fix(esm): improve ESM compatibility and modernize package configuration
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"@ship.zone/szci": {
|
||||
"npmGlobalTools": [],
|
||||
"npmRegistryUrl": "registry.npmjs.org"
|
||||
},
|
||||
"@git.zone/cli": {
|
||||
"projectType": "npm",
|
||||
"module": {
|
||||
"githost": "code.foss.global",
|
||||
"gitscope": "push.rocks",
|
||||
"gitrepo": "smartspawn",
|
||||
"shortDescription": "smart subprocess handling",
|
||||
"description": "A node module for smart subprocess handling with support for promises and streamlined subprocess communication.",
|
||||
"npmPackagename": "@push.rocks/smartspawn",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"subprocess",
|
||||
"child_process",
|
||||
"spawn",
|
||||
"threading",
|
||||
"multithreading",
|
||||
"process management",
|
||||
"async",
|
||||
"promise"
|
||||
]
|
||||
},
|
||||
"release": {
|
||||
"registries": [
|
||||
"https://verdaccio.lossless.digital",
|
||||
"https://registry.npmjs.org"
|
||||
],
|
||||
"accessLevel": "public"
|
||||
}
|
||||
},
|
||||
"@git.zone/tsdoc": {
|
||||
"legal": "\n## License and Legal Information\n\nThis repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. \n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
# Changelog
|
||||
|
||||
## 2026-05-01 - 3.0.4 - fix(esm)
|
||||
improve ESM compatibility and modernize package configuration
|
||||
|
||||
- replace direct CommonJS-style imports of threads and spawn-wrap with createRequire-based loading for NodeNext compatibility
|
||||
- update internal path handling to derive package paths from import.meta.url instead of __dirname
|
||||
- add package exports entry, tighten TypeScript settings, and refresh test/tooling configuration for the current build setup
|
||||
|
||||
## 2026-03-01 - 3.0.3 - maintenance
|
||||
Released 3.0.3 with repository and metadata housekeeping updates.
|
||||
|
||||
- Removed the GitLab CI configuration.
|
||||
- Updated the project description.
|
||||
- Included minor maintenance-only changes across the 3.0.3 release line.
|
||||
|
||||
## 2024-05-14 - 3.0.2 - core
|
||||
Delivered a core update in 3.0.2 with additional configuration maintenance.
|
||||
|
||||
- Updated core functionality.
|
||||
- Refreshed TypeScript configuration.
|
||||
- Updated npm metadata for git host settings.
|
||||
- Summarizes minor maintenance commits within the 3.0.2 release range.
|
||||
|
||||
## 2022-07-28 - 3.0.0 - core
|
||||
Released the 3.x line with a breaking module-system migration and follow-up core fixes through 3.0.1–3.0.2.
|
||||
|
||||
- Switched the package to ESM as a breaking change.
|
||||
- Applied core update fixes in 3.0.0, 3.0.1, and 3.0.2.
|
||||
- Summarizes the trivial version-tag commits across versions 3.0.0 through 3.0.2.
|
||||
|
||||
## 2019-08-22 - 2.0.9 - core
|
||||
Delivered a sequence of core maintenance releases from 2.0.3 through 2.0.9.
|
||||
|
||||
- Applied repeated core update fixes across versions 2.0.3, 2.0.4, 2.0.5, 2.0.6, 2.0.7, and 2.0.8.
|
||||
- Released 2.0.9 as the latest point in this maintenance range.
|
||||
- Summarizes trivial version-only commits across versions 2.0.3 through 2.0.9.
|
||||
|
||||
## 2018-08-07 - 2.0.0 - package
|
||||
Released 2.0.0 with package-level breaking and follow-up maintenance changes through 2.0.2.
|
||||
|
||||
- Introduced a breaking package scope change in the lead-up to 2.0.0.
|
||||
- Updated npm access level for the package.
|
||||
- Updated the testing framework in 2.0.1.
|
||||
- Summarizes trivial version-only commits across versions 2.0.0 through 2.0.2.
|
||||
|
||||
## 2017-11-28 - 1.0.9 - maintenance
|
||||
Published maintenance updates across versions 1.0.9 through 1.0.11.
|
||||
|
||||
- Updated the project to align with newer standards.
|
||||
- Refreshed CI configuration.
|
||||
- Summarizes trivial version-only commits across versions 1.0.9 through 1.0.11.
|
||||
|
||||
## 2017-03-04 - 1.0.4 - core
|
||||
Expanded core threading and API capabilities across versions 1.0.4 through 1.0.8.
|
||||
|
||||
- Added simple forking support with `threadsimple`.
|
||||
- Changed `ThreadSimple` to return a Promise.
|
||||
- Improved typings.
|
||||
- Added `forkOptions`.
|
||||
- Added `argvArgs` support to `simpleThread`.
|
||||
- Included an update to wrapping behavior.
|
||||
- Summarizes trivial version-only commits across versions 1.0.4 through 1.0.8.
|
||||
|
||||
## 2017-03-03 - 1.0.2 - maintenance
|
||||
Delivered early maintenance improvements across versions 1.0.2 and 1.0.3.
|
||||
|
||||
- Updated internal `smartipc` code.
|
||||
- Updated the README.
|
||||
- Added `npmts` as a required global CI tool.
|
||||
- Summarizes trivial version-only commits across versions 1.0.2 through 1.0.3.
|
||||
|
||||
## 2017-01-29 - 1.0.0 - core
|
||||
Initial release of the project with foundational functionality and setup work through 1.0.1.
|
||||
|
||||
- Added the initial basic functionality.
|
||||
- Started the implementation and merged initial development work.
|
||||
- Added and improved the README.
|
||||
- Added GitLab CI configuration.
|
||||
- Switched to native IPC to reduce dependencies.
|
||||
- Summarizes trivial release-tag and documentation-only follow-up commits across versions 1.0.0 and 1.0.1.
|
||||
@@ -0,0 +1,19 @@
|
||||
Copyright (c) 2026 Task Venture Capital GmbH <hello@task.vc>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
+13
-10
@@ -1,19 +1,15 @@
|
||||
{
|
||||
"npmts": {
|
||||
"testTs": {
|
||||
"./test/*.ts": "./test/"
|
||||
}
|
||||
},
|
||||
"npmci": {
|
||||
"@ship.zone/szci": {
|
||||
"npmGlobalTools": [],
|
||||
"npmAccessLevel": "public"
|
||||
"npmRegistryUrl": "registry.npmjs.org"
|
||||
},
|
||||
"gitzone": {
|
||||
"@git.zone/cli": {
|
||||
"projectType": "npm",
|
||||
"module": {
|
||||
"githost": "code.foss.global",
|
||||
"gitscope": "push.rocks",
|
||||
"gitrepo": "smartspawn",
|
||||
"shortDescription": "smart subprocess handling",
|
||||
"description": "A node module for smart subprocess handling with support for promises and streamlined subprocess communication.",
|
||||
"npmPackagename": "@push.rocks/smartspawn",
|
||||
"license": "MIT",
|
||||
@@ -27,9 +23,16 @@
|
||||
"async",
|
||||
"promise"
|
||||
]
|
||||
},
|
||||
"release": {
|
||||
"registries": [
|
||||
"https://verdaccio.lossless.digital",
|
||||
"https://registry.npmjs.org"
|
||||
],
|
||||
"accessLevel": "public"
|
||||
}
|
||||
},
|
||||
"tsdoc": {
|
||||
"@git.zone/tsdoc": {
|
||||
"legal": "\n## License and Legal Information\n\nThis repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. \n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+16
-13
@@ -3,36 +3,37 @@
|
||||
"version": "3.0.3",
|
||||
"private": false,
|
||||
"description": "A node module for smart subprocess handling with support for promises and streamlined subprocess communication.",
|
||||
"exports": {
|
||||
".": "./dist_ts/index.js"
|
||||
},
|
||||
"main": "dist_ts/index.js",
|
||||
"typings": "dist_ts/index.d.ts",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"test": "(tstest test/)",
|
||||
"build": "(tsbuild --web --allowimplicitany)",
|
||||
"test": "tstest test/",
|
||||
"build": "tsbuild",
|
||||
"buildDocs": "tsdoc"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://code.foss.global/push.rocks/smartspawn.git"
|
||||
},
|
||||
"author": "Lossless GmbH",
|
||||
"author": "Task Venture Capital GmbH <hello@task.vc>",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://gitlab.com/pushrocks/smartipc/issues"
|
||||
"url": "https://code.foss.global/push.rocks/smartspawn/issues"
|
||||
},
|
||||
"homepage": "https://code.foss.global/push.rocks/smartspawn",
|
||||
"dependencies": {
|
||||
"@push.rocks/smartpromise": "^4.0.3",
|
||||
"spawn-wrap": "^2.0.0",
|
||||
"@push.rocks/smartpromise": "^4.2.4",
|
||||
"spawn-wrap": "^3.0.0",
|
||||
"threads": "1.7.0",
|
||||
"tiny-worker": "^2.2.0"
|
||||
"tiny-worker": "^2.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@git.zone/tsbuild": "^2.1.11",
|
||||
"@git.zone/tsrun": "^1.2.8",
|
||||
"@git.zone/tstest": "^1.0.24",
|
||||
"@push.rocks/tapbundle": "^5.0.4",
|
||||
"@types/node": "^20.12.12"
|
||||
"@git.zone/tsbuild": "^4.4.0",
|
||||
"@git.zone/tstest": "^3.6.3",
|
||||
"@types/node": "^25.6.0"
|
||||
},
|
||||
"files": [
|
||||
"ts/**/*",
|
||||
@@ -43,6 +44,8 @@
|
||||
"dist_ts_web/**/*",
|
||||
"assets/**/*",
|
||||
"cli.js",
|
||||
".smartconfig.json",
|
||||
"license",
|
||||
"npmextra.json",
|
||||
"readme.md"
|
||||
],
|
||||
@@ -59,4 +62,4 @@
|
||||
"async",
|
||||
"promise"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Generated
+4927
-3542
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
||||
import { expect, tap } from '@push.rocks/tapbundle';
|
||||
import { expect, tap } from '@git.zone/tstest/tapbundle';
|
||||
|
||||
import * as smartspawn from '../ts/index.js';
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
* autocreated commitinfo by @pushrocks/commitinfo
|
||||
* autocreated commitinfo by @push.rocks/commitinfo
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@push.rocks/smartspawn',
|
||||
version: '3.0.3',
|
||||
version: '3.0.4',
|
||||
description: 'A node module for smart subprocess handling with support for promises and streamlined subprocess communication.'
|
||||
}
|
||||
|
||||
+30
-1
@@ -1,4 +1,33 @@
|
||||
export * from './smartspawn.classes.threadsimple.js';
|
||||
export * from './smartspawn.wrap.js';
|
||||
|
||||
export * from 'threads';
|
||||
import { createRequire } from 'module';
|
||||
|
||||
const require = createRequire(import.meta.url);
|
||||
|
||||
export interface IThreadsModule {
|
||||
BlobWorker: new (...args: unknown[]) => unknown;
|
||||
DefaultSerializer: unknown;
|
||||
Pool: unknown;
|
||||
Thread: {
|
||||
terminate: (threadArg: unknown) => Promise<void> | void;
|
||||
events?: (threadArg: unknown) => unknown;
|
||||
};
|
||||
Transfer: (payloadArg: unknown, transferablesArg?: Transferable[]) => unknown;
|
||||
Worker: new (workerPathArg: string | URL, optionsArg?: unknown) => unknown;
|
||||
registerSerializer: (serializerArg: unknown) => void;
|
||||
spawn: <T = unknown>(workerArg: unknown, optionsArg?: unknown) => Promise<T>;
|
||||
}
|
||||
|
||||
const threads = require('threads') as IThreadsModule;
|
||||
|
||||
export const {
|
||||
BlobWorker,
|
||||
DefaultSerializer,
|
||||
Pool,
|
||||
Thread,
|
||||
Transfer,
|
||||
Worker,
|
||||
registerSerializer,
|
||||
spawn,
|
||||
} = threads;
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
import * as plugins from './smartspawn.plugins.js';
|
||||
import * as smartpromise from '@push.rocks/smartpromise';
|
||||
import * as childProcess from 'child_process';
|
||||
|
||||
export class ThreadSimple {
|
||||
public workerPath: string;
|
||||
public threadChildProcess: childProcess.ChildProcess;
|
||||
public threadChildProcess!: childProcess.ChildProcess;
|
||||
public forkOptions: childProcess.ForkOptions;
|
||||
public argvArgs: string[];
|
||||
constructor(
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as plugins from './smartspawn.plugins.js';
|
||||
|
||||
export const packageBase = plugins.path.join(__dirname, '../');
|
||||
export const packageBase = plugins.path.join(plugins.path.dirname(plugins.url.fileURLToPath(import.meta.url)), '../');
|
||||
export const typescriptwrapJs = plugins.path.join(packageBase, 'assets/typescriptwrap.js');
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import * as path from 'path';
|
||||
import * as threads from 'threads';
|
||||
import * as url from 'url';
|
||||
import * as smartpromise from '@push.rocks/smartpromise';
|
||||
|
||||
export { path, smartpromise, threads };
|
||||
export { path, smartpromise, url };
|
||||
|
||||
@@ -1,8 +1,14 @@
|
||||
import * as spawnWrap from 'spawn-wrap';
|
||||
import { createRequire } from 'module';
|
||||
|
||||
let unwrap: any = null;
|
||||
const require = createRequire(import.meta.url);
|
||||
const spawnWrap = require('spawn-wrap') as (
|
||||
spawnArgvArg: string[],
|
||||
envArg?: NodeJS.ProcessEnv,
|
||||
) => () => void;
|
||||
|
||||
export const startSpawnWrap = (filePath: string, cliArgs: string[] = [], envArgs: any = {}) => {
|
||||
let unwrap: (() => void) | null = null;
|
||||
|
||||
export const startSpawnWrap = (filePath: string, cliArgs: string[] = [], envArgs: NodeJS.ProcessEnv = {}) => {
|
||||
const spawnArray = [filePath];
|
||||
for (const cliArg of cliArgs) {
|
||||
spawnArray.push(cliArg);
|
||||
|
||||
+3
-1
@@ -5,8 +5,10 @@
|
||||
"target": "ES2022",
|
||||
"module": "NodeNext",
|
||||
"moduleResolution": "NodeNext",
|
||||
"noImplicitAny": true,
|
||||
"esModuleInterop": true,
|
||||
"verbatimModuleSyntax": true
|
||||
"verbatimModuleSyntax": true,
|
||||
"types": ["node"]
|
||||
},
|
||||
"exclude": [
|
||||
"dist_*/**/*.d.ts"
|
||||
|
||||
Reference in New Issue
Block a user