env-runner 0.2.0 → 0.2.1
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/dist/_chunks/common-host-env.mjs +11 -0
- package/dist/_chunks/deno-process-runner.mjs +3 -3
- package/dist/_chunks/node-worker-runner.mjs +2 -1
- package/dist/cli.mjs +0 -0
- package/dist/runners/bun-process/runner.mjs +3 -3
- package/dist/runners/node-process/runner.mjs +3 -3
- package/package.json +26 -25
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
function hostEnv(extra) {
|
|
2
|
+
const env = {
|
|
3
|
+
...process.env,
|
|
4
|
+
...extra
|
|
5
|
+
};
|
|
6
|
+
const stdout = process.stdout;
|
|
7
|
+
if (!("FORCE_COLOR" in env) && !env.NO_COLOR && stdout?.isTTY) env.FORCE_COLOR = "1";
|
|
8
|
+
if (!("COLUMNS" in env) && stdout?.columns) env.COLUMNS = String(stdout.columns);
|
|
9
|
+
return env;
|
|
10
|
+
}
|
|
11
|
+
export { hostEnv };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BaseEnvRunner } from "./common-base-runner.mjs";
|
|
2
|
+
import { hostEnv } from "./common-host-env.mjs";
|
|
2
3
|
import { fileURLToPath } from "node:url";
|
|
3
4
|
import { existsSync } from "node:fs";
|
|
4
5
|
import { spawn } from "node:child_process";
|
|
@@ -36,11 +37,10 @@ var DenoProcessEnvRunner = class extends BaseEnvRunner {
|
|
|
36
37
|
this.close(`process entry not found in "${this._workerEntry}".`);
|
|
37
38
|
return;
|
|
38
39
|
}
|
|
39
|
-
const env = {
|
|
40
|
-
...process.env,
|
|
40
|
+
const env = hostEnv({
|
|
41
41
|
ENV_RUNNER_NAME: this._name,
|
|
42
42
|
ENV_RUNNER_DATA: JSON.stringify(this._data || {})
|
|
43
|
-
};
|
|
43
|
+
});
|
|
44
44
|
const child = spawn("deno", [
|
|
45
45
|
"run",
|
|
46
46
|
"-A",
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BaseEnvRunner } from "./common-base-runner.mjs";
|
|
2
|
+
import { hostEnv } from "./common-host-env.mjs";
|
|
2
3
|
import { fileURLToPath } from "node:url";
|
|
3
4
|
import { existsSync } from "node:fs";
|
|
4
5
|
import { Worker } from "node:worker_threads";
|
|
@@ -37,7 +38,7 @@ var NodeWorkerEnvRunner = class extends BaseEnvRunner {
|
|
|
37
38
|
return;
|
|
38
39
|
}
|
|
39
40
|
const worker = new Worker(this._workerEntry, {
|
|
40
|
-
env:
|
|
41
|
+
env: hostEnv(),
|
|
41
42
|
workerData: {
|
|
42
43
|
name: this._name,
|
|
43
44
|
...this._data
|
package/dist/cli.mjs
CHANGED
|
File without changes
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BaseEnvRunner } from "../../_chunks/common-base-runner.mjs";
|
|
2
|
+
import { hostEnv } from "../../_chunks/common-host-env.mjs";
|
|
2
3
|
import { fileURLToPath } from "node:url";
|
|
3
4
|
import { existsSync } from "node:fs";
|
|
4
5
|
import { execSync, spawn } from "node:child_process";
|
|
@@ -56,11 +57,10 @@ var BunProcessEnvRunner = class extends BaseEnvRunner {
|
|
|
56
57
|
this.close(`process entry not found in "${this._workerEntry}".`);
|
|
57
58
|
return;
|
|
58
59
|
}
|
|
59
|
-
const env = {
|
|
60
|
-
...process.env,
|
|
60
|
+
const env = hostEnv({
|
|
61
61
|
ENV_RUNNER_NAME: this._name,
|
|
62
62
|
ENV_RUNNER_DATA: JSON.stringify(this._data || {})
|
|
63
|
-
};
|
|
63
|
+
});
|
|
64
64
|
if (_isBun) this.#initBunProcess(execArgv, env);
|
|
65
65
|
else this.#initNodeProcess(execArgv, env);
|
|
66
66
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BaseEnvRunner } from "../../_chunks/common-base-runner.mjs";
|
|
2
|
+
import { hostEnv } from "../../_chunks/common-host-env.mjs";
|
|
2
3
|
import { fileURLToPath } from "node:url";
|
|
3
4
|
import { existsSync } from "node:fs";
|
|
4
5
|
import { fork } from "node:child_process";
|
|
@@ -35,11 +36,10 @@ var NodeProcessEnvRunner = class extends BaseEnvRunner {
|
|
|
35
36
|
return;
|
|
36
37
|
}
|
|
37
38
|
const child = fork(this._workerEntry, [], {
|
|
38
|
-
env: {
|
|
39
|
-
...process.env,
|
|
39
|
+
env: hostEnv({
|
|
40
40
|
ENV_RUNNER_NAME: this._name,
|
|
41
41
|
ENV_RUNNER_DATA: JSON.stringify(this._data || {})
|
|
42
|
-
},
|
|
42
|
+
}),
|
|
43
43
|
stdio: [
|
|
44
44
|
"pipe",
|
|
45
45
|
"pipe",
|
package/package.json
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "env-runner",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Generic environment runner for JavaScript runtimes.",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"repository":
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "unjs/env-runner"
|
|
9
|
+
},
|
|
7
10
|
"bin": {
|
|
8
11
|
"env-runner": "./dist/cli.mjs"
|
|
9
12
|
},
|
|
@@ -31,40 +34,38 @@
|
|
|
31
34
|
"./runners/netlify/worker": "./dist/runners/netlify/worker.mjs",
|
|
32
35
|
"./vite": "./dist/vite.mjs"
|
|
33
36
|
},
|
|
34
|
-
"scripts": {
|
|
35
|
-
"build": "obuild",
|
|
36
|
-
"dev": "vitest dev",
|
|
37
|
-
"fmt": "automd && oxlint . --fix && oxfmt .",
|
|
38
|
-
"lint": "oxlint . && oxfmt --check .",
|
|
39
|
-
"prepack": "pnpm build",
|
|
40
|
-
"env-runner": "node ./src/cli.ts",
|
|
41
|
-
"release": "pnpm test && pnpm build && changelogen --release && npm publish && git push --follow-tags",
|
|
42
|
-
"test": "pnpm lint && pnpm typecheck && vitest run --coverage",
|
|
43
|
-
"typecheck": "tsc --noEmit --skipLibCheck"
|
|
44
|
-
},
|
|
45
37
|
"dependencies": {
|
|
46
|
-
"crossws": "^0.4.
|
|
38
|
+
"crossws": "^0.4.12",
|
|
47
39
|
"exsolve": "^1.1.1",
|
|
48
40
|
"httpxy": "^0.5.5",
|
|
49
|
-
"srvx": "^0.
|
|
41
|
+
"srvx": "^1.0.0"
|
|
50
42
|
},
|
|
51
43
|
"devDependencies": {
|
|
52
|
-
"@netlify/runtime": "^5",
|
|
53
|
-
"@types/node": "^26.
|
|
54
|
-
"@vercel/queue": "^0.
|
|
44
|
+
"@netlify/runtime": "^5.0.2",
|
|
45
|
+
"@types/node": "^26.4.0",
|
|
46
|
+
"@vercel/queue": "^0.5.1",
|
|
55
47
|
"@vitest/coverage-v8": "^4.1.11",
|
|
56
48
|
"automd": "^0.4.3",
|
|
57
49
|
"changelogen": "^0.6.2",
|
|
58
50
|
"cjs-module-lexer": "^2.2.1",
|
|
59
51
|
"env-runner-fixture": "link:",
|
|
60
52
|
"es-module-lexer": "^2.3.2",
|
|
61
|
-
"miniflare": "^4",
|
|
53
|
+
"miniflare": "^4.20260730.0",
|
|
62
54
|
"obuild": "^0.4.38",
|
|
63
|
-
"oxfmt": "
|
|
64
|
-
"oxlint": "^1.
|
|
65
|
-
"typescript": "^7",
|
|
55
|
+
"oxfmt": "^0.65.0",
|
|
56
|
+
"oxlint": "^1.80.0",
|
|
57
|
+
"typescript": "^7.0.2",
|
|
66
58
|
"vitest": "^4.1.11",
|
|
67
|
-
"wrangler": "^4.
|
|
59
|
+
"wrangler": "^4.127.1"
|
|
68
60
|
},
|
|
69
|
-
"
|
|
70
|
-
|
|
61
|
+
"scripts": {
|
|
62
|
+
"build": "obuild",
|
|
63
|
+
"dev": "vitest dev",
|
|
64
|
+
"fmt": "automd && oxlint . --fix && oxfmt .",
|
|
65
|
+
"lint": "oxlint . && oxfmt --check .",
|
|
66
|
+
"env-runner": "node ./src/cli.ts",
|
|
67
|
+
"release": "pnpm test && pnpm build && changelogen --release && pnpm publish && git push --follow-tags",
|
|
68
|
+
"test": "pnpm lint && pnpm typecheck && vitest run --coverage",
|
|
69
|
+
"typecheck": "tsc --noEmit --skipLibCheck"
|
|
70
|
+
}
|
|
71
|
+
}
|