@volter/tabnode 0.5.20 → 0.5.21
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.
|
@@ -8246,20 +8246,30 @@ function descriptorWriter(fd2) {
|
|
|
8246
8246
|
if (!file || file.directory || (file.flags & 3) === 0) return null;
|
|
8247
8247
|
const { tree: tree2, path: path2 } = file;
|
|
8248
8248
|
const append = (file.flags & flagBits().append) !== 0;
|
|
8249
|
-
let
|
|
8249
|
+
let cursor = descriptorCursors.get(file);
|
|
8250
|
+
if (!cursor) {
|
|
8251
|
+
cursor = { position: file.position };
|
|
8252
|
+
descriptorCursors.set(file, cursor);
|
|
8253
|
+
}
|
|
8254
|
+
const offset2 = cursor;
|
|
8250
8255
|
return (text) => {
|
|
8251
8256
|
const bytes2 = new TextEncoder().encode(text);
|
|
8252
8257
|
const shared = openFiles.get(fd2) === file ? file : null;
|
|
8258
|
+
if (shared) offset2.position = shared.position;
|
|
8253
8259
|
const existing = (shared == null ? void 0 : shared.cached) ?? (tree2.existsSync(path2) ? tree2.readFileSync(path2) : new Uint8Array(0));
|
|
8254
|
-
const at3 = append ? existing.length : position;
|
|
8260
|
+
const at3 = append ? existing.length : offset2.position;
|
|
8255
8261
|
const next2 = new Uint8Array(Math.max(existing.length, at3 + bytes2.length));
|
|
8256
8262
|
next2.set(existing, 0);
|
|
8257
8263
|
next2.set(bytes2, at3);
|
|
8258
8264
|
tree2.writeFileSync(path2, next2);
|
|
8259
|
-
position = at3 + bytes2.length;
|
|
8260
|
-
if (shared)
|
|
8265
|
+
offset2.position = at3 + bytes2.length;
|
|
8266
|
+
if (shared) {
|
|
8267
|
+
shared.cached = next2;
|
|
8268
|
+
shared.position = offset2.position;
|
|
8269
|
+
}
|
|
8261
8270
|
};
|
|
8262
8271
|
}
|
|
8272
|
+
const descriptorCursors = /* @__PURE__ */ new WeakMap();
|
|
8263
8273
|
function statArray(stats, bigint, path2) {
|
|
8264
8274
|
var _a3, _b3, _c3;
|
|
8265
8275
|
const mtime = stats.mtime instanceof Date ? stats.mtime.getTime() : Number(stats.mtimeMs ?? 0);
|
|
@@ -74566,8 +74576,15 @@ async function handleNpmInstall(args, ctx) {
|
|
|
74566
74576
|
}
|
|
74567
74577
|
}
|
|
74568
74578
|
async function handleNpmInit(args, ctx) {
|
|
74579
|
+
var _a3;
|
|
74569
74580
|
const yes = args.includes("-y") || args.includes("--yes");
|
|
74570
|
-
const
|
|
74581
|
+
const takesValue = (flag) => !flag.includes("=") && (flag === "--scope" || flag === "-w" || flag === "--workspace" || flag.startsWith("--init-"));
|
|
74582
|
+
const valueOf = (flag) => {
|
|
74583
|
+
const at3 = args.findIndex((a) => a === flag || a.startsWith(`${flag}=`));
|
|
74584
|
+
if (at3 < 0) return void 0;
|
|
74585
|
+
return args[at3].includes("=") ? args[at3].slice(args[at3].indexOf("=") + 1) : args[at3 + 1];
|
|
74586
|
+
};
|
|
74587
|
+
const initializer = args.find((a, i10) => !a.startsWith("-") && !(i10 > 0 && takesValue(args[i10 - 1])));
|
|
74571
74588
|
if (initializer) {
|
|
74572
74589
|
return { stdout: "", stderr: `npm ERR! npm init ${initializer} runs an initializer package, which this engine's npm does not; write package.json, or run \`npm init -y\`.
|
|
74573
74590
|
`, exitCode: 1 };
|
|
@@ -74587,7 +74604,9 @@ async function handleNpmInit(args, ctx) {
|
|
|
74587
74604
|
}
|
|
74588
74605
|
}
|
|
74589
74606
|
const base = ctx.cwd.split("/").filter(Boolean).pop() ?? "package";
|
|
74590
|
-
const
|
|
74607
|
+
const bare = base.toLowerCase().replace(/^[._]+/, "").replace(/[^a-z0-9._~-]+/g, "-") || "package";
|
|
74608
|
+
const scope = (_a3 = valueOf("--scope")) == null ? void 0 : _a3.replace(/^@?/, "@");
|
|
74609
|
+
const name = scope ? `${scope}/${bare}` : bare;
|
|
74591
74610
|
const manifest = {
|
|
74592
74611
|
name,
|
|
74593
74612
|
version: "1.0.0",
|
package/dist/index.mjs
CHANGED
|
@@ -8402,20 +8402,30 @@ function descriptorWriter(fd) {
|
|
|
8402
8402
|
if (!file || file.directory || (file.flags & 3) === 0) return null;
|
|
8403
8403
|
const { tree: tree2, path: path2 } = file;
|
|
8404
8404
|
const append = (file.flags & flagBits().append) !== 0;
|
|
8405
|
-
let
|
|
8405
|
+
let cursor = descriptorCursors.get(file);
|
|
8406
|
+
if (!cursor) {
|
|
8407
|
+
cursor = { position: file.position };
|
|
8408
|
+
descriptorCursors.set(file, cursor);
|
|
8409
|
+
}
|
|
8410
|
+
const offset2 = cursor;
|
|
8406
8411
|
return (text) => {
|
|
8407
8412
|
const bytes2 = new TextEncoder().encode(text);
|
|
8408
8413
|
const shared = openFiles.get(fd) === file ? file : null;
|
|
8414
|
+
if (shared) offset2.position = shared.position;
|
|
8409
8415
|
const existing = (shared == null ? void 0 : shared.cached) ?? (tree2.existsSync(path2) ? tree2.readFileSync(path2) : new Uint8Array(0));
|
|
8410
|
-
const at2 = append ? existing.length : position;
|
|
8416
|
+
const at2 = append ? existing.length : offset2.position;
|
|
8411
8417
|
const next = new Uint8Array(Math.max(existing.length, at2 + bytes2.length));
|
|
8412
8418
|
next.set(existing, 0);
|
|
8413
8419
|
next.set(bytes2, at2);
|
|
8414
8420
|
tree2.writeFileSync(path2, next);
|
|
8415
|
-
position = at2 + bytes2.length;
|
|
8416
|
-
if (shared)
|
|
8421
|
+
offset2.position = at2 + bytes2.length;
|
|
8422
|
+
if (shared) {
|
|
8423
|
+
shared.cached = next;
|
|
8424
|
+
shared.position = offset2.position;
|
|
8425
|
+
}
|
|
8417
8426
|
};
|
|
8418
8427
|
}
|
|
8428
|
+
const descriptorCursors = /* @__PURE__ */ new WeakMap();
|
|
8419
8429
|
function statArray(stats, bigint, path2) {
|
|
8420
8430
|
var _a2, _b2, _c2;
|
|
8421
8431
|
const mtime = stats.mtime instanceof Date ? stats.mtime.getTime() : Number(stats.mtimeMs ?? 0);
|
|
@@ -21312,17 +21322,10 @@ var implementation$1 = function bind2(that) {
|
|
|
21312
21322
|
var implementation = implementation$1;
|
|
21313
21323
|
var functionBind = Function.prototype.bind || implementation;
|
|
21314
21324
|
var functionCall = Function.prototype.call;
|
|
21315
|
-
var functionApply;
|
|
21316
|
-
var hasRequiredFunctionApply;
|
|
21317
|
-
function requireFunctionApply() {
|
|
21318
|
-
if (hasRequiredFunctionApply) return functionApply;
|
|
21319
|
-
hasRequiredFunctionApply = 1;
|
|
21320
|
-
functionApply = Function.prototype.apply;
|
|
21321
|
-
return functionApply;
|
|
21322
|
-
}
|
|
21325
|
+
var functionApply = Function.prototype.apply;
|
|
21323
21326
|
var reflectApply = typeof Reflect !== "undefined" && Reflect && Reflect.apply;
|
|
21324
21327
|
var bind$2 = functionBind;
|
|
21325
|
-
var $apply$1 =
|
|
21328
|
+
var $apply$1 = functionApply;
|
|
21326
21329
|
var $call$2 = functionCall;
|
|
21327
21330
|
var $reflectApply = reflectApply;
|
|
21328
21331
|
var actualApply = $reflectApply || bind$2.call($call$2, $apply$1);
|
|
@@ -21442,7 +21445,7 @@ var hasSymbols = requireHasSymbols()();
|
|
|
21442
21445
|
var getProto = requireGetProto();
|
|
21443
21446
|
var $ObjectGPO = requireObject_getPrototypeOf();
|
|
21444
21447
|
var $ReflectGPO = requireReflect_getPrototypeOf();
|
|
21445
|
-
var $apply =
|
|
21448
|
+
var $apply = functionApply;
|
|
21446
21449
|
var $call = functionCall;
|
|
21447
21450
|
var needsEval = {};
|
|
21448
21451
|
var TypedArray = typeof Uint8Array === "undefined" || !getProto ? undefined$1 : getProto(Uint8Array);
|
|
@@ -22083,7 +22086,7 @@ function requireApplyBind() {
|
|
|
22083
22086
|
if (hasRequiredApplyBind) return applyBind;
|
|
22084
22087
|
hasRequiredApplyBind = 1;
|
|
22085
22088
|
var bind3 = functionBind;
|
|
22086
|
-
var $apply2 =
|
|
22089
|
+
var $apply2 = functionApply;
|
|
22087
22090
|
var actualApply$1 = actualApply;
|
|
22088
22091
|
applyBind = function applyBind2() {
|
|
22089
22092
|
return actualApply$1(bind3, $apply2, arguments);
|
|
@@ -34229,8 +34232,15 @@ async function handleNpmInstall(args, ctx) {
|
|
|
34229
34232
|
}
|
|
34230
34233
|
}
|
|
34231
34234
|
async function handleNpmInit(args, ctx) {
|
|
34235
|
+
var _a2;
|
|
34232
34236
|
const yes = args.includes("-y") || args.includes("--yes");
|
|
34233
|
-
const
|
|
34237
|
+
const takesValue = (flag) => !flag.includes("=") && (flag === "--scope" || flag === "-w" || flag === "--workspace" || flag.startsWith("--init-"));
|
|
34238
|
+
const valueOf = (flag) => {
|
|
34239
|
+
const at2 = args.findIndex((a) => a === flag || a.startsWith(`${flag}=`));
|
|
34240
|
+
if (at2 < 0) return void 0;
|
|
34241
|
+
return args[at2].includes("=") ? args[at2].slice(args[at2].indexOf("=") + 1) : args[at2 + 1];
|
|
34242
|
+
};
|
|
34243
|
+
const initializer = args.find((a, i2) => !a.startsWith("-") && !(i2 > 0 && takesValue(args[i2 - 1])));
|
|
34234
34244
|
if (initializer) {
|
|
34235
34245
|
return { stdout: "", stderr: `npm ERR! npm init ${initializer} runs an initializer package, which this engine's npm does not; write package.json, or run \`npm init -y\`.
|
|
34236
34246
|
`, exitCode: 1 };
|
|
@@ -34250,7 +34260,9 @@ async function handleNpmInit(args, ctx) {
|
|
|
34250
34260
|
}
|
|
34251
34261
|
}
|
|
34252
34262
|
const base = ctx.cwd.split("/").filter(Boolean).pop() ?? "package";
|
|
34253
|
-
const
|
|
34263
|
+
const bare = base.toLowerCase().replace(/^[._]+/, "").replace(/[^a-z0-9._~-]+/g, "-") || "package";
|
|
34264
|
+
const scope = (_a2 = valueOf("--scope")) == null ? void 0 : _a2.replace(/^@?/, "@");
|
|
34265
|
+
const name = scope ? `${scope}/${bare}` : bare;
|
|
34254
34266
|
const manifest = {
|
|
34255
34267
|
name,
|
|
34256
34268
|
version: "1.0.0",
|
|
@@ -39827,7 +39839,7 @@ class WorkerRuntime {
|
|
|
39827
39839
|
this.worker = new Worker(
|
|
39828
39840
|
new URL(
|
|
39829
39841
|
/* @vite-ignore */
|
|
39830
|
-
"/assets/runtime-worker-
|
|
39842
|
+
"/assets/runtime-worker-XRE6n_4W.js",
|
|
39831
39843
|
import.meta.url
|
|
39832
39844
|
),
|
|
39833
39845
|
{ type: "module" }
|
package/package.json
CHANGED
|
@@ -186,21 +186,28 @@ export function descriptorWriter(fd: number): ((text: string) => void) | null {
|
|
|
186
186
|
if (!file || file.directory || (file.flags & 3) === 0) return null;
|
|
187
187
|
const { tree, path } = file;
|
|
188
188
|
const append = (file.flags & flagBits().append) !== 0;
|
|
189
|
-
|
|
189
|
+
// One offset per open file, as a dup'd descriptor shares one: a child's
|
|
190
|
+
// stdout and stderr on the same file follow each other, and the parent's
|
|
191
|
+
// own position moves with them while its copy is open.
|
|
192
|
+
let cursor = descriptorCursors.get(file);
|
|
193
|
+
if (!cursor) { cursor = { position: file.position }; descriptorCursors.set(file, cursor); }
|
|
194
|
+
const offset = cursor;
|
|
190
195
|
return (text) => {
|
|
191
196
|
const bytes = new TextEncoder().encode(text);
|
|
192
197
|
// the parent's copy, while it is open, holds the file's bytes as it last wrote them
|
|
193
198
|
const shared = openFiles.get(fd) === file ? file : null;
|
|
199
|
+
if (shared) offset.position = shared.position;
|
|
194
200
|
const existing = shared?.cached ?? (tree.existsSync(path) ? tree.readFileSync(path) as Uint8Array : new Uint8Array(0));
|
|
195
|
-
const at = append ? existing.length : position;
|
|
201
|
+
const at = append ? existing.length : offset.position;
|
|
196
202
|
const next = new Uint8Array(Math.max(existing.length, at + bytes.length));
|
|
197
203
|
next.set(existing, 0);
|
|
198
204
|
next.set(bytes, at);
|
|
199
205
|
tree.writeFileSync(path, next);
|
|
200
|
-
position = at + bytes.length;
|
|
201
|
-
if (shared) shared.cached = next;
|
|
206
|
+
offset.position = at + bytes.length;
|
|
207
|
+
if (shared) { shared.cached = next; shared.position = offset.position; }
|
|
202
208
|
};
|
|
203
209
|
}
|
|
210
|
+
const descriptorCursors = new WeakMap<object, { position: number }>();
|
|
204
211
|
|
|
205
212
|
/** Node's stat array: eighteen numbers, with each time a second and a nanosecond. */
|
|
206
213
|
function statArray(stats: VfsStats, bigint: boolean, path?: string): Float64Array | BigInt64Array {
|
|
@@ -1308,7 +1308,14 @@ async function handleNpmInstall(args: string[], ctx: CommandContext): Promise<Ju
|
|
|
1308
1308
|
*/
|
|
1309
1309
|
async function handleNpmInit(args: string[], ctx: CommandContext): Promise<JustBashExecResult> {
|
|
1310
1310
|
const yes = args.includes('-y') || args.includes('--yes');
|
|
1311
|
-
|
|
1311
|
+
// a flag's value is not an initializer: `--scope @x`, `-w pkg`, `--init-license MIT`
|
|
1312
|
+
const takesValue = (flag: string) => !flag.includes('=') && (flag === '--scope' || flag === '-w' || flag === '--workspace' || flag.startsWith('--init-'));
|
|
1313
|
+
const valueOf = (flag: string) => {
|
|
1314
|
+
const at = args.findIndex((a) => a === flag || a.startsWith(`${flag}=`));
|
|
1315
|
+
if (at < 0) return undefined;
|
|
1316
|
+
return args[at].includes('=') ? args[at].slice(args[at].indexOf('=') + 1) : args[at + 1];
|
|
1317
|
+
};
|
|
1318
|
+
const initializer = args.find((a, i) => !a.startsWith('-') && !(i > 0 && takesValue(args[i - 1]!)));
|
|
1312
1319
|
if (initializer) {
|
|
1313
1320
|
return { stdout: '', stderr: `npm ERR! npm init ${initializer} runs an initializer package, which this engine's npm does not; write package.json, or run \`npm init -y\`.\n`, exitCode: 1 };
|
|
1314
1321
|
}
|
|
@@ -1323,7 +1330,9 @@ async function handleNpmInit(args: string[], ctx: CommandContext): Promise<JustB
|
|
|
1323
1330
|
catch { return { stdout: '', stderr: `npm ERR! ${file} is not valid JSON\n`, exitCode: 1 }; }
|
|
1324
1331
|
}
|
|
1325
1332
|
const base = ctx.cwd.split('/').filter(Boolean).pop() ?? 'package';
|
|
1326
|
-
const
|
|
1333
|
+
const bare = base.toLowerCase().replace(/^[._]+/, '').replace(/[^a-z0-9._~-]+/g, '-') || 'package';
|
|
1334
|
+
const scope = valueOf('--scope')?.replace(/^@?/, '@');
|
|
1335
|
+
const name = scope ? `${scope}/${bare}` : bare;
|
|
1327
1336
|
const manifest = {
|
|
1328
1337
|
name,
|
|
1329
1338
|
version: '1.0.0',
|