eser 4.0.7 → 4.0.8
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/eser.js +1078 -1073
- package/package.json +1 -1
package/eser.js
CHANGED
|
@@ -55,89 +55,108 @@ var init_types = __esm({
|
|
|
55
55
|
});
|
|
56
56
|
|
|
57
57
|
// pkg/@eser/standards/runtime/detect.ts
|
|
58
|
-
var detectRuntime, getRuntimeVersion, isDeno, isNode, isBun, isWorkerd, isBrowser, isServer, isEdge;
|
|
58
|
+
var globalRef, isWorkerdEnv, isBrowserEnv, detectRuntime, versionGetters, getRuntimeVersion, isDeno, isNode, isBun, isWorkerd, isBrowser, SERVER_RUNTIMES, isServer, isEdge;
|
|
59
59
|
var init_detect = __esm({
|
|
60
60
|
"pkg/@eser/standards/runtime/detect.ts"() {
|
|
61
|
+
globalRef = globalThis;
|
|
62
|
+
isWorkerdEnv = () => typeof globalRef.caches !== "undefined" && typeof globalRef.Request !== "undefined" && typeof globalRef.Response !== "undefined" && typeof globalRef.window === "undefined" && typeof globalRef.document === "undefined";
|
|
63
|
+
isBrowserEnv = () => typeof globalRef.window !== "undefined" || typeof globalRef.document !== "undefined";
|
|
61
64
|
detectRuntime = () => {
|
|
62
|
-
if (typeof globalThis
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
const proc = globalThis.process;
|
|
70
|
-
if (proc?.versions?.node && !proc?.versions?.bun) {
|
|
71
|
-
return "node";
|
|
72
|
-
}
|
|
73
|
-
const g = globalThis;
|
|
74
|
-
if (typeof g.caches !== "undefined" && typeof g.Request !== "undefined" && typeof g.Response !== "undefined" && typeof g.window === "undefined" && typeof g.document === "undefined") {
|
|
75
|
-
return "workerd";
|
|
76
|
-
}
|
|
77
|
-
if (typeof g.window !== "undefined" || typeof g.document !== "undefined") {
|
|
78
|
-
return "browser";
|
|
79
|
-
}
|
|
80
|
-
}
|
|
65
|
+
if (typeof globalThis === "undefined") return "unknown";
|
|
66
|
+
if (typeof globalRef.Bun !== "undefined") return "bun";
|
|
67
|
+
if (typeof globalRef.Deno !== "undefined") return "deno";
|
|
68
|
+
const proc = globalRef.process;
|
|
69
|
+
if (proc?.versions?.node && !proc?.versions?.bun) return "node";
|
|
70
|
+
if (isWorkerdEnv()) return "workerd";
|
|
71
|
+
if (isBrowserEnv()) return "browser";
|
|
81
72
|
return "unknown";
|
|
82
73
|
};
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
return globalThis.Bun?.version ?? "unknown";
|
|
91
|
-
}
|
|
92
|
-
case "node": {
|
|
93
|
-
return globalThis.process?.versions?.node ?? "unknown";
|
|
94
|
-
}
|
|
95
|
-
case "workerd": {
|
|
96
|
-
return "unknown";
|
|
97
|
-
}
|
|
98
|
-
case "browser": {
|
|
99
|
-
return globalThis.navigator?.userAgent ?? "unknown";
|
|
100
|
-
}
|
|
101
|
-
default: {
|
|
102
|
-
return "unknown";
|
|
103
|
-
}
|
|
104
|
-
}
|
|
74
|
+
versionGetters = {
|
|
75
|
+
deno: () => globalRef.Deno?.version?.deno ?? "unknown",
|
|
76
|
+
bun: () => globalRef.Bun?.version ?? "unknown",
|
|
77
|
+
node: () => globalRef.process?.versions?.node ?? "unknown",
|
|
78
|
+
workerd: () => "unknown",
|
|
79
|
+
browser: () => globalRef.navigator?.userAgent ?? "unknown",
|
|
80
|
+
unknown: () => "unknown"
|
|
105
81
|
};
|
|
82
|
+
getRuntimeVersion = () => versionGetters[detectRuntime()]();
|
|
106
83
|
isDeno = () => detectRuntime() === "deno";
|
|
107
84
|
isNode = () => detectRuntime() === "node";
|
|
108
85
|
isBun = () => detectRuntime() === "bun";
|
|
109
86
|
isWorkerd = () => detectRuntime() === "workerd";
|
|
110
87
|
isBrowser = () => detectRuntime() === "browser";
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
88
|
+
SERVER_RUNTIMES = /* @__PURE__ */ new Set([
|
|
89
|
+
"deno",
|
|
90
|
+
"node",
|
|
91
|
+
"bun"
|
|
92
|
+
]);
|
|
93
|
+
isServer = () => SERVER_RUNTIMES.has(detectRuntime());
|
|
94
|
+
isEdge = () => detectRuntime() === "workerd";
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
// pkg/@eser/standards/runtime/helpers.ts
|
|
99
|
+
var getEnvVar, getFirstEnvVar, tryRequire, getProcess, getNavigator;
|
|
100
|
+
var init_helpers = __esm({
|
|
101
|
+
"pkg/@eser/standards/runtime/helpers.ts"() {
|
|
102
|
+
getEnvVar = (key) => {
|
|
103
|
+
if (typeof Deno !== "undefined" && Deno.env?.get) {
|
|
104
|
+
return Deno.env.get(key);
|
|
105
|
+
}
|
|
106
|
+
const proc = globalThis.process;
|
|
107
|
+
if (proc?.env) {
|
|
108
|
+
return proc.env[key];
|
|
109
|
+
}
|
|
110
|
+
return void 0;
|
|
111
|
+
};
|
|
112
|
+
getFirstEnvVar = (...keys) => {
|
|
113
|
+
for (const key of keys) {
|
|
114
|
+
const value2 = getEnvVar(key);
|
|
115
|
+
if (value2 !== void 0) {
|
|
116
|
+
return value2;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return void 0;
|
|
120
|
+
};
|
|
121
|
+
tryRequire = (moduleName) => {
|
|
122
|
+
try {
|
|
123
|
+
const requireFn = globalThis.require;
|
|
124
|
+
if (requireFn instanceof Function) {
|
|
125
|
+
return requireFn(moduleName);
|
|
126
|
+
}
|
|
127
|
+
} catch {
|
|
128
|
+
}
|
|
129
|
+
return void 0;
|
|
114
130
|
};
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
131
|
+
getProcess = () => {
|
|
132
|
+
return globalThis.process;
|
|
133
|
+
};
|
|
134
|
+
getNavigator = () => {
|
|
135
|
+
return globalThis.navigator;
|
|
118
136
|
};
|
|
119
137
|
}
|
|
120
138
|
});
|
|
121
139
|
|
|
122
140
|
// pkg/@eser/standards/runtime/platform.ts
|
|
123
|
-
var getPlatform, getArch, getHomedir, getTmpdir, getPlatformInfo;
|
|
141
|
+
var PLATFORM_MAP, getPlatform, ARCH_MAP, getArch, getHomedir, getTmpdir, getPlatformInfo;
|
|
124
142
|
var init_platform = __esm({
|
|
125
143
|
"pkg/@eser/standards/runtime/platform.ts"() {
|
|
144
|
+
init_helpers();
|
|
145
|
+
PLATFORM_MAP = {
|
|
146
|
+
darwin: "darwin",
|
|
147
|
+
linux: "linux",
|
|
148
|
+
windows: "windows",
|
|
149
|
+
win32: "windows"
|
|
150
|
+
};
|
|
126
151
|
getPlatform = () => {
|
|
127
152
|
if (typeof Deno !== "undefined" && Deno.build?.os) {
|
|
128
|
-
|
|
129
|
-
if (os === "darwin") return "darwin";
|
|
130
|
-
if (os === "linux") return "linux";
|
|
131
|
-
if (os === "windows") return "windows";
|
|
153
|
+
return PLATFORM_MAP[Deno.build.os] ?? "linux";
|
|
132
154
|
}
|
|
133
|
-
const proc =
|
|
155
|
+
const proc = getProcess();
|
|
134
156
|
if (proc?.platform) {
|
|
135
|
-
|
|
136
|
-
if (platform === "darwin") return "darwin";
|
|
137
|
-
if (platform === "linux") return "linux";
|
|
138
|
-
if (platform === "win32") return "windows";
|
|
157
|
+
return PLATFORM_MAP[proc.platform] ?? "linux";
|
|
139
158
|
}
|
|
140
|
-
const nav =
|
|
159
|
+
const nav = getNavigator();
|
|
141
160
|
if (nav?.userAgent) {
|
|
142
161
|
const ua = nav.userAgent.toLowerCase();
|
|
143
162
|
if (ua.includes("mac")) return "darwin";
|
|
@@ -146,19 +165,21 @@ var init_platform = __esm({
|
|
|
146
165
|
}
|
|
147
166
|
return "linux";
|
|
148
167
|
};
|
|
168
|
+
ARCH_MAP = {
|
|
169
|
+
x86_64: "amd64",
|
|
170
|
+
x64: "amd64",
|
|
171
|
+
aarch64: "arm64",
|
|
172
|
+
arm64: "arm64"
|
|
173
|
+
};
|
|
149
174
|
getArch = () => {
|
|
150
175
|
if (typeof Deno !== "undefined" && Deno.build?.arch) {
|
|
151
|
-
|
|
152
|
-
if (arch === "x86_64") return "amd64";
|
|
153
|
-
if (arch === "aarch64") return "arm64";
|
|
176
|
+
return ARCH_MAP[Deno.build.arch] ?? "amd64";
|
|
154
177
|
}
|
|
155
|
-
const proc =
|
|
178
|
+
const proc = getProcess();
|
|
156
179
|
if (proc?.arch) {
|
|
157
|
-
|
|
158
|
-
if (arch === "x64") return "amd64";
|
|
159
|
-
if (arch === "arm64") return "arm64";
|
|
180
|
+
return ARCH_MAP[proc.arch] ?? "amd64";
|
|
160
181
|
}
|
|
161
|
-
const nav =
|
|
182
|
+
const nav = getNavigator();
|
|
162
183
|
if (nav?.userAgent) {
|
|
163
184
|
const ua = nav.userAgent.toLowerCase();
|
|
164
185
|
if (ua.includes("arm64") || ua.includes("aarch64")) return "arm64";
|
|
@@ -166,50 +187,22 @@ var init_platform = __esm({
|
|
|
166
187
|
return "amd64";
|
|
167
188
|
};
|
|
168
189
|
getHomedir = () => {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
if (proc?.env) {
|
|
175
|
-
const home = proc.env.HOME ?? proc.env.USERPROFILE;
|
|
176
|
-
if (home) return home;
|
|
177
|
-
}
|
|
178
|
-
try {
|
|
179
|
-
const os = globalThis.require?.("os");
|
|
180
|
-
if (os?.homedir) {
|
|
181
|
-
return os.homedir();
|
|
182
|
-
}
|
|
183
|
-
} catch {
|
|
184
|
-
}
|
|
185
|
-
const platform = getPlatform();
|
|
186
|
-
if (platform === "windows") {
|
|
187
|
-
return "C:\\Users\\Default";
|
|
190
|
+
const home = getFirstEnvVar("HOME", "USERPROFILE");
|
|
191
|
+
if (home) return home;
|
|
192
|
+
const os = tryRequire("os");
|
|
193
|
+
if (os?.homedir) {
|
|
194
|
+
return os.homedir();
|
|
188
195
|
}
|
|
189
|
-
return "/home";
|
|
196
|
+
return getPlatform() === "windows" ? "C:\\Users\\Default" : "/home";
|
|
190
197
|
};
|
|
191
198
|
getTmpdir = () => {
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
if (proc?.env) {
|
|
198
|
-
const tmp = proc.env.TMPDIR ?? proc.env.TMP ?? proc.env.TEMP;
|
|
199
|
-
if (tmp) return tmp;
|
|
200
|
-
}
|
|
201
|
-
try {
|
|
202
|
-
const os = globalThis.require?.("os");
|
|
203
|
-
if (os?.tmpdir) {
|
|
204
|
-
return os.tmpdir();
|
|
205
|
-
}
|
|
206
|
-
} catch {
|
|
199
|
+
const tmp = getFirstEnvVar("TMPDIR", "TMP", "TEMP");
|
|
200
|
+
if (tmp) return tmp;
|
|
201
|
+
const os = tryRequire("os");
|
|
202
|
+
if (os?.tmpdir) {
|
|
203
|
+
return os.tmpdir();
|
|
207
204
|
}
|
|
208
|
-
|
|
209
|
-
if (platform === "windows") {
|
|
210
|
-
return "C:\\Windows\\Temp";
|
|
211
|
-
}
|
|
212
|
-
return "/tmp";
|
|
205
|
+
return getPlatform() === "windows" ? "C:\\Windows\\Temp" : "/tmp";
|
|
213
206
|
};
|
|
214
207
|
getPlatformInfo = () => {
|
|
215
208
|
return {
|
|
@@ -222,489 +215,58 @@ var init_platform = __esm({
|
|
|
222
215
|
}
|
|
223
216
|
});
|
|
224
217
|
|
|
225
|
-
//
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
process: true,
|
|
234
|
-
env: true,
|
|
235
|
-
stdin: true,
|
|
236
|
-
stdout: true,
|
|
237
|
-
kv: false
|
|
238
|
-
};
|
|
239
|
-
DENO_CAPABILITIES = {
|
|
240
|
-
fs: true,
|
|
241
|
-
fsSync: true,
|
|
242
|
-
exec: true,
|
|
243
|
-
process: true,
|
|
244
|
-
env: true,
|
|
245
|
-
stdin: true,
|
|
246
|
-
stdout: true,
|
|
247
|
-
kv: true
|
|
248
|
-
};
|
|
249
|
-
NODE_CAPABILITIES = {
|
|
250
|
-
fs: true,
|
|
251
|
-
fsSync: true,
|
|
252
|
-
exec: true,
|
|
253
|
-
process: true,
|
|
254
|
-
env: true,
|
|
255
|
-
stdin: true,
|
|
256
|
-
stdout: true,
|
|
257
|
-
kv: false
|
|
258
|
-
};
|
|
259
|
-
BUN_CAPABILITIES = {
|
|
260
|
-
fs: true,
|
|
261
|
-
fsSync: true,
|
|
262
|
-
exec: true,
|
|
263
|
-
process: true,
|
|
264
|
-
env: true,
|
|
265
|
-
stdin: true,
|
|
266
|
-
stdout: true,
|
|
267
|
-
kv: false
|
|
268
|
-
};
|
|
269
|
-
WORKERD_CAPABILITIES = {
|
|
270
|
-
fs: false,
|
|
271
|
-
fsSync: false,
|
|
272
|
-
exec: false,
|
|
273
|
-
process: false,
|
|
274
|
-
env: true,
|
|
275
|
-
stdin: false,
|
|
276
|
-
stdout: false,
|
|
277
|
-
kv: true
|
|
278
|
-
};
|
|
279
|
-
BROWSER_CAPABILITIES = {
|
|
280
|
-
fs: false,
|
|
281
|
-
fsSync: false,
|
|
282
|
-
exec: false,
|
|
283
|
-
process: false,
|
|
284
|
-
env: false,
|
|
285
|
-
stdin: false,
|
|
286
|
-
stdout: false,
|
|
287
|
-
kv: false
|
|
288
|
-
};
|
|
289
|
-
UNKNOWN_CAPABILITIES = {
|
|
290
|
-
fs: false,
|
|
291
|
-
fsSync: false,
|
|
292
|
-
exec: false,
|
|
293
|
-
process: false,
|
|
294
|
-
env: false,
|
|
295
|
-
stdin: false,
|
|
296
|
-
stdout: false,
|
|
297
|
-
kv: false
|
|
298
|
-
};
|
|
299
|
-
getCapabilities = (runtime2) => {
|
|
300
|
-
switch (runtime2) {
|
|
301
|
-
case "deno":
|
|
302
|
-
return DENO_CAPABILITIES;
|
|
303
|
-
case "node":
|
|
304
|
-
return NODE_CAPABILITIES;
|
|
305
|
-
case "bun":
|
|
306
|
-
return BUN_CAPABILITIES;
|
|
307
|
-
case "workerd":
|
|
308
|
-
return WORKERD_CAPABILITIES;
|
|
309
|
-
case "browser":
|
|
310
|
-
return BROWSER_CAPABILITIES;
|
|
311
|
-
default:
|
|
312
|
-
return UNKNOWN_CAPABILITIES;
|
|
313
|
-
}
|
|
314
|
-
};
|
|
315
|
-
hasCapability = (runtime2, capability) => {
|
|
316
|
-
return getCapabilities(runtime2)[capability];
|
|
317
|
-
};
|
|
218
|
+
// deno:https://jsr.io/@std/internal/1.0.12/_os.ts
|
|
219
|
+
function checkWindows() {
|
|
220
|
+
const global = globalThis;
|
|
221
|
+
const os = global.Deno?.build?.os;
|
|
222
|
+
return typeof os === "string" ? os === "windows" : global.navigator?.platform?.startsWith("Win") ?? global.process?.platform?.startsWith("win") ?? false;
|
|
223
|
+
}
|
|
224
|
+
var init_os = __esm({
|
|
225
|
+
"deno:https://jsr.io/@std/internal/1.0.12/_os.ts"() {
|
|
318
226
|
}
|
|
319
227
|
});
|
|
320
228
|
|
|
321
|
-
//
|
|
322
|
-
var
|
|
323
|
-
var
|
|
324
|
-
"
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
return
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
if (
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
basename = (path, suffix) => {
|
|
363
|
-
if (path.length === 0) return "";
|
|
364
|
-
path = normalizeSlashes(path);
|
|
365
|
-
while (path.length > 1 && path.endsWith("/")) {
|
|
366
|
-
path = path.slice(0, -1);
|
|
367
|
-
}
|
|
368
|
-
const lastSlash = path.lastIndexOf("/");
|
|
369
|
-
let base = lastSlash === -1 ? path : path.slice(lastSlash + 1);
|
|
370
|
-
if (suffix && base.endsWith(suffix)) {
|
|
371
|
-
base = base.slice(0, -suffix.length);
|
|
372
|
-
}
|
|
373
|
-
return base;
|
|
374
|
-
};
|
|
375
|
-
extname = (path) => {
|
|
376
|
-
const base = basename(path);
|
|
377
|
-
const lastDot = base.lastIndexOf(".");
|
|
378
|
-
if (lastDot <= 0 || lastDot === base.length - 1) {
|
|
379
|
-
return "";
|
|
380
|
-
}
|
|
381
|
-
return base.slice(lastDot);
|
|
382
|
-
};
|
|
383
|
-
normalize = (path) => {
|
|
384
|
-
if (path.length === 0) return ".";
|
|
385
|
-
path = normalizeSlashes(path);
|
|
386
|
-
const isAbs = path.startsWith("/");
|
|
387
|
-
const trailingSlash = path.endsWith("/");
|
|
388
|
-
const segments = path.split("/").filter((s) => s.length > 0);
|
|
389
|
-
const result = [];
|
|
390
|
-
for (const segment of segments) {
|
|
391
|
-
if (segment === ".") {
|
|
392
|
-
continue;
|
|
393
|
-
}
|
|
394
|
-
if (segment === "..") {
|
|
395
|
-
if (result.length > 0 && result[result.length - 1] !== "..") {
|
|
396
|
-
result.pop();
|
|
397
|
-
} else if (!isAbs) {
|
|
398
|
-
result.push("..");
|
|
399
|
-
}
|
|
400
|
-
} else {
|
|
401
|
-
result.push(segment);
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
let normalized = result.join("/");
|
|
405
|
-
if (isAbs) {
|
|
406
|
-
normalized = `/${normalized}`;
|
|
407
|
-
}
|
|
408
|
-
if (trailingSlash && normalized.length > 1) {
|
|
409
|
-
normalized += "/";
|
|
410
|
-
}
|
|
411
|
-
return normalized ?? ".";
|
|
412
|
-
};
|
|
413
|
-
isAbsolute = (path) => {
|
|
414
|
-
if (path.length === 0) return false;
|
|
415
|
-
if (path.startsWith("/")) return true;
|
|
416
|
-
if (path.length >= 3 && /^[a-zA-Z]:[/\\]/.test(path)) {
|
|
417
|
-
return true;
|
|
418
|
-
}
|
|
419
|
-
return false;
|
|
420
|
-
};
|
|
421
|
-
relative = (from, to) => {
|
|
422
|
-
if (from === to) return "";
|
|
423
|
-
from = resolve(from);
|
|
424
|
-
to = resolve(to);
|
|
425
|
-
if (from === to) return "";
|
|
426
|
-
const fromParts = from.split("/").filter((p) => p.length > 0);
|
|
427
|
-
const toParts = to.split("/").filter((p) => p.length > 0);
|
|
428
|
-
let commonLength = 0;
|
|
429
|
-
const minLength = Math.min(fromParts.length, toParts.length);
|
|
430
|
-
for (let i = 0; i < minLength; i++) {
|
|
431
|
-
if (fromParts[i] !== toParts[i]) break;
|
|
432
|
-
commonLength++;
|
|
433
|
-
}
|
|
434
|
-
const upCount = fromParts.length - commonLength;
|
|
435
|
-
const remaining = toParts.slice(commonLength);
|
|
436
|
-
const result = [
|
|
437
|
-
...Array(upCount).fill(".."),
|
|
438
|
-
...remaining
|
|
439
|
-
];
|
|
440
|
-
return result.join("/") ?? ".";
|
|
441
|
-
};
|
|
442
|
-
parse = (path) => {
|
|
443
|
-
if (path.length === 0) {
|
|
444
|
-
return {
|
|
445
|
-
root: "",
|
|
446
|
-
dir: "",
|
|
447
|
-
base: "",
|
|
448
|
-
ext: "",
|
|
449
|
-
name: ""
|
|
450
|
-
};
|
|
451
|
-
}
|
|
452
|
-
path = normalizeSlashes(path);
|
|
453
|
-
let root = "";
|
|
454
|
-
let dir = "";
|
|
455
|
-
const base = basename(path);
|
|
456
|
-
const ext = extname(path);
|
|
457
|
-
const name = ext ? base.slice(0, -ext.length) : base;
|
|
458
|
-
if (path.startsWith("/")) {
|
|
459
|
-
root = "/";
|
|
460
|
-
} else if (/^[a-zA-Z]:[/\\]/.test(path)) {
|
|
461
|
-
root = path.slice(0, 3);
|
|
462
|
-
}
|
|
463
|
-
dir = dirname(path);
|
|
464
|
-
if (dir === ".") {
|
|
465
|
-
dir = "";
|
|
466
|
-
}
|
|
467
|
-
return {
|
|
468
|
-
root,
|
|
469
|
-
dir,
|
|
470
|
-
base,
|
|
471
|
-
ext,
|
|
472
|
-
name
|
|
473
|
-
};
|
|
474
|
-
};
|
|
475
|
-
format = (pathObject) => {
|
|
476
|
-
const { root = "", dir, base, ext = "", name = "" } = pathObject;
|
|
477
|
-
const finalBase = base ?? name + ext;
|
|
478
|
-
if (dir) {
|
|
479
|
-
if (dir === root) {
|
|
480
|
-
return `${dir}${finalBase}`;
|
|
481
|
-
}
|
|
482
|
-
return `${dir}/${finalBase}`;
|
|
483
|
-
}
|
|
484
|
-
return `${root}${finalBase}`;
|
|
485
|
-
};
|
|
486
|
-
posixPath = {
|
|
487
|
-
join,
|
|
488
|
-
resolve,
|
|
489
|
-
dirname,
|
|
490
|
-
basename,
|
|
491
|
-
extname,
|
|
492
|
-
normalize,
|
|
493
|
-
isAbsolute,
|
|
494
|
-
relative,
|
|
495
|
-
parse,
|
|
496
|
-
format,
|
|
497
|
-
sep: POSIX_SEP,
|
|
498
|
-
delimiter: POSIX_DELIMITER
|
|
499
|
-
};
|
|
500
|
-
}
|
|
501
|
-
});
|
|
502
|
-
|
|
503
|
-
// pkg/@eser/standards/runtime/file-search.ts
|
|
504
|
-
var searchFileHierarchy;
|
|
505
|
-
var init_file_search = __esm({
|
|
506
|
-
"pkg/@eser/standards/runtime/file-search.ts"() {
|
|
507
|
-
init_mod2();
|
|
508
|
-
searchFileHierarchy = async (startDir, filenames, options = {}) => {
|
|
509
|
-
const { searchParents = false } = options;
|
|
510
|
-
let dir = startDir;
|
|
511
|
-
while (true) {
|
|
512
|
-
for (const name of filenames) {
|
|
513
|
-
const filepath = runtime.path.join(dir, name);
|
|
514
|
-
const exists = await runtime.fs.exists(filepath);
|
|
515
|
-
if (exists) {
|
|
516
|
-
const stat3 = await runtime.fs.stat(filepath);
|
|
517
|
-
if (stat3.isFile) {
|
|
518
|
-
return filepath;
|
|
519
|
-
}
|
|
520
|
-
}
|
|
521
|
-
}
|
|
522
|
-
if (!searchParents) {
|
|
523
|
-
break;
|
|
524
|
-
}
|
|
525
|
-
const parent = runtime.path.dirname(dir);
|
|
526
|
-
if (parent === dir) {
|
|
527
|
-
break;
|
|
528
|
-
}
|
|
529
|
-
dir = parent;
|
|
530
|
-
}
|
|
531
|
-
return void 0;
|
|
532
|
-
};
|
|
533
|
-
}
|
|
534
|
-
});
|
|
535
|
-
|
|
536
|
-
// pkg/@eser/standards/runtime/adapters/workerd.ts
|
|
537
|
-
var createWorkerdFs, createWorkerdPath, createWorkerdExec, envStorage, createWorkerdEnv, populateEnvFromContext, clearEnv, createWorkerdProcess, createWorkerdRuntime;
|
|
538
|
-
var init_workerd = __esm({
|
|
539
|
-
"pkg/@eser/standards/runtime/adapters/workerd.ts"() {
|
|
540
|
-
init_types();
|
|
541
|
-
init_capabilities();
|
|
542
|
-
init_path();
|
|
543
|
-
createWorkerdFs = () => {
|
|
544
|
-
const throwNotAvailable = () => {
|
|
545
|
-
throw new RuntimeCapabilityError("fs", "workerd");
|
|
546
|
-
};
|
|
547
|
-
return {
|
|
548
|
-
readFile: throwNotAvailable,
|
|
549
|
-
readTextFile: throwNotAvailable,
|
|
550
|
-
writeFile: throwNotAvailable,
|
|
551
|
-
writeTextFile: throwNotAvailable,
|
|
552
|
-
exists: throwNotAvailable,
|
|
553
|
-
stat: throwNotAvailable,
|
|
554
|
-
lstat: throwNotAvailable,
|
|
555
|
-
mkdir: throwNotAvailable,
|
|
556
|
-
remove: throwNotAvailable,
|
|
557
|
-
readDir: () => {
|
|
558
|
-
throw new RuntimeCapabilityError("fs", "workerd");
|
|
559
|
-
},
|
|
560
|
-
copyFile: throwNotAvailable,
|
|
561
|
-
rename: throwNotAvailable,
|
|
562
|
-
makeTempDir: throwNotAvailable
|
|
563
|
-
};
|
|
564
|
-
};
|
|
565
|
-
createWorkerdPath = () => {
|
|
566
|
-
return posixPath;
|
|
567
|
-
};
|
|
568
|
-
createWorkerdExec = () => {
|
|
569
|
-
const throwNotAvailable = () => {
|
|
570
|
-
throw new RuntimeCapabilityError("exec", "workerd");
|
|
571
|
-
};
|
|
572
|
-
return {
|
|
573
|
-
spawn: throwNotAvailable,
|
|
574
|
-
exec: throwNotAvailable,
|
|
575
|
-
execJson: throwNotAvailable,
|
|
576
|
-
spawnChild: throwNotAvailable
|
|
577
|
-
};
|
|
578
|
-
};
|
|
579
|
-
envStorage = /* @__PURE__ */ new Map();
|
|
580
|
-
createWorkerdEnv = () => {
|
|
581
|
-
return {
|
|
582
|
-
get(key) {
|
|
583
|
-
return envStorage.get(key);
|
|
584
|
-
},
|
|
585
|
-
set(key, value2) {
|
|
586
|
-
envStorage.set(key, value2);
|
|
587
|
-
},
|
|
588
|
-
delete(key) {
|
|
589
|
-
envStorage.delete(key);
|
|
590
|
-
},
|
|
591
|
-
has(key) {
|
|
592
|
-
return envStorage.has(key);
|
|
593
|
-
},
|
|
594
|
-
toObject() {
|
|
595
|
-
return Object.fromEntries(envStorage);
|
|
596
|
-
}
|
|
597
|
-
};
|
|
598
|
-
};
|
|
599
|
-
populateEnvFromContext = (env) => {
|
|
600
|
-
for (const [key, value2] of Object.entries(env)) {
|
|
601
|
-
if (typeof value2 === "string") {
|
|
602
|
-
envStorage.set(key, value2);
|
|
603
|
-
}
|
|
604
|
-
}
|
|
605
|
-
};
|
|
606
|
-
clearEnv = () => {
|
|
607
|
-
envStorage.clear();
|
|
608
|
-
};
|
|
609
|
-
createWorkerdProcess = () => {
|
|
610
|
-
const throwNotAvailable = () => {
|
|
611
|
-
throw new RuntimeCapabilityError("process", "workerd");
|
|
612
|
-
};
|
|
613
|
-
return {
|
|
614
|
-
exit: throwNotAvailable,
|
|
615
|
-
cwd: throwNotAvailable,
|
|
616
|
-
chdir: throwNotAvailable,
|
|
617
|
-
hostname: throwNotAvailable,
|
|
618
|
-
execPath: throwNotAvailable,
|
|
619
|
-
get args() {
|
|
620
|
-
throw new RuntimeCapabilityError("process", "workerd");
|
|
621
|
-
},
|
|
622
|
-
get pid() {
|
|
623
|
-
throw new RuntimeCapabilityError("process", "workerd");
|
|
624
|
-
},
|
|
625
|
-
get stdin() {
|
|
626
|
-
throw new RuntimeCapabilityError("process", "workerd");
|
|
627
|
-
},
|
|
628
|
-
get stdout() {
|
|
629
|
-
throw new RuntimeCapabilityError("process", "workerd");
|
|
630
|
-
},
|
|
631
|
-
get stderr() {
|
|
632
|
-
throw new RuntimeCapabilityError("process", "workerd");
|
|
633
|
-
}
|
|
634
|
-
};
|
|
635
|
-
};
|
|
636
|
-
createWorkerdRuntime = () => {
|
|
637
|
-
const fs = createWorkerdFs();
|
|
638
|
-
const path = createWorkerdPath();
|
|
639
|
-
const exec2 = createWorkerdExec();
|
|
640
|
-
const env = createWorkerdEnv();
|
|
641
|
-
const process = createWorkerdProcess();
|
|
642
|
-
return {
|
|
643
|
-
name: "workerd",
|
|
644
|
-
version: "unknown",
|
|
645
|
-
capabilities: WORKERD_CAPABILITIES,
|
|
646
|
-
fs,
|
|
647
|
-
path,
|
|
648
|
-
exec: exec2,
|
|
649
|
-
env,
|
|
650
|
-
process
|
|
651
|
-
};
|
|
652
|
-
};
|
|
653
|
-
}
|
|
654
|
-
});
|
|
655
|
-
|
|
656
|
-
// deno:https://jsr.io/@std/internal/1.0.12/_os.ts
|
|
657
|
-
function checkWindows() {
|
|
658
|
-
const global = globalThis;
|
|
659
|
-
const os = global.Deno?.build?.os;
|
|
660
|
-
return typeof os === "string" ? os === "windows" : global.navigator?.platform?.startsWith("Win") ?? global.process?.platform?.startsWith("win") ?? false;
|
|
661
|
-
}
|
|
662
|
-
var init_os = __esm({
|
|
663
|
-
"deno:https://jsr.io/@std/internal/1.0.12/_os.ts"() {
|
|
664
|
-
}
|
|
665
|
-
});
|
|
666
|
-
|
|
667
|
-
// deno:https://jsr.io/@std/internal/1.0.12/os.ts
|
|
668
|
-
var isWindows;
|
|
669
|
-
var init_os2 = __esm({
|
|
670
|
-
"deno:https://jsr.io/@std/internal/1.0.12/os.ts"() {
|
|
671
|
-
init_os();
|
|
672
|
-
isWindows = checkWindows();
|
|
673
|
-
}
|
|
674
|
-
});
|
|
675
|
-
|
|
676
|
-
// deno:https://jsr.io/@std/path/1.1.4/_common/assert_path.ts
|
|
677
|
-
function assertPath(path) {
|
|
678
|
-
if (typeof path !== "string") {
|
|
679
|
-
throw new TypeError(`Path must be a string, received "${JSON.stringify(path)}"`);
|
|
680
|
-
}
|
|
681
|
-
}
|
|
682
|
-
var init_assert_path = __esm({
|
|
683
|
-
"deno:https://jsr.io/@std/path/1.1.4/_common/assert_path.ts"() {
|
|
684
|
-
}
|
|
685
|
-
});
|
|
686
|
-
|
|
687
|
-
// deno:https://jsr.io/@std/path/1.1.4/_common/basename.ts
|
|
688
|
-
function stripSuffix(name, suffix) {
|
|
689
|
-
if (suffix.length >= name.length) {
|
|
690
|
-
return name;
|
|
691
|
-
}
|
|
692
|
-
const lenDiff = name.length - suffix.length;
|
|
693
|
-
for (let i = suffix.length - 1; i >= 0; --i) {
|
|
694
|
-
if (name.charCodeAt(lenDiff + i) !== suffix.charCodeAt(i)) {
|
|
695
|
-
return name;
|
|
696
|
-
}
|
|
697
|
-
}
|
|
698
|
-
return name.slice(0, -suffix.length);
|
|
699
|
-
}
|
|
700
|
-
function lastPathSegment(path, isSep, start = 0) {
|
|
701
|
-
let matchedNonSeparator = false;
|
|
702
|
-
let end = path.length;
|
|
703
|
-
for (let i = path.length - 1; i >= start; --i) {
|
|
704
|
-
if (isSep(path.charCodeAt(i))) {
|
|
705
|
-
if (matchedNonSeparator) {
|
|
706
|
-
start = i + 1;
|
|
707
|
-
break;
|
|
229
|
+
// deno:https://jsr.io/@std/internal/1.0.12/os.ts
|
|
230
|
+
var isWindows;
|
|
231
|
+
var init_os2 = __esm({
|
|
232
|
+
"deno:https://jsr.io/@std/internal/1.0.12/os.ts"() {
|
|
233
|
+
init_os();
|
|
234
|
+
isWindows = checkWindows();
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
// deno:https://jsr.io/@std/path/1.1.4/_common/assert_path.ts
|
|
239
|
+
function assertPath(path) {
|
|
240
|
+
if (typeof path !== "string") {
|
|
241
|
+
throw new TypeError(`Path must be a string, received "${JSON.stringify(path)}"`);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
var init_assert_path = __esm({
|
|
245
|
+
"deno:https://jsr.io/@std/path/1.1.4/_common/assert_path.ts"() {
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
|
|
249
|
+
// deno:https://jsr.io/@std/path/1.1.4/_common/basename.ts
|
|
250
|
+
function stripSuffix(name, suffix) {
|
|
251
|
+
if (suffix.length >= name.length) {
|
|
252
|
+
return name;
|
|
253
|
+
}
|
|
254
|
+
const lenDiff = name.length - suffix.length;
|
|
255
|
+
for (let i = suffix.length - 1; i >= 0; --i) {
|
|
256
|
+
if (name.charCodeAt(lenDiff + i) !== suffix.charCodeAt(i)) {
|
|
257
|
+
return name;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
return name.slice(0, -suffix.length);
|
|
261
|
+
}
|
|
262
|
+
function lastPathSegment(path, isSep, start = 0) {
|
|
263
|
+
let matchedNonSeparator = false;
|
|
264
|
+
let end = path.length;
|
|
265
|
+
for (let i = path.length - 1; i >= start; --i) {
|
|
266
|
+
if (isSep(path.charCodeAt(i))) {
|
|
267
|
+
if (matchedNonSeparator) {
|
|
268
|
+
start = i + 1;
|
|
269
|
+
break;
|
|
708
270
|
}
|
|
709
271
|
} else if (!matchedNonSeparator) {
|
|
710
272
|
matchedNonSeparator = true;
|
|
@@ -796,7 +358,7 @@ var init_util = __esm({
|
|
|
796
358
|
});
|
|
797
359
|
|
|
798
360
|
// deno:https://jsr.io/@std/path/1.1.4/posix/basename.ts
|
|
799
|
-
function
|
|
361
|
+
function basename(path, suffix = "") {
|
|
800
362
|
if (path instanceof URL) {
|
|
801
363
|
path = fromFileUrl(path);
|
|
802
364
|
}
|
|
@@ -846,7 +408,7 @@ var init_from_file_url3 = __esm({
|
|
|
846
408
|
});
|
|
847
409
|
|
|
848
410
|
// deno:https://jsr.io/@std/path/1.1.4/windows/basename.ts
|
|
849
|
-
function
|
|
411
|
+
function basename2(path, suffix = "") {
|
|
850
412
|
if (path instanceof URL) {
|
|
851
413
|
path = fromFileUrl2(path);
|
|
852
414
|
}
|
|
@@ -873,8 +435,8 @@ var init_basename3 = __esm({
|
|
|
873
435
|
});
|
|
874
436
|
|
|
875
437
|
// deno:https://jsr.io/@std/path/1.1.4/basename.ts
|
|
876
|
-
function
|
|
877
|
-
return isWindows ?
|
|
438
|
+
function basename3(path, suffix = "") {
|
|
439
|
+
return isWindows ? basename2(path, suffix) : basename(path, suffix);
|
|
878
440
|
}
|
|
879
441
|
var init_basename4 = __esm({
|
|
880
442
|
"deno:https://jsr.io/@std/path/1.1.4/basename.ts"() {
|
|
@@ -907,7 +469,7 @@ var init_dirname = __esm({
|
|
|
907
469
|
});
|
|
908
470
|
|
|
909
471
|
// deno:https://jsr.io/@std/path/1.1.4/posix/dirname.ts
|
|
910
|
-
function
|
|
472
|
+
function dirname(path) {
|
|
911
473
|
if (path instanceof URL) {
|
|
912
474
|
path = fromFileUrl(path);
|
|
913
475
|
}
|
|
@@ -939,7 +501,7 @@ var init_dirname2 = __esm({
|
|
|
939
501
|
});
|
|
940
502
|
|
|
941
503
|
// deno:https://jsr.io/@std/path/1.1.4/windows/dirname.ts
|
|
942
|
-
function
|
|
504
|
+
function dirname2(path) {
|
|
943
505
|
if (path instanceof URL) {
|
|
944
506
|
path = fromFileUrl2(path);
|
|
945
507
|
}
|
|
@@ -1016,8 +578,8 @@ var init_dirname3 = __esm({
|
|
|
1016
578
|
});
|
|
1017
579
|
|
|
1018
580
|
// deno:https://jsr.io/@std/path/1.1.4/dirname.ts
|
|
1019
|
-
function
|
|
1020
|
-
return isWindows ?
|
|
581
|
+
function dirname3(path) {
|
|
582
|
+
return isWindows ? dirname2(path) : dirname(path);
|
|
1021
583
|
}
|
|
1022
584
|
var init_dirname4 = __esm({
|
|
1023
585
|
"deno:https://jsr.io/@std/path/1.1.4/dirname.ts"() {
|
|
@@ -1028,7 +590,7 @@ var init_dirname4 = __esm({
|
|
|
1028
590
|
});
|
|
1029
591
|
|
|
1030
592
|
// deno:https://jsr.io/@std/path/1.1.4/posix/extname.ts
|
|
1031
|
-
function
|
|
593
|
+
function extname(path) {
|
|
1032
594
|
if (path instanceof URL) {
|
|
1033
595
|
path = fromFileUrl(path);
|
|
1034
596
|
}
|
|
@@ -1075,7 +637,7 @@ var init_extname = __esm({
|
|
|
1075
637
|
});
|
|
1076
638
|
|
|
1077
639
|
// deno:https://jsr.io/@std/path/1.1.4/windows/extname.ts
|
|
1078
|
-
function
|
|
640
|
+
function extname2(path) {
|
|
1079
641
|
if (path instanceof URL) {
|
|
1080
642
|
path = fromFileUrl2(path);
|
|
1081
643
|
}
|
|
@@ -1126,8 +688,8 @@ var init_extname2 = __esm({
|
|
|
1126
688
|
});
|
|
1127
689
|
|
|
1128
690
|
// deno:https://jsr.io/@std/path/1.1.4/extname.ts
|
|
1129
|
-
function
|
|
1130
|
-
return isWindows ?
|
|
691
|
+
function extname3(path) {
|
|
692
|
+
return isWindows ? extname2(path) : extname(path);
|
|
1131
693
|
}
|
|
1132
694
|
var init_extname3 = __esm({
|
|
1133
695
|
"deno:https://jsr.io/@std/path/1.1.4/extname.ts"() {
|
|
@@ -1157,7 +719,7 @@ var init_format = __esm({
|
|
|
1157
719
|
});
|
|
1158
720
|
|
|
1159
721
|
// deno:https://jsr.io/@std/path/1.1.4/posix/format.ts
|
|
1160
|
-
function
|
|
722
|
+
function format(pathObject) {
|
|
1161
723
|
assertArg3(pathObject);
|
|
1162
724
|
return _format("/", pathObject);
|
|
1163
725
|
}
|
|
@@ -1168,7 +730,7 @@ var init_format2 = __esm({
|
|
|
1168
730
|
});
|
|
1169
731
|
|
|
1170
732
|
// deno:https://jsr.io/@std/path/1.1.4/windows/format.ts
|
|
1171
|
-
function
|
|
733
|
+
function format2(pathObject) {
|
|
1172
734
|
assertArg3(pathObject);
|
|
1173
735
|
return _format("\\", pathObject);
|
|
1174
736
|
}
|
|
@@ -1179,8 +741,8 @@ var init_format3 = __esm({
|
|
|
1179
741
|
});
|
|
1180
742
|
|
|
1181
743
|
// deno:https://jsr.io/@std/path/1.1.4/format.ts
|
|
1182
|
-
function
|
|
1183
|
-
return isWindows ?
|
|
744
|
+
function format3(pathObject) {
|
|
745
|
+
return isWindows ? format2(pathObject) : format(pathObject);
|
|
1184
746
|
}
|
|
1185
747
|
var init_format4 = __esm({
|
|
1186
748
|
"deno:https://jsr.io/@std/path/1.1.4/format.ts"() {
|
|
@@ -1203,7 +765,7 @@ var init_from_file_url4 = __esm({
|
|
|
1203
765
|
});
|
|
1204
766
|
|
|
1205
767
|
// deno:https://jsr.io/@std/path/1.1.4/posix/is_absolute.ts
|
|
1206
|
-
function
|
|
768
|
+
function isAbsolute(path) {
|
|
1207
769
|
assertPath(path);
|
|
1208
770
|
return path.length > 0 && isPosixPathSeparator(path.charCodeAt(0));
|
|
1209
771
|
}
|
|
@@ -1215,7 +777,7 @@ var init_is_absolute = __esm({
|
|
|
1215
777
|
});
|
|
1216
778
|
|
|
1217
779
|
// deno:https://jsr.io/@std/path/1.1.4/windows/is_absolute.ts
|
|
1218
|
-
function
|
|
780
|
+
function isAbsolute2(path) {
|
|
1219
781
|
assertPath(path);
|
|
1220
782
|
const len = path.length;
|
|
1221
783
|
if (len === 0) return false;
|
|
@@ -1238,8 +800,8 @@ var init_is_absolute2 = __esm({
|
|
|
1238
800
|
});
|
|
1239
801
|
|
|
1240
802
|
// deno:https://jsr.io/@std/path/1.1.4/is_absolute.ts
|
|
1241
|
-
function
|
|
1242
|
-
return isWindows ?
|
|
803
|
+
function isAbsolute3(path) {
|
|
804
|
+
return isWindows ? isAbsolute2(path) : isAbsolute(path);
|
|
1243
805
|
}
|
|
1244
806
|
var init_is_absolute3 = __esm({
|
|
1245
807
|
"deno:https://jsr.io/@std/path/1.1.4/is_absolute.ts"() {
|
|
@@ -1322,7 +884,7 @@ var init_normalize_string = __esm({
|
|
|
1322
884
|
});
|
|
1323
885
|
|
|
1324
886
|
// deno:https://jsr.io/@std/path/1.1.4/posix/normalize.ts
|
|
1325
|
-
function
|
|
887
|
+
function normalize(path) {
|
|
1326
888
|
if (path instanceof URL) {
|
|
1327
889
|
path = fromFileUrl(path);
|
|
1328
890
|
}
|
|
@@ -1345,7 +907,7 @@ var init_normalize2 = __esm({
|
|
|
1345
907
|
});
|
|
1346
908
|
|
|
1347
909
|
// deno:https://jsr.io/@std/path/1.1.4/posix/join.ts
|
|
1348
|
-
function
|
|
910
|
+
function join(path, ...paths) {
|
|
1349
911
|
if (path === void 0) return ".";
|
|
1350
912
|
if (path instanceof URL) {
|
|
1351
913
|
path = fromFileUrl(path);
|
|
@@ -1356,7 +918,7 @@ function join2(path, ...paths) {
|
|
|
1356
918
|
] : paths;
|
|
1357
919
|
paths.forEach((path2) => assertPath(path2));
|
|
1358
920
|
const joined = paths.filter((path2) => path2.length > 0).join("/");
|
|
1359
|
-
return joined === "" ? "." :
|
|
921
|
+
return joined === "" ? "." : normalize(joined);
|
|
1360
922
|
}
|
|
1361
923
|
var init_join = __esm({
|
|
1362
924
|
"deno:https://jsr.io/@std/path/1.1.4/posix/join.ts"() {
|
|
@@ -1367,7 +929,7 @@ var init_join = __esm({
|
|
|
1367
929
|
});
|
|
1368
930
|
|
|
1369
931
|
// deno:https://jsr.io/@std/path/1.1.4/windows/normalize.ts
|
|
1370
|
-
function
|
|
932
|
+
function normalize2(path) {
|
|
1371
933
|
if (path instanceof URL) {
|
|
1372
934
|
path = fromFileUrl2(path);
|
|
1373
935
|
}
|
|
@@ -1456,7 +1018,7 @@ var init_normalize3 = __esm({
|
|
|
1456
1018
|
});
|
|
1457
1019
|
|
|
1458
1020
|
// deno:https://jsr.io/@std/path/1.1.4/windows/join.ts
|
|
1459
|
-
function
|
|
1021
|
+
function join2(path, ...paths) {
|
|
1460
1022
|
if (path instanceof URL) {
|
|
1461
1023
|
path = fromFileUrl2(path);
|
|
1462
1024
|
}
|
|
@@ -1492,7 +1054,7 @@ function join3(path, ...paths) {
|
|
|
1492
1054
|
}
|
|
1493
1055
|
if (slashCount >= 2) joined = `\\${joined.slice(slashCount)}`;
|
|
1494
1056
|
}
|
|
1495
|
-
return
|
|
1057
|
+
return normalize2(joined);
|
|
1496
1058
|
}
|
|
1497
1059
|
var init_join2 = __esm({
|
|
1498
1060
|
"deno:https://jsr.io/@std/path/1.1.4/windows/join.ts"() {
|
|
@@ -1504,8 +1066,8 @@ var init_join2 = __esm({
|
|
|
1504
1066
|
});
|
|
1505
1067
|
|
|
1506
1068
|
// deno:https://jsr.io/@std/path/1.1.4/join.ts
|
|
1507
|
-
function
|
|
1508
|
-
return isWindows ?
|
|
1069
|
+
function join3(path, ...paths) {
|
|
1070
|
+
return isWindows ? join2(path, ...paths) : join(path, ...paths);
|
|
1509
1071
|
}
|
|
1510
1072
|
var init_join3 = __esm({
|
|
1511
1073
|
"deno:https://jsr.io/@std/path/1.1.4/join.ts"() {
|
|
@@ -1516,8 +1078,8 @@ var init_join3 = __esm({
|
|
|
1516
1078
|
});
|
|
1517
1079
|
|
|
1518
1080
|
// deno:https://jsr.io/@std/path/1.1.4/normalize.ts
|
|
1519
|
-
function
|
|
1520
|
-
return isWindows ?
|
|
1081
|
+
function normalize3(path) {
|
|
1082
|
+
return isWindows ? normalize2(path) : normalize(path);
|
|
1521
1083
|
}
|
|
1522
1084
|
var init_normalize4 = __esm({
|
|
1523
1085
|
"deno:https://jsr.io/@std/path/1.1.4/normalize.ts"() {
|
|
@@ -1528,7 +1090,7 @@ var init_normalize4 = __esm({
|
|
|
1528
1090
|
});
|
|
1529
1091
|
|
|
1530
1092
|
// deno:https://jsr.io/@std/path/1.1.4/posix/parse.ts
|
|
1531
|
-
function
|
|
1093
|
+
function parse(path) {
|
|
1532
1094
|
assertPath(path);
|
|
1533
1095
|
const ret = {
|
|
1534
1096
|
root: "",
|
|
@@ -1608,7 +1170,7 @@ var init_parse = __esm({
|
|
|
1608
1170
|
});
|
|
1609
1171
|
|
|
1610
1172
|
// deno:https://jsr.io/@std/path/1.1.4/windows/parse.ts
|
|
1611
|
-
function
|
|
1173
|
+
function parse2(path) {
|
|
1612
1174
|
assertPath(path);
|
|
1613
1175
|
const ret = {
|
|
1614
1176
|
root: "",
|
|
@@ -1724,8 +1286,8 @@ var init_parse2 = __esm({
|
|
|
1724
1286
|
});
|
|
1725
1287
|
|
|
1726
1288
|
// deno:https://jsr.io/@std/path/1.1.4/parse.ts
|
|
1727
|
-
function
|
|
1728
|
-
return isWindows ?
|
|
1289
|
+
function parse3(path) {
|
|
1290
|
+
return isWindows ? parse2(path) : parse(path);
|
|
1729
1291
|
}
|
|
1730
1292
|
var init_parse3 = __esm({
|
|
1731
1293
|
"deno:https://jsr.io/@std/path/1.1.4/parse.ts"() {
|
|
@@ -1736,7 +1298,7 @@ var init_parse3 = __esm({
|
|
|
1736
1298
|
});
|
|
1737
1299
|
|
|
1738
1300
|
// deno:https://jsr.io/@std/path/1.1.4/posix/resolve.ts
|
|
1739
|
-
function
|
|
1301
|
+
function resolve(...pathSegments) {
|
|
1740
1302
|
let resolvedPath = "";
|
|
1741
1303
|
let resolvedAbsolute = false;
|
|
1742
1304
|
for (let i = pathSegments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
|
|
@@ -1784,10 +1346,10 @@ var init_relative = __esm({
|
|
|
1784
1346
|
});
|
|
1785
1347
|
|
|
1786
1348
|
// deno:https://jsr.io/@std/path/1.1.4/posix/relative.ts
|
|
1787
|
-
function
|
|
1349
|
+
function relative(from, to) {
|
|
1788
1350
|
assertArgs2(from, to);
|
|
1789
|
-
from =
|
|
1790
|
-
to =
|
|
1351
|
+
from = resolve(from);
|
|
1352
|
+
to = resolve(to);
|
|
1791
1353
|
if (from === to) return "";
|
|
1792
1354
|
let fromStart = 1;
|
|
1793
1355
|
const fromEnd = from.length;
|
|
@@ -1849,7 +1411,7 @@ var init_relative2 = __esm({
|
|
|
1849
1411
|
});
|
|
1850
1412
|
|
|
1851
1413
|
// deno:https://jsr.io/@std/path/1.1.4/windows/resolve.ts
|
|
1852
|
-
function
|
|
1414
|
+
function resolve2(...pathSegments) {
|
|
1853
1415
|
let resolvedDevice = "";
|
|
1854
1416
|
let resolvedTail = "";
|
|
1855
1417
|
let resolvedAbsolute = false;
|
|
@@ -1952,10 +1514,10 @@ var init_resolve2 = __esm({
|
|
|
1952
1514
|
});
|
|
1953
1515
|
|
|
1954
1516
|
// deno:https://jsr.io/@std/path/1.1.4/windows/relative.ts
|
|
1955
|
-
function
|
|
1517
|
+
function relative2(from, to) {
|
|
1956
1518
|
assertArgs2(from, to);
|
|
1957
|
-
const fromOrig =
|
|
1958
|
-
const toOrig =
|
|
1519
|
+
const fromOrig = resolve2(from);
|
|
1520
|
+
const toOrig = resolve2(to);
|
|
1959
1521
|
if (fromOrig === toOrig) return "";
|
|
1960
1522
|
from = fromOrig.toLowerCase();
|
|
1961
1523
|
to = toOrig.toLowerCase();
|
|
@@ -2032,8 +1594,8 @@ var init_relative3 = __esm({
|
|
|
2032
1594
|
});
|
|
2033
1595
|
|
|
2034
1596
|
// deno:https://jsr.io/@std/path/1.1.4/relative.ts
|
|
2035
|
-
function
|
|
2036
|
-
return isWindows ?
|
|
1597
|
+
function relative3(from, to) {
|
|
1598
|
+
return isWindows ? relative2(from, to) : relative(from, to);
|
|
2037
1599
|
}
|
|
2038
1600
|
var init_relative4 = __esm({
|
|
2039
1601
|
"deno:https://jsr.io/@std/path/1.1.4/relative.ts"() {
|
|
@@ -2044,8 +1606,8 @@ var init_relative4 = __esm({
|
|
|
2044
1606
|
});
|
|
2045
1607
|
|
|
2046
1608
|
// deno:https://jsr.io/@std/path/1.1.4/resolve.ts
|
|
2047
|
-
function
|
|
2048
|
-
return isWindows ?
|
|
1609
|
+
function resolve3(...pathSegments) {
|
|
1610
|
+
return isWindows ? resolve2(...pathSegments) : resolve(...pathSegments);
|
|
2049
1611
|
}
|
|
2050
1612
|
var init_resolve3 = __esm({
|
|
2051
1613
|
"deno:https://jsr.io/@std/path/1.1.4/resolve.ts"() {
|
|
@@ -2440,11 +2002,11 @@ function normalizeGlob(glob, options = {}) {
|
|
|
2440
2002
|
throw new Error(`Glob contains invalid characters: "${glob}"`);
|
|
2441
2003
|
}
|
|
2442
2004
|
if (!globstar) {
|
|
2443
|
-
return
|
|
2005
|
+
return normalize(glob);
|
|
2444
2006
|
}
|
|
2445
2007
|
const s = SEPARATOR_PATTERN2.source;
|
|
2446
2008
|
const badParentPattern = new RegExp(`(?<=(${s}|^)\\*\\*${s})\\.\\.(?=${s}|$)`, "g");
|
|
2447
|
-
return
|
|
2009
|
+
return normalize(glob.replace(badParentPattern, "\0")).replace(/\0/g, "..");
|
|
2448
2010
|
}
|
|
2449
2011
|
var init_normalize_glob = __esm({
|
|
2450
2012
|
"deno:https://jsr.io/@std/path/1.1.4/posix/normalize_glob.ts"() {
|
|
@@ -2457,7 +2019,7 @@ var init_normalize_glob = __esm({
|
|
|
2457
2019
|
function joinGlobs(globs, options = {}) {
|
|
2458
2020
|
const { globstar = false } = options;
|
|
2459
2021
|
if (!globstar || globs.length === 0) {
|
|
2460
|
-
return
|
|
2022
|
+
return join(...globs);
|
|
2461
2023
|
}
|
|
2462
2024
|
let joined;
|
|
2463
2025
|
for (const glob of globs) {
|
|
@@ -2496,11 +2058,11 @@ function normalizeGlob2(glob, options = {}) {
|
|
|
2496
2058
|
throw new Error(`Glob contains invalid characters: "${glob}"`);
|
|
2497
2059
|
}
|
|
2498
2060
|
if (!globstar) {
|
|
2499
|
-
return
|
|
2061
|
+
return normalize2(glob);
|
|
2500
2062
|
}
|
|
2501
2063
|
const s = SEPARATOR_PATTERN3.source;
|
|
2502
2064
|
const badParentPattern = new RegExp(`(?<=(${s}|^)\\*\\*${s})\\.\\.(?=${s}|$)`, "g");
|
|
2503
|
-
return
|
|
2065
|
+
return normalize2(glob.replace(badParentPattern, "\0")).replace(/\0/g, "..");
|
|
2504
2066
|
}
|
|
2505
2067
|
var init_normalize_glob2 = __esm({
|
|
2506
2068
|
"deno:https://jsr.io/@std/path/1.1.4/windows/normalize_glob.ts"() {
|
|
@@ -2513,7 +2075,7 @@ var init_normalize_glob2 = __esm({
|
|
|
2513
2075
|
function joinGlobs2(globs, options = {}) {
|
|
2514
2076
|
const { globstar = false } = options;
|
|
2515
2077
|
if (!globstar || globs.length === 0) {
|
|
2516
|
-
return
|
|
2078
|
+
return join2(...globs);
|
|
2517
2079
|
}
|
|
2518
2080
|
let joined;
|
|
2519
2081
|
for (const glob of globs) {
|
|
@@ -2583,13 +2145,48 @@ var init_mod = __esm({
|
|
|
2583
2145
|
}
|
|
2584
2146
|
});
|
|
2585
2147
|
|
|
2148
|
+
// pkg/@eser/standards/runtime/adapters/shared.ts
|
|
2149
|
+
var mapStdioToNode, getStdioModes, getNodeStdioArray;
|
|
2150
|
+
var init_shared = __esm({
|
|
2151
|
+
"pkg/@eser/standards/runtime/adapters/shared.ts"() {
|
|
2152
|
+
mapStdioToNode = (mode) => {
|
|
2153
|
+
if (mode === "inherit") return "inherit";
|
|
2154
|
+
if (mode === "piped") return "pipe";
|
|
2155
|
+
return "ignore";
|
|
2156
|
+
};
|
|
2157
|
+
getStdioModes = (options) => ({
|
|
2158
|
+
stdin: options?.stdin ?? "null",
|
|
2159
|
+
stdout: options?.stdout ?? "piped",
|
|
2160
|
+
stderr: options?.stderr ?? "piped"
|
|
2161
|
+
});
|
|
2162
|
+
getNodeStdioArray = (options) => {
|
|
2163
|
+
const modes = getStdioModes(options);
|
|
2164
|
+
return [
|
|
2165
|
+
mapStdioToNode(modes.stdin),
|
|
2166
|
+
mapStdioToNode(modes.stdout),
|
|
2167
|
+
mapStdioToNode(modes.stderr)
|
|
2168
|
+
];
|
|
2169
|
+
};
|
|
2170
|
+
}
|
|
2171
|
+
});
|
|
2172
|
+
|
|
2586
2173
|
// pkg/@eser/standards/runtime/adapters/deno.ts
|
|
2587
|
-
var createDenoFs, createDenoPath, createDenoExec, createDenoEnv, createDenoProcess, createDenoRuntime;
|
|
2174
|
+
var DENO_CAPABILITIES, createDenoFs, createDenoPath, createDenoExec, createDenoEnv, createDenoProcess, createDenoRuntime;
|
|
2588
2175
|
var init_deno = __esm({
|
|
2589
2176
|
"pkg/@eser/standards/runtime/adapters/deno.ts"() {
|
|
2590
2177
|
init_mod();
|
|
2591
2178
|
init_types();
|
|
2592
|
-
|
|
2179
|
+
init_shared();
|
|
2180
|
+
DENO_CAPABILITIES = {
|
|
2181
|
+
fs: true,
|
|
2182
|
+
fsSync: true,
|
|
2183
|
+
exec: true,
|
|
2184
|
+
process: true,
|
|
2185
|
+
env: true,
|
|
2186
|
+
stdin: true,
|
|
2187
|
+
stdout: true,
|
|
2188
|
+
kv: true
|
|
2189
|
+
};
|
|
2593
2190
|
createDenoFs = () => {
|
|
2594
2191
|
const mapFileInfo = (info) => ({
|
|
2595
2192
|
isFile: info.isFile,
|
|
@@ -2726,16 +2323,16 @@ var init_deno = __esm({
|
|
|
2726
2323
|
};
|
|
2727
2324
|
createDenoPath = () => {
|
|
2728
2325
|
return {
|
|
2729
|
-
join:
|
|
2730
|
-
resolve:
|
|
2731
|
-
dirname:
|
|
2732
|
-
basename:
|
|
2733
|
-
extname:
|
|
2734
|
-
normalize:
|
|
2735
|
-
isAbsolute:
|
|
2736
|
-
relative:
|
|
2737
|
-
parse:
|
|
2738
|
-
format:
|
|
2326
|
+
join: join3,
|
|
2327
|
+
resolve: resolve3,
|
|
2328
|
+
dirname: dirname3,
|
|
2329
|
+
basename: basename3,
|
|
2330
|
+
extname: extname3,
|
|
2331
|
+
normalize: normalize3,
|
|
2332
|
+
isAbsolute: isAbsolute3,
|
|
2333
|
+
relative: relative3,
|
|
2334
|
+
parse: parse3,
|
|
2335
|
+
format: format3,
|
|
2739
2336
|
sep: SEPARATOR,
|
|
2740
2337
|
delimiter: DELIMITER
|
|
2741
2338
|
};
|
|
@@ -2743,23 +2340,22 @@ var init_deno = __esm({
|
|
|
2743
2340
|
createDenoExec = () => {
|
|
2744
2341
|
return {
|
|
2745
2342
|
async spawn(cmd, args = [], options) {
|
|
2746
|
-
const
|
|
2747
|
-
const stderrMode = options?.stderr ?? "piped";
|
|
2343
|
+
const modes = getStdioModes(options);
|
|
2748
2344
|
const command = new Deno.Command(cmd, {
|
|
2749
2345
|
args,
|
|
2750
2346
|
cwd: options?.cwd,
|
|
2751
2347
|
env: options?.env,
|
|
2752
|
-
stdin:
|
|
2753
|
-
stdout:
|
|
2754
|
-
stderr:
|
|
2348
|
+
stdin: modes.stdin,
|
|
2349
|
+
stdout: modes.stdout,
|
|
2350
|
+
stderr: modes.stderr,
|
|
2755
2351
|
signal: options?.signal
|
|
2756
2352
|
});
|
|
2757
2353
|
const result = await command.output();
|
|
2758
2354
|
return {
|
|
2759
2355
|
success: result.success,
|
|
2760
2356
|
code: result.code,
|
|
2761
|
-
stdout:
|
|
2762
|
-
stderr:
|
|
2357
|
+
stdout: modes.stdout === "piped" ? result.stdout : new Uint8Array(),
|
|
2358
|
+
stderr: modes.stderr === "piped" ? result.stderr : new Uint8Array()
|
|
2763
2359
|
};
|
|
2764
2360
|
},
|
|
2765
2361
|
async exec(cmd, args = [], options) {
|
|
@@ -2775,35 +2371,40 @@ var init_deno = __esm({
|
|
|
2775
2371
|
return JSON.parse(output);
|
|
2776
2372
|
},
|
|
2777
2373
|
spawnChild(cmd, args = [], options) {
|
|
2778
|
-
const
|
|
2779
|
-
const stdoutMode = options?.stdout ?? "piped";
|
|
2780
|
-
const stderrMode = options?.stderr ?? "piped";
|
|
2374
|
+
const modes = getStdioModes(options);
|
|
2781
2375
|
const command = new Deno.Command(cmd, {
|
|
2782
2376
|
args,
|
|
2783
2377
|
cwd: options?.cwd,
|
|
2784
2378
|
env: options?.env,
|
|
2785
|
-
stdin:
|
|
2786
|
-
stdout:
|
|
2787
|
-
stderr:
|
|
2379
|
+
stdin: modes.stdin,
|
|
2380
|
+
stdout: modes.stdout,
|
|
2381
|
+
stderr: modes.stderr,
|
|
2788
2382
|
signal: options?.signal
|
|
2789
2383
|
});
|
|
2790
2384
|
const process = command.spawn();
|
|
2385
|
+
const collectStream = (stream, mode) => {
|
|
2386
|
+
if (mode !== "piped" || !stream) {
|
|
2387
|
+
return Promise.resolve(new Uint8Array());
|
|
2388
|
+
}
|
|
2389
|
+
return new Response(stream).arrayBuffer().then((b) => new Uint8Array(b));
|
|
2390
|
+
};
|
|
2791
2391
|
return {
|
|
2792
2392
|
pid: process.pid,
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
stderr: stderrMode === "piped" ? process.stderr : null,
|
|
2393
|
+
stdin: modes.stdin === "piped" ? process.stdin : null,
|
|
2394
|
+
stdout: modes.stdout === "piped" ? process.stdout : null,
|
|
2395
|
+
stderr: modes.stderr === "piped" ? process.stderr : null,
|
|
2797
2396
|
status: process.status.then((status) => ({
|
|
2798
2397
|
success: status.success,
|
|
2799
2398
|
code: status.code,
|
|
2800
2399
|
signal: status.signal ?? void 0
|
|
2801
2400
|
})),
|
|
2802
2401
|
output: async () => {
|
|
2402
|
+
const stdoutStream = modes.stdout === "piped" ? process.stdout : null;
|
|
2403
|
+
const stderrStream = modes.stderr === "piped" ? process.stderr : null;
|
|
2803
2404
|
const [status, stdout, stderr] = await Promise.all([
|
|
2804
2405
|
process.status,
|
|
2805
|
-
|
|
2806
|
-
|
|
2406
|
+
collectStream(stdoutStream, modes.stdout),
|
|
2407
|
+
collectStream(stderrStream, modes.stderr)
|
|
2807
2408
|
]);
|
|
2808
2409
|
return {
|
|
2809
2410
|
success: status.success,
|
|
@@ -2890,11 +2491,21 @@ import * as nodeChildProcess from "node:child_process";
|
|
|
2890
2491
|
import nodeProcess from "node:process";
|
|
2891
2492
|
import { Buffer as Buffer2 } from "node:buffer";
|
|
2892
2493
|
import { Readable, Writable } from "node:stream";
|
|
2893
|
-
var createNodeFs, createNodePath, createNodeExec, createNodeEnv, createNodeProcess, createNodeRuntime;
|
|
2494
|
+
var NODE_CAPABILITIES, createNodeFs, createNodePath, createNodeExec, createNodeEnv, createNodeProcess, createNodeRuntime;
|
|
2894
2495
|
var init_node = __esm({
|
|
2895
2496
|
"pkg/@eser/standards/runtime/adapters/node.ts"() {
|
|
2896
2497
|
init_types();
|
|
2897
|
-
|
|
2498
|
+
init_shared();
|
|
2499
|
+
NODE_CAPABILITIES = {
|
|
2500
|
+
fs: true,
|
|
2501
|
+
fsSync: true,
|
|
2502
|
+
exec: true,
|
|
2503
|
+
process: true,
|
|
2504
|
+
env: true,
|
|
2505
|
+
stdin: true,
|
|
2506
|
+
stdout: true,
|
|
2507
|
+
kv: false
|
|
2508
|
+
};
|
|
2898
2509
|
createNodeFs = () => {
|
|
2899
2510
|
const mapStats = (stats) => ({
|
|
2900
2511
|
isFile: stats.isFile(),
|
|
@@ -3052,30 +2663,20 @@ var init_node = __esm({
|
|
|
3052
2663
|
...nodeProcess.env,
|
|
3053
2664
|
...options.env
|
|
3054
2665
|
} : void 0,
|
|
3055
|
-
stdio:
|
|
3056
|
-
options?.stdin === "inherit" ? "inherit" : options?.stdin === "piped" ? "pipe" : "ignore",
|
|
3057
|
-
options?.stdout === "inherit" ? "inherit" : options?.stdout === "null" ? "ignore" : "pipe",
|
|
3058
|
-
options?.stderr === "inherit" ? "inherit" : options?.stderr === "null" ? "ignore" : "pipe"
|
|
3059
|
-
],
|
|
2666
|
+
stdio: getNodeStdioArray(options),
|
|
3060
2667
|
signal: options?.signal
|
|
3061
2668
|
});
|
|
3062
2669
|
const stdoutChunks = [];
|
|
3063
2670
|
const stderrChunks = [];
|
|
3064
|
-
proc.stdout?.on("data", (chunk) =>
|
|
3065
|
-
|
|
3066
|
-
});
|
|
3067
|
-
proc.stderr?.on("data", (chunk) => {
|
|
3068
|
-
stderrChunks.push(chunk);
|
|
3069
|
-
});
|
|
2671
|
+
proc.stdout?.on("data", (chunk) => stdoutChunks.push(chunk));
|
|
2672
|
+
proc.stderr?.on("data", (chunk) => stderrChunks.push(chunk));
|
|
3070
2673
|
proc.on("error", reject);
|
|
3071
2674
|
proc.on("close", (code2) => {
|
|
3072
|
-
const stdout = new Uint8Array(Buffer2.concat(stdoutChunks));
|
|
3073
|
-
const stderr = new Uint8Array(Buffer2.concat(stderrChunks));
|
|
3074
2675
|
resolve7({
|
|
3075
2676
|
success: code2 === 0,
|
|
3076
2677
|
code: code2 ?? 1,
|
|
3077
|
-
stdout,
|
|
3078
|
-
stderr
|
|
2678
|
+
stdout: new Uint8Array(Buffer2.concat(stdoutChunks)),
|
|
2679
|
+
stderr: new Uint8Array(Buffer2.concat(stderrChunks))
|
|
3079
2680
|
});
|
|
3080
2681
|
});
|
|
3081
2682
|
});
|
|
@@ -3093,36 +2694,19 @@ var init_node = __esm({
|
|
|
3093
2694
|
return JSON.parse(output);
|
|
3094
2695
|
},
|
|
3095
2696
|
spawnChild(cmd, args = [], options) {
|
|
3096
|
-
const mapStdio = (value2) => {
|
|
3097
|
-
if (value2 === "inherit") {
|
|
3098
|
-
return "inherit";
|
|
3099
|
-
}
|
|
3100
|
-
if (value2 === "piped") {
|
|
3101
|
-
return "pipe";
|
|
3102
|
-
}
|
|
3103
|
-
return "ignore";
|
|
3104
|
-
};
|
|
3105
2697
|
const proc = nodeChildProcess.spawn(cmd, args, {
|
|
3106
2698
|
cwd: options?.cwd,
|
|
3107
2699
|
env: options?.env ? {
|
|
3108
2700
|
...nodeProcess.env,
|
|
3109
2701
|
...options.env
|
|
3110
2702
|
} : void 0,
|
|
3111
|
-
stdio:
|
|
3112
|
-
mapStdio(options?.stdin),
|
|
3113
|
-
mapStdio(options?.stdout ?? "piped"),
|
|
3114
|
-
mapStdio(options?.stderr ?? "piped")
|
|
3115
|
-
],
|
|
2703
|
+
stdio: getNodeStdioArray(options),
|
|
3116
2704
|
signal: options?.signal
|
|
3117
2705
|
});
|
|
3118
2706
|
const stdoutChunks = [];
|
|
3119
2707
|
const stderrChunks = [];
|
|
3120
|
-
proc.stdout?.on("data", (chunk) =>
|
|
3121
|
-
|
|
3122
|
-
});
|
|
3123
|
-
proc.stderr?.on("data", (chunk) => {
|
|
3124
|
-
stderrChunks.push(chunk);
|
|
3125
|
-
});
|
|
2708
|
+
proc.stdout?.on("data", (chunk) => stdoutChunks.push(chunk));
|
|
2709
|
+
proc.stderr?.on("data", (chunk) => stderrChunks.push(chunk));
|
|
3126
2710
|
const statusPromise = new Promise((resolve7, reject) => {
|
|
3127
2711
|
proc.on("error", reject);
|
|
3128
2712
|
proc.on("close", (code2, signal) => {
|
|
@@ -3230,11 +2814,21 @@ import * as nodePath2 from "node:path";
|
|
|
3230
2814
|
import * as nodeOs2 from "node:os";
|
|
3231
2815
|
import nodeProcess2 from "node:process";
|
|
3232
2816
|
import { Readable as Readable2, Writable as Writable2 } from "node:stream";
|
|
3233
|
-
var createBunFs, createBunPath, readStream, createBunExec, createBunEnv, createBunProcess, createBunRuntime;
|
|
2817
|
+
var BUN_CAPABILITIES, createBunFs, createBunPath, readStream, createBunExec, createBunEnv, createBunProcess, createBunRuntime;
|
|
3234
2818
|
var init_bun = __esm({
|
|
3235
2819
|
"pkg/@eser/standards/runtime/adapters/bun.ts"() {
|
|
3236
2820
|
init_types();
|
|
3237
|
-
|
|
2821
|
+
init_shared();
|
|
2822
|
+
BUN_CAPABILITIES = {
|
|
2823
|
+
fs: true,
|
|
2824
|
+
fsSync: true,
|
|
2825
|
+
exec: true,
|
|
2826
|
+
process: true,
|
|
2827
|
+
env: true,
|
|
2828
|
+
stdin: true,
|
|
2829
|
+
stdout: true,
|
|
2830
|
+
kv: false
|
|
2831
|
+
};
|
|
3238
2832
|
createBunFs = () => {
|
|
3239
2833
|
const mapStats = (stats) => ({
|
|
3240
2834
|
isFile: stats.isFile(),
|
|
@@ -3362,186 +2956,499 @@ var init_bun = __esm({
|
|
|
3362
2956
|
await nodeFsPromises2.rename(tempPath, newPath);
|
|
3363
2957
|
return newPath;
|
|
3364
2958
|
}
|
|
3365
|
-
return tempPath;
|
|
2959
|
+
return tempPath;
|
|
2960
|
+
}
|
|
2961
|
+
};
|
|
2962
|
+
};
|
|
2963
|
+
createBunPath = () => {
|
|
2964
|
+
return {
|
|
2965
|
+
join: nodePath2.join,
|
|
2966
|
+
resolve: nodePath2.resolve,
|
|
2967
|
+
dirname: nodePath2.dirname,
|
|
2968
|
+
basename: nodePath2.basename,
|
|
2969
|
+
extname: nodePath2.extname,
|
|
2970
|
+
normalize: nodePath2.normalize,
|
|
2971
|
+
isAbsolute: nodePath2.isAbsolute,
|
|
2972
|
+
relative: nodePath2.relative,
|
|
2973
|
+
parse: nodePath2.parse,
|
|
2974
|
+
format: nodePath2.format,
|
|
2975
|
+
sep: nodePath2.sep,
|
|
2976
|
+
delimiter: nodePath2.delimiter
|
|
2977
|
+
};
|
|
2978
|
+
};
|
|
2979
|
+
readStream = async (stream) => {
|
|
2980
|
+
if (!stream) return new Uint8Array(0);
|
|
2981
|
+
const chunks = [];
|
|
2982
|
+
const reader = stream.getReader();
|
|
2983
|
+
try {
|
|
2984
|
+
while (true) {
|
|
2985
|
+
const { done, value: value2 } = await reader.read();
|
|
2986
|
+
if (done) break;
|
|
2987
|
+
chunks.push(value2);
|
|
2988
|
+
}
|
|
2989
|
+
} finally {
|
|
2990
|
+
reader.releaseLock();
|
|
2991
|
+
}
|
|
2992
|
+
const totalLength = chunks.reduce((acc, chunk) => acc + chunk.length, 0);
|
|
2993
|
+
const result = new Uint8Array(totalLength);
|
|
2994
|
+
let offset = 0;
|
|
2995
|
+
for (const chunk of chunks) {
|
|
2996
|
+
result.set(chunk, offset);
|
|
2997
|
+
offset += chunk.length;
|
|
2998
|
+
}
|
|
2999
|
+
return result;
|
|
3000
|
+
};
|
|
3001
|
+
createBunExec = () => {
|
|
3002
|
+
return {
|
|
3003
|
+
async spawn(cmd, args = [], options) {
|
|
3004
|
+
const [stdinMode, stdoutMode, stderrMode] = getNodeStdioArray(options);
|
|
3005
|
+
const proc = Bun.spawn([
|
|
3006
|
+
cmd,
|
|
3007
|
+
...args
|
|
3008
|
+
], {
|
|
3009
|
+
cwd: options?.cwd,
|
|
3010
|
+
env: options?.env,
|
|
3011
|
+
stdin: stdinMode,
|
|
3012
|
+
stdout: stdoutMode,
|
|
3013
|
+
stderr: stderrMode
|
|
3014
|
+
});
|
|
3015
|
+
const [exitCode, stdout, stderr] = await Promise.all([
|
|
3016
|
+
proc.exited,
|
|
3017
|
+
readStream(proc.stdout),
|
|
3018
|
+
readStream(proc.stderr)
|
|
3019
|
+
]);
|
|
3020
|
+
return {
|
|
3021
|
+
success: exitCode === 0,
|
|
3022
|
+
code: exitCode,
|
|
3023
|
+
stdout,
|
|
3024
|
+
stderr
|
|
3025
|
+
};
|
|
3026
|
+
},
|
|
3027
|
+
async exec(cmd, args = [], options) {
|
|
3028
|
+
const result = await this.spawn(cmd, args, options);
|
|
3029
|
+
if (!result.success) {
|
|
3030
|
+
const stderr = new TextDecoder().decode(result.stderr);
|
|
3031
|
+
throw new ProcessError(cmd, result.code, stderr);
|
|
3032
|
+
}
|
|
3033
|
+
return new TextDecoder().decode(result.stdout).trim();
|
|
3034
|
+
},
|
|
3035
|
+
async execJson(cmd, args = [], options) {
|
|
3036
|
+
const output = await this.exec(cmd, args, options);
|
|
3037
|
+
return JSON.parse(output);
|
|
3038
|
+
},
|
|
3039
|
+
spawnChild(cmd, args = [], options) {
|
|
3040
|
+
const [stdinMode, stdoutMode, stderrMode] = getNodeStdioArray(options);
|
|
3041
|
+
const proc = Bun.spawn([
|
|
3042
|
+
cmd,
|
|
3043
|
+
...args
|
|
3044
|
+
], {
|
|
3045
|
+
cwd: options?.cwd,
|
|
3046
|
+
env: options?.env,
|
|
3047
|
+
stdin: stdinMode,
|
|
3048
|
+
stdout: stdoutMode,
|
|
3049
|
+
stderr: stderrMode
|
|
3050
|
+
});
|
|
3051
|
+
const statusPromise = proc.exited.then((code2) => ({
|
|
3052
|
+
success: code2 === 0,
|
|
3053
|
+
code: code2,
|
|
3054
|
+
signal: void 0
|
|
3055
|
+
}));
|
|
3056
|
+
return {
|
|
3057
|
+
pid: proc.pid,
|
|
3058
|
+
stdin: proc.stdin,
|
|
3059
|
+
stdout: proc.stdout,
|
|
3060
|
+
stderr: proc.stderr,
|
|
3061
|
+
status: statusPromise,
|
|
3062
|
+
output: async () => {
|
|
3063
|
+
const [status, stdout, stderr] = await Promise.all([
|
|
3064
|
+
statusPromise,
|
|
3065
|
+
readStream(proc.stdout),
|
|
3066
|
+
readStream(proc.stderr)
|
|
3067
|
+
]);
|
|
3068
|
+
return {
|
|
3069
|
+
success: status.success,
|
|
3070
|
+
code: status.code,
|
|
3071
|
+
stdout,
|
|
3072
|
+
stderr
|
|
3073
|
+
};
|
|
3074
|
+
},
|
|
3075
|
+
kill: (signal) => {
|
|
3076
|
+
proc.kill(signal);
|
|
3077
|
+
}
|
|
3078
|
+
};
|
|
3079
|
+
}
|
|
3080
|
+
};
|
|
3081
|
+
};
|
|
3082
|
+
createBunEnv = () => {
|
|
3083
|
+
return {
|
|
3084
|
+
get(key) {
|
|
3085
|
+
return nodeProcess2.env[key];
|
|
3086
|
+
},
|
|
3087
|
+
set(key, value2) {
|
|
3088
|
+
nodeProcess2.env[key] = value2;
|
|
3089
|
+
},
|
|
3090
|
+
delete(key) {
|
|
3091
|
+
delete nodeProcess2.env[key];
|
|
3092
|
+
},
|
|
3093
|
+
has(key) {
|
|
3094
|
+
return key in nodeProcess2.env;
|
|
3095
|
+
},
|
|
3096
|
+
toObject() {
|
|
3097
|
+
const result = {};
|
|
3098
|
+
for (const [key, value2] of Object.entries(nodeProcess2.env)) {
|
|
3099
|
+
if (value2 !== void 0) {
|
|
3100
|
+
result[key] = value2;
|
|
3101
|
+
}
|
|
3102
|
+
}
|
|
3103
|
+
return result;
|
|
3104
|
+
}
|
|
3105
|
+
};
|
|
3106
|
+
};
|
|
3107
|
+
createBunProcess = () => {
|
|
3108
|
+
return {
|
|
3109
|
+
exit(code2) {
|
|
3110
|
+
nodeProcess2.exit(code2);
|
|
3111
|
+
},
|
|
3112
|
+
cwd() {
|
|
3113
|
+
return nodeProcess2.cwd();
|
|
3114
|
+
},
|
|
3115
|
+
chdir(path) {
|
|
3116
|
+
nodeProcess2.chdir(path);
|
|
3117
|
+
},
|
|
3118
|
+
hostname() {
|
|
3119
|
+
return nodeOs2.hostname();
|
|
3120
|
+
},
|
|
3121
|
+
execPath() {
|
|
3122
|
+
return nodeProcess2.execPath;
|
|
3123
|
+
},
|
|
3124
|
+
args: nodeProcess2.argv.slice(2),
|
|
3125
|
+
pid: nodeProcess2.pid,
|
|
3126
|
+
stdin: Readable2.toWeb(nodeProcess2.stdin),
|
|
3127
|
+
stdout: Writable2.toWeb(nodeProcess2.stdout),
|
|
3128
|
+
stderr: Writable2.toWeb(nodeProcess2.stderr)
|
|
3129
|
+
};
|
|
3130
|
+
};
|
|
3131
|
+
createBunRuntime = () => {
|
|
3132
|
+
const fs = createBunFs();
|
|
3133
|
+
const path = createBunPath();
|
|
3134
|
+
const exec2 = createBunExec();
|
|
3135
|
+
const env = createBunEnv();
|
|
3136
|
+
const process = createBunProcess();
|
|
3137
|
+
return {
|
|
3138
|
+
name: "bun",
|
|
3139
|
+
version: Bun.version,
|
|
3140
|
+
capabilities: BUN_CAPABILITIES,
|
|
3141
|
+
fs,
|
|
3142
|
+
path,
|
|
3143
|
+
exec: exec2,
|
|
3144
|
+
env,
|
|
3145
|
+
process
|
|
3146
|
+
};
|
|
3147
|
+
};
|
|
3148
|
+
}
|
|
3149
|
+
});
|
|
3150
|
+
|
|
3151
|
+
// pkg/@eser/standards/runtime/polyfills/path.ts
|
|
3152
|
+
var POSIX_SEP, POSIX_DELIMITER, normalizeSlashes, join6, resolve6, dirname6, basename6, extname6, normalize6, isAbsolute6, relative6, parse6, format6, posixPath;
|
|
3153
|
+
var init_path = __esm({
|
|
3154
|
+
"pkg/@eser/standards/runtime/polyfills/path.ts"() {
|
|
3155
|
+
POSIX_SEP = "/";
|
|
3156
|
+
POSIX_DELIMITER = ":";
|
|
3157
|
+
normalizeSlashes = (path) => {
|
|
3158
|
+
return path.replace(/\\/g, "/").replace(/\/+/g, "/");
|
|
3159
|
+
};
|
|
3160
|
+
join6 = (...paths) => {
|
|
3161
|
+
if (paths.length === 0) return ".";
|
|
3162
|
+
const joined = paths.filter((p) => p.length > 0).join(POSIX_SEP);
|
|
3163
|
+
if (joined.length === 0) return ".";
|
|
3164
|
+
return normalize6(joined);
|
|
3165
|
+
};
|
|
3166
|
+
resolve6 = (...paths) => {
|
|
3167
|
+
let resolvedPath = "";
|
|
3168
|
+
let resolvedAbsolute = false;
|
|
3169
|
+
for (let i = paths.length - 1; i >= 0 && !resolvedAbsolute; i--) {
|
|
3170
|
+
const segment = paths[i];
|
|
3171
|
+
if (segment === void 0 || segment.length === 0) continue;
|
|
3172
|
+
resolvedPath = `${segment}/${resolvedPath}`;
|
|
3173
|
+
resolvedAbsolute = isAbsolute6(segment);
|
|
3174
|
+
}
|
|
3175
|
+
resolvedPath = normalizeSlashes(resolvedPath);
|
|
3176
|
+
if (resolvedPath.length > 1 && resolvedPath.endsWith("/")) {
|
|
3177
|
+
resolvedPath = resolvedPath.slice(0, -1);
|
|
3178
|
+
}
|
|
3179
|
+
return normalize6(resolvedPath) ?? ".";
|
|
3180
|
+
};
|
|
3181
|
+
dirname6 = (path) => {
|
|
3182
|
+
if (path.length === 0) return ".";
|
|
3183
|
+
path = normalizeSlashes(path);
|
|
3184
|
+
while (path.length > 1 && path.endsWith("/")) {
|
|
3185
|
+
path = path.slice(0, -1);
|
|
3186
|
+
}
|
|
3187
|
+
const lastSlash = path.lastIndexOf("/");
|
|
3188
|
+
if (lastSlash === -1) return ".";
|
|
3189
|
+
if (lastSlash === 0) return "/";
|
|
3190
|
+
return path.slice(0, lastSlash);
|
|
3191
|
+
};
|
|
3192
|
+
basename6 = (path, suffix) => {
|
|
3193
|
+
if (path.length === 0) return "";
|
|
3194
|
+
path = normalizeSlashes(path);
|
|
3195
|
+
while (path.length > 1 && path.endsWith("/")) {
|
|
3196
|
+
path = path.slice(0, -1);
|
|
3197
|
+
}
|
|
3198
|
+
const lastSlash = path.lastIndexOf("/");
|
|
3199
|
+
let base = lastSlash === -1 ? path : path.slice(lastSlash + 1);
|
|
3200
|
+
if (suffix && base.endsWith(suffix)) {
|
|
3201
|
+
base = base.slice(0, -suffix.length);
|
|
3202
|
+
}
|
|
3203
|
+
return base;
|
|
3204
|
+
};
|
|
3205
|
+
extname6 = (path) => {
|
|
3206
|
+
const base = basename6(path);
|
|
3207
|
+
const lastDot = base.lastIndexOf(".");
|
|
3208
|
+
if (lastDot <= 0 || lastDot === base.length - 1) {
|
|
3209
|
+
return "";
|
|
3210
|
+
}
|
|
3211
|
+
return base.slice(lastDot);
|
|
3212
|
+
};
|
|
3213
|
+
normalize6 = (path) => {
|
|
3214
|
+
if (path.length === 0) return ".";
|
|
3215
|
+
path = normalizeSlashes(path);
|
|
3216
|
+
const isAbs = path.startsWith("/");
|
|
3217
|
+
const trailingSlash = path.endsWith("/");
|
|
3218
|
+
const segments = path.split("/").filter((s) => s.length > 0);
|
|
3219
|
+
const result = [];
|
|
3220
|
+
for (const segment of segments) {
|
|
3221
|
+
if (segment === ".") {
|
|
3222
|
+
continue;
|
|
3223
|
+
}
|
|
3224
|
+
if (segment === "..") {
|
|
3225
|
+
if (result.length > 0 && result[result.length - 1] !== "..") {
|
|
3226
|
+
result.pop();
|
|
3227
|
+
} else if (!isAbs) {
|
|
3228
|
+
result.push("..");
|
|
3229
|
+
}
|
|
3230
|
+
} else {
|
|
3231
|
+
result.push(segment);
|
|
3366
3232
|
}
|
|
3367
|
-
}
|
|
3233
|
+
}
|
|
3234
|
+
let normalized = result.join("/");
|
|
3235
|
+
if (isAbs) {
|
|
3236
|
+
normalized = `/${normalized}`;
|
|
3237
|
+
}
|
|
3238
|
+
if (trailingSlash && normalized.length > 1) {
|
|
3239
|
+
normalized += "/";
|
|
3240
|
+
}
|
|
3241
|
+
return normalized ?? ".";
|
|
3368
3242
|
};
|
|
3369
|
-
|
|
3243
|
+
isAbsolute6 = (path) => {
|
|
3244
|
+
if (path.length === 0) return false;
|
|
3245
|
+
if (path.startsWith("/")) return true;
|
|
3246
|
+
if (path.length >= 3 && /^[a-zA-Z]:[/\\]/.test(path)) {
|
|
3247
|
+
return true;
|
|
3248
|
+
}
|
|
3249
|
+
return false;
|
|
3250
|
+
};
|
|
3251
|
+
relative6 = (from, to) => {
|
|
3252
|
+
if (from === to) return "";
|
|
3253
|
+
from = resolve6(from);
|
|
3254
|
+
to = resolve6(to);
|
|
3255
|
+
if (from === to) return "";
|
|
3256
|
+
const fromParts = from.split("/").filter((p) => p.length > 0);
|
|
3257
|
+
const toParts = to.split("/").filter((p) => p.length > 0);
|
|
3258
|
+
let commonLength = 0;
|
|
3259
|
+
const minLength = Math.min(fromParts.length, toParts.length);
|
|
3260
|
+
for (let i = 0; i < minLength; i++) {
|
|
3261
|
+
if (fromParts[i] !== toParts[i]) break;
|
|
3262
|
+
commonLength++;
|
|
3263
|
+
}
|
|
3264
|
+
const upCount = fromParts.length - commonLength;
|
|
3265
|
+
const remaining = toParts.slice(commonLength);
|
|
3266
|
+
const result = [
|
|
3267
|
+
...Array(upCount).fill(".."),
|
|
3268
|
+
...remaining
|
|
3269
|
+
];
|
|
3270
|
+
return result.join("/") ?? ".";
|
|
3271
|
+
};
|
|
3272
|
+
parse6 = (path) => {
|
|
3273
|
+
if (path.length === 0) {
|
|
3274
|
+
return {
|
|
3275
|
+
root: "",
|
|
3276
|
+
dir: "",
|
|
3277
|
+
base: "",
|
|
3278
|
+
ext: "",
|
|
3279
|
+
name: ""
|
|
3280
|
+
};
|
|
3281
|
+
}
|
|
3282
|
+
path = normalizeSlashes(path);
|
|
3283
|
+
let root = "";
|
|
3284
|
+
let dir = "";
|
|
3285
|
+
const base = basename6(path);
|
|
3286
|
+
const ext = extname6(path);
|
|
3287
|
+
const name = ext ? base.slice(0, -ext.length) : base;
|
|
3288
|
+
if (path.startsWith("/")) {
|
|
3289
|
+
root = "/";
|
|
3290
|
+
} else if (/^[a-zA-Z]:[/\\]/.test(path)) {
|
|
3291
|
+
root = path.slice(0, 3);
|
|
3292
|
+
}
|
|
3293
|
+
dir = dirname6(path);
|
|
3294
|
+
if (dir === ".") {
|
|
3295
|
+
dir = "";
|
|
3296
|
+
}
|
|
3370
3297
|
return {
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
normalize: nodePath2.normalize,
|
|
3377
|
-
isAbsolute: nodePath2.isAbsolute,
|
|
3378
|
-
relative: nodePath2.relative,
|
|
3379
|
-
parse: nodePath2.parse,
|
|
3380
|
-
format: nodePath2.format,
|
|
3381
|
-
sep: nodePath2.sep,
|
|
3382
|
-
delimiter: nodePath2.delimiter
|
|
3298
|
+
root,
|
|
3299
|
+
dir,
|
|
3300
|
+
base,
|
|
3301
|
+
ext,
|
|
3302
|
+
name
|
|
3383
3303
|
};
|
|
3384
3304
|
};
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
const
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
const { done, value: value2 } = await reader.read();
|
|
3392
|
-
if (done) break;
|
|
3393
|
-
chunks.push(value2);
|
|
3305
|
+
format6 = (pathObject) => {
|
|
3306
|
+
const { root = "", dir, base, ext = "", name = "" } = pathObject;
|
|
3307
|
+
const finalBase = base ?? name + ext;
|
|
3308
|
+
if (dir) {
|
|
3309
|
+
if (dir === root) {
|
|
3310
|
+
return `${dir}${finalBase}`;
|
|
3394
3311
|
}
|
|
3395
|
-
|
|
3396
|
-
reader.releaseLock();
|
|
3397
|
-
}
|
|
3398
|
-
const totalLength = chunks.reduce((acc, chunk) => acc + chunk.length, 0);
|
|
3399
|
-
const result = new Uint8Array(totalLength);
|
|
3400
|
-
let offset = 0;
|
|
3401
|
-
for (const chunk of chunks) {
|
|
3402
|
-
result.set(chunk, offset);
|
|
3403
|
-
offset += chunk.length;
|
|
3312
|
+
return `${dir}/${finalBase}`;
|
|
3404
3313
|
}
|
|
3405
|
-
return
|
|
3314
|
+
return `${root}${finalBase}`;
|
|
3406
3315
|
};
|
|
3407
|
-
|
|
3316
|
+
posixPath = {
|
|
3317
|
+
join: join6,
|
|
3318
|
+
resolve: resolve6,
|
|
3319
|
+
dirname: dirname6,
|
|
3320
|
+
basename: basename6,
|
|
3321
|
+
extname: extname6,
|
|
3322
|
+
normalize: normalize6,
|
|
3323
|
+
isAbsolute: isAbsolute6,
|
|
3324
|
+
relative: relative6,
|
|
3325
|
+
parse: parse6,
|
|
3326
|
+
format: format6,
|
|
3327
|
+
sep: POSIX_SEP,
|
|
3328
|
+
delimiter: POSIX_DELIMITER
|
|
3329
|
+
};
|
|
3330
|
+
}
|
|
3331
|
+
});
|
|
3332
|
+
|
|
3333
|
+
// pkg/@eser/standards/runtime/adapters/workerd.ts
|
|
3334
|
+
var WORKERD_CAPABILITIES, createWorkerdFs, createWorkerdPath, createWorkerdExec, envStorage, createWorkerdEnv, populateEnvFromContext, clearEnv, createWorkerdProcess, createWorkerdRuntime;
|
|
3335
|
+
var init_workerd = __esm({
|
|
3336
|
+
"pkg/@eser/standards/runtime/adapters/workerd.ts"() {
|
|
3337
|
+
init_types();
|
|
3338
|
+
init_path();
|
|
3339
|
+
WORKERD_CAPABILITIES = {
|
|
3340
|
+
fs: false,
|
|
3341
|
+
fsSync: false,
|
|
3342
|
+
exec: false,
|
|
3343
|
+
process: false,
|
|
3344
|
+
env: true,
|
|
3345
|
+
stdin: false,
|
|
3346
|
+
stdout: false,
|
|
3347
|
+
kv: true
|
|
3348
|
+
};
|
|
3349
|
+
createWorkerdFs = () => {
|
|
3350
|
+
const throwNotAvailable = () => {
|
|
3351
|
+
throw new RuntimeCapabilityError("fs", "workerd");
|
|
3352
|
+
};
|
|
3408
3353
|
return {
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
|
|
3419
|
-
|
|
3420
|
-
const [exitCode, stdout, stderr] = await Promise.all([
|
|
3421
|
-
proc.exited,
|
|
3422
|
-
readStream(proc.stdout),
|
|
3423
|
-
readStream(proc.stderr)
|
|
3424
|
-
]);
|
|
3425
|
-
return {
|
|
3426
|
-
success: exitCode === 0,
|
|
3427
|
-
code: exitCode,
|
|
3428
|
-
stdout,
|
|
3429
|
-
stderr
|
|
3430
|
-
};
|
|
3431
|
-
},
|
|
3432
|
-
async exec(cmd, args = [], options) {
|
|
3433
|
-
const result = await this.spawn(cmd, args, options);
|
|
3434
|
-
if (!result.success) {
|
|
3435
|
-
const stderr = new TextDecoder().decode(result.stderr);
|
|
3436
|
-
throw new ProcessError(cmd, result.code, stderr);
|
|
3437
|
-
}
|
|
3438
|
-
return new TextDecoder().decode(result.stdout).trim();
|
|
3439
|
-
},
|
|
3440
|
-
async execJson(cmd, args = [], options) {
|
|
3441
|
-
const output = await this.exec(cmd, args, options);
|
|
3442
|
-
return JSON.parse(output);
|
|
3354
|
+
readFile: throwNotAvailable,
|
|
3355
|
+
readTextFile: throwNotAvailable,
|
|
3356
|
+
writeFile: throwNotAvailable,
|
|
3357
|
+
writeTextFile: throwNotAvailable,
|
|
3358
|
+
exists: throwNotAvailable,
|
|
3359
|
+
stat: throwNotAvailable,
|
|
3360
|
+
lstat: throwNotAvailable,
|
|
3361
|
+
mkdir: throwNotAvailable,
|
|
3362
|
+
remove: throwNotAvailable,
|
|
3363
|
+
readDir: () => {
|
|
3364
|
+
throw new RuntimeCapabilityError("fs", "workerd");
|
|
3443
3365
|
},
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
pid: proc.pid,
|
|
3462
|
-
stdin: proc.stdin,
|
|
3463
|
-
stdout: proc.stdout,
|
|
3464
|
-
stderr: proc.stderr,
|
|
3465
|
-
status: statusPromise,
|
|
3466
|
-
output: async () => {
|
|
3467
|
-
const [status, stdout, stderr] = await Promise.all([
|
|
3468
|
-
statusPromise,
|
|
3469
|
-
readStream(proc.stdout),
|
|
3470
|
-
readStream(proc.stderr)
|
|
3471
|
-
]);
|
|
3472
|
-
return {
|
|
3473
|
-
success: status.success,
|
|
3474
|
-
code: status.code,
|
|
3475
|
-
stdout,
|
|
3476
|
-
stderr
|
|
3477
|
-
};
|
|
3478
|
-
},
|
|
3479
|
-
kill: (signal) => {
|
|
3480
|
-
proc.kill(signal);
|
|
3481
|
-
}
|
|
3482
|
-
};
|
|
3483
|
-
}
|
|
3366
|
+
copyFile: throwNotAvailable,
|
|
3367
|
+
rename: throwNotAvailable,
|
|
3368
|
+
makeTempDir: throwNotAvailable
|
|
3369
|
+
};
|
|
3370
|
+
};
|
|
3371
|
+
createWorkerdPath = () => {
|
|
3372
|
+
return posixPath;
|
|
3373
|
+
};
|
|
3374
|
+
createWorkerdExec = () => {
|
|
3375
|
+
const throwNotAvailable = () => {
|
|
3376
|
+
throw new RuntimeCapabilityError("exec", "workerd");
|
|
3377
|
+
};
|
|
3378
|
+
return {
|
|
3379
|
+
spawn: throwNotAvailable,
|
|
3380
|
+
exec: throwNotAvailable,
|
|
3381
|
+
execJson: throwNotAvailable,
|
|
3382
|
+
spawnChild: throwNotAvailable
|
|
3484
3383
|
};
|
|
3485
3384
|
};
|
|
3486
|
-
|
|
3385
|
+
envStorage = /* @__PURE__ */ new Map();
|
|
3386
|
+
createWorkerdEnv = () => {
|
|
3487
3387
|
return {
|
|
3488
3388
|
get(key) {
|
|
3489
|
-
return
|
|
3389
|
+
return envStorage.get(key);
|
|
3490
3390
|
},
|
|
3491
3391
|
set(key, value2) {
|
|
3492
|
-
|
|
3392
|
+
envStorage.set(key, value2);
|
|
3493
3393
|
},
|
|
3494
3394
|
delete(key) {
|
|
3495
|
-
delete
|
|
3395
|
+
envStorage.delete(key);
|
|
3496
3396
|
},
|
|
3497
3397
|
has(key) {
|
|
3498
|
-
return key
|
|
3398
|
+
return envStorage.has(key);
|
|
3499
3399
|
},
|
|
3500
3400
|
toObject() {
|
|
3501
|
-
|
|
3502
|
-
for (const [key, value2] of Object.entries(nodeProcess2.env)) {
|
|
3503
|
-
if (value2 !== void 0) {
|
|
3504
|
-
result[key] = value2;
|
|
3505
|
-
}
|
|
3506
|
-
}
|
|
3507
|
-
return result;
|
|
3401
|
+
return Object.fromEntries(envStorage);
|
|
3508
3402
|
}
|
|
3509
3403
|
};
|
|
3510
3404
|
};
|
|
3511
|
-
|
|
3405
|
+
populateEnvFromContext = (env) => {
|
|
3406
|
+
for (const [key, value2] of Object.entries(env)) {
|
|
3407
|
+
if (value2 !== null && value2 !== void 0 && value2.constructor === String) {
|
|
3408
|
+
envStorage.set(key, value2);
|
|
3409
|
+
}
|
|
3410
|
+
}
|
|
3411
|
+
};
|
|
3412
|
+
clearEnv = () => {
|
|
3413
|
+
envStorage.clear();
|
|
3414
|
+
};
|
|
3415
|
+
createWorkerdProcess = () => {
|
|
3416
|
+
const throwNotAvailable = () => {
|
|
3417
|
+
throw new RuntimeCapabilityError("process", "workerd");
|
|
3418
|
+
};
|
|
3512
3419
|
return {
|
|
3513
|
-
exit
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3420
|
+
exit: throwNotAvailable,
|
|
3421
|
+
cwd: throwNotAvailable,
|
|
3422
|
+
chdir: throwNotAvailable,
|
|
3423
|
+
hostname: throwNotAvailable,
|
|
3424
|
+
execPath: throwNotAvailable,
|
|
3425
|
+
get args() {
|
|
3426
|
+
throw new RuntimeCapabilityError("process", "workerd");
|
|
3518
3427
|
},
|
|
3519
|
-
|
|
3520
|
-
|
|
3428
|
+
get pid() {
|
|
3429
|
+
throw new RuntimeCapabilityError("process", "workerd");
|
|
3521
3430
|
},
|
|
3522
|
-
|
|
3523
|
-
|
|
3431
|
+
get stdin() {
|
|
3432
|
+
throw new RuntimeCapabilityError("process", "workerd");
|
|
3524
3433
|
},
|
|
3525
|
-
|
|
3526
|
-
|
|
3434
|
+
get stdout() {
|
|
3435
|
+
throw new RuntimeCapabilityError("process", "workerd");
|
|
3527
3436
|
},
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
stdout: Writable2.toWeb(nodeProcess2.stdout),
|
|
3532
|
-
stderr: Writable2.toWeb(nodeProcess2.stderr)
|
|
3437
|
+
get stderr() {
|
|
3438
|
+
throw new RuntimeCapabilityError("process", "workerd");
|
|
3439
|
+
}
|
|
3533
3440
|
};
|
|
3534
3441
|
};
|
|
3535
|
-
|
|
3536
|
-
const fs =
|
|
3537
|
-
const path =
|
|
3538
|
-
const exec2 =
|
|
3539
|
-
const env =
|
|
3540
|
-
const process =
|
|
3442
|
+
createWorkerdRuntime = () => {
|
|
3443
|
+
const fs = createWorkerdFs();
|
|
3444
|
+
const path = createWorkerdPath();
|
|
3445
|
+
const exec2 = createWorkerdExec();
|
|
3446
|
+
const env = createWorkerdEnv();
|
|
3447
|
+
const process = createWorkerdProcess();
|
|
3541
3448
|
return {
|
|
3542
|
-
name: "
|
|
3543
|
-
version:
|
|
3544
|
-
capabilities:
|
|
3449
|
+
name: "workerd",
|
|
3450
|
+
version: "unknown",
|
|
3451
|
+
capabilities: WORKERD_CAPABILITIES,
|
|
3545
3452
|
fs,
|
|
3546
3453
|
path,
|
|
3547
3454
|
exec: exec2,
|
|
@@ -3552,6 +3459,103 @@ var init_bun = __esm({
|
|
|
3552
3459
|
}
|
|
3553
3460
|
});
|
|
3554
3461
|
|
|
3462
|
+
// pkg/@eser/standards/runtime/capabilities.ts
|
|
3463
|
+
var FULL_CAPABILITIES, BROWSER_CAPABILITIES, UNKNOWN_CAPABILITIES, getCapabilities, hasCapability;
|
|
3464
|
+
var init_capabilities = __esm({
|
|
3465
|
+
"pkg/@eser/standards/runtime/capabilities.ts"() {
|
|
3466
|
+
init_deno();
|
|
3467
|
+
init_node();
|
|
3468
|
+
init_bun();
|
|
3469
|
+
init_workerd();
|
|
3470
|
+
init_deno();
|
|
3471
|
+
init_node();
|
|
3472
|
+
init_bun();
|
|
3473
|
+
init_workerd();
|
|
3474
|
+
FULL_CAPABILITIES = {
|
|
3475
|
+
fs: true,
|
|
3476
|
+
fsSync: true,
|
|
3477
|
+
exec: true,
|
|
3478
|
+
process: true,
|
|
3479
|
+
env: true,
|
|
3480
|
+
stdin: true,
|
|
3481
|
+
stdout: true,
|
|
3482
|
+
kv: false
|
|
3483
|
+
};
|
|
3484
|
+
BROWSER_CAPABILITIES = {
|
|
3485
|
+
fs: false,
|
|
3486
|
+
fsSync: false,
|
|
3487
|
+
exec: false,
|
|
3488
|
+
process: false,
|
|
3489
|
+
env: false,
|
|
3490
|
+
stdin: false,
|
|
3491
|
+
stdout: false,
|
|
3492
|
+
kv: false
|
|
3493
|
+
};
|
|
3494
|
+
UNKNOWN_CAPABILITIES = {
|
|
3495
|
+
fs: false,
|
|
3496
|
+
fsSync: false,
|
|
3497
|
+
exec: false,
|
|
3498
|
+
process: false,
|
|
3499
|
+
env: false,
|
|
3500
|
+
stdin: false,
|
|
3501
|
+
stdout: false,
|
|
3502
|
+
kv: false
|
|
3503
|
+
};
|
|
3504
|
+
getCapabilities = (runtime2) => {
|
|
3505
|
+
switch (runtime2) {
|
|
3506
|
+
case "deno":
|
|
3507
|
+
return DENO_CAPABILITIES;
|
|
3508
|
+
case "node":
|
|
3509
|
+
return NODE_CAPABILITIES;
|
|
3510
|
+
case "bun":
|
|
3511
|
+
return BUN_CAPABILITIES;
|
|
3512
|
+
case "workerd":
|
|
3513
|
+
return WORKERD_CAPABILITIES;
|
|
3514
|
+
case "browser":
|
|
3515
|
+
return BROWSER_CAPABILITIES;
|
|
3516
|
+
default:
|
|
3517
|
+
return UNKNOWN_CAPABILITIES;
|
|
3518
|
+
}
|
|
3519
|
+
};
|
|
3520
|
+
hasCapability = (runtime2, capability) => {
|
|
3521
|
+
return getCapabilities(runtime2)[capability];
|
|
3522
|
+
};
|
|
3523
|
+
}
|
|
3524
|
+
});
|
|
3525
|
+
|
|
3526
|
+
// pkg/@eser/standards/runtime/file-search.ts
|
|
3527
|
+
var searchFileHierarchy;
|
|
3528
|
+
var init_file_search = __esm({
|
|
3529
|
+
"pkg/@eser/standards/runtime/file-search.ts"() {
|
|
3530
|
+
init_mod2();
|
|
3531
|
+
searchFileHierarchy = async (startDir, filenames, options = {}) => {
|
|
3532
|
+
const { searchParents = false } = options;
|
|
3533
|
+
let dir = startDir;
|
|
3534
|
+
while (true) {
|
|
3535
|
+
for (const name of filenames) {
|
|
3536
|
+
const filepath = runtime.path.join(dir, name);
|
|
3537
|
+
const exists = await runtime.fs.exists(filepath);
|
|
3538
|
+
if (exists) {
|
|
3539
|
+
const stat3 = await runtime.fs.stat(filepath);
|
|
3540
|
+
if (stat3.isFile) {
|
|
3541
|
+
return filepath;
|
|
3542
|
+
}
|
|
3543
|
+
}
|
|
3544
|
+
}
|
|
3545
|
+
if (!searchParents) {
|
|
3546
|
+
break;
|
|
3547
|
+
}
|
|
3548
|
+
const parent = runtime.path.dirname(dir);
|
|
3549
|
+
if (parent === dir) {
|
|
3550
|
+
break;
|
|
3551
|
+
}
|
|
3552
|
+
dir = parent;
|
|
3553
|
+
}
|
|
3554
|
+
return void 0;
|
|
3555
|
+
};
|
|
3556
|
+
}
|
|
3557
|
+
});
|
|
3558
|
+
|
|
3555
3559
|
// pkg/@eser/standards/runtime/mod.ts
|
|
3556
3560
|
var mod_exports2 = {};
|
|
3557
3561
|
__export(mod_exports2, {
|
|
@@ -3589,7 +3593,7 @@ __export(mod_exports2, {
|
|
|
3589
3593
|
runtime: () => runtime,
|
|
3590
3594
|
searchFileHierarchy: () => searchFileHierarchy
|
|
3591
3595
|
});
|
|
3592
|
-
var createMinimalRuntime, createRuntime, runtime;
|
|
3596
|
+
var createThrowFn, createStubFs, createStubExec, createStubProcess, createStubEnv, createMinimalRuntime, runtimeFactories, overrideKeys, hasOverrides, mergeRuntime, createRuntime, runtime;
|
|
3593
3597
|
var init_mod2 = __esm({
|
|
3594
3598
|
"pkg/@eser/standards/runtime/mod.ts"() {
|
|
3595
3599
|
init_types();
|
|
@@ -3607,111 +3611,116 @@ var init_mod2 = __esm({
|
|
|
3607
3611
|
init_node();
|
|
3608
3612
|
init_bun();
|
|
3609
3613
|
init_workerd();
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
throw new RuntimeCapabilityError(
|
|
3614
|
+
createThrowFn = (capability, runtimeName) => {
|
|
3615
|
+
return () => {
|
|
3616
|
+
throw new RuntimeCapabilityError(capability, runtimeName);
|
|
3613
3617
|
};
|
|
3614
|
-
|
|
3615
|
-
|
|
3618
|
+
};
|
|
3619
|
+
createStubFs = (runtimeName) => {
|
|
3620
|
+
const throwFs = createThrowFn("fs", runtimeName);
|
|
3621
|
+
return {
|
|
3622
|
+
readFile: throwFs,
|
|
3623
|
+
readTextFile: throwFs,
|
|
3624
|
+
writeFile: throwFs,
|
|
3625
|
+
writeTextFile: throwFs,
|
|
3626
|
+
exists: throwFs,
|
|
3627
|
+
stat: throwFs,
|
|
3628
|
+
lstat: throwFs,
|
|
3629
|
+
mkdir: throwFs,
|
|
3630
|
+
remove: throwFs,
|
|
3631
|
+
readDir: throwFs,
|
|
3632
|
+
copyFile: throwFs,
|
|
3633
|
+
rename: throwFs,
|
|
3634
|
+
makeTempDir: throwFs
|
|
3616
3635
|
};
|
|
3617
|
-
|
|
3618
|
-
|
|
3636
|
+
};
|
|
3637
|
+
createStubExec = (runtimeName) => {
|
|
3638
|
+
const throwExec = createThrowFn("exec", runtimeName);
|
|
3639
|
+
return {
|
|
3640
|
+
spawn: throwExec,
|
|
3641
|
+
exec: throwExec,
|
|
3642
|
+
execJson: throwExec,
|
|
3643
|
+
spawnChild: throwExec
|
|
3619
3644
|
};
|
|
3645
|
+
};
|
|
3646
|
+
createStubProcess = (runtimeName) => {
|
|
3647
|
+
const throwProcess = createThrowFn("process", runtimeName);
|
|
3620
3648
|
return {
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
|
|
3628
|
-
writeTextFile: throwFs,
|
|
3629
|
-
exists: throwFs,
|
|
3630
|
-
stat: throwFs,
|
|
3631
|
-
lstat: throwFs,
|
|
3632
|
-
mkdir: throwFs,
|
|
3633
|
-
remove: throwFs,
|
|
3634
|
-
readDir: () => {
|
|
3635
|
-
throw new RuntimeCapabilityError("fs", name);
|
|
3636
|
-
},
|
|
3637
|
-
copyFile: throwFs,
|
|
3638
|
-
rename: throwFs,
|
|
3639
|
-
makeTempDir: throwFs
|
|
3649
|
+
exit: throwProcess,
|
|
3650
|
+
cwd: throwProcess,
|
|
3651
|
+
chdir: throwProcess,
|
|
3652
|
+
hostname: throwProcess,
|
|
3653
|
+
execPath: throwProcess,
|
|
3654
|
+
get args() {
|
|
3655
|
+
throw new RuntimeCapabilityError("process", runtimeName);
|
|
3640
3656
|
},
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
spawn: throwExec,
|
|
3644
|
-
exec: throwExec,
|
|
3645
|
-
execJson: throwExec,
|
|
3646
|
-
spawnChild: throwExec
|
|
3657
|
+
get pid() {
|
|
3658
|
+
throw new RuntimeCapabilityError("process", runtimeName);
|
|
3647
3659
|
},
|
|
3648
|
-
|
|
3649
|
-
|
|
3650
|
-
set: () => {
|
|
3651
|
-
},
|
|
3652
|
-
delete: () => {
|
|
3653
|
-
},
|
|
3654
|
-
has: () => false,
|
|
3655
|
-
toObject: () => ({})
|
|
3660
|
+
get stdin() {
|
|
3661
|
+
throw new RuntimeCapabilityError("process", runtimeName);
|
|
3656
3662
|
},
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
|
|
3661
|
-
|
|
3662
|
-
execPath: throwProcess,
|
|
3663
|
-
get args() {
|
|
3664
|
-
throw new RuntimeCapabilityError("process", name);
|
|
3665
|
-
},
|
|
3666
|
-
get pid() {
|
|
3667
|
-
throw new RuntimeCapabilityError("process", name);
|
|
3668
|
-
},
|
|
3669
|
-
get stdin() {
|
|
3670
|
-
throw new RuntimeCapabilityError("process", name);
|
|
3671
|
-
},
|
|
3672
|
-
get stdout() {
|
|
3673
|
-
throw new RuntimeCapabilityError("process", name);
|
|
3674
|
-
},
|
|
3675
|
-
get stderr() {
|
|
3676
|
-
throw new RuntimeCapabilityError("process", name);
|
|
3677
|
-
}
|
|
3663
|
+
get stdout() {
|
|
3664
|
+
throw new RuntimeCapabilityError("process", runtimeName);
|
|
3665
|
+
},
|
|
3666
|
+
get stderr() {
|
|
3667
|
+
throw new RuntimeCapabilityError("process", runtimeName);
|
|
3678
3668
|
}
|
|
3679
3669
|
};
|
|
3680
3670
|
};
|
|
3671
|
+
createStubEnv = () => ({
|
|
3672
|
+
get: () => void 0,
|
|
3673
|
+
set: () => {
|
|
3674
|
+
},
|
|
3675
|
+
delete: () => {
|
|
3676
|
+
},
|
|
3677
|
+
has: () => false,
|
|
3678
|
+
toObject: () => ({})
|
|
3679
|
+
});
|
|
3680
|
+
createMinimalRuntime = (name, capabilities = UNKNOWN_CAPABILITIES) => ({
|
|
3681
|
+
name,
|
|
3682
|
+
version: "unknown",
|
|
3683
|
+
capabilities,
|
|
3684
|
+
fs: createStubFs(name),
|
|
3685
|
+
path: posixPath,
|
|
3686
|
+
exec: createStubExec(name),
|
|
3687
|
+
env: createStubEnv(),
|
|
3688
|
+
process: createStubProcess(name)
|
|
3689
|
+
});
|
|
3690
|
+
runtimeFactories = {
|
|
3691
|
+
deno: createDenoRuntime,
|
|
3692
|
+
node: createNodeRuntime,
|
|
3693
|
+
bun: createBunRuntime,
|
|
3694
|
+
workerd: createWorkerdRuntime
|
|
3695
|
+
};
|
|
3696
|
+
overrideKeys = [
|
|
3697
|
+
"fs",
|
|
3698
|
+
"exec",
|
|
3699
|
+
"env",
|
|
3700
|
+
"path",
|
|
3701
|
+
"process"
|
|
3702
|
+
];
|
|
3703
|
+
hasOverrides = (options) => options !== void 0 && overrideKeys.some((key) => options[key] !== void 0);
|
|
3704
|
+
mergeRuntime = (base, options, capabilities) => ({
|
|
3705
|
+
name: base.name,
|
|
3706
|
+
version: base.version,
|
|
3707
|
+
capabilities,
|
|
3708
|
+
fs: options.fs ?? base.fs,
|
|
3709
|
+
path: options.path ?? base.path,
|
|
3710
|
+
exec: options.exec ?? base.exec,
|
|
3711
|
+
env: options.env ?? base.env,
|
|
3712
|
+
process: options.process ?? base.process
|
|
3713
|
+
});
|
|
3681
3714
|
createRuntime = (options) => {
|
|
3682
3715
|
const runtimeName = detectRuntime();
|
|
3683
3716
|
const capabilities = {
|
|
3684
3717
|
...getCapabilities(runtimeName),
|
|
3685
3718
|
...options?.capabilities
|
|
3686
3719
|
};
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
|
|
3690
|
-
|
|
3691
|
-
break;
|
|
3692
|
-
case "node":
|
|
3693
|
-
baseRuntime = createNodeRuntime();
|
|
3694
|
-
break;
|
|
3695
|
-
case "bun":
|
|
3696
|
-
baseRuntime = createBunRuntime();
|
|
3697
|
-
break;
|
|
3698
|
-
case "workerd":
|
|
3699
|
-
baseRuntime = createWorkerdRuntime();
|
|
3700
|
-
break;
|
|
3701
|
-
default:
|
|
3702
|
-
baseRuntime = createMinimalRuntime(runtimeName, capabilities);
|
|
3703
|
-
}
|
|
3704
|
-
if (options?.fs || options?.exec || options?.env || options?.path || options?.process) {
|
|
3705
|
-
return {
|
|
3706
|
-
name: baseRuntime.name,
|
|
3707
|
-
version: baseRuntime.version,
|
|
3708
|
-
capabilities,
|
|
3709
|
-
fs: options.fs ?? baseRuntime.fs,
|
|
3710
|
-
path: options.path ?? baseRuntime.path,
|
|
3711
|
-
exec: options.exec ?? baseRuntime.exec,
|
|
3712
|
-
env: options.env ?? baseRuntime.env,
|
|
3713
|
-
process: options.process ?? baseRuntime.process
|
|
3714
|
-
};
|
|
3720
|
+
const factory = runtimeFactories[runtimeName];
|
|
3721
|
+
const baseRuntime = factory?.() ?? createMinimalRuntime(runtimeName, capabilities);
|
|
3722
|
+
if (options !== void 0 && hasOverrides(options)) {
|
|
3723
|
+
return mergeRuntime(baseRuntime, options, capabilities);
|
|
3715
3724
|
}
|
|
3716
3725
|
return baseRuntime;
|
|
3717
3726
|
};
|
|
@@ -5872,8 +5881,8 @@ var init_to_path_string = __esm({
|
|
|
5872
5881
|
// deno:https://jsr.io/@std/fs/1.0.21/_create_walk_entry.ts
|
|
5873
5882
|
async function createWalkEntry(path) {
|
|
5874
5883
|
path = toPathString(path);
|
|
5875
|
-
path =
|
|
5876
|
-
const name =
|
|
5884
|
+
path = normalize3(path);
|
|
5885
|
+
const name = basename3(path);
|
|
5877
5886
|
const info = await Deno.stat(path);
|
|
5878
5887
|
return {
|
|
5879
5888
|
path,
|
|
@@ -5920,7 +5929,7 @@ async function* walk(root, options) {
|
|
|
5920
5929
|
return;
|
|
5921
5930
|
}
|
|
5922
5931
|
for await (const entry of Deno.readDir(root)) {
|
|
5923
|
-
let path =
|
|
5932
|
+
let path = join3(root, entry.name);
|
|
5924
5933
|
let { isSymlink, isDirectory } = entry;
|
|
5925
5934
|
if (isSymlink) {
|
|
5926
5935
|
if (!followSymlinks) {
|
|
@@ -7212,7 +7221,7 @@ var init_loader = __esm({
|
|
|
7212
7221
|
}
|
|
7213
7222
|
};
|
|
7214
7223
|
getFileFormat = (filepath) => {
|
|
7215
|
-
const ext =
|
|
7224
|
+
const ext = extname(filepath);
|
|
7216
7225
|
if (ext === ".json") {
|
|
7217
7226
|
return FileFormats.Json;
|
|
7218
7227
|
}
|
|
@@ -7447,7 +7456,7 @@ var init_loader2 = __esm({
|
|
|
7447
7456
|
findConfigFiles = async (baseDir, includeFiles) => {
|
|
7448
7457
|
const results = [];
|
|
7449
7458
|
for (const fileType of includeFiles) {
|
|
7450
|
-
const filepath =
|
|
7459
|
+
const filepath = join(baseDir, fileType);
|
|
7451
7460
|
const loaded = await tryLoadConfigFile(filepath, fileType);
|
|
7452
7461
|
if (loaded) {
|
|
7453
7462
|
results.push(loaded);
|
|
@@ -7507,14 +7516,14 @@ var init_loader2 = __esm({
|
|
|
7507
7516
|
const { baseDir = ".", includeFiles = CONFIG_FILE_PRIORITY, fieldMappings, searchParents = false } = options;
|
|
7508
7517
|
const mergedMappings = mergeFieldMappings(fieldMappings);
|
|
7509
7518
|
const sortedFiles = sortByPriority(includeFiles);
|
|
7510
|
-
let searchDir =
|
|
7519
|
+
let searchDir = resolve(baseDir);
|
|
7511
7520
|
let loadedFiles = [];
|
|
7512
7521
|
while (true) {
|
|
7513
7522
|
loadedFiles = await findConfigFiles(searchDir, sortedFiles);
|
|
7514
7523
|
if (loadedFiles.length > 0 || !searchParents) {
|
|
7515
7524
|
break;
|
|
7516
7525
|
}
|
|
7517
|
-
const parent =
|
|
7526
|
+
const parent = dirname(searchDir);
|
|
7518
7527
|
if (parent === searchDir) {
|
|
7519
7528
|
break;
|
|
7520
7529
|
}
|
|
@@ -7718,7 +7727,7 @@ var init_writer = __esm({
|
|
|
7718
7727
|
function split(path) {
|
|
7719
7728
|
const s = SEPARATOR_PATTERN.source;
|
|
7720
7729
|
const segments = path.replace(new RegExp(`^${s}|${s}$`, "g"), "").split(SEPARATOR_PATTERN);
|
|
7721
|
-
const isAbsolute_ =
|
|
7730
|
+
const isAbsolute_ = isAbsolute3(path);
|
|
7722
7731
|
const split2 = {
|
|
7723
7732
|
segments,
|
|
7724
7733
|
isAbsolute: isAbsolute_,
|
|
@@ -7748,8 +7757,8 @@ async function* expandGlob(glob, options) {
|
|
|
7748
7757
|
globstar,
|
|
7749
7758
|
caseInsensitive
|
|
7750
7759
|
};
|
|
7751
|
-
const absRoot = isGlobAbsolute ? root :
|
|
7752
|
-
const resolveFromRoot = (path) =>
|
|
7760
|
+
const absRoot = isGlobAbsolute ? root : resolve3(root);
|
|
7761
|
+
const resolveFromRoot = (path) => resolve3(absRoot, path);
|
|
7753
7762
|
const excludePatterns = exclude.map(resolveFromRoot).map((s) => globToRegExp3(s, globOptions));
|
|
7754
7763
|
const shouldInclude = (path) => !excludePatterns.some((p) => p.test(path));
|
|
7755
7764
|
let fixedRoot = isGlobAbsolute ? winRoot ?? "/" : absRoot;
|
|
@@ -7872,7 +7881,7 @@ var init_workspace = __esm({
|
|
|
7872
7881
|
});
|
|
7873
7882
|
} catch (e) {
|
|
7874
7883
|
if (e instanceof PackageLoadError) {
|
|
7875
|
-
console.log(`No package config file found in ${
|
|
7884
|
+
console.log(`No package config file found in ${resolve(path)}`);
|
|
7876
7885
|
runtime.process.exit(1);
|
|
7877
7886
|
}
|
|
7878
7887
|
throw e;
|
|
@@ -7881,7 +7890,7 @@ var init_workspace = __esm({
|
|
|
7881
7890
|
expandWorkspacePaths = async (root, patterns) => {
|
|
7882
7891
|
const paths = [];
|
|
7883
7892
|
for (const pattern of patterns) {
|
|
7884
|
-
const fullPattern =
|
|
7893
|
+
const fullPattern = join(root, pattern);
|
|
7885
7894
|
if (pattern.includes("*") || pattern.includes("?")) {
|
|
7886
7895
|
for await (const entry of expandGlob(fullPattern, {
|
|
7887
7896
|
includeDirs: true
|
|
@@ -7990,10 +7999,10 @@ var init_workspace_discovery = __esm({
|
|
|
7990
7999
|
return [];
|
|
7991
8000
|
};
|
|
7992
8001
|
resolveModulePath = (specifier, basePath) => {
|
|
7993
|
-
if (
|
|
8002
|
+
if (isAbsolute(specifier)) {
|
|
7994
8003
|
return specifier;
|
|
7995
8004
|
}
|
|
7996
|
-
return
|
|
8005
|
+
return resolve(basePath, specifier);
|
|
7997
8006
|
};
|
|
7998
8007
|
getPackageFiles = async (packagePath) => {
|
|
7999
8008
|
const files = [];
|
|
@@ -8008,8 +8017,8 @@ var init_workspace_discovery = __esm({
|
|
|
8008
8017
|
/\.git/
|
|
8009
8018
|
]
|
|
8010
8019
|
})) {
|
|
8011
|
-
const relativePath =
|
|
8012
|
-
const fileName =
|
|
8020
|
+
const relativePath = relative(packagePath, entry.path);
|
|
8021
|
+
const fileName = basename(relativePath);
|
|
8013
8022
|
if (fileName.endsWith("_test.ts") || fileName.endsWith("_bench.ts")) {
|
|
8014
8023
|
continue;
|
|
8015
8024
|
}
|
|
@@ -8200,7 +8209,7 @@ var init_check_mod_exports = __esm({
|
|
|
8200
8209
|
const packages = await discoverPackages(root);
|
|
8201
8210
|
const missingExports = [];
|
|
8202
8211
|
for (const pkg of packages) {
|
|
8203
|
-
const modPath =
|
|
8212
|
+
const modPath = join(pkg.path, "mod.ts");
|
|
8204
8213
|
let modContent;
|
|
8205
8214
|
try {
|
|
8206
8215
|
modContent = await runtime.fs.readTextFile(modPath);
|
|
@@ -8213,7 +8222,7 @@ var init_check_mod_exports = __esm({
|
|
|
8213
8222
|
].map((e) => normalizePath(e)));
|
|
8214
8223
|
const files = await getPackageFiles(pkg.path);
|
|
8215
8224
|
for (const file of files) {
|
|
8216
|
-
const fileName =
|
|
8225
|
+
const fileName = basename(file);
|
|
8217
8226
|
if (!shouldBeExported(fileName)) {
|
|
8218
8227
|
continue;
|
|
8219
8228
|
}
|
|
@@ -8299,7 +8308,7 @@ var init_check_export_names = __esm({
|
|
|
8299
8308
|
if (cleanSegment.length === 0) {
|
|
8300
8309
|
continue;
|
|
8301
8310
|
}
|
|
8302
|
-
const ext =
|
|
8311
|
+
const ext = extname(cleanSegment);
|
|
8303
8312
|
if (ext.length > 0) {
|
|
8304
8313
|
cleanSegment = cleanSegment.slice(0, -ext.length);
|
|
8305
8314
|
}
|
|
@@ -8575,7 +8584,7 @@ var init_check_licenses = __esm({
|
|
|
8575
8584
|
validateLicenses = async (options = {}) => {
|
|
8576
8585
|
const { fix = false } = options;
|
|
8577
8586
|
const baseUrl = new URL(".", import.meta.url);
|
|
8578
|
-
const defaultRoot =
|
|
8587
|
+
const defaultRoot = join(fromFileUrl(baseUrl.href), "..");
|
|
8579
8588
|
const root = options.root ?? defaultRoot;
|
|
8580
8589
|
const issues = [];
|
|
8581
8590
|
let checked = 0;
|
|
@@ -9220,27 +9229,18 @@ var buildParseOptions = (flags) => {
|
|
|
9220
9229
|
default: defaultValues
|
|
9221
9230
|
};
|
|
9222
9231
|
};
|
|
9232
|
+
var isString = (value2) => value2 !== null && value2 !== void 0 && value2.constructor === String;
|
|
9233
|
+
var coercers = {
|
|
9234
|
+
boolean: (value2) => Boolean(value2),
|
|
9235
|
+
number: (value2) => isString(value2) ? Number(value2) : value2,
|
|
9236
|
+
string: (value2) => String(value2),
|
|
9237
|
+
"string[]": (value2) => Array.isArray(value2) ? value2.map(String) : [
|
|
9238
|
+
String(value2)
|
|
9239
|
+
]
|
|
9240
|
+
};
|
|
9223
9241
|
var coerceValue = (value2, type) => {
|
|
9224
|
-
if (value2 === void 0)
|
|
9225
|
-
|
|
9226
|
-
}
|
|
9227
|
-
switch (type) {
|
|
9228
|
-
case "boolean":
|
|
9229
|
-
return Boolean(value2);
|
|
9230
|
-
case "number":
|
|
9231
|
-
return typeof value2 === "string" ? Number(value2) : value2;
|
|
9232
|
-
case "string":
|
|
9233
|
-
return String(value2);
|
|
9234
|
-
case "string[]":
|
|
9235
|
-
if (Array.isArray(value2)) {
|
|
9236
|
-
return value2.map(String);
|
|
9237
|
-
}
|
|
9238
|
-
return value2 !== void 0 ? [
|
|
9239
|
-
String(value2)
|
|
9240
|
-
] : [];
|
|
9241
|
-
default:
|
|
9242
|
-
return value2;
|
|
9243
|
-
}
|
|
9242
|
+
if (value2 === void 0) return void 0;
|
|
9243
|
+
return coercers[type]?.(value2) ?? value2;
|
|
9244
9244
|
};
|
|
9245
9245
|
var extractFlags = (parsed, flags) => {
|
|
9246
9246
|
const result = {};
|
|
@@ -9264,75 +9264,80 @@ var validateRequiredFlags = (flags, definitions) => {
|
|
|
9264
9264
|
};
|
|
9265
9265
|
|
|
9266
9266
|
// pkg/@eser/shell/args/help.ts
|
|
9267
|
-
var padRight = (str2, len) =>
|
|
9268
|
-
return str2 + " ".repeat(Math.max(0, len - str2.length));
|
|
9269
|
-
};
|
|
9267
|
+
var padRight = (str2, len) => str2 + " ".repeat(Math.max(0, len - str2.length));
|
|
9270
9268
|
var formatFlag = (flag) => {
|
|
9271
|
-
|
|
9272
|
-
|
|
9273
|
-
|
|
9274
|
-
|
|
9275
|
-
|
|
9276
|
-
|
|
9269
|
+
const short = flag.short !== void 0 ? `-${flag.short}, ` : "";
|
|
9270
|
+
const typeSuffix = flag.type !== "boolean" ? ` <${flag.type}>` : "";
|
|
9271
|
+
return `${short}--${flag.name}${typeSuffix}`;
|
|
9272
|
+
};
|
|
9273
|
+
var generateTitle = (meta, fullName) => {
|
|
9274
|
+
const title = meta.description !== void 0 ? `${fullName} - ${meta.description}` : fullName;
|
|
9275
|
+
return [
|
|
9276
|
+
title,
|
|
9277
|
+
""
|
|
9278
|
+
];
|
|
9279
|
+
};
|
|
9280
|
+
var generateUsage = (meta, fullName) => {
|
|
9281
|
+
if (meta.usage !== void 0) {
|
|
9282
|
+
return [
|
|
9283
|
+
"Usage:",
|
|
9284
|
+
` ${meta.usage}`,
|
|
9285
|
+
""
|
|
9286
|
+
];
|
|
9277
9287
|
}
|
|
9278
|
-
|
|
9288
|
+
const commands2 = meta.children.length > 0 ? " <command>" : "";
|
|
9289
|
+
const options = meta.flags.length > 0 ? " [options]" : "";
|
|
9290
|
+
return [
|
|
9291
|
+
"Usage:",
|
|
9292
|
+
` ${fullName}${commands2}${options}`,
|
|
9293
|
+
""
|
|
9294
|
+
];
|
|
9295
|
+
};
|
|
9296
|
+
var generateCommands = (children) => {
|
|
9297
|
+
if (children.length === 0) return [];
|
|
9298
|
+
const maxLen = Math.max(...children.map((c) => c.name.length));
|
|
9299
|
+
const lines = children.map((c) => ` ${padRight(c.name, maxLen + 2)}${c.description ?? ""}`);
|
|
9300
|
+
return [
|
|
9301
|
+
"Commands:",
|
|
9302
|
+
...lines,
|
|
9303
|
+
""
|
|
9304
|
+
];
|
|
9305
|
+
};
|
|
9306
|
+
var generateOptions = (flags) => {
|
|
9307
|
+
if (flags.length === 0) return [];
|
|
9308
|
+
const formatted = flags.map((f) => ({
|
|
9309
|
+
flag: formatFlag(f),
|
|
9310
|
+
desc: f.description
|
|
9311
|
+
}));
|
|
9312
|
+
const maxLen = Math.max(...formatted.map((f) => f.flag.length));
|
|
9313
|
+
const lines = formatted.map(({ flag, desc }) => ` ${padRight(flag, maxLen + 2)}${desc}`);
|
|
9314
|
+
return [
|
|
9315
|
+
"Options:",
|
|
9316
|
+
...lines,
|
|
9317
|
+
""
|
|
9318
|
+
];
|
|
9319
|
+
};
|
|
9320
|
+
var generateExamples = (examples) => {
|
|
9321
|
+
if (!examples?.length) return [];
|
|
9322
|
+
return [
|
|
9323
|
+
"Examples:",
|
|
9324
|
+
...examples.map((e) => ` ${e}`),
|
|
9325
|
+
""
|
|
9326
|
+
];
|
|
9279
9327
|
};
|
|
9280
9328
|
var generateHelp = (meta, commandPath) => {
|
|
9281
|
-
const lines = [];
|
|
9282
9329
|
const fullName = commandPath.join(" ");
|
|
9283
|
-
|
|
9284
|
-
|
|
9285
|
-
|
|
9286
|
-
|
|
9287
|
-
|
|
9288
|
-
|
|
9289
|
-
|
|
9290
|
-
lines.push("Usage:");
|
|
9291
|
-
lines.push(` ${meta.usage}`);
|
|
9292
|
-
} else {
|
|
9293
|
-
let usage = fullName;
|
|
9294
|
-
if (meta.children.length > 0) {
|
|
9295
|
-
usage += " <command>";
|
|
9296
|
-
}
|
|
9297
|
-
if (meta.flags.length > 0) {
|
|
9298
|
-
usage += " [options]";
|
|
9299
|
-
}
|
|
9300
|
-
lines.push("Usage:");
|
|
9301
|
-
lines.push(` ${usage}`);
|
|
9302
|
-
}
|
|
9303
|
-
lines.push("");
|
|
9304
|
-
if (meta.children.length > 0) {
|
|
9305
|
-
lines.push("Commands:");
|
|
9306
|
-
const maxLen = Math.max(...meta.children.map((c) => c.name.length));
|
|
9307
|
-
for (const child of meta.children) {
|
|
9308
|
-
const desc = child.description ?? "";
|
|
9309
|
-
lines.push(` ${padRight(child.name, maxLen + 2)}${desc}`);
|
|
9310
|
-
}
|
|
9311
|
-
lines.push("");
|
|
9312
|
-
}
|
|
9313
|
-
if (meta.flags.length > 0) {
|
|
9314
|
-
lines.push("Options:");
|
|
9315
|
-
const formatted = meta.flags.map((f) => ({
|
|
9316
|
-
flag: formatFlag(f),
|
|
9317
|
-
desc: f.description
|
|
9318
|
-
}));
|
|
9319
|
-
const maxLen = Math.max(...formatted.map((f) => f.flag.length));
|
|
9320
|
-
for (const { flag, desc } of formatted) {
|
|
9321
|
-
lines.push(` ${padRight(flag, maxLen + 2)}${desc}`);
|
|
9322
|
-
}
|
|
9323
|
-
lines.push("");
|
|
9324
|
-
}
|
|
9325
|
-
if (meta.examples !== void 0 && meta.examples.length > 0) {
|
|
9326
|
-
lines.push("Examples:");
|
|
9327
|
-
for (const example of meta.examples) {
|
|
9328
|
-
lines.push(` ${example}`);
|
|
9329
|
-
}
|
|
9330
|
-
lines.push("");
|
|
9331
|
-
}
|
|
9330
|
+
const sections = [
|
|
9331
|
+
...generateTitle(meta, fullName),
|
|
9332
|
+
...generateUsage(meta, fullName),
|
|
9333
|
+
...generateCommands(meta.children),
|
|
9334
|
+
...generateOptions(meta.flags),
|
|
9335
|
+
...generateExamples(meta.examples)
|
|
9336
|
+
];
|
|
9332
9337
|
if (meta.children.length > 0) {
|
|
9333
|
-
|
|
9338
|
+
sections.push(`Run '${fullName} <command> --help' for more information on a command.`);
|
|
9334
9339
|
}
|
|
9335
|
-
return
|
|
9340
|
+
return sections.join("\n");
|
|
9336
9341
|
};
|
|
9337
9342
|
|
|
9338
9343
|
// pkg/@eser/shell/completions/generators/bash.ts
|
|
@@ -9938,7 +9943,7 @@ var CONFIG_FILENAMES = [
|
|
|
9938
9943
|
];
|
|
9939
9944
|
var loadProjectConfig = async (dir) => {
|
|
9940
9945
|
for (const filename of CONFIG_FILENAMES) {
|
|
9941
|
-
const filepath =
|
|
9946
|
+
const filepath = join3(dir, filename);
|
|
9942
9947
|
try {
|
|
9943
9948
|
const content = await runtime.fs.readTextFile(filepath);
|
|
9944
9949
|
const config = parse7(content);
|
|
@@ -10990,12 +10995,12 @@ var UntarStream = class {
|
|
|
10990
10995
|
init_mod();
|
|
10991
10996
|
var extractTarball = async (stream, targetDir, options = {}) => {
|
|
10992
10997
|
const { stripComponents = 0, subpath } = options;
|
|
10993
|
-
const normalizedSubpath = subpath !== void 0 ?
|
|
10998
|
+
const normalizedSubpath = subpath !== void 0 ? normalize3(subpath).replace(/^\/+/, "") : void 0;
|
|
10994
10999
|
const decompressed = stream.pipeThrough(new DecompressionStream("gzip"));
|
|
10995
11000
|
const untarStream = decompressed.pipeThrough(new UntarStream());
|
|
10996
11001
|
for await (const entry of untarStream) {
|
|
10997
|
-
const entryPath =
|
|
10998
|
-
if (entryPath.startsWith("..") ||
|
|
11002
|
+
const entryPath = normalize3(entry.path);
|
|
11003
|
+
if (entryPath.startsWith("..") || isAbsolute3(entryPath)) {
|
|
10999
11004
|
if (entry.readable !== void 0) {
|
|
11000
11005
|
await entry.readable.cancel();
|
|
11001
11006
|
}
|
|
@@ -11025,8 +11030,8 @@ var extractTarball = async (stream, targetDir, options = {}) => {
|
|
|
11025
11030
|
continue;
|
|
11026
11031
|
}
|
|
11027
11032
|
}
|
|
11028
|
-
const outputPath = normalizedSubpath !== void 0 ?
|
|
11029
|
-
await ensureDir(
|
|
11033
|
+
const outputPath = normalizedSubpath !== void 0 ? join3(targetDir, strippedPath.slice(normalizedSubpath.length).replace(/^\/+/, "")) : join3(targetDir, strippedPath);
|
|
11034
|
+
await ensureDir(dirname3(outputPath));
|
|
11030
11035
|
if (entry.readable !== void 0) {
|
|
11031
11036
|
const file = await Deno.create(outputPath);
|
|
11032
11037
|
await entry.readable.pipeTo(file.writable);
|
|
@@ -11149,7 +11154,7 @@ var CONFIG_FILENAMES2 = [
|
|
|
11149
11154
|
];
|
|
11150
11155
|
var loadTemplateConfig = async (dir) => {
|
|
11151
11156
|
for (const filename of CONFIG_FILENAMES2) {
|
|
11152
|
-
const filepath =
|
|
11157
|
+
const filepath = join3(dir, filename);
|
|
11153
11158
|
try {
|
|
11154
11159
|
const content = await runtime.fs.readTextFile(filepath);
|
|
11155
11160
|
const config = parse7(content);
|
|
@@ -11231,7 +11236,7 @@ ${errors.join("\n")}`);
|
|
|
11231
11236
|
};
|
|
11232
11237
|
var getConfigFilePath = async (dir) => {
|
|
11233
11238
|
for (const filename of CONFIG_FILENAMES2) {
|
|
11234
|
-
const filepath =
|
|
11239
|
+
const filepath = join3(dir, filename);
|
|
11235
11240
|
try {
|
|
11236
11241
|
await runtime.fs.stat(filepath);
|
|
11237
11242
|
return filepath;
|
|
@@ -11284,7 +11289,7 @@ var BINARY_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
|
11284
11289
|
".webm"
|
|
11285
11290
|
]);
|
|
11286
11291
|
var isBinaryFile = (filepath) => {
|
|
11287
|
-
const ext =
|
|
11292
|
+
const ext = extname3(filepath).toLowerCase();
|
|
11288
11293
|
return BINARY_EXTENSIONS.has(ext);
|
|
11289
11294
|
};
|
|
11290
11295
|
var shouldIgnore = (relativePath, ignorePatterns) => {
|
|
@@ -11327,7 +11332,7 @@ var processTemplate = async (dir, options) => {
|
|
|
11327
11332
|
for await (const entry of walk(dir, {
|
|
11328
11333
|
includeDirs: true
|
|
11329
11334
|
})) {
|
|
11330
|
-
const relativePath =
|
|
11335
|
+
const relativePath = relative3(dir, entry.path);
|
|
11331
11336
|
if (relativePath === "") {
|
|
11332
11337
|
continue;
|
|
11333
11338
|
}
|
|
@@ -11343,8 +11348,8 @@ var processTemplate = async (dir, options) => {
|
|
|
11343
11348
|
}
|
|
11344
11349
|
}
|
|
11345
11350
|
for (const filepath of filesToProcess) {
|
|
11346
|
-
const filename =
|
|
11347
|
-
const dirPath =
|
|
11351
|
+
const filename = basename3(filepath);
|
|
11352
|
+
const dirPath = dirname3(filepath);
|
|
11348
11353
|
if (!isBinaryFile(filepath)) {
|
|
11349
11354
|
try {
|
|
11350
11355
|
const content = await runtime.fs.readTextFile(filepath);
|
|
@@ -11360,7 +11365,7 @@ var processTemplate = async (dir, options) => {
|
|
|
11360
11365
|
}
|
|
11361
11366
|
if (hasVariables(filename)) {
|
|
11362
11367
|
const newFilename = substituteVariables(filename, variables);
|
|
11363
|
-
const newPath =
|
|
11368
|
+
const newPath = join3(dirPath, newFilename);
|
|
11364
11369
|
if (newPath !== filepath) {
|
|
11365
11370
|
await Deno.rename(filepath, newPath);
|
|
11366
11371
|
}
|
|
@@ -11368,10 +11373,10 @@ var processTemplate = async (dir, options) => {
|
|
|
11368
11373
|
}
|
|
11369
11374
|
dirsToRename.sort((a, b) => b.split(SEPARATOR).length - a.split(SEPARATOR).length);
|
|
11370
11375
|
for (const dirPath of dirsToRename) {
|
|
11371
|
-
const dirname7 =
|
|
11372
|
-
const parentDir =
|
|
11376
|
+
const dirname7 = basename3(dirPath);
|
|
11377
|
+
const parentDir = dirname3(dirPath);
|
|
11373
11378
|
const newDirname = substituteVariables(dirname7, variables);
|
|
11374
|
-
const newPath =
|
|
11379
|
+
const newPath = join3(parentDir, newDirname);
|
|
11375
11380
|
if (newPath !== dirPath) {
|
|
11376
11381
|
await Deno.rename(dirPath, newPath);
|
|
11377
11382
|
}
|
|
@@ -11390,7 +11395,7 @@ var removeConfigFile = async (filepath) => {
|
|
|
11390
11395
|
// pkg/@eser/codebase/scaffolding/scaffold.ts
|
|
11391
11396
|
var scaffold = async (options) => {
|
|
11392
11397
|
const { specifier, targetDir, variables: providedVariables = {}, force = false, skipPostInstall = false, interactive = false } = options;
|
|
11393
|
-
const absoluteTargetDir =
|
|
11398
|
+
const absoluteTargetDir = isAbsolute3(targetDir) ? targetDir : join3(runtime.process.cwd(), targetDir);
|
|
11394
11399
|
try {
|
|
11395
11400
|
const entries = [];
|
|
11396
11401
|
for await (const entry of Deno.readDir(absoluteTargetDir)) {
|
|
@@ -11798,22 +11803,22 @@ var getRcFilePath = (shell) => {
|
|
|
11798
11803
|
const home = getHomeDir();
|
|
11799
11804
|
switch (shell) {
|
|
11800
11805
|
case "zsh":
|
|
11801
|
-
return
|
|
11806
|
+
return join3(home, ".zshrc");
|
|
11802
11807
|
case "bash":
|
|
11803
|
-
return
|
|
11808
|
+
return join3(home, ".bashrc");
|
|
11804
11809
|
case "fish":
|
|
11805
|
-
return
|
|
11810
|
+
return join3(home, ".config", "fish", "config.fish");
|
|
11806
11811
|
}
|
|
11807
11812
|
};
|
|
11808
11813
|
var getCompletionsFilePath = (shell, appName) => {
|
|
11809
11814
|
const home = getHomeDir();
|
|
11810
11815
|
switch (shell) {
|
|
11811
11816
|
case "zsh":
|
|
11812
|
-
return
|
|
11817
|
+
return join3(home, ".zshrc");
|
|
11813
11818
|
case "bash":
|
|
11814
|
-
return
|
|
11819
|
+
return join3(home, ".bashrc");
|
|
11815
11820
|
case "fish":
|
|
11816
|
-
return
|
|
11821
|
+
return join3(home, ".config", "fish", "completions", `${appName}.fish`);
|
|
11817
11822
|
}
|
|
11818
11823
|
};
|
|
11819
11824
|
var getCompletionEvalLine = (shell, appName) => {
|
|
@@ -11871,7 +11876,7 @@ var addCompletions = async (shell) => {
|
|
|
11871
11876
|
try {
|
|
11872
11877
|
if (config.completionType === "file") {
|
|
11873
11878
|
const fishPath = config.completionsFile;
|
|
11874
|
-
const dir =
|
|
11879
|
+
const dir = dirname3(fishPath);
|
|
11875
11880
|
try {
|
|
11876
11881
|
await runtime2.fs.mkdir(dir, {
|
|
11877
11882
|
recursive: true
|
|
@@ -12183,7 +12188,7 @@ var systemCommand = new Command("system").description("Commands related with thi
|
|
|
12183
12188
|
// pkg/@eser/cli/package.json
|
|
12184
12189
|
var package_default = {
|
|
12185
12190
|
name: "@eser/cli",
|
|
12186
|
-
version: "4.0.
|
|
12191
|
+
version: "4.0.8",
|
|
12187
12192
|
type: "module",
|
|
12188
12193
|
exports: "./main.ts",
|
|
12189
12194
|
bin: {
|