@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/browser.js
CHANGED
|
@@ -557,6 +557,7 @@ ${input.slice(result.pos)}
|
|
|
557
557
|
processForInOf: () => processForInOf,
|
|
558
558
|
processProgram: () => processProgram,
|
|
559
559
|
processProgramAsync: () => processProgramAsync,
|
|
560
|
+
processTryBlock: () => processTryBlock,
|
|
560
561
|
processUnaryExpression: () => processUnaryExpression,
|
|
561
562
|
quoteString: () => quoteString,
|
|
562
563
|
reorderBindingRestProperty: () => reorderBindingRestProperty,
|
|
@@ -1578,7 +1579,6 @@ ${input.slice(result.pos)}
|
|
|
1578
1579
|
if (!(node != null)) {
|
|
1579
1580
|
return false;
|
|
1580
1581
|
}
|
|
1581
|
-
let ref2;
|
|
1582
1582
|
switch (node.type) {
|
|
1583
1583
|
case "ReturnStatement":
|
|
1584
1584
|
case "ThrowStatement":
|
|
@@ -1590,13 +1590,10 @@ ${input.slice(result.pos)}
|
|
|
1590
1590
|
return isExit(node.then) && isExit(node.else?.block);
|
|
1591
1591
|
}
|
|
1592
1592
|
case "BlockStatement": {
|
|
1593
|
-
return
|
|
1593
|
+
return node.expressions.some((s) => isExit(s[1]));
|
|
1594
1594
|
}
|
|
1595
1595
|
case "IterationStatement": {
|
|
1596
|
-
return node.condition?.type === "ParenthesizedExpression" && node.condition.expression?.type === "Literal" && node.condition.expression?.raw === "true" && gatherRecursiveWithinFunction(
|
|
1597
|
-
node.block,
|
|
1598
|
-
({ type }) => type === "BreakStatement"
|
|
1599
|
-
).length === 0;
|
|
1596
|
+
return node.condition?.type === "ParenthesizedExpression" && node.condition.expression?.type === "Literal" && node.condition.expression?.raw === "true" && gatherRecursiveWithinFunction(node.block, ($) => $.type === "BreakStatement").length === 0;
|
|
1600
1597
|
}
|
|
1601
1598
|
default: {
|
|
1602
1599
|
return false;
|
|
@@ -1897,8 +1894,8 @@ ${input.slice(result.pos)}
|
|
|
1897
1894
|
node.parent = parent;
|
|
1898
1895
|
}
|
|
1899
1896
|
if (depth && isParent(node)) {
|
|
1900
|
-
for (let
|
|
1901
|
-
const child =
|
|
1897
|
+
for (let ref2 = node.children, i3 = 0, len3 = ref2.length; i3 < len3; i3++) {
|
|
1898
|
+
const child = ref2[i3];
|
|
1902
1899
|
updateParentPointers(child, node, depth - 1);
|
|
1903
1900
|
}
|
|
1904
1901
|
}
|
|
@@ -2970,6 +2967,10 @@ ${input.slice(result.pos)}
|
|
|
2970
2967
|
const propsGroupedByName = /* @__PURE__ */ new Map();
|
|
2971
2968
|
for (const p of props) {
|
|
2972
2969
|
const { name, value } = p;
|
|
2970
|
+
let m;
|
|
2971
|
+
if (m = value?.type, m === "ArrayBindingPattern" || m === "ObjectBindingPattern") {
|
|
2972
|
+
continue;
|
|
2973
|
+
}
|
|
2973
2974
|
const key = value?.name || name?.name || name;
|
|
2974
2975
|
if (propsGroupedByName.has(key)) {
|
|
2975
2976
|
propsGroupedByName.get(key).push(p);
|
|
@@ -3218,7 +3219,7 @@ ${input.slice(result.pos)}
|
|
|
3218
3219
|
return;
|
|
3219
3220
|
}
|
|
3220
3221
|
let { expression } = condition;
|
|
3221
|
-
if (typeof expression === "object" &&
|
|
3222
|
+
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]) {
|
|
3222
3223
|
const { type: type1, children: [, { type: type2, expression: expression2 }] } = expression;
|
|
3223
3224
|
const type = [type1, type2];
|
|
3224
3225
|
expression = expression2;
|
|
@@ -3235,40 +3236,99 @@ ${input.slice(result.pos)}
|
|
|
3235
3236
|
}
|
|
3236
3237
|
});
|
|
3237
3238
|
if (conditions.length) {
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3239
|
+
if (s.negated) {
|
|
3240
|
+
let m;
|
|
3241
|
+
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")) {
|
|
3242
|
+
console.log(condition.expression);
|
|
3243
|
+
throw new Error("Unsupported negated condition");
|
|
3244
|
+
}
|
|
3245
|
+
const { children } = condition.expression.children[1];
|
|
3246
|
+
const close = children.pop();
|
|
3247
|
+
conditions.forEach((c) => {
|
|
3248
|
+
return children.push(" && ", c);
|
|
3249
|
+
});
|
|
3250
|
+
children.push(close);
|
|
3251
|
+
} else {
|
|
3252
|
+
condition.children.unshift("(");
|
|
3253
|
+
conditions.forEach((c) => {
|
|
3254
|
+
return condition.children.push(" && ", c);
|
|
3255
|
+
});
|
|
3256
|
+
condition.children.push(")");
|
|
3257
|
+
}
|
|
3243
3258
|
}
|
|
3244
3259
|
}
|
|
3260
|
+
const { blockPrefix } = condition.expression;
|
|
3261
|
+
if (s.negated && blockPrefix && (s.type === "IfStatement" && isExit(s.then) || s.type === "IterationStatement")) {
|
|
3262
|
+
const { ancestor, child } = findAncestor(
|
|
3263
|
+
s,
|
|
3264
|
+
(a) => a.type === "BlockStatement"
|
|
3265
|
+
);
|
|
3266
|
+
if (!(ancestor != null)) {
|
|
3267
|
+
throw new Error("Couldn't find block for postfix declaration");
|
|
3268
|
+
}
|
|
3269
|
+
const index = findChildIndex(ancestor.expressions, child);
|
|
3270
|
+
if (index < 0) {
|
|
3271
|
+
throw new Error("Couldn't find where in block to put postfix declaration");
|
|
3272
|
+
}
|
|
3273
|
+
ancestor.expressions.splice(index + 1, 0, ...blockPrefix);
|
|
3274
|
+
updateParentPointers(ancestor);
|
|
3275
|
+
braceBlock(ancestor);
|
|
3276
|
+
let ref1;
|
|
3277
|
+
switch (s.type) {
|
|
3278
|
+
case "IfStatement": {
|
|
3279
|
+
if (ref1 = s.else?.block) {
|
|
3280
|
+
const elseBlock = ref1;
|
|
3281
|
+
if (elseBlock.bare && !elseBlock.semicolon) {
|
|
3282
|
+
elseBlock.children.push(elseBlock.semicolon = ";");
|
|
3283
|
+
}
|
|
3284
|
+
ancestor.expressions.splice(index + 1 + blockPrefix.length, 0, ["", elseBlock]);
|
|
3285
|
+
s.children = s.children.filter((a1) => a1 !== s.else);
|
|
3286
|
+
s.else = void 0;
|
|
3287
|
+
}
|
|
3288
|
+
const block = s.then;
|
|
3289
|
+
if (block.bare && !block.semicolon) {
|
|
3290
|
+
block.children.push(block.semicolon = ";");
|
|
3291
|
+
}
|
|
3292
|
+
;
|
|
3293
|
+
break;
|
|
3294
|
+
}
|
|
3295
|
+
}
|
|
3296
|
+
return;
|
|
3297
|
+
}
|
|
3245
3298
|
switch (s.type) {
|
|
3246
3299
|
case "IfStatement": {
|
|
3247
3300
|
const { else: e } = s;
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
return block;
|
|
3255
|
-
} else {
|
|
3256
|
-
return c;
|
|
3301
|
+
if (s.negated) {
|
|
3302
|
+
if (e != null) {
|
|
3303
|
+
const block = blockWithPrefix(blockPrefix, e.block);
|
|
3304
|
+
e.children = e.children.map(($1) => $1 === e.block ? block : $1);
|
|
3305
|
+
e.block = block;
|
|
3306
|
+
updateParentPointers(e);
|
|
3257
3307
|
}
|
|
3258
|
-
}
|
|
3259
|
-
|
|
3260
|
-
|
|
3308
|
+
} else {
|
|
3309
|
+
const block = blockWithPrefix(blockPrefix, s.then);
|
|
3310
|
+
if (block.bare && e && !block.semicolon) {
|
|
3311
|
+
block.children.push(block.semicolon = ";");
|
|
3312
|
+
}
|
|
3313
|
+
s.children = s.children.map(($2) => $2 === s.then ? block : $2);
|
|
3314
|
+
s.then = block;
|
|
3315
|
+
updateParentPointers(s);
|
|
3316
|
+
}
|
|
3317
|
+
;
|
|
3261
3318
|
break;
|
|
3262
3319
|
}
|
|
3263
3320
|
case "IterationStatement": {
|
|
3321
|
+
if (!blockPrefix) {
|
|
3322
|
+
return;
|
|
3323
|
+
}
|
|
3264
3324
|
const { children, block } = s;
|
|
3265
|
-
const newBlock = blockWithPrefix(
|
|
3266
|
-
s.children = children.map((
|
|
3267
|
-
updateParentPointers(
|
|
3325
|
+
const newBlock = blockWithPrefix(blockPrefix, block);
|
|
3326
|
+
s.children = children.map(($3) => $3 === block ? newBlock : $3);
|
|
3327
|
+
updateParentPointers(s);
|
|
3268
3328
|
break;
|
|
3269
3329
|
}
|
|
3270
3330
|
case "SwitchStatement": {
|
|
3271
|
-
const {
|
|
3331
|
+
const { ref: ref2, statementDeclaration } = condition.expression;
|
|
3272
3332
|
if (!blockPrefix) {
|
|
3273
3333
|
return;
|
|
3274
3334
|
}
|
|
@@ -3291,7 +3351,7 @@ ${input.slice(result.pos)}
|
|
|
3291
3351
|
const block = makeEmptyBlock();
|
|
3292
3352
|
replaceBlockExpression(s.parent, s, block);
|
|
3293
3353
|
block.expressions.push(["", s]);
|
|
3294
|
-
s.children.splice(s.children.findIndex(($
|
|
3354
|
+
s.children.splice(s.children.findIndex(($4) => $4.token === "switch"), 0, blockPrefix);
|
|
3295
3355
|
s.parent = block;
|
|
3296
3356
|
} else {
|
|
3297
3357
|
const block = blockWithPrefix([["", [{
|
|
@@ -3321,20 +3381,20 @@ ${input.slice(result.pos)}
|
|
|
3321
3381
|
const { imports } = decl;
|
|
3322
3382
|
let { star, binding, specifiers } = imports;
|
|
3323
3383
|
const justDefault = binding && !specifiers && !star;
|
|
3324
|
-
let
|
|
3384
|
+
let ref2;
|
|
3325
3385
|
{
|
|
3326
3386
|
if (binding) {
|
|
3327
3387
|
if (specifiers) {
|
|
3328
|
-
|
|
3388
|
+
ref2 = makeRef();
|
|
3329
3389
|
} else {
|
|
3330
|
-
|
|
3390
|
+
ref2 = binding;
|
|
3331
3391
|
}
|
|
3332
3392
|
} else {
|
|
3333
|
-
|
|
3393
|
+
ref2 = convertNamedImportsToObject(imports, true);
|
|
3334
3394
|
}
|
|
3335
3395
|
}
|
|
3336
3396
|
;
|
|
3337
|
-
const pattern =
|
|
3397
|
+
const pattern = ref2;
|
|
3338
3398
|
const c = "const";
|
|
3339
3399
|
const expression = [
|
|
3340
3400
|
justDefault ? "(" : void 0,
|
|
@@ -4785,6 +4845,67 @@ ${js}`
|
|
|
4785
4845
|
}
|
|
4786
4846
|
return [value, value.thisShorthand];
|
|
4787
4847
|
}
|
|
4848
|
+
function processTryBlock($0) {
|
|
4849
|
+
let [t, , b, c, e, f] = $0;
|
|
4850
|
+
if (!c && (e || !f)) {
|
|
4851
|
+
const emptyCatchBlock = makeEmptyBlock();
|
|
4852
|
+
c = {
|
|
4853
|
+
type: "CatchClause",
|
|
4854
|
+
children: [" ", "catch(e) ", emptyCatchBlock],
|
|
4855
|
+
block: emptyCatchBlock
|
|
4856
|
+
};
|
|
4857
|
+
}
|
|
4858
|
+
let hoistDec;
|
|
4859
|
+
if (e) {
|
|
4860
|
+
c = c;
|
|
4861
|
+
const ok = makeRef("ok");
|
|
4862
|
+
hoistDec = {
|
|
4863
|
+
type: "Declaration",
|
|
4864
|
+
children: ["let ", ok, " = true"],
|
|
4865
|
+
names: []
|
|
4866
|
+
};
|
|
4867
|
+
replaceNode(
|
|
4868
|
+
c.block,
|
|
4869
|
+
blockWithPrefix([["", "ok = false"]], c.block),
|
|
4870
|
+
c
|
|
4871
|
+
);
|
|
4872
|
+
const condition = {
|
|
4873
|
+
type: "ParenthesizedExpression",
|
|
4874
|
+
children: ["(", ok, ")"],
|
|
4875
|
+
expression: ok
|
|
4876
|
+
};
|
|
4877
|
+
const i = makeNode({
|
|
4878
|
+
type: "IfStatement",
|
|
4879
|
+
children: ["if", condition, e.block],
|
|
4880
|
+
condition,
|
|
4881
|
+
then: e.block,
|
|
4882
|
+
else: void 0
|
|
4883
|
+
});
|
|
4884
|
+
if (!f) {
|
|
4885
|
+
const emptyFinallyBlock = makeEmptyBlock();
|
|
4886
|
+
f = {
|
|
4887
|
+
type: "FinallyClause",
|
|
4888
|
+
children: [" ", "finally ", emptyFinallyBlock],
|
|
4889
|
+
block: emptyFinallyBlock
|
|
4890
|
+
};
|
|
4891
|
+
}
|
|
4892
|
+
replaceNode(
|
|
4893
|
+
f.block,
|
|
4894
|
+
blockWithPrefix([["", i]], f.block),
|
|
4895
|
+
f
|
|
4896
|
+
);
|
|
4897
|
+
}
|
|
4898
|
+
const blocks = [b];
|
|
4899
|
+
if (c) {
|
|
4900
|
+
blocks.push(c.block);
|
|
4901
|
+
}
|
|
4902
|
+
return {
|
|
4903
|
+
type: "TryStatement",
|
|
4904
|
+
blocks,
|
|
4905
|
+
children: [t, b, c, f],
|
|
4906
|
+
hoistDec
|
|
4907
|
+
};
|
|
4908
|
+
}
|
|
4788
4909
|
function processCallMemberExpression(node) {
|
|
4789
4910
|
const { children } = node;
|
|
4790
4911
|
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") {
|
|
@@ -5526,25 +5647,29 @@ ${js}`
|
|
|
5526
5647
|
}
|
|
5527
5648
|
function processNegativeIndexAccess(statements) {
|
|
5528
5649
|
gatherRecursiveAll(statements, (n) => n.type === "NegativeIndex").forEach((exp) => {
|
|
5529
|
-
const {
|
|
5530
|
-
|
|
5650
|
+
const { children } = exp.parent;
|
|
5651
|
+
let start = 0;
|
|
5652
|
+
while (start < children.length && isWhitespaceOrEmpty(children[start])) {
|
|
5653
|
+
start++;
|
|
5654
|
+
}
|
|
5655
|
+
const index = children.indexOf(exp);
|
|
5531
5656
|
let ref, subexp;
|
|
5532
|
-
if (index === 1) {
|
|
5533
|
-
const child =
|
|
5657
|
+
if (index === start + 1) {
|
|
5658
|
+
const child = children[start];
|
|
5534
5659
|
ref = maybeRef(child);
|
|
5535
5660
|
if (ref !== child) {
|
|
5536
|
-
subexp =
|
|
5661
|
+
subexp = children.splice(start, 1);
|
|
5537
5662
|
}
|
|
5538
|
-
} else if (index > 1) {
|
|
5663
|
+
} else if (index > start + 1) {
|
|
5539
5664
|
ref = makeRef();
|
|
5540
|
-
subexp =
|
|
5665
|
+
subexp = children.splice(start, index);
|
|
5541
5666
|
} else {
|
|
5542
5667
|
throw new Error("Invalid parse tree for negative index access");
|
|
5543
5668
|
}
|
|
5544
5669
|
if (subexp) {
|
|
5545
5670
|
const { hoistDec, refAssignment } = makeRefAssignment(ref, subexp);
|
|
5546
5671
|
exp.hoistDec = hoistDec;
|
|
5547
|
-
|
|
5672
|
+
children.splice(start, 0, makeLeftHandSideExpression(refAssignment));
|
|
5548
5673
|
}
|
|
5549
5674
|
return exp.len.children = [
|
|
5550
5675
|
ref,
|
|
@@ -5617,6 +5742,7 @@ ${js}`
|
|
|
5617
5742
|
}
|
|
5618
5743
|
function processPlaceholders(statements) {
|
|
5619
5744
|
const placeholderMap = /* @__PURE__ */ new Map();
|
|
5745
|
+
const liftedIfs = /* @__PURE__ */ new Set();
|
|
5620
5746
|
gatherRecursiveAll(statements, ($3) => $3.type === "Placeholder").forEach((_exp) => {
|
|
5621
5747
|
const exp = _exp;
|
|
5622
5748
|
let ancestor;
|
|
@@ -5637,9 +5763,15 @@ ${js}`
|
|
|
5637
5763
|
let child;
|
|
5638
5764
|
({ ancestor, child } = findAncestor(exp, (ancestor2, child2) => {
|
|
5639
5765
|
const { type } = ancestor2;
|
|
5640
|
-
|
|
5766
|
+
if (type === "IfStatement") {
|
|
5767
|
+
liftedIfs.add(ancestor2);
|
|
5768
|
+
}
|
|
5769
|
+
let m;
|
|
5770
|
+
let m1;
|
|
5771
|
+
return type === "Call" || // Block, except for if/else blocks when condition already lifted
|
|
5772
|
+
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
|
|
5641
5773
|
type === "Initializer" || // Right-hand side of assignment
|
|
5642
|
-
type === "AssignmentExpression" && ancestor2
|
|
5774
|
+
type === "AssignmentExpression" && findChildIndex(ancestor2, child2) === ancestor2.children.indexOf(ancestor2.expression) || type === "ReturnStatement" || type === "YieldExpression";
|
|
5643
5775
|
}));
|
|
5644
5776
|
switch (ancestor?.type) {
|
|
5645
5777
|
case "Call": {
|
|
@@ -6007,7 +6139,7 @@ ${js}`
|
|
|
6007
6139
|
PrimaryExpression,
|
|
6008
6140
|
ParenthesizedExpression,
|
|
6009
6141
|
Placeholder,
|
|
6010
|
-
|
|
6142
|
+
PlaceholderTypeSuffix,
|
|
6011
6143
|
ClassDeclaration,
|
|
6012
6144
|
ClassExpression,
|
|
6013
6145
|
ClassBinding,
|
|
@@ -6213,7 +6345,6 @@ ${js}`
|
|
|
6213
6345
|
IfStatement,
|
|
6214
6346
|
ElseClause,
|
|
6215
6347
|
IfClause,
|
|
6216
|
-
UnlessClause,
|
|
6217
6348
|
IterationStatement,
|
|
6218
6349
|
_IterationStatement,
|
|
6219
6350
|
IterationExpression,
|
|
@@ -6904,7 +7035,7 @@ ${js}`
|
|
|
6904
7035
|
var $R3 = (0, import_lib3.$R)(new RegExp("[0-9]", "suy"));
|
|
6905
7036
|
var $R4 = (0, import_lib3.$R)(new RegExp("(?!\\p{ID_Start}|[_$0-9(\\[{])", "suy"));
|
|
6906
7037
|
var $R5 = (0, import_lib3.$R)(new RegExp("[ \\t]", "suy"));
|
|
6907
|
-
var $R6 = (0, import_lib3.$R)(new RegExp("(?:\\p{ID_Continue}|[\\u200C\\u200D
|
|
7038
|
+
var $R6 = (0, import_lib3.$R)(new RegExp("(?:\\p{ID_Continue}|[\\u200C\\u200D$.#])", "suy"));
|
|
6908
7039
|
var $R7 = (0, import_lib3.$R)(new RegExp("[&=]", "suy"));
|
|
6909
7040
|
var $R8 = (0, import_lib3.$R)(new RegExp("(?=['\"`])", "suy"));
|
|
6910
7041
|
var $R9 = (0, import_lib3.$R)(new RegExp("(?=[\\/?])", "suy"));
|
|
@@ -7878,15 +8009,17 @@ ${js}`
|
|
|
7878
8009
|
function ParenthesizedExpression(ctx, state2) {
|
|
7879
8010
|
return (0, import_lib3.$EVENT)(ctx, state2, "ParenthesizedExpression", ParenthesizedExpression$0);
|
|
7880
8011
|
}
|
|
7881
|
-
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
|
|
8012
|
+
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) {
|
|
7882
8013
|
var dot = $1;
|
|
8014
|
+
var typeSuffix = $3;
|
|
7883
8015
|
return {
|
|
7884
8016
|
type: "Placeholder",
|
|
7885
8017
|
subtype: ".",
|
|
8018
|
+
typeSuffix,
|
|
7886
8019
|
children: [dot]
|
|
7887
8020
|
};
|
|
7888
8021
|
});
|
|
7889
|
-
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)(
|
|
8022
|
+
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) {
|
|
7890
8023
|
var amp = $1;
|
|
7891
8024
|
var typeSuffix = $3;
|
|
7892
8025
|
return {
|
|
@@ -7907,11 +8040,11 @@ ${js}`
|
|
|
7907
8040
|
function Placeholder(ctx, state2) {
|
|
7908
8041
|
return (0, import_lib3.$EVENT_C)(ctx, state2, "Placeholder", Placeholder$$);
|
|
7909
8042
|
}
|
|
7910
|
-
var
|
|
8043
|
+
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) {
|
|
7911
8044
|
return value[1];
|
|
7912
8045
|
});
|
|
7913
|
-
function
|
|
7914
|
-
return (0, import_lib3.$EVENT)(ctx, state2, "
|
|
8046
|
+
function PlaceholderTypeSuffix(ctx, state2) {
|
|
8047
|
+
return (0, import_lib3.$EVENT)(ctx, state2, "PlaceholderTypeSuffix", PlaceholderTypeSuffix$0);
|
|
7915
8048
|
}
|
|
7916
8049
|
var ClassDeclaration$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(ClassExpression), function($skip, $loc, $0, $1) {
|
|
7917
8050
|
if ($1.id)
|
|
@@ -8125,7 +8258,8 @@ ${js}`
|
|
|
8125
8258
|
children: $0
|
|
8126
8259
|
};
|
|
8127
8260
|
});
|
|
8128
|
-
var ClassElement
|
|
8261
|
+
var ClassElement$2 = EmptyStatement;
|
|
8262
|
+
var ClassElement$$ = [ClassElement$0, ClassElement$1, ClassElement$2];
|
|
8129
8263
|
function ClassElement(ctx, state2) {
|
|
8130
8264
|
return (0, import_lib3.$EVENT_C)(ctx, state2, "ClassElement", ClassElement$$);
|
|
8131
8265
|
}
|
|
@@ -10709,18 +10843,7 @@ ${js}`
|
|
|
10709
10843
|
implicit: true
|
|
10710
10844
|
};
|
|
10711
10845
|
});
|
|
10712
|
-
var ComputedPropertyName
|
|
10713
|
-
var open = $2;
|
|
10714
|
-
var expression = $3;
|
|
10715
|
-
var close = $4;
|
|
10716
|
-
return {
|
|
10717
|
-
type: "ComputedPropertyName",
|
|
10718
|
-
expression,
|
|
10719
|
-
children: [open, expression, close],
|
|
10720
|
-
implicit: true
|
|
10721
|
-
};
|
|
10722
|
-
});
|
|
10723
|
-
var ComputedPropertyName$$ = [ComputedPropertyName$0, ComputedPropertyName$1, ComputedPropertyName$2, ComputedPropertyName$3];
|
|
10846
|
+
var ComputedPropertyName$$ = [ComputedPropertyName$0, ComputedPropertyName$1, ComputedPropertyName$2];
|
|
10724
10847
|
function ComputedPropertyName(ctx, state2) {
|
|
10725
10848
|
return (0, import_lib3.$EVENT_C)(ctx, state2, "ComputedPropertyName", ComputedPropertyName$$);
|
|
10726
10849
|
}
|
|
@@ -11512,9 +11635,8 @@ ${js}`
|
|
|
11512
11635
|
var _PostfixStatement$0 = ForClause;
|
|
11513
11636
|
var _PostfixStatement$1 = IfClause;
|
|
11514
11637
|
var _PostfixStatement$2 = LoopClause;
|
|
11515
|
-
var _PostfixStatement$3 =
|
|
11516
|
-
var _PostfixStatement
|
|
11517
|
-
var _PostfixStatement$$ = [_PostfixStatement$0, _PostfixStatement$1, _PostfixStatement$2, _PostfixStatement$3, _PostfixStatement$4];
|
|
11638
|
+
var _PostfixStatement$3 = WhileClause;
|
|
11639
|
+
var _PostfixStatement$$ = [_PostfixStatement$0, _PostfixStatement$1, _PostfixStatement$2, _PostfixStatement$3];
|
|
11518
11640
|
function _PostfixStatement(ctx, state2) {
|
|
11519
11641
|
return (0, import_lib3.$EVENT_C)(ctx, state2, "_PostfixStatement", _PostfixStatement$$);
|
|
11520
11642
|
}
|
|
@@ -11594,7 +11716,7 @@ ${js}`
|
|
|
11594
11716
|
function LabelledItem(ctx, state2) {
|
|
11595
11717
|
return (0, import_lib3.$EVENT_C)(ctx, state2, "LabelledItem", LabelledItem$$);
|
|
11596
11718
|
}
|
|
11597
|
-
var IfStatement$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(
|
|
11719
|
+
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) {
|
|
11598
11720
|
var clause = $1;
|
|
11599
11721
|
var block = $2;
|
|
11600
11722
|
var e = $3;
|
|
@@ -11602,6 +11724,7 @@ ${js}`
|
|
|
11602
11724
|
type: "IfStatement",
|
|
11603
11725
|
children: [...clause.children, block, e],
|
|
11604
11726
|
condition: clause.condition,
|
|
11727
|
+
negated: clause.negated,
|
|
11605
11728
|
then: block,
|
|
11606
11729
|
else: e
|
|
11607
11730
|
};
|
|
@@ -11616,33 +11739,24 @@ ${js}`
|
|
|
11616
11739
|
function ElseClause(ctx, state2) {
|
|
11617
11740
|
return (0, import_lib3.$EVENT)(ctx, state2, "ElseClause", ElseClause$0);
|
|
11618
11741
|
}
|
|
11619
|
-
var IfClause$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(If, Condition), function($skip, $loc, $0, $1, $2) {
|
|
11620
|
-
var
|
|
11742
|
+
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) {
|
|
11743
|
+
var kind = $1;
|
|
11744
|
+
var ws = $2;
|
|
11745
|
+
var condition = $3;
|
|
11746
|
+
if (kind.negated) {
|
|
11747
|
+
kind = { ...kind, token: "if" };
|
|
11748
|
+
condition = negateCondition(condition);
|
|
11749
|
+
}
|
|
11621
11750
|
return {
|
|
11622
11751
|
type: "IfStatement",
|
|
11623
|
-
children:
|
|
11624
|
-
condition
|
|
11752
|
+
children: [kind, ws, condition],
|
|
11753
|
+
condition,
|
|
11754
|
+
negated: kind.negated
|
|
11625
11755
|
};
|
|
11626
11756
|
});
|
|
11627
11757
|
function IfClause(ctx, state2) {
|
|
11628
11758
|
return (0, import_lib3.$EVENT)(ctx, state2, "IfClause", IfClause$0);
|
|
11629
11759
|
}
|
|
11630
|
-
var UnlessClause$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(Unless, Condition), function($skip, $loc, $0, $1, $2) {
|
|
11631
|
-
var kind = $1;
|
|
11632
|
-
var condition = $2;
|
|
11633
|
-
kind = { ...kind, token: "if" };
|
|
11634
|
-
kind.token += getTrimmingSpace(condition);
|
|
11635
|
-
condition = insertTrimmingSpace(condition, "");
|
|
11636
|
-
condition = negateCondition(condition);
|
|
11637
|
-
return {
|
|
11638
|
-
type: "IfStatement",
|
|
11639
|
-
children: [kind, condition],
|
|
11640
|
-
condition
|
|
11641
|
-
};
|
|
11642
|
-
});
|
|
11643
|
-
function UnlessClause(ctx, state2) {
|
|
11644
|
-
return (0, import_lib3.$EVENT)(ctx, state2, "UnlessClause", UnlessClause$0);
|
|
11645
|
-
}
|
|
11646
11760
|
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) {
|
|
11647
11761
|
return value[1];
|
|
11648
11762
|
});
|
|
@@ -11772,7 +11886,7 @@ ${js}`
|
|
|
11772
11886
|
var kind = $1;
|
|
11773
11887
|
var ws = $2;
|
|
11774
11888
|
var condition = $3;
|
|
11775
|
-
if (kind.
|
|
11889
|
+
if (kind.negated) {
|
|
11776
11890
|
kind = { ...kind, token: "while" };
|
|
11777
11891
|
condition = negateCondition(condition);
|
|
11778
11892
|
}
|
|
@@ -11780,7 +11894,8 @@ ${js}`
|
|
|
11780
11894
|
type: "IterationStatement",
|
|
11781
11895
|
subtype: kind.token,
|
|
11782
11896
|
children: [kind, ws, condition],
|
|
11783
|
-
condition
|
|
11897
|
+
condition,
|
|
11898
|
+
negated: kind.negated
|
|
11784
11899
|
};
|
|
11785
11900
|
});
|
|
11786
11901
|
function WhileClause(ctx, state2) {
|
|
@@ -12255,32 +12370,8 @@ ${js}`
|
|
|
12255
12370
|
function IgnoreColon(ctx, state2) {
|
|
12256
12371
|
return (0, import_lib3.$EVENT)(ctx, state2, "IgnoreColon", IgnoreColon$0);
|
|
12257
12372
|
}
|
|
12258
|
-
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) {
|
|
12259
|
-
|
|
12260
|
-
var b = $3;
|
|
12261
|
-
var c = $4;
|
|
12262
|
-
var f = $5;
|
|
12263
|
-
if (!c && !f) {
|
|
12264
|
-
const emptyCatchBlock = makeEmptyBlock();
|
|
12265
|
-
c = {
|
|
12266
|
-
type: "CatchClause",
|
|
12267
|
-
children: [" catch(e) ", emptyCatchBlock],
|
|
12268
|
-
block: emptyCatchBlock
|
|
12269
|
-
};
|
|
12270
|
-
return {
|
|
12271
|
-
type: "TryStatement",
|
|
12272
|
-
blocks: [b, emptyCatchBlock],
|
|
12273
|
-
children: [t, b, c]
|
|
12274
|
-
};
|
|
12275
|
-
}
|
|
12276
|
-
const blocks = [b];
|
|
12277
|
-
if (c)
|
|
12278
|
-
blocks.push(c.block);
|
|
12279
|
-
return {
|
|
12280
|
-
type: "TryStatement",
|
|
12281
|
-
blocks,
|
|
12282
|
-
children: [t, b, c, f]
|
|
12283
|
-
};
|
|
12373
|
+
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) {
|
|
12374
|
+
return processTryBlock($0);
|
|
12284
12375
|
});
|
|
12285
12376
|
function TryStatement(ctx, state2) {
|
|
12286
12377
|
return (0, import_lib3.$EVENT)(ctx, state2, "TryStatement", TryStatement$0);
|
|
@@ -12302,7 +12393,14 @@ ${js}`
|
|
|
12302
12393
|
function CatchBind(ctx, state2) {
|
|
12303
12394
|
return (0, import_lib3.$EVENT_C)(ctx, state2, "CatchBind", CatchBind$$);
|
|
12304
12395
|
}
|
|
12305
|
-
var FinallyClause$0 = (0, import_lib3.$S)((0, import_lib3.$C)(Nested, _), Finally, (0, import_lib3.$C)(BracedThenClause, BracedOrEmptyBlock))
|
|
12396
|
+
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) {
|
|
12397
|
+
var block = $3;
|
|
12398
|
+
return {
|
|
12399
|
+
type: "FinallyClause",
|
|
12400
|
+
children: $0,
|
|
12401
|
+
block
|
|
12402
|
+
};
|
|
12403
|
+
});
|
|
12306
12404
|
function FinallyClause(ctx, state2) {
|
|
12307
12405
|
return (0, import_lib3.$EVENT)(ctx, state2, "FinallyClause", FinallyClause$0);
|
|
12308
12406
|
}
|
|
@@ -12359,7 +12457,8 @@ ${js}`
|
|
|
12359
12457
|
return $skip;
|
|
12360
12458
|
return {
|
|
12361
12459
|
type: "DeclarationCondition",
|
|
12362
|
-
declaration
|
|
12460
|
+
declaration,
|
|
12461
|
+
children: [declaration]
|
|
12363
12462
|
};
|
|
12364
12463
|
});
|
|
12365
12464
|
function DeclarationCondition(ctx, state2) {
|
|
@@ -14159,7 +14258,7 @@ ${js}`
|
|
|
14159
14258
|
return (0, import_lib3.$EVENT)(ctx, state2, "Unless", Unless$0);
|
|
14160
14259
|
}
|
|
14161
14260
|
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) {
|
|
14162
|
-
return { $loc, token: $1 };
|
|
14261
|
+
return { $loc, token: $1, negated: true };
|
|
14163
14262
|
});
|
|
14164
14263
|
function Until(ctx, state2) {
|
|
14165
14264
|
return (0, import_lib3.$EVENT)(ctx, state2, "Until", Until$0);
|
package/dist/config.js
CHANGED
|
@@ -31,6 +31,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
31
31
|
var config_exports = {};
|
|
32
32
|
__export(config_exports, {
|
|
33
33
|
findConfig: () => findConfig,
|
|
34
|
+
findInDir: () => findInDir,
|
|
34
35
|
loadConfig: () => loadConfig
|
|
35
36
|
});
|
|
36
37
|
module.exports = __toCommonJS(config_exports);
|
|
@@ -41,14 +42,16 @@ var configFileNames = /* @__PURE__ */ new Set([
|
|
|
41
42
|
"\u{1F408}.json",
|
|
42
43
|
"\u{1F408}.civet",
|
|
43
44
|
"civetconfig.json",
|
|
44
|
-
"civetconfig.civet"
|
|
45
|
+
"civetconfig.civet",
|
|
46
|
+
"civet.config.json",
|
|
47
|
+
"civet.config.civet"
|
|
45
48
|
]);
|
|
46
49
|
async function findInDir(dirPath) {
|
|
47
50
|
for (const entryName of await import_promises.default.readdir(dirPath)) {
|
|
48
51
|
const entryPath = import_path.default.join(dirPath, entryName);
|
|
49
52
|
if (entryName === ".config" && await (async () => {
|
|
50
53
|
try {
|
|
51
|
-
return (await import_promises.default.stat(entryPath)).
|
|
54
|
+
return (await import_promises.default.stat(entryPath)).isDirectory();
|
|
52
55
|
} catch (e) {
|
|
53
56
|
return;
|
|
54
57
|
}
|
|
@@ -119,5 +122,6 @@ async function loadConfig(path2) {
|
|
|
119
122
|
// Annotate the CommonJS export names for ESM import in node:
|
|
120
123
|
0 && (module.exports = {
|
|
121
124
|
findConfig,
|
|
125
|
+
findInDir,
|
|
122
126
|
loadConfig
|
|
123
127
|
});
|
package/dist/esbuild.d.mts
CHANGED