@danielx/civet 0.7.7 → 0.7.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -49
- package/dist/astro.d.mts +1 -0
- package/dist/astro.d.ts +1 -0
- package/dist/astro.js +16 -8
- package/dist/browser.js +221 -122
- package/dist/config.js +6 -2
- package/dist/esbuild.d.mts +1 -0
- package/dist/esbuild.d.ts +1 -0
- package/dist/esbuild.js +16 -8
- package/dist/main.js +221 -122
- package/dist/main.mjs +221 -122
- package/dist/rollup.d.mts +1 -0
- package/dist/rollup.d.ts +1 -0
- package/dist/rollup.js +16 -8
- package/dist/types.d.ts +9 -6
- package/dist/unplugin-shared.mjs +16 -8
- package/dist/unplugin.d.mts +4 -1
- package/dist/unplugin.d.ts +4 -1
- package/dist/unplugin.js +16 -8
- package/dist/vite.d.mts +1 -0
- package/dist/vite.d.ts +1 -0
- package/dist/vite.js +16 -8
- package/dist/webpack.d.mts +1 -0
- package/dist/webpack.d.ts +1 -0
- package/dist/webpack.js +16 -8
- package/package.json +1 -1
package/dist/main.mjs
CHANGED
|
@@ -532,6 +532,7 @@ __export(lib_exports, {
|
|
|
532
532
|
processForInOf: () => processForInOf,
|
|
533
533
|
processProgram: () => processProgram,
|
|
534
534
|
processProgramAsync: () => processProgramAsync,
|
|
535
|
+
processTryBlock: () => processTryBlock,
|
|
535
536
|
processUnaryExpression: () => processUnaryExpression,
|
|
536
537
|
quoteString: () => quoteString,
|
|
537
538
|
reorderBindingRestProperty: () => reorderBindingRestProperty,
|
|
@@ -1553,7 +1554,6 @@ function isExit(node) {
|
|
|
1553
1554
|
if (!(node != null)) {
|
|
1554
1555
|
return false;
|
|
1555
1556
|
}
|
|
1556
|
-
let ref2;
|
|
1557
1557
|
switch (node.type) {
|
|
1558
1558
|
case "ReturnStatement":
|
|
1559
1559
|
case "ThrowStatement":
|
|
@@ -1565,13 +1565,10 @@ function isExit(node) {
|
|
|
1565
1565
|
return isExit(node.then) && isExit(node.else?.block);
|
|
1566
1566
|
}
|
|
1567
1567
|
case "BlockStatement": {
|
|
1568
|
-
return
|
|
1568
|
+
return node.expressions.some((s) => isExit(s[1]));
|
|
1569
1569
|
}
|
|
1570
1570
|
case "IterationStatement": {
|
|
1571
|
-
return node.condition?.type === "ParenthesizedExpression" && node.condition.expression?.type === "Literal" && node.condition.expression?.raw === "true" && gatherRecursiveWithinFunction(
|
|
1572
|
-
node.block,
|
|
1573
|
-
({ type }) => type === "BreakStatement"
|
|
1574
|
-
).length === 0;
|
|
1571
|
+
return node.condition?.type === "ParenthesizedExpression" && node.condition.expression?.type === "Literal" && node.condition.expression?.raw === "true" && gatherRecursiveWithinFunction(node.block, ($) => $.type === "BreakStatement").length === 0;
|
|
1575
1572
|
}
|
|
1576
1573
|
default: {
|
|
1577
1574
|
return false;
|
|
@@ -1872,8 +1869,8 @@ function updateParentPointers(node, parent, depth = 1) {
|
|
|
1872
1869
|
node.parent = parent;
|
|
1873
1870
|
}
|
|
1874
1871
|
if (depth && isParent(node)) {
|
|
1875
|
-
for (let
|
|
1876
|
-
const child =
|
|
1872
|
+
for (let ref2 = node.children, i3 = 0, len3 = ref2.length; i3 < len3; i3++) {
|
|
1873
|
+
const child = ref2[i3];
|
|
1877
1874
|
updateParentPointers(child, node, depth - 1);
|
|
1878
1875
|
}
|
|
1879
1876
|
}
|
|
@@ -2945,6 +2942,10 @@ function aggregateDuplicateBindings(bindings) {
|
|
|
2945
2942
|
const propsGroupedByName = /* @__PURE__ */ new Map();
|
|
2946
2943
|
for (const p of props) {
|
|
2947
2944
|
const { name, value } = p;
|
|
2945
|
+
let m;
|
|
2946
|
+
if (m = value?.type, m === "ArrayBindingPattern" || m === "ObjectBindingPattern") {
|
|
2947
|
+
continue;
|
|
2948
|
+
}
|
|
2948
2949
|
const key = value?.name || name?.name || name;
|
|
2949
2950
|
if (propsGroupedByName.has(key)) {
|
|
2950
2951
|
propsGroupedByName.get(key).push(p);
|
|
@@ -3193,7 +3194,7 @@ function processDeclarationConditionStatement(s) {
|
|
|
3193
3194
|
return;
|
|
3194
3195
|
}
|
|
3195
3196
|
let { expression } = condition;
|
|
3196
|
-
if (typeof expression === "object" &&
|
|
3197
|
+
if (expression && typeof expression === "object" && "type" in expression && expression.type === "UnaryExpression" && "children" in expression && Array.isArray(expression.children) && len2(expression.children, 2) && expression.children[0] === "!" && typeof expression.children[1] === "object" && expression.children[1] != null && "type" in expression.children[1] && expression.children[1].type === "ParenthesizedExpression" && "expression" in expression.children[1]) {
|
|
3197
3198
|
const { type: type1, children: [, { type: type2, expression: expression2 }] } = expression;
|
|
3198
3199
|
const type = [type1, type2];
|
|
3199
3200
|
expression = expression2;
|
|
@@ -3210,40 +3211,99 @@ function processDeclarationConditionStatement(s) {
|
|
|
3210
3211
|
}
|
|
3211
3212
|
});
|
|
3212
3213
|
if (conditions.length) {
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3214
|
+
if (s.negated) {
|
|
3215
|
+
let m;
|
|
3216
|
+
if (!(m = condition.expression, typeof m === "object" && m != null && "type" in m && m.type === "UnaryExpression" && "children" in m && Array.isArray(m.children) && len2(m.children, 2) && m.children[0] === "!" && typeof m.children[1] === "object" && m.children[1] != null && "type" in m.children[1] && m.children[1].type === "ParenthesizedExpression")) {
|
|
3217
|
+
console.log(condition.expression);
|
|
3218
|
+
throw new Error("Unsupported negated condition");
|
|
3219
|
+
}
|
|
3220
|
+
const { children } = condition.expression.children[1];
|
|
3221
|
+
const close = children.pop();
|
|
3222
|
+
conditions.forEach((c) => {
|
|
3223
|
+
return children.push(" && ", c);
|
|
3224
|
+
});
|
|
3225
|
+
children.push(close);
|
|
3226
|
+
} else {
|
|
3227
|
+
condition.children.unshift("(");
|
|
3228
|
+
conditions.forEach((c) => {
|
|
3229
|
+
return condition.children.push(" && ", c);
|
|
3230
|
+
});
|
|
3231
|
+
condition.children.push(")");
|
|
3232
|
+
}
|
|
3218
3233
|
}
|
|
3219
3234
|
}
|
|
3235
|
+
const { blockPrefix } = condition.expression;
|
|
3236
|
+
if (s.negated && blockPrefix && (s.type === "IfStatement" && isExit(s.then) || s.type === "IterationStatement")) {
|
|
3237
|
+
const { ancestor, child } = findAncestor(
|
|
3238
|
+
s,
|
|
3239
|
+
(a) => a.type === "BlockStatement"
|
|
3240
|
+
);
|
|
3241
|
+
if (!(ancestor != null)) {
|
|
3242
|
+
throw new Error("Couldn't find block for postfix declaration");
|
|
3243
|
+
}
|
|
3244
|
+
const index = findChildIndex(ancestor.expressions, child);
|
|
3245
|
+
if (index < 0) {
|
|
3246
|
+
throw new Error("Couldn't find where in block to put postfix declaration");
|
|
3247
|
+
}
|
|
3248
|
+
ancestor.expressions.splice(index + 1, 0, ...blockPrefix);
|
|
3249
|
+
updateParentPointers(ancestor);
|
|
3250
|
+
braceBlock(ancestor);
|
|
3251
|
+
let ref1;
|
|
3252
|
+
switch (s.type) {
|
|
3253
|
+
case "IfStatement": {
|
|
3254
|
+
if (ref1 = s.else?.block) {
|
|
3255
|
+
const elseBlock = ref1;
|
|
3256
|
+
if (elseBlock.bare && !elseBlock.semicolon) {
|
|
3257
|
+
elseBlock.children.push(elseBlock.semicolon = ";");
|
|
3258
|
+
}
|
|
3259
|
+
ancestor.expressions.splice(index + 1 + blockPrefix.length, 0, ["", elseBlock]);
|
|
3260
|
+
s.children = s.children.filter((a1) => a1 !== s.else);
|
|
3261
|
+
s.else = void 0;
|
|
3262
|
+
}
|
|
3263
|
+
const block = s.then;
|
|
3264
|
+
if (block.bare && !block.semicolon) {
|
|
3265
|
+
block.children.push(block.semicolon = ";");
|
|
3266
|
+
}
|
|
3267
|
+
;
|
|
3268
|
+
break;
|
|
3269
|
+
}
|
|
3270
|
+
}
|
|
3271
|
+
return;
|
|
3272
|
+
}
|
|
3220
3273
|
switch (s.type) {
|
|
3221
3274
|
case "IfStatement": {
|
|
3222
3275
|
const { else: e } = s;
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
return block;
|
|
3230
|
-
} else {
|
|
3231
|
-
return c;
|
|
3276
|
+
if (s.negated) {
|
|
3277
|
+
if (e != null) {
|
|
3278
|
+
const block = blockWithPrefix(blockPrefix, e.block);
|
|
3279
|
+
e.children = e.children.map(($1) => $1 === e.block ? block : $1);
|
|
3280
|
+
e.block = block;
|
|
3281
|
+
updateParentPointers(e);
|
|
3232
3282
|
}
|
|
3233
|
-
}
|
|
3234
|
-
|
|
3235
|
-
|
|
3283
|
+
} else {
|
|
3284
|
+
const block = blockWithPrefix(blockPrefix, s.then);
|
|
3285
|
+
if (block.bare && e && !block.semicolon) {
|
|
3286
|
+
block.children.push(block.semicolon = ";");
|
|
3287
|
+
}
|
|
3288
|
+
s.children = s.children.map(($2) => $2 === s.then ? block : $2);
|
|
3289
|
+
s.then = block;
|
|
3290
|
+
updateParentPointers(s);
|
|
3291
|
+
}
|
|
3292
|
+
;
|
|
3236
3293
|
break;
|
|
3237
3294
|
}
|
|
3238
3295
|
case "IterationStatement": {
|
|
3296
|
+
if (!blockPrefix) {
|
|
3297
|
+
return;
|
|
3298
|
+
}
|
|
3239
3299
|
const { children, block } = s;
|
|
3240
|
-
const newBlock = blockWithPrefix(
|
|
3241
|
-
s.children = children.map((
|
|
3242
|
-
updateParentPointers(
|
|
3300
|
+
const newBlock = blockWithPrefix(blockPrefix, block);
|
|
3301
|
+
s.children = children.map(($3) => $3 === block ? newBlock : $3);
|
|
3302
|
+
updateParentPointers(s);
|
|
3243
3303
|
break;
|
|
3244
3304
|
}
|
|
3245
3305
|
case "SwitchStatement": {
|
|
3246
|
-
const {
|
|
3306
|
+
const { ref: ref2, statementDeclaration } = condition.expression;
|
|
3247
3307
|
if (!blockPrefix) {
|
|
3248
3308
|
return;
|
|
3249
3309
|
}
|
|
@@ -3266,7 +3326,7 @@ function processDeclarationConditionStatement(s) {
|
|
|
3266
3326
|
const block = makeEmptyBlock();
|
|
3267
3327
|
replaceBlockExpression(s.parent, s, block);
|
|
3268
3328
|
block.expressions.push(["", s]);
|
|
3269
|
-
s.children.splice(s.children.findIndex(($
|
|
3329
|
+
s.children.splice(s.children.findIndex(($4) => $4.token === "switch"), 0, blockPrefix);
|
|
3270
3330
|
s.parent = block;
|
|
3271
3331
|
} else {
|
|
3272
3332
|
const block = blockWithPrefix([["", [{
|
|
@@ -3296,20 +3356,20 @@ function dynamizeImportDeclaration(decl) {
|
|
|
3296
3356
|
const { imports } = decl;
|
|
3297
3357
|
let { star, binding, specifiers } = imports;
|
|
3298
3358
|
const justDefault = binding && !specifiers && !star;
|
|
3299
|
-
let
|
|
3359
|
+
let ref2;
|
|
3300
3360
|
{
|
|
3301
3361
|
if (binding) {
|
|
3302
3362
|
if (specifiers) {
|
|
3303
|
-
|
|
3363
|
+
ref2 = makeRef();
|
|
3304
3364
|
} else {
|
|
3305
|
-
|
|
3365
|
+
ref2 = binding;
|
|
3306
3366
|
}
|
|
3307
3367
|
} else {
|
|
3308
|
-
|
|
3368
|
+
ref2 = convertNamedImportsToObject(imports, true);
|
|
3309
3369
|
}
|
|
3310
3370
|
}
|
|
3311
3371
|
;
|
|
3312
|
-
const pattern =
|
|
3372
|
+
const pattern = ref2;
|
|
3313
3373
|
const c = "const";
|
|
3314
3374
|
const expression = [
|
|
3315
3375
|
justDefault ? "(" : void 0,
|
|
@@ -4745,6 +4805,67 @@ function handleThisPrivateShorthands(value) {
|
|
|
4745
4805
|
}
|
|
4746
4806
|
return [value, value.thisShorthand];
|
|
4747
4807
|
}
|
|
4808
|
+
function processTryBlock($0) {
|
|
4809
|
+
let [t, , b, c, e, f] = $0;
|
|
4810
|
+
if (!c && (e || !f)) {
|
|
4811
|
+
const emptyCatchBlock = makeEmptyBlock();
|
|
4812
|
+
c = {
|
|
4813
|
+
type: "CatchClause",
|
|
4814
|
+
children: [" ", "catch(e) ", emptyCatchBlock],
|
|
4815
|
+
block: emptyCatchBlock
|
|
4816
|
+
};
|
|
4817
|
+
}
|
|
4818
|
+
let hoistDec;
|
|
4819
|
+
if (e) {
|
|
4820
|
+
c = c;
|
|
4821
|
+
const ok = makeRef("ok");
|
|
4822
|
+
hoistDec = {
|
|
4823
|
+
type: "Declaration",
|
|
4824
|
+
children: ["let ", ok, " = true"],
|
|
4825
|
+
names: []
|
|
4826
|
+
};
|
|
4827
|
+
replaceNode(
|
|
4828
|
+
c.block,
|
|
4829
|
+
blockWithPrefix([["", "ok = false"]], c.block),
|
|
4830
|
+
c
|
|
4831
|
+
);
|
|
4832
|
+
const condition = {
|
|
4833
|
+
type: "ParenthesizedExpression",
|
|
4834
|
+
children: ["(", ok, ")"],
|
|
4835
|
+
expression: ok
|
|
4836
|
+
};
|
|
4837
|
+
const i = makeNode({
|
|
4838
|
+
type: "IfStatement",
|
|
4839
|
+
children: ["if", condition, e.block],
|
|
4840
|
+
condition,
|
|
4841
|
+
then: e.block,
|
|
4842
|
+
else: void 0
|
|
4843
|
+
});
|
|
4844
|
+
if (!f) {
|
|
4845
|
+
const emptyFinallyBlock = makeEmptyBlock();
|
|
4846
|
+
f = {
|
|
4847
|
+
type: "FinallyClause",
|
|
4848
|
+
children: [" ", "finally ", emptyFinallyBlock],
|
|
4849
|
+
block: emptyFinallyBlock
|
|
4850
|
+
};
|
|
4851
|
+
}
|
|
4852
|
+
replaceNode(
|
|
4853
|
+
f.block,
|
|
4854
|
+
blockWithPrefix([["", i]], f.block),
|
|
4855
|
+
f
|
|
4856
|
+
);
|
|
4857
|
+
}
|
|
4858
|
+
const blocks = [b];
|
|
4859
|
+
if (c) {
|
|
4860
|
+
blocks.push(c.block);
|
|
4861
|
+
}
|
|
4862
|
+
return {
|
|
4863
|
+
type: "TryStatement",
|
|
4864
|
+
blocks,
|
|
4865
|
+
children: [t, b, c, f],
|
|
4866
|
+
hoistDec
|
|
4867
|
+
};
|
|
4868
|
+
}
|
|
4748
4869
|
function processCallMemberExpression(node) {
|
|
4749
4870
|
const { children } = node;
|
|
4750
4871
|
if (Array.isArray(children) && children.length >= 2 && typeof children[0] === "object" && children[0] != null && "parenthesizedOp" in children[0] && typeof children[0].parenthesizedOp === "object" && children[0].parenthesizedOp != null && "token" in children[0].parenthesizedOp && typeof children[1] === "object" && children[1] != null && "type" in children[1] && children[1].type === "Call") {
|
|
@@ -5486,25 +5607,29 @@ function processStatementExpressions(statements) {
|
|
|
5486
5607
|
}
|
|
5487
5608
|
function processNegativeIndexAccess(statements) {
|
|
5488
5609
|
gatherRecursiveAll(statements, (n) => n.type === "NegativeIndex").forEach((exp) => {
|
|
5489
|
-
const {
|
|
5490
|
-
|
|
5610
|
+
const { children } = exp.parent;
|
|
5611
|
+
let start = 0;
|
|
5612
|
+
while (start < children.length && isWhitespaceOrEmpty(children[start])) {
|
|
5613
|
+
start++;
|
|
5614
|
+
}
|
|
5615
|
+
const index = children.indexOf(exp);
|
|
5491
5616
|
let ref, subexp;
|
|
5492
|
-
if (index === 1) {
|
|
5493
|
-
const child =
|
|
5617
|
+
if (index === start + 1) {
|
|
5618
|
+
const child = children[start];
|
|
5494
5619
|
ref = maybeRef(child);
|
|
5495
5620
|
if (ref !== child) {
|
|
5496
|
-
subexp =
|
|
5621
|
+
subexp = children.splice(start, 1);
|
|
5497
5622
|
}
|
|
5498
|
-
} else if (index > 1) {
|
|
5623
|
+
} else if (index > start + 1) {
|
|
5499
5624
|
ref = makeRef();
|
|
5500
|
-
subexp =
|
|
5625
|
+
subexp = children.splice(start, index);
|
|
5501
5626
|
} else {
|
|
5502
5627
|
throw new Error("Invalid parse tree for negative index access");
|
|
5503
5628
|
}
|
|
5504
5629
|
if (subexp) {
|
|
5505
5630
|
const { hoistDec, refAssignment } = makeRefAssignment(ref, subexp);
|
|
5506
5631
|
exp.hoistDec = hoistDec;
|
|
5507
|
-
|
|
5632
|
+
children.splice(start, 0, makeLeftHandSideExpression(refAssignment));
|
|
5508
5633
|
}
|
|
5509
5634
|
return exp.len.children = [
|
|
5510
5635
|
ref,
|
|
@@ -5577,6 +5702,7 @@ function populateRefs(statements) {
|
|
|
5577
5702
|
}
|
|
5578
5703
|
function processPlaceholders(statements) {
|
|
5579
5704
|
const placeholderMap = /* @__PURE__ */ new Map();
|
|
5705
|
+
const liftedIfs = /* @__PURE__ */ new Set();
|
|
5580
5706
|
gatherRecursiveAll(statements, ($3) => $3.type === "Placeholder").forEach((_exp) => {
|
|
5581
5707
|
const exp = _exp;
|
|
5582
5708
|
let ancestor;
|
|
@@ -5597,9 +5723,15 @@ function processPlaceholders(statements) {
|
|
|
5597
5723
|
let child;
|
|
5598
5724
|
({ ancestor, child } = findAncestor(exp, (ancestor2, child2) => {
|
|
5599
5725
|
const { type } = ancestor2;
|
|
5600
|
-
|
|
5726
|
+
if (type === "IfStatement") {
|
|
5727
|
+
liftedIfs.add(ancestor2);
|
|
5728
|
+
}
|
|
5729
|
+
let m;
|
|
5730
|
+
let m1;
|
|
5731
|
+
return type === "Call" || // Block, except for if/else blocks when condition already lifted
|
|
5732
|
+
type === "BlockStatement" && !((m = ancestor2.parent, typeof m === "object" && m != null && "type" in m && m.type === "IfStatement") && liftedIfs.has(ancestor2.parent)) && !((m1 = ancestor2.parent, typeof m1 === "object" && m1 != null && "type" in m1 && m1.type === "ElseClause" && "parent" in m1 && typeof m1.parent === "object" && m1.parent != null && "type" in m1.parent && m1.parent.type === "IfStatement") && liftedIfs.has(ancestor2.parent.parent)) || type === "PipelineExpression" || // Declaration
|
|
5601
5733
|
type === "Initializer" || // Right-hand side of assignment
|
|
5602
|
-
type === "AssignmentExpression" && ancestor2
|
|
5734
|
+
type === "AssignmentExpression" && findChildIndex(ancestor2, child2) === ancestor2.children.indexOf(ancestor2.expression) || type === "ReturnStatement" || type === "YieldExpression";
|
|
5603
5735
|
}));
|
|
5604
5736
|
switch (ancestor?.type) {
|
|
5605
5737
|
case "Call": {
|
|
@@ -5967,7 +6099,7 @@ var grammar = {
|
|
|
5967
6099
|
PrimaryExpression,
|
|
5968
6100
|
ParenthesizedExpression,
|
|
5969
6101
|
Placeholder,
|
|
5970
|
-
|
|
6102
|
+
PlaceholderTypeSuffix,
|
|
5971
6103
|
ClassDeclaration,
|
|
5972
6104
|
ClassExpression,
|
|
5973
6105
|
ClassBinding,
|
|
@@ -6173,7 +6305,6 @@ var grammar = {
|
|
|
6173
6305
|
IfStatement,
|
|
6174
6306
|
ElseClause,
|
|
6175
6307
|
IfClause,
|
|
6176
|
-
UnlessClause,
|
|
6177
6308
|
IterationStatement,
|
|
6178
6309
|
_IterationStatement,
|
|
6179
6310
|
IterationExpression,
|
|
@@ -6864,7 +6995,7 @@ var $R2 = (0, import_lib3.$R)(new RegExp("(as|of|satisfies|then|when|implements|
|
|
|
6864
6995
|
var $R3 = (0, import_lib3.$R)(new RegExp("[0-9]", "suy"));
|
|
6865
6996
|
var $R4 = (0, import_lib3.$R)(new RegExp("(?!\\p{ID_Start}|[_$0-9(\\[{])", "suy"));
|
|
6866
6997
|
var $R5 = (0, import_lib3.$R)(new RegExp("[ \\t]", "suy"));
|
|
6867
|
-
var $R6 = (0, import_lib3.$R)(new RegExp("(?:\\p{ID_Continue}|[\\u200C\\u200D
|
|
6998
|
+
var $R6 = (0, import_lib3.$R)(new RegExp("(?:\\p{ID_Continue}|[\\u200C\\u200D$.#])", "suy"));
|
|
6868
6999
|
var $R7 = (0, import_lib3.$R)(new RegExp("[&=]", "suy"));
|
|
6869
7000
|
var $R8 = (0, import_lib3.$R)(new RegExp("(?=['\"`])", "suy"));
|
|
6870
7001
|
var $R9 = (0, import_lib3.$R)(new RegExp("(?=[\\/?])", "suy"));
|
|
@@ -7838,15 +7969,17 @@ var ParenthesizedExpression$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(OpenPar
|
|
|
7838
7969
|
function ParenthesizedExpression(ctx, state2) {
|
|
7839
7970
|
return (0, import_lib3.$EVENT)(ctx, state2, "ParenthesizedExpression", ParenthesizedExpression$0);
|
|
7840
7971
|
}
|
|
7841
|
-
var Placeholder$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(Dot, (0, import_lib3.$N)((0, import_lib3.$EXPECT)($R6, "Placeholder /(?:\\p{ID_Continue}|[\\u200C\\u200D
|
|
7972
|
+
var Placeholder$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(Dot, (0, import_lib3.$N)((0, import_lib3.$EXPECT)($R6, "Placeholder /(?:\\p{ID_Continue}|[\\u200C\\u200D$.#])/")), (0, import_lib3.$E)(PlaceholderTypeSuffix)), function($skip, $loc, $0, $1, $2, $3) {
|
|
7842
7973
|
var dot = $1;
|
|
7974
|
+
var typeSuffix = $3;
|
|
7843
7975
|
return {
|
|
7844
7976
|
type: "Placeholder",
|
|
7845
7977
|
subtype: ".",
|
|
7978
|
+
typeSuffix,
|
|
7846
7979
|
children: [dot]
|
|
7847
7980
|
};
|
|
7848
7981
|
});
|
|
7849
|
-
var Placeholder$1 = (0, import_lib3.$TS)((0, import_lib3.$S)(Ampersand, (0, import_lib3.$N)((0, import_lib3.$EXPECT)($R7, "Placeholder /[&=]/")), (0, import_lib3.$E)(
|
|
7982
|
+
var Placeholder$1 = (0, import_lib3.$TS)((0, import_lib3.$S)(Ampersand, (0, import_lib3.$N)((0, import_lib3.$EXPECT)($R7, "Placeholder /[&=]/")), (0, import_lib3.$E)(PlaceholderTypeSuffix)), function($skip, $loc, $0, $1, $2, $3) {
|
|
7850
7983
|
var amp = $1;
|
|
7851
7984
|
var typeSuffix = $3;
|
|
7852
7985
|
return {
|
|
@@ -7867,11 +8000,11 @@ var Placeholder$$ = [Placeholder$0, Placeholder$1, Placeholder$2];
|
|
|
7867
8000
|
function Placeholder(ctx, state2) {
|
|
7868
8001
|
return (0, import_lib3.$EVENT_C)(ctx, state2, "Placeholder", Placeholder$$);
|
|
7869
8002
|
}
|
|
7870
|
-
var
|
|
8003
|
+
var PlaceholderTypeSuffix$0 = (0, import_lib3.$T)((0, import_lib3.$S)((0, import_lib3.$Y)((0, import_lib3.$S)((0, import_lib3.$E)(QuestionMark), Colon)), TypeSuffix), function(value) {
|
|
7871
8004
|
return value[1];
|
|
7872
8005
|
});
|
|
7873
|
-
function
|
|
7874
|
-
return (0, import_lib3.$EVENT)(ctx, state2, "
|
|
8006
|
+
function PlaceholderTypeSuffix(ctx, state2) {
|
|
8007
|
+
return (0, import_lib3.$EVENT)(ctx, state2, "PlaceholderTypeSuffix", PlaceholderTypeSuffix$0);
|
|
7875
8008
|
}
|
|
7876
8009
|
var ClassDeclaration$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(ClassExpression), function($skip, $loc, $0, $1) {
|
|
7877
8010
|
if ($1.id)
|
|
@@ -8085,7 +8218,8 @@ var ClassElement$1 = (0, import_lib3.$TS)((0, import_lib3.$S)(Static, BracedBloc
|
|
|
8085
8218
|
children: $0
|
|
8086
8219
|
};
|
|
8087
8220
|
});
|
|
8088
|
-
var ClassElement
|
|
8221
|
+
var ClassElement$2 = EmptyStatement;
|
|
8222
|
+
var ClassElement$$ = [ClassElement$0, ClassElement$1, ClassElement$2];
|
|
8089
8223
|
function ClassElement(ctx, state2) {
|
|
8090
8224
|
return (0, import_lib3.$EVENT_C)(ctx, state2, "ClassElement", ClassElement$$);
|
|
8091
8225
|
}
|
|
@@ -10669,18 +10803,7 @@ var ComputedPropertyName$2 = (0, import_lib3.$TS)((0, import_lib3.$S)(InsertOpen
|
|
|
10669
10803
|
implicit: true
|
|
10670
10804
|
};
|
|
10671
10805
|
});
|
|
10672
|
-
var ComputedPropertyName
|
|
10673
|
-
var open = $2;
|
|
10674
|
-
var expression = $3;
|
|
10675
|
-
var close = $4;
|
|
10676
|
-
return {
|
|
10677
|
-
type: "ComputedPropertyName",
|
|
10678
|
-
expression,
|
|
10679
|
-
children: [open, expression, close],
|
|
10680
|
-
implicit: true
|
|
10681
|
-
};
|
|
10682
|
-
});
|
|
10683
|
-
var ComputedPropertyName$$ = [ComputedPropertyName$0, ComputedPropertyName$1, ComputedPropertyName$2, ComputedPropertyName$3];
|
|
10806
|
+
var ComputedPropertyName$$ = [ComputedPropertyName$0, ComputedPropertyName$1, ComputedPropertyName$2];
|
|
10684
10807
|
function ComputedPropertyName(ctx, state2) {
|
|
10685
10808
|
return (0, import_lib3.$EVENT_C)(ctx, state2, "ComputedPropertyName", ComputedPropertyName$$);
|
|
10686
10809
|
}
|
|
@@ -11472,9 +11595,8 @@ function PostfixStatement(ctx, state2) {
|
|
|
11472
11595
|
var _PostfixStatement$0 = ForClause;
|
|
11473
11596
|
var _PostfixStatement$1 = IfClause;
|
|
11474
11597
|
var _PostfixStatement$2 = LoopClause;
|
|
11475
|
-
var _PostfixStatement$3 =
|
|
11476
|
-
var _PostfixStatement
|
|
11477
|
-
var _PostfixStatement$$ = [_PostfixStatement$0, _PostfixStatement$1, _PostfixStatement$2, _PostfixStatement$3, _PostfixStatement$4];
|
|
11598
|
+
var _PostfixStatement$3 = WhileClause;
|
|
11599
|
+
var _PostfixStatement$$ = [_PostfixStatement$0, _PostfixStatement$1, _PostfixStatement$2, _PostfixStatement$3];
|
|
11478
11600
|
function _PostfixStatement(ctx, state2) {
|
|
11479
11601
|
return (0, import_lib3.$EVENT_C)(ctx, state2, "_PostfixStatement", _PostfixStatement$$);
|
|
11480
11602
|
}
|
|
@@ -11554,7 +11676,7 @@ var LabelledItem$$ = [LabelledItem$0, LabelledItem$1];
|
|
|
11554
11676
|
function LabelledItem(ctx, state2) {
|
|
11555
11677
|
return (0, import_lib3.$EVENT_C)(ctx, state2, "LabelledItem", LabelledItem$$);
|
|
11556
11678
|
}
|
|
11557
|
-
var IfStatement$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(
|
|
11679
|
+
var IfStatement$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(IfClause, BlockOrEmpty, (0, import_lib3.$E)(ElseClause)), function($skip, $loc, $0, $1, $2, $3) {
|
|
11558
11680
|
var clause = $1;
|
|
11559
11681
|
var block = $2;
|
|
11560
11682
|
var e = $3;
|
|
@@ -11562,6 +11684,7 @@ var IfStatement$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$C)
|
|
|
11562
11684
|
type: "IfStatement",
|
|
11563
11685
|
children: [...clause.children, block, e],
|
|
11564
11686
|
condition: clause.condition,
|
|
11687
|
+
negated: clause.negated,
|
|
11565
11688
|
then: block,
|
|
11566
11689
|
else: e
|
|
11567
11690
|
};
|
|
@@ -11576,33 +11699,24 @@ var ElseClause$0 = (0, import_lib3.$T)((0, import_lib3.$S)((0, import_lib3.$C)(N
|
|
|
11576
11699
|
function ElseClause(ctx, state2) {
|
|
11577
11700
|
return (0, import_lib3.$EVENT)(ctx, state2, "ElseClause", ElseClause$0);
|
|
11578
11701
|
}
|
|
11579
|
-
var IfClause$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(If, Condition), function($skip, $loc, $0, $1, $2) {
|
|
11580
|
-
var
|
|
11702
|
+
var IfClause$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$C)(If, Unless), (0, import_lib3.$E)(_), Condition), function($skip, $loc, $0, $1, $2, $3) {
|
|
11703
|
+
var kind = $1;
|
|
11704
|
+
var ws = $2;
|
|
11705
|
+
var condition = $3;
|
|
11706
|
+
if (kind.negated) {
|
|
11707
|
+
kind = { ...kind, token: "if" };
|
|
11708
|
+
condition = negateCondition(condition);
|
|
11709
|
+
}
|
|
11581
11710
|
return {
|
|
11582
11711
|
type: "IfStatement",
|
|
11583
|
-
children:
|
|
11584
|
-
condition
|
|
11712
|
+
children: [kind, ws, condition],
|
|
11713
|
+
condition,
|
|
11714
|
+
negated: kind.negated
|
|
11585
11715
|
};
|
|
11586
11716
|
});
|
|
11587
11717
|
function IfClause(ctx, state2) {
|
|
11588
11718
|
return (0, import_lib3.$EVENT)(ctx, state2, "IfClause", IfClause$0);
|
|
11589
11719
|
}
|
|
11590
|
-
var UnlessClause$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(Unless, Condition), function($skip, $loc, $0, $1, $2) {
|
|
11591
|
-
var kind = $1;
|
|
11592
|
-
var condition = $2;
|
|
11593
|
-
kind = { ...kind, token: "if" };
|
|
11594
|
-
kind.token += getTrimmingSpace(condition);
|
|
11595
|
-
condition = insertTrimmingSpace(condition, "");
|
|
11596
|
-
condition = negateCondition(condition);
|
|
11597
|
-
return {
|
|
11598
|
-
type: "IfStatement",
|
|
11599
|
-
children: [kind, condition],
|
|
11600
|
-
condition
|
|
11601
|
-
};
|
|
11602
|
-
});
|
|
11603
|
-
function UnlessClause(ctx, state2) {
|
|
11604
|
-
return (0, import_lib3.$EVENT)(ctx, state2, "UnlessClause", UnlessClause$0);
|
|
11605
|
-
}
|
|
11606
11720
|
var IterationStatement$0 = (0, import_lib3.$T)((0, import_lib3.$S)((0, import_lib3.$EXPECT)($R25, "IterationStatement /(?=loop|comptime|do|for|until|while)/"), _IterationStatement), function(value) {
|
|
11607
11721
|
return value[1];
|
|
11608
11722
|
});
|
|
@@ -11732,7 +11846,7 @@ var WhileClause$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$C)
|
|
|
11732
11846
|
var kind = $1;
|
|
11733
11847
|
var ws = $2;
|
|
11734
11848
|
var condition = $3;
|
|
11735
|
-
if (kind.
|
|
11849
|
+
if (kind.negated) {
|
|
11736
11850
|
kind = { ...kind, token: "while" };
|
|
11737
11851
|
condition = negateCondition(condition);
|
|
11738
11852
|
}
|
|
@@ -11740,7 +11854,8 @@ var WhileClause$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$C)
|
|
|
11740
11854
|
type: "IterationStatement",
|
|
11741
11855
|
subtype: kind.token,
|
|
11742
11856
|
children: [kind, ws, condition],
|
|
11743
|
-
condition
|
|
11857
|
+
condition,
|
|
11858
|
+
negated: kind.negated
|
|
11744
11859
|
};
|
|
11745
11860
|
});
|
|
11746
11861
|
function WhileClause(ctx, state2) {
|
|
@@ -12215,32 +12330,8 @@ var IgnoreColon$0 = (0, import_lib3.$TV)((0, import_lib3.$E)((0, import_lib3.$S)
|
|
|
12215
12330
|
function IgnoreColon(ctx, state2) {
|
|
12216
12331
|
return (0, import_lib3.$EVENT)(ctx, state2, "IgnoreColon", IgnoreColon$0);
|
|
12217
12332
|
}
|
|
12218
|
-
var TryStatement$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(Try, (0, import_lib3.$N)((0, import_lib3.$EXPECT)($L15, 'TryStatement ":"')), NoPostfixBracedOrEmptyBlock, (0, import_lib3.$E)(CatchClause), (0, import_lib3.$E)(FinallyClause)), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
12219
|
-
|
|
12220
|
-
var b = $3;
|
|
12221
|
-
var c = $4;
|
|
12222
|
-
var f = $5;
|
|
12223
|
-
if (!c && !f) {
|
|
12224
|
-
const emptyCatchBlock = makeEmptyBlock();
|
|
12225
|
-
c = {
|
|
12226
|
-
type: "CatchClause",
|
|
12227
|
-
children: [" catch(e) ", emptyCatchBlock],
|
|
12228
|
-
block: emptyCatchBlock
|
|
12229
|
-
};
|
|
12230
|
-
return {
|
|
12231
|
-
type: "TryStatement",
|
|
12232
|
-
blocks: [b, emptyCatchBlock],
|
|
12233
|
-
children: [t, b, c]
|
|
12234
|
-
};
|
|
12235
|
-
}
|
|
12236
|
-
const blocks = [b];
|
|
12237
|
-
if (c)
|
|
12238
|
-
blocks.push(c.block);
|
|
12239
|
-
return {
|
|
12240
|
-
type: "TryStatement",
|
|
12241
|
-
blocks,
|
|
12242
|
-
children: [t, b, c, f]
|
|
12243
|
-
};
|
|
12333
|
+
var TryStatement$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(Try, (0, import_lib3.$N)((0, import_lib3.$EXPECT)($L15, 'TryStatement ":"')), NoPostfixBracedOrEmptyBlock, (0, import_lib3.$E)(CatchClause), (0, import_lib3.$E)(ElseClause), (0, import_lib3.$E)(FinallyClause)), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
|
|
12334
|
+
return processTryBlock($0);
|
|
12244
12335
|
});
|
|
12245
12336
|
function TryStatement(ctx, state2) {
|
|
12246
12337
|
return (0, import_lib3.$EVENT)(ctx, state2, "TryStatement", TryStatement$0);
|
|
@@ -12262,7 +12353,14 @@ var CatchBind$$ = [CatchBind$0, CatchBind$1];
|
|
|
12262
12353
|
function CatchBind(ctx, state2) {
|
|
12263
12354
|
return (0, import_lib3.$EVENT_C)(ctx, state2, "CatchBind", CatchBind$$);
|
|
12264
12355
|
}
|
|
12265
|
-
var FinallyClause$0 = (0, import_lib3.$S)((0, import_lib3.$C)(Nested, _), Finally, (0, import_lib3.$C)(BracedThenClause, BracedOrEmptyBlock))
|
|
12356
|
+
var FinallyClause$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$C)(Nested, _), Finally, (0, import_lib3.$C)(BracedThenClause, BracedOrEmptyBlock)), function($skip, $loc, $0, $1, $2, $3) {
|
|
12357
|
+
var block = $3;
|
|
12358
|
+
return {
|
|
12359
|
+
type: "FinallyClause",
|
|
12360
|
+
children: $0,
|
|
12361
|
+
block
|
|
12362
|
+
};
|
|
12363
|
+
});
|
|
12266
12364
|
function FinallyClause(ctx, state2) {
|
|
12267
12365
|
return (0, import_lib3.$EVENT)(ctx, state2, "FinallyClause", FinallyClause$0);
|
|
12268
12366
|
}
|
|
@@ -12319,7 +12417,8 @@ var DeclarationCondition$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(ForbidBrac
|
|
|
12319
12417
|
return $skip;
|
|
12320
12418
|
return {
|
|
12321
12419
|
type: "DeclarationCondition",
|
|
12322
|
-
declaration
|
|
12420
|
+
declaration,
|
|
12421
|
+
children: [declaration]
|
|
12323
12422
|
};
|
|
12324
12423
|
});
|
|
12325
12424
|
function DeclarationCondition(ctx, state2) {
|
|
@@ -14119,7 +14218,7 @@ function Unless(ctx, state2) {
|
|
|
14119
14218
|
return (0, import_lib3.$EVENT)(ctx, state2, "Unless", Unless$0);
|
|
14120
14219
|
}
|
|
14121
14220
|
var Until$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$EXPECT)($L205, 'Until "until"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
|
|
14122
|
-
return { $loc, token: $1 };
|
|
14221
|
+
return { $loc, token: $1, negated: true };
|
|
14123
14222
|
});
|
|
14124
14223
|
function Until(ctx, state2) {
|
|
14125
14224
|
return (0, import_lib3.$EVENT)(ctx, state2, "Until", Until$0);
|
package/dist/rollup.d.mts
CHANGED