fix(plugins): Export child_process.spawn from plugins and use plugins.spawn in spawnPath to remove direct require and unify process spawning
This commit is contained in:
@@ -1,5 +1,12 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 2025-10-17 - 1.6.1 - fix(plugins)
|
||||||
|
Export child_process.spawn from plugins and use plugins.spawn in spawnPath to remove direct require and unify process spawning
|
||||||
|
|
||||||
|
- Exported spawn from ts/plugins.ts so native child_process.spawn is available via the plugins module
|
||||||
|
- Removed require('child_process') from ts/index.ts and switched to plugins.spawn when spawning child processes in spawnPath
|
||||||
|
- No public API changes; this unifies internal imports and fixes inconsistent spawn usage that could cause runtime issues
|
||||||
|
|
||||||
## 2025-10-17 - 1.6.0 - feat(core)
|
## 2025-10-17 - 1.6.0 - feat(core)
|
||||||
Add spawnPath child-process API with timeout/abort/terminate support, export native types, and expand README
|
Add spawnPath child-process API with timeout/abort/terminate support, export native types, and expand README
|
||||||
|
|
||||||
|
@@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@git.zone/tsrun',
|
name: '@git.zone/tsrun',
|
||||||
version: '1.6.0',
|
version: '1.6.1',
|
||||||
description: 'run typescript programs efficiently'
|
description: 'run typescript programs efficiently'
|
||||||
}
|
}
|
||||||
|
@@ -159,8 +159,6 @@ export const spawnPath = (
|
|||||||
fromFileUrl?: string | URL,
|
fromFileUrl?: string | URL,
|
||||||
options?: ISpawnOptions
|
options?: ISpawnOptions
|
||||||
): ITsrunChildProcess => {
|
): ITsrunChildProcess => {
|
||||||
const { spawn } = require('child_process');
|
|
||||||
|
|
||||||
// 1. Resolve path (similar to runPath)
|
// 1. Resolve path (similar to runPath)
|
||||||
const resolvedPath = fromFileUrl
|
const resolvedPath = fromFileUrl
|
||||||
? plugins.path.join(
|
? plugins.path.join(
|
||||||
@@ -192,7 +190,7 @@ export const spawnPath = (
|
|||||||
};
|
};
|
||||||
|
|
||||||
// 4. Spawn child process
|
// 4. Spawn child process
|
||||||
const child = spawn(process.execPath, args, spawnOptions);
|
const child = plugins.spawn(process.execPath, args, spawnOptions);
|
||||||
|
|
||||||
// 5. Set up timeout if provided
|
// 5. Set up timeout if provided
|
||||||
let timeoutId: NodeJS.Timeout | undefined;
|
let timeoutId: NodeJS.Timeout | undefined;
|
||||||
|
@@ -1,10 +1,11 @@
|
|||||||
// node native
|
// node native
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import * as url from 'url';
|
import * as url from 'url';
|
||||||
|
import { spawn } from 'child_process';
|
||||||
import type { ChildProcess } from 'child_process';
|
import type { ChildProcess } from 'child_process';
|
||||||
import type { Readable } from 'stream';
|
import type { Readable } from 'stream';
|
||||||
|
|
||||||
export { path, url };
|
export { path, url, spawn };
|
||||||
export type { ChildProcess, Readable };
|
export type { ChildProcess, Readable };
|
||||||
|
|
||||||
// @pushrocks scope
|
// @pushrocks scope
|
||||||
|
Reference in New Issue
Block a user