@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.mjs
CHANGED
|
@@ -604,7 +604,7 @@ function addParentPointers(node, parent) {
|
|
|
604
604
|
node.parent = parent;
|
|
605
605
|
}
|
|
606
606
|
if (node.children) {
|
|
607
|
-
for (let ref = node.children, i1 = 0,
|
|
607
|
+
for (let ref = node.children, i1 = 0, len12 = ref.length; i1 < len12; i1++) {
|
|
608
608
|
const child = ref[i1];
|
|
609
609
|
addParentPointers(child, node);
|
|
610
610
|
}
|
|
@@ -1588,7 +1588,7 @@ function findChildIndex(parent, child) {
|
|
|
1588
1588
|
}
|
|
1589
1589
|
}
|
|
1590
1590
|
function arrayRecurse(array) {
|
|
1591
|
-
for (let i2 = 0,
|
|
1591
|
+
for (let i2 = 0, len12 = array.length; i2 < len12; i2++) {
|
|
1592
1592
|
const c = array[i2];
|
|
1593
1593
|
if (c === child || Array.isArray(c) && arrayRecurse(c)) {
|
|
1594
1594
|
return true;
|
|
@@ -1795,7 +1795,7 @@ function adjustBindingElements(elements) {
|
|
|
1795
1795
|
const names = elements.flatMap(($2) => $2.names || []);
|
|
1796
1796
|
const { length } = elements;
|
|
1797
1797
|
let blockPrefix, restIndex = -1, restCount = 0;
|
|
1798
|
-
for (let i2 = 0,
|
|
1798
|
+
for (let i2 = 0, len12 = elements.length; i2 < len12; i2++) {
|
|
1799
1799
|
const i = i2;
|
|
1800
1800
|
const { type } = elements[i2];
|
|
1801
1801
|
if (type === "BindingRestElement") {
|
|
@@ -3054,7 +3054,7 @@ function patternBindings(pattern) {
|
|
|
3054
3054
|
function recurse(pattern2) {
|
|
3055
3055
|
switch (pattern2.type) {
|
|
3056
3056
|
case "ArrayBindingPattern": {
|
|
3057
|
-
for (let ref3 = pattern2.elements, i2 = 0,
|
|
3057
|
+
for (let ref3 = pattern2.elements, i2 = 0, len12 = ref3.length; i2 < len12; i2++) {
|
|
3058
3058
|
const element = ref3[i2];
|
|
3059
3059
|
recurse(element);
|
|
3060
3060
|
}
|
|
@@ -4024,7 +4024,11 @@ function processSignature(f) {
|
|
|
4024
4024
|
}
|
|
4025
4025
|
}
|
|
4026
4026
|
if (signature.modifier.async && !signature.modifier.generator && signature.returnType && !isPromiseType(signature.returnType.t)) {
|
|
4027
|
-
replaceNode(
|
|
4027
|
+
replaceNode(
|
|
4028
|
+
signature.returnType.t,
|
|
4029
|
+
wrapTypeInPromise(signature.returnType.t),
|
|
4030
|
+
signature.returnType
|
|
4031
|
+
);
|
|
4028
4032
|
}
|
|
4029
4033
|
}
|
|
4030
4034
|
function processFunctions(statements, config2) {
|
|
@@ -4053,14 +4057,23 @@ function expressionizeIteration(exp) {
|
|
|
4053
4057
|
if (generator) {
|
|
4054
4058
|
iterationDefaultBody(statement);
|
|
4055
4059
|
assignResults(block, (node) => {
|
|
4060
|
+
let star;
|
|
4061
|
+
if (node && typeof node === "object" && "type" in node && node.type === "SpreadElement" && "expression" in node) {
|
|
4062
|
+
const { expression } = node;
|
|
4063
|
+
star = "*";
|
|
4064
|
+
node = expression;
|
|
4065
|
+
}
|
|
4056
4066
|
return {
|
|
4057
4067
|
type: "YieldExpression",
|
|
4058
4068
|
expression: node,
|
|
4069
|
+
star,
|
|
4059
4070
|
children: [
|
|
4060
4071
|
{
|
|
4061
4072
|
type: "Yield",
|
|
4062
|
-
|
|
4073
|
+
children: ["yield"]
|
|
4063
4074
|
},
|
|
4075
|
+
star,
|
|
4076
|
+
" ",
|
|
4064
4077
|
node
|
|
4065
4078
|
]
|
|
4066
4079
|
};
|
|
@@ -4254,6 +4267,17 @@ function braceBlock(block) {
|
|
|
4254
4267
|
}
|
|
4255
4268
|
}
|
|
4256
4269
|
}
|
|
4270
|
+
function unbraceBlock(block) {
|
|
4271
|
+
if (block.bare) {
|
|
4272
|
+
return;
|
|
4273
|
+
}
|
|
4274
|
+
let ref;
|
|
4275
|
+
if (block.children[0] === " {" && (ref = block.children)[ref.length - 1] === "}") {
|
|
4276
|
+
block.children.shift();
|
|
4277
|
+
block.children.pop();
|
|
4278
|
+
block.bare = true;
|
|
4279
|
+
}
|
|
4280
|
+
}
|
|
4257
4281
|
function duplicateBlock(block) {
|
|
4258
4282
|
const expressions = [...block.expressions];
|
|
4259
4283
|
let children;
|
|
@@ -4352,16 +4376,58 @@ function insertHoistDec(block, node, dec) {
|
|
|
4352
4376
|
}
|
|
4353
4377
|
function processBlocks(statements) {
|
|
4354
4378
|
insertSemicolon(statements);
|
|
4355
|
-
for (let
|
|
4356
|
-
const
|
|
4357
|
-
|
|
4379
|
+
for (let ref1 = gatherRecursive(statements, ($) => $.type === "BlockStatement"), i2 = 0, len12 = ref1.length; i2 < len12; i2++) {
|
|
4380
|
+
const block = ref1[i2];
|
|
4381
|
+
let m;
|
|
4382
|
+
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")) {
|
|
4383
|
+
const object = block.expressions[0][1].expression;
|
|
4384
|
+
if (!(() => {
|
|
4385
|
+
let results = true;
|
|
4386
|
+
for (const prop of object.properties) {
|
|
4387
|
+
if (!(prop.type === "Property" && prop.implicitName)) {
|
|
4388
|
+
results = false;
|
|
4389
|
+
break;
|
|
4390
|
+
}
|
|
4391
|
+
}
|
|
4392
|
+
return results;
|
|
4393
|
+
})()) {
|
|
4394
|
+
continue;
|
|
4395
|
+
}
|
|
4396
|
+
block.expressions[0][1] = block.expressions[0][1].expression;
|
|
4397
|
+
unbraceBlock(block);
|
|
4398
|
+
for (let ref2 = object.properties, i3 = 0, len22 = ref2.length; i3 < len22; i3++) {
|
|
4399
|
+
const i = i3;
|
|
4400
|
+
const prop = ref2[i3];
|
|
4401
|
+
let m1;
|
|
4402
|
+
if (m1 = prop.name, typeof m1 === "object" && m1 != null && "type" in m1 && m1.type === "ComputedPropertyName" && "implicit" in m1 && m1.implicit === true) {
|
|
4403
|
+
replaceNode(prop.name, prop.name.expression, prop);
|
|
4404
|
+
}
|
|
4405
|
+
if (prop.delim?.implicit) {
|
|
4406
|
+
if (needsPrecedingSemicolon(object.properties[i + 1])) {
|
|
4407
|
+
prop.delim.token = ";";
|
|
4408
|
+
} else {
|
|
4409
|
+
replaceNode(prop.delim, void 0, prop);
|
|
4410
|
+
prop.delim = void 0;
|
|
4411
|
+
}
|
|
4412
|
+
}
|
|
4413
|
+
const colon = prop.children.indexOf(": ");
|
|
4414
|
+
if (colon < 0) {
|
|
4415
|
+
continue;
|
|
4416
|
+
}
|
|
4417
|
+
if (!(prop.children[colon - 1] === prop.name)) {
|
|
4418
|
+
continue;
|
|
4419
|
+
}
|
|
4420
|
+
prop.children.splice(colon - 1, 2);
|
|
4421
|
+
}
|
|
4422
|
+
}
|
|
4423
|
+
processBlocks(block.expressions);
|
|
4358
4424
|
}
|
|
4359
4425
|
}
|
|
4360
4426
|
function insertSemicolon(statements) {
|
|
4361
4427
|
const l = statements.length;
|
|
4362
|
-
for (let
|
|
4363
|
-
const i =
|
|
4364
|
-
const s = statements[
|
|
4428
|
+
for (let i4 = 0, len3 = statements.length; i4 < len3; i4++) {
|
|
4429
|
+
const i = i4;
|
|
4430
|
+
const s = statements[i4];
|
|
4365
4431
|
if (i < l - 1) {
|
|
4366
4432
|
if (needsPrecedingSemicolon(statements[i + 1][1])) {
|
|
4367
4433
|
const delim = s[2];
|
|
@@ -4379,8 +4445,8 @@ function needsPrecedingSemicolon(exp) {
|
|
|
4379
4445
|
return false;
|
|
4380
4446
|
}
|
|
4381
4447
|
if (Array.isArray(exp)) {
|
|
4382
|
-
for (let
|
|
4383
|
-
const child = exp[
|
|
4448
|
+
for (let i5 = 0, len4 = exp.length; i5 < len4; i5++) {
|
|
4449
|
+
const child = exp[i5];
|
|
4384
4450
|
if (!(child != null)) {
|
|
4385
4451
|
continue;
|
|
4386
4452
|
}
|
|
@@ -4426,8 +4492,8 @@ function needsPrecedingSemicolon(exp) {
|
|
|
4426
4492
|
function blockContainingStatement(exp) {
|
|
4427
4493
|
let child = exp;
|
|
4428
4494
|
let parent = exp.parent;
|
|
4429
|
-
let
|
|
4430
|
-
while (parent != null && (
|
|
4495
|
+
let m2;
|
|
4496
|
+
while (parent != null && (m2 = parent.type, m2 === "StatementExpression" || m2 === "PipelineExpression" || m2 === "UnwrappedExpression")) {
|
|
4431
4497
|
child = parent;
|
|
4432
4498
|
parent = parent.parent;
|
|
4433
4499
|
}
|
|
@@ -4480,7 +4546,7 @@ var precedenceMap = /* @__PURE__ */ new Map();
|
|
|
4480
4546
|
for (let i1 = 0, len3 = precedenceOrder.length; i1 < len3; i1++) {
|
|
4481
4547
|
const prec = i1;
|
|
4482
4548
|
const ops = precedenceOrder[i1];
|
|
4483
|
-
for (let i2 = 0,
|
|
4549
|
+
for (let i2 = 0, len12 = ops.length; i2 < len12; i2++) {
|
|
4484
4550
|
const op = ops[i2];
|
|
4485
4551
|
precedenceMap.set(op, prec);
|
|
4486
4552
|
}
|
|
@@ -4811,7 +4877,7 @@ function processPatternMatching(statements) {
|
|
|
4811
4877
|
let isPattern = false;
|
|
4812
4878
|
if (clauses.some(($4) => $4.type === "PatternClause")) {
|
|
4813
4879
|
isPattern = true;
|
|
4814
|
-
for (let i2 = 0,
|
|
4880
|
+
for (let i2 = 0, len12 = clauses.length; i2 < len12; i2++) {
|
|
4815
4881
|
const c = clauses[i2];
|
|
4816
4882
|
if (!(c.type === "PatternClause" || c.type === "DefaultClause")) {
|
|
4817
4883
|
errors = true;
|
|
@@ -5345,7 +5411,7 @@ function processAssignmentDeclaration(decl, pattern, typeSuffix, ws, assign, e)
|
|
|
5345
5411
|
});
|
|
5346
5412
|
}
|
|
5347
5413
|
function processDeclarations(statements) {
|
|
5348
|
-
for (let ref1 = gatherRecursiveAll(statements, ($) => $.type === "Declaration"), i1 = 0,
|
|
5414
|
+
for (let ref1 = gatherRecursiveAll(statements, ($) => $.type === "Declaration"), i1 = 0, len12 = ref1.length; i1 < len12; i1++) {
|
|
5349
5415
|
const declaration = ref1[i1];
|
|
5350
5416
|
const { bindings } = declaration;
|
|
5351
5417
|
if (!(bindings != null)) {
|
|
@@ -5432,7 +5498,7 @@ function prependStatementExpressionBlock(initializer, statement) {
|
|
|
5432
5498
|
}
|
|
5433
5499
|
const pre = [];
|
|
5434
5500
|
const statementExp = exp.statement;
|
|
5435
|
-
const blockStatement = ["", statementExp];
|
|
5501
|
+
const blockStatement = [ws || "", statementExp, ";"];
|
|
5436
5502
|
let ref;
|
|
5437
5503
|
if (statementExp.type === "IterationExpression") {
|
|
5438
5504
|
if (statementExp.async || statementExp.generator) {
|
|
@@ -5454,9 +5520,9 @@ function prependStatementExpressionBlock(initializer, statement) {
|
|
|
5454
5520
|
});
|
|
5455
5521
|
const refDec = {
|
|
5456
5522
|
type: "Declaration",
|
|
5457
|
-
children: ["let ", ref
|
|
5523
|
+
children: ["let ", ref]
|
|
5458
5524
|
};
|
|
5459
|
-
pre.unshift(refDec);
|
|
5525
|
+
pre.unshift(["", refDec, ";"]);
|
|
5460
5526
|
} else {
|
|
5461
5527
|
wrapIterationReturningResults(statement2, () => void 0);
|
|
5462
5528
|
ref = initializer.expression = initializer.children[2] = statement2.resultsRef;
|
|
@@ -5472,14 +5538,11 @@ function prependStatementExpressionBlock(initializer, statement) {
|
|
|
5472
5538
|
});
|
|
5473
5539
|
const refDec = {
|
|
5474
5540
|
type: "Declaration",
|
|
5475
|
-
children: ["let ", ref
|
|
5541
|
+
children: ["let ", ref]
|
|
5476
5542
|
};
|
|
5477
|
-
pre.unshift(refDec);
|
|
5478
|
-
if (ws) {
|
|
5479
|
-
pre.push(ws);
|
|
5480
|
-
}
|
|
5543
|
+
pre.unshift(["", refDec, ";"]);
|
|
5481
5544
|
}
|
|
5482
|
-
statement.children.unshift(pre, blockStatement
|
|
5545
|
+
statement.children.unshift(...pre, blockStatement);
|
|
5483
5546
|
updateParentPointers(blockStatement, statement);
|
|
5484
5547
|
return ref;
|
|
5485
5548
|
}
|
|
@@ -5800,26 +5863,60 @@ function dynamizeImportDeclaration(decl) {
|
|
|
5800
5863
|
};
|
|
5801
5864
|
}
|
|
5802
5865
|
function dynamizeImportDeclarationExpression($0) {
|
|
5803
|
-
const [imp, ws1,
|
|
5804
|
-
const
|
|
5805
|
-
|
|
5806
|
-
return processCallMemberExpression({
|
|
5807
|
-
type: "CallExpression",
|
|
5866
|
+
const [imp, ws1, imports, ws2, from] = $0;
|
|
5867
|
+
const awaitExpression = {
|
|
5868
|
+
type: "AwaitExpression",
|
|
5808
5869
|
children: [
|
|
5809
|
-
{ type: "Await", children: "await" },
|
|
5870
|
+
{ type: "Await", children: ["await"] },
|
|
5810
5871
|
" ",
|
|
5811
5872
|
imp,
|
|
5812
5873
|
trimFirstSpace(ws2),
|
|
5813
|
-
dynamizeFromClause(from)
|
|
5814
|
-
{
|
|
5815
|
-
type: "PropertyGlob",
|
|
5816
|
-
dot,
|
|
5817
|
-
object,
|
|
5818
|
-
children: [ws1, dot, object],
|
|
5819
|
-
reversed: true
|
|
5820
|
-
}
|
|
5874
|
+
dynamizeFromClause(from)
|
|
5821
5875
|
]
|
|
5822
|
-
}
|
|
5876
|
+
};
|
|
5877
|
+
const dot = {
|
|
5878
|
+
type: "AccessStart",
|
|
5879
|
+
children: ["."],
|
|
5880
|
+
optional: false
|
|
5881
|
+
};
|
|
5882
|
+
switch (imports?.type) {
|
|
5883
|
+
case "Identifier": {
|
|
5884
|
+
return processCallMemberExpression({
|
|
5885
|
+
type: "CallExpression",
|
|
5886
|
+
children: [
|
|
5887
|
+
parenthesizeExpression(awaitExpression),
|
|
5888
|
+
{
|
|
5889
|
+
type: "PropertyAccess",
|
|
5890
|
+
dot,
|
|
5891
|
+
name: "default",
|
|
5892
|
+
children: [ws1, dot, "default"]
|
|
5893
|
+
}
|
|
5894
|
+
]
|
|
5895
|
+
});
|
|
5896
|
+
}
|
|
5897
|
+
case "Star": {
|
|
5898
|
+
return parenthesizeExpression(awaitExpression);
|
|
5899
|
+
}
|
|
5900
|
+
case "Declaration": {
|
|
5901
|
+
const object = convertNamedImportsToObject(imports);
|
|
5902
|
+
return processCallMemberExpression({
|
|
5903
|
+
type: "CallExpression",
|
|
5904
|
+
children: [
|
|
5905
|
+
parenthesizeExpression(awaitExpression),
|
|
5906
|
+
{
|
|
5907
|
+
type: "PropertyGlob",
|
|
5908
|
+
dot,
|
|
5909
|
+
object,
|
|
5910
|
+
children: [ws1, dot, object],
|
|
5911
|
+
reversed: true
|
|
5912
|
+
}
|
|
5913
|
+
]
|
|
5914
|
+
});
|
|
5915
|
+
}
|
|
5916
|
+
default: {
|
|
5917
|
+
throw new Error("Unsupported dynamic import");
|
|
5918
|
+
}
|
|
5919
|
+
}
|
|
5823
5920
|
}
|
|
5824
5921
|
function convertWithClause(withClause, extendsClause) {
|
|
5825
5922
|
let extendsToken, extendsTarget, ws;
|
|
@@ -6119,7 +6216,7 @@ function processPipelineExpressions(statements) {
|
|
|
6119
6216
|
const children = [ws];
|
|
6120
6217
|
const comma = blockContainingStatement(s) ? ";" : ",";
|
|
6121
6218
|
let usingRef = null;
|
|
6122
|
-
for (let i2 = 0,
|
|
6219
|
+
for (let i2 = 0, len12 = body.length; i2 < len12; i2++) {
|
|
6123
6220
|
const i = i2;
|
|
6124
6221
|
const step = body[i2];
|
|
6125
6222
|
const [leadingComment, pipe, trailingComment, expr] = step;
|
|
@@ -6911,7 +7008,7 @@ function dedentBlockSubstitutions($0, tab) {
|
|
|
6911
7008
|
}
|
|
6912
7009
|
const stringPart = (() => {
|
|
6913
7010
|
const results1 = [];
|
|
6914
|
-
for (let i2 = 0,
|
|
7011
|
+
for (let i2 = 0, len12 = strWithSubstitutions.length; i2 < len12; i2++) {
|
|
6915
7012
|
const part = strWithSubstitutions[i2];
|
|
6916
7013
|
results1.push(part.token ?? "s");
|
|
6917
7014
|
}
|
|
@@ -7001,6 +7098,9 @@ function quoteString(str) {
|
|
|
7001
7098
|
|
|
7002
7099
|
// unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\lib.civet.jsx
|
|
7003
7100
|
var xor = (a, b) => a ? !b && a : b;
|
|
7101
|
+
function len1(arr, length) {
|
|
7102
|
+
return arr.length === length;
|
|
7103
|
+
}
|
|
7004
7104
|
function addPostfixStatement(statement, ws, post) {
|
|
7005
7105
|
const expressions = [
|
|
7006
7106
|
...post.blockPrefix || [],
|
|
@@ -7378,7 +7478,7 @@ function processCallMemberExpression(node) {
|
|
|
7378
7478
|
isComma(args[args.length - 1]).token = "";
|
|
7379
7479
|
}
|
|
7380
7480
|
let commaCount = 0;
|
|
7381
|
-
for (let i2 = 0,
|
|
7481
|
+
for (let i2 = 0, len22 = args.length; i2 < len22; i2++) {
|
|
7382
7482
|
const i = i2;
|
|
7383
7483
|
let arg = args[i2];
|
|
7384
7484
|
if (isComma(arg)) {
|
|
@@ -7408,19 +7508,22 @@ function processCallMemberExpression(node) {
|
|
|
7408
7508
|
}
|
|
7409
7509
|
}
|
|
7410
7510
|
}
|
|
7411
|
-
for (let i3 = 0,
|
|
7511
|
+
for (let i3 = 0, len3 = children.length; i3 < len3; i3++) {
|
|
7412
7512
|
const i = i3;
|
|
7413
7513
|
const glob = children[i3];
|
|
7414
7514
|
if (glob?.type === "PropertyGlob") {
|
|
7415
7515
|
let prefix = children.slice(0, i);
|
|
7416
7516
|
const parts = [];
|
|
7417
7517
|
let ref;
|
|
7418
|
-
if (prefix
|
|
7518
|
+
if (needsRef(prefix) && glob.object.properties.length > 1) {
|
|
7519
|
+
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) {
|
|
7520
|
+
prefix = [prefix[0].expression];
|
|
7521
|
+
}
|
|
7419
7522
|
ref = makeRef();
|
|
7420
7523
|
const { refAssignment } = makeRefAssignment(ref, prefix);
|
|
7421
7524
|
prefix = [makeLeftHandSideExpression(refAssignment)];
|
|
7422
7525
|
}
|
|
7423
|
-
|
|
7526
|
+
let prefixDot = [...prefix, glob.dot];
|
|
7424
7527
|
for (const part of glob.object.properties) {
|
|
7425
7528
|
if (part.type === "Error") {
|
|
7426
7529
|
parts.push(part);
|
|
@@ -7433,7 +7536,7 @@ function processCallMemberExpression(node) {
|
|
|
7433
7536
|
});
|
|
7434
7537
|
continue;
|
|
7435
7538
|
}
|
|
7436
|
-
if (part.value && !["CallExpression", "MemberExpression", "Identifier"].includes(part.value.type)) {
|
|
7539
|
+
if (part.value && !["CallExpression", "MemberExpression", "Identifier", "StringLiteral", "ComputedPropertyName"].includes(part.value.type)) {
|
|
7437
7540
|
parts.push({
|
|
7438
7541
|
type: "Error",
|
|
7439
7542
|
message: `Glob pattern must have call or member expression value, found ${JSON.stringify(part.value)}`
|
|
@@ -7449,9 +7552,28 @@ function processCallMemberExpression(node) {
|
|
|
7449
7552
|
[name, value] = [value, name];
|
|
7450
7553
|
}
|
|
7451
7554
|
if (!suppressPrefix) {
|
|
7452
|
-
value
|
|
7555
|
+
if (value.type === "StringLiteral") {
|
|
7556
|
+
value = [
|
|
7557
|
+
...prefix,
|
|
7558
|
+
{
|
|
7559
|
+
type: "Index",
|
|
7560
|
+
children: ["[", trimFirstSpace(value), "]"]
|
|
7561
|
+
}
|
|
7562
|
+
];
|
|
7563
|
+
} else if (value.type === "ComputedPropertyName") {
|
|
7564
|
+
value = [
|
|
7565
|
+
...prefix,
|
|
7566
|
+
{
|
|
7567
|
+
type: "Index",
|
|
7568
|
+
children: [trimFirstSpace(value)]
|
|
7569
|
+
}
|
|
7570
|
+
];
|
|
7571
|
+
} else {
|
|
7572
|
+
value = [...prefixDot, trimFirstSpace(value)];
|
|
7573
|
+
}
|
|
7453
7574
|
if (ref != null) {
|
|
7454
|
-
prefix = [ref]
|
|
7575
|
+
prefix = [ref];
|
|
7576
|
+
prefixDot = [...prefix, glob.dot];
|
|
7455
7577
|
}
|
|
7456
7578
|
}
|
|
7457
7579
|
if (wValue) value.unshift(wValue);
|
|
@@ -7627,21 +7749,18 @@ function makeExpressionStatement(expression) {
|
|
|
7627
7749
|
}
|
|
7628
7750
|
}
|
|
7629
7751
|
function lastAccessInCallExpression(exp) {
|
|
7630
|
-
|
|
7752
|
+
while (exp.type === "MemberExpression" || exp.type === "CallExpression") {
|
|
7753
|
+
const { children } = exp;
|
|
7754
|
+
let i = children.length - 1;
|
|
7755
|
+
while (i >= 0 && typeof children[i] === "object" && (children[i].type === "Call" || children[i].type === "NonNullAssertion" || children[i].type === "Optional")) i--;
|
|
7756
|
+
if (i < 0) return;
|
|
7757
|
+
exp = children[i];
|
|
7758
|
+
}
|
|
7759
|
+
if (exp.type === "Identifier" || exp.type === "PropertyAccess" || exp.type === "Index") {
|
|
7631
7760
|
return exp;
|
|
7632
7761
|
}
|
|
7633
|
-
|
|
7634
|
-
|
|
7635
|
-
if (!(exp.children != null)) {
|
|
7636
|
-
return;
|
|
7637
|
-
}
|
|
7638
|
-
;
|
|
7639
|
-
({ children } = exp);
|
|
7640
|
-
i = children.length - 1;
|
|
7641
|
-
while (i >= 0 && (children[i].type === "Call" || children[i].type === "NonNullAssertion" || children[i].type === "Optional")) i--;
|
|
7642
|
-
if (i < 0) return;
|
|
7643
|
-
} while (children[i].type === "MemberExpression" && (exp = children[i]));
|
|
7644
|
-
return children[i];
|
|
7762
|
+
;
|
|
7763
|
+
return;
|
|
7645
7764
|
}
|
|
7646
7765
|
function convertMethodToFunction(method) {
|
|
7647
7766
|
const { signature, block } = method;
|
|
@@ -7857,7 +7976,7 @@ function processBindingPatternLHS(lhs, tail) {
|
|
|
7857
7976
|
);
|
|
7858
7977
|
}
|
|
7859
7978
|
function processAssignments(statements) {
|
|
7860
|
-
for (let ref8 = gatherRecursiveAll(statements, ($4) => $4.type === "AssignmentExpression" || $4.type === "UpdateExpression"), i5 = 0,
|
|
7979
|
+
for (let ref8 = gatherRecursiveAll(statements, ($4) => $4.type === "AssignmentExpression" || $4.type === "UpdateExpression"), i5 = 0, len4 = ref8.length; i5 < len4; i5++) {
|
|
7861
7980
|
let extractAssignment = function(lhs) {
|
|
7862
7981
|
let expr = lhs;
|
|
7863
7982
|
while (expr.type === "ParenthesizedExpression") {
|
|
@@ -7886,7 +8005,7 @@ function processAssignments(statements) {
|
|
|
7886
8005
|
if (!exp.lhs) {
|
|
7887
8006
|
continue;
|
|
7888
8007
|
}
|
|
7889
|
-
for (let ref10 = exp.lhs, i6 = 0,
|
|
8008
|
+
for (let ref10 = exp.lhs, i6 = 0, len5 = ref10.length; i6 < len5; i6++) {
|
|
7890
8009
|
const lhsPart = ref10[i6];
|
|
7891
8010
|
let ref11;
|
|
7892
8011
|
if (ref11 = extractAssignment(lhsPart[1])) {
|
|
@@ -7931,7 +8050,7 @@ function processAssignments(statements) {
|
|
|
7931
8050
|
}
|
|
7932
8051
|
}
|
|
7933
8052
|
}
|
|
7934
|
-
for (let ref12 = gatherRecursiveAll(statements, ($6) => $6.type === "AssignmentExpression"), i7 = 0,
|
|
8053
|
+
for (let ref12 = gatherRecursiveAll(statements, ($6) => $6.type === "AssignmentExpression"), i7 = 0, len6 = ref12.length; i7 < len6; i7++) {
|
|
7935
8054
|
const exp = ref12[i7];
|
|
7936
8055
|
if (!(exp.names === null)) {
|
|
7937
8056
|
continue;
|
|
@@ -8002,7 +8121,7 @@ function processAssignments(statements) {
|
|
|
8002
8121
|
c[1] = start;
|
|
8003
8122
|
c[2] = ", ";
|
|
8004
8123
|
if (end) {
|
|
8005
|
-
c[3] = [end, " - ", start];
|
|
8124
|
+
c[3] = [makeLeftHandSideExpression(end), " - ", makeLeftHandSideExpression(start)];
|
|
8006
8125
|
} else {
|
|
8007
8126
|
c[3] = ["1/0"];
|
|
8008
8127
|
}
|
|
@@ -8165,7 +8284,7 @@ function attachPostfixStatementAsExpression(exp, post) {
|
|
|
8165
8284
|
}
|
|
8166
8285
|
function processTypes(node) {
|
|
8167
8286
|
const results1 = [];
|
|
8168
|
-
for (let ref16 = gatherRecursiveAll(node, ($11) => $11.type === "TypeUnary"), i8 = 0,
|
|
8287
|
+
for (let ref16 = gatherRecursiveAll(node, ($11) => $11.type === "TypeUnary"), i8 = 0, len7 = ref16.length; i8 < len7; i8++) {
|
|
8169
8288
|
const unary = ref16[i8];
|
|
8170
8289
|
let suffixIndex = unary.suffix.length - 1;
|
|
8171
8290
|
const results2 = [];
|
|
@@ -8293,7 +8412,7 @@ function processTypes(node) {
|
|
|
8293
8412
|
return results1;
|
|
8294
8413
|
}
|
|
8295
8414
|
function processStatementExpressions(statements) {
|
|
8296
|
-
for (let ref18 = gatherRecursiveAll(statements, ($12) => $12.type === "StatementExpression"), i9 = 0,
|
|
8415
|
+
for (let ref18 = gatherRecursiveAll(statements, ($12) => $12.type === "StatementExpression"), i9 = 0, len8 = ref18.length; i9 < len8; i9++) {
|
|
8297
8416
|
const exp = ref18[i9];
|
|
8298
8417
|
const { maybe, statement } = exp;
|
|
8299
8418
|
if ((maybe || statement.type === "ThrowStatement") && blockContainingStatement(exp)) {
|
|
@@ -8363,7 +8482,7 @@ function processNegativeIndexAccess(statements) {
|
|
|
8363
8482
|
});
|
|
8364
8483
|
}
|
|
8365
8484
|
function processFinallyClauses(statements) {
|
|
8366
|
-
for (let ref20 = gatherRecursiveAll(statements, ($) => $.type === "FinallyClause" && $.parent?.type !== "TryStatement"), i10 = 0,
|
|
8485
|
+
for (let ref20 = gatherRecursiveAll(statements, ($) => $.type === "FinallyClause" && $.parent?.type !== "TryStatement"), i10 = 0, len9 = ref20.length; i10 < len9; i10++) {
|
|
8367
8486
|
let f = ref20[i10];
|
|
8368
8487
|
let ref21;
|
|
8369
8488
|
if (!((ref21 = blockContainingStatement(f)) && typeof ref21 === "object" && "block" in ref21 && "index" in ref21)) {
|
|
@@ -8441,7 +8560,7 @@ function processBreaksContinues(statements) {
|
|
|
8441
8560
|
}
|
|
8442
8561
|
}
|
|
8443
8562
|
function processCoffeeClasses(statements) {
|
|
8444
|
-
for (let ref22 = gatherRecursiveAll(statements, ($13) => $13.type === "ClassExpression"), i11 = 0,
|
|
8563
|
+
for (let ref22 = gatherRecursiveAll(statements, ($13) => $13.type === "ClassExpression"), i11 = 0, len10 = ref22.length; i11 < len10; i11++) {
|
|
8445
8564
|
const ce = ref22[i11];
|
|
8446
8565
|
const { expressions } = ce.body;
|
|
8447
8566
|
const indent = expressions[0]?.[0] ?? "\n";
|
|
@@ -8486,7 +8605,7 @@ function processCoffeeClasses(statements) {
|
|
|
8486
8605
|
0,
|
|
8487
8606
|
...(() => {
|
|
8488
8607
|
const results3 = [];
|
|
8489
|
-
for (let i12 = 0,
|
|
8608
|
+
for (let i12 = 0, len11 = autoBinds.length; i12 < len11; i12++) {
|
|
8490
8609
|
const [, a] = autoBinds[i12];
|
|
8491
8610
|
results3.push([indent, ["this.", a.name, " = this.", a.name, ".bind(this)"], ";"]);
|
|
8492
8611
|
}
|
|
@@ -8602,7 +8721,7 @@ async function processProgramAsync(root) {
|
|
|
8602
8721
|
function processRepl(root, rootIIFE) {
|
|
8603
8722
|
const topBlock = gatherRecursive(rootIIFE, ($21) => $21.type === "BlockStatement")[0];
|
|
8604
8723
|
let i = 0;
|
|
8605
|
-
for (let ref23 = gatherRecursiveWithinFunction(topBlock, ($22) => $22.type === "Declaration"), i14 = 0,
|
|
8724
|
+
for (let ref23 = gatherRecursiveWithinFunction(topBlock, ($22) => $22.type === "Declaration"), i14 = 0, len12 = ref23.length; i14 < len12; i14++) {
|
|
8606
8725
|
const decl = ref23[i14];
|
|
8607
8726
|
if (!decl.names?.length) {
|
|
8608
8727
|
continue;
|
|
@@ -8616,7 +8735,7 @@ function processRepl(root, rootIIFE) {
|
|
|
8616
8735
|
root.expressions.splice(i++, 0, ["", `var ${decl.names.join(",")}`, ";"]);
|
|
8617
8736
|
}
|
|
8618
8737
|
}
|
|
8619
|
-
for (let ref24 = gatherRecursive(topBlock, ($23) => $23.type === "FunctionExpression"), i15 = 0,
|
|
8738
|
+
for (let ref24 = gatherRecursive(topBlock, ($23) => $23.type === "FunctionExpression"), i15 = 0, len13 = ref24.length; i15 < len13; i15++) {
|
|
8620
8739
|
const func = ref24[i15];
|
|
8621
8740
|
if (func.name && func.parent?.type === "BlockStatement") {
|
|
8622
8741
|
if (func.parent === topBlock) {
|
|
@@ -8629,7 +8748,7 @@ function processRepl(root, rootIIFE) {
|
|
|
8629
8748
|
}
|
|
8630
8749
|
}
|
|
8631
8750
|
}
|
|
8632
|
-
for (let ref25 = gatherRecursiveWithinFunction(topBlock, ($24) => $24.type === "ClassExpression"), i16 = 0,
|
|
8751
|
+
for (let ref25 = gatherRecursiveWithinFunction(topBlock, ($24) => $24.type === "ClassExpression"), i16 = 0, len14 = ref25.length; i16 < len14; i16++) {
|
|
8633
8752
|
const classExp = ref25[i16];
|
|
8634
8753
|
let m8;
|
|
8635
8754
|
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)) {
|
|
@@ -8641,7 +8760,7 @@ function processRepl(root, rootIIFE) {
|
|
|
8641
8760
|
function processPlaceholders(statements) {
|
|
8642
8761
|
const placeholderMap = /* @__PURE__ */ new Map();
|
|
8643
8762
|
const liftedIfs = /* @__PURE__ */ new Set();
|
|
8644
|
-
for (let ref26 = gatherRecursiveAll(statements, ($25) => $25.type === "Placeholder"), i17 = 0,
|
|
8763
|
+
for (let ref26 = gatherRecursiveAll(statements, ($25) => $25.type === "Placeholder"), i17 = 0, len15 = ref26.length; i17 < len15; i17++) {
|
|
8645
8764
|
const exp = ref26[i17];
|
|
8646
8765
|
let ancestor;
|
|
8647
8766
|
if (exp.subtype === ".") {
|
|
@@ -8751,7 +8870,7 @@ function processPlaceholders(statements) {
|
|
|
8751
8870
|
for (const [ancestor, placeholders] of placeholderMap) {
|
|
8752
8871
|
let ref = makeRef("$");
|
|
8753
8872
|
let typeSuffix;
|
|
8754
|
-
for (let i18 = 0,
|
|
8873
|
+
for (let i18 = 0, len16 = placeholders.length; i18 < len16; i18++) {
|
|
8755
8874
|
const placeholder = placeholders[i18];
|
|
8756
8875
|
typeSuffix ??= placeholder.typeSuffix;
|
|
8757
8876
|
let ref27;
|
|
@@ -8865,10 +8984,12 @@ function reorderBindingRestProperty(props) {
|
|
|
8865
8984
|
}
|
|
8866
8985
|
function typeOfJSX(node, config2) {
|
|
8867
8986
|
switch (node.type) {
|
|
8868
|
-
case "JSXElement":
|
|
8987
|
+
case "JSXElement": {
|
|
8869
8988
|
return typeOfJSXElement(node, config2);
|
|
8870
|
-
|
|
8989
|
+
}
|
|
8990
|
+
case "JSXFragment": {
|
|
8871
8991
|
return typeOfJSXFragment(node, config2);
|
|
8992
|
+
}
|
|
8872
8993
|
}
|
|
8873
8994
|
}
|
|
8874
8995
|
function typeOfJSXElement(node, config2) {
|
|
@@ -8876,7 +8997,7 @@ function typeOfJSXElement(node, config2) {
|
|
|
8876
8997
|
if (config2.server && !config2.client) {
|
|
8877
8998
|
return ["string"];
|
|
8878
8999
|
}
|
|
8879
|
-
|
|
9000
|
+
const { tag } = node;
|
|
8880
9001
|
const clientType = tag[0] === tag[0].toLowerCase() ? [getHelperRef("IntrinsicElements"), '<"', tag, '">'] : ["ReturnType<typeof ", tag, ">"];
|
|
8881
9002
|
if (config2.server) {
|
|
8882
9003
|
return ["string", " | ", clientType];
|
|
@@ -8891,33 +9012,40 @@ function typeOfJSXFragment(node, config2) {
|
|
|
8891
9012
|
if (config2.solid) {
|
|
8892
9013
|
let type = [];
|
|
8893
9014
|
let lastType;
|
|
8894
|
-
for (
|
|
9015
|
+
for (const child of node.jsxChildren) {
|
|
8895
9016
|
switch (child.type) {
|
|
8896
|
-
case "JSXText":
|
|
8897
|
-
if (lastType
|
|
9017
|
+
case "JSXText": {
|
|
9018
|
+
if (!(lastType === "JSXText")) {
|
|
8898
9019
|
type.push("string");
|
|
8899
9020
|
}
|
|
9021
|
+
;
|
|
8900
9022
|
break;
|
|
8901
|
-
|
|
9023
|
+
}
|
|
9024
|
+
case "JSXElement": {
|
|
8902
9025
|
type.push(typeOfJSXElement(child, config2));
|
|
8903
9026
|
break;
|
|
8904
|
-
|
|
9027
|
+
}
|
|
9028
|
+
case "JSXFragment": {
|
|
8905
9029
|
type.push(...typeOfJSXFragment(child, config2));
|
|
8906
9030
|
break;
|
|
8907
|
-
|
|
9031
|
+
}
|
|
9032
|
+
case "JSXChildExpression": {
|
|
8908
9033
|
if (child.expression) {
|
|
8909
9034
|
type.push(["typeof ", child.expression]);
|
|
8910
9035
|
}
|
|
9036
|
+
;
|
|
8911
9037
|
break;
|
|
8912
|
-
|
|
9038
|
+
}
|
|
9039
|
+
default: {
|
|
8913
9040
|
throw new Error(`unknown child in JSXFragment: ${JSON.stringify(child)}`);
|
|
9041
|
+
}
|
|
8914
9042
|
}
|
|
8915
9043
|
lastType = child.type;
|
|
8916
9044
|
}
|
|
8917
9045
|
if (type.length === 1) {
|
|
8918
9046
|
return type[0];
|
|
8919
9047
|
} else {
|
|
8920
|
-
type = type.flatMap((
|
|
9048
|
+
type = type.flatMap(($26) => [$26, ", "]);
|
|
8921
9049
|
type.pop();
|
|
8922
9050
|
return ["[", type, "]"];
|
|
8923
9051
|
}
|
|
@@ -9142,6 +9270,8 @@ var grammar = {
|
|
|
9142
9270
|
NonSingleBracedBlock,
|
|
9143
9271
|
DeclarationOrStatement,
|
|
9144
9272
|
SingleLineStatements,
|
|
9273
|
+
ObjectSingleLineStatements,
|
|
9274
|
+
BracedObjectSingleLineStatements,
|
|
9145
9275
|
PostfixedSingleLineStatements,
|
|
9146
9276
|
PostfixedSingleLineNoCommaStatements,
|
|
9147
9277
|
NestedBlockStatements,
|
|
@@ -9322,6 +9452,10 @@ var grammar = {
|
|
|
9322
9452
|
ForbidNewlineBinaryOp,
|
|
9323
9453
|
RestoreNewlineBinaryOp,
|
|
9324
9454
|
NewlineBinaryOpAllowed,
|
|
9455
|
+
AllowImplicitFragment,
|
|
9456
|
+
ForbidImplicitFragment,
|
|
9457
|
+
RestoreImplicitFragment,
|
|
9458
|
+
ImplicitFragmentAllowed,
|
|
9325
9459
|
AllowPipeline,
|
|
9326
9460
|
ForbidPipeline,
|
|
9327
9461
|
RestorePipeline,
|
|
@@ -9347,11 +9481,15 @@ var grammar = {
|
|
|
9347
9481
|
NameSpaceImport,
|
|
9348
9482
|
NamedImports,
|
|
9349
9483
|
OperatorNamedImports,
|
|
9484
|
+
DynamicNamedImports,
|
|
9485
|
+
DynamicImportContents,
|
|
9350
9486
|
FromClause,
|
|
9351
9487
|
ImportAssertion,
|
|
9352
9488
|
TypeAndImportSpecifier,
|
|
9353
9489
|
ImportSpecifier,
|
|
9354
9490
|
OperatorImportSpecifier,
|
|
9491
|
+
DynamicImportSpecifier,
|
|
9492
|
+
DynamicModuleExportName,
|
|
9355
9493
|
ImportAsToken,
|
|
9356
9494
|
ModuleExportName,
|
|
9357
9495
|
ModuleSpecifier,
|
|
@@ -10629,7 +10767,11 @@ function SingleLineBinaryOpRHS(ctx, state2) {
|
|
|
10629
10767
|
return (0, import_lib2.$EVENT)(ctx, state2, "SingleLineBinaryOpRHS", SingleLineBinaryOpRHS$0);
|
|
10630
10768
|
}
|
|
10631
10769
|
var RHS$0 = ExpressionizedStatementWithTrailingCallExpressions;
|
|
10632
|
-
var RHS$1 = UnaryExpression
|
|
10770
|
+
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) {
|
|
10771
|
+
var exp = $2;
|
|
10772
|
+
if (!exp) return $skip;
|
|
10773
|
+
return exp;
|
|
10774
|
+
});
|
|
10633
10775
|
var RHS$$ = [RHS$0, RHS$1];
|
|
10634
10776
|
function RHS(ctx, state2) {
|
|
10635
10777
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "RHS", RHS$$);
|
|
@@ -10963,8 +11105,9 @@ var FatArrowBody$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$N
|
|
|
10963
11105
|
implicitlyReturned: true
|
|
10964
11106
|
};
|
|
10965
11107
|
});
|
|
10966
|
-
var FatArrowBody$1 =
|
|
10967
|
-
var FatArrowBody
|
|
11108
|
+
var FatArrowBody$1 = BracedObjectSingleLineStatements;
|
|
11109
|
+
var FatArrowBody$2 = NoCommaBracedOrEmptyBlock;
|
|
11110
|
+
var FatArrowBody$$ = [FatArrowBody$0, FatArrowBody$1, FatArrowBody$2];
|
|
10968
11111
|
function FatArrowBody(ctx, state2) {
|
|
10969
11112
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "FatArrowBody", FatArrowBody$$);
|
|
10970
11113
|
}
|
|
@@ -11675,10 +11818,10 @@ var CallExpression$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Super, Arguments
|
|
|
11675
11818
|
children: [$1, ...$2, ...rest.flat()]
|
|
11676
11819
|
});
|
|
11677
11820
|
});
|
|
11678
|
-
var CallExpression$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(Import, _,
|
|
11821
|
+
var CallExpression$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(Import, _, DynamicImportContents, __, FromClause), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
11679
11822
|
return dynamizeImportDeclarationExpression($0);
|
|
11680
11823
|
});
|
|
11681
|
-
var CallExpression$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(FromClause, __, Import, _,
|
|
11824
|
+
var CallExpression$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(FromClause, __, Import, _, DynamicImportContents), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
11682
11825
|
var from = $1;
|
|
11683
11826
|
var fws = $2;
|
|
11684
11827
|
var i = $3;
|
|
@@ -12991,7 +13134,7 @@ var OperatorDeclaration$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Operator, (
|
|
|
12991
13134
|
var behavior = $2;
|
|
12992
13135
|
var w = $3;
|
|
12993
13136
|
var decl = $4;
|
|
12994
|
-
decl.names.forEach((name) =>
|
|
13137
|
+
decl.names.forEach((name) => setOperatorBehavior(name, behavior));
|
|
12995
13138
|
if (behavior?.error) decl = prepend(behavior.error, decl);
|
|
12996
13139
|
decl = prepend(trimFirstSpace(w), decl);
|
|
12997
13140
|
return decl;
|
|
@@ -12999,7 +13142,7 @@ var OperatorDeclaration$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Operator, (
|
|
|
12999
13142
|
var OperatorDeclaration$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(OperatorSignature, BracedBlock), function($skip, $loc, $0, $1, $2) {
|
|
13000
13143
|
var signature = $1;
|
|
13001
13144
|
var block = $2;
|
|
13002
|
-
|
|
13145
|
+
setOperatorBehavior(signature.id.name, signature.behavior);
|
|
13003
13146
|
return {
|
|
13004
13147
|
...signature,
|
|
13005
13148
|
type: "FunctionExpression",
|
|
@@ -13016,10 +13159,10 @@ var OperatorDeclaration$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(Operator, _
|
|
|
13016
13159
|
var behavior = $4;
|
|
13017
13160
|
var ids = $5;
|
|
13018
13161
|
const children = [];
|
|
13019
|
-
|
|
13162
|
+
setOperatorBehavior(id.name, behavior);
|
|
13020
13163
|
if (behavior?.error) children.push(behavior.error);
|
|
13021
13164
|
ids.forEach(([, , id2, behavior2]) => {
|
|
13022
|
-
|
|
13165
|
+
setOperatorBehavior(id2.name, behavior2);
|
|
13023
13166
|
if (behavior2?.error) children.push(behavior2.error);
|
|
13024
13167
|
});
|
|
13025
13168
|
return {
|
|
@@ -13119,7 +13262,7 @@ var OperatorAssociativity$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, impor
|
|
|
13119
13262
|
function OperatorAssociativity(ctx, state2) {
|
|
13120
13263
|
return (0, import_lib2.$EVENT)(ctx, state2, "OperatorAssociativity", OperatorAssociativity$0);
|
|
13121
13264
|
}
|
|
13122
|
-
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) {
|
|
13265
|
+
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) {
|
|
13123
13266
|
var async = $1;
|
|
13124
13267
|
var parameters = $2;
|
|
13125
13268
|
var returnType = $3;
|
|
@@ -13273,8 +13416,9 @@ var ThenBlock$0 = (0, import_lib2.$T)((0, import_lib2.$S)(NoBlock, EmptyBlock),
|
|
|
13273
13416
|
return value[1];
|
|
13274
13417
|
});
|
|
13275
13418
|
var ThenBlock$1 = ImplicitNestedBlock;
|
|
13276
|
-
var ThenBlock$2 =
|
|
13277
|
-
var ThenBlock
|
|
13419
|
+
var ThenBlock$2 = ObjectSingleLineStatements;
|
|
13420
|
+
var ThenBlock$3 = SingleLineStatements;
|
|
13421
|
+
var ThenBlock$$ = [ThenBlock$0, ThenBlock$1, ThenBlock$2, ThenBlock$3];
|
|
13278
13422
|
function ThenBlock(ctx, state2) {
|
|
13279
13423
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "ThenBlock", ThenBlock$$);
|
|
13280
13424
|
}
|
|
@@ -13333,11 +13477,12 @@ var BlockOrEmptyStatement$$ = [BlockOrEmptyStatement$0, BlockOrEmptyStatement$1]
|
|
|
13333
13477
|
function BlockOrEmptyStatement(ctx, state2) {
|
|
13334
13478
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "BlockOrEmptyStatement", BlockOrEmptyStatement$$);
|
|
13335
13479
|
}
|
|
13336
|
-
var BlockOrEmpty$0 =
|
|
13337
|
-
var BlockOrEmpty$1 =
|
|
13480
|
+
var BlockOrEmpty$0 = ObjectSingleLineStatements;
|
|
13481
|
+
var BlockOrEmpty$1 = Block;
|
|
13482
|
+
var BlockOrEmpty$2 = (0, import_lib2.$T)((0, import_lib2.$S)(NoBlock, EmptyBlock), function(value) {
|
|
13338
13483
|
return value[1];
|
|
13339
13484
|
});
|
|
13340
|
-
var BlockOrEmpty$$ = [BlockOrEmpty$0, BlockOrEmpty$1];
|
|
13485
|
+
var BlockOrEmpty$$ = [BlockOrEmpty$0, BlockOrEmpty$1, BlockOrEmpty$2];
|
|
13341
13486
|
function BlockOrEmpty(ctx, state2) {
|
|
13342
13487
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "BlockOrEmpty", BlockOrEmpty$$);
|
|
13343
13488
|
}
|
|
@@ -13473,6 +13618,26 @@ var SingleLineStatements$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(ForbidNewl
|
|
|
13473
13618
|
function SingleLineStatements(ctx, state2) {
|
|
13474
13619
|
return (0, import_lib2.$EVENT)(ctx, state2, "SingleLineStatements", SingleLineStatements$0);
|
|
13475
13620
|
}
|
|
13621
|
+
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) {
|
|
13622
|
+
var block = $2;
|
|
13623
|
+
if (block.bare && block.expressions.length === 1) {
|
|
13624
|
+
const expression = block.expressions[0][1];
|
|
13625
|
+
if (expression.type === "ParenthesizedExpression" && expression.implicit && expression.expression.type === "ObjectExpression") {
|
|
13626
|
+
block = { ...block, unwrapObject: true };
|
|
13627
|
+
}
|
|
13628
|
+
}
|
|
13629
|
+
return block;
|
|
13630
|
+
});
|
|
13631
|
+
function ObjectSingleLineStatements(ctx, state2) {
|
|
13632
|
+
return (0, import_lib2.$EVENT)(ctx, state2, "ObjectSingleLineStatements", ObjectSingleLineStatements$0);
|
|
13633
|
+
}
|
|
13634
|
+
var BracedObjectSingleLineStatements$0 = (0, import_lib2.$TV)(ObjectSingleLineStatements, function($skip, $loc, $0, $1) {
|
|
13635
|
+
var block = $0;
|
|
13636
|
+
return bracedBlock(block);
|
|
13637
|
+
});
|
|
13638
|
+
function BracedObjectSingleLineStatements(ctx, state2) {
|
|
13639
|
+
return (0, import_lib2.$EVENT)(ctx, state2, "BracedObjectSingleLineStatements", BracedObjectSingleLineStatements$0);
|
|
13640
|
+
}
|
|
13476
13641
|
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) {
|
|
13477
13642
|
var stmts = $1;
|
|
13478
13643
|
var last = $2;
|
|
@@ -14323,7 +14488,8 @@ var PropertyDefinition$2 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_l
|
|
|
14323
14488
|
children: [ws, id],
|
|
14324
14489
|
name: id,
|
|
14325
14490
|
names: id.names,
|
|
14326
|
-
value: id
|
|
14491
|
+
value: id,
|
|
14492
|
+
implicitName: true
|
|
14327
14493
|
};
|
|
14328
14494
|
});
|
|
14329
14495
|
var PropertyDefinition$3 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(_), MethodDefinition), function($skip, $loc, $0, $1, $2) {
|
|
@@ -14382,7 +14548,8 @@ var PropertyDefinition$5 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_l
|
|
|
14382
14548
|
if (refAssignment) {
|
|
14383
14549
|
name = {
|
|
14384
14550
|
type: "ComputedPropertyName",
|
|
14385
|
-
children: [last.children[0], "(", refAssignment, ",", ref, ")", ...last.children.slice(-2)]
|
|
14551
|
+
children: [last.children[0], "(", refAssignment, ",", ref, ")", ...last.children.slice(-2)],
|
|
14552
|
+
implicit: true
|
|
14386
14553
|
};
|
|
14387
14554
|
value = {
|
|
14388
14555
|
...value,
|
|
@@ -14397,7 +14564,8 @@ var PropertyDefinition$5 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_l
|
|
|
14397
14564
|
} else {
|
|
14398
14565
|
name = {
|
|
14399
14566
|
type: "ComputedPropertyName",
|
|
14400
|
-
children: last.children
|
|
14567
|
+
children: last.children,
|
|
14568
|
+
implicit: true
|
|
14401
14569
|
};
|
|
14402
14570
|
}
|
|
14403
14571
|
} else {
|
|
@@ -14410,7 +14578,8 @@ var PropertyDefinition$5 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_l
|
|
|
14410
14578
|
children: [ws, name, ": ", processUnaryExpression(pre, value, post)],
|
|
14411
14579
|
name,
|
|
14412
14580
|
names: [],
|
|
14413
|
-
value
|
|
14581
|
+
value,
|
|
14582
|
+
implicitName: true
|
|
14414
14583
|
};
|
|
14415
14584
|
});
|
|
14416
14585
|
var PropertyDefinition$$ = [PropertyDefinition$0, PropertyDefinition$1, PropertyDefinition$2, PropertyDefinition$3, PropertyDefinition$4, PropertyDefinition$5];
|
|
@@ -14613,6 +14782,7 @@ function MethodDefinition(ctx, state2) {
|
|
|
14613
14782
|
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) {
|
|
14614
14783
|
var kind = $1;
|
|
14615
14784
|
var ws = $2;
|
|
14785
|
+
if (!ws) ws = " ";
|
|
14616
14786
|
return {
|
|
14617
14787
|
// no async or generator, because getters and setters can't be
|
|
14618
14788
|
modifier: {
|
|
@@ -15330,7 +15500,7 @@ function ShouldExpressionize(ctx, state2) {
|
|
|
15330
15500
|
var NoCommaStatement$0 = KeywordStatement;
|
|
15331
15501
|
var NoCommaStatement$1 = VariableStatement;
|
|
15332
15502
|
var NoCommaStatement$2 = IfStatement;
|
|
15333
|
-
var NoCommaStatement$3 =
|
|
15503
|
+
var NoCommaStatement$3 = IterationActualStatement;
|
|
15334
15504
|
var NoCommaStatement$4 = SwitchStatement;
|
|
15335
15505
|
var NoCommaStatement$5 = TryStatement;
|
|
15336
15506
|
var NoCommaStatement$6 = EmptyStatement;
|
|
@@ -16362,8 +16532,8 @@ var SingleLineExpressionWithIndentedApplicationForbidden$0 = (0, import_lib2.$TS
|
|
|
16362
16532
|
function SingleLineExpressionWithIndentedApplicationForbidden(ctx, state2) {
|
|
16363
16533
|
return (0, import_lib2.$EVENT)(ctx, state2, "SingleLineExpressionWithIndentedApplicationForbidden", SingleLineExpressionWithIndentedApplicationForbidden$0);
|
|
16364
16534
|
}
|
|
16365
|
-
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) {
|
|
16366
|
-
var exp = $
|
|
16535
|
+
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) {
|
|
16536
|
+
var exp = $4;
|
|
16367
16537
|
if (exp) return exp;
|
|
16368
16538
|
return $skip;
|
|
16369
16539
|
});
|
|
@@ -16540,6 +16710,33 @@ var NewlineBinaryOpAllowed$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0
|
|
|
16540
16710
|
function NewlineBinaryOpAllowed(ctx, state2) {
|
|
16541
16711
|
return (0, import_lib2.$EVENT)(ctx, state2, "NewlineBinaryOpAllowed", NewlineBinaryOpAllowed$0);
|
|
16542
16712
|
}
|
|
16713
|
+
var AllowImplicitFragment$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'AllowImplicitFragment ""'), function($skip, $loc, $0, $1) {
|
|
16714
|
+
state.forbidImplicitFragment.push(false);
|
|
16715
|
+
});
|
|
16716
|
+
function AllowImplicitFragment(ctx, state2) {
|
|
16717
|
+
return (0, import_lib2.$EVENT)(ctx, state2, "AllowImplicitFragment", AllowImplicitFragment$0);
|
|
16718
|
+
}
|
|
16719
|
+
var ForbidImplicitFragment$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'ForbidImplicitFragment ""'), function($skip, $loc, $0, $1) {
|
|
16720
|
+
state.forbidImplicitFragment.push(true);
|
|
16721
|
+
});
|
|
16722
|
+
function ForbidImplicitFragment(ctx, state2) {
|
|
16723
|
+
return (0, import_lib2.$EVENT)(ctx, state2, "ForbidImplicitFragment", ForbidImplicitFragment$0);
|
|
16724
|
+
}
|
|
16725
|
+
var RestoreImplicitFragment$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'RestoreImplicitFragment ""'), function($skip, $loc, $0, $1) {
|
|
16726
|
+
state.forbidImplicitFragment.pop();
|
|
16727
|
+
});
|
|
16728
|
+
function RestoreImplicitFragment(ctx, state2) {
|
|
16729
|
+
return (0, import_lib2.$EVENT)(ctx, state2, "RestoreImplicitFragment", RestoreImplicitFragment$0);
|
|
16730
|
+
}
|
|
16731
|
+
var ImplicitFragmentAllowed$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'ImplicitFragmentAllowed ""'), function($skip, $loc, $0, $1) {
|
|
16732
|
+
if (config.verbose) {
|
|
16733
|
+
console.log("forbidImplicitFragment:", state.forbidImplicitFragment);
|
|
16734
|
+
}
|
|
16735
|
+
if (state.implicitFragmentForbidden) return $skip;
|
|
16736
|
+
});
|
|
16737
|
+
function ImplicitFragmentAllowed(ctx, state2) {
|
|
16738
|
+
return (0, import_lib2.$EVENT)(ctx, state2, "ImplicitFragmentAllowed", ImplicitFragmentAllowed$0);
|
|
16739
|
+
}
|
|
16543
16740
|
var AllowPipeline$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'AllowPipeline ""'), function($skip, $loc, $0, $1) {
|
|
16544
16741
|
state.forbidPipeline.push(false);
|
|
16545
16742
|
});
|
|
@@ -16567,11 +16764,11 @@ var PipelineAllowed$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'Pipe
|
|
|
16567
16764
|
function PipelineAllowed(ctx, state2) {
|
|
16568
16765
|
return (0, import_lib2.$EVENT)(ctx, state2, "PipelineAllowed", PipelineAllowed$0);
|
|
16569
16766
|
}
|
|
16570
|
-
var AllowAll$0 = (0, import_lib2.$S)(AllowTrailingMemberProperty, AllowBracedApplication, AllowIndentedApplication, AllowClassImplicitCall, AllowNestedBinaryOp, AllowNewlineBinaryOp, AllowPipeline);
|
|
16767
|
+
var AllowAll$0 = (0, import_lib2.$S)(AllowTrailingMemberProperty, AllowBracedApplication, AllowIndentedApplication, AllowClassImplicitCall, AllowNestedBinaryOp, AllowNewlineBinaryOp, AllowImplicitFragment, AllowPipeline);
|
|
16571
16768
|
function AllowAll(ctx, state2) {
|
|
16572
16769
|
return (0, import_lib2.$EVENT)(ctx, state2, "AllowAll", AllowAll$0);
|
|
16573
16770
|
}
|
|
16574
|
-
var RestoreAll$0 = (0, import_lib2.$S)(RestoreTrailingMemberProperty, RestoreBracedApplication, RestoreIndentedApplication, RestoreClassImplicitCall, RestoreNestedBinaryOp, RestoreNewlineBinaryOp, RestorePipeline);
|
|
16771
|
+
var RestoreAll$0 = (0, import_lib2.$S)(RestoreTrailingMemberProperty, RestoreBracedApplication, RestoreIndentedApplication, RestoreClassImplicitCall, RestoreNestedBinaryOp, RestoreNewlineBinaryOp, RestoreImplicitFragment, RestorePipeline);
|
|
16575
16772
|
function RestoreAll(ctx, state2) {
|
|
16576
16773
|
return (0, import_lib2.$EVENT)(ctx, state2, "RestoreAll", RestoreAll$0);
|
|
16577
16774
|
}
|
|
@@ -16674,7 +16871,11 @@ var MaybeNestedNonPipelineExpression$0 = (0, import_lib2.$TS)((0, import_lib2.$S
|
|
|
16674
16871
|
if (!trailing) return expression;
|
|
16675
16872
|
return [expression, trailing];
|
|
16676
16873
|
});
|
|
16677
|
-
var MaybeNestedNonPipelineExpression$1 = NonPipelineExpression
|
|
16874
|
+
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) {
|
|
16875
|
+
var expression = $2;
|
|
16876
|
+
if (!expression) return $skip;
|
|
16877
|
+
return expression;
|
|
16878
|
+
});
|
|
16678
16879
|
var MaybeNestedNonPipelineExpression$$ = [MaybeNestedNonPipelineExpression$0, MaybeNestedNonPipelineExpression$1];
|
|
16679
16880
|
function MaybeNestedNonPipelineExpression(ctx, state2) {
|
|
16680
16881
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "MaybeNestedNonPipelineExpression", MaybeNestedNonPipelineExpression$$);
|
|
@@ -16686,7 +16887,11 @@ var MaybeNestedPostfixedExpression$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(
|
|
|
16686
16887
|
if (!trailing) return expression;
|
|
16687
16888
|
return [expression, trailing];
|
|
16688
16889
|
});
|
|
16689
|
-
var MaybeNestedPostfixedExpression$1 = PostfixedExpression
|
|
16890
|
+
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) {
|
|
16891
|
+
var expression = $2;
|
|
16892
|
+
if (!expression) return $skip;
|
|
16893
|
+
return expression;
|
|
16894
|
+
});
|
|
16690
16895
|
var MaybeNestedPostfixedExpression$$ = [MaybeNestedPostfixedExpression$0, MaybeNestedPostfixedExpression$1];
|
|
16691
16896
|
function MaybeNestedPostfixedExpression(ctx, state2) {
|
|
16692
16897
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "MaybeNestedPostfixedExpression", MaybeNestedPostfixedExpression$$);
|
|
@@ -16709,7 +16914,11 @@ var MaybeNestedExpression$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, impor
|
|
|
16709
16914
|
if (!trailing) return expression;
|
|
16710
16915
|
return [expression, trailing];
|
|
16711
16916
|
});
|
|
16712
|
-
var MaybeNestedExpression$1 = Expression
|
|
16917
|
+
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) {
|
|
16918
|
+
var expression = $2;
|
|
16919
|
+
if (!expression) return $skip;
|
|
16920
|
+
return expression;
|
|
16921
|
+
});
|
|
16713
16922
|
var MaybeNestedExpression$$ = [MaybeNestedExpression$0, MaybeNestedExpression$1];
|
|
16714
16923
|
function MaybeNestedExpression(ctx, state2) {
|
|
16715
16924
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "MaybeNestedExpression", MaybeNestedExpression$$);
|
|
@@ -16752,7 +16961,7 @@ var ImportDeclaration$1 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_li
|
|
|
16752
16961
|
const errors = [];
|
|
16753
16962
|
if (behavior?.error) errors.push(behavior.error);
|
|
16754
16963
|
imports.specifiers.forEach((spec) => {
|
|
16755
|
-
|
|
16964
|
+
setOperatorBehavior(spec.binding.name, spec.behavior ?? behavior);
|
|
16756
16965
|
if (spec.behavior?.error) errors.push(spec.behavior.error);
|
|
16757
16966
|
});
|
|
16758
16967
|
return {
|
|
@@ -16803,7 +17012,7 @@ var ImportDeclaration$5 = (0, import_lib2.$TS)((0, import_lib2.$S)(FromClause, _
|
|
|
16803
17012
|
const errors = [];
|
|
16804
17013
|
if (behavior?.error) errors.push(behavior.error);
|
|
16805
17014
|
imports.specifiers.forEach((spec) => {
|
|
16806
|
-
|
|
17015
|
+
setOperatorBehavior(spec.binding.name, spec.behavior ?? behavior);
|
|
16807
17016
|
if (spec.behavior?.error) errors.push(spec.behavior.error);
|
|
16808
17017
|
});
|
|
16809
17018
|
return {
|
|
@@ -16904,6 +17113,24 @@ var OperatorNamedImports$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(OpenBrace,
|
|
|
16904
17113
|
function OperatorNamedImports(ctx, state2) {
|
|
16905
17114
|
return (0, import_lib2.$EVENT)(ctx, state2, "OperatorNamedImports", OperatorNamedImports$0);
|
|
16906
17115
|
}
|
|
17116
|
+
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) {
|
|
17117
|
+
var specifiers = $2;
|
|
17118
|
+
return {
|
|
17119
|
+
type: "Declaration",
|
|
17120
|
+
children: $0,
|
|
17121
|
+
specifiers
|
|
17122
|
+
};
|
|
17123
|
+
});
|
|
17124
|
+
function DynamicNamedImports(ctx, state2) {
|
|
17125
|
+
return (0, import_lib2.$EVENT)(ctx, state2, "DynamicNamedImports", DynamicNamedImports$0);
|
|
17126
|
+
}
|
|
17127
|
+
var DynamicImportContents$0 = DynamicNamedImports;
|
|
17128
|
+
var DynamicImportContents$1 = IdentifierName;
|
|
17129
|
+
var DynamicImportContents$2 = Star;
|
|
17130
|
+
var DynamicImportContents$$ = [DynamicImportContents$0, DynamicImportContents$1, DynamicImportContents$2];
|
|
17131
|
+
function DynamicImportContents(ctx, state2) {
|
|
17132
|
+
return (0, import_lib2.$EVENT_C)(ctx, state2, "DynamicImportContents", DynamicImportContents$$);
|
|
17133
|
+
}
|
|
16907
17134
|
var FromClause$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(From, __, ModuleSpecifier), function($skip, $loc, $0, $1, $2, $3) {
|
|
16908
17135
|
var module = $3;
|
|
16909
17136
|
if (!Array.isArray(module)) return $0;
|
|
@@ -16925,17 +17152,17 @@ var ImportAssertion$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2
|
|
|
16925
17152
|
function ImportAssertion(ctx, state2) {
|
|
16926
17153
|
return (0, import_lib2.$EVENT)(ctx, state2, "ImportAssertion", ImportAssertion$0);
|
|
16927
17154
|
}
|
|
16928
|
-
var TypeAndImportSpecifier$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(
|
|
16929
|
-
|
|
16930
|
-
return { ts: true, children: $0, binding: $2.binding };
|
|
17155
|
+
var TypeAndImportSpecifier$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(__, TypeKeyword, ImportSpecifier), function($skip, $loc, $0, $1, $2, $3) {
|
|
17156
|
+
return { ts: true, children: $0, binding: $3.binding };
|
|
16931
17157
|
});
|
|
16932
|
-
var TypeAndImportSpecifier$1 =
|
|
17158
|
+
var TypeAndImportSpecifier$1 = ImportSpecifier;
|
|
17159
|
+
var TypeAndImportSpecifier$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(__, Operator, OperatorImportSpecifier), function($skip, $loc, $0, $1, $2, $3) {
|
|
16933
17160
|
var ws = $1;
|
|
16934
17161
|
var spec = $3;
|
|
16935
17162
|
if (spec.binding.type !== "Identifier") {
|
|
16936
17163
|
throw new Error("Expected identifier after `operator`");
|
|
16937
17164
|
}
|
|
16938
|
-
|
|
17165
|
+
setOperatorBehavior(spec.binding.name, spec.behavior);
|
|
16939
17166
|
return {
|
|
16940
17167
|
...spec,
|
|
16941
17168
|
children: [
|
|
@@ -16945,7 +17172,7 @@ var TypeAndImportSpecifier$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(__, Oper
|
|
|
16945
17172
|
]
|
|
16946
17173
|
};
|
|
16947
17174
|
});
|
|
16948
|
-
var TypeAndImportSpecifier$$ = [TypeAndImportSpecifier$0, TypeAndImportSpecifier$1];
|
|
17175
|
+
var TypeAndImportSpecifier$$ = [TypeAndImportSpecifier$0, TypeAndImportSpecifier$1, TypeAndImportSpecifier$2];
|
|
16949
17176
|
function TypeAndImportSpecifier(ctx, state2) {
|
|
16950
17177
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "TypeAndImportSpecifier", TypeAndImportSpecifier$$);
|
|
16951
17178
|
}
|
|
@@ -16992,6 +17219,27 @@ var OperatorImportSpecifier$$ = [OperatorImportSpecifier$0, OperatorImportSpecif
|
|
|
16992
17219
|
function OperatorImportSpecifier(ctx, state2) {
|
|
16993
17220
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "OperatorImportSpecifier", OperatorImportSpecifier$$);
|
|
16994
17221
|
}
|
|
17222
|
+
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) {
|
|
17223
|
+
var ts2 = $2;
|
|
17224
|
+
var source = $3;
|
|
17225
|
+
var binding = $4;
|
|
17226
|
+
return {
|
|
17227
|
+
source,
|
|
17228
|
+
binding: binding?.[2],
|
|
17229
|
+
ts: !!ts2,
|
|
17230
|
+
// true causes an error later
|
|
17231
|
+
children: $0
|
|
17232
|
+
};
|
|
17233
|
+
});
|
|
17234
|
+
function DynamicImportSpecifier(ctx, state2) {
|
|
17235
|
+
return (0, import_lib2.$EVENT)(ctx, state2, "DynamicImportSpecifier", DynamicImportSpecifier$0);
|
|
17236
|
+
}
|
|
17237
|
+
var DynamicModuleExportName$0 = ModuleExportName;
|
|
17238
|
+
var DynamicModuleExportName$1 = ComputedPropertyName;
|
|
17239
|
+
var DynamicModuleExportName$$ = [DynamicModuleExportName$0, DynamicModuleExportName$1];
|
|
17240
|
+
function DynamicModuleExportName(ctx, state2) {
|
|
17241
|
+
return (0, import_lib2.$EVENT_C)(ctx, state2, "DynamicModuleExportName", DynamicModuleExportName$$);
|
|
17242
|
+
}
|
|
16995
17243
|
var ImportAsToken$0 = (0, import_lib2.$S)(__, As);
|
|
16996
17244
|
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) {
|
|
16997
17245
|
var l = $1;
|
|
@@ -18283,7 +18531,7 @@ function SingleQuote(ctx, state2) {
|
|
|
18283
18531
|
return (0, import_lib2.$EVENT)(ctx, state2, "SingleQuote", SingleQuote$0);
|
|
18284
18532
|
}
|
|
18285
18533
|
var Star$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L75, 'Star "*"'), function($skip, $loc, $0, $1) {
|
|
18286
|
-
return { $loc, token: $1 };
|
|
18534
|
+
return { $loc, token: $1, type: "Star" };
|
|
18287
18535
|
});
|
|
18288
18536
|
function Star(ctx, state2) {
|
|
18289
18537
|
return (0, import_lib2.$EVENT)(ctx, state2, "Star", Star$0);
|
|
@@ -18436,18 +18684,22 @@ var Yield$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$EXPECT)(
|
|
|
18436
18684
|
function Yield(ctx, state2) {
|
|
18437
18685
|
return (0, import_lib2.$EVENT)(ctx, state2, "Yield", Yield$0);
|
|
18438
18686
|
}
|
|
18439
|
-
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) {
|
|
18440
|
-
|
|
18687
|
+
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) {
|
|
18688
|
+
var first = $1;
|
|
18689
|
+
var rest = $2;
|
|
18690
|
+
rest = rest ? rest[3] : [];
|
|
18691
|
+
const jsx = rest.length === 0 ? first : {
|
|
18441
18692
|
type: "JSXFragment",
|
|
18442
18693
|
children: [
|
|
18443
18694
|
"<>\n",
|
|
18444
18695
|
state.currentIndent.token,
|
|
18445
|
-
|
|
18696
|
+
first,
|
|
18697
|
+
...rest,
|
|
18446
18698
|
"\n",
|
|
18447
18699
|
state.currentIndent.token,
|
|
18448
18700
|
"</>"
|
|
18449
18701
|
],
|
|
18450
|
-
jsxChildren: [
|
|
18702
|
+
jsxChildren: [first, ...rest.map(([, tag]) => tag)]
|
|
18451
18703
|
};
|
|
18452
18704
|
const type = typeOfJSX(jsx, config);
|
|
18453
18705
|
return type ? [
|
|
@@ -19182,13 +19434,7 @@ var JSXAngleChild$0 = (0, import_lib2.$T)((0, import_lib2.$S)(CloseAngleBracket,
|
|
|
19182
19434
|
function JSXAngleChild(ctx, state2) {
|
|
19183
19435
|
return (0, import_lib2.$EVENT)(ctx, state2, "JSXAngleChild", JSXAngleChild$0);
|
|
19184
19436
|
}
|
|
19185
|
-
var JSXCodeChild$0 = (0, import_lib2.$
|
|
19186
|
-
var open = $1;
|
|
19187
|
-
var expression = $2;
|
|
19188
|
-
var close = $3;
|
|
19189
|
-
if (!expression) return $skip;
|
|
19190
|
-
return [open, expression, close];
|
|
19191
|
-
});
|
|
19437
|
+
var JSXCodeChild$0 = (0, import_lib2.$S)(InsertInlineOpenBrace, JSXCodeChildExpression, InsertCloseBrace);
|
|
19192
19438
|
function JSXCodeChild(ctx, state2) {
|
|
19193
19439
|
return (0, import_lib2.$EVENT)(ctx, state2, "JSXCodeChild", JSXCodeChild$0);
|
|
19194
19440
|
}
|
|
@@ -20531,6 +20777,7 @@ var CivetOption$0 = (0, import_lib2.$TR)((0, import_lib2.$EXPECT)($R99, "CivetOp
|
|
|
20531
20777
|
break;
|
|
20532
20778
|
case "globals":
|
|
20533
20779
|
case "symbols":
|
|
20780
|
+
case "operators":
|
|
20534
20781
|
value = value.split(",").filter(Boolean);
|
|
20535
20782
|
break;
|
|
20536
20783
|
}
|
|
@@ -20851,6 +21098,7 @@ var Reset$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'Reset ""'), fu
|
|
|
20851
21098
|
state.forbidTrailingMemberProperty = [false];
|
|
20852
21099
|
state.forbidNestedBinaryOp = [false];
|
|
20853
21100
|
state.forbidNewlineBinaryOp = [false];
|
|
21101
|
+
state.forbidImplicitFragment = [false];
|
|
20854
21102
|
state.forbidPipeline = [false];
|
|
20855
21103
|
state.JSXTagStack = [void 0];
|
|
20856
21104
|
state.operators = /* @__PURE__ */ new Map();
|
|
@@ -20939,6 +21187,36 @@ var Reset$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'Reset ""'), fu
|
|
|
20939
21187
|
}
|
|
20940
21188
|
}
|
|
20941
21189
|
});
|
|
21190
|
+
Object.defineProperty(config, "operators", {
|
|
21191
|
+
set(o) {
|
|
21192
|
+
if (!o) return;
|
|
21193
|
+
if (typeof o !== "object") {
|
|
21194
|
+
throw new Error("operators configuration must be an object or array");
|
|
21195
|
+
}
|
|
21196
|
+
if (Array.isArray(o)) {
|
|
21197
|
+
o.forEach((name) => {
|
|
21198
|
+
if (typeof name !== "string") {
|
|
21199
|
+
throw new Error("operators configuration array must contain only strings");
|
|
21200
|
+
}
|
|
21201
|
+
setOperatorBehavior(name, void 0);
|
|
21202
|
+
});
|
|
21203
|
+
} else {
|
|
21204
|
+
for (let [name, behavior] of Object.entries(o)) {
|
|
21205
|
+
if (typeof behavior === "string") {
|
|
21206
|
+
behavior = behavior.trim();
|
|
21207
|
+
behavior = behavior ? parse(behavior, {
|
|
21208
|
+
startRule: "OperatorBehavior",
|
|
21209
|
+
filename: `operator config for ${name}`
|
|
21210
|
+
}) : void 0;
|
|
21211
|
+
}
|
|
21212
|
+
if (behavior && typeof behavior !== "object") {
|
|
21213
|
+
throw new Error("operators configuration object must have string or object values");
|
|
21214
|
+
}
|
|
21215
|
+
setOperatorBehavior(name, behavior);
|
|
21216
|
+
}
|
|
21217
|
+
}
|
|
21218
|
+
}
|
|
21219
|
+
});
|
|
20942
21220
|
Object.assign(config, initialConfig);
|
|
20943
21221
|
});
|
|
20944
21222
|
function Reset(ctx, state2) {
|
|
@@ -21070,26 +21348,24 @@ var PushExtraIndent1$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'Pus
|
|
|
21070
21348
|
function PushExtraIndent1(ctx, state2) {
|
|
21071
21349
|
return (0, import_lib2.$EVENT)(ctx, state2, "PushExtraIndent1", PushExtraIndent1$0);
|
|
21072
21350
|
}
|
|
21073
|
-
var parser =
|
|
21074
|
-
|
|
21075
|
-
|
|
21076
|
-
|
|
21077
|
-
|
|
21078
|
-
|
|
21079
|
-
|
|
21080
|
-
|
|
21081
|
-
|
|
21082
|
-
|
|
21083
|
-
|
|
21084
|
-
|
|
21085
|
-
|
|
21086
|
-
|
|
21087
|
-
|
|
21088
|
-
|
|
21089
|
-
|
|
21090
|
-
|
|
21091
|
-
};
|
|
21092
|
-
}();
|
|
21351
|
+
var parser = {
|
|
21352
|
+
parse: (input, options = {}) => {
|
|
21353
|
+
const { fail, validate, reset } = (0, import_lib2.Validator)();
|
|
21354
|
+
let ctx = { expectation: "", fail };
|
|
21355
|
+
if (typeof input !== "string") throw new Error("Input must be a string");
|
|
21356
|
+
const parser2 = options.startRule != null ? grammar[options.startRule] : Object.values(grammar)[0];
|
|
21357
|
+
if (!parser2) throw new Error(`Could not find rule with name '${options.startRule}'`);
|
|
21358
|
+
const filename2 = options.filename || "<anonymous>";
|
|
21359
|
+
reset();
|
|
21360
|
+
Object.assign(ctx, { ...options.events, tokenize: options.tokenize });
|
|
21361
|
+
return validate(input, parser2(ctx, {
|
|
21362
|
+
input,
|
|
21363
|
+
pos: 0
|
|
21364
|
+
}), {
|
|
21365
|
+
filename: filename2
|
|
21366
|
+
});
|
|
21367
|
+
}
|
|
21368
|
+
};
|
|
21093
21369
|
var { parse } = parser;
|
|
21094
21370
|
var filename;
|
|
21095
21371
|
var initialConfig;
|
|
@@ -21104,6 +21380,7 @@ var state = {
|
|
|
21104
21380
|
forbidTrailingMemberProperty: [false],
|
|
21105
21381
|
forbidNestedBinaryOp: [false],
|
|
21106
21382
|
forbidNewlineBinaryOp: [false],
|
|
21383
|
+
forbidImplicitFragment: [false],
|
|
21107
21384
|
forbidPipeline: [false],
|
|
21108
21385
|
JSXTagStack: [void 0]
|
|
21109
21386
|
};
|
|
@@ -21155,6 +21432,12 @@ Object.defineProperties(state, {
|
|
|
21155
21432
|
return s[s.length - 1];
|
|
21156
21433
|
}
|
|
21157
21434
|
},
|
|
21435
|
+
implicitFragmentForbidden: {
|
|
21436
|
+
get() {
|
|
21437
|
+
const { forbidImplicitFragment: s } = state;
|
|
21438
|
+
return s[s.length - 1];
|
|
21439
|
+
}
|
|
21440
|
+
},
|
|
21158
21441
|
pipelineForbidden: {
|
|
21159
21442
|
get() {
|
|
21160
21443
|
const { forbidPipeline: s } = state;
|
|
@@ -21168,8 +21451,16 @@ Object.defineProperties(state, {
|
|
|
21168
21451
|
}
|
|
21169
21452
|
}
|
|
21170
21453
|
});
|
|
21454
|
+
function setOperatorBehavior(name, behavior) {
|
|
21455
|
+
const existing = state.operators.get(name);
|
|
21456
|
+
if (existing && behavior) {
|
|
21457
|
+
state.operators.set(name, { ...existing, ...behavior });
|
|
21458
|
+
} else {
|
|
21459
|
+
state.operators.set(name, behavior || existing);
|
|
21460
|
+
}
|
|
21461
|
+
}
|
|
21171
21462
|
function getStateKey() {
|
|
21172
|
-
const stateInt = state.currentIndent.level % 256 <<
|
|
21463
|
+
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,
|
|
21173
21464
|
// since it is affected by the directive prologue and may be hit
|
|
21174
21465
|
// by the EOL rule early in the parse. Later if we wanted to
|
|
21175
21466
|
// allow block scoping of the compat directives we would need to
|
|
@@ -21269,7 +21560,7 @@ var SourceMap = class {
|
|
|
21269
21560
|
const line = ref1[i1];
|
|
21270
21561
|
results.push((() => {
|
|
21271
21562
|
const results1 = [];
|
|
21272
|
-
for (let i2 = 0,
|
|
21563
|
+
for (let i2 = 0, len12 = line.length; i2 < len12; i2++) {
|
|
21273
21564
|
const entry = line[i2];
|
|
21274
21565
|
if (entry.length === 4) {
|
|
21275
21566
|
let [colDelta, sourceFileIndex, srcLine, srcCol] = entry;
|
|
@@ -21615,10 +21906,11 @@ var WorkerPool = class {
|
|
|
21615
21906
|
}
|
|
21616
21907
|
})();
|
|
21617
21908
|
const worker = new Worker(path.join(__dirname, "node-worker.mjs"));
|
|
21618
|
-
worker.on("message", (response) => {
|
|
21909
|
+
worker.on("message", async (response) => {
|
|
21619
21910
|
const callback = this.callbacks.get(response.id);
|
|
21620
21911
|
this.callbacks.delete(response.id);
|
|
21621
21912
|
if (response.error) {
|
|
21913
|
+
await new Promise((done) => setTimeout(done, 0));
|
|
21622
21914
|
const message = `${response.error.name}: ${response.error.message}`;
|
|
21623
21915
|
let ref;
|
|
21624
21916
|
if (response.error.type in globalThis) {
|
|
@@ -21734,7 +22026,32 @@ var uncacheable = /* @__PURE__ */ new Set([
|
|
|
21734
22026
|
"RestorePipeline"
|
|
21735
22027
|
]);
|
|
21736
22028
|
var workerPool;
|
|
22029
|
+
function decode(src) {
|
|
22030
|
+
if (typeof src === "string") {
|
|
22031
|
+
return src;
|
|
22032
|
+
}
|
|
22033
|
+
if (typeof Buffer === "undefined") {
|
|
22034
|
+
return src;
|
|
22035
|
+
}
|
|
22036
|
+
if (!Buffer?.isBuffer(src)) {
|
|
22037
|
+
return src;
|
|
22038
|
+
}
|
|
22039
|
+
if (src[0] === 239 && src[1] === 187 && src[2] === 191) {
|
|
22040
|
+
return src.toString("utf8", 3);
|
|
22041
|
+
} else if (src[0] === 255 && src[1] === 254) {
|
|
22042
|
+
return src.toString("utf16le", 2);
|
|
22043
|
+
} else if (src[0] === 254 && src[1] === 255) {
|
|
22044
|
+
for (let end = src.length - 2, i1 = 2; i1 <= end; i1 += 2) {
|
|
22045
|
+
const i = i1;
|
|
22046
|
+
[src[i], src[i + 1]] = [src[i + 1], src[i]];
|
|
22047
|
+
}
|
|
22048
|
+
return src.toString("utf16le", 2);
|
|
22049
|
+
} else {
|
|
22050
|
+
return src.toString("utf8");
|
|
22051
|
+
}
|
|
22052
|
+
}
|
|
21737
22053
|
function compile(src, options) {
|
|
22054
|
+
src = decode(src);
|
|
21738
22055
|
if (!(process.env.CIVET_THREADS == 0)) {
|
|
21739
22056
|
const threads = parseInt(options?.threads ?? process.env.CIVET_THREADS, 10);
|
|
21740
22057
|
if (threads === 0) {
|
|
@@ -21931,6 +22248,7 @@ export {
|
|
|
21931
22248
|
ParseErrors,
|
|
21932
22249
|
SourceMap2 as SourceMap,
|
|
21933
22250
|
compile,
|
|
22251
|
+
decode,
|
|
21934
22252
|
main_civet_default as default,
|
|
21935
22253
|
generate_civet_default as generate,
|
|
21936
22254
|
isCompileError,
|