@volter/tabnode 0.5.41 → 0.5.42
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.
|
@@ -21171,10 +21171,17 @@ var implementation$1 = function bind2(that) {
|
|
|
21171
21171
|
var implementation = implementation$1;
|
|
21172
21172
|
var functionBind = Function.prototype.bind || implementation;
|
|
21173
21173
|
var functionCall = Function.prototype.call;
|
|
21174
|
-
var functionApply
|
|
21174
|
+
var functionApply;
|
|
21175
|
+
var hasRequiredFunctionApply;
|
|
21176
|
+
function requireFunctionApply() {
|
|
21177
|
+
if (hasRequiredFunctionApply) return functionApply;
|
|
21178
|
+
hasRequiredFunctionApply = 1;
|
|
21179
|
+
functionApply = Function.prototype.apply;
|
|
21180
|
+
return functionApply;
|
|
21181
|
+
}
|
|
21175
21182
|
var reflectApply = typeof Reflect !== "undefined" && Reflect && Reflect.apply;
|
|
21176
21183
|
var bind$2 = functionBind;
|
|
21177
|
-
var $apply$1 =
|
|
21184
|
+
var $apply$1 = requireFunctionApply();
|
|
21178
21185
|
var $call$2 = functionCall;
|
|
21179
21186
|
var $reflectApply = reflectApply;
|
|
21180
21187
|
var actualApply = $reflectApply || bind$2.call($call$2, $apply$1);
|
|
@@ -21294,7 +21301,7 @@ var hasSymbols = requireHasSymbols()();
|
|
|
21294
21301
|
var getProto = requireGetProto();
|
|
21295
21302
|
var $ObjectGPO = requireObject_getPrototypeOf();
|
|
21296
21303
|
var $ReflectGPO = requireReflect_getPrototypeOf();
|
|
21297
|
-
var $apply =
|
|
21304
|
+
var $apply = requireFunctionApply();
|
|
21298
21305
|
var $call = functionCall;
|
|
21299
21306
|
var needsEval = {};
|
|
21300
21307
|
var TypedArray = typeof Uint8Array === "undefined" || !getProto ? undefined$1 : getProto(Uint8Array);
|
|
@@ -21935,7 +21942,7 @@ function requireApplyBind() {
|
|
|
21935
21942
|
if (hasRequiredApplyBind) return applyBind;
|
|
21936
21943
|
hasRequiredApplyBind = 1;
|
|
21937
21944
|
var bind3 = functionBind;
|
|
21938
|
-
var $apply2 =
|
|
21945
|
+
var $apply2 = requireFunctionApply();
|
|
21939
21946
|
var actualApply$1 = actualApply;
|
|
21940
21947
|
applyBind = function applyBind2() {
|
|
21941
21948
|
return actualApply$1(bind3, $apply2, arguments);
|
|
@@ -78606,6 +78613,10 @@ function __substrateFollowAwaits(code2) {
|
|
|
78606
78613
|
const insert = (at3, text) => {
|
|
78607
78614
|
edits.push([at3, at3, text]);
|
|
78608
78615
|
};
|
|
78616
|
+
const closings = [];
|
|
78617
|
+
const close2 = (at3, text) => {
|
|
78618
|
+
closings.push([at3, at3, text]);
|
|
78619
|
+
};
|
|
78609
78620
|
const isFunction = (node) => node.type === "FunctionDeclaration" || node.type === "FunctionExpression" || node.type === "ArrowFunctionExpression";
|
|
78610
78621
|
const visit = (node, framed, parent) => {
|
|
78611
78622
|
const leading = [];
|
|
@@ -78617,7 +78628,7 @@ function __substrateFollowAwaits(code2) {
|
|
|
78617
78628
|
}
|
|
78618
78629
|
} else if (node.type === "AwaitExpression") {
|
|
78619
78630
|
insert(node.start, framed ? FOLLOW_RESUME_FRAMED : FOLLOW_RESUME_TAKEN);
|
|
78620
|
-
|
|
78631
|
+
close2(node.end, `${FOLLOW_MARK})`);
|
|
78621
78632
|
} else if (framed && node.type === "CatchClause") {
|
|
78622
78633
|
leading.push([node.body.start + 1, FOLLOW_RESTORE]);
|
|
78623
78634
|
} else if (framed && node.type === "TryStatement" && node.finalizer) {
|
|
@@ -78625,11 +78636,11 @@ function __substrateFollowAwaits(code2) {
|
|
|
78625
78636
|
} else if (framed && node.type === "ForOfStatement" && node.await) {
|
|
78626
78637
|
const whole = (parent == null ? void 0 : parent.type) === "LabeledStatement" ? parent : node;
|
|
78627
78638
|
insert(whole.start, `{${FOLLOW_MARK}`);
|
|
78628
|
-
|
|
78639
|
+
close2(whole.end, `;${FOLLOW_RESTORE}${FOLLOW_MARK}}`);
|
|
78629
78640
|
if (node.body.type === "BlockStatement") leading.push([node.body.start + 1, FOLLOW_RESTORE]);
|
|
78630
78641
|
else {
|
|
78631
78642
|
leading.push([node.body.start, `{${FOLLOW_MARK}${FOLLOW_RESTORE}`]);
|
|
78632
|
-
|
|
78643
|
+
close2(node.body.end, `${FOLLOW_MARK}}`);
|
|
78633
78644
|
}
|
|
78634
78645
|
}
|
|
78635
78646
|
for (const key of Object.keys(node)) {
|
|
@@ -78643,7 +78654,7 @@ function __substrateFollowAwaits(code2) {
|
|
|
78643
78654
|
for (const [at3, text] of leading) insert(at3, text);
|
|
78644
78655
|
};
|
|
78645
78656
|
visit(ast, false, void 0);
|
|
78646
|
-
const followed = edits.length ? applyReplacements(code2, edits) : code2;
|
|
78657
|
+
const followed = edits.length || closings.length ? applyReplacements(code2, [...edits, ...closings]) : code2;
|
|
78647
78658
|
return __substrateTopLevelAwait(ast) ? `${followed}
|
|
78648
78659
|
${__substrateTopLevelAwaitMarker}` : followed;
|
|
78649
78660
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -21319,10 +21319,17 @@ var implementation$1 = function bind2(that) {
|
|
|
21319
21319
|
var implementation = implementation$1;
|
|
21320
21320
|
var functionBind = Function.prototype.bind || implementation;
|
|
21321
21321
|
var functionCall = Function.prototype.call;
|
|
21322
|
-
var functionApply
|
|
21322
|
+
var functionApply;
|
|
21323
|
+
var hasRequiredFunctionApply;
|
|
21324
|
+
function requireFunctionApply() {
|
|
21325
|
+
if (hasRequiredFunctionApply) return functionApply;
|
|
21326
|
+
hasRequiredFunctionApply = 1;
|
|
21327
|
+
functionApply = Function.prototype.apply;
|
|
21328
|
+
return functionApply;
|
|
21329
|
+
}
|
|
21323
21330
|
var reflectApply = typeof Reflect !== "undefined" && Reflect && Reflect.apply;
|
|
21324
21331
|
var bind$2 = functionBind;
|
|
21325
|
-
var $apply$1 =
|
|
21332
|
+
var $apply$1 = requireFunctionApply();
|
|
21326
21333
|
var $call$2 = functionCall;
|
|
21327
21334
|
var $reflectApply = reflectApply;
|
|
21328
21335
|
var actualApply = $reflectApply || bind$2.call($call$2, $apply$1);
|
|
@@ -21442,7 +21449,7 @@ var hasSymbols = requireHasSymbols()();
|
|
|
21442
21449
|
var getProto = requireGetProto();
|
|
21443
21450
|
var $ObjectGPO = requireObject_getPrototypeOf();
|
|
21444
21451
|
var $ReflectGPO = requireReflect_getPrototypeOf();
|
|
21445
|
-
var $apply =
|
|
21452
|
+
var $apply = requireFunctionApply();
|
|
21446
21453
|
var $call = functionCall;
|
|
21447
21454
|
var needsEval = {};
|
|
21448
21455
|
var TypedArray = typeof Uint8Array === "undefined" || !getProto ? undefined$1 : getProto(Uint8Array);
|
|
@@ -22083,7 +22090,7 @@ function requireApplyBind() {
|
|
|
22083
22090
|
if (hasRequiredApplyBind) return applyBind;
|
|
22084
22091
|
hasRequiredApplyBind = 1;
|
|
22085
22092
|
var bind3 = functionBind;
|
|
22086
|
-
var $apply2 =
|
|
22093
|
+
var $apply2 = requireFunctionApply();
|
|
22087
22094
|
var actualApply$1 = actualApply;
|
|
22088
22095
|
applyBind = function applyBind2() {
|
|
22089
22096
|
return actualApply$1(bind3, $apply2, arguments);
|
|
@@ -38264,6 +38271,10 @@ function __substrateFollowAwaits(code2) {
|
|
|
38264
38271
|
const insert = (at2, text) => {
|
|
38265
38272
|
edits.push([at2, at2, text]);
|
|
38266
38273
|
};
|
|
38274
|
+
const closings = [];
|
|
38275
|
+
const close2 = (at2, text) => {
|
|
38276
|
+
closings.push([at2, at2, text]);
|
|
38277
|
+
};
|
|
38267
38278
|
const isFunction = (node) => node.type === "FunctionDeclaration" || node.type === "FunctionExpression" || node.type === "ArrowFunctionExpression";
|
|
38268
38279
|
const visit = (node, framed, parent) => {
|
|
38269
38280
|
const leading = [];
|
|
@@ -38275,7 +38286,7 @@ function __substrateFollowAwaits(code2) {
|
|
|
38275
38286
|
}
|
|
38276
38287
|
} else if (node.type === "AwaitExpression") {
|
|
38277
38288
|
insert(node.start, framed ? FOLLOW_RESUME_FRAMED : FOLLOW_RESUME_TAKEN);
|
|
38278
|
-
|
|
38289
|
+
close2(node.end, `${FOLLOW_MARK})`);
|
|
38279
38290
|
} else if (framed && node.type === "CatchClause") {
|
|
38280
38291
|
leading.push([node.body.start + 1, FOLLOW_RESTORE]);
|
|
38281
38292
|
} else if (framed && node.type === "TryStatement" && node.finalizer) {
|
|
@@ -38283,11 +38294,11 @@ function __substrateFollowAwaits(code2) {
|
|
|
38283
38294
|
} else if (framed && node.type === "ForOfStatement" && node.await) {
|
|
38284
38295
|
const whole = (parent == null ? void 0 : parent.type) === "LabeledStatement" ? parent : node;
|
|
38285
38296
|
insert(whole.start, `{${FOLLOW_MARK}`);
|
|
38286
|
-
|
|
38297
|
+
close2(whole.end, `;${FOLLOW_RESTORE}${FOLLOW_MARK}}`);
|
|
38287
38298
|
if (node.body.type === "BlockStatement") leading.push([node.body.start + 1, FOLLOW_RESTORE]);
|
|
38288
38299
|
else {
|
|
38289
38300
|
leading.push([node.body.start, `{${FOLLOW_MARK}${FOLLOW_RESTORE}`]);
|
|
38290
|
-
|
|
38301
|
+
close2(node.body.end, `${FOLLOW_MARK}}`);
|
|
38291
38302
|
}
|
|
38292
38303
|
}
|
|
38293
38304
|
for (const key of Object.keys(node)) {
|
|
@@ -38301,7 +38312,7 @@ function __substrateFollowAwaits(code2) {
|
|
|
38301
38312
|
for (const [at2, text] of leading) insert(at2, text);
|
|
38302
38313
|
};
|
|
38303
38314
|
visit(ast, false, void 0);
|
|
38304
|
-
const followed = edits.length ? applyReplacements(code2, edits) : code2;
|
|
38315
|
+
const followed = edits.length || closings.length ? applyReplacements(code2, [...edits, ...closings]) : code2;
|
|
38305
38316
|
return __substrateTopLevelAwait(ast) ? `${followed}
|
|
38306
38317
|
${__substrateTopLevelAwaitMarker}` : followed;
|
|
38307
38318
|
}
|
|
@@ -40327,7 +40338,7 @@ class WorkerRuntime {
|
|
|
40327
40338
|
this.worker = new Worker(
|
|
40328
40339
|
new URL(
|
|
40329
40340
|
/* @vite-ignore */
|
|
40330
|
-
"/assets/runtime-worker-
|
|
40341
|
+
"/assets/runtime-worker-BBHch2BO.js",
|
|
40331
40342
|
import.meta.url
|
|
40332
40343
|
),
|
|
40333
40344
|
{ type: "module" }
|
package/package.json
CHANGED
package/src/runtime.ts
CHANGED
|
@@ -465,6 +465,12 @@ function __substrateFollowAwaits(code: string): string {
|
|
|
465
465
|
}
|
|
466
466
|
const edits: Array<[number, number, string]> = [];
|
|
467
467
|
const insert = (at: number, text: string): void => { edits.push([at, at, text]); };
|
|
468
|
+
// What closes a node goes before what opens the next one at the same offset: a node that ends where another starts
|
|
469
|
+
// never holds it, so its closing lands first. `for await(x of y)await a;await b` ends the loop's body and starts the
|
|
470
|
+
// next statement's `await` at one offset, and the resume opened there landed inside the loop's brace: a SyntaxError
|
|
471
|
+
// in a 7 MB server chunk of Dub's (its web-stream pipe). Closings are kept apart and applied after, so they land first.
|
|
472
|
+
const closings: Array<[number, number, string]> = [];
|
|
473
|
+
const close = (at: number, text: string): void => { closings.push([at, at, text]); };
|
|
468
474
|
const isFunction = (node: any): boolean => node.type === 'FunctionDeclaration' || node.type === 'FunctionExpression' || node.type === 'ArrowFunctionExpression';
|
|
469
475
|
// `framed`: the nearest function is async and holds the frame in ASYNC_FRAME.
|
|
470
476
|
const visit = (node: any, framed: boolean, parent: any): void => {
|
|
@@ -484,7 +490,7 @@ function __substrateFollowAwaits(code: string): string {
|
|
|
484
490
|
}
|
|
485
491
|
} else if (node.type === 'AwaitExpression') {
|
|
486
492
|
insert(node.start, framed ? FOLLOW_RESUME_FRAMED : FOLLOW_RESUME_TAKEN);
|
|
487
|
-
|
|
493
|
+
close(node.end, `${FOLLOW_MARK})`);
|
|
488
494
|
} else if (framed && node.type === 'CatchClause') {
|
|
489
495
|
leading.push([node.body.start + 1, FOLLOW_RESTORE]);
|
|
490
496
|
} else if (framed && node.type === 'TryStatement' && node.finalizer) {
|
|
@@ -494,9 +500,9 @@ function __substrateFollowAwaits(code: string): string {
|
|
|
494
500
|
// made later lands before it, so the body's brace closes inside.
|
|
495
501
|
const whole = parent?.type === 'LabeledStatement' ? parent : node;
|
|
496
502
|
insert(whole.start, `{${FOLLOW_MARK}`);
|
|
497
|
-
|
|
503
|
+
close(whole.end, `;${FOLLOW_RESTORE}${FOLLOW_MARK}}`);
|
|
498
504
|
if (node.body.type === 'BlockStatement') leading.push([node.body.start + 1, FOLLOW_RESTORE]);
|
|
499
|
-
else { leading.push([node.body.start, `{${FOLLOW_MARK}${FOLLOW_RESTORE}`]);
|
|
505
|
+
else { leading.push([node.body.start, `{${FOLLOW_MARK}${FOLLOW_RESTORE}`]); close(node.body.end, `${FOLLOW_MARK}}`); }
|
|
500
506
|
}
|
|
501
507
|
for (const key of Object.keys(node)) {
|
|
502
508
|
if (key === 'type' || key === 'start' || key === 'end' || key === 'loc' || key === 'range') continue;
|
|
@@ -509,7 +515,8 @@ function __substrateFollowAwaits(code: string): string {
|
|
|
509
515
|
for (const [at, text] of leading) insert(at, text);
|
|
510
516
|
};
|
|
511
517
|
visit(ast, false, undefined);
|
|
512
|
-
|
|
518
|
+
// applyReplacements' sort is stable and lands edits at one offset in reverse of their order: closings after openings
|
|
519
|
+
const followed = edits.length || closings.length ? applyReplacements(code, [...edits, ...closings]) : code;
|
|
513
520
|
return __substrateTopLevelAwait(ast) ? `${followed}\n${__substrateTopLevelAwaitMarker}` : followed;
|
|
514
521
|
}
|
|
515
522
|
|