@lark-codem/codem-core 0.8.25-dev.100101066390.0.g539f76d → 0.8.25
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/bin/lib/launch.js +2 -1
- package/bin/lib/runtime-env.js +15 -0
- package/bin/linco +10 -0
- package/package.json +7 -7
package/bin/lib/launch.js
CHANGED
|
@@ -66,6 +66,7 @@ function reportFatal({ error, binary, platform, stderr, exit }) {
|
|
|
66
66
|
function launch({
|
|
67
67
|
binary,
|
|
68
68
|
args,
|
|
69
|
+
env,
|
|
69
70
|
stdio,
|
|
70
71
|
platform = process.platform,
|
|
71
72
|
spawnImpl = require("node:child_process").spawn,
|
|
@@ -73,7 +74,7 @@ function launch({
|
|
|
73
74
|
exit = (code) => process.exit(code),
|
|
74
75
|
}) {
|
|
75
76
|
const attempt = (stdioForAttempt) =>
|
|
76
|
-
spawnImpl(binary, args, { stdio: stdioForAttempt, windowsHide: true });
|
|
77
|
+
spawnImpl(binary, args, { env, stdio: stdioForAttempt, windowsHide: true });
|
|
77
78
|
|
|
78
79
|
let child;
|
|
79
80
|
try {
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const path = require("node:path");
|
|
4
|
+
|
|
5
|
+
const PLUGIN_NODE_ENV = "CODEM_PLUGIN_NODE";
|
|
6
|
+
|
|
7
|
+
function buildRuntimeEnvironment(base, processExecutable) {
|
|
8
|
+
const configured = base[PLUGIN_NODE_ENV] || processExecutable;
|
|
9
|
+
if (!path.isAbsolute(configured)) {
|
|
10
|
+
throw new Error(`${PLUGIN_NODE_ENV} must be an absolute executable path: ${configured}`);
|
|
11
|
+
}
|
|
12
|
+
return { ...base, [PLUGIN_NODE_ENV]: configured };
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
module.exports = { buildRuntimeEnvironment, PLUGIN_NODE_ENV };
|
package/bin/linco
CHANGED
|
@@ -6,6 +6,7 @@ const { detectTarget } = require("./lib/detect-target");
|
|
|
6
6
|
const { resolvePlatformBinary } = require("./lib/resolve-binary");
|
|
7
7
|
const { buildStdio } = require("./lib/control-fd");
|
|
8
8
|
const { launch } = require("./lib/launch");
|
|
9
|
+
const { buildRuntimeEnvironment } = require("./lib/runtime-env");
|
|
9
10
|
|
|
10
11
|
function main() {
|
|
11
12
|
let target;
|
|
@@ -33,9 +34,18 @@ function main() {
|
|
|
33
34
|
|
|
34
35
|
// Not a bare `stdio: "inherit"`: that is three slots and would drop the /space
|
|
35
36
|
// control fd codem-bridge passes as fd 3. See lib/control-fd.js.
|
|
37
|
+
let environment;
|
|
38
|
+
try {
|
|
39
|
+
environment = buildRuntimeEnvironment(process.env, process.execPath);
|
|
40
|
+
} catch (error) {
|
|
41
|
+
console.error(`linco: ${error.message}`);
|
|
42
|
+
process.exit(1);
|
|
43
|
+
}
|
|
44
|
+
|
|
36
45
|
const child = launch({
|
|
37
46
|
binary,
|
|
38
47
|
args: process.argv.slice(2),
|
|
48
|
+
env: environment,
|
|
39
49
|
stdio: buildStdio(),
|
|
40
50
|
});
|
|
41
51
|
if (!child) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lark-codem/codem-core",
|
|
3
|
-
"version": "0.8.25
|
|
3
|
+
"version": "0.8.25",
|
|
4
4
|
"description": "CodeM CLI.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"bin": {
|
|
@@ -11,12 +11,12 @@
|
|
|
11
11
|
"LICENSE"
|
|
12
12
|
],
|
|
13
13
|
"optionalDependencies": {
|
|
14
|
-
"@lark-codem/codem-core-darwin-arm64": "0.8.25
|
|
15
|
-
"@lark-codem/codem-core-darwin-x64": "0.8.25
|
|
16
|
-
"@lark-codem/codem-core-linux-x64-gnu": "0.8.25
|
|
17
|
-
"@lark-codem/codem-core-linux-arm64-gnu": "0.8.25
|
|
18
|
-
"@lark-codem/codem-core-win32-arm64-gnu": "0.8.25
|
|
19
|
-
"@lark-codem/codem-core-win32-x64-msvc": "0.8.25
|
|
14
|
+
"@lark-codem/codem-core-darwin-arm64": "0.8.25",
|
|
15
|
+
"@lark-codem/codem-core-darwin-x64": "0.8.25",
|
|
16
|
+
"@lark-codem/codem-core-linux-x64-gnu": "0.8.25",
|
|
17
|
+
"@lark-codem/codem-core-linux-arm64-gnu": "0.8.25",
|
|
18
|
+
"@lark-codem/codem-core-win32-arm64-gnu": "0.8.25",
|
|
19
|
+
"@lark-codem/codem-core-win32-x64-msvc": "0.8.25"
|
|
20
20
|
},
|
|
21
21
|
"engines": {
|
|
22
22
|
"node": ">=18"
|