sval 0.6.6 → 0.6.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/dist/src/index.d.ts +1 -1
- package/dist/sval.js +85 -85
- package/dist/sval.min.js +1 -1
- package/dist/sval.umd.cjs +3 -3
- package/package.json +4 -5
package/dist/src/index.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ declare class Sval {
|
|
|
11
11
|
exports: Record<string, any>;
|
|
12
12
|
constructor(options?: SvalOptions);
|
|
13
13
|
import(nameOrModules: string | Record<string, any>, mod?: any): void;
|
|
14
|
-
parse(code: string, parser?: (code: string, options:
|
|
14
|
+
parse(code: string, parser?: (code: string, options: Options) => Node): Node;
|
|
15
15
|
run(code: string | Node): void;
|
|
16
16
|
}
|
|
17
17
|
export default Sval;
|
package/dist/sval.js
CHANGED
|
@@ -253,7 +253,7 @@ function kr(e) {
|
|
|
253
253
|
}
|
|
254
254
|
return e;
|
|
255
255
|
}
|
|
256
|
-
const
|
|
256
|
+
const j = Object.assign || kr;
|
|
257
257
|
let Ge = [], p = Se(null);
|
|
258
258
|
const qe = (e) => {
|
|
259
259
|
if (!e.Object) throw 0;
|
|
@@ -535,7 +535,7 @@ for (let e = 0; e < Ge.length; e++) {
|
|
|
535
535
|
}
|
|
536
536
|
const Te = R("window");
|
|
537
537
|
function Er() {
|
|
538
|
-
return
|
|
538
|
+
return j(Se({ [Te]: p }), zt);
|
|
539
539
|
}
|
|
540
540
|
function R(e) {
|
|
541
541
|
return e + Math.random().toString(36).substring(2);
|
|
@@ -587,16 +587,16 @@ var w = function(t, r) {
|
|
|
587
587
|
function q(e, t) {
|
|
588
588
|
return new w(e, { beforeExpr: !0, binop: t });
|
|
589
589
|
}
|
|
590
|
-
var W = { beforeExpr: !0 },
|
|
590
|
+
var W = { beforeExpr: !0 }, O = { startsExpr: !0 }, vt = {};
|
|
591
591
|
function S(e, t) {
|
|
592
592
|
return t === void 0 && (t = {}), t.keyword = e, vt[e] = new w(e, t);
|
|
593
593
|
}
|
|
594
594
|
var o = {
|
|
595
|
-
num: new w("num",
|
|
596
|
-
regexp: new w("regexp",
|
|
597
|
-
string: new w("string",
|
|
598
|
-
name: new w("name",
|
|
599
|
-
privateId: new w("privateId",
|
|
595
|
+
num: new w("num", O),
|
|
596
|
+
regexp: new w("regexp", O),
|
|
597
|
+
string: new w("string", O),
|
|
598
|
+
name: new w("name", O),
|
|
599
|
+
privateId: new w("privateId", O),
|
|
600
600
|
eof: new w("eof"),
|
|
601
601
|
// Punctuation token types.
|
|
602
602
|
bracketL: new w("[", { beforeExpr: !0, startsExpr: !0 }),
|
|
@@ -615,7 +615,7 @@ var o = {
|
|
|
615
615
|
template: new w("template"),
|
|
616
616
|
invalidTemplate: new w("invalidTemplate"),
|
|
617
617
|
ellipsis: new w("...", W),
|
|
618
|
-
backQuote: new w("`",
|
|
618
|
+
backQuote: new w("`", O),
|
|
619
619
|
dollarBraceL: new w("${", { beforeExpr: !0, startsExpr: !0 }),
|
|
620
620
|
// Operators. These carry several kinds of properties to help the
|
|
621
621
|
// parser use them properly (the presence of these properties is
|
|
@@ -659,7 +659,7 @@ var o = {
|
|
|
659
659
|
_else: S("else", W),
|
|
660
660
|
_finally: S("finally"),
|
|
661
661
|
_for: S("for", { isLoop: !0 }),
|
|
662
|
-
_function: S("function",
|
|
662
|
+
_function: S("function", O),
|
|
663
663
|
_if: S("if"),
|
|
664
664
|
_return: S("return", W),
|
|
665
665
|
_switch: S("switch"),
|
|
@@ -670,15 +670,15 @@ var o = {
|
|
|
670
670
|
_while: S("while", { isLoop: !0 }),
|
|
671
671
|
_with: S("with"),
|
|
672
672
|
_new: S("new", { beforeExpr: !0, startsExpr: !0 }),
|
|
673
|
-
_this: S("this",
|
|
674
|
-
_super: S("super",
|
|
675
|
-
_class: S("class",
|
|
673
|
+
_this: S("this", O),
|
|
674
|
+
_super: S("super", O),
|
|
675
|
+
_class: S("class", O),
|
|
676
676
|
_extends: S("extends", W),
|
|
677
677
|
_export: S("export"),
|
|
678
|
-
_import: S("import",
|
|
679
|
-
_null: S("null",
|
|
680
|
-
_true: S("true",
|
|
681
|
-
_false: S("false",
|
|
678
|
+
_import: S("import", O),
|
|
679
|
+
_null: S("null", O),
|
|
680
|
+
_true: S("true", O),
|
|
681
|
+
_false: S("false", O),
|
|
682
682
|
_in: S("in", { beforeExpr: !0, binop: 7 }),
|
|
683
683
|
_instanceof: S("instanceof", { beforeExpr: !0, binop: 7 }),
|
|
684
684
|
_typeof: S("typeof", { beforeExpr: !0, prefix: !0, startsExpr: !0 }),
|
|
@@ -919,8 +919,8 @@ V.tokenizer = function(t, r) {
|
|
|
919
919
|
return new this(r, t);
|
|
920
920
|
};
|
|
921
921
|
Object.defineProperties(V.prototype, Z);
|
|
922
|
-
var
|
|
923
|
-
|
|
922
|
+
var B = V.prototype, Fr = /^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;
|
|
923
|
+
B.strictDirective = function(e) {
|
|
924
924
|
if (this.options.ecmaVersion < 5)
|
|
925
925
|
return !1;
|
|
926
926
|
for (; ; ) {
|
|
@@ -936,49 +936,49 @@ O.strictDirective = function(e) {
|
|
|
936
936
|
e += t[0].length, z.lastIndex = e, e += z.exec(this.input)[0].length, this.input[e] === ";" && e++;
|
|
937
937
|
}
|
|
938
938
|
};
|
|
939
|
-
|
|
939
|
+
B.eat = function(e) {
|
|
940
940
|
return this.type === e ? (this.next(), !0) : !1;
|
|
941
941
|
};
|
|
942
|
-
|
|
942
|
+
B.isContextual = function(e) {
|
|
943
943
|
return this.type === o.name && this.value === e && !this.containsEsc;
|
|
944
944
|
};
|
|
945
|
-
|
|
945
|
+
B.eatContextual = function(e) {
|
|
946
946
|
return this.isContextual(e) ? (this.next(), !0) : !1;
|
|
947
947
|
};
|
|
948
|
-
|
|
948
|
+
B.expectContextual = function(e) {
|
|
949
949
|
this.eatContextual(e) || this.unexpected();
|
|
950
950
|
};
|
|
951
|
-
|
|
951
|
+
B.canInsertSemicolon = function() {
|
|
952
952
|
return this.type === o.eof || this.type === o.braceR || H.test(this.input.slice(this.lastTokEnd, this.start));
|
|
953
953
|
};
|
|
954
|
-
|
|
954
|
+
B.insertSemicolon = function() {
|
|
955
955
|
if (this.canInsertSemicolon())
|
|
956
956
|
return this.options.onInsertedSemicolon && this.options.onInsertedSemicolon(this.lastTokEnd, this.lastTokEndLoc), !0;
|
|
957
957
|
};
|
|
958
|
-
|
|
958
|
+
B.semicolon = function() {
|
|
959
959
|
!this.eat(o.semi) && !this.insertSemicolon() && this.unexpected();
|
|
960
960
|
};
|
|
961
|
-
|
|
961
|
+
B.afterTrailingComma = function(e, t) {
|
|
962
962
|
if (this.type === e)
|
|
963
963
|
return this.options.onTrailingComma && this.options.onTrailingComma(this.lastTokStart, this.lastTokStartLoc), t || this.next(), !0;
|
|
964
964
|
};
|
|
965
|
-
|
|
965
|
+
B.expect = function(e) {
|
|
966
966
|
this.eat(e) || this.unexpected();
|
|
967
967
|
};
|
|
968
|
-
|
|
968
|
+
B.unexpected = function(e) {
|
|
969
969
|
this.raise(e ?? this.start, "Unexpected token");
|
|
970
970
|
};
|
|
971
971
|
var tt = function() {
|
|
972
972
|
this.shorthandAssign = this.trailingComma = this.parenthesizedAssign = this.parenthesizedBind = this.doubleProto = -1;
|
|
973
973
|
};
|
|
974
|
-
|
|
974
|
+
B.checkPatternErrors = function(e, t) {
|
|
975
975
|
if (e) {
|
|
976
976
|
e.trailingComma > -1 && this.raiseRecoverable(e.trailingComma, "Comma is not permitted after the rest element");
|
|
977
977
|
var r = t ? e.parenthesizedAssign : e.parenthesizedBind;
|
|
978
978
|
r > -1 && this.raiseRecoverable(r, t ? "Assigning to rvalue" : "Parenthesized pattern");
|
|
979
979
|
}
|
|
980
980
|
};
|
|
981
|
-
|
|
981
|
+
B.checkExpressionErrors = function(e, t) {
|
|
982
982
|
if (!e)
|
|
983
983
|
return !1;
|
|
984
984
|
var r = e.shorthandAssign, i = e.doubleProto;
|
|
@@ -986,10 +986,10 @@ O.checkExpressionErrors = function(e, t) {
|
|
|
986
986
|
return r >= 0 || i >= 0;
|
|
987
987
|
r >= 0 && this.raise(r, "Shorthand property assignments are valid only in destructuring patterns"), i >= 0 && this.raiseRecoverable(i, "Redefinition of __proto__ property");
|
|
988
988
|
};
|
|
989
|
-
|
|
989
|
+
B.checkYieldAwaitInDefaultParams = function() {
|
|
990
990
|
this.yieldPos && (!this.awaitPos || this.yieldPos < this.awaitPos) && this.raise(this.yieldPos, "Yield expression cannot be a default value"), this.awaitPos && this.raise(this.awaitPos, "Await expression cannot be a default value");
|
|
991
991
|
};
|
|
992
|
-
|
|
992
|
+
B.isSimpleAssignTarget = function(e) {
|
|
993
993
|
return e.type === "ParenthesizedExpression" ? this.isSimpleAssignTarget(e.expression) : e.type === "Identifier" || e.type === "MemberExpression";
|
|
994
994
|
};
|
|
995
995
|
var g = V.prototype;
|
|
@@ -3634,7 +3634,7 @@ V.acorn = {
|
|
|
3634
3634
|
function ha(e, t) {
|
|
3635
3635
|
return V.parse(e, t);
|
|
3636
3636
|
}
|
|
3637
|
-
const ye = { RES: void 0 }, E = { RES: void 0 }, _ = { LABEL: void 0 }, I = { LABEL: void 0 }, at = R("super"), he = R("supercall"), st = R("noctor"), ke = R("clsctor"), nt = R("newtarget"), T = R("private"), N = R("noinit"),
|
|
3637
|
+
const ye = { RES: void 0 }, E = { RES: void 0 }, _ = { LABEL: void 0 }, I = { LABEL: void 0 }, at = R("super"), he = R("supercall"), st = R("noctor"), ke = R("clsctor"), nt = R("newtarget"), T = R("private"), N = R("noinit"), D = R("deadzone"), be = R("import"), U = R("exports");
|
|
3638
3638
|
class We {
|
|
3639
3639
|
constructor(t, r) {
|
|
3640
3640
|
this.kind = t, this.value = r;
|
|
@@ -3724,7 +3724,7 @@ class P {
|
|
|
3724
3724
|
*/
|
|
3725
3725
|
let(t, r) {
|
|
3726
3726
|
const i = this.context[t];
|
|
3727
|
-
if (!i || i.get() ===
|
|
3727
|
+
if (!i || i.get() === D)
|
|
3728
3728
|
this.context[t] = new We("let", r);
|
|
3729
3729
|
else
|
|
3730
3730
|
throw new SyntaxError(`Identifier '${t}' has already been declared`);
|
|
@@ -3736,7 +3736,7 @@ class P {
|
|
|
3736
3736
|
*/
|
|
3737
3737
|
const(t, r) {
|
|
3738
3738
|
const i = this.context[t];
|
|
3739
|
-
if (!i || i.get() ===
|
|
3739
|
+
if (!i || i.get() === D)
|
|
3740
3740
|
this.context[t] = new We("const", r);
|
|
3741
3741
|
else
|
|
3742
3742
|
throw new SyntaxError(`Identifier '${t}' has already been declared`);
|
|
@@ -3761,7 +3761,7 @@ class P {
|
|
|
3761
3761
|
Object.keys(t) && (this.withContext = t);
|
|
3762
3762
|
}
|
|
3763
3763
|
}
|
|
3764
|
-
const fa = "0.6.
|
|
3764
|
+
const fa = "0.6.7", pa = {
|
|
3765
3765
|
version: fa
|
|
3766
3766
|
};
|
|
3767
3767
|
function mt(e, t = {}) {
|
|
@@ -3806,7 +3806,7 @@ function* Le(e, t, r = {}) {
|
|
|
3806
3806
|
return s;
|
|
3807
3807
|
{
|
|
3808
3808
|
const n = s.get();
|
|
3809
|
-
if (n ===
|
|
3809
|
+
if (n === D)
|
|
3810
3810
|
throw new ReferenceError(`${e.name} is not defined`);
|
|
3811
3811
|
return n;
|
|
3812
3812
|
}
|
|
@@ -3821,7 +3821,7 @@ const da = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3821
3821
|
Identifier: Le
|
|
3822
3822
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3823
3823
|
function* Ii(e, t) {
|
|
3824
|
-
return e.value;
|
|
3824
|
+
return e.regex ? new RegExp(e.regex.pattern, e.regex.flags) : e.value;
|
|
3825
3825
|
}
|
|
3826
3826
|
const ya = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3827
3827
|
__proto__: null,
|
|
@@ -3846,7 +3846,7 @@ function* xa(e, t) {
|
|
|
3846
3846
|
for (let i = 0; i < e.properties.length; i++) {
|
|
3847
3847
|
const a = e.properties[i];
|
|
3848
3848
|
if (a.type === "SpreadElement")
|
|
3849
|
-
|
|
3849
|
+
j(r, yield* je(a, t, { spreadProps: !0 }));
|
|
3850
3850
|
else {
|
|
3851
3851
|
let s;
|
|
3852
3852
|
const n = a.key;
|
|
@@ -3988,7 +3988,7 @@ function* ka(e, t) {
|
|
|
3988
3988
|
i = yield* Me(r, t, { getVar: !0 });
|
|
3989
3989
|
else {
|
|
3990
3990
|
const s = yield* d(e.right, t);
|
|
3991
|
-
return yield*
|
|
3991
|
+
return yield* M(r, t, { feed: s });
|
|
3992
3992
|
}
|
|
3993
3993
|
const a = yield* d(e.right, t);
|
|
3994
3994
|
switch (e.operator) {
|
|
@@ -4256,16 +4256,16 @@ function* Li(e, t, r = {}) {
|
|
|
4256
4256
|
if (s || i === "var")
|
|
4257
4257
|
if (c.type === "Property") {
|
|
4258
4258
|
const h = c.value;
|
|
4259
|
-
h.type === "Identifier" ? t[i](h.name, s ?
|
|
4259
|
+
h.type === "Identifier" ? t[i](h.name, s ? D : i === "var" ? N : void 0) : yield* M(h, t, { kind: i, hoist: a, onlyBlock: s });
|
|
4260
4260
|
} else
|
|
4261
4261
|
yield* Ee(c, t, { kind: i, hoist: a, onlyBlock: s });
|
|
4262
4262
|
} else if (c.type === "Property") {
|
|
4263
4263
|
let h;
|
|
4264
4264
|
c.computed ? h = yield* d(c.key, t) : h = c.key.name, u.push(h);
|
|
4265
4265
|
const f = c.value;
|
|
4266
|
-
f.type === "Identifier" ? t[i](f.name, n[h]) : yield*
|
|
4266
|
+
f.type === "Identifier" ? t[i](f.name, n[h]) : yield* M(f, t, { kind: i, feed: n[h] });
|
|
4267
4267
|
} else {
|
|
4268
|
-
const h =
|
|
4268
|
+
const h = j({}, n);
|
|
4269
4269
|
for (let f = 0; f < u.length; f++) delete h[u[f]];
|
|
4270
4270
|
yield* Ee(c, t, { kind: i, feed: h });
|
|
4271
4271
|
}
|
|
@@ -4277,7 +4277,7 @@ function* Vi(e, t, r = {}) {
|
|
|
4277
4277
|
const c = e.elements[l];
|
|
4278
4278
|
if (c)
|
|
4279
4279
|
if (a)
|
|
4280
|
-
(s || i === "var") && (c.type === "Identifier" ? t[i](c.name, s ?
|
|
4280
|
+
(s || i === "var") && (c.type === "Identifier" ? t[i](c.name, s ? D : i === "var" ? N : void 0) : yield* M(c, t, { kind: i, hoist: a, onlyBlock: s }));
|
|
4281
4281
|
else if (c.type === "Identifier")
|
|
4282
4282
|
if (i)
|
|
4283
4283
|
t[i](c.name, n[l]);
|
|
@@ -4285,18 +4285,18 @@ function* Vi(e, t, r = {}) {
|
|
|
4285
4285
|
const h = yield* Le(c, t, { getVar: !0 });
|
|
4286
4286
|
h.set(n[l]), u.push(h.get());
|
|
4287
4287
|
}
|
|
4288
|
-
else c.type === "RestElement" ? yield* Ee(c, t, { kind: i, feed: n.slice(l) }) : yield*
|
|
4288
|
+
else c.type === "RestElement" ? yield* Ee(c, t, { kind: i, feed: n.slice(l) }) : yield* M(c, t, { kind: i, feed: n[l] });
|
|
4289
4289
|
}
|
|
4290
4290
|
if (u.length)
|
|
4291
4291
|
return u;
|
|
4292
4292
|
}
|
|
4293
4293
|
function* Ee(e, t, r = {}) {
|
|
4294
4294
|
const { kind: i, hoist: a = !1, onlyBlock: s = !1, feed: n = [] } = r, u = e.argument;
|
|
4295
|
-
a ? (s || i === "var") && (u.type === "Identifier" ? t[i](u.name, s ?
|
|
4295
|
+
a ? (s || i === "var") && (u.type === "Identifier" ? t[i](u.name, s ? D : i === "var" ? N : void 0) : yield* M(u, t, { kind: i, hoist: a, onlyBlock: s })) : u.type === "Identifier" ? i ? t[i](u.name, n) : (yield* Le(u, t, { getVar: !0 })).set(n) : yield* M(u, t, { kind: i, feed: n });
|
|
4296
4296
|
}
|
|
4297
4297
|
function* Ti(e, t, r = {}) {
|
|
4298
4298
|
const { kind: i = "var", hoist: a = !1, onlyBlock: s = !1, feed: n = yield* d(e.right, t) } = r, u = e.left;
|
|
4299
|
-
a ? (s || i === "var") && (u.type === "Identifier" ? t[i](u.name, s ?
|
|
4299
|
+
a ? (s || i === "var") && (u.type === "Identifier" ? t[i](u.name, s ? D : i === "var" ? N : void 0) : yield* M(u, t, { kind: i, hoist: a, onlyBlock: s })) : u.type === "Identifier" ? t[i](u.name, n) : yield* M(u, t, { kind: i, feed: n });
|
|
4300
4300
|
}
|
|
4301
4301
|
const Ma = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4302
4302
|
__proto__: null,
|
|
@@ -4316,7 +4316,7 @@ const Ua = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
4316
4316
|
let ct;
|
|
4317
4317
|
function* d(e, t) {
|
|
4318
4318
|
if (!e) return;
|
|
4319
|
-
ct || (ct =
|
|
4319
|
+
ct || (ct = j(
|
|
4320
4320
|
{},
|
|
4321
4321
|
gr,
|
|
4322
4322
|
Fa,
|
|
@@ -4446,7 +4446,7 @@ function* Di(e, t, r = {}) {
|
|
|
4446
4446
|
const u = n.name;
|
|
4447
4447
|
s.var(u, a);
|
|
4448
4448
|
} else
|
|
4449
|
-
yield*
|
|
4449
|
+
yield* M(n, t, { feed: a });
|
|
4450
4450
|
i = yield* Fi(e.handler, s);
|
|
4451
4451
|
} else
|
|
4452
4452
|
throw a;
|
|
@@ -4493,7 +4493,7 @@ function* ji(e, t, r = {}) {
|
|
|
4493
4493
|
}
|
|
4494
4494
|
function* Ui(e, t, r = {}) {
|
|
4495
4495
|
const i = new P(t);
|
|
4496
|
-
for (yield* d(e.init, i); !e.test || (yield* d(e.test, i)); yield* d(e.update, i)) {
|
|
4496
|
+
for (e.init ? yield* d(e.init, i) : void 0; !e.test || (yield* d(e.test, i)); e.update ? yield* d(e.update, i) : void 0) {
|
|
4497
4497
|
const a = new P(i);
|
|
4498
4498
|
let s;
|
|
4499
4499
|
if (e.body.type === "BlockStatement" ? s = yield* se(e.body, a, { invasived: !0 }) : s = yield* d(e.body, a), s === I) {
|
|
@@ -4561,12 +4561,12 @@ function* Xa(e, t) {
|
|
|
4561
4561
|
}
|
|
4562
4562
|
function* me(e, t, r = {}) {
|
|
4563
4563
|
for (let i = 0; i < e.declarations.length; i++)
|
|
4564
|
-
yield* Wi(e.declarations[i], t,
|
|
4564
|
+
yield* Wi(e.declarations[i], t, j({ kind: e.kind }, r));
|
|
4565
4565
|
}
|
|
4566
4566
|
function* Wi(e, t, r = {}) {
|
|
4567
4567
|
const { kind: i = "var", hoist: a = !1, onlyBlock: s = !1, feed: n } = r;
|
|
4568
4568
|
if (a)
|
|
4569
|
-
(s || i === "var") && (e.id.type === "Identifier" ? t[i](e.id.name, s ?
|
|
4569
|
+
(s || i === "var") && (e.id.type === "Identifier" ? t[i](e.id.name, s ? D : i === "var" ? N : void 0) : yield* M(e.id, t, { kind: i, hoist: a, onlyBlock: s }));
|
|
4570
4570
|
else {
|
|
4571
4571
|
const u = "feed" in r, l = u ? n : yield* d(e.init, t);
|
|
4572
4572
|
if (e.id.type === "Identifier") {
|
|
@@ -4576,7 +4576,7 @@ function* Wi(e, t, r = {}) {
|
|
|
4576
4576
|
configurable: !0
|
|
4577
4577
|
});
|
|
4578
4578
|
} else
|
|
4579
|
-
yield*
|
|
4579
|
+
yield* M(e.id, t, { kind: i, feed: l });
|
|
4580
4580
|
}
|
|
4581
4581
|
}
|
|
4582
4582
|
function* Ya(e, t) {
|
|
@@ -4669,7 +4669,7 @@ function* Za(e, t) {
|
|
|
4669
4669
|
let u;
|
|
4670
4670
|
if (n.type === "ImportSpecifier" ? u = n.imported.type === "Identifier" ? n.imported.name : n.imported.value : n.type === "ImportDefaultSpecifier" ? u = "default" : n.type === "ImportNamespaceSpecifier" && (u = "*"), u !== "*" && !xt(a, u))
|
|
4671
4671
|
throw new SyntaxError(`The requested module "${e.source.value}" does not provide an export named "${u}"`);
|
|
4672
|
-
t.var(n.local.name, u === "*" ?
|
|
4672
|
+
t.var(n.local.name, u === "*" ? j({}, a) : a[u]);
|
|
4673
4673
|
}
|
|
4674
4674
|
}
|
|
4675
4675
|
function* Ja(e, t) {
|
|
@@ -4737,7 +4737,7 @@ function* ts(e, t) {
|
|
|
4737
4737
|
const s = r.find(U);
|
|
4738
4738
|
if (s) {
|
|
4739
4739
|
const n = s.get();
|
|
4740
|
-
n && typeof n == "object" &&
|
|
4740
|
+
n && typeof n == "object" && j(n, a);
|
|
4741
4741
|
}
|
|
4742
4742
|
}
|
|
4743
4743
|
function de(e, t, r = {}) {
|
|
@@ -4750,7 +4750,7 @@ function de(e, t, r = {}) {
|
|
|
4750
4750
|
return s;
|
|
4751
4751
|
{
|
|
4752
4752
|
const n = s.get();
|
|
4753
|
-
if (n ===
|
|
4753
|
+
if (n === D)
|
|
4754
4754
|
throw new ReferenceError(`${e.name} is not defined`);
|
|
4755
4755
|
return n;
|
|
4756
4756
|
}
|
|
@@ -4765,7 +4765,7 @@ const is = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
4765
4765
|
Identifier: de
|
|
4766
4766
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
4767
4767
|
function Ki(e, t) {
|
|
4768
|
-
return e.value;
|
|
4768
|
+
return e.regex ? new RegExp(e.regex.pattern, e.regex.flags) : e.value;
|
|
4769
4769
|
}
|
|
4770
4770
|
const rs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4771
4771
|
__proto__: null,
|
|
@@ -4790,7 +4790,7 @@ function ns(e, t) {
|
|
|
4790
4790
|
for (let i = 0; i < e.properties.length; i++) {
|
|
4791
4791
|
const a = e.properties[i];
|
|
4792
4792
|
if (a.type === "SpreadElement")
|
|
4793
|
-
|
|
4793
|
+
j(r, $e(a, t, { spreadProps: !0 }));
|
|
4794
4794
|
else {
|
|
4795
4795
|
let s;
|
|
4796
4796
|
const n = a.key;
|
|
@@ -4932,7 +4932,7 @@ function hs(e, t) {
|
|
|
4932
4932
|
i = Ue(r, t, { getVar: !0 });
|
|
4933
4933
|
else {
|
|
4934
4934
|
const s = y(e.right, t);
|
|
4935
|
-
return
|
|
4935
|
+
return F(r, t, { feed: s });
|
|
4936
4936
|
}
|
|
4937
4937
|
const a = y(e.right, t);
|
|
4938
4938
|
switch (e.operator) {
|
|
@@ -5191,16 +5191,16 @@ function Yi(e, t, r = {}) {
|
|
|
5191
5191
|
if (s || i === "var")
|
|
5192
5192
|
if (c.type === "Property") {
|
|
5193
5193
|
const h = c.value;
|
|
5194
|
-
h.type === "Identifier" ? t[i](h.name, s ?
|
|
5194
|
+
h.type === "Identifier" ? t[i](h.name, s ? D : i === "var" ? N : void 0) : F(h, t, { kind: i, hoist: a, onlyBlock: s });
|
|
5195
5195
|
} else
|
|
5196
5196
|
Ce(c, t, { kind: i, hoist: a, onlyBlock: s });
|
|
5197
5197
|
} else if (c.type === "Property") {
|
|
5198
5198
|
let h;
|
|
5199
5199
|
c.computed ? h = y(c.key, t) : h = c.key.name, u.push(h);
|
|
5200
5200
|
const f = c.value;
|
|
5201
|
-
f.type === "Identifier" ? t[i](f.name, n[h]) :
|
|
5201
|
+
f.type === "Identifier" ? t[i](f.name, n[h]) : F(f, t, { kind: i, feed: n[h] });
|
|
5202
5202
|
} else {
|
|
5203
|
-
const h =
|
|
5203
|
+
const h = j({}, n);
|
|
5204
5204
|
for (let f = 0; f < u.length; f++) delete h[u[f]];
|
|
5205
5205
|
Ce(c, t, { kind: i, feed: h });
|
|
5206
5206
|
}
|
|
@@ -5212,7 +5212,7 @@ function Zi(e, t, r = {}) {
|
|
|
5212
5212
|
const c = e.elements[l];
|
|
5213
5213
|
if (c)
|
|
5214
5214
|
if (a)
|
|
5215
|
-
(s || i === "var") && (c.type === "Identifier" ? t[i](c.name, s ?
|
|
5215
|
+
(s || i === "var") && (c.type === "Identifier" ? t[i](c.name, s ? D : i === "var" ? N : void 0) : F(c, t, { kind: i, hoist: a, onlyBlock: s }));
|
|
5216
5216
|
else if (c.type === "Identifier")
|
|
5217
5217
|
if (i)
|
|
5218
5218
|
t[i](c.name, n[l]);
|
|
@@ -5220,18 +5220,18 @@ function Zi(e, t, r = {}) {
|
|
|
5220
5220
|
const h = de(c, t, { getVar: !0 });
|
|
5221
5221
|
h.set(n[l]), u.push(h.get());
|
|
5222
5222
|
}
|
|
5223
|
-
else c.type === "RestElement" ? Ce(c, t, { kind: i, feed: n.slice(l) }) :
|
|
5223
|
+
else c.type === "RestElement" ? Ce(c, t, { kind: i, feed: n.slice(l) }) : F(c, t, { kind: i, feed: n[l] });
|
|
5224
5224
|
}
|
|
5225
5225
|
if (u.length)
|
|
5226
5226
|
return u;
|
|
5227
5227
|
}
|
|
5228
5228
|
function Ce(e, t, r = {}) {
|
|
5229
5229
|
const { kind: i, hoist: a = !1, onlyBlock: s = !1, feed: n = [] } = r, u = e.argument;
|
|
5230
|
-
a ? (s || i === "var") && (u.type === "Identifier" ? t[i](u.name, s ?
|
|
5230
|
+
a ? (s || i === "var") && (u.type === "Identifier" ? t[i](u.name, s ? D : i === "var" ? N : void 0) : F(u, t, { kind: i, hoist: a, onlyBlock: s })) : u.type === "Identifier" ? i ? t[i](u.name, n) : de(u, t, { getVar: !0 }).set(n) : F(u, t, { kind: i, feed: n });
|
|
5231
5231
|
}
|
|
5232
5232
|
function Ji(e, t, r = {}) {
|
|
5233
5233
|
const { kind: i = "var", hoist: a = !1, onlyBlock: s = !1, feed: n = y(e.right, t) } = r, u = e.left;
|
|
5234
|
-
a ? (s || i === "var") && (u.type === "Identifier" ? t[i](u.name, s ?
|
|
5234
|
+
a ? (s || i === "var") && (u.type === "Identifier" ? t[i](u.name, s ? D : i === "var" ? N : void 0) : F(u, t, { kind: i, hoist: a, onlyBlock: s })) : u.type === "Identifier" ? t[i](u.name, n) : F(u, t, { kind: i, feed: n });
|
|
5235
5235
|
}
|
|
5236
5236
|
const Cs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
5237
5237
|
__proto__: null,
|
|
@@ -5251,7 +5251,7 @@ const Is = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
5251
5251
|
let ht;
|
|
5252
5252
|
function y(e, t) {
|
|
5253
5253
|
if (!e) return;
|
|
5254
|
-
ht || (ht =
|
|
5254
|
+
ht || (ht = j(
|
|
5255
5255
|
{},
|
|
5256
5256
|
br,
|
|
5257
5257
|
Es,
|
|
@@ -5381,7 +5381,7 @@ function ar(e, t, r = {}) {
|
|
|
5381
5381
|
const u = n.name;
|
|
5382
5382
|
s.var(u, a);
|
|
5383
5383
|
} else
|
|
5384
|
-
|
|
5384
|
+
F(n, t, { feed: a });
|
|
5385
5385
|
i = sr(e.handler, s);
|
|
5386
5386
|
} else
|
|
5387
5387
|
throw a;
|
|
@@ -5428,7 +5428,7 @@ function or(e, t, r = {}) {
|
|
|
5428
5428
|
}
|
|
5429
5429
|
function ur(e, t, r = {}) {
|
|
5430
5430
|
const i = new P(t);
|
|
5431
|
-
for (y(e.init, i); !e.test || y(e.test, i); y(e.update, i)) {
|
|
5431
|
+
for (e.init ? y(e.init, i) : void 0; !e.test || y(e.test, i); e.update ? y(e.update, i) : void 0) {
|
|
5432
5432
|
const a = new P(i);
|
|
5433
5433
|
let s;
|
|
5434
5434
|
if (e.body.type === "BlockStatement" ? s = ne(e.body, a, { invasived: !0 }) : s = y(e.body, a), s === I) {
|
|
@@ -5479,12 +5479,12 @@ function Os(e, t) {
|
|
|
5479
5479
|
}
|
|
5480
5480
|
function ge(e, t, r = {}) {
|
|
5481
5481
|
for (let i = 0; i < e.declarations.length; i++)
|
|
5482
|
-
hr(e.declarations[i], t,
|
|
5482
|
+
hr(e.declarations[i], t, j({ kind: e.kind }, r));
|
|
5483
5483
|
}
|
|
5484
5484
|
function hr(e, t, r = {}) {
|
|
5485
5485
|
const { kind: i = "var", hoist: a = !1, onlyBlock: s = !1, feed: n } = r;
|
|
5486
5486
|
if (a)
|
|
5487
|
-
(s || i === "var") && (e.id.type === "Identifier" ? t[i](e.id.name, s ?
|
|
5487
|
+
(s || i === "var") && (e.id.type === "Identifier" ? t[i](e.id.name, s ? D : i === "var" ? N : void 0) : F(e.id, t, { kind: i, hoist: a, onlyBlock: s }));
|
|
5488
5488
|
else {
|
|
5489
5489
|
const u = "feed" in r, l = u ? n : y(e.init, t);
|
|
5490
5490
|
if (e.id.type === "Identifier") {
|
|
@@ -5494,7 +5494,7 @@ function hr(e, t, r = {}) {
|
|
|
5494
5494
|
configurable: !0
|
|
5495
5495
|
});
|
|
5496
5496
|
} else
|
|
5497
|
-
|
|
5497
|
+
F(e.id, t, { kind: i, feed: l });
|
|
5498
5498
|
}
|
|
5499
5499
|
}
|
|
5500
5500
|
function Ds(e, t) {
|
|
@@ -5587,7 +5587,7 @@ function Fs(e, t) {
|
|
|
5587
5587
|
let u;
|
|
5588
5588
|
if (n.type === "ImportSpecifier" ? u = n.imported.type === "Identifier" ? n.imported.name : n.imported.value : n.type === "ImportDefaultSpecifier" ? u = "default" : n.type === "ImportNamespaceSpecifier" && (u = "*"), u !== "*" && !xt(a, u))
|
|
5589
5589
|
throw new SyntaxError(`The requested module "${e.source.value}" does not provide an export named "${u}"`);
|
|
5590
|
-
t.var(n.local.name, u === "*" ?
|
|
5590
|
+
t.var(n.local.name, u === "*" ? j({}, a) : a[u]);
|
|
5591
5591
|
}
|
|
5592
5592
|
}
|
|
5593
5593
|
function Ms(e, t) {
|
|
@@ -5655,7 +5655,7 @@ function Us(e, t) {
|
|
|
5655
5655
|
const s = r.find(U);
|
|
5656
5656
|
if (s) {
|
|
5657
5657
|
const n = s.get();
|
|
5658
|
-
n && typeof n == "object" &&
|
|
5658
|
+
n && typeof n == "object" && j(n, a);
|
|
5659
5659
|
}
|
|
5660
5660
|
}
|
|
5661
5661
|
function Pt(e, t, r = {}) {
|
|
@@ -5679,7 +5679,7 @@ function ee(e, t) {
|
|
|
5679
5679
|
case "ForOfStatement":
|
|
5680
5680
|
e.left.type === "VariableDeclaration" && ge(e.left, t, { hoist: !0 });
|
|
5681
5681
|
case "ForStatement":
|
|
5682
|
-
e.type === "ForStatement" && e.init.type === "VariableDeclaration" && ge(e.init, t, { hoist: !0 });
|
|
5682
|
+
e.type === "ForStatement" && e.init && e.init.type === "VariableDeclaration" && ge(e.init, t, { hoist: !0 });
|
|
5683
5683
|
case "WhileStatement":
|
|
5684
5684
|
case "DoWhileStatement":
|
|
5685
5685
|
ee(e.body, t);
|
|
@@ -5712,7 +5712,7 @@ function ee(e, t) {
|
|
|
5712
5712
|
}
|
|
5713
5713
|
}
|
|
5714
5714
|
}
|
|
5715
|
-
function
|
|
5715
|
+
function F(e, t, r = {}) {
|
|
5716
5716
|
switch (e.type) {
|
|
5717
5717
|
case "ObjectPattern":
|
|
5718
5718
|
return Yi(e, t, r);
|
|
@@ -5736,7 +5736,7 @@ function X(e, t, r = {}) {
|
|
|
5736
5736
|
e.type !== "ArrowFunctionExpression" && (f.let("this", this), f.let("arguments", arguments), f.const(nt, new.target), i ? (f.const(at, i), a && f.let(he, a)) : a && a(this));
|
|
5737
5737
|
for (let C = 0; C < s.length; C++) {
|
|
5738
5738
|
const L = s[C];
|
|
5739
|
-
L.type === "Identifier" ? f.var(L.name, h[C]) : L.type === "RestElement" ? Ce(L, f, { kind: "var", feed: h.slice(C) }) :
|
|
5739
|
+
L.type === "Identifier" ? f.var(L.name, h[C]) : L.type === "RestElement" ? Ce(L, f, { kind: "var", feed: h.slice(C) }) : F(L, f, { kind: "var", feed: h[C] });
|
|
5740
5740
|
}
|
|
5741
5741
|
let v;
|
|
5742
5742
|
if (e.body.type === "BlockStatement" ? (Pt(e.body, f), v = ne(e.body, f, {
|
|
@@ -5785,7 +5785,7 @@ function Be(e, t) {
|
|
|
5785
5785
|
}
|
|
5786
5786
|
function yr(e, t, r) {
|
|
5787
5787
|
const { value: i } = r, a = e.left, s = new P(t);
|
|
5788
|
-
a.type === "VariableDeclaration" ? ge(a, s, { feed: i }) : a.type === "Identifier" ? de(a, t, { getVar: !0 }).set(i) :
|
|
5788
|
+
a.type === "VariableDeclaration" ? ge(a, s, { feed: i }) : a.type === "Identifier" ? de(a, t, { getVar: !0 }).set(i) : F(a, t, { feed: i });
|
|
5789
5789
|
let n;
|
|
5790
5790
|
return e.body.type === "BlockStatement" ? n = ne(e.body, s, { invasived: !0 }) : n = y(e.body, s), n;
|
|
5791
5791
|
}
|
|
@@ -5810,7 +5810,7 @@ function* te(e, t) {
|
|
|
5810
5810
|
case "ForOfStatement":
|
|
5811
5811
|
e.left.type === "VariableDeclaration" && (yield* me(e.left, t, { hoist: !0 }));
|
|
5812
5812
|
case "ForStatement":
|
|
5813
|
-
e.type === "ForStatement" && e.init.type === "VariableDeclaration" && (yield* me(e.init, t, { hoist: !0 }));
|
|
5813
|
+
e.type === "ForStatement" && e.init && e.init.type === "VariableDeclaration" && (yield* me(e.init, t, { hoist: !0 }));
|
|
5814
5814
|
case "WhileStatement":
|
|
5815
5815
|
case "DoWhileStatement":
|
|
5816
5816
|
yield* te(e.body, t);
|
|
@@ -5843,7 +5843,7 @@ function* te(e, t) {
|
|
|
5843
5843
|
}
|
|
5844
5844
|
}
|
|
5845
5845
|
}
|
|
5846
|
-
function*
|
|
5846
|
+
function* M(e, t, r = {}) {
|
|
5847
5847
|
switch (e.type) {
|
|
5848
5848
|
case "ObjectPattern":
|
|
5849
5849
|
return yield* Li(e, t, r);
|
|
@@ -5869,7 +5869,7 @@ function Y(e, t, r = {}) {
|
|
|
5869
5869
|
e.type !== "ArrowFunctionExpression" && (f.let("this", this), f.let("arguments", arguments), f.const(nt, new.target), i ? (f.const(at, i), a && f.let(he, a)) : a && (yield* a(this)));
|
|
5870
5870
|
for (let C = 0; C < s.length; C++) {
|
|
5871
5871
|
const L = s[C];
|
|
5872
|
-
L.type === "Identifier" ? f.var(L.name, h[C]) : L.type === "RestElement" ? yield* Ee(L, f, { kind: "var", feed: h.slice(C) }) : yield*
|
|
5872
|
+
L.type === "Identifier" ? f.var(L.name, h[C]) : L.type === "RestElement" ? yield* Ee(L, f, { kind: "var", feed: h.slice(C) }) : yield* M(L, f, { kind: "var", feed: h[C] });
|
|
5873
5873
|
}
|
|
5874
5874
|
let v;
|
|
5875
5875
|
if (e.body.type === "BlockStatement" ? (yield* Lt(e.body, f), v = yield* se(e.body, f, {
|
|
@@ -5884,7 +5884,7 @@ function Y(e, t, r = {}) {
|
|
|
5884
5884
|
e.async && e.generator ? u = function() {
|
|
5885
5885
|
const h = n.apply(this, arguments);
|
|
5886
5886
|
let f = Promise.resolve(), v = !1;
|
|
5887
|
-
const C = ($) => f = f.then(() => mt(h,
|
|
5887
|
+
const C = ($) => f = f.then(() => mt(h, j({ fullRet: !0 }, $))).catch((ue) => {
|
|
5888
5888
|
if (!v)
|
|
5889
5889
|
return v = !0, Promise.reject(ue);
|
|
5890
5890
|
}), L = {
|
|
@@ -5935,7 +5935,7 @@ function* Oe(e, t) {
|
|
|
5935
5935
|
}
|
|
5936
5936
|
function* gt(e, t, r) {
|
|
5937
5937
|
const { value: i } = r, a = e.left, s = new P(t);
|
|
5938
|
-
a.type === "VariableDeclaration" ? yield* me(a, s, { feed: i }) : a.type === "Identifier" ? (yield* de(a, t, { getVar: !0 })).set(i) : yield*
|
|
5938
|
+
a.type === "VariableDeclaration" ? yield* me(a, s, { feed: i }) : a.type === "Identifier" ? (yield* de(a, t, { getVar: !0 })).set(i) : yield* M(a, t, { feed: i });
|
|
5939
5939
|
let n;
|
|
5940
5940
|
return e.body.type === "BlockStatement" ? n = yield* se(e.body, s, { invasived: !0 }) : n = yield* d(e.body, s), n;
|
|
5941
5941
|
}
|
|
@@ -5961,7 +5961,7 @@ const $s = 15, Vt = class Vt {
|
|
|
5961
5961
|
}
|
|
5962
5962
|
}
|
|
5963
5963
|
parse(t, r) {
|
|
5964
|
-
return typeof r == "function" ? r(t,
|
|
5964
|
+
return typeof r == "function" ? r(t, this.options) : ha(t, this.options);
|
|
5965
5965
|
}
|
|
5966
5966
|
run(t) {
|
|
5967
5967
|
const r = typeof t == "string" ? this.parse(t) : t, i = this.scope;
|