virrun 2.31.0
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/LICENSE +201 -0
- package/README.md +99 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +17 -0
- package/dist/createVirrun-C8zMQHAQ.js +22994 -0
- package/dist/createVirrun-Cg9BQxg_.js +22988 -0
- package/dist/createVirrun-rH3O-itW.js +19019 -0
- package/dist/index.d.ts +170 -0
- package/dist/index.js +2 -0
- package/package.json +50 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
//#region src/models/exec/ExecOptions.d.ts
|
|
2
|
+
interface ExecOptions {
|
|
3
|
+
cwd: string;
|
|
4
|
+
network?: boolean;
|
|
5
|
+
overlayDirs?: readonly string[];
|
|
6
|
+
stdio: ExecStdio;
|
|
7
|
+
}
|
|
8
|
+
type ExecStdio = "inherit" | "pipe";
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region src/models/exec/ExecResult.d.ts
|
|
11
|
+
interface ExecResult {
|
|
12
|
+
exitCode: number;
|
|
13
|
+
stderr: string;
|
|
14
|
+
stdout: string;
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
//#region src/models/exec/ExecBackend.d.ts
|
|
18
|
+
interface ExecBackend {
|
|
19
|
+
exec: (command: readonly string[] | string, options: ExecOptions) => Promise<ExecResult>;
|
|
20
|
+
readonly name: string;
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region src/models/exec/ExitSignalError.d.ts
|
|
24
|
+
declare class ExitSignalError extends Error {
|
|
25
|
+
readonly code: number;
|
|
26
|
+
constructor(code: number);
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
29
|
+
//#region src/models/exec/NodeInvocation.d.ts
|
|
30
|
+
interface NodeInvocation {
|
|
31
|
+
code: string;
|
|
32
|
+
file: string;
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region src/models/source/SourceType.d.ts
|
|
36
|
+
declare enum SourceType {
|
|
37
|
+
Dir = "dir",
|
|
38
|
+
Files = "files",
|
|
39
|
+
Git = "git"
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
42
|
+
//#region src/models/source/DirSource.d.ts
|
|
43
|
+
interface DirSource {
|
|
44
|
+
dir: string;
|
|
45
|
+
readonly type: SourceType.Dir;
|
|
46
|
+
}
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region src/models/source/FilesSource.d.ts
|
|
49
|
+
interface FilesSource {
|
|
50
|
+
files: Record<string, string>;
|
|
51
|
+
readonly type: SourceType.Files;
|
|
52
|
+
}
|
|
53
|
+
//#endregion
|
|
54
|
+
//#region src/models/source/GitSource.d.ts
|
|
55
|
+
interface GitSource {
|
|
56
|
+
ref: string;
|
|
57
|
+
repo: string;
|
|
58
|
+
readonly type: SourceType.Git;
|
|
59
|
+
}
|
|
60
|
+
//#endregion
|
|
61
|
+
//#region src/models/source/LoadedSource.d.ts
|
|
62
|
+
interface LoadedSource {
|
|
63
|
+
cwd: string;
|
|
64
|
+
dispose: () => Promise<void>;
|
|
65
|
+
}
|
|
66
|
+
//#endregion
|
|
67
|
+
//#region src/models/source/Source.d.ts
|
|
68
|
+
type Source = DirSource | FilesSource | GitSource;
|
|
69
|
+
//#endregion
|
|
70
|
+
//#region src/models/vfs/FsProvider.d.ts
|
|
71
|
+
interface FsProvider {
|
|
72
|
+
dispose: () => void;
|
|
73
|
+
exists: (path: string) => boolean;
|
|
74
|
+
mkdir: (path: string) => void;
|
|
75
|
+
mount: (prefix: string) => void;
|
|
76
|
+
readonly name: string;
|
|
77
|
+
readFile: (path: string) => string;
|
|
78
|
+
unmount: () => void;
|
|
79
|
+
writeFile: (path: string, data: string) => void;
|
|
80
|
+
}
|
|
81
|
+
//#endregion
|
|
82
|
+
//#region src/models/vfs/FsProviderOptions.d.ts
|
|
83
|
+
interface FsProviderOptions {
|
|
84
|
+
overlay: boolean;
|
|
85
|
+
}
|
|
86
|
+
//#endregion
|
|
87
|
+
//#region src/models/virrun/BackendType.d.ts
|
|
88
|
+
declare enum BackendType {
|
|
89
|
+
Auto = "auto",
|
|
90
|
+
Native = "native",
|
|
91
|
+
Os = "os",
|
|
92
|
+
Vfs = "vfs"
|
|
93
|
+
}
|
|
94
|
+
//#endregion
|
|
95
|
+
//#region src/models/virrun/Virrun.d.ts
|
|
96
|
+
interface Virrun {
|
|
97
|
+
readonly backend: string;
|
|
98
|
+
dispose: () => Promise<void>;
|
|
99
|
+
exec: (command: readonly string[] | string, stdio?: ExecStdio) => Promise<ExecResult>;
|
|
100
|
+
}
|
|
101
|
+
//#endregion
|
|
102
|
+
//#region src/models/virrun/VirrunOptions.d.ts
|
|
103
|
+
interface VirrunOptions {
|
|
104
|
+
backend: BackendType;
|
|
105
|
+
source: Source;
|
|
106
|
+
}
|
|
107
|
+
//#endregion
|
|
108
|
+
//#region src/services/cli/parseCliCommand.d.ts
|
|
109
|
+
declare const parseCliCommand: (argv: readonly string[]) => string[];
|
|
110
|
+
//#endregion
|
|
111
|
+
//#region src/services/exec/buildBwrapArgs.d.ts
|
|
112
|
+
declare const buildBwrapArgs: (command: readonly string[] | string, cwd: string, {
|
|
113
|
+
network,
|
|
114
|
+
overlayDirs
|
|
115
|
+
}?: Pick<ExecOptions, "network" | "overlayDirs">) => string[];
|
|
116
|
+
//#endregion
|
|
117
|
+
//#region src/services/exec/createNativeBackend.d.ts
|
|
118
|
+
declare const createNativeBackend: () => ExecBackend;
|
|
119
|
+
//#endregion
|
|
120
|
+
//#region src/services/exec/createOsBackend.d.ts
|
|
121
|
+
declare const createOsBackend: () => ExecBackend;
|
|
122
|
+
//#endregion
|
|
123
|
+
//#region src/services/exec/createVfsBackend.d.ts
|
|
124
|
+
declare const createVfsBackend: () => ExecBackend;
|
|
125
|
+
//#endregion
|
|
126
|
+
//#region src/services/exec/isOsBackendSupported.d.ts
|
|
127
|
+
declare const isOsBackendSupported: () => boolean;
|
|
128
|
+
//#endregion
|
|
129
|
+
//#region src/services/exec/parseBwrapExitCode.d.ts
|
|
130
|
+
declare const parseBwrapExitCode: (status: string) => number | undefined;
|
|
131
|
+
//#endregion
|
|
132
|
+
//#region src/services/exec/parseNodeInvocation.d.ts
|
|
133
|
+
declare const parseNodeInvocation: (command: readonly string[] | string) => NodeInvocation | undefined;
|
|
134
|
+
//#endregion
|
|
135
|
+
//#region src/services/exec/runNodeInProcess.d.ts
|
|
136
|
+
declare const runNodeInProcess: ({
|
|
137
|
+
code,
|
|
138
|
+
file
|
|
139
|
+
}: NodeInvocation, {
|
|
140
|
+
cwd,
|
|
141
|
+
stdio
|
|
142
|
+
}: ExecOptions) => ExecResult | undefined;
|
|
143
|
+
//#endregion
|
|
144
|
+
//#region src/services/exec/toExitCode.d.ts
|
|
145
|
+
declare const toExitCode: (code: null | number, signal: NodeJS.Signals | null) => number;
|
|
146
|
+
//#endregion
|
|
147
|
+
//#region src/services/exec/tokenizeShellCommand.d.ts
|
|
148
|
+
declare const tokenizeShellCommand: (input: string) => string[] | undefined;
|
|
149
|
+
//#endregion
|
|
150
|
+
//#region src/services/source/loadDirSource.d.ts
|
|
151
|
+
declare const loadDirSource: (source: DirSource) => Promise<LoadedSource>;
|
|
152
|
+
//#endregion
|
|
153
|
+
//#region src/services/source/loadFilesSource.d.ts
|
|
154
|
+
declare const loadFilesSource: (source: FilesSource) => Promise<LoadedSource>;
|
|
155
|
+
//#endregion
|
|
156
|
+
//#region src/services/source/loadGitSource.d.ts
|
|
157
|
+
declare const loadGitSource: (source: GitSource) => Promise<LoadedSource>;
|
|
158
|
+
//#endregion
|
|
159
|
+
//#region src/services/source/loadSource.d.ts
|
|
160
|
+
declare const loadSource: (source: Source) => Promise<LoadedSource>;
|
|
161
|
+
//#endregion
|
|
162
|
+
//#region src/services/vfs/createPlatformaticFsProvider.d.ts
|
|
163
|
+
declare const createPlatformaticFsProvider: ({
|
|
164
|
+
overlay
|
|
165
|
+
}?: Partial<FsProviderOptions>) => FsProvider;
|
|
166
|
+
//#endregion
|
|
167
|
+
//#region src/services/virrun/createVirrun.d.ts
|
|
168
|
+
declare const createVirrun: (options?: Partial<VirrunOptions>) => Promise<Virrun>;
|
|
169
|
+
//#endregion
|
|
170
|
+
export { BackendType, DirSource, ExecBackend, ExecOptions, ExecResult, ExecStdio, ExitSignalError, FilesSource, FsProvider, FsProviderOptions, GitSource, LoadedSource, NodeInvocation, Source, SourceType, Virrun, VirrunOptions, buildBwrapArgs, createNativeBackend, createOsBackend, createPlatformaticFsProvider, createVfsBackend, createVirrun, isOsBackendSupported, loadDirSource, loadFilesSource, loadGitSource, loadSource, parseBwrapExitCode, parseCliCommand, parseNodeInvocation, runNodeInProcess, toExitCode, tokenizeShellCommand };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { _ as createNativeBackend, a as loadDirSource, b as SourceType, c as createPlatformaticFsProvider, d as tokenizeShellCommand, f as createOsBackend, g as buildBwrapArgs, i as loadFilesSource, l as ExitSignalError, m as isOsBackendSupported, n as loadSource, o as createVfsBackend, p as parseBwrapExitCode, r as loadGitSource, s as runNodeInProcess, t as createVirrun, u as parseNodeInvocation, v as toExitCode, x as parseCliCommand, y as BackendType } from "./createVirrun-C8zMQHAQ.js";
|
|
2
|
+
export { BackendType, ExitSignalError, SourceType, buildBwrapArgs, createNativeBackend, createOsBackend, createPlatformaticFsProvider, createVfsBackend, createVirrun, isOsBackendSupported, loadDirSource, loadFilesSource, loadGitSource, loadSource, parseBwrapExitCode, parseCliCommand, parseNodeInvocation, runNodeInProcess, toExitCode, tokenizeShellCommand };
|
package/package.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "virrun",
|
|
3
|
+
"version": "2.31.0",
|
|
4
|
+
"description": "An ephemeral, in-memory virtual runner that runs a repo's real toolchain fast and isolated.",
|
|
5
|
+
"homepage": "https://github.com/Esposter/Esposter/blob/main/packages/virrun#readme",
|
|
6
|
+
"bugs": {
|
|
7
|
+
"url": "https://github.com/Esposter/Esposter/issues"
|
|
8
|
+
},
|
|
9
|
+
"license": "Apache-2.0",
|
|
10
|
+
"author": "Jimmy Chen",
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "git+https://github.com/Esposter/Esposter.git"
|
|
14
|
+
},
|
|
15
|
+
"bin": {
|
|
16
|
+
"virrun": "dist/cli.js"
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"dist"
|
|
20
|
+
],
|
|
21
|
+
"type": "module",
|
|
22
|
+
"main": "dist/index.js",
|
|
23
|
+
"types": "dist/index.d.ts",
|
|
24
|
+
"publishConfig": {
|
|
25
|
+
"access": "public"
|
|
26
|
+
},
|
|
27
|
+
"scripts": {
|
|
28
|
+
"bench": "vitest bench --run",
|
|
29
|
+
"build": "pnpm export:gen && rolldown --config rolldown.config.ts",
|
|
30
|
+
"export:gen": "ctix build --config ../configuration/.ctirc-ts",
|
|
31
|
+
"format": "oxfmt",
|
|
32
|
+
"format:check": "oxfmt --check",
|
|
33
|
+
"lint": "eslint .",
|
|
34
|
+
"lint:fix": "eslint --fix .",
|
|
35
|
+
"test": "vitest",
|
|
36
|
+
"typecheck": "tsgo"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@codspeed/vitest-plugin": "^5.7.1",
|
|
40
|
+
"@esposter/configuration": "2.31.0",
|
|
41
|
+
"@esposter/shared": "2.31.0",
|
|
42
|
+
"@esposter/shared-node": "2.31.0",
|
|
43
|
+
"@platformatic/vfs": "^0.4.0",
|
|
44
|
+
"@types/node": "^26.0.1",
|
|
45
|
+
"ctix": "^2.8.1",
|
|
46
|
+
"rolldown": "^1.1.3",
|
|
47
|
+
"vitest": "^4.1.9"
|
|
48
|
+
},
|
|
49
|
+
"gitHead": "fd2d3fd4f100dbdfbc8195533afc991c01687a55"
|
|
50
|
+
}
|