@vite-hub/shell 0.5.1 → 0.6.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/{analyze-3W0Rnm5v.js → analyze-CKnpAi1D.js} +11 -9
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/{just-bash-3Rfl6Fim.d.ts → just-bash-7eQmwBCy.d.ts} +1 -1
- package/dist/providers/just-bash.d.ts +1 -1
- package/dist/providers/just-bash.js +1 -1
- package/dist/{session-ChhAKsnl.js → session-DI9BVN5c.js} +1 -1
- package/dist/{types-0p6rVKwI.d.ts → types-Ct6o7rwi.d.ts} +1 -0
- package/dist/workspace.d.ts +2 -2
- package/dist/workspace.js +2 -2
- package/package.json +2 -2
|
@@ -106,20 +106,25 @@ const shellErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
|
|
|
106
106
|
// src/command/sh-syntax.ts
|
|
107
107
|
let parser;
|
|
108
108
|
async function parseShell(text, options) {
|
|
109
|
+
return (await shellParser())(text, options);
|
|
110
|
+
}
|
|
111
|
+
function shellParser() {
|
|
109
112
|
parser ??= loadParser().catch((error) => {
|
|
110
113
|
parser = void 0;
|
|
111
114
|
throw error;
|
|
112
115
|
});
|
|
113
|
-
return
|
|
116
|
+
return parser;
|
|
114
117
|
}
|
|
115
118
|
async function loadParser() {
|
|
116
119
|
const shSyntax = await import("sh-syntax");
|
|
117
120
|
const { importError, module: wasm } = await bundledWasmModule();
|
|
118
121
|
if (!wasm) {
|
|
119
|
-
if (!shSyntax.parse) throw shellErrorDiagnostics.SHELL_SH_SYNTAX_WASM_UNAVAILABLE({ cause: importError });
|
|
122
|
+
if (!shSyntax.parse || !shSyntax.init) throw shellErrorDiagnostics.SHELL_SH_SYNTAX_WASM_UNAVAILABLE({ cause: importError });
|
|
123
|
+
await shSyntax.init();
|
|
120
124
|
return shSyntax.parse;
|
|
121
125
|
}
|
|
122
126
|
const processor = shSyntax.getProcessor((imports) => WebAssembly.instantiate(wasm, imports));
|
|
127
|
+
await processor.init();
|
|
123
128
|
return (text, options) => processor(text, options);
|
|
124
129
|
}
|
|
125
130
|
async function bundledWasmModule() {
|
|
@@ -348,7 +353,10 @@ async function analyzeShellCommand(command, options = {}) {
|
|
|
348
353
|
};
|
|
349
354
|
try {
|
|
350
355
|
return {
|
|
351
|
-
...analyzeAst(await withTimeout(
|
|
356
|
+
...analyzeAst(await withTimeout((await shellParser())(command, {
|
|
357
|
+
keepComments: true,
|
|
358
|
+
variant: LangVariant.LangBash
|
|
359
|
+
}), options.timeoutMs ?? defaultTimeoutMs), command),
|
|
352
360
|
ok: true,
|
|
353
361
|
parser: "sh-syntax"
|
|
354
362
|
};
|
|
@@ -360,12 +368,6 @@ async function analyzeShellCommand(command, options = {}) {
|
|
|
360
368
|
};
|
|
361
369
|
}
|
|
362
370
|
}
|
|
363
|
-
async function parseWithShSyntax(command) {
|
|
364
|
-
return parseShell(command, {
|
|
365
|
-
keepComments: true,
|
|
366
|
-
variant: LangVariant.LangBash
|
|
367
|
-
});
|
|
368
|
-
}
|
|
369
371
|
function analyzeAst(file, command) {
|
|
370
372
|
const commands = [];
|
|
371
373
|
const toIndex = createSourceIndex(command);
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as ShellBoundary, c as ShellObservationEvent, d as ShellRuntimeExecOptions, f as ShellSession, i as ShellAnalyzeResult, l as ShellProcess, n as CreateShellSessionOptions, o as ShellDriver, p as ShellSessionPolicy, r as ShellAnalyzeOptions, s as ShellObservation, t as CreateShellRuntimeOptions, u as ShellRuntime } from "./types-
|
|
1
|
+
import { a as ShellBoundary, c as ShellObservationEvent, d as ShellRuntimeExecOptions, f as ShellSession, i as ShellAnalyzeResult, l as ShellProcess, n as CreateShellSessionOptions, o as ShellDriver, p as ShellSessionPolicy, r as ShellAnalyzeOptions, s as ShellObservation, t as CreateShellRuntimeOptions, u as ShellRuntime } from "./types-Ct6o7rwi.js";
|
|
2
2
|
export declare function analyzeShellCommand(command: string, options?: ShellAnalyzeOptions): Promise<ShellAnalyzeResult>;
|
|
3
3
|
export declare function createShellRuntime(options: CreateShellRuntimeOptions): ShellRuntime;
|
|
4
4
|
export type { CreateShellRuntimeOptions, CreateShellSessionOptions, ShellAnalyzeOptions, ShellAnalyzeResult, ShellBoundary, ShellDriver, ShellObservation, ShellObservationEvent, ShellProcess, ShellRuntime, ShellRuntimeExecOptions, ShellSession, ShellSessionPolicy };
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { t as analyzeShellCommand } from "./analyze-
|
|
2
|
-
import { t as createShellRuntime } from "./session-
|
|
1
|
+
import { t as analyzeShellCommand } from "./analyze-CKnpAi1D.js";
|
|
2
|
+
import { t as createShellRuntime } from "./session-DI9BVN5c.js";
|
|
3
3
|
export { analyzeShellCommand, createShellRuntime };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as ShellNetworkGrantExecutor, c as createJustBashDriver, i as JustBashFileSystem, n as JustBashExecutionLimitProfile, o as ShellNetworkRequest, r as JustBashExecutionLimits, s as ShellNetworkRequestResult, t as JustBashDriverOptions } from "../just-bash-
|
|
1
|
+
import { a as ShellNetworkGrantExecutor, c as createJustBashDriver, i as JustBashFileSystem, n as JustBashExecutionLimitProfile, o as ShellNetworkRequest, r as JustBashExecutionLimits, s as ShellNetworkRequestResult, t as JustBashDriverOptions } from "../just-bash-7eQmwBCy.js";
|
|
2
2
|
export { JustBashDriverOptions, JustBashExecutionLimitProfile, JustBashExecutionLimits, JustBashFileSystem, ShellNetworkGrantExecutor, ShellNetworkRequest, ShellNetworkRequestResult, createJustBashDriver };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as shellErrorDiagnostics, t as analyzeShellCommand } from "../analyze-
|
|
1
|
+
import { r as shellErrorDiagnostics, t as analyzeShellCommand } from "../analyze-CKnpAi1D.js";
|
|
2
2
|
// src/providers/just-bash.ts
|
|
3
3
|
function createJustBashDriver(options) {
|
|
4
4
|
const commands = options.commands?.slice();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as shellErrorDiagnostics, t as analyzeShellCommand } from "./analyze-
|
|
1
|
+
import { r as shellErrorDiagnostics, t as analyzeShellCommand } from "./analyze-CKnpAi1D.js";
|
|
2
2
|
// src/runtime/session.ts
|
|
3
3
|
function applyOutputLimit(result, maxLength) {
|
|
4
4
|
const limit = normalizeLimit(maxLength);
|
|
@@ -34,6 +34,7 @@ interface ShellObservation {
|
|
|
34
34
|
}
|
|
35
35
|
interface ShellAnalyzeOptions {
|
|
36
36
|
maxInputBytes?: number;
|
|
37
|
+
/** Limits the parse. The first call also loads the WebAssembly parser, which this limit does not include. Defaults to 100. */
|
|
37
38
|
timeoutMs?: number;
|
|
38
39
|
}
|
|
39
40
|
interface ShellAnalyzeResult {
|
package/dist/workspace.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { o as ShellDriver, s as ShellObservation } from "./types-
|
|
2
|
-
import { a as ShellNetworkGrantExecutor } from "./just-bash-
|
|
1
|
+
import { o as ShellDriver, s as ShellObservation } from "./types-Ct6o7rwi.js";
|
|
2
|
+
import { a as ShellNetworkGrantExecutor } from "./just-bash-7eQmwBCy.js";
|
|
3
3
|
import { ExecutionBudget } from "@vite-hub/runtime";
|
|
4
4
|
import { IFileSystem } from "just-bash";
|
|
5
5
|
type ShellContent = string | Uint8Array;
|
package/dist/workspace.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { n as splitShellCommandSegments, r as shellErrorDiagnostics } from "./analyze-
|
|
1
|
+
import { n as splitShellCommandSegments, r as shellErrorDiagnostics } from "./analyze-CKnpAi1D.js";
|
|
2
2
|
import { createJustBashDriver } from "./providers/just-bash.js";
|
|
3
|
-
import { t as createShellRuntime } from "./session-
|
|
3
|
+
import { t as createShellRuntime } from "./session-DI9BVN5c.js";
|
|
4
4
|
import { Buffer } from "node:buffer";
|
|
5
5
|
import { posix } from "node:path";
|
|
6
6
|
// src/workspace/filesystem.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vite-hub/shell",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"description": "Unified shell runtimes for ViteHub.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bash",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"./package.json": "./package.json"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@vite-hub/runtime": "0.
|
|
48
|
+
"@vite-hub/runtime": "0.6.1",
|
|
49
49
|
"just-bash": "^3.6.1",
|
|
50
50
|
"nostics": "1.4.0",
|
|
51
51
|
"sh-syntax": "0.8.7"
|