@theia/application-manager 1.74.0-next.15 → 1.74.0-next.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/application-process.d.ts +2 -0
- package/lib/application-process.d.ts.map +1 -1
- package/lib/application-process.js +16 -5
- package/lib/application-process.js.map +1 -1
- package/lib/application-process.spec.d.ts +2 -0
- package/lib/application-process.spec.d.ts.map +1 -0
- package/lib/application-process.spec.js +41 -0
- package/lib/application-process.spec.js.map +1 -0
- package/package.json +13 -13
- package/src/application-process.spec.ts +46 -0
- package/src/application-process.ts +18 -5
|
@@ -9,6 +9,8 @@ export declare class ApplicationProcess {
|
|
|
9
9
|
};
|
|
10
10
|
constructor(pck: ApplicationPackage, binProjectPath: string);
|
|
11
11
|
spawn(command: string, args?: string[], options?: cp.SpawnOptions): cp.ChildProcess;
|
|
12
|
+
protected buildCommandLine(command: string, args: string[]): string;
|
|
13
|
+
protected quoteArg(arg: string): string;
|
|
12
14
|
fork(modulePath: string, args?: string[], options?: cp.ForkOptions): cp.ChildProcess;
|
|
13
15
|
canRun(command: string): boolean;
|
|
14
16
|
run(command: string, args: string[], options?: cp.SpawnOptions): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"application-process.d.ts","sourceRoot":"","sources":["../src/application-process.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,MAAM,eAAe,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhE,qBAAa,kBAAkB;IAQvB,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE,kBAAkB;IAC1C,SAAS,CAAC,QAAQ,CAAC,cAAc,EAAE,MAAM;IAP7C,SAAS,CAAC,QAAQ,CAAC,cAAc;;;MAG/B;gBAGqB,GAAG,EAAE,kBAAkB,EACvB,cAAc,EAAE,MAAM;IAG7C,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE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YAAY;IAQrF,SAAS,CAAC,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAe3E,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;CAmBhE"}
|
|
@@ -29,11 +29,25 @@ class ApplicationProcess {
|
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
31
|
spawn(command, args, options) {
|
|
32
|
-
|
|
32
|
+
// Build a single quoted command line rather than passing an args array together with `shell: true`.
|
|
33
|
+
// Node.js 24 deprecates the latter (DEP0190) because it does not escape the arguments.
|
|
34
|
+
const commandLine = this.buildCommandLine(command, args || []);
|
|
35
|
+
return cp.spawn(commandLine, [], Object.assign({}, this.defaultOptions, {
|
|
33
36
|
...options,
|
|
34
37
|
shell: true
|
|
35
38
|
}));
|
|
36
39
|
}
|
|
40
|
+
buildCommandLine(command, args) {
|
|
41
|
+
return [command, ...args].map(arg => this.quoteArg(arg)).join(' ');
|
|
42
|
+
}
|
|
43
|
+
quoteArg(arg) {
|
|
44
|
+
if (process.platform === 'win32') {
|
|
45
|
+
// cmd.exe: wrap in double quotes and escape embedded double quotes by doubling them.
|
|
46
|
+
return `"${arg.replace(/"/g, '""')}"`;
|
|
47
|
+
}
|
|
48
|
+
// POSIX shell: single-quote and escape embedded single quotes (' becomes '\'').
|
|
49
|
+
return `'${arg.replace(/'/g, '\'\\\'\'')}'`;
|
|
50
|
+
}
|
|
37
51
|
fork(modulePath, args, options) {
|
|
38
52
|
return cp.fork(modulePath, args, Object.assign({}, this.defaultOptions, options));
|
|
39
53
|
}
|
|
@@ -50,10 +64,7 @@ class ApplicationProcess {
|
|
|
50
64
|
if (!binPath) {
|
|
51
65
|
throw new Error(`Could not resolve ${command} relative to ${this.binProjectPath}`);
|
|
52
66
|
}
|
|
53
|
-
return this.spawn(binPath, args,
|
|
54
|
-
...options,
|
|
55
|
-
shell: true
|
|
56
|
-
});
|
|
67
|
+
return this.spawn(binPath, args, options);
|
|
57
68
|
}
|
|
58
69
|
resolveBin(rootPath, command) {
|
|
59
70
|
let commandPath = path.resolve(rootPath, 'node_modules', '.bin', command);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"application-process.js","sourceRoot":"","sources":["../src/application-process.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;AAEhF,6BAA6B;AAC7B,+BAA+B;AAC/B,oCAAoC;AAGpC,MAAa,kBAAkB;IAO3B,YACuB,GAAuB,EACvB,cAAsB;QADtB,QAAG,GAAH,GAAG,CAAoB;QACvB,mBAAc,GAAd,cAAc,CAAQ;QAP1B,mBAAc,GAAG;YAChC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,WAAW;YACzB,GAAG,EAAE,OAAO,CAAC,GAAG;SACnB,CAAC;IAKE,CAAC;IAEL,KAAK,CAAC,OAAe,EAAE,IAAe,EAAE,OAAyB;QAC7D,
|
|
1
|
+
{"version":3,"file":"application-process.js","sourceRoot":"","sources":["../src/application-process.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;AAEhF,6BAA6B;AAC7B,+BAA+B;AAC/B,oCAAoC;AAGpC,MAAa,kBAAkB;IAO3B,YACuB,GAAuB,EACvB,cAAsB;QADtB,QAAG,GAAH,GAAG,CAAoB;QACvB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
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2026 EclipseSource and others.
|
|
4
|
+
//
|
|
5
|
+
// This program and the accompanying materials are made available under the
|
|
6
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
//
|
|
9
|
+
// This Source Code may also be made available under the following Secondary
|
|
10
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
// with the GNU Classpath Exception which is available at
|
|
13
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
//
|
|
15
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
+
// *****************************************************************************
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
const chai_1 = require("chai");
|
|
19
|
+
const application_process_1 = require("./application-process");
|
|
20
|
+
describe('ApplicationProcess', () => {
|
|
21
|
+
function createProcess() {
|
|
22
|
+
// Only `projectPath` is needed for `spawn`'s working directory.
|
|
23
|
+
const pck = { projectPath: process.cwd() };
|
|
24
|
+
return new application_process_1.ApplicationProcess(pck, '');
|
|
25
|
+
}
|
|
26
|
+
it('should pass arguments containing spaces and shell metacharacters through intact', async () => {
|
|
27
|
+
const applicationProcess = createProcess();
|
|
28
|
+
const testArgs = ['hello world', 'a&b', 'c;d', 'quote"inside'];
|
|
29
|
+
// Print each received argument on its own line so we can compare with the input.
|
|
30
|
+
const script = 'process.stdout.write(process.argv.slice(1).join(String.fromCharCode(10)))';
|
|
31
|
+
const child = applicationProcess.spawn(process.execPath, ['-e', script, ...testArgs]);
|
|
32
|
+
let stdout = '';
|
|
33
|
+
child.stdout.on('data', data => stdout += data.toString());
|
|
34
|
+
await new Promise((resolve, reject) => {
|
|
35
|
+
child.on('error', reject);
|
|
36
|
+
child.on('close', () => resolve());
|
|
37
|
+
});
|
|
38
|
+
(0, chai_1.expect)(stdout).to.equal(testArgs.join('\n'));
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
//# sourceMappingURL=application-process.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"application-process.spec.js","sourceRoot":"","sources":["../src/application-process.spec.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,+CAA+C;AAC/C,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;AAEhF,+BAA8B;AAC9B,+DAA2D;AAG3D,QAAQ,CAAC,oBAAoB,EAAE,GAAG,EAAE;IAEhC,SAAS,aAAa;QAClB,gEAAgE;QAChE,MAAM,GAAG,GAAG,EAAE,WAAW,EAAE,OAAO,CAAC,GAAG,EAAE,EAAwB,CAAC;QACjE,OAAO,IAAI,wCAAkB,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IAC3C,CAAC;IAED,EAAE,CAAC,iFAAiF,EAAE,KAAK,IAAI,EAAE;QAC7F,MAAM,kBAAkB,GAAG,aAAa,EAAE,CAAC;QAC3C,MAAM,QAAQ,GAAG,CAAC,aAAa,EAAE,KAAK,EAAE,KAAK,EAAE,cAAc,CAAC,CAAC;QAC/D,iFAAiF;QACjF,MAAM,MAAM,GAAG,2EAA2E,CAAC;QAE3F,MAAM,KAAK,GAAG,kBAAkB,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,QAAQ,CAAC,CAAC,CAAC;QACtF,IAAI,MAAM,GAAG,EAAE,CAAC;QAChB,KAAK,CAAC,MAAO,CAAC,EAAE,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC,MAAM,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;QAE5D,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACxC,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;YAC1B,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC;QACvC,CAAC,CAAC,CAAC;QAEH,IAAA,aAAM,EAAC,MAAM,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACjD,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theia/application-manager",
|
|
3
|
-
"version": "1.74.0-next.
|
|
3
|
+
"version": "1.74.0-next.29+5ef180bee",
|
|
4
4
|
"description": "Theia application manager API.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -33,20 +33,20 @@
|
|
|
33
33
|
"@babel/plugin-transform-classes": "^7.29.7",
|
|
34
34
|
"@babel/plugin-transform-runtime": "^7.29.7",
|
|
35
35
|
"@babel/preset-env": "^7.29.7",
|
|
36
|
-
"@electron/rebuild": "^4.0
|
|
37
|
-
"@theia/application-package": "1.74.0-next.
|
|
38
|
-
"@theia/bundle-plugin": "1.74.0-next.
|
|
39
|
-
"@theia/ffmpeg": "1.74.0-next.
|
|
36
|
+
"@electron/rebuild": "^4.1.0",
|
|
37
|
+
"@theia/application-package": "1.74.0-next.29+5ef180bee",
|
|
38
|
+
"@theia/bundle-plugin": "1.74.0-next.29+5ef180bee",
|
|
39
|
+
"@theia/ffmpeg": "1.74.0-next.29+5ef180bee",
|
|
40
40
|
"@types/fs-extra": "^4.0.15",
|
|
41
41
|
"@types/semver": "^7.7.1",
|
|
42
42
|
"babel-loader": "^8.4.1",
|
|
43
43
|
"buffer": "^6.0.3",
|
|
44
|
-
"compression-webpack-plugin": "^
|
|
45
|
-
"copy-webpack-plugin": "^
|
|
44
|
+
"compression-webpack-plugin": "^12.0.0",
|
|
45
|
+
"copy-webpack-plugin": "^14.0.0",
|
|
46
46
|
"css-loader": "^6.11.0",
|
|
47
|
-
"esbuild": "^0.
|
|
47
|
+
"esbuild": "^0.28.0",
|
|
48
48
|
"esbuild-plugin-copy": "^2.1.1",
|
|
49
|
-
"esbuild-plugins-node-modules-polyfill": "^1.8.
|
|
49
|
+
"esbuild-plugins-node-modules-polyfill": "^1.8.2",
|
|
50
50
|
"fs-extra": "^4.0.3",
|
|
51
51
|
"http-server": "^14.1.1",
|
|
52
52
|
"ignore-loader": "^0.1.2",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"mini-css-extract-plugin": "^2.10.2",
|
|
55
55
|
"node-loader": "^2.1.0",
|
|
56
56
|
"path-browserify": "^1.0.1",
|
|
57
|
-
"semver": "^7.8.
|
|
57
|
+
"semver": "^7.8.5",
|
|
58
58
|
"source-map": "^0.6.1",
|
|
59
59
|
"source-map-loader": "^2.0.2",
|
|
60
60
|
"source-map-support": "^0.5.21",
|
|
@@ -62,10 +62,10 @@
|
|
|
62
62
|
"style-loader": "^2.0.0",
|
|
63
63
|
"tslib": "^2.8.1",
|
|
64
64
|
"umd-compat-loader": "^2.1.2",
|
|
65
|
-
"webpack": "^5.
|
|
65
|
+
"webpack": "^5.108.3",
|
|
66
66
|
"webpack-cli": "4.7.0",
|
|
67
67
|
"worker-loader": "^3.0.8",
|
|
68
|
-
"yargs": "^17.7.
|
|
68
|
+
"yargs": "^17.7.3"
|
|
69
69
|
},
|
|
70
70
|
"peerDependencies": {
|
|
71
71
|
"@theia/electron": "*"
|
|
@@ -81,5 +81,5 @@
|
|
|
81
81
|
"nyc": {
|
|
82
82
|
"extends": "../../configs/nyc.json"
|
|
83
83
|
},
|
|
84
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "5ef180bee6397858bc244d20ca2f35fb1fa360ac"
|
|
85
85
|
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2026 EclipseSource and others.
|
|
3
|
+
//
|
|
4
|
+
// This program and the accompanying materials are made available under the
|
|
5
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
//
|
|
8
|
+
// This Source Code may also be made available under the following Secondary
|
|
9
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
// with the GNU Classpath Exception which is available at
|
|
12
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
//
|
|
14
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
|
|
17
|
+
import { expect } from 'chai';
|
|
18
|
+
import { ApplicationProcess } from './application-process';
|
|
19
|
+
import { ApplicationPackage } from '@theia/application-package';
|
|
20
|
+
|
|
21
|
+
describe('ApplicationProcess', () => {
|
|
22
|
+
|
|
23
|
+
function createProcess(): ApplicationProcess {
|
|
24
|
+
// Only `projectPath` is needed for `spawn`'s working directory.
|
|
25
|
+
const pck = { projectPath: process.cwd() } as ApplicationPackage;
|
|
26
|
+
return new ApplicationProcess(pck, '');
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
it('should pass arguments containing spaces and shell metacharacters through intact', async () => {
|
|
30
|
+
const applicationProcess = createProcess();
|
|
31
|
+
const testArgs = ['hello world', 'a&b', 'c;d', 'quote"inside'];
|
|
32
|
+
// Print each received argument on its own line so we can compare with the input.
|
|
33
|
+
const script = 'process.stdout.write(process.argv.slice(1).join(String.fromCharCode(10)))';
|
|
34
|
+
|
|
35
|
+
const child = applicationProcess.spawn(process.execPath, ['-e', script, ...testArgs]);
|
|
36
|
+
let stdout = '';
|
|
37
|
+
child.stdout!.on('data', data => stdout += data.toString());
|
|
38
|
+
|
|
39
|
+
await new Promise<void>((resolve, reject) => {
|
|
40
|
+
child.on('error', reject);
|
|
41
|
+
child.on('close', () => resolve());
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
expect(stdout).to.equal(testArgs.join('\n'));
|
|
45
|
+
});
|
|
46
|
+
});
|
|
@@ -32,12 +32,28 @@ export class ApplicationProcess {
|
|
|
32
32
|
) { }
|
|
33
33
|
|
|
34
34
|
spawn(command: string, args?: string[], options?: cp.SpawnOptions): cp.ChildProcess {
|
|
35
|
-
|
|
35
|
+
// Build a single quoted command line rather than passing an args array together with `shell: true`.
|
|
36
|
+
// Node.js 24 deprecates the latter (DEP0190) because it does not escape the arguments.
|
|
37
|
+
const commandLine = this.buildCommandLine(command, args || []);
|
|
38
|
+
return cp.spawn(commandLine, [], Object.assign({}, this.defaultOptions, {
|
|
36
39
|
...options,
|
|
37
40
|
shell: true
|
|
38
41
|
}));
|
|
39
42
|
}
|
|
40
43
|
|
|
44
|
+
protected buildCommandLine(command: string, args: string[]): string {
|
|
45
|
+
return [command, ...args].map(arg => this.quoteArg(arg)).join(' ');
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
protected quoteArg(arg: string): string {
|
|
49
|
+
if (process.platform === 'win32') {
|
|
50
|
+
// cmd.exe: wrap in double quotes and escape embedded double quotes by doubling them.
|
|
51
|
+
return `"${arg.replace(/"/g, '""')}"`;
|
|
52
|
+
}
|
|
53
|
+
// POSIX shell: single-quote and escape embedded single quotes (' becomes '\'').
|
|
54
|
+
return `'${arg.replace(/'/g, '\'\\\'\'')}'`;
|
|
55
|
+
}
|
|
56
|
+
|
|
41
57
|
fork(modulePath: string, args?: string[], options?: cp.ForkOptions): cp.ChildProcess {
|
|
42
58
|
return cp.fork(modulePath, args, Object.assign({}, this.defaultOptions, options));
|
|
43
59
|
}
|
|
@@ -57,10 +73,7 @@ export class ApplicationProcess {
|
|
|
57
73
|
if (!binPath) {
|
|
58
74
|
throw new Error(`Could not resolve ${command} relative to ${this.binProjectPath}`);
|
|
59
75
|
}
|
|
60
|
-
return this.spawn(binPath, args,
|
|
61
|
-
...options,
|
|
62
|
-
shell: true
|
|
63
|
-
});
|
|
76
|
+
return this.spawn(binPath, args, options);
|
|
64
77
|
}
|
|
65
78
|
|
|
66
79
|
protected resolveBin(rootPath: string, command: string): string | undefined {
|