@veryfront/ext-content-mdx 0.1.1106 → 0.1.1108
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/esm/deno.js +1 -1
- package/esm/src/utils/logger/logger.d.ts.map +1 -1
- package/esm/src/utils/logger/logger.js +2 -1
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/esm/src/utils/version.js +1 -1
- package/package.json +2 -2
- package/esm/src/platform/compat/dynamic-import.d.ts +0 -11
- package/esm/src/platform/compat/dynamic-import.d.ts.map +0 -1
- package/esm/src/platform/compat/dynamic-import.js +0 -10
- package/esm/src/platform/compat/process/command.d.ts +0 -33
- package/esm/src/platform/compat/process/command.d.ts.map +0 -1
- package/esm/src/platform/compat/process/command.js +0 -206
- package/esm/src/platform/compat/process.d.ts +0 -5
- package/esm/src/platform/compat/process.d.ts.map +0 -1
- package/esm/src/platform/compat/process.js +0 -4
package/esm/deno.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../../src/src/utils/logger/logger.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../../src/src/utils/logger/logger.ts"],"names":[],"mappings":"AAGA,OAAO,EAOL,KAAK,YAAY,EAEjB,KAAK,eAAe,EAErB,MAAM,WAAW,CAAC;AAGnB,oBAAY,QAAQ;IAClB,KAAK,IAAI;IACT,IAAI,IAAI;IACR,IAAI,IAAI;IACR,KAAK,IAAI;CACV;AAED,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,MAAM,CAAC;AAExC;;;GAGG;AACH,MAAM,WAAW,QAAQ;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,YAAY,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,EAAE,MAAM,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;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IACxB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GACA,MAAM,CAUR"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { getEnv, getHostEnv
|
|
1
|
+
import { getEnv, getHostEnv } from "../../platform/compat/process/env.js";
|
|
2
|
+
import { isStdoutTTY } from "../../platform/compat/process/lifecycle.js";
|
|
2
3
|
import { RUNTIME_VERSION } from "../version.js";
|
|
3
4
|
import { ANSI, colorize, formatContextText, formatTimestamp, LEVEL_COLORS, LEVEL_GLYPHS, padTag, serializeError, } from "./core.js";
|
|
4
5
|
import { redactSensitive, sanitizeSerializedError, sanitizeUrlCredentials } from "./redact.js";
|
package/esm/src/utils/version.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import denoConfig from "../../deno.js";
|
|
2
|
-
import { getEnv } from "../platform/compat/process.js";
|
|
2
|
+
import { getEnv } from "../platform/compat/process/env.js";
|
|
3
3
|
import { VERSION } from "./version-constant.js";
|
|
4
4
|
export { VERSION } from "./version-constant.js";
|
|
5
5
|
export function normalizeVeryfrontVersion(version) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@veryfront/ext-content-mdx",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1108",
|
|
4
4
|
"description": "Veryfront first-party extension package for ext-content-mdx",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"veryfront",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"vfile": "6.0.3"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
|
-
"veryfront": "^0.1.
|
|
70
|
+
"veryfront": "^0.1.1108"
|
|
71
71
|
},
|
|
72
72
|
"type": "module",
|
|
73
73
|
"types": "./esm/extensions/ext-content-mdx/src/index.d.ts",
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Opaque dynamic import helper.
|
|
3
|
-
*
|
|
4
|
-
* Uses `new Function` to hide the `import()` call from static analysis
|
|
5
|
-
* by bundlers and `deno compile`, preventing them from tracing into
|
|
6
|
-
* the imported specifier.
|
|
7
|
-
*
|
|
8
|
-
* @module platform/compat
|
|
9
|
-
*/
|
|
10
|
-
export declare const dynamicImport: <T = unknown>(specifier: string) => Promise<T>;
|
|
11
|
-
//# sourceMappingURL=dynamic-import.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dynamic-import.d.ts","sourceRoot":"","sources":["../../../../src/src/platform/compat/dynamic-import.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,eAAO,MAAM,aAAa,EAA4D,CACpF,CAAC,GAAG,OAAO,EAEX,SAAS,EAAE,MAAM,KACd,OAAO,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Opaque dynamic import helper.
|
|
3
|
-
*
|
|
4
|
-
* Uses `new Function` to hide the `import()` call from static analysis
|
|
5
|
-
* by bundlers and `deno compile`, preventing them from tracing into
|
|
6
|
-
* the imported specifier.
|
|
7
|
-
*
|
|
8
|
-
* @module platform/compat
|
|
9
|
-
*/
|
|
10
|
-
export const dynamicImport = new Function("specifier", "return import(specifier)");
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
export interface CommandResult {
|
|
2
|
-
success: boolean;
|
|
3
|
-
code: number;
|
|
4
|
-
stdout?: string;
|
|
5
|
-
stderr?: string;
|
|
6
|
-
}
|
|
7
|
-
export interface CommandOptions {
|
|
8
|
-
args?: string[];
|
|
9
|
-
cwd?: string;
|
|
10
|
-
env?: Record<string, string>;
|
|
11
|
-
/** Start from an empty environment before applying `env`. */
|
|
12
|
-
clearEnv?: boolean;
|
|
13
|
-
/** Capture stdout/stderr to return in result */
|
|
14
|
-
capture?: boolean;
|
|
15
|
-
/** Inherit stdio from parent process (shows output in terminal) */
|
|
16
|
-
inherit?: boolean;
|
|
17
|
-
/** Use shell to run the command (needed for .cmd files on Windows) */
|
|
18
|
-
shell?: boolean;
|
|
19
|
-
/** Kill the command if it exceeds this duration (milliseconds) */
|
|
20
|
-
timeoutMs?: number;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Run a command and return the result.
|
|
24
|
-
* Works across Deno, Node.js, and Bun.
|
|
25
|
-
*
|
|
26
|
-
* @param cmd - Command to run
|
|
27
|
-
* @param options - Command options
|
|
28
|
-
* @param options.capture - Capture stdout/stderr to return in result
|
|
29
|
-
* @param options.inherit - Inherit stdio from parent (shows output in terminal)
|
|
30
|
-
* @param options.shell - Use shell to run command (needed for .cmd on Windows)
|
|
31
|
-
*/
|
|
32
|
-
export declare function runCommand(cmd: string, options?: CommandOptions): Promise<CommandResult>;
|
|
33
|
-
//# sourceMappingURL=command.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../../src/src/platform/compat/process/command.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,gDAAgD;IAChD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,mEAAmE;IACnE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,sEAAsE;IACtE,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,kEAAkE;IAClE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AA6ED;;;;;;;;;GASG;AACH,wBAAsB,UAAU,CAC9B,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,cAAmB,GAC3B,OAAO,CAAC,aAAa,CAAC,CAoMxB"}
|
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
import * as dntShim from "../../../../_dnt.shims.js";
|
|
2
|
-
import { dynamicImport } from "../dynamic-import.js";
|
|
3
|
-
import { getDenoRuntime, isBun as IS_BUN, isDeno as IS_DENO } from "../runtime.js";
|
|
4
|
-
import { isWindowsPlatform, runtimeProcess } from "./runtime-process.js";
|
|
5
|
-
const COMMAND_TIMEOUT_EXIT_CODE = 124;
|
|
6
|
-
const FORCE_KILL_GRACE_MS = 250;
|
|
7
|
-
function createTimeoutResult(timeoutMs, stdout, stderr) {
|
|
8
|
-
return {
|
|
9
|
-
success: false,
|
|
10
|
-
code: COMMAND_TIMEOUT_EXIT_CODE,
|
|
11
|
-
stdout,
|
|
12
|
-
stderr: `${stderr ?? ""}\nCommand timed out after ${timeoutMs}ms`.trim(),
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
function createProcessTimeout(timeoutMs, terminate, forceTerminate) {
|
|
16
|
-
let timedOut = false;
|
|
17
|
-
let timeoutId;
|
|
18
|
-
let forceKillId;
|
|
19
|
-
if (timeoutMs && timeoutMs > 0) {
|
|
20
|
-
timeoutId = dntShim.setTimeout(() => {
|
|
21
|
-
timedOut = true;
|
|
22
|
-
try {
|
|
23
|
-
terminate();
|
|
24
|
-
}
|
|
25
|
-
catch (_) {
|
|
26
|
-
/* expected: best-effort terminate may fail if process already exited */
|
|
27
|
-
}
|
|
28
|
-
forceKillId = dntShim.setTimeout(() => {
|
|
29
|
-
try {
|
|
30
|
-
forceTerminate();
|
|
31
|
-
}
|
|
32
|
-
catch (_) {
|
|
33
|
-
/* expected: best-effort force terminate may fail if process already exited */
|
|
34
|
-
}
|
|
35
|
-
}, FORCE_KILL_GRACE_MS);
|
|
36
|
-
}, timeoutMs);
|
|
37
|
-
}
|
|
38
|
-
return {
|
|
39
|
-
hasTimedOut: () => timedOut,
|
|
40
|
-
clear: () => {
|
|
41
|
-
if (timeoutId)
|
|
42
|
-
clearTimeout(timeoutId);
|
|
43
|
-
if (forceKillId)
|
|
44
|
-
clearTimeout(forceKillId);
|
|
45
|
-
},
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
async function readStreamToString(stream) {
|
|
49
|
-
const reader = stream.getReader();
|
|
50
|
-
const chunks = [];
|
|
51
|
-
while (true) {
|
|
52
|
-
const { done, value } = await reader.read();
|
|
53
|
-
if (done)
|
|
54
|
-
break;
|
|
55
|
-
if (value)
|
|
56
|
-
chunks.push(value);
|
|
57
|
-
}
|
|
58
|
-
const total = chunks.reduce((acc, c) => acc + c.length, 0);
|
|
59
|
-
const merged = new Uint8Array(total);
|
|
60
|
-
let offset = 0;
|
|
61
|
-
for (const chunk of chunks) {
|
|
62
|
-
merged.set(chunk, offset);
|
|
63
|
-
offset += chunk.length;
|
|
64
|
-
}
|
|
65
|
-
return new TextDecoder().decode(merged);
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Run a command and return the result.
|
|
69
|
-
* Works across Deno, Node.js, and Bun.
|
|
70
|
-
*
|
|
71
|
-
* @param cmd - Command to run
|
|
72
|
-
* @param options - Command options
|
|
73
|
-
* @param options.capture - Capture stdout/stderr to return in result
|
|
74
|
-
* @param options.inherit - Inherit stdio from parent (shows output in terminal)
|
|
75
|
-
* @param options.shell - Use shell to run command (needed for .cmd on Windows)
|
|
76
|
-
*/
|
|
77
|
-
export async function runCommand(cmd, options = {}) {
|
|
78
|
-
const { args = [], cwd: cmdCwd, env: cmdEnv, clearEnv = false, capture = false, inherit = false, shell = false, timeoutMs, } = options;
|
|
79
|
-
const effectiveTimeoutMs = timeoutMs && timeoutMs > 0 ? Math.floor(timeoutMs) : undefined;
|
|
80
|
-
// Determine stdio mode: inherit > capture > null
|
|
81
|
-
const stdioMode = inherit ? "inherit" : capture ? "piped" : "null";
|
|
82
|
-
const deno = IS_DENO ? getDenoRuntime() : undefined;
|
|
83
|
-
if (deno) {
|
|
84
|
-
const command = new deno.Command(cmd, {
|
|
85
|
-
args,
|
|
86
|
-
cwd: cmdCwd,
|
|
87
|
-
env: cmdEnv,
|
|
88
|
-
clearEnv,
|
|
89
|
-
stdin: inherit ? "inherit" : "null",
|
|
90
|
-
stdout: stdioMode,
|
|
91
|
-
stderr: stdioMode,
|
|
92
|
-
});
|
|
93
|
-
const child = command.spawn();
|
|
94
|
-
const timeout = createProcessTimeout(effectiveTimeoutMs, () => child.kill("SIGTERM"), () => child.kill("SIGKILL"));
|
|
95
|
-
try {
|
|
96
|
-
const [status, stdout, stderr] = await Promise.all([
|
|
97
|
-
child.status,
|
|
98
|
-
capture && child.stdout ? readStreamToString(child.stdout) : Promise.resolve(undefined),
|
|
99
|
-
capture && child.stderr ? readStreamToString(child.stderr) : Promise.resolve(undefined),
|
|
100
|
-
]);
|
|
101
|
-
if (timeout.hasTimedOut()) {
|
|
102
|
-
return createTimeoutResult(effectiveTimeoutMs ?? 0, stdout, stderr);
|
|
103
|
-
}
|
|
104
|
-
return {
|
|
105
|
-
success: status.success,
|
|
106
|
-
code: status.code,
|
|
107
|
-
stdout,
|
|
108
|
-
stderr,
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
finally {
|
|
112
|
-
timeout.clear();
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
if (IS_BUN) {
|
|
116
|
-
const bunGlobal = dntShim.dntGlobalThis;
|
|
117
|
-
const bunStdio = inherit ? "inherit" : capture ? "pipe" : "ignore";
|
|
118
|
-
const isWindows = isWindowsPlatform();
|
|
119
|
-
const bunCmd = shell
|
|
120
|
-
? args.length === 0
|
|
121
|
-
? isWindows ? ["cmd", "/c", cmd] : ["sh", "-c", cmd]
|
|
122
|
-
: isWindows
|
|
123
|
-
? ["cmd", "/c", cmd, ...args]
|
|
124
|
-
: ["sh", "-c", 'exec "$@"', "sh", cmd, ...args]
|
|
125
|
-
: [cmd, ...args];
|
|
126
|
-
const proc = bunGlobal.Bun.spawn({
|
|
127
|
-
cmd: bunCmd,
|
|
128
|
-
cwd: cmdCwd,
|
|
129
|
-
env: clearEnv ? cmdEnv ?? {} : cmdEnv,
|
|
130
|
-
stdout: bunStdio,
|
|
131
|
-
stderr: bunStdio,
|
|
132
|
-
});
|
|
133
|
-
const timeout = createProcessTimeout(effectiveTimeoutMs, () => proc.kill?.("SIGTERM"), () => proc.kill?.("SIGKILL"));
|
|
134
|
-
try {
|
|
135
|
-
const [code, stdout, stderr] = await Promise.all([
|
|
136
|
-
proc.exited,
|
|
137
|
-
capture && proc.stdout ? readStreamToString(proc.stdout) : Promise.resolve(undefined),
|
|
138
|
-
capture && proc.stderr ? readStreamToString(proc.stderr) : Promise.resolve(undefined),
|
|
139
|
-
]);
|
|
140
|
-
if (timeout.hasTimedOut()) {
|
|
141
|
-
return createTimeoutResult(effectiveTimeoutMs ?? 0, stdout, stderr);
|
|
142
|
-
}
|
|
143
|
-
return { success: code === 0, code, stdout, stderr };
|
|
144
|
-
}
|
|
145
|
-
finally {
|
|
146
|
-
timeout.clear();
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
if (!runtimeProcess)
|
|
150
|
-
return { success: false, code: 1 };
|
|
151
|
-
const process = runtimeProcess;
|
|
152
|
-
const { spawn } = await dynamicImport("node:child_process");
|
|
153
|
-
const nodeStdio = inherit
|
|
154
|
-
? ["inherit", "inherit", "inherit"]
|
|
155
|
-
: capture
|
|
156
|
-
? ["ignore", "pipe", "pipe"]
|
|
157
|
-
: ["ignore", "ignore", "ignore"];
|
|
158
|
-
return await new Promise((resolve) => {
|
|
159
|
-
const child = spawn(cmd, args, {
|
|
160
|
-
cwd: cmdCwd,
|
|
161
|
-
env: clearEnv ? cmdEnv ?? {} : cmdEnv ? { ...process.env, ...cmdEnv } : undefined,
|
|
162
|
-
stdio: nodeStdio,
|
|
163
|
-
shell,
|
|
164
|
-
});
|
|
165
|
-
let stdout = "";
|
|
166
|
-
let stderr = "";
|
|
167
|
-
const decoder = new TextDecoder();
|
|
168
|
-
const timeout = createProcessTimeout(effectiveTimeoutMs, () => child.kill("SIGTERM"), () => child.kill("SIGKILL"));
|
|
169
|
-
if (capture) {
|
|
170
|
-
child.stdout?.on("data", (data) => {
|
|
171
|
-
stdout += decoder.decode(data);
|
|
172
|
-
});
|
|
173
|
-
child.stderr?.on("data", (data) => {
|
|
174
|
-
stderr += decoder.decode(data);
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
|
-
child.on("close", (code) => {
|
|
178
|
-
timeout.clear();
|
|
179
|
-
if (timeout.hasTimedOut()) {
|
|
180
|
-
resolve(createTimeoutResult(effectiveTimeoutMs ?? 0, capture ? stdout : undefined, capture ? stderr : undefined));
|
|
181
|
-
return;
|
|
182
|
-
}
|
|
183
|
-
resolve({
|
|
184
|
-
success: code === 0,
|
|
185
|
-
code: code ?? 1,
|
|
186
|
-
stdout: capture ? stdout : undefined,
|
|
187
|
-
stderr: capture ? stderr : undefined,
|
|
188
|
-
});
|
|
189
|
-
});
|
|
190
|
-
child.on("error", (spawnError) => {
|
|
191
|
-
timeout.clear();
|
|
192
|
-
// Include the spawn error message so callers can distinguish ENOENT
|
|
193
|
-
// ("command not found"), EACCES ("permission denied"), etc.
|
|
194
|
-
resolve({
|
|
195
|
-
success: false,
|
|
196
|
-
code: 1,
|
|
197
|
-
stdout: capture ? stdout : undefined,
|
|
198
|
-
stderr: capture
|
|
199
|
-
? (stderr
|
|
200
|
-
? `${stderr}\nSpawn error: ${spawnError.message}`
|
|
201
|
-
: `Spawn error: ${spawnError.message}`)
|
|
202
|
-
: undefined,
|
|
203
|
-
});
|
|
204
|
-
});
|
|
205
|
-
});
|
|
206
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export { deleteEnv, env, type EnvBooleanOptions, getEnv, getEnvBoolean, getEnvNumber, getEnvOverlayStorage, getEnvString, getHostEnv, setEnv, } from "./process/env.js";
|
|
2
|
-
export { chdir, cwd, execPath, exit, getArgs, getOsType, getRuntimeVersion, getStdout, getTerminalSize, isInteractive, isStdoutTTY, memoryUsage, onGlobalError, onSignal, pid, promptSync, readStdinByteSync, unrefTimer, uptime, writeStdout, writeStdoutAsync, } from "./process/lifecycle.js";
|
|
3
|
-
export { testHasRuntimeProcess } from "./process/runtime-process.js";
|
|
4
|
-
export { type CommandOptions, type CommandResult, runCommand } from "./process/command.js";
|
|
5
|
-
//# sourceMappingURL=process.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"process.d.ts","sourceRoot":"","sources":["../../../../src/src/platform/compat/process.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,GAAG,EACH,KAAK,iBAAiB,EACtB,MAAM,EACN,aAAa,EACb,YAAY,EACZ,oBAAoB,EACpB,YAAY,EACZ,UAAU,EACV,MAAM,GACP,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,KAAK,EACL,GAAG,EACH,QAAQ,EACR,IAAI,EACJ,OAAO,EACP,SAAS,EACT,iBAAiB,EACjB,SAAS,EACT,eAAe,EACf,aAAa,EACb,WAAW,EACX,WAAW,EACX,aAAa,EACb,QAAQ,EACR,GAAG,EACH,UAAU,EACV,iBAAiB,EACjB,UAAU,EACV,MAAM,EACN,WAAW,EACX,gBAAgB,GACjB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,aAAa,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export { deleteEnv, env, getEnv, getEnvBoolean, getEnvNumber, getEnvOverlayStorage, getEnvString, getHostEnv, setEnv, } from "./process/env.js";
|
|
2
|
-
export { chdir, cwd, execPath, exit, getArgs, getOsType, getRuntimeVersion, getStdout, getTerminalSize, isInteractive, isStdoutTTY, memoryUsage, onGlobalError, onSignal, pid, promptSync, readStdinByteSync, unrefTimer, uptime, writeStdout, writeStdoutAsync, } from "./process/lifecycle.js";
|
|
3
|
-
export { testHasRuntimeProcess } from "./process/runtime-process.js";
|
|
4
|
-
export { runCommand } from "./process/command.js";
|