@danielx/civet 0.10.6 → 0.11.0
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/CHANGELOG.md +19 -0
- package/dist/browser.js +386 -148
- package/dist/civet +5 -7
- package/dist/config.js +1 -1
- package/dist/config.mjs +2 -2
- package/dist/esbuild-plugin.js +1 -1
- package/dist/esm.mjs +1 -1
- package/dist/main.js +479 -160
- package/dist/main.mjs +478 -160
- package/dist/node-worker.mjs +1 -1
- package/dist/types.d.ts +89 -11
- package/dist/unplugin/unplugin.js +2 -4
- package/dist/unplugin/unplugin.mjs +3 -5
- package/package.json +2 -2
- package/register.js +2 -2
package/dist/main.js
CHANGED
|
@@ -490,6 +490,7 @@ __export(main_civet_exports, {
|
|
|
490
490
|
ParseErrors: () => ParseErrors,
|
|
491
491
|
SourceMap: () => SourceMap2,
|
|
492
492
|
compile: () => compile,
|
|
493
|
+
decode: () => decode,
|
|
493
494
|
default: () => main_civet_default,
|
|
494
495
|
generate: () => generate_civet_default,
|
|
495
496
|
isCompileError: () => isCompileError,
|
|
@@ -623,7 +624,7 @@ function addParentPointers(node, parent) {
|
|
|
623
624
|
node.parent = parent;
|
|
624
625
|
}
|
|
625
626
|
if (node.children) {
|
|
626
|
-
for (let ref = node.children, i1 = 0,
|
|
627
|
+
for (let ref = node.children, i1 = 0, len12 = ref.length; i1 < len12; i1++) {
|
|
627
628
|
const child = ref[i1];
|
|
628
629
|
addParentPointers(child, node);
|
|
629
630
|
}
|
|
@@ -1607,7 +1608,7 @@ function findChildIndex(parent, child) {
|
|
|
1607
1608
|
}
|
|
1608
1609
|
}
|
|
1609
1610
|
function arrayRecurse(array) {
|
|
1610
|
-
for (let i2 = 0,
|
|
1611
|
+
for (let i2 = 0, len12 = array.length; i2 < len12; i2++) {
|
|
1611
1612
|
const c = array[i2];
|
|
1612
1613
|
if (c === child || Array.isArray(c) && arrayRecurse(c)) {
|
|
1613
1614
|
return true;
|
|
@@ -1814,7 +1815,7 @@ function adjustBindingElements(elements) {
|
|
|
1814
1815
|
const names = elements.flatMap(($2) => $2.names || []);
|
|
1815
1816
|
const { length } = elements;
|
|
1816
1817
|
let blockPrefix, restIndex = -1, restCount = 0;
|
|
1817
|
-
for (let i2 = 0,
|
|
1818
|
+
for (let i2 = 0, len12 = elements.length; i2 < len12; i2++) {
|
|
1818
1819
|
const i = i2;
|
|
1819
1820
|
const { type } = elements[i2];
|
|
1820
1821
|
if (type === "BindingRestElement") {
|
|
@@ -3073,7 +3074,7 @@ function patternBindings(pattern) {
|
|
|
3073
3074
|
function recurse(pattern2) {
|
|
3074
3075
|
switch (pattern2.type) {
|
|
3075
3076
|
case "ArrayBindingPattern": {
|
|
3076
|
-
for (let ref3 = pattern2.elements, i2 = 0,
|
|
3077
|
+
for (let ref3 = pattern2.elements, i2 = 0, len12 = ref3.length; i2 < len12; i2++) {
|
|
3077
3078
|
const element = ref3[i2];
|
|
3078
3079
|
recurse(element);
|
|
3079
3080
|
}
|
|
@@ -4043,7 +4044,11 @@ function processSignature(f) {
|
|
|
4043
4044
|
}
|
|
4044
4045
|
}
|
|
4045
4046
|
if (signature.modifier.async && !signature.modifier.generator && signature.returnType && !isPromiseType(signature.returnType.t)) {
|
|
4046
|
-
replaceNode(
|
|
4047
|
+
replaceNode(
|
|
4048
|
+
signature.returnType.t,
|
|
4049
|
+
wrapTypeInPromise(signature.returnType.t),
|
|
4050
|
+
signature.returnType
|
|
4051
|
+
);
|
|
4047
4052
|
}
|
|
4048
4053
|
}
|
|
4049
4054
|
function processFunctions(statements, config2) {
|
|
@@ -4072,14 +4077,23 @@ function expressionizeIteration(exp) {
|
|
|
4072
4077
|
if (generator) {
|
|
4073
4078
|
iterationDefaultBody(statement);
|
|
4074
4079
|
assignResults(block, (node) => {
|
|
4080
|
+
let star;
|
|
4081
|
+
if (node && typeof node === "object" && "type" in node && node.type === "SpreadElement" && "expression" in node) {
|
|
4082
|
+
const { expression } = node;
|
|
4083
|
+
star = "*";
|
|
4084
|
+
node = expression;
|
|
4085
|
+
}
|
|
4075
4086
|
return {
|
|
4076
4087
|
type: "YieldExpression",
|
|
4077
4088
|
expression: node,
|
|
4089
|
+
star,
|
|
4078
4090
|
children: [
|
|
4079
4091
|
{
|
|
4080
4092
|
type: "Yield",
|
|
4081
|
-
|
|
4093
|
+
children: ["yield"]
|
|
4082
4094
|
},
|
|
4095
|
+
star,
|
|
4096
|
+
" ",
|
|
4083
4097
|
node
|
|
4084
4098
|
]
|
|
4085
4099
|
};
|
|
@@ -4273,6 +4287,17 @@ function braceBlock(block) {
|
|
|
4273
4287
|
}
|
|
4274
4288
|
}
|
|
4275
4289
|
}
|
|
4290
|
+
function unbraceBlock(block) {
|
|
4291
|
+
if (block.bare) {
|
|
4292
|
+
return;
|
|
4293
|
+
}
|
|
4294
|
+
let ref;
|
|
4295
|
+
if (block.children[0] === " {" && (ref = block.children)[ref.length - 1] === "}") {
|
|
4296
|
+
block.children.shift();
|
|
4297
|
+
block.children.pop();
|
|
4298
|
+
block.bare = true;
|
|
4299
|
+
}
|
|
4300
|
+
}
|
|
4276
4301
|
function duplicateBlock(block) {
|
|
4277
4302
|
const expressions = [...block.expressions];
|
|
4278
4303
|
let children;
|
|
@@ -4371,16 +4396,58 @@ function insertHoistDec(block, node, dec) {
|
|
|
4371
4396
|
}
|
|
4372
4397
|
function processBlocks(statements) {
|
|
4373
4398
|
insertSemicolon(statements);
|
|
4374
|
-
for (let
|
|
4375
|
-
const
|
|
4376
|
-
|
|
4399
|
+
for (let ref1 = gatherRecursive(statements, ($) => $.type === "BlockStatement"), i2 = 0, len12 = ref1.length; i2 < len12; i2++) {
|
|
4400
|
+
const block = ref1[i2];
|
|
4401
|
+
let m;
|
|
4402
|
+
if (block.unwrapObject && block.expressions.length === 1 && (m = block.expressions[0][1], typeof m === "object" && m != null && "type" in m && m.type === "ParenthesizedExpression" && "implicit" in m && m.implicit === true && "expression" in m && typeof m.expression === "object" && m.expression != null && "type" in m.expression && m.expression.type === "ObjectExpression")) {
|
|
4403
|
+
const object = block.expressions[0][1].expression;
|
|
4404
|
+
if (!(() => {
|
|
4405
|
+
let results = true;
|
|
4406
|
+
for (const prop of object.properties) {
|
|
4407
|
+
if (!(prop.type === "Property" && prop.implicitName)) {
|
|
4408
|
+
results = false;
|
|
4409
|
+
break;
|
|
4410
|
+
}
|
|
4411
|
+
}
|
|
4412
|
+
return results;
|
|
4413
|
+
})()) {
|
|
4414
|
+
continue;
|
|
4415
|
+
}
|
|
4416
|
+
block.expressions[0][1] = block.expressions[0][1].expression;
|
|
4417
|
+
unbraceBlock(block);
|
|
4418
|
+
for (let ref2 = object.properties, i3 = 0, len22 = ref2.length; i3 < len22; i3++) {
|
|
4419
|
+
const i = i3;
|
|
4420
|
+
const prop = ref2[i3];
|
|
4421
|
+
let m1;
|
|
4422
|
+
if (m1 = prop.name, typeof m1 === "object" && m1 != null && "type" in m1 && m1.type === "ComputedPropertyName" && "implicit" in m1 && m1.implicit === true) {
|
|
4423
|
+
replaceNode(prop.name, prop.name.expression, prop);
|
|
4424
|
+
}
|
|
4425
|
+
if (prop.delim?.implicit) {
|
|
4426
|
+
if (needsPrecedingSemicolon(object.properties[i + 1])) {
|
|
4427
|
+
prop.delim.token = ";";
|
|
4428
|
+
} else {
|
|
4429
|
+
replaceNode(prop.delim, void 0, prop);
|
|
4430
|
+
prop.delim = void 0;
|
|
4431
|
+
}
|
|
4432
|
+
}
|
|
4433
|
+
const colon = prop.children.indexOf(": ");
|
|
4434
|
+
if (colon < 0) {
|
|
4435
|
+
continue;
|
|
4436
|
+
}
|
|
4437
|
+
if (!(prop.children[colon - 1] === prop.name)) {
|
|
4438
|
+
continue;
|
|
4439
|
+
}
|
|
4440
|
+
prop.children.splice(colon - 1, 2);
|
|
4441
|
+
}
|
|
4442
|
+
}
|
|
4443
|
+
processBlocks(block.expressions);
|
|
4377
4444
|
}
|
|
4378
4445
|
}
|
|
4379
4446
|
function insertSemicolon(statements) {
|
|
4380
4447
|
const l = statements.length;
|
|
4381
|
-
for (let
|
|
4382
|
-
const i =
|
|
4383
|
-
const s = statements[
|
|
4448
|
+
for (let i4 = 0, len3 = statements.length; i4 < len3; i4++) {
|
|
4449
|
+
const i = i4;
|
|
4450
|
+
const s = statements[i4];
|
|
4384
4451
|
if (i < l - 1) {
|
|
4385
4452
|
if (needsPrecedingSemicolon(statements[i + 1][1])) {
|
|
4386
4453
|
const delim = s[2];
|
|
@@ -4398,8 +4465,8 @@ function needsPrecedingSemicolon(exp) {
|
|
|
4398
4465
|
return false;
|
|
4399
4466
|
}
|
|
4400
4467
|
if (Array.isArray(exp)) {
|
|
4401
|
-
for (let
|
|
4402
|
-
const child = exp[
|
|
4468
|
+
for (let i5 = 0, len4 = exp.length; i5 < len4; i5++) {
|
|
4469
|
+
const child = exp[i5];
|
|
4403
4470
|
if (!(child != null)) {
|
|
4404
4471
|
continue;
|
|
4405
4472
|
}
|
|
@@ -4445,8 +4512,8 @@ function needsPrecedingSemicolon(exp) {
|
|
|
4445
4512
|
function blockContainingStatement(exp) {
|
|
4446
4513
|
let child = exp;
|
|
4447
4514
|
let parent = exp.parent;
|
|
4448
|
-
let
|
|
4449
|
-
while (parent != null && (
|
|
4515
|
+
let m2;
|
|
4516
|
+
while (parent != null && (m2 = parent.type, m2 === "StatementExpression" || m2 === "PipelineExpression" || m2 === "UnwrappedExpression")) {
|
|
4450
4517
|
child = parent;
|
|
4451
4518
|
parent = parent.parent;
|
|
4452
4519
|
}
|
|
@@ -4499,7 +4566,7 @@ var precedenceMap = /* @__PURE__ */ new Map();
|
|
|
4499
4566
|
for (let i1 = 0, len3 = precedenceOrder.length; i1 < len3; i1++) {
|
|
4500
4567
|
const prec = i1;
|
|
4501
4568
|
const ops = precedenceOrder[i1];
|
|
4502
|
-
for (let i2 = 0,
|
|
4569
|
+
for (let i2 = 0, len12 = ops.length; i2 < len12; i2++) {
|
|
4503
4570
|
const op = ops[i2];
|
|
4504
4571
|
precedenceMap.set(op, prec);
|
|
4505
4572
|
}
|
|
@@ -4830,7 +4897,7 @@ function processPatternMatching(statements) {
|
|
|
4830
4897
|
let isPattern = false;
|
|
4831
4898
|
if (clauses.some(($4) => $4.type === "PatternClause")) {
|
|
4832
4899
|
isPattern = true;
|
|
4833
|
-
for (let i2 = 0,
|
|
4900
|
+
for (let i2 = 0, len12 = clauses.length; i2 < len12; i2++) {
|
|
4834
4901
|
const c = clauses[i2];
|
|
4835
4902
|
if (!(c.type === "PatternClause" || c.type === "DefaultClause")) {
|
|
4836
4903
|
errors = true;
|
|
@@ -5364,7 +5431,7 @@ function processAssignmentDeclaration(decl, pattern, typeSuffix, ws, assign, e)
|
|
|
5364
5431
|
});
|
|
5365
5432
|
}
|
|
5366
5433
|
function processDeclarations(statements) {
|
|
5367
|
-
for (let ref1 = gatherRecursiveAll(statements, ($) => $.type === "Declaration"), i1 = 0,
|
|
5434
|
+
for (let ref1 = gatherRecursiveAll(statements, ($) => $.type === "Declaration"), i1 = 0, len12 = ref1.length; i1 < len12; i1++) {
|
|
5368
5435
|
const declaration = ref1[i1];
|
|
5369
5436
|
const { bindings } = declaration;
|
|
5370
5437
|
if (!(bindings != null)) {
|
|
@@ -5451,7 +5518,7 @@ function prependStatementExpressionBlock(initializer, statement) {
|
|
|
5451
5518
|
}
|
|
5452
5519
|
const pre = [];
|
|
5453
5520
|
const statementExp = exp.statement;
|
|
5454
|
-
const blockStatement = ["", statementExp];
|
|
5521
|
+
const blockStatement = [ws || "", statementExp, ";"];
|
|
5455
5522
|
let ref;
|
|
5456
5523
|
if (statementExp.type === "IterationExpression") {
|
|
5457
5524
|
if (statementExp.async || statementExp.generator) {
|
|
@@ -5473,9 +5540,9 @@ function prependStatementExpressionBlock(initializer, statement) {
|
|
|
5473
5540
|
});
|
|
5474
5541
|
const refDec = {
|
|
5475
5542
|
type: "Declaration",
|
|
5476
|
-
children: ["let ", ref
|
|
5543
|
+
children: ["let ", ref]
|
|
5477
5544
|
};
|
|
5478
|
-
pre.unshift(refDec);
|
|
5545
|
+
pre.unshift(["", refDec, ";"]);
|
|
5479
5546
|
} else {
|
|
5480
5547
|
wrapIterationReturningResults(statement2, () => void 0);
|
|
5481
5548
|
ref = initializer.expression = initializer.children[2] = statement2.resultsRef;
|
|
@@ -5491,14 +5558,11 @@ function prependStatementExpressionBlock(initializer, statement) {
|
|
|
5491
5558
|
});
|
|
5492
5559
|
const refDec = {
|
|
5493
5560
|
type: "Declaration",
|
|
5494
|
-
children: ["let ", ref
|
|
5561
|
+
children: ["let ", ref]
|
|
5495
5562
|
};
|
|
5496
|
-
pre.unshift(refDec);
|
|
5497
|
-
if (ws) {
|
|
5498
|
-
pre.push(ws);
|
|
5499
|
-
}
|
|
5563
|
+
pre.unshift(["", refDec, ";"]);
|
|
5500
5564
|
}
|
|
5501
|
-
statement.children.unshift(pre, blockStatement
|
|
5565
|
+
statement.children.unshift(...pre, blockStatement);
|
|
5502
5566
|
updateParentPointers(blockStatement, statement);
|
|
5503
5567
|
return ref;
|
|
5504
5568
|
}
|
|
@@ -5819,26 +5883,60 @@ function dynamizeImportDeclaration(decl) {
|
|
|
5819
5883
|
};
|
|
5820
5884
|
}
|
|
5821
5885
|
function dynamizeImportDeclarationExpression($0) {
|
|
5822
|
-
const [imp, ws1,
|
|
5823
|
-
const
|
|
5824
|
-
|
|
5825
|
-
return processCallMemberExpression({
|
|
5826
|
-
type: "CallExpression",
|
|
5886
|
+
const [imp, ws1, imports, ws2, from] = $0;
|
|
5887
|
+
const awaitExpression = {
|
|
5888
|
+
type: "AwaitExpression",
|
|
5827
5889
|
children: [
|
|
5828
|
-
{ type: "Await", children: "await" },
|
|
5890
|
+
{ type: "Await", children: ["await"] },
|
|
5829
5891
|
" ",
|
|
5830
5892
|
imp,
|
|
5831
5893
|
trimFirstSpace(ws2),
|
|
5832
|
-
dynamizeFromClause(from)
|
|
5833
|
-
{
|
|
5834
|
-
type: "PropertyGlob",
|
|
5835
|
-
dot,
|
|
5836
|
-
object,
|
|
5837
|
-
children: [ws1, dot, object],
|
|
5838
|
-
reversed: true
|
|
5839
|
-
}
|
|
5894
|
+
dynamizeFromClause(from)
|
|
5840
5895
|
]
|
|
5841
|
-
}
|
|
5896
|
+
};
|
|
5897
|
+
const dot = {
|
|
5898
|
+
type: "AccessStart",
|
|
5899
|
+
children: ["."],
|
|
5900
|
+
optional: false
|
|
5901
|
+
};
|
|
5902
|
+
switch (imports?.type) {
|
|
5903
|
+
case "Identifier": {
|
|
5904
|
+
return processCallMemberExpression({
|
|
5905
|
+
type: "CallExpression",
|
|
5906
|
+
children: [
|
|
5907
|
+
parenthesizeExpression(awaitExpression),
|
|
5908
|
+
{
|
|
5909
|
+
type: "PropertyAccess",
|
|
5910
|
+
dot,
|
|
5911
|
+
name: "default",
|
|
5912
|
+
children: [ws1, dot, "default"]
|
|
5913
|
+
}
|
|
5914
|
+
]
|
|
5915
|
+
});
|
|
5916
|
+
}
|
|
5917
|
+
case "Star": {
|
|
5918
|
+
return parenthesizeExpression(awaitExpression);
|
|
5919
|
+
}
|
|
5920
|
+
case "Declaration": {
|
|
5921
|
+
const object = convertNamedImportsToObject(imports);
|
|
5922
|
+
return processCallMemberExpression({
|
|
5923
|
+
type: "CallExpression",
|
|
5924
|
+
children: [
|
|
5925
|
+
parenthesizeExpression(awaitExpression),
|
|
5926
|
+
{
|
|
5927
|
+
type: "PropertyGlob",
|
|
5928
|
+
dot,
|
|
5929
|
+
object,
|
|
5930
|
+
children: [ws1, dot, object],
|
|
5931
|
+
reversed: true
|
|
5932
|
+
}
|
|
5933
|
+
]
|
|
5934
|
+
});
|
|
5935
|
+
}
|
|
5936
|
+
default: {
|
|
5937
|
+
throw new Error("Unsupported dynamic import");
|
|
5938
|
+
}
|
|
5939
|
+
}
|
|
5842
5940
|
}
|
|
5843
5941
|
function convertWithClause(withClause, extendsClause) {
|
|
5844
5942
|
let extendsToken, extendsTarget, ws;
|
|
@@ -6138,7 +6236,7 @@ function processPipelineExpressions(statements) {
|
|
|
6138
6236
|
const children = [ws];
|
|
6139
6237
|
const comma = blockContainingStatement(s) ? ";" : ",";
|
|
6140
6238
|
let usingRef = null;
|
|
6141
|
-
for (let i2 = 0,
|
|
6239
|
+
for (let i2 = 0, len12 = body.length; i2 < len12; i2++) {
|
|
6142
6240
|
const i = i2;
|
|
6143
6241
|
const step = body[i2];
|
|
6144
6242
|
const [leadingComment, pipe, trailingComment, expr] = step;
|
|
@@ -6930,7 +7028,7 @@ function dedentBlockSubstitutions($0, tab) {
|
|
|
6930
7028
|
}
|
|
6931
7029
|
const stringPart = (() => {
|
|
6932
7030
|
const results1 = [];
|
|
6933
|
-
for (let i2 = 0,
|
|
7031
|
+
for (let i2 = 0, len12 = strWithSubstitutions.length; i2 < len12; i2++) {
|
|
6934
7032
|
const part = strWithSubstitutions[i2];
|
|
6935
7033
|
results1.push(part.token ?? "s");
|
|
6936
7034
|
}
|
|
@@ -7020,6 +7118,9 @@ function quoteString(str) {
|
|
|
7020
7118
|
|
|
7021
7119
|
// unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\lib.civet.jsx
|
|
7022
7120
|
var xor = (a, b) => a ? !b && a : b;
|
|
7121
|
+
function len1(arr, length) {
|
|
7122
|
+
return arr.length === length;
|
|
7123
|
+
}
|
|
7023
7124
|
function addPostfixStatement(statement, ws, post) {
|
|
7024
7125
|
const expressions = [
|
|
7025
7126
|
...post.blockPrefix || [],
|
|
@@ -7397,7 +7498,7 @@ function processCallMemberExpression(node) {
|
|
|
7397
7498
|
isComma(args[args.length - 1]).token = "";
|
|
7398
7499
|
}
|
|
7399
7500
|
let commaCount = 0;
|
|
7400
|
-
for (let i2 = 0,
|
|
7501
|
+
for (let i2 = 0, len22 = args.length; i2 < len22; i2++) {
|
|
7401
7502
|
const i = i2;
|
|
7402
7503
|
let arg = args[i2];
|
|
7403
7504
|
if (isComma(arg)) {
|
|
@@ -7427,19 +7528,22 @@ function processCallMemberExpression(node) {
|
|
|
7427
7528
|
}
|
|
7428
7529
|
}
|
|
7429
7530
|
}
|
|
7430
|
-
for (let i3 = 0,
|
|
7531
|
+
for (let i3 = 0, len3 = children.length; i3 < len3; i3++) {
|
|
7431
7532
|
const i = i3;
|
|
7432
7533
|
const glob = children[i3];
|
|
7433
7534
|
if (glob?.type === "PropertyGlob") {
|
|
7434
7535
|
let prefix = children.slice(0, i);
|
|
7435
7536
|
const parts = [];
|
|
7436
7537
|
let ref;
|
|
7437
|
-
if (prefix
|
|
7538
|
+
if (needsRef(prefix) && glob.object.properties.length > 1) {
|
|
7539
|
+
if (Array.isArray(prefix) && len1(prefix, 1) && typeof prefix[0] === "object" && prefix[0] != null && "type" in prefix[0] && prefix[0].type === "ParenthesizedExpression" && "implicit" in prefix[0] && prefix[0].implicit === true) {
|
|
7540
|
+
prefix = [prefix[0].expression];
|
|
7541
|
+
}
|
|
7438
7542
|
ref = makeRef();
|
|
7439
7543
|
const { refAssignment } = makeRefAssignment(ref, prefix);
|
|
7440
7544
|
prefix = [makeLeftHandSideExpression(refAssignment)];
|
|
7441
7545
|
}
|
|
7442
|
-
|
|
7546
|
+
let prefixDot = [...prefix, glob.dot];
|
|
7443
7547
|
for (const part of glob.object.properties) {
|
|
7444
7548
|
if (part.type === "Error") {
|
|
7445
7549
|
parts.push(part);
|
|
@@ -7452,7 +7556,7 @@ function processCallMemberExpression(node) {
|
|
|
7452
7556
|
});
|
|
7453
7557
|
continue;
|
|
7454
7558
|
}
|
|
7455
|
-
if (part.value && !["CallExpression", "MemberExpression", "Identifier"].includes(part.value.type)) {
|
|
7559
|
+
if (part.value && !["CallExpression", "MemberExpression", "Identifier", "StringLiteral", "ComputedPropertyName"].includes(part.value.type)) {
|
|
7456
7560
|
parts.push({
|
|
7457
7561
|
type: "Error",
|
|
7458
7562
|
message: `Glob pattern must have call or member expression value, found ${JSON.stringify(part.value)}`
|
|
@@ -7468,9 +7572,28 @@ function processCallMemberExpression(node) {
|
|
|
7468
7572
|
[name, value] = [value, name];
|
|
7469
7573
|
}
|
|
7470
7574
|
if (!suppressPrefix) {
|
|
7471
|
-
value
|
|
7575
|
+
if (value.type === "StringLiteral") {
|
|
7576
|
+
value = [
|
|
7577
|
+
...prefix,
|
|
7578
|
+
{
|
|
7579
|
+
type: "Index",
|
|
7580
|
+
children: ["[", trimFirstSpace(value), "]"]
|
|
7581
|
+
}
|
|
7582
|
+
];
|
|
7583
|
+
} else if (value.type === "ComputedPropertyName") {
|
|
7584
|
+
value = [
|
|
7585
|
+
...prefix,
|
|
7586
|
+
{
|
|
7587
|
+
type: "Index",
|
|
7588
|
+
children: [trimFirstSpace(value)]
|
|
7589
|
+
}
|
|
7590
|
+
];
|
|
7591
|
+
} else {
|
|
7592
|
+
value = [...prefixDot, trimFirstSpace(value)];
|
|
7593
|
+
}
|
|
7472
7594
|
if (ref != null) {
|
|
7473
|
-
prefix = [ref]
|
|
7595
|
+
prefix = [ref];
|
|
7596
|
+
prefixDot = [...prefix, glob.dot];
|
|
7474
7597
|
}
|
|
7475
7598
|
}
|
|
7476
7599
|
if (wValue) value.unshift(wValue);
|
|
@@ -7646,21 +7769,18 @@ function makeExpressionStatement(expression) {
|
|
|
7646
7769
|
}
|
|
7647
7770
|
}
|
|
7648
7771
|
function lastAccessInCallExpression(exp) {
|
|
7649
|
-
|
|
7772
|
+
while (exp.type === "MemberExpression" || exp.type === "CallExpression") {
|
|
7773
|
+
const { children } = exp;
|
|
7774
|
+
let i = children.length - 1;
|
|
7775
|
+
while (i >= 0 && typeof children[i] === "object" && (children[i].type === "Call" || children[i].type === "NonNullAssertion" || children[i].type === "Optional")) i--;
|
|
7776
|
+
if (i < 0) return;
|
|
7777
|
+
exp = children[i];
|
|
7778
|
+
}
|
|
7779
|
+
if (exp.type === "Identifier" || exp.type === "PropertyAccess" || exp.type === "Index") {
|
|
7650
7780
|
return exp;
|
|
7651
7781
|
}
|
|
7652
|
-
|
|
7653
|
-
|
|
7654
|
-
if (!(exp.children != null)) {
|
|
7655
|
-
return;
|
|
7656
|
-
}
|
|
7657
|
-
;
|
|
7658
|
-
({ children } = exp);
|
|
7659
|
-
i = children.length - 1;
|
|
7660
|
-
while (i >= 0 && (children[i].type === "Call" || children[i].type === "NonNullAssertion" || children[i].type === "Optional")) i--;
|
|
7661
|
-
if (i < 0) return;
|
|
7662
|
-
} while (children[i].type === "MemberExpression" && (exp = children[i]));
|
|
7663
|
-
return children[i];
|
|
7782
|
+
;
|
|
7783
|
+
return;
|
|
7664
7784
|
}
|
|
7665
7785
|
function convertMethodToFunction(method) {
|
|
7666
7786
|
const { signature, block } = method;
|
|
@@ -7876,7 +7996,7 @@ function processBindingPatternLHS(lhs, tail) {
|
|
|
7876
7996
|
);
|
|
7877
7997
|
}
|
|
7878
7998
|
function processAssignments(statements) {
|
|
7879
|
-
for (let ref8 = gatherRecursiveAll(statements, ($4) => $4.type === "AssignmentExpression" || $4.type === "UpdateExpression"), i5 = 0,
|
|
7999
|
+
for (let ref8 = gatherRecursiveAll(statements, ($4) => $4.type === "AssignmentExpression" || $4.type === "UpdateExpression"), i5 = 0, len4 = ref8.length; i5 < len4; i5++) {
|
|
7880
8000
|
let extractAssignment = function(lhs) {
|
|
7881
8001
|
let expr = lhs;
|
|
7882
8002
|
while (expr.type === "ParenthesizedExpression") {
|
|
@@ -7905,7 +8025,7 @@ function processAssignments(statements) {
|
|
|
7905
8025
|
if (!exp.lhs) {
|
|
7906
8026
|
continue;
|
|
7907
8027
|
}
|
|
7908
|
-
for (let ref10 = exp.lhs, i6 = 0,
|
|
8028
|
+
for (let ref10 = exp.lhs, i6 = 0, len5 = ref10.length; i6 < len5; i6++) {
|
|
7909
8029
|
const lhsPart = ref10[i6];
|
|
7910
8030
|
let ref11;
|
|
7911
8031
|
if (ref11 = extractAssignment(lhsPart[1])) {
|
|
@@ -7950,7 +8070,7 @@ function processAssignments(statements) {
|
|
|
7950
8070
|
}
|
|
7951
8071
|
}
|
|
7952
8072
|
}
|
|
7953
|
-
for (let ref12 = gatherRecursiveAll(statements, ($6) => $6.type === "AssignmentExpression"), i7 = 0,
|
|
8073
|
+
for (let ref12 = gatherRecursiveAll(statements, ($6) => $6.type === "AssignmentExpression"), i7 = 0, len6 = ref12.length; i7 < len6; i7++) {
|
|
7954
8074
|
const exp = ref12[i7];
|
|
7955
8075
|
if (!(exp.names === null)) {
|
|
7956
8076
|
continue;
|
|
@@ -8021,7 +8141,7 @@ function processAssignments(statements) {
|
|
|
8021
8141
|
c[1] = start;
|
|
8022
8142
|
c[2] = ", ";
|
|
8023
8143
|
if (end) {
|
|
8024
|
-
c[3] = [end, " - ", start];
|
|
8144
|
+
c[3] = [makeLeftHandSideExpression(end), " - ", makeLeftHandSideExpression(start)];
|
|
8025
8145
|
} else {
|
|
8026
8146
|
c[3] = ["1/0"];
|
|
8027
8147
|
}
|
|
@@ -8184,7 +8304,7 @@ function attachPostfixStatementAsExpression(exp, post) {
|
|
|
8184
8304
|
}
|
|
8185
8305
|
function processTypes(node) {
|
|
8186
8306
|
const results1 = [];
|
|
8187
|
-
for (let ref16 = gatherRecursiveAll(node, ($11) => $11.type === "TypeUnary"), i8 = 0,
|
|
8307
|
+
for (let ref16 = gatherRecursiveAll(node, ($11) => $11.type === "TypeUnary"), i8 = 0, len7 = ref16.length; i8 < len7; i8++) {
|
|
8188
8308
|
const unary = ref16[i8];
|
|
8189
8309
|
let suffixIndex = unary.suffix.length - 1;
|
|
8190
8310
|
const results2 = [];
|
|
@@ -8312,7 +8432,7 @@ function processTypes(node) {
|
|
|
8312
8432
|
return results1;
|
|
8313
8433
|
}
|
|
8314
8434
|
function processStatementExpressions(statements) {
|
|
8315
|
-
for (let ref18 = gatherRecursiveAll(statements, ($12) => $12.type === "StatementExpression"), i9 = 0,
|
|
8435
|
+
for (let ref18 = gatherRecursiveAll(statements, ($12) => $12.type === "StatementExpression"), i9 = 0, len8 = ref18.length; i9 < len8; i9++) {
|
|
8316
8436
|
const exp = ref18[i9];
|
|
8317
8437
|
const { maybe, statement } = exp;
|
|
8318
8438
|
if ((maybe || statement.type === "ThrowStatement") && blockContainingStatement(exp)) {
|
|
@@ -8382,7 +8502,7 @@ function processNegativeIndexAccess(statements) {
|
|
|
8382
8502
|
});
|
|
8383
8503
|
}
|
|
8384
8504
|
function processFinallyClauses(statements) {
|
|
8385
|
-
for (let ref20 = gatherRecursiveAll(statements, ($) => $.type === "FinallyClause" && $.parent?.type !== "TryStatement"), i10 = 0,
|
|
8505
|
+
for (let ref20 = gatherRecursiveAll(statements, ($) => $.type === "FinallyClause" && $.parent?.type !== "TryStatement"), i10 = 0, len9 = ref20.length; i10 < len9; i10++) {
|
|
8386
8506
|
let f = ref20[i10];
|
|
8387
8507
|
let ref21;
|
|
8388
8508
|
if (!((ref21 = blockContainingStatement(f)) && typeof ref21 === "object" && "block" in ref21 && "index" in ref21)) {
|
|
@@ -8460,7 +8580,7 @@ function processBreaksContinues(statements) {
|
|
|
8460
8580
|
}
|
|
8461
8581
|
}
|
|
8462
8582
|
function processCoffeeClasses(statements) {
|
|
8463
|
-
for (let ref22 = gatherRecursiveAll(statements, ($13) => $13.type === "ClassExpression"), i11 = 0,
|
|
8583
|
+
for (let ref22 = gatherRecursiveAll(statements, ($13) => $13.type === "ClassExpression"), i11 = 0, len10 = ref22.length; i11 < len10; i11++) {
|
|
8464
8584
|
const ce = ref22[i11];
|
|
8465
8585
|
const { expressions } = ce.body;
|
|
8466
8586
|
const indent = expressions[0]?.[0] ?? "\n";
|
|
@@ -8505,7 +8625,7 @@ function processCoffeeClasses(statements) {
|
|
|
8505
8625
|
0,
|
|
8506
8626
|
...(() => {
|
|
8507
8627
|
const results3 = [];
|
|
8508
|
-
for (let i12 = 0,
|
|
8628
|
+
for (let i12 = 0, len11 = autoBinds.length; i12 < len11; i12++) {
|
|
8509
8629
|
const [, a] = autoBinds[i12];
|
|
8510
8630
|
results3.push([indent, ["this.", a.name, " = this.", a.name, ".bind(this)"], ";"]);
|
|
8511
8631
|
}
|
|
@@ -8621,7 +8741,7 @@ async function processProgramAsync(root) {
|
|
|
8621
8741
|
function processRepl(root, rootIIFE) {
|
|
8622
8742
|
const topBlock = gatherRecursive(rootIIFE, ($21) => $21.type === "BlockStatement")[0];
|
|
8623
8743
|
let i = 0;
|
|
8624
|
-
for (let ref23 = gatherRecursiveWithinFunction(topBlock, ($22) => $22.type === "Declaration"), i14 = 0,
|
|
8744
|
+
for (let ref23 = gatherRecursiveWithinFunction(topBlock, ($22) => $22.type === "Declaration"), i14 = 0, len12 = ref23.length; i14 < len12; i14++) {
|
|
8625
8745
|
const decl = ref23[i14];
|
|
8626
8746
|
if (!decl.names?.length) {
|
|
8627
8747
|
continue;
|
|
@@ -8635,7 +8755,7 @@ function processRepl(root, rootIIFE) {
|
|
|
8635
8755
|
root.expressions.splice(i++, 0, ["", `var ${decl.names.join(",")}`, ";"]);
|
|
8636
8756
|
}
|
|
8637
8757
|
}
|
|
8638
|
-
for (let ref24 = gatherRecursive(topBlock, ($23) => $23.type === "FunctionExpression"), i15 = 0,
|
|
8758
|
+
for (let ref24 = gatherRecursive(topBlock, ($23) => $23.type === "FunctionExpression"), i15 = 0, len13 = ref24.length; i15 < len13; i15++) {
|
|
8639
8759
|
const func = ref24[i15];
|
|
8640
8760
|
if (func.name && func.parent?.type === "BlockStatement") {
|
|
8641
8761
|
if (func.parent === topBlock) {
|
|
@@ -8648,7 +8768,7 @@ function processRepl(root, rootIIFE) {
|
|
|
8648
8768
|
}
|
|
8649
8769
|
}
|
|
8650
8770
|
}
|
|
8651
|
-
for (let ref25 = gatherRecursiveWithinFunction(topBlock, ($24) => $24.type === "ClassExpression"), i16 = 0,
|
|
8771
|
+
for (let ref25 = gatherRecursiveWithinFunction(topBlock, ($24) => $24.type === "ClassExpression"), i16 = 0, len14 = ref25.length; i16 < len14; i16++) {
|
|
8652
8772
|
const classExp = ref25[i16];
|
|
8653
8773
|
let m8;
|
|
8654
8774
|
if (classExp.name && classExp.parent === topBlock || (m8 = classExp.parent, typeof m8 === "object" && m8 != null && "type" in m8 && m8.type === "ReturnStatement" && "parent" in m8 && m8.parent === topBlock)) {
|
|
@@ -8660,7 +8780,7 @@ function processRepl(root, rootIIFE) {
|
|
|
8660
8780
|
function processPlaceholders(statements) {
|
|
8661
8781
|
const placeholderMap = /* @__PURE__ */ new Map();
|
|
8662
8782
|
const liftedIfs = /* @__PURE__ */ new Set();
|
|
8663
|
-
for (let ref26 = gatherRecursiveAll(statements, ($25) => $25.type === "Placeholder"), i17 = 0,
|
|
8783
|
+
for (let ref26 = gatherRecursiveAll(statements, ($25) => $25.type === "Placeholder"), i17 = 0, len15 = ref26.length; i17 < len15; i17++) {
|
|
8664
8784
|
const exp = ref26[i17];
|
|
8665
8785
|
let ancestor;
|
|
8666
8786
|
if (exp.subtype === ".") {
|
|
@@ -8770,7 +8890,7 @@ function processPlaceholders(statements) {
|
|
|
8770
8890
|
for (const [ancestor, placeholders] of placeholderMap) {
|
|
8771
8891
|
let ref = makeRef("$");
|
|
8772
8892
|
let typeSuffix;
|
|
8773
|
-
for (let i18 = 0,
|
|
8893
|
+
for (let i18 = 0, len16 = placeholders.length; i18 < len16; i18++) {
|
|
8774
8894
|
const placeholder = placeholders[i18];
|
|
8775
8895
|
typeSuffix ??= placeholder.typeSuffix;
|
|
8776
8896
|
let ref27;
|
|
@@ -8884,10 +9004,12 @@ function reorderBindingRestProperty(props) {
|
|
|
8884
9004
|
}
|
|
8885
9005
|
function typeOfJSX(node, config2) {
|
|
8886
9006
|
switch (node.type) {
|
|
8887
|
-
case "JSXElement":
|
|
9007
|
+
case "JSXElement": {
|
|
8888
9008
|
return typeOfJSXElement(node, config2);
|
|
8889
|
-
|
|
9009
|
+
}
|
|
9010
|
+
case "JSXFragment": {
|
|
8890
9011
|
return typeOfJSXFragment(node, config2);
|
|
9012
|
+
}
|
|
8891
9013
|
}
|
|
8892
9014
|
}
|
|
8893
9015
|
function typeOfJSXElement(node, config2) {
|
|
@@ -8895,7 +9017,7 @@ function typeOfJSXElement(node, config2) {
|
|
|
8895
9017
|
if (config2.server && !config2.client) {
|
|
8896
9018
|
return ["string"];
|
|
8897
9019
|
}
|
|
8898
|
-
|
|
9020
|
+
const { tag } = node;
|
|
8899
9021
|
const clientType = tag[0] === tag[0].toLowerCase() ? [getHelperRef("IntrinsicElements"), '<"', tag, '">'] : ["ReturnType<typeof ", tag, ">"];
|
|
8900
9022
|
if (config2.server) {
|
|
8901
9023
|
return ["string", " | ", clientType];
|
|
@@ -8910,33 +9032,40 @@ function typeOfJSXFragment(node, config2) {
|
|
|
8910
9032
|
if (config2.solid) {
|
|
8911
9033
|
let type = [];
|
|
8912
9034
|
let lastType;
|
|
8913
|
-
for (
|
|
9035
|
+
for (const child of node.jsxChildren) {
|
|
8914
9036
|
switch (child.type) {
|
|
8915
|
-
case "JSXText":
|
|
8916
|
-
if (lastType
|
|
9037
|
+
case "JSXText": {
|
|
9038
|
+
if (!(lastType === "JSXText")) {
|
|
8917
9039
|
type.push("string");
|
|
8918
9040
|
}
|
|
9041
|
+
;
|
|
8919
9042
|
break;
|
|
8920
|
-
|
|
9043
|
+
}
|
|
9044
|
+
case "JSXElement": {
|
|
8921
9045
|
type.push(typeOfJSXElement(child, config2));
|
|
8922
9046
|
break;
|
|
8923
|
-
|
|
9047
|
+
}
|
|
9048
|
+
case "JSXFragment": {
|
|
8924
9049
|
type.push(...typeOfJSXFragment(child, config2));
|
|
8925
9050
|
break;
|
|
8926
|
-
|
|
9051
|
+
}
|
|
9052
|
+
case "JSXChildExpression": {
|
|
8927
9053
|
if (child.expression) {
|
|
8928
9054
|
type.push(["typeof ", child.expression]);
|
|
8929
9055
|
}
|
|
9056
|
+
;
|
|
8930
9057
|
break;
|
|
8931
|
-
|
|
9058
|
+
}
|
|
9059
|
+
default: {
|
|
8932
9060
|
throw new Error(`unknown child in JSXFragment: ${JSON.stringify(child)}`);
|
|
9061
|
+
}
|
|
8933
9062
|
}
|
|
8934
9063
|
lastType = child.type;
|
|
8935
9064
|
}
|
|
8936
9065
|
if (type.length === 1) {
|
|
8937
9066
|
return type[0];
|
|
8938
9067
|
} else {
|
|
8939
|
-
type = type.flatMap((
|
|
9068
|
+
type = type.flatMap(($26) => [$26, ", "]);
|
|
8940
9069
|
type.pop();
|
|
8941
9070
|
return ["[", type, "]"];
|
|
8942
9071
|
}
|
|
@@ -9161,6 +9290,8 @@ var grammar = {
|
|
|
9161
9290
|
NonSingleBracedBlock,
|
|
9162
9291
|
DeclarationOrStatement,
|
|
9163
9292
|
SingleLineStatements,
|
|
9293
|
+
ObjectSingleLineStatements,
|
|
9294
|
+
BracedObjectSingleLineStatements,
|
|
9164
9295
|
PostfixedSingleLineStatements,
|
|
9165
9296
|
PostfixedSingleLineNoCommaStatements,
|
|
9166
9297
|
NestedBlockStatements,
|
|
@@ -9341,6 +9472,10 @@ var grammar = {
|
|
|
9341
9472
|
ForbidNewlineBinaryOp,
|
|
9342
9473
|
RestoreNewlineBinaryOp,
|
|
9343
9474
|
NewlineBinaryOpAllowed,
|
|
9475
|
+
AllowImplicitFragment,
|
|
9476
|
+
ForbidImplicitFragment,
|
|
9477
|
+
RestoreImplicitFragment,
|
|
9478
|
+
ImplicitFragmentAllowed,
|
|
9344
9479
|
AllowPipeline,
|
|
9345
9480
|
ForbidPipeline,
|
|
9346
9481
|
RestorePipeline,
|
|
@@ -9366,11 +9501,15 @@ var grammar = {
|
|
|
9366
9501
|
NameSpaceImport,
|
|
9367
9502
|
NamedImports,
|
|
9368
9503
|
OperatorNamedImports,
|
|
9504
|
+
DynamicNamedImports,
|
|
9505
|
+
DynamicImportContents,
|
|
9369
9506
|
FromClause,
|
|
9370
9507
|
ImportAssertion,
|
|
9371
9508
|
TypeAndImportSpecifier,
|
|
9372
9509
|
ImportSpecifier,
|
|
9373
9510
|
OperatorImportSpecifier,
|
|
9511
|
+
DynamicImportSpecifier,
|
|
9512
|
+
DynamicModuleExportName,
|
|
9374
9513
|
ImportAsToken,
|
|
9375
9514
|
ModuleExportName,
|
|
9376
9515
|
ModuleSpecifier,
|
|
@@ -10648,7 +10787,11 @@ function SingleLineBinaryOpRHS(ctx, state2) {
|
|
|
10648
10787
|
return (0, import_lib2.$EVENT)(ctx, state2, "SingleLineBinaryOpRHS", SingleLineBinaryOpRHS$0);
|
|
10649
10788
|
}
|
|
10650
10789
|
var RHS$0 = ExpressionizedStatementWithTrailingCallExpressions;
|
|
10651
|
-
var RHS$1 = UnaryExpression
|
|
10790
|
+
var RHS$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(ForbidImplicitFragment, (0, import_lib2.$E)(UnaryExpression), RestoreImplicitFragment), function($skip, $loc, $0, $1, $2, $3) {
|
|
10791
|
+
var exp = $2;
|
|
10792
|
+
if (!exp) return $skip;
|
|
10793
|
+
return exp;
|
|
10794
|
+
});
|
|
10652
10795
|
var RHS$$ = [RHS$0, RHS$1];
|
|
10653
10796
|
function RHS(ctx, state2) {
|
|
10654
10797
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "RHS", RHS$$);
|
|
@@ -10982,8 +11125,9 @@ var FatArrowBody$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$N
|
|
|
10982
11125
|
implicitlyReturned: true
|
|
10983
11126
|
};
|
|
10984
11127
|
});
|
|
10985
|
-
var FatArrowBody$1 =
|
|
10986
|
-
var FatArrowBody
|
|
11128
|
+
var FatArrowBody$1 = BracedObjectSingleLineStatements;
|
|
11129
|
+
var FatArrowBody$2 = NoCommaBracedOrEmptyBlock;
|
|
11130
|
+
var FatArrowBody$$ = [FatArrowBody$0, FatArrowBody$1, FatArrowBody$2];
|
|
10987
11131
|
function FatArrowBody(ctx, state2) {
|
|
10988
11132
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "FatArrowBody", FatArrowBody$$);
|
|
10989
11133
|
}
|
|
@@ -11694,10 +11838,10 @@ var CallExpression$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Super, Arguments
|
|
|
11694
11838
|
children: [$1, ...$2, ...rest.flat()]
|
|
11695
11839
|
});
|
|
11696
11840
|
});
|
|
11697
|
-
var CallExpression$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(Import, _,
|
|
11841
|
+
var CallExpression$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(Import, _, DynamicImportContents, __, FromClause), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
11698
11842
|
return dynamizeImportDeclarationExpression($0);
|
|
11699
11843
|
});
|
|
11700
|
-
var CallExpression$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(FromClause, __, Import, _,
|
|
11844
|
+
var CallExpression$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(FromClause, __, Import, _, DynamicImportContents), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
11701
11845
|
var from = $1;
|
|
11702
11846
|
var fws = $2;
|
|
11703
11847
|
var i = $3;
|
|
@@ -13010,7 +13154,7 @@ var OperatorDeclaration$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Operator, (
|
|
|
13010
13154
|
var behavior = $2;
|
|
13011
13155
|
var w = $3;
|
|
13012
13156
|
var decl = $4;
|
|
13013
|
-
decl.names.forEach((name) =>
|
|
13157
|
+
decl.names.forEach((name) => setOperatorBehavior(name, behavior));
|
|
13014
13158
|
if (behavior?.error) decl = prepend(behavior.error, decl);
|
|
13015
13159
|
decl = prepend(trimFirstSpace(w), decl);
|
|
13016
13160
|
return decl;
|
|
@@ -13018,7 +13162,7 @@ var OperatorDeclaration$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Operator, (
|
|
|
13018
13162
|
var OperatorDeclaration$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(OperatorSignature, BracedBlock), function($skip, $loc, $0, $1, $2) {
|
|
13019
13163
|
var signature = $1;
|
|
13020
13164
|
var block = $2;
|
|
13021
|
-
|
|
13165
|
+
setOperatorBehavior(signature.id.name, signature.behavior);
|
|
13022
13166
|
return {
|
|
13023
13167
|
...signature,
|
|
13024
13168
|
type: "FunctionExpression",
|
|
@@ -13035,10 +13179,10 @@ var OperatorDeclaration$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(Operator, _
|
|
|
13035
13179
|
var behavior = $4;
|
|
13036
13180
|
var ids = $5;
|
|
13037
13181
|
const children = [];
|
|
13038
|
-
|
|
13182
|
+
setOperatorBehavior(id.name, behavior);
|
|
13039
13183
|
if (behavior?.error) children.push(behavior.error);
|
|
13040
13184
|
ids.forEach(([, , id2, behavior2]) => {
|
|
13041
|
-
|
|
13185
|
+
setOperatorBehavior(id2.name, behavior2);
|
|
13042
13186
|
if (behavior2?.error) children.push(behavior2.error);
|
|
13043
13187
|
});
|
|
13044
13188
|
return {
|
|
@@ -13138,7 +13282,7 @@ var OperatorAssociativity$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, impor
|
|
|
13138
13282
|
function OperatorAssociativity(ctx, state2) {
|
|
13139
13283
|
return (0, import_lib2.$EVENT)(ctx, state2, "OperatorAssociativity", OperatorAssociativity$0);
|
|
13140
13284
|
}
|
|
13141
|
-
var ThinArrowFunction$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)((0, import_lib2.$S)(Async, _)), ArrowParameters, (0, import_lib2.$E)(ReturnTypeSuffix), (0, import_lib2.$E)(_), Arrow, NoCommaBracedOrEmptyBlock), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
|
|
13285
|
+
var ThinArrowFunction$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)((0, import_lib2.$S)(Async, _)), ArrowParameters, (0, import_lib2.$E)(ReturnTypeSuffix), (0, import_lib2.$E)(_), Arrow, (0, import_lib2.$C)(BracedObjectSingleLineStatements, NoCommaBracedOrEmptyBlock)), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
|
|
13142
13286
|
var async = $1;
|
|
13143
13287
|
var parameters = $2;
|
|
13144
13288
|
var returnType = $3;
|
|
@@ -13292,8 +13436,9 @@ var ThenBlock$0 = (0, import_lib2.$T)((0, import_lib2.$S)(NoBlock, EmptyBlock),
|
|
|
13292
13436
|
return value[1];
|
|
13293
13437
|
});
|
|
13294
13438
|
var ThenBlock$1 = ImplicitNestedBlock;
|
|
13295
|
-
var ThenBlock$2 =
|
|
13296
|
-
var ThenBlock
|
|
13439
|
+
var ThenBlock$2 = ObjectSingleLineStatements;
|
|
13440
|
+
var ThenBlock$3 = SingleLineStatements;
|
|
13441
|
+
var ThenBlock$$ = [ThenBlock$0, ThenBlock$1, ThenBlock$2, ThenBlock$3];
|
|
13297
13442
|
function ThenBlock(ctx, state2) {
|
|
13298
13443
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "ThenBlock", ThenBlock$$);
|
|
13299
13444
|
}
|
|
@@ -13352,11 +13497,12 @@ var BlockOrEmptyStatement$$ = [BlockOrEmptyStatement$0, BlockOrEmptyStatement$1]
|
|
|
13352
13497
|
function BlockOrEmptyStatement(ctx, state2) {
|
|
13353
13498
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "BlockOrEmptyStatement", BlockOrEmptyStatement$$);
|
|
13354
13499
|
}
|
|
13355
|
-
var BlockOrEmpty$0 =
|
|
13356
|
-
var BlockOrEmpty$1 =
|
|
13500
|
+
var BlockOrEmpty$0 = ObjectSingleLineStatements;
|
|
13501
|
+
var BlockOrEmpty$1 = Block;
|
|
13502
|
+
var BlockOrEmpty$2 = (0, import_lib2.$T)((0, import_lib2.$S)(NoBlock, EmptyBlock), function(value) {
|
|
13357
13503
|
return value[1];
|
|
13358
13504
|
});
|
|
13359
|
-
var BlockOrEmpty$$ = [BlockOrEmpty$0, BlockOrEmpty$1];
|
|
13505
|
+
var BlockOrEmpty$$ = [BlockOrEmpty$0, BlockOrEmpty$1, BlockOrEmpty$2];
|
|
13360
13506
|
function BlockOrEmpty(ctx, state2) {
|
|
13361
13507
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "BlockOrEmpty", BlockOrEmpty$$);
|
|
13362
13508
|
}
|
|
@@ -13492,6 +13638,26 @@ var SingleLineStatements$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(ForbidNewl
|
|
|
13492
13638
|
function SingleLineStatements(ctx, state2) {
|
|
13493
13639
|
return (0, import_lib2.$EVENT)(ctx, state2, "SingleLineStatements", SingleLineStatements$0);
|
|
13494
13640
|
}
|
|
13641
|
+
var ObjectSingleLineStatements$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$Y)((0, import_lib2.$S)((0, import_lib2.$E)(_), BracedObjectLiteral)), SingleLineStatements), function($skip, $loc, $0, $1, $2) {
|
|
13642
|
+
var block = $2;
|
|
13643
|
+
if (block.bare && block.expressions.length === 1) {
|
|
13644
|
+
const expression = block.expressions[0][1];
|
|
13645
|
+
if (expression.type === "ParenthesizedExpression" && expression.implicit && expression.expression.type === "ObjectExpression") {
|
|
13646
|
+
block = { ...block, unwrapObject: true };
|
|
13647
|
+
}
|
|
13648
|
+
}
|
|
13649
|
+
return block;
|
|
13650
|
+
});
|
|
13651
|
+
function ObjectSingleLineStatements(ctx, state2) {
|
|
13652
|
+
return (0, import_lib2.$EVENT)(ctx, state2, "ObjectSingleLineStatements", ObjectSingleLineStatements$0);
|
|
13653
|
+
}
|
|
13654
|
+
var BracedObjectSingleLineStatements$0 = (0, import_lib2.$TV)(ObjectSingleLineStatements, function($skip, $loc, $0, $1) {
|
|
13655
|
+
var block = $0;
|
|
13656
|
+
return bracedBlock(block);
|
|
13657
|
+
});
|
|
13658
|
+
function BracedObjectSingleLineStatements(ctx, state2) {
|
|
13659
|
+
return (0, import_lib2.$EVENT)(ctx, state2, "BracedObjectSingleLineStatements", BracedObjectSingleLineStatements$0);
|
|
13660
|
+
}
|
|
13495
13661
|
var PostfixedSingleLineStatements$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$Q)((0, import_lib2.$S)((0, import_lib2.$S)((0, import_lib2.$E)(_), (0, import_lib2.$N)(EOS)), StatementListItem, SemicolonDelimiter)), (0, import_lib2.$E)((0, import_lib2.$S)((0, import_lib2.$S)((0, import_lib2.$E)(_), (0, import_lib2.$N)(EOS)), StatementListItem, (0, import_lib2.$E)(SemicolonDelimiter)))), function($skip, $loc, $0, $1, $2) {
|
|
13496
13662
|
var stmts = $1;
|
|
13497
13663
|
var last = $2;
|
|
@@ -14342,7 +14508,8 @@ var PropertyDefinition$2 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_l
|
|
|
14342
14508
|
children: [ws, id],
|
|
14343
14509
|
name: id,
|
|
14344
14510
|
names: id.names,
|
|
14345
|
-
value: id
|
|
14511
|
+
value: id,
|
|
14512
|
+
implicitName: true
|
|
14346
14513
|
};
|
|
14347
14514
|
});
|
|
14348
14515
|
var PropertyDefinition$3 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(_), MethodDefinition), function($skip, $loc, $0, $1, $2) {
|
|
@@ -14401,7 +14568,8 @@ var PropertyDefinition$5 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_l
|
|
|
14401
14568
|
if (refAssignment) {
|
|
14402
14569
|
name = {
|
|
14403
14570
|
type: "ComputedPropertyName",
|
|
14404
|
-
children: [last.children[0], "(", refAssignment, ",", ref, ")", ...last.children.slice(-2)]
|
|
14571
|
+
children: [last.children[0], "(", refAssignment, ",", ref, ")", ...last.children.slice(-2)],
|
|
14572
|
+
implicit: true
|
|
14405
14573
|
};
|
|
14406
14574
|
value = {
|
|
14407
14575
|
...value,
|
|
@@ -14416,7 +14584,8 @@ var PropertyDefinition$5 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_l
|
|
|
14416
14584
|
} else {
|
|
14417
14585
|
name = {
|
|
14418
14586
|
type: "ComputedPropertyName",
|
|
14419
|
-
children: last.children
|
|
14587
|
+
children: last.children,
|
|
14588
|
+
implicit: true
|
|
14420
14589
|
};
|
|
14421
14590
|
}
|
|
14422
14591
|
} else {
|
|
@@ -14429,7 +14598,8 @@ var PropertyDefinition$5 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_l
|
|
|
14429
14598
|
children: [ws, name, ": ", processUnaryExpression(pre, value, post)],
|
|
14430
14599
|
name,
|
|
14431
14600
|
names: [],
|
|
14432
|
-
value
|
|
14601
|
+
value,
|
|
14602
|
+
implicitName: true
|
|
14433
14603
|
};
|
|
14434
14604
|
});
|
|
14435
14605
|
var PropertyDefinition$$ = [PropertyDefinition$0, PropertyDefinition$1, PropertyDefinition$2, PropertyDefinition$3, PropertyDefinition$4, PropertyDefinition$5];
|
|
@@ -14632,6 +14802,7 @@ function MethodDefinition(ctx, state2) {
|
|
|
14632
14802
|
var MethodModifier$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(GetOrSet, (0, import_lib2.$E)(_), (0, import_lib2.$Y)(ClassElementName)), function($skip, $loc, $0, $1, $2, $3) {
|
|
14633
14803
|
var kind = $1;
|
|
14634
14804
|
var ws = $2;
|
|
14805
|
+
if (!ws) ws = " ";
|
|
14635
14806
|
return {
|
|
14636
14807
|
// no async or generator, because getters and setters can't be
|
|
14637
14808
|
modifier: {
|
|
@@ -15349,7 +15520,7 @@ function ShouldExpressionize(ctx, state2) {
|
|
|
15349
15520
|
var NoCommaStatement$0 = KeywordStatement;
|
|
15350
15521
|
var NoCommaStatement$1 = VariableStatement;
|
|
15351
15522
|
var NoCommaStatement$2 = IfStatement;
|
|
15352
|
-
var NoCommaStatement$3 =
|
|
15523
|
+
var NoCommaStatement$3 = IterationActualStatement;
|
|
15353
15524
|
var NoCommaStatement$4 = SwitchStatement;
|
|
15354
15525
|
var NoCommaStatement$5 = TryStatement;
|
|
15355
15526
|
var NoCommaStatement$6 = EmptyStatement;
|
|
@@ -16381,8 +16552,8 @@ var SingleLineExpressionWithIndentedApplicationForbidden$0 = (0, import_lib2.$TS
|
|
|
16381
16552
|
function SingleLineExpressionWithIndentedApplicationForbidden(ctx, state2) {
|
|
16382
16553
|
return (0, import_lib2.$EVENT)(ctx, state2, "SingleLineExpressionWithIndentedApplicationForbidden", SingleLineExpressionWithIndentedApplicationForbidden$0);
|
|
16383
16554
|
}
|
|
16384
|
-
var ExpressionWithObjectApplicationForbidden$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(ForbidBracedApplication, ForbidIndentedApplication, (0, import_lib2.$E)(Expression), RestoreBracedApplication, RestoreIndentedApplication), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
16385
|
-
var exp = $
|
|
16555
|
+
var ExpressionWithObjectApplicationForbidden$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(ForbidBracedApplication, ForbidIndentedApplication, ForbidImplicitFragment, (0, import_lib2.$E)(Expression), RestoreBracedApplication, RestoreIndentedApplication, RestoreImplicitFragment), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7) {
|
|
16556
|
+
var exp = $4;
|
|
16386
16557
|
if (exp) return exp;
|
|
16387
16558
|
return $skip;
|
|
16388
16559
|
});
|
|
@@ -16559,6 +16730,33 @@ var NewlineBinaryOpAllowed$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0
|
|
|
16559
16730
|
function NewlineBinaryOpAllowed(ctx, state2) {
|
|
16560
16731
|
return (0, import_lib2.$EVENT)(ctx, state2, "NewlineBinaryOpAllowed", NewlineBinaryOpAllowed$0);
|
|
16561
16732
|
}
|
|
16733
|
+
var AllowImplicitFragment$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'AllowImplicitFragment ""'), function($skip, $loc, $0, $1) {
|
|
16734
|
+
state.forbidImplicitFragment.push(false);
|
|
16735
|
+
});
|
|
16736
|
+
function AllowImplicitFragment(ctx, state2) {
|
|
16737
|
+
return (0, import_lib2.$EVENT)(ctx, state2, "AllowImplicitFragment", AllowImplicitFragment$0);
|
|
16738
|
+
}
|
|
16739
|
+
var ForbidImplicitFragment$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'ForbidImplicitFragment ""'), function($skip, $loc, $0, $1) {
|
|
16740
|
+
state.forbidImplicitFragment.push(true);
|
|
16741
|
+
});
|
|
16742
|
+
function ForbidImplicitFragment(ctx, state2) {
|
|
16743
|
+
return (0, import_lib2.$EVENT)(ctx, state2, "ForbidImplicitFragment", ForbidImplicitFragment$0);
|
|
16744
|
+
}
|
|
16745
|
+
var RestoreImplicitFragment$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'RestoreImplicitFragment ""'), function($skip, $loc, $0, $1) {
|
|
16746
|
+
state.forbidImplicitFragment.pop();
|
|
16747
|
+
});
|
|
16748
|
+
function RestoreImplicitFragment(ctx, state2) {
|
|
16749
|
+
return (0, import_lib2.$EVENT)(ctx, state2, "RestoreImplicitFragment", RestoreImplicitFragment$0);
|
|
16750
|
+
}
|
|
16751
|
+
var ImplicitFragmentAllowed$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'ImplicitFragmentAllowed ""'), function($skip, $loc, $0, $1) {
|
|
16752
|
+
if (config.verbose) {
|
|
16753
|
+
console.log("forbidImplicitFragment:", state.forbidImplicitFragment);
|
|
16754
|
+
}
|
|
16755
|
+
if (state.implicitFragmentForbidden) return $skip;
|
|
16756
|
+
});
|
|
16757
|
+
function ImplicitFragmentAllowed(ctx, state2) {
|
|
16758
|
+
return (0, import_lib2.$EVENT)(ctx, state2, "ImplicitFragmentAllowed", ImplicitFragmentAllowed$0);
|
|
16759
|
+
}
|
|
16562
16760
|
var AllowPipeline$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'AllowPipeline ""'), function($skip, $loc, $0, $1) {
|
|
16563
16761
|
state.forbidPipeline.push(false);
|
|
16564
16762
|
});
|
|
@@ -16586,11 +16784,11 @@ var PipelineAllowed$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'Pipe
|
|
|
16586
16784
|
function PipelineAllowed(ctx, state2) {
|
|
16587
16785
|
return (0, import_lib2.$EVENT)(ctx, state2, "PipelineAllowed", PipelineAllowed$0);
|
|
16588
16786
|
}
|
|
16589
|
-
var AllowAll$0 = (0, import_lib2.$S)(AllowTrailingMemberProperty, AllowBracedApplication, AllowIndentedApplication, AllowClassImplicitCall, AllowNestedBinaryOp, AllowNewlineBinaryOp, AllowPipeline);
|
|
16787
|
+
var AllowAll$0 = (0, import_lib2.$S)(AllowTrailingMemberProperty, AllowBracedApplication, AllowIndentedApplication, AllowClassImplicitCall, AllowNestedBinaryOp, AllowNewlineBinaryOp, AllowImplicitFragment, AllowPipeline);
|
|
16590
16788
|
function AllowAll(ctx, state2) {
|
|
16591
16789
|
return (0, import_lib2.$EVENT)(ctx, state2, "AllowAll", AllowAll$0);
|
|
16592
16790
|
}
|
|
16593
|
-
var RestoreAll$0 = (0, import_lib2.$S)(RestoreTrailingMemberProperty, RestoreBracedApplication, RestoreIndentedApplication, RestoreClassImplicitCall, RestoreNestedBinaryOp, RestoreNewlineBinaryOp, RestorePipeline);
|
|
16791
|
+
var RestoreAll$0 = (0, import_lib2.$S)(RestoreTrailingMemberProperty, RestoreBracedApplication, RestoreIndentedApplication, RestoreClassImplicitCall, RestoreNestedBinaryOp, RestoreNewlineBinaryOp, RestoreImplicitFragment, RestorePipeline);
|
|
16594
16792
|
function RestoreAll(ctx, state2) {
|
|
16595
16793
|
return (0, import_lib2.$EVENT)(ctx, state2, "RestoreAll", RestoreAll$0);
|
|
16596
16794
|
}
|
|
@@ -16693,7 +16891,11 @@ var MaybeNestedNonPipelineExpression$0 = (0, import_lib2.$TS)((0, import_lib2.$S
|
|
|
16693
16891
|
if (!trailing) return expression;
|
|
16694
16892
|
return [expression, trailing];
|
|
16695
16893
|
});
|
|
16696
|
-
var MaybeNestedNonPipelineExpression$1 = NonPipelineExpression
|
|
16894
|
+
var MaybeNestedNonPipelineExpression$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(ForbidImplicitFragment, (0, import_lib2.$E)(NonPipelineExpression), RestoreImplicitFragment), function($skip, $loc, $0, $1, $2, $3) {
|
|
16895
|
+
var expression = $2;
|
|
16896
|
+
if (!expression) return $skip;
|
|
16897
|
+
return expression;
|
|
16898
|
+
});
|
|
16697
16899
|
var MaybeNestedNonPipelineExpression$$ = [MaybeNestedNonPipelineExpression$0, MaybeNestedNonPipelineExpression$1];
|
|
16698
16900
|
function MaybeNestedNonPipelineExpression(ctx, state2) {
|
|
16699
16901
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "MaybeNestedNonPipelineExpression", MaybeNestedNonPipelineExpression$$);
|
|
@@ -16705,7 +16907,11 @@ var MaybeNestedPostfixedExpression$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(
|
|
|
16705
16907
|
if (!trailing) return expression;
|
|
16706
16908
|
return [expression, trailing];
|
|
16707
16909
|
});
|
|
16708
|
-
var MaybeNestedPostfixedExpression$1 = PostfixedExpression
|
|
16910
|
+
var MaybeNestedPostfixedExpression$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(ForbidImplicitFragment, (0, import_lib2.$E)(PostfixedExpression), RestoreImplicitFragment), function($skip, $loc, $0, $1, $2, $3) {
|
|
16911
|
+
var expression = $2;
|
|
16912
|
+
if (!expression) return $skip;
|
|
16913
|
+
return expression;
|
|
16914
|
+
});
|
|
16709
16915
|
var MaybeNestedPostfixedExpression$$ = [MaybeNestedPostfixedExpression$0, MaybeNestedPostfixedExpression$1];
|
|
16710
16916
|
function MaybeNestedPostfixedExpression(ctx, state2) {
|
|
16711
16917
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "MaybeNestedPostfixedExpression", MaybeNestedPostfixedExpression$$);
|
|
@@ -16728,7 +16934,11 @@ var MaybeNestedExpression$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, impor
|
|
|
16728
16934
|
if (!trailing) return expression;
|
|
16729
16935
|
return [expression, trailing];
|
|
16730
16936
|
});
|
|
16731
|
-
var MaybeNestedExpression$1 = Expression
|
|
16937
|
+
var MaybeNestedExpression$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(ForbidImplicitFragment, (0, import_lib2.$E)(Expression), RestoreImplicitFragment), function($skip, $loc, $0, $1, $2, $3) {
|
|
16938
|
+
var expression = $2;
|
|
16939
|
+
if (!expression) return $skip;
|
|
16940
|
+
return expression;
|
|
16941
|
+
});
|
|
16732
16942
|
var MaybeNestedExpression$$ = [MaybeNestedExpression$0, MaybeNestedExpression$1];
|
|
16733
16943
|
function MaybeNestedExpression(ctx, state2) {
|
|
16734
16944
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "MaybeNestedExpression", MaybeNestedExpression$$);
|
|
@@ -16771,7 +16981,7 @@ var ImportDeclaration$1 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_li
|
|
|
16771
16981
|
const errors = [];
|
|
16772
16982
|
if (behavior?.error) errors.push(behavior.error);
|
|
16773
16983
|
imports.specifiers.forEach((spec) => {
|
|
16774
|
-
|
|
16984
|
+
setOperatorBehavior(spec.binding.name, spec.behavior ?? behavior);
|
|
16775
16985
|
if (spec.behavior?.error) errors.push(spec.behavior.error);
|
|
16776
16986
|
});
|
|
16777
16987
|
return {
|
|
@@ -16822,7 +17032,7 @@ var ImportDeclaration$5 = (0, import_lib2.$TS)((0, import_lib2.$S)(FromClause, _
|
|
|
16822
17032
|
const errors = [];
|
|
16823
17033
|
if (behavior?.error) errors.push(behavior.error);
|
|
16824
17034
|
imports.specifiers.forEach((spec) => {
|
|
16825
|
-
|
|
17035
|
+
setOperatorBehavior(spec.binding.name, spec.behavior ?? behavior);
|
|
16826
17036
|
if (spec.behavior?.error) errors.push(spec.behavior.error);
|
|
16827
17037
|
});
|
|
16828
17038
|
return {
|
|
@@ -16923,6 +17133,24 @@ var OperatorNamedImports$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(OpenBrace,
|
|
|
16923
17133
|
function OperatorNamedImports(ctx, state2) {
|
|
16924
17134
|
return (0, import_lib2.$EVENT)(ctx, state2, "OperatorNamedImports", OperatorNamedImports$0);
|
|
16925
17135
|
}
|
|
17136
|
+
var DynamicNamedImports$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(OpenBrace, (0, import_lib2.$Q)(DynamicImportSpecifier), (0, import_lib2.$E)((0, import_lib2.$S)(__, Comma)), __, CloseBrace), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
17137
|
+
var specifiers = $2;
|
|
17138
|
+
return {
|
|
17139
|
+
type: "Declaration",
|
|
17140
|
+
children: $0,
|
|
17141
|
+
specifiers
|
|
17142
|
+
};
|
|
17143
|
+
});
|
|
17144
|
+
function DynamicNamedImports(ctx, state2) {
|
|
17145
|
+
return (0, import_lib2.$EVENT)(ctx, state2, "DynamicNamedImports", DynamicNamedImports$0);
|
|
17146
|
+
}
|
|
17147
|
+
var DynamicImportContents$0 = DynamicNamedImports;
|
|
17148
|
+
var DynamicImportContents$1 = IdentifierName;
|
|
17149
|
+
var DynamicImportContents$2 = Star;
|
|
17150
|
+
var DynamicImportContents$$ = [DynamicImportContents$0, DynamicImportContents$1, DynamicImportContents$2];
|
|
17151
|
+
function DynamicImportContents(ctx, state2) {
|
|
17152
|
+
return (0, import_lib2.$EVENT_C)(ctx, state2, "DynamicImportContents", DynamicImportContents$$);
|
|
17153
|
+
}
|
|
16926
17154
|
var FromClause$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(From, __, ModuleSpecifier), function($skip, $loc, $0, $1, $2, $3) {
|
|
16927
17155
|
var module2 = $3;
|
|
16928
17156
|
if (!Array.isArray(module2)) return $0;
|
|
@@ -16944,17 +17172,17 @@ var ImportAssertion$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2
|
|
|
16944
17172
|
function ImportAssertion(ctx, state2) {
|
|
16945
17173
|
return (0, import_lib2.$EVENT)(ctx, state2, "ImportAssertion", ImportAssertion$0);
|
|
16946
17174
|
}
|
|
16947
|
-
var TypeAndImportSpecifier$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(
|
|
16948
|
-
|
|
16949
|
-
return { ts: true, children: $0, binding: $2.binding };
|
|
17175
|
+
var TypeAndImportSpecifier$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(__, TypeKeyword, ImportSpecifier), function($skip, $loc, $0, $1, $2, $3) {
|
|
17176
|
+
return { ts: true, children: $0, binding: $3.binding };
|
|
16950
17177
|
});
|
|
16951
|
-
var TypeAndImportSpecifier$1 =
|
|
17178
|
+
var TypeAndImportSpecifier$1 = ImportSpecifier;
|
|
17179
|
+
var TypeAndImportSpecifier$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(__, Operator, OperatorImportSpecifier), function($skip, $loc, $0, $1, $2, $3) {
|
|
16952
17180
|
var ws = $1;
|
|
16953
17181
|
var spec = $3;
|
|
16954
17182
|
if (spec.binding.type !== "Identifier") {
|
|
16955
17183
|
throw new Error("Expected identifier after `operator`");
|
|
16956
17184
|
}
|
|
16957
|
-
|
|
17185
|
+
setOperatorBehavior(spec.binding.name, spec.behavior);
|
|
16958
17186
|
return {
|
|
16959
17187
|
...spec,
|
|
16960
17188
|
children: [
|
|
@@ -16964,7 +17192,7 @@ var TypeAndImportSpecifier$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(__, Oper
|
|
|
16964
17192
|
]
|
|
16965
17193
|
};
|
|
16966
17194
|
});
|
|
16967
|
-
var TypeAndImportSpecifier$$ = [TypeAndImportSpecifier$0, TypeAndImportSpecifier$1];
|
|
17195
|
+
var TypeAndImportSpecifier$$ = [TypeAndImportSpecifier$0, TypeAndImportSpecifier$1, TypeAndImportSpecifier$2];
|
|
16968
17196
|
function TypeAndImportSpecifier(ctx, state2) {
|
|
16969
17197
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "TypeAndImportSpecifier", TypeAndImportSpecifier$$);
|
|
16970
17198
|
}
|
|
@@ -17011,6 +17239,27 @@ var OperatorImportSpecifier$$ = [OperatorImportSpecifier$0, OperatorImportSpecif
|
|
|
17011
17239
|
function OperatorImportSpecifier(ctx, state2) {
|
|
17012
17240
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "OperatorImportSpecifier", OperatorImportSpecifier$$);
|
|
17013
17241
|
}
|
|
17242
|
+
var DynamicImportSpecifier$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(__, (0, import_lib2.$E)((0, import_lib2.$S)(TypeKeyword, __, (0, import_lib2.$Y)(DynamicModuleExportName))), DynamicModuleExportName, (0, import_lib2.$E)((0, import_lib2.$S)(ImportAsToken, __, DynamicModuleExportName)), ObjectPropertyDelimiter), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
17243
|
+
var ts2 = $2;
|
|
17244
|
+
var source = $3;
|
|
17245
|
+
var binding = $4;
|
|
17246
|
+
return {
|
|
17247
|
+
source,
|
|
17248
|
+
binding: binding?.[2],
|
|
17249
|
+
ts: !!ts2,
|
|
17250
|
+
// true causes an error later
|
|
17251
|
+
children: $0
|
|
17252
|
+
};
|
|
17253
|
+
});
|
|
17254
|
+
function DynamicImportSpecifier(ctx, state2) {
|
|
17255
|
+
return (0, import_lib2.$EVENT)(ctx, state2, "DynamicImportSpecifier", DynamicImportSpecifier$0);
|
|
17256
|
+
}
|
|
17257
|
+
var DynamicModuleExportName$0 = ModuleExportName;
|
|
17258
|
+
var DynamicModuleExportName$1 = ComputedPropertyName;
|
|
17259
|
+
var DynamicModuleExportName$$ = [DynamicModuleExportName$0, DynamicModuleExportName$1];
|
|
17260
|
+
function DynamicModuleExportName(ctx, state2) {
|
|
17261
|
+
return (0, import_lib2.$EVENT_C)(ctx, state2, "DynamicModuleExportName", DynamicModuleExportName$$);
|
|
17262
|
+
}
|
|
17014
17263
|
var ImportAsToken$0 = (0, import_lib2.$S)(__, As);
|
|
17015
17264
|
var ImportAsToken$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(Loc, __, Colon, (0, import_lib2.$E)((0, import_lib2.$EXPECT)($L17, 'ImportAsToken " "'))), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
17016
17265
|
var l = $1;
|
|
@@ -18302,7 +18551,7 @@ function SingleQuote(ctx, state2) {
|
|
|
18302
18551
|
return (0, import_lib2.$EVENT)(ctx, state2, "SingleQuote", SingleQuote$0);
|
|
18303
18552
|
}
|
|
18304
18553
|
var Star$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L75, 'Star "*"'), function($skip, $loc, $0, $1) {
|
|
18305
|
-
return { $loc, token: $1 };
|
|
18554
|
+
return { $loc, token: $1, type: "Star" };
|
|
18306
18555
|
});
|
|
18307
18556
|
function Star(ctx, state2) {
|
|
18308
18557
|
return (0, import_lib2.$EVENT)(ctx, state2, "Star", Star$0);
|
|
@@ -18455,18 +18704,22 @@ var Yield$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$EXPECT)(
|
|
|
18455
18704
|
function Yield(ctx, state2) {
|
|
18456
18705
|
return (0, import_lib2.$EVENT)(ctx, state2, "Yield", Yield$0);
|
|
18457
18706
|
}
|
|
18458
|
-
var JSXImplicitFragment$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(JSXTag, (0, import_lib2.$Q)((0, import_lib2.$S)(Nested, (0, import_lib2.$C)(JSXTag, JSXAngleChild)))), function($skip, $loc, $0, $1, $2) {
|
|
18459
|
-
|
|
18707
|
+
var JSXImplicitFragment$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(JSXTag, (0, import_lib2.$E)((0, import_lib2.$S)(ImplicitFragmentAllowed, NestedBinaryOpAllowed, NewlineBinaryOpAllowed, (0, import_lib2.$Q)((0, import_lib2.$S)(Nested, (0, import_lib2.$C)(JSXTag, JSXAngleChild)))))), function($skip, $loc, $0, $1, $2) {
|
|
18708
|
+
var first = $1;
|
|
18709
|
+
var rest = $2;
|
|
18710
|
+
rest = rest ? rest[3] : [];
|
|
18711
|
+
const jsx = rest.length === 0 ? first : {
|
|
18460
18712
|
type: "JSXFragment",
|
|
18461
18713
|
children: [
|
|
18462
18714
|
"<>\n",
|
|
18463
18715
|
state.currentIndent.token,
|
|
18464
|
-
|
|
18716
|
+
first,
|
|
18717
|
+
...rest,
|
|
18465
18718
|
"\n",
|
|
18466
18719
|
state.currentIndent.token,
|
|
18467
18720
|
"</>"
|
|
18468
18721
|
],
|
|
18469
|
-
jsxChildren: [
|
|
18722
|
+
jsxChildren: [first, ...rest.map(([, tag]) => tag)]
|
|
18470
18723
|
};
|
|
18471
18724
|
const type = typeOfJSX(jsx, config);
|
|
18472
18725
|
return type ? [
|
|
@@ -19201,13 +19454,7 @@ var JSXAngleChild$0 = (0, import_lib2.$T)((0, import_lib2.$S)(CloseAngleBracket,
|
|
|
19201
19454
|
function JSXAngleChild(ctx, state2) {
|
|
19202
19455
|
return (0, import_lib2.$EVENT)(ctx, state2, "JSXAngleChild", JSXAngleChild$0);
|
|
19203
19456
|
}
|
|
19204
|
-
var JSXCodeChild$0 = (0, import_lib2.$
|
|
19205
|
-
var open = $1;
|
|
19206
|
-
var expression = $2;
|
|
19207
|
-
var close = $3;
|
|
19208
|
-
if (!expression) return $skip;
|
|
19209
|
-
return [open, expression, close];
|
|
19210
|
-
});
|
|
19457
|
+
var JSXCodeChild$0 = (0, import_lib2.$S)(InsertInlineOpenBrace, JSXCodeChildExpression, InsertCloseBrace);
|
|
19211
19458
|
function JSXCodeChild(ctx, state2) {
|
|
19212
19459
|
return (0, import_lib2.$EVENT)(ctx, state2, "JSXCodeChild", JSXCodeChild$0);
|
|
19213
19460
|
}
|
|
@@ -20550,6 +20797,7 @@ var CivetOption$0 = (0, import_lib2.$TR)((0, import_lib2.$EXPECT)($R99, "CivetOp
|
|
|
20550
20797
|
break;
|
|
20551
20798
|
case "globals":
|
|
20552
20799
|
case "symbols":
|
|
20800
|
+
case "operators":
|
|
20553
20801
|
value = value.split(",").filter(Boolean);
|
|
20554
20802
|
break;
|
|
20555
20803
|
}
|
|
@@ -20870,6 +21118,7 @@ var Reset$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'Reset ""'), fu
|
|
|
20870
21118
|
state.forbidTrailingMemberProperty = [false];
|
|
20871
21119
|
state.forbidNestedBinaryOp = [false];
|
|
20872
21120
|
state.forbidNewlineBinaryOp = [false];
|
|
21121
|
+
state.forbidImplicitFragment = [false];
|
|
20873
21122
|
state.forbidPipeline = [false];
|
|
20874
21123
|
state.JSXTagStack = [void 0];
|
|
20875
21124
|
state.operators = /* @__PURE__ */ new Map();
|
|
@@ -20958,6 +21207,36 @@ var Reset$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'Reset ""'), fu
|
|
|
20958
21207
|
}
|
|
20959
21208
|
}
|
|
20960
21209
|
});
|
|
21210
|
+
Object.defineProperty(config, "operators", {
|
|
21211
|
+
set(o) {
|
|
21212
|
+
if (!o) return;
|
|
21213
|
+
if (typeof o !== "object") {
|
|
21214
|
+
throw new Error("operators configuration must be an object or array");
|
|
21215
|
+
}
|
|
21216
|
+
if (Array.isArray(o)) {
|
|
21217
|
+
o.forEach((name) => {
|
|
21218
|
+
if (typeof name !== "string") {
|
|
21219
|
+
throw new Error("operators configuration array must contain only strings");
|
|
21220
|
+
}
|
|
21221
|
+
setOperatorBehavior(name, void 0);
|
|
21222
|
+
});
|
|
21223
|
+
} else {
|
|
21224
|
+
for (let [name, behavior] of Object.entries(o)) {
|
|
21225
|
+
if (typeof behavior === "string") {
|
|
21226
|
+
behavior = behavior.trim();
|
|
21227
|
+
behavior = behavior ? parse(behavior, {
|
|
21228
|
+
startRule: "OperatorBehavior",
|
|
21229
|
+
filename: `operator config for ${name}`
|
|
21230
|
+
}) : void 0;
|
|
21231
|
+
}
|
|
21232
|
+
if (behavior && typeof behavior !== "object") {
|
|
21233
|
+
throw new Error("operators configuration object must have string or object values");
|
|
21234
|
+
}
|
|
21235
|
+
setOperatorBehavior(name, behavior);
|
|
21236
|
+
}
|
|
21237
|
+
}
|
|
21238
|
+
}
|
|
21239
|
+
});
|
|
20961
21240
|
Object.assign(config, initialConfig);
|
|
20962
21241
|
});
|
|
20963
21242
|
function Reset(ctx, state2) {
|
|
@@ -21089,26 +21368,24 @@ var PushExtraIndent1$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'Pus
|
|
|
21089
21368
|
function PushExtraIndent1(ctx, state2) {
|
|
21090
21369
|
return (0, import_lib2.$EVENT)(ctx, state2, "PushExtraIndent1", PushExtraIndent1$0);
|
|
21091
21370
|
}
|
|
21092
|
-
var parser =
|
|
21093
|
-
|
|
21094
|
-
|
|
21095
|
-
|
|
21096
|
-
|
|
21097
|
-
|
|
21098
|
-
|
|
21099
|
-
|
|
21100
|
-
|
|
21101
|
-
|
|
21102
|
-
|
|
21103
|
-
|
|
21104
|
-
|
|
21105
|
-
|
|
21106
|
-
|
|
21107
|
-
|
|
21108
|
-
|
|
21109
|
-
|
|
21110
|
-
};
|
|
21111
|
-
}();
|
|
21371
|
+
var parser = {
|
|
21372
|
+
parse: (input, options = {}) => {
|
|
21373
|
+
const { fail, validate, reset } = (0, import_lib2.Validator)();
|
|
21374
|
+
let ctx = { expectation: "", fail };
|
|
21375
|
+
if (typeof input !== "string") throw new Error("Input must be a string");
|
|
21376
|
+
const parser2 = options.startRule != null ? grammar[options.startRule] : Object.values(grammar)[0];
|
|
21377
|
+
if (!parser2) throw new Error(`Could not find rule with name '${options.startRule}'`);
|
|
21378
|
+
const filename2 = options.filename || "<anonymous>";
|
|
21379
|
+
reset();
|
|
21380
|
+
Object.assign(ctx, { ...options.events, tokenize: options.tokenize });
|
|
21381
|
+
return validate(input, parser2(ctx, {
|
|
21382
|
+
input,
|
|
21383
|
+
pos: 0
|
|
21384
|
+
}), {
|
|
21385
|
+
filename: filename2
|
|
21386
|
+
});
|
|
21387
|
+
}
|
|
21388
|
+
};
|
|
21112
21389
|
var { parse } = parser;
|
|
21113
21390
|
var filename;
|
|
21114
21391
|
var initialConfig;
|
|
@@ -21123,6 +21400,7 @@ var state = {
|
|
|
21123
21400
|
forbidTrailingMemberProperty: [false],
|
|
21124
21401
|
forbidNestedBinaryOp: [false],
|
|
21125
21402
|
forbidNewlineBinaryOp: [false],
|
|
21403
|
+
forbidImplicitFragment: [false],
|
|
21126
21404
|
forbidPipeline: [false],
|
|
21127
21405
|
JSXTagStack: [void 0]
|
|
21128
21406
|
};
|
|
@@ -21174,6 +21452,12 @@ Object.defineProperties(state, {
|
|
|
21174
21452
|
return s[s.length - 1];
|
|
21175
21453
|
}
|
|
21176
21454
|
},
|
|
21455
|
+
implicitFragmentForbidden: {
|
|
21456
|
+
get() {
|
|
21457
|
+
const { forbidImplicitFragment: s } = state;
|
|
21458
|
+
return s[s.length - 1];
|
|
21459
|
+
}
|
|
21460
|
+
},
|
|
21177
21461
|
pipelineForbidden: {
|
|
21178
21462
|
get() {
|
|
21179
21463
|
const { forbidPipeline: s } = state;
|
|
@@ -21187,8 +21471,16 @@ Object.defineProperties(state, {
|
|
|
21187
21471
|
}
|
|
21188
21472
|
}
|
|
21189
21473
|
});
|
|
21474
|
+
function setOperatorBehavior(name, behavior) {
|
|
21475
|
+
const existing = state.operators.get(name);
|
|
21476
|
+
if (existing && behavior) {
|
|
21477
|
+
state.operators.set(name, { ...existing, ...behavior });
|
|
21478
|
+
} else {
|
|
21479
|
+
state.operators.set(name, behavior || existing);
|
|
21480
|
+
}
|
|
21481
|
+
}
|
|
21190
21482
|
function getStateKey() {
|
|
21191
|
-
const stateInt = state.currentIndent.level % 256 <<
|
|
21483
|
+
const stateInt = state.currentIndent.level % 256 << 9 | state.classImplicitCallForbidden << 8 | state.indentedApplicationForbidden << 7 | state.bracedApplicationForbidden << 6 | state.trailingMemberPropertyForbidden << 5 | state.nestedBinaryOpForbidden << 4 | state.newlineBinaryOpForbidden << 3 | state.implicitFragmentForbidden << 2 | state.pipelineForbidden << 1 | // This is slightly different than the rest of the state,
|
|
21192
21484
|
// since it is affected by the directive prologue and may be hit
|
|
21193
21485
|
// by the EOL rule early in the parse. Later if we wanted to
|
|
21194
21486
|
// allow block scoping of the compat directives we would need to
|
|
@@ -21288,7 +21580,7 @@ var SourceMap = class {
|
|
|
21288
21580
|
const line = ref1[i1];
|
|
21289
21581
|
results.push((() => {
|
|
21290
21582
|
const results1 = [];
|
|
21291
|
-
for (let i2 = 0,
|
|
21583
|
+
for (let i2 = 0, len12 = line.length; i2 < len12; i2++) {
|
|
21292
21584
|
const entry = line[i2];
|
|
21293
21585
|
if (entry.length === 4) {
|
|
21294
21586
|
let [colDelta, sourceFileIndex, srcLine, srcCol] = entry;
|
|
@@ -21628,10 +21920,11 @@ var WorkerPool = class {
|
|
|
21628
21920
|
const { Worker } = await import("node:worker_threads");
|
|
21629
21921
|
const path = (await import("node:path")).default;
|
|
21630
21922
|
const worker = new Worker(path.join(__dirname, "node-worker.mjs"));
|
|
21631
|
-
worker.on("message", (response) => {
|
|
21923
|
+
worker.on("message", async (response) => {
|
|
21632
21924
|
const callback = this.callbacks.get(response.id);
|
|
21633
21925
|
this.callbacks.delete(response.id);
|
|
21634
21926
|
if (response.error) {
|
|
21927
|
+
await new Promise((done) => setTimeout(done, 0));
|
|
21635
21928
|
const message = `${response.error.name}: ${response.error.message}`;
|
|
21636
21929
|
let ref;
|
|
21637
21930
|
if (response.error.type in globalThis) {
|
|
@@ -21747,7 +22040,32 @@ var uncacheable = /* @__PURE__ */ new Set([
|
|
|
21747
22040
|
"RestorePipeline"
|
|
21748
22041
|
]);
|
|
21749
22042
|
var workerPool;
|
|
22043
|
+
function decode(src) {
|
|
22044
|
+
if (typeof src === "string") {
|
|
22045
|
+
return src;
|
|
22046
|
+
}
|
|
22047
|
+
if (typeof Buffer === "undefined") {
|
|
22048
|
+
return src;
|
|
22049
|
+
}
|
|
22050
|
+
if (!Buffer?.isBuffer(src)) {
|
|
22051
|
+
return src;
|
|
22052
|
+
}
|
|
22053
|
+
if (src[0] === 239 && src[1] === 187 && src[2] === 191) {
|
|
22054
|
+
return src.toString("utf8", 3);
|
|
22055
|
+
} else if (src[0] === 255 && src[1] === 254) {
|
|
22056
|
+
return src.toString("utf16le", 2);
|
|
22057
|
+
} else if (src[0] === 254 && src[1] === 255) {
|
|
22058
|
+
for (let end = src.length - 2, i1 = 2; i1 <= end; i1 += 2) {
|
|
22059
|
+
const i = i1;
|
|
22060
|
+
[src[i], src[i + 1]] = [src[i + 1], src[i]];
|
|
22061
|
+
}
|
|
22062
|
+
return src.toString("utf16le", 2);
|
|
22063
|
+
} else {
|
|
22064
|
+
return src.toString("utf8");
|
|
22065
|
+
}
|
|
22066
|
+
}
|
|
21750
22067
|
function compile(src, options) {
|
|
22068
|
+
src = decode(src);
|
|
21751
22069
|
if (!(process.env.CIVET_THREADS == 0)) {
|
|
21752
22070
|
const threads = parseInt(options?.threads ?? process.env.CIVET_THREADS, 10);
|
|
21753
22071
|
if (threads === 0) {
|
|
@@ -21944,6 +22262,7 @@ var main_civet_default = { parse, parseProgram, ParseError: import_lib2.ParseErr
|
|
|
21944
22262
|
ParseErrors,
|
|
21945
22263
|
SourceMap,
|
|
21946
22264
|
compile,
|
|
22265
|
+
decode,
|
|
21947
22266
|
generate,
|
|
21948
22267
|
isCompileError,
|
|
21949
22268
|
lib,
|