@secure-exec/core 0.2.1 → 0.3.0-rc.2
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/README.md +5 -5
- package/dist/binary.d.ts +4 -0
- package/dist/binary.js +25 -0
- package/dist/bytes.d.ts +2 -0
- package/dist/bytes.js +6 -0
- package/dist/callbacks.d.ts +41 -0
- package/dist/callbacks.js +94 -0
- package/dist/cargo.d.ts +2 -0
- package/dist/cargo.js +142 -0
- package/dist/correlation.d.ts +10 -0
- package/dist/correlation.js +49 -0
- package/dist/descriptors.d.ts +34 -0
- package/dist/descriptors.js +37 -0
- package/dist/event-buffer.d.ts +90 -0
- package/dist/event-buffer.js +313 -0
- package/dist/ext.d.ts +7 -0
- package/dist/ext.js +13 -0
- package/dist/filesystem.d.ts +41 -0
- package/dist/filesystem.js +70 -0
- package/dist/frame-payload-codec.d.ts +8 -0
- package/dist/frame-payload-codec.js +14 -0
- package/dist/frame-rpc.d.ts +38 -0
- package/dist/frame-rpc.js +73 -0
- package/dist/frame-stream.d.ts +27 -0
- package/dist/frame-stream.js +99 -0
- package/dist/framing.d.ts +7 -0
- package/dist/framing.js +22 -0
- package/dist/generated/AcpLimitsConfig.d.ts +4 -0
- package/dist/generated/AcpLimitsConfig.js +2 -0
- package/dist/generated/CreateVmConfig.d.ts +19 -0
- package/dist/generated/FsPermissionRule.d.ts +6 -0
- package/dist/generated/FsPermissionRuleSet.d.ts +6 -0
- package/dist/generated/FsPermissionRuleSet.js +1 -0
- package/dist/generated/FsPermissionScope.d.ts +3 -0
- package/dist/generated/FsPermissionScope.js +1 -0
- package/dist/generated/HttpLimitsConfig.d.ts +3 -0
- package/dist/generated/HttpLimitsConfig.js +2 -0
- package/dist/generated/JsModuleResolution.d.ts +1 -0
- package/dist/generated/JsModuleResolution.js +2 -0
- package/dist/generated/JsRuntimeConfig.d.ts +26 -0
- package/dist/generated/JsRuntimeConfig.js +1 -0
- package/dist/generated/JsRuntimeLimitsConfig.d.ts +7 -0
- package/dist/generated/JsRuntimeLimitsConfig.js +2 -0
- package/dist/generated/JsRuntimePlatform.d.ts +1 -0
- package/dist/generated/JsRuntimePlatform.js +2 -0
- package/dist/generated/MountPluginDescriptor.d.ts +4 -0
- package/dist/generated/MountPluginDescriptor.js +2 -0
- package/dist/generated/NativeRootFilesystemConfig.d.ts +5 -0
- package/dist/generated/NativeRootFilesystemConfig.js +1 -0
- package/dist/generated/PatternPermissionRule.d.ts +6 -0
- package/dist/generated/PatternPermissionRule.js +1 -0
- package/dist/generated/PatternPermissionRuleSet.d.ts +6 -0
- package/dist/generated/PatternPermissionRuleSet.js +1 -0
- package/dist/generated/PatternPermissionScope.d.ts +3 -0
- package/dist/generated/PatternPermissionScope.js +1 -0
- package/dist/generated/PermissionMode.d.ts +1 -0
- package/dist/generated/PermissionMode.js +2 -0
- package/dist/generated/PermissionsPolicy.d.ts +10 -0
- package/dist/generated/PermissionsPolicy.js +1 -0
- package/dist/generated/PluginLimitsConfig.d.ts +4 -0
- package/dist/generated/PluginLimitsConfig.js +2 -0
- package/dist/generated/PythonLimitsConfig.d.ts +5 -0
- package/dist/generated/PythonLimitsConfig.js +2 -0
- package/dist/generated/ResourceLimitsConfig.d.ts +22 -0
- package/dist/generated/ResourceLimitsConfig.js +2 -0
- package/dist/generated/RootFilesystemConfig.d.ts +9 -0
- package/dist/generated/RootFilesystemConfig.js +1 -0
- package/dist/generated/RootFilesystemEntry.d.ts +13 -0
- package/dist/generated/RootFilesystemEntry.js +1 -0
- package/dist/generated/RootFilesystemEntryEncoding.d.ts +1 -0
- package/dist/generated/RootFilesystemEntryEncoding.js +2 -0
- package/dist/generated/RootFilesystemEntryKind.d.ts +1 -0
- package/dist/generated/RootFilesystemEntryKind.js +2 -0
- package/dist/generated/RootFilesystemLowerDescriptor.d.ts +7 -0
- package/dist/generated/RootFilesystemLowerDescriptor.js +1 -0
- package/dist/generated/RootFilesystemMode.d.ts +1 -0
- package/dist/generated/RootFilesystemMode.js +2 -0
- package/dist/generated/ToolLimitsConfig.d.ts +10 -0
- package/dist/generated/ToolLimitsConfig.js +2 -0
- package/dist/generated/VmDnsConfig.d.ts +6 -0
- package/dist/generated/VmDnsConfig.js +2 -0
- package/dist/generated/VmLimitsConfig.d.ts +18 -0
- package/dist/generated/VmLimitsConfig.js +1 -0
- package/dist/generated/VmListenPolicyConfig.d.ts +5 -0
- package/dist/generated/VmListenPolicyConfig.js +2 -0
- package/dist/generated/WasmLimitsConfig.d.ts +5 -0
- package/dist/generated/WasmLimitsConfig.js +2 -0
- package/dist/generated-protocol.d.ts +1037 -0
- package/dist/generated-protocol.js +2887 -0
- package/dist/index.d.ts +24 -62
- package/dist/index.js +24 -53
- package/dist/json.d.ts +2 -0
- package/dist/json.js +20 -0
- package/dist/kernel-proxy.d.ts +149 -0
- package/dist/kernel-proxy.js +1733 -0
- package/dist/native-client.d.ts +41 -0
- package/dist/native-client.js +124 -0
- package/dist/node-runtime.d.ts +490 -0
- package/dist/node-runtime.js +585 -0
- package/dist/numbers.d.ts +1 -0
- package/dist/numbers.js +8 -0
- package/dist/ownership.d.ts +18 -0
- package/dist/ownership.js +77 -0
- package/dist/permissions.d.ts +29 -0
- package/dist/permissions.js +68 -0
- package/dist/process.d.ts +35 -0
- package/dist/process.js +125 -0
- package/dist/protocol-client.d.ts +46 -0
- package/dist/protocol-client.js +180 -0
- package/dist/protocol-frames.d.ts +68 -0
- package/dist/protocol-frames.js +139 -0
- package/dist/protocol-maps.d.ts +28 -0
- package/dist/protocol-maps.js +217 -0
- package/dist/protocol-schema.d.ts +10 -0
- package/dist/protocol-schema.js +11 -0
- package/dist/request-payloads.d.ts +137 -0
- package/dist/request-payloads.js +210 -0
- package/dist/response-payloads.d.ts +107 -0
- package/dist/response-payloads.js +161 -0
- package/dist/sidecar-client.d.ts +242 -0
- package/dist/sidecar-client.js +797 -0
- package/dist/state.d.ts +40 -0
- package/dist/state.js +44 -0
- package/dist/test-runtime.d.ts +526 -0
- package/dist/test-runtime.js +2119 -0
- package/dist/vm-config.d.ts +31 -0
- package/dist/vm-config.js +1 -0
- package/fixtures/alpine-defaults.json +520 -0
- package/fixtures/base-filesystem.json +528 -0
- package/package.json +193 -115
- package/LICENSE +0 -191
- package/dist/bridge-setup.d.ts +0 -6
- package/dist/bridge-setup.js +0 -9
- package/dist/esm-compiler.d.ts +0 -18
- package/dist/esm-compiler.js +0 -72
- package/dist/fs-helpers.d.ts +0 -23
- package/dist/fs-helpers.js +0 -41
- package/dist/generated/isolate-runtime.d.ts +0 -19
- package/dist/generated/isolate-runtime.js +0 -21
- package/dist/generated/polyfills.d.ts +0 -82
- package/dist/generated/polyfills.js +0 -82
- package/dist/isolate-runtime/apply-custom-global-policy.js +0 -53
- package/dist/isolate-runtime/apply-timing-mitigation-freeze.js +0 -130
- package/dist/isolate-runtime/apply-timing-mitigation-off.js +0 -14
- package/dist/isolate-runtime/bridge-attach.js +0 -29
- package/dist/isolate-runtime/bridge-initial-globals.js +0 -385
- package/dist/isolate-runtime/eval-script-result.js +0 -8
- package/dist/isolate-runtime/global-exposure-helpers.js +0 -36
- package/dist/isolate-runtime/init-commonjs-module-globals.js +0 -28
- package/dist/isolate-runtime/override-process-cwd.js +0 -8
- package/dist/isolate-runtime/override-process-env.js +0 -8
- package/dist/isolate-runtime/require-setup.js +0 -4153
- package/dist/isolate-runtime/set-commonjs-file-globals.js +0 -36
- package/dist/isolate-runtime/set-stdin-data.js +0 -10
- package/dist/isolate-runtime/setup-dynamic-import.js +0 -123
- package/dist/isolate-runtime/setup-fs-facade.js +0 -87
- package/dist/kernel/command-registry.d.ts +0 -44
- package/dist/kernel/command-registry.js +0 -114
- package/dist/kernel/device-backend.d.ts +0 -14
- package/dist/kernel/device-backend.js +0 -251
- package/dist/kernel/device-layer.d.ts +0 -12
- package/dist/kernel/device-layer.js +0 -271
- package/dist/kernel/dns-cache.d.ts +0 -29
- package/dist/kernel/dns-cache.js +0 -52
- package/dist/kernel/fd-table.d.ts +0 -84
- package/dist/kernel/fd-table.js +0 -278
- package/dist/kernel/file-lock.d.ts +0 -34
- package/dist/kernel/file-lock.js +0 -122
- package/dist/kernel/host-adapter.d.ts +0 -50
- package/dist/kernel/host-adapter.js +0 -8
- package/dist/kernel/index.d.ts +0 -36
- package/dist/kernel/index.js +0 -34
- package/dist/kernel/kernel.d.ts +0 -9
- package/dist/kernel/kernel.js +0 -1415
- package/dist/kernel/mount-table.d.ts +0 -75
- package/dist/kernel/mount-table.js +0 -353
- package/dist/kernel/permissions.d.ts +0 -36
- package/dist/kernel/permissions.js +0 -150
- package/dist/kernel/pipe-manager.d.ts +0 -64
- package/dist/kernel/pipe-manager.js +0 -267
- package/dist/kernel/proc-backend.d.ts +0 -30
- package/dist/kernel/proc-backend.js +0 -428
- package/dist/kernel/proc-layer.d.ts +0 -11
- package/dist/kernel/proc-layer.js +0 -507
- package/dist/kernel/process-table.d.ts +0 -126
- package/dist/kernel/process-table.js +0 -651
- package/dist/kernel/pty.d.ts +0 -109
- package/dist/kernel/pty.js +0 -552
- package/dist/kernel/socket-table.d.ts +0 -312
- package/dist/kernel/socket-table.js +0 -1188
- package/dist/kernel/timer-table.d.ts +0 -54
- package/dist/kernel/timer-table.js +0 -108
- package/dist/kernel/types.d.ts +0 -541
- package/dist/kernel/types.js +0 -98
- package/dist/kernel/user.d.ts +0 -29
- package/dist/kernel/user.js +0 -35
- package/dist/kernel/vfs.d.ts +0 -82
- package/dist/kernel/vfs.js +0 -25
- package/dist/kernel/wait.d.ts +0 -45
- package/dist/kernel/wait.js +0 -112
- package/dist/kernel/wstatus.d.ts +0 -21
- package/dist/kernel/wstatus.js +0 -33
- package/dist/module-resolver.d.ts +0 -29
- package/dist/module-resolver.js +0 -314
- package/dist/package-bundler.d.ts +0 -41
- package/dist/package-bundler.js +0 -497
- package/dist/runtime-driver.d.ts +0 -66
- package/dist/shared/api-types.d.ts +0 -83
- package/dist/shared/bridge-contract.d.ts +0 -772
- package/dist/shared/bridge-contract.js +0 -169
- package/dist/shared/console-formatter.d.ts +0 -22
- package/dist/shared/console-formatter.js +0 -161
- package/dist/shared/constants.d.ts +0 -3
- package/dist/shared/constants.js +0 -3
- package/dist/shared/errors.d.ts +0 -16
- package/dist/shared/errors.js +0 -21
- package/dist/shared/esm-utils.d.ts +0 -28
- package/dist/shared/esm-utils.js +0 -97
- package/dist/shared/global-exposure.d.ts +0 -38
- package/dist/shared/global-exposure.js +0 -876
- package/dist/shared/in-memory-fs.d.ts +0 -16
- package/dist/shared/in-memory-fs.js +0 -115
- package/dist/shared/permissions.d.ts +0 -36
- package/dist/shared/permissions.js +0 -314
- package/dist/shared/require-setup.d.ts +0 -6
- package/dist/shared/require-setup.js +0 -9
- package/dist/test/block-store-conformance.d.ts +0 -34
- package/dist/test/block-store-conformance.js +0 -251
- package/dist/test/metadata-store-conformance.d.ts +0 -37
- package/dist/test/metadata-store-conformance.js +0 -646
- package/dist/test/vfs-conformance.d.ts +0 -65
- package/dist/test/vfs-conformance.js +0 -842
- package/dist/types.d.ts +0 -98
- package/dist/types.js +0 -6
- package/dist/vfs/chunked-vfs.d.ts +0 -66
- package/dist/vfs/chunked-vfs.js +0 -1290
- package/dist/vfs/host-block-store.d.ts +0 -19
- package/dist/vfs/host-block-store.js +0 -97
- package/dist/vfs/memory-block-store.d.ts +0 -16
- package/dist/vfs/memory-block-store.js +0 -45
- package/dist/vfs/memory-metadata.d.ts +0 -75
- package/dist/vfs/memory-metadata.js +0 -528
- package/dist/vfs/sqlite-metadata.d.ts +0 -91
- package/dist/vfs/sqlite-metadata.js +0 -582
- package/dist/vfs/types.d.ts +0 -210
- package/dist/vfs/types.js +0 -8
- /package/dist/{runtime-driver.js → generated/CreateVmConfig.js} +0 -0
- /package/dist/{shared/api-types.js → generated/FsPermissionRule.js} +0 -0
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
(() => {
|
|
3
|
-
// ../core/isolate-runtime/src/common/global-exposure.ts
|
|
4
|
-
function defineRuntimeGlobalBinding(name, value, mutable) {
|
|
5
|
-
Object.defineProperty(globalThis, name, {
|
|
6
|
-
value,
|
|
7
|
-
writable: mutable,
|
|
8
|
-
configurable: mutable,
|
|
9
|
-
enumerable: true
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
function createRuntimeGlobalExposer(mutable) {
|
|
13
|
-
return (name, value) => {
|
|
14
|
-
defineRuntimeGlobalBinding(name, value, mutable);
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
function getRuntimeExposeMutableGlobal() {
|
|
18
|
-
if (typeof globalThis.__runtimeExposeMutableGlobal === "function") {
|
|
19
|
-
return globalThis.__runtimeExposeMutableGlobal;
|
|
20
|
-
}
|
|
21
|
-
return createRuntimeGlobalExposer(true);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
// ../core/isolate-runtime/src/inject/set-commonjs-file-globals.ts
|
|
25
|
-
var __runtimeExposeMutableGlobal = getRuntimeExposeMutableGlobal();
|
|
26
|
-
var __commonJsFileConfig = globalThis.__runtimeCommonJsFileConfig ?? {};
|
|
27
|
-
var __filePath = typeof __commonJsFileConfig.filePath === "string" ? __commonJsFileConfig.filePath : "/<entry>.js";
|
|
28
|
-
var __dirname = typeof __commonJsFileConfig.dirname === "string" ? __commonJsFileConfig.dirname : "/";
|
|
29
|
-
__runtimeExposeMutableGlobal("__filename", __filePath);
|
|
30
|
-
__runtimeExposeMutableGlobal("__dirname", __dirname);
|
|
31
|
-
var __currentModule = globalThis._currentModule;
|
|
32
|
-
if (__currentModule) {
|
|
33
|
-
__currentModule.dirname = __dirname;
|
|
34
|
-
__currentModule.filename = __filePath;
|
|
35
|
-
}
|
|
36
|
-
})();
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
(() => {
|
|
3
|
-
// ../core/isolate-runtime/src/inject/set-stdin-data.ts
|
|
4
|
-
if (typeof globalThis._stdinData !== "undefined") {
|
|
5
|
-
globalThis._stdinData = globalThis.__runtimeStdinData;
|
|
6
|
-
globalThis._stdinPosition = 0;
|
|
7
|
-
globalThis._stdinEnded = false;
|
|
8
|
-
globalThis._stdinFlowMode = false;
|
|
9
|
-
}
|
|
10
|
-
})();
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
(() => {
|
|
3
|
-
// ../core/isolate-runtime/src/common/global-access.ts
|
|
4
|
-
function isObjectLike(value) {
|
|
5
|
-
return value !== null && (typeof value === "object" || typeof value === "function");
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
// ../core/isolate-runtime/src/common/global-exposure.ts
|
|
9
|
-
function defineRuntimeGlobalBinding(name, value, mutable) {
|
|
10
|
-
Object.defineProperty(globalThis, name, {
|
|
11
|
-
value,
|
|
12
|
-
writable: mutable,
|
|
13
|
-
configurable: mutable,
|
|
14
|
-
enumerable: true
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
function createRuntimeGlobalExposer(mutable) {
|
|
18
|
-
return (name, value) => {
|
|
19
|
-
defineRuntimeGlobalBinding(name, value, mutable);
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
function getRuntimeExposeCustomGlobal() {
|
|
23
|
-
if (typeof globalThis.__runtimeExposeCustomGlobal === "function") {
|
|
24
|
-
return globalThis.__runtimeExposeCustomGlobal;
|
|
25
|
-
}
|
|
26
|
-
return createRuntimeGlobalExposer(false);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// ../core/isolate-runtime/src/inject/setup-dynamic-import.ts
|
|
30
|
-
var __runtimeExposeCustomGlobal = getRuntimeExposeCustomGlobal();
|
|
31
|
-
var __dynamicImportConfig = globalThis.__runtimeDynamicImportConfig ?? {};
|
|
32
|
-
var __fallbackReferrer = typeof __dynamicImportConfig.referrerPath === "string" && __dynamicImportConfig.referrerPath.length > 0 ? __dynamicImportConfig.referrerPath : "/";
|
|
33
|
-
var __dynamicImportCache = /* @__PURE__ */ new Map();
|
|
34
|
-
var __pathToFileURL = typeof globalThis.require === "function" ? globalThis.require("node:url").pathToFileURL ?? null : null;
|
|
35
|
-
var __resolveDynamicImportPath = function(request, referrer) {
|
|
36
|
-
if (!request.startsWith("./") && !request.startsWith("../") && !request.startsWith("/")) {
|
|
37
|
-
return request;
|
|
38
|
-
}
|
|
39
|
-
const baseDir = referrer.endsWith("/") ? referrer : referrer.slice(0, referrer.lastIndexOf("/")) || "/";
|
|
40
|
-
const segments = baseDir.split("/").filter(Boolean);
|
|
41
|
-
for (const part of request.split("/")) {
|
|
42
|
-
if (part === "." || part.length === 0) continue;
|
|
43
|
-
if (part === "..") {
|
|
44
|
-
segments.pop();
|
|
45
|
-
continue;
|
|
46
|
-
}
|
|
47
|
-
segments.push(part);
|
|
48
|
-
}
|
|
49
|
-
return `/${segments.join("/")}`;
|
|
50
|
-
};
|
|
51
|
-
var __dynamicImportHandler = function(specifier, fromPath) {
|
|
52
|
-
const request = String(specifier);
|
|
53
|
-
const referrer = typeof fromPath === "string" && fromPath.length > 0 ? fromPath : __fallbackReferrer;
|
|
54
|
-
let resolved = null;
|
|
55
|
-
if (typeof globalThis._resolveModuleSync !== "undefined") {
|
|
56
|
-
resolved = globalThis._resolveModuleSync.applySync(
|
|
57
|
-
void 0,
|
|
58
|
-
[request, referrer, "import"]
|
|
59
|
-
);
|
|
60
|
-
}
|
|
61
|
-
const resolvedPath = typeof resolved === "string" && resolved.length > 0 ? resolved : __resolveDynamicImportPath(request, referrer);
|
|
62
|
-
const cacheKey = typeof resolved === "string" && resolved.length > 0 ? resolved : `${referrer}\0${request}`;
|
|
63
|
-
const cached = __dynamicImportCache.get(cacheKey);
|
|
64
|
-
if (cached) return Promise.resolve(cached);
|
|
65
|
-
if (typeof globalThis._requireFrom !== "function") {
|
|
66
|
-
throw new Error("Cannot load module: " + resolvedPath);
|
|
67
|
-
}
|
|
68
|
-
let mod;
|
|
69
|
-
try {
|
|
70
|
-
mod = globalThis._requireFrom(resolved ?? request, referrer);
|
|
71
|
-
} catch (error) {
|
|
72
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
73
|
-
if (error && typeof error === "object" && "code" in error && error.code === "MODULE_NOT_FOUND") {
|
|
74
|
-
throw new Error("Cannot load module: " + resolvedPath);
|
|
75
|
-
}
|
|
76
|
-
if (message.startsWith("Cannot find module ")) {
|
|
77
|
-
throw new Error("Cannot load module: " + resolvedPath);
|
|
78
|
-
}
|
|
79
|
-
throw error;
|
|
80
|
-
}
|
|
81
|
-
const namespaceFallback = { default: mod };
|
|
82
|
-
if (isObjectLike(mod)) {
|
|
83
|
-
for (const key of Object.keys(mod)) {
|
|
84
|
-
if (!(key in namespaceFallback)) {
|
|
85
|
-
namespaceFallback[key] = mod[key];
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
__dynamicImportCache.set(cacheKey, namespaceFallback);
|
|
90
|
-
return Promise.resolve(namespaceFallback);
|
|
91
|
-
};
|
|
92
|
-
var __importMetaResolveHandler = function(specifier, fromPath) {
|
|
93
|
-
const request = String(specifier);
|
|
94
|
-
const referrer = typeof fromPath === "string" && fromPath.length > 0 ? fromPath : __fallbackReferrer;
|
|
95
|
-
let resolved = null;
|
|
96
|
-
if (typeof globalThis._resolveModuleSync !== "undefined") {
|
|
97
|
-
resolved = globalThis._resolveModuleSync.applySync(
|
|
98
|
-
void 0,
|
|
99
|
-
[request, referrer, "import"]
|
|
100
|
-
);
|
|
101
|
-
}
|
|
102
|
-
if (resolved === null || resolved === void 0) {
|
|
103
|
-
resolved = globalThis._resolveModule.applySyncPromise(
|
|
104
|
-
void 0,
|
|
105
|
-
[request, referrer, "import"]
|
|
106
|
-
);
|
|
107
|
-
}
|
|
108
|
-
if (resolved === null) {
|
|
109
|
-
const err = new Error("Cannot find module '" + request + "'");
|
|
110
|
-
err.code = "MODULE_NOT_FOUND";
|
|
111
|
-
throw err;
|
|
112
|
-
}
|
|
113
|
-
if (resolved.startsWith("node:")) {
|
|
114
|
-
return resolved;
|
|
115
|
-
}
|
|
116
|
-
if (__pathToFileURL && resolved.startsWith("/")) {
|
|
117
|
-
return __pathToFileURL(resolved).href;
|
|
118
|
-
}
|
|
119
|
-
return resolved;
|
|
120
|
-
};
|
|
121
|
-
__runtimeExposeCustomGlobal("__dynamicImport", __dynamicImportHandler);
|
|
122
|
-
__runtimeExposeCustomGlobal("__importMetaResolve", __importMetaResolveHandler);
|
|
123
|
-
})();
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
(() => {
|
|
3
|
-
// ../core/isolate-runtime/src/common/global-exposure.ts
|
|
4
|
-
function defineRuntimeGlobalBinding(name, value, mutable) {
|
|
5
|
-
Object.defineProperty(globalThis, name, {
|
|
6
|
-
value,
|
|
7
|
-
writable: mutable,
|
|
8
|
-
configurable: mutable,
|
|
9
|
-
enumerable: true
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
function createRuntimeGlobalExposer(mutable) {
|
|
13
|
-
return (name, value) => {
|
|
14
|
-
defineRuntimeGlobalBinding(name, value, mutable);
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
function getRuntimeExposeCustomGlobal() {
|
|
18
|
-
if (typeof globalThis.__runtimeExposeCustomGlobal === "function") {
|
|
19
|
-
return globalThis.__runtimeExposeCustomGlobal;
|
|
20
|
-
}
|
|
21
|
-
return createRuntimeGlobalExposer(false);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
// ../core/isolate-runtime/src/inject/setup-fs-facade.ts
|
|
25
|
-
var __runtimeExposeCustomGlobal = getRuntimeExposeCustomGlobal();
|
|
26
|
-
var __fsFacade = {};
|
|
27
|
-
Object.defineProperties(__fsFacade, {
|
|
28
|
-
readFile: { get() {
|
|
29
|
-
return globalThis._fsReadFile;
|
|
30
|
-
}, enumerable: true },
|
|
31
|
-
writeFile: { get() {
|
|
32
|
-
return globalThis._fsWriteFile;
|
|
33
|
-
}, enumerable: true },
|
|
34
|
-
readFileBinary: { get() {
|
|
35
|
-
return globalThis._fsReadFileBinary;
|
|
36
|
-
}, enumerable: true },
|
|
37
|
-
writeFileBinary: { get() {
|
|
38
|
-
return globalThis._fsWriteFileBinary;
|
|
39
|
-
}, enumerable: true },
|
|
40
|
-
readDir: { get() {
|
|
41
|
-
return globalThis._fsReadDir;
|
|
42
|
-
}, enumerable: true },
|
|
43
|
-
mkdir: { get() {
|
|
44
|
-
return globalThis._fsMkdir;
|
|
45
|
-
}, enumerable: true },
|
|
46
|
-
rmdir: { get() {
|
|
47
|
-
return globalThis._fsRmdir;
|
|
48
|
-
}, enumerable: true },
|
|
49
|
-
exists: { get() {
|
|
50
|
-
return globalThis._fsExists;
|
|
51
|
-
}, enumerable: true },
|
|
52
|
-
stat: { get() {
|
|
53
|
-
return globalThis._fsStat;
|
|
54
|
-
}, enumerable: true },
|
|
55
|
-
unlink: { get() {
|
|
56
|
-
return globalThis._fsUnlink;
|
|
57
|
-
}, enumerable: true },
|
|
58
|
-
rename: { get() {
|
|
59
|
-
return globalThis._fsRename;
|
|
60
|
-
}, enumerable: true },
|
|
61
|
-
chmod: { get() {
|
|
62
|
-
return globalThis._fsChmod;
|
|
63
|
-
}, enumerable: true },
|
|
64
|
-
chown: { get() {
|
|
65
|
-
return globalThis._fsChown;
|
|
66
|
-
}, enumerable: true },
|
|
67
|
-
link: { get() {
|
|
68
|
-
return globalThis._fsLink;
|
|
69
|
-
}, enumerable: true },
|
|
70
|
-
symlink: { get() {
|
|
71
|
-
return globalThis._fsSymlink;
|
|
72
|
-
}, enumerable: true },
|
|
73
|
-
readlink: { get() {
|
|
74
|
-
return globalThis._fsReadlink;
|
|
75
|
-
}, enumerable: true },
|
|
76
|
-
lstat: { get() {
|
|
77
|
-
return globalThis._fsLstat;
|
|
78
|
-
}, enumerable: true },
|
|
79
|
-
truncate: { get() {
|
|
80
|
-
return globalThis._fsTruncate;
|
|
81
|
-
}, enumerable: true },
|
|
82
|
-
utimes: { get() {
|
|
83
|
-
return globalThis._fsUtimes;
|
|
84
|
-
}, enumerable: true }
|
|
85
|
-
});
|
|
86
|
-
__runtimeExposeCustomGlobal("_fs", __fsFacade);
|
|
87
|
-
})();
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Command registry.
|
|
3
|
-
*
|
|
4
|
-
* Maps command names to runtime drivers. When a process calls
|
|
5
|
-
* spawn("grep", ...), the registry resolves "grep" to the WasmVM driver.
|
|
6
|
-
* Also populates /bin in the VFS so shell PATH lookup succeeds.
|
|
7
|
-
*/
|
|
8
|
-
import type { RuntimeDriver } from "./types.js";
|
|
9
|
-
import type { VirtualFileSystem } from "./vfs.js";
|
|
10
|
-
export declare class CommandRegistry {
|
|
11
|
-
/** command name → RuntimeDriver */
|
|
12
|
-
private commands;
|
|
13
|
-
/** Warning log for command overrides. */
|
|
14
|
-
private warnings;
|
|
15
|
-
/**
|
|
16
|
-
* Register all commands from a driver.
|
|
17
|
-
* Last-mounted driver wins on conflicts (allows override with warning).
|
|
18
|
-
*/
|
|
19
|
-
register(driver: RuntimeDriver): void;
|
|
20
|
-
/** Get recorded warnings (for testing). */
|
|
21
|
-
getWarnings(): readonly string[];
|
|
22
|
-
/**
|
|
23
|
-
* Register a single command to a driver.
|
|
24
|
-
* Used for on-demand dynamic registration (e.g. after tryResolve).
|
|
25
|
-
*/
|
|
26
|
-
registerCommand(command: string, driver: RuntimeDriver): void;
|
|
27
|
-
/**
|
|
28
|
-
* Resolve a command name to a driver. Returns null if unknown.
|
|
29
|
-
* Supports path-based lookup: '/bin/ls' resolves to the driver for 'ls'.
|
|
30
|
-
*/
|
|
31
|
-
resolve(command: string): RuntimeDriver | null;
|
|
32
|
-
/** List all registered commands. Returns command → driver name. */
|
|
33
|
-
list(): Map<string, string>;
|
|
34
|
-
/**
|
|
35
|
-
* Create a single /bin stub entry for a command.
|
|
36
|
-
* Used for on-demand registration after tryResolve discovers a new command.
|
|
37
|
-
*/
|
|
38
|
-
populateBinEntry(vfs: VirtualFileSystem, command: string): Promise<void>;
|
|
39
|
-
/**
|
|
40
|
-
* Populate /bin in the VFS with stub entries for all registered commands.
|
|
41
|
-
* This enables brush-shell's PATH lookup to find commands.
|
|
42
|
-
*/
|
|
43
|
-
populateBin(vfs: VirtualFileSystem): Promise<void>;
|
|
44
|
-
}
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Command registry.
|
|
3
|
-
*
|
|
4
|
-
* Maps command names to runtime drivers. When a process calls
|
|
5
|
-
* spawn("grep", ...), the registry resolves "grep" to the WasmVM driver.
|
|
6
|
-
* Also populates /bin in the VFS so shell PATH lookup succeeds.
|
|
7
|
-
*/
|
|
8
|
-
export class CommandRegistry {
|
|
9
|
-
/** command name → RuntimeDriver */
|
|
10
|
-
commands = new Map();
|
|
11
|
-
/** Warning log for command overrides. */
|
|
12
|
-
warnings = [];
|
|
13
|
-
/**
|
|
14
|
-
* Register all commands from a driver.
|
|
15
|
-
* Last-mounted driver wins on conflicts (allows override with warning).
|
|
16
|
-
*/
|
|
17
|
-
register(driver) {
|
|
18
|
-
for (const cmd of driver.commands) {
|
|
19
|
-
const existing = this.commands.get(cmd);
|
|
20
|
-
if (existing) {
|
|
21
|
-
const msg = `command "${cmd}" overridden: ${existing.name} → ${driver.name}`;
|
|
22
|
-
this.warnings.push(msg);
|
|
23
|
-
console.warn(`[CommandRegistry] ${msg}`);
|
|
24
|
-
}
|
|
25
|
-
this.commands.set(cmd, driver);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
/** Get recorded warnings (for testing). */
|
|
29
|
-
getWarnings() {
|
|
30
|
-
return this.warnings;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Register a single command to a driver.
|
|
34
|
-
* Used for on-demand dynamic registration (e.g. after tryResolve).
|
|
35
|
-
*/
|
|
36
|
-
registerCommand(command, driver) {
|
|
37
|
-
const existing = this.commands.get(command);
|
|
38
|
-
if (existing) {
|
|
39
|
-
const msg = `command "${command}" overridden: ${existing.name} → ${driver.name}`;
|
|
40
|
-
this.warnings.push(msg);
|
|
41
|
-
console.warn(`[CommandRegistry] ${msg}`);
|
|
42
|
-
}
|
|
43
|
-
this.commands.set(command, driver);
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Resolve a command name to a driver. Returns null if unknown.
|
|
47
|
-
* Supports path-based lookup: '/bin/ls' resolves to the driver for 'ls'.
|
|
48
|
-
*/
|
|
49
|
-
resolve(command) {
|
|
50
|
-
// Direct name lookup
|
|
51
|
-
const direct = this.commands.get(command);
|
|
52
|
-
if (direct)
|
|
53
|
-
return direct;
|
|
54
|
-
// Path-based: extract basename and retry
|
|
55
|
-
if (command.includes("/")) {
|
|
56
|
-
const basename = command.split("/").pop();
|
|
57
|
-
if (basename)
|
|
58
|
-
return this.commands.get(basename) ?? null;
|
|
59
|
-
}
|
|
60
|
-
return null;
|
|
61
|
-
}
|
|
62
|
-
/** List all registered commands. Returns command → driver name. */
|
|
63
|
-
list() {
|
|
64
|
-
const result = new Map();
|
|
65
|
-
for (const [cmd, driver] of this.commands) {
|
|
66
|
-
result.set(cmd, driver.name);
|
|
67
|
-
}
|
|
68
|
-
return result;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Create a single /bin stub entry for a command.
|
|
72
|
-
* Used for on-demand registration after tryResolve discovers a new command.
|
|
73
|
-
*/
|
|
74
|
-
async populateBinEntry(vfs, command) {
|
|
75
|
-
if (!(await vfs.exists("/bin"))) {
|
|
76
|
-
await vfs.mkdir("/bin", { recursive: true });
|
|
77
|
-
}
|
|
78
|
-
const path = `/bin/${command}`;
|
|
79
|
-
if (!(await vfs.exists(path))) {
|
|
80
|
-
const stub = new TextEncoder().encode("#!/bin/sh\n# kernel command stub\n");
|
|
81
|
-
await vfs.writeFile(path, stub);
|
|
82
|
-
try {
|
|
83
|
-
await vfs.chmod(path, 0o755);
|
|
84
|
-
}
|
|
85
|
-
catch {
|
|
86
|
-
// chmod may not be supported by all VFS backends
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* Populate /bin in the VFS with stub entries for all registered commands.
|
|
92
|
-
* This enables brush-shell's PATH lookup to find commands.
|
|
93
|
-
*/
|
|
94
|
-
async populateBin(vfs) {
|
|
95
|
-
// Ensure /bin exists
|
|
96
|
-
if (!(await vfs.exists("/bin"))) {
|
|
97
|
-
await vfs.mkdir("/bin", { recursive: true });
|
|
98
|
-
}
|
|
99
|
-
// Create a stub file for each command
|
|
100
|
-
const stub = new TextEncoder().encode("#!/bin/sh\n# kernel command stub\n");
|
|
101
|
-
for (const cmd of this.commands.keys()) {
|
|
102
|
-
const path = `/bin/${cmd}`;
|
|
103
|
-
if (!(await vfs.exists(path))) {
|
|
104
|
-
await vfs.writeFile(path, stub);
|
|
105
|
-
try {
|
|
106
|
-
await vfs.chmod(path, 0o755);
|
|
107
|
-
}
|
|
108
|
-
catch {
|
|
109
|
-
// chmod may not be supported by all VFS backends
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Device backend.
|
|
3
|
-
*
|
|
4
|
-
* Standalone VirtualFileSystem that handles device nodes.
|
|
5
|
-
* Receives relative paths (e.g. "null" not "/dev/null").
|
|
6
|
-
* Designed to be mounted at /dev via MountTable.
|
|
7
|
-
*/
|
|
8
|
-
import type { VirtualFileSystem } from "./vfs.js";
|
|
9
|
-
/**
|
|
10
|
-
* Create a standalone device backend VFS.
|
|
11
|
-
* All paths are relative to /dev (e.g. "null", "zero", "pts/0").
|
|
12
|
-
* Mount at /dev via MountTable.
|
|
13
|
-
*/
|
|
14
|
-
export declare function createDeviceBackend(): VirtualFileSystem;
|
|
@@ -1,251 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Device backend.
|
|
3
|
-
*
|
|
4
|
-
* Standalone VirtualFileSystem that handles device nodes.
|
|
5
|
-
* Receives relative paths (e.g. "null" not "/dev/null").
|
|
6
|
-
* Designed to be mounted at /dev via MountTable.
|
|
7
|
-
*/
|
|
8
|
-
import { KernelError } from "./types.js";
|
|
9
|
-
const DEVICE_NAMES = new Set([
|
|
10
|
-
"null",
|
|
11
|
-
"zero",
|
|
12
|
-
"stdin",
|
|
13
|
-
"stdout",
|
|
14
|
-
"stderr",
|
|
15
|
-
"urandom",
|
|
16
|
-
"random",
|
|
17
|
-
"tty",
|
|
18
|
-
"console",
|
|
19
|
-
"full",
|
|
20
|
-
"ptmx",
|
|
21
|
-
]);
|
|
22
|
-
const DEVICE_INO = {
|
|
23
|
-
null: 0xffff_0001,
|
|
24
|
-
zero: 0xffff_0002,
|
|
25
|
-
stdin: 0xffff_0003,
|
|
26
|
-
stdout: 0xffff_0004,
|
|
27
|
-
stderr: 0xffff_0005,
|
|
28
|
-
urandom: 0xffff_0006,
|
|
29
|
-
random: 0xffff_0007,
|
|
30
|
-
tty: 0xffff_0008,
|
|
31
|
-
console: 0xffff_0009,
|
|
32
|
-
full: 0xffff_000a,
|
|
33
|
-
ptmx: 0xffff_000b,
|
|
34
|
-
};
|
|
35
|
-
/** Device pseudo-directories that contain dynamic entries. */
|
|
36
|
-
const DEVICE_DIRS = new Set(["fd", "pts", "shm"]);
|
|
37
|
-
function isDeviceName(path) {
|
|
38
|
-
return (DEVICE_NAMES.has(path) || path.startsWith("fd/") || path.startsWith("pts/"));
|
|
39
|
-
}
|
|
40
|
-
function isDeviceDir(path) {
|
|
41
|
-
return path === "" || DEVICE_DIRS.has(path);
|
|
42
|
-
}
|
|
43
|
-
function deviceStat(path) {
|
|
44
|
-
const now = Date.now();
|
|
45
|
-
return {
|
|
46
|
-
mode: 0o666,
|
|
47
|
-
size: 0,
|
|
48
|
-
isDirectory: false,
|
|
49
|
-
isSymbolicLink: false,
|
|
50
|
-
atimeMs: now,
|
|
51
|
-
mtimeMs: now,
|
|
52
|
-
ctimeMs: now,
|
|
53
|
-
birthtimeMs: now,
|
|
54
|
-
ino: DEVICE_INO[path] ?? 0xffff_0000,
|
|
55
|
-
nlink: 1,
|
|
56
|
-
uid: 0,
|
|
57
|
-
gid: 0,
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
function dirStat(path) {
|
|
61
|
-
const now = Date.now();
|
|
62
|
-
return {
|
|
63
|
-
mode: 0o755,
|
|
64
|
-
size: 0,
|
|
65
|
-
isDirectory: true,
|
|
66
|
-
isSymbolicLink: false,
|
|
67
|
-
atimeMs: now,
|
|
68
|
-
mtimeMs: now,
|
|
69
|
-
ctimeMs: now,
|
|
70
|
-
birthtimeMs: now,
|
|
71
|
-
ino: DEVICE_INO[path] ?? 0xffff_0000,
|
|
72
|
-
nlink: 2,
|
|
73
|
-
uid: 0,
|
|
74
|
-
gid: 0,
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
const DEV_DIR_ENTRIES = [
|
|
78
|
-
{ name: "null", isDirectory: false },
|
|
79
|
-
{ name: "zero", isDirectory: false },
|
|
80
|
-
{ name: "stdin", isDirectory: false },
|
|
81
|
-
{ name: "stdout", isDirectory: false },
|
|
82
|
-
{ name: "stderr", isDirectory: false },
|
|
83
|
-
{ name: "urandom", isDirectory: false },
|
|
84
|
-
{ name: "random", isDirectory: false },
|
|
85
|
-
{ name: "tty", isDirectory: false },
|
|
86
|
-
{ name: "console", isDirectory: false },
|
|
87
|
-
{ name: "full", isDirectory: false },
|
|
88
|
-
{ name: "ptmx", isDirectory: false },
|
|
89
|
-
{ name: "fd", isDirectory: true },
|
|
90
|
-
{ name: "pts", isDirectory: true },
|
|
91
|
-
{ name: "shm", isDirectory: true },
|
|
92
|
-
];
|
|
93
|
-
function randomBytes(length) {
|
|
94
|
-
const buf = new Uint8Array(length);
|
|
95
|
-
if (typeof globalThis.crypto?.getRandomValues === "function") {
|
|
96
|
-
globalThis.crypto.getRandomValues(buf);
|
|
97
|
-
}
|
|
98
|
-
else {
|
|
99
|
-
for (let i = 0; i < buf.length; i++) {
|
|
100
|
-
buf[i] = (Math.random() * 256) | 0;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
return buf;
|
|
104
|
-
}
|
|
105
|
-
function notFound(path) {
|
|
106
|
-
throw new KernelError("ENOENT", `no such device: ${path}`);
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Create a standalone device backend VFS.
|
|
110
|
-
* All paths are relative to /dev (e.g. "null", "zero", "pts/0").
|
|
111
|
-
* Mount at /dev via MountTable.
|
|
112
|
-
*/
|
|
113
|
-
export function createDeviceBackend() {
|
|
114
|
-
const backend = {
|
|
115
|
-
async readFile(path) {
|
|
116
|
-
if (path === "null" || path === "full")
|
|
117
|
-
return new Uint8Array(0);
|
|
118
|
-
if (path === "zero")
|
|
119
|
-
return new Uint8Array(4096);
|
|
120
|
-
if (path === "urandom" || path === "random")
|
|
121
|
-
return randomBytes(4096);
|
|
122
|
-
if (path === "tty" || path === "console" || path === "ptmx")
|
|
123
|
-
return new Uint8Array(0);
|
|
124
|
-
if (path === "stdin" || path === "stdout" || path === "stderr")
|
|
125
|
-
return new Uint8Array(0);
|
|
126
|
-
notFound(path);
|
|
127
|
-
},
|
|
128
|
-
async pread(path, _offset, length) {
|
|
129
|
-
if (path === "null" || path === "full")
|
|
130
|
-
return new Uint8Array(0);
|
|
131
|
-
if (path === "zero")
|
|
132
|
-
return new Uint8Array(length);
|
|
133
|
-
if (path === "urandom" || path === "random")
|
|
134
|
-
return randomBytes(length);
|
|
135
|
-
if (path === "tty" || path === "console" || path === "ptmx")
|
|
136
|
-
return new Uint8Array(0);
|
|
137
|
-
if (path === "stdin" || path === "stdout" || path === "stderr")
|
|
138
|
-
return new Uint8Array(0);
|
|
139
|
-
notFound(path);
|
|
140
|
-
},
|
|
141
|
-
async readTextFile(path) {
|
|
142
|
-
const bytes = await this.readFile(path);
|
|
143
|
-
return new TextDecoder().decode(bytes);
|
|
144
|
-
},
|
|
145
|
-
async readDir(path) {
|
|
146
|
-
if (path === "")
|
|
147
|
-
return DEV_DIR_ENTRIES.map((e) => e.name);
|
|
148
|
-
if (DEVICE_DIRS.has(path))
|
|
149
|
-
return [];
|
|
150
|
-
notFound(path);
|
|
151
|
-
},
|
|
152
|
-
async readDirWithTypes(path) {
|
|
153
|
-
if (path === "")
|
|
154
|
-
return DEV_DIR_ENTRIES;
|
|
155
|
-
if (DEVICE_DIRS.has(path))
|
|
156
|
-
return [];
|
|
157
|
-
notFound(path);
|
|
158
|
-
},
|
|
159
|
-
async writeFile(path, _content) {
|
|
160
|
-
if (path === "full")
|
|
161
|
-
throw new KernelError("ENOSPC", "No space left on device");
|
|
162
|
-
if (DEVICE_NAMES.has(path) ||
|
|
163
|
-
path.startsWith("fd/") ||
|
|
164
|
-
path.startsWith("pts/")) {
|
|
165
|
-
return;
|
|
166
|
-
}
|
|
167
|
-
notFound(path);
|
|
168
|
-
},
|
|
169
|
-
async pwrite(path, _offset, _data) {
|
|
170
|
-
if (path === "full")
|
|
171
|
-
throw new KernelError("ENOSPC", "No space left on device");
|
|
172
|
-
if (DEVICE_NAMES.has(path) ||
|
|
173
|
-
path.startsWith("fd/") ||
|
|
174
|
-
path.startsWith("pts/")) {
|
|
175
|
-
return;
|
|
176
|
-
}
|
|
177
|
-
notFound(path);
|
|
178
|
-
},
|
|
179
|
-
async createDir(path) {
|
|
180
|
-
if (isDeviceDir(path))
|
|
181
|
-
return;
|
|
182
|
-
throw new KernelError("EPERM", "cannot create directory in /dev");
|
|
183
|
-
},
|
|
184
|
-
async mkdir(path, _options) {
|
|
185
|
-
if (isDeviceDir(path))
|
|
186
|
-
return;
|
|
187
|
-
throw new KernelError("EPERM", "cannot create directory in /dev");
|
|
188
|
-
},
|
|
189
|
-
async exists(path) {
|
|
190
|
-
return isDeviceName(path) || isDeviceDir(path);
|
|
191
|
-
},
|
|
192
|
-
async stat(path) {
|
|
193
|
-
if (isDeviceName(path))
|
|
194
|
-
return deviceStat(path);
|
|
195
|
-
if (isDeviceDir(path))
|
|
196
|
-
return dirStat(path);
|
|
197
|
-
notFound(path);
|
|
198
|
-
},
|
|
199
|
-
async removeFile(path) {
|
|
200
|
-
if (isDeviceName(path))
|
|
201
|
-
throw new KernelError("EPERM", "cannot remove device");
|
|
202
|
-
notFound(path);
|
|
203
|
-
},
|
|
204
|
-
async removeDir(path) {
|
|
205
|
-
if (isDeviceDir(path))
|
|
206
|
-
throw new KernelError("EPERM", "cannot remove device directory");
|
|
207
|
-
notFound(path);
|
|
208
|
-
},
|
|
209
|
-
async rename(_oldPath, _newPath) {
|
|
210
|
-
throw new KernelError("EPERM", "cannot rename device");
|
|
211
|
-
},
|
|
212
|
-
async realpath(path) {
|
|
213
|
-
if (isDeviceName(path) || isDeviceDir(path))
|
|
214
|
-
return path;
|
|
215
|
-
notFound(path);
|
|
216
|
-
},
|
|
217
|
-
async symlink(_target, _linkPath) {
|
|
218
|
-
throw new KernelError("EPERM", "cannot create symlink in /dev");
|
|
219
|
-
},
|
|
220
|
-
async readlink(path) {
|
|
221
|
-
notFound(path);
|
|
222
|
-
},
|
|
223
|
-
async lstat(path) {
|
|
224
|
-
return this.stat(path);
|
|
225
|
-
},
|
|
226
|
-
async link(_oldPath, _newPath) {
|
|
227
|
-
throw new KernelError("EPERM", "cannot link device");
|
|
228
|
-
},
|
|
229
|
-
async chmod(path, _mode) {
|
|
230
|
-
if (isDeviceName(path) || isDeviceDir(path))
|
|
231
|
-
return;
|
|
232
|
-
notFound(path);
|
|
233
|
-
},
|
|
234
|
-
async chown(path, _uid, _gid) {
|
|
235
|
-
if (isDeviceName(path) || isDeviceDir(path))
|
|
236
|
-
return;
|
|
237
|
-
notFound(path);
|
|
238
|
-
},
|
|
239
|
-
async utimes(path, _atime, _mtime) {
|
|
240
|
-
if (isDeviceName(path) || isDeviceDir(path))
|
|
241
|
-
return;
|
|
242
|
-
notFound(path);
|
|
243
|
-
},
|
|
244
|
-
async truncate(path, _length) {
|
|
245
|
-
if (isDeviceName(path) || isDeviceDir(path))
|
|
246
|
-
return;
|
|
247
|
-
notFound(path);
|
|
248
|
-
},
|
|
249
|
-
};
|
|
250
|
-
return backend;
|
|
251
|
-
}
|