@danielx/civet 0.5.87 → 0.5.89
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.js +107 -52
- package/dist/main.js +107 -52
- package/dist/main.mjs +107 -52
- package/package.json +1 -1
package/dist/browser.js
CHANGED
|
@@ -44,7 +44,7 @@ var Civet = (() => {
|
|
|
44
44
|
children: block.children === block.expressions ? expressions : block.children.map((c) => c === block.expressions ? expressions : c)
|
|
45
45
|
};
|
|
46
46
|
if (block.bare) {
|
|
47
|
-
block.children = [[" {
|
|
47
|
+
block.children = [[" {"], ...block.children, "}"];
|
|
48
48
|
block.bare = false;
|
|
49
49
|
}
|
|
50
50
|
}
|
|
@@ -152,8 +152,16 @@ var Civet = (() => {
|
|
|
152
152
|
}
|
|
153
153
|
function getIndent(statement) {
|
|
154
154
|
let indent = statement?.[0];
|
|
155
|
-
if (Array.isArray(indent))
|
|
156
|
-
indent = indent
|
|
155
|
+
if (Array.isArray(indent)) {
|
|
156
|
+
indent = indent.flat(Infinity);
|
|
157
|
+
return indent.filter((n) => n && !(n.type === "Comment")).map((n) => {
|
|
158
|
+
if (typeof n === "string")
|
|
159
|
+
return n;
|
|
160
|
+
if (n.token != null)
|
|
161
|
+
return n.token;
|
|
162
|
+
return "";
|
|
163
|
+
});
|
|
164
|
+
}
|
|
157
165
|
return indent;
|
|
158
166
|
}
|
|
159
167
|
function hasAwait(exp) {
|
|
@@ -175,10 +183,11 @@ var Civet = (() => {
|
|
|
175
183
|
}
|
|
176
184
|
const block = outer.parent;
|
|
177
185
|
const { expressions } = block;
|
|
178
|
-
const index = expressions.
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
186
|
+
const index = expressions.findIndex(([, s]) => outer === s);
|
|
187
|
+
if (index < 0)
|
|
188
|
+
throw new Error("Couldn't find expression in block for hoistable declaration.");
|
|
189
|
+
const indent = expressions[index][0];
|
|
190
|
+
hoistDec[0][0] = indent;
|
|
182
191
|
expressions.splice(index, 0, hoistDec);
|
|
183
192
|
node.hoistDec = null;
|
|
184
193
|
});
|
|
@@ -318,7 +327,7 @@ var Civet = (() => {
|
|
|
318
327
|
varLet = [",", ...varName, " = ", counterRef];
|
|
319
328
|
} else {
|
|
320
329
|
blockPrefix = [
|
|
321
|
-
["", forDeclaration, " = ", counterRef, "
|
|
330
|
+
["", forDeclaration, " = ", counterRef, ";"]
|
|
322
331
|
];
|
|
323
332
|
}
|
|
324
333
|
} else if (forDeclaration) {
|
|
@@ -1032,6 +1041,7 @@ ${input.slice(result.pos)}
|
|
|
1032
1041
|
OperatorDeclaration,
|
|
1033
1042
|
OperatorSignature,
|
|
1034
1043
|
AmpersandBlockRHS,
|
|
1044
|
+
AmpersandBlockRHSBody,
|
|
1035
1045
|
AmpersandUnaryPrefix,
|
|
1036
1046
|
ThinArrowFunction,
|
|
1037
1047
|
Arrow,
|
|
@@ -1785,7 +1795,8 @@ ${input.slice(result.pos)}
|
|
|
1785
1795
|
type: "BlockStatement",
|
|
1786
1796
|
expressions: statements,
|
|
1787
1797
|
children: [statements],
|
|
1788
|
-
bare: true
|
|
1798
|
+
bare: true,
|
|
1799
|
+
root: true
|
|
1789
1800
|
});
|
|
1790
1801
|
return $0;
|
|
1791
1802
|
});
|
|
@@ -2244,7 +2255,7 @@ ${input.slice(result.pos)}
|
|
|
2244
2255
|
return result;
|
|
2245
2256
|
}
|
|
2246
2257
|
}
|
|
2247
|
-
var ArgumentsWithTrailingMemberExpressions$0 = $TS($S(Arguments,
|
|
2258
|
+
var ArgumentsWithTrailingMemberExpressions$0 = $TS($S(Arguments, AllowedTrailingMemberExpressions), function($skip, $loc, $0, $1, $2) {
|
|
2248
2259
|
var args = $1;
|
|
2249
2260
|
var trailing = $2;
|
|
2250
2261
|
const call = {
|
|
@@ -6262,7 +6273,34 @@ ${input.slice(result.pos)}
|
|
|
6262
6273
|
return result;
|
|
6263
6274
|
}
|
|
6264
6275
|
}
|
|
6265
|
-
var AmpersandBlockRHS$0 = $TS($S(
|
|
6276
|
+
var AmpersandBlockRHS$0 = $TS($S(ForbidTrailingMemberProperty, $E(AmpersandBlockRHSBody), RestoreTrailingMemberProperty), function($skip, $loc, $0, $1, $2, $3) {
|
|
6277
|
+
if (!$2)
|
|
6278
|
+
return $skip;
|
|
6279
|
+
return $2;
|
|
6280
|
+
});
|
|
6281
|
+
function AmpersandBlockRHS(state) {
|
|
6282
|
+
let eventData;
|
|
6283
|
+
if (state.events) {
|
|
6284
|
+
const result = state.events.enter?.("AmpersandBlockRHS", state);
|
|
6285
|
+
if (result) {
|
|
6286
|
+
if (result.cache)
|
|
6287
|
+
return result.cache;
|
|
6288
|
+
eventData = result.data;
|
|
6289
|
+
}
|
|
6290
|
+
}
|
|
6291
|
+
if (state.tokenize) {
|
|
6292
|
+
const result = $TOKEN("AmpersandBlockRHS", state, AmpersandBlockRHS$0(state));
|
|
6293
|
+
if (state.events)
|
|
6294
|
+
state.events.exit?.("AmpersandBlockRHS", state, result, eventData);
|
|
6295
|
+
return result;
|
|
6296
|
+
} else {
|
|
6297
|
+
const result = AmpersandBlockRHS$0(state);
|
|
6298
|
+
if (state.events)
|
|
6299
|
+
state.events.exit?.("AmpersandBlockRHS", state, result, eventData);
|
|
6300
|
+
return result;
|
|
6301
|
+
}
|
|
6302
|
+
}
|
|
6303
|
+
var AmpersandBlockRHSBody$0 = $TS($S($E($S($N(_), $P(CallExpressionRest))), $E($S($N($EXPECT($R3, fail, "AmpersandBlockRHSBody /[&]/")), $P(BinaryOpRHS)))), function($skip, $loc, $0, $1, $2) {
|
|
6266
6304
|
var callExpRest = $1;
|
|
6267
6305
|
var binopRHS = $2;
|
|
6268
6306
|
if (!callExpRest && !binopRHS)
|
|
@@ -6289,10 +6327,10 @@ ${input.slice(result.pos)}
|
|
|
6289
6327
|
}
|
|
6290
6328
|
return exp;
|
|
6291
6329
|
});
|
|
6292
|
-
function
|
|
6330
|
+
function AmpersandBlockRHSBody(state) {
|
|
6293
6331
|
let eventData;
|
|
6294
6332
|
if (state.events) {
|
|
6295
|
-
const result = state.events.enter?.("
|
|
6333
|
+
const result = state.events.enter?.("AmpersandBlockRHSBody", state);
|
|
6296
6334
|
if (result) {
|
|
6297
6335
|
if (result.cache)
|
|
6298
6336
|
return result.cache;
|
|
@@ -6300,14 +6338,14 @@ ${input.slice(result.pos)}
|
|
|
6300
6338
|
}
|
|
6301
6339
|
}
|
|
6302
6340
|
if (state.tokenize) {
|
|
6303
|
-
const result = $TOKEN("
|
|
6341
|
+
const result = $TOKEN("AmpersandBlockRHSBody", state, AmpersandBlockRHSBody$0(state));
|
|
6304
6342
|
if (state.events)
|
|
6305
|
-
state.events.exit?.("
|
|
6343
|
+
state.events.exit?.("AmpersandBlockRHSBody", state, result, eventData);
|
|
6306
6344
|
return result;
|
|
6307
6345
|
} else {
|
|
6308
|
-
const result =
|
|
6346
|
+
const result = AmpersandBlockRHSBody$0(state);
|
|
6309
6347
|
if (state.events)
|
|
6310
|
-
state.events.exit?.("
|
|
6348
|
+
state.events.exit?.("AmpersandBlockRHSBody", state, result, eventData);
|
|
6311
6349
|
return result;
|
|
6312
6350
|
}
|
|
6313
6351
|
}
|
|
@@ -6889,17 +6927,10 @@ ${input.slice(result.pos)}
|
|
|
6889
6927
|
if (!statements.length)
|
|
6890
6928
|
return $skip;
|
|
6891
6929
|
statements = statements.flat();
|
|
6892
|
-
const first = statements[0];
|
|
6893
|
-
const ws = first[0];
|
|
6894
|
-
const indent = ws.at(-1);
|
|
6895
|
-
statements = [
|
|
6896
|
-
[indent, ...first.slice(1)],
|
|
6897
|
-
...statements.slice(1)
|
|
6898
|
-
];
|
|
6899
6930
|
return {
|
|
6900
6931
|
type: "BlockStatement",
|
|
6901
6932
|
expressions: statements,
|
|
6902
|
-
children: [
|
|
6933
|
+
children: [statements],
|
|
6903
6934
|
bare: true
|
|
6904
6935
|
};
|
|
6905
6936
|
});
|
|
@@ -10098,13 +10129,12 @@ ${input.slice(result.pos)}
|
|
|
10098
10129
|
});
|
|
10099
10130
|
var ForStatementControl$1 = $TS($S(CoffeeForLoopsEnabled, CoffeeForStatementParameters, $E(WhenCondition)), function($skip, $loc, $0, $1, $2, $3) {
|
|
10100
10131
|
if ($3) {
|
|
10101
|
-
const
|
|
10102
|
-
const block = "continue\n";
|
|
10132
|
+
const block = "continue;";
|
|
10103
10133
|
$2 = {
|
|
10104
10134
|
...$2,
|
|
10105
10135
|
blockPrefix: [
|
|
10106
10136
|
...$2.blockPrefix,
|
|
10107
|
-
[
|
|
10137
|
+
["", {
|
|
10108
10138
|
type: "IfStatement",
|
|
10109
10139
|
then: block,
|
|
10110
10140
|
children: ["if (!(", insertTrimmingSpace($3, ""), ")) ", block]
|
|
@@ -10171,7 +10201,6 @@ ${input.slice(result.pos)}
|
|
|
10171
10201
|
var step = $8;
|
|
10172
10202
|
var close = $9;
|
|
10173
10203
|
let blockPrefix = [];
|
|
10174
|
-
const indent = module.currentIndent.token + " ";
|
|
10175
10204
|
exp = insertTrimmingSpace(exp, "");
|
|
10176
10205
|
declaration = insertTrimmingSpace(declaration, "");
|
|
10177
10206
|
if (kind.token === "from") {
|
|
@@ -10185,14 +10214,14 @@ ${input.slice(result.pos)}
|
|
|
10185
10214
|
}
|
|
10186
10215
|
if (declaration.own) {
|
|
10187
10216
|
const hasPropRef = module.getRef("hasProp");
|
|
10188
|
-
blockPrefix.push([
|
|
10217
|
+
blockPrefix.push(["", "if (!", hasPropRef, ".call(", exp, ", ", declaration, ")) continue", ";"]);
|
|
10189
10218
|
}
|
|
10190
10219
|
if (index) {
|
|
10191
|
-
blockPrefix.push([
|
|
10220
|
+
blockPrefix.push(["", {
|
|
10192
10221
|
type: "AssignmentExpression",
|
|
10193
10222
|
children: [index, " = ", exp, "[", declaration, "]"],
|
|
10194
10223
|
names: index.names
|
|
10195
|
-
}, "
|
|
10224
|
+
}, ";"]);
|
|
10196
10225
|
}
|
|
10197
10226
|
kind.token = "in";
|
|
10198
10227
|
} else if (kind.token === "in") {
|
|
@@ -10228,11 +10257,11 @@ ${input.slice(result.pos)}
|
|
|
10228
10257
|
assignmentNames.push(...index.names);
|
|
10229
10258
|
}
|
|
10230
10259
|
const expRefDec = expRef !== exp ? [expRef, " = ", insertTrimmingSpace(exp, ""), ", "] : [];
|
|
10231
|
-
blockPrefix.push([
|
|
10260
|
+
blockPrefix.push(["", {
|
|
10232
10261
|
type: "AssignmentExpression",
|
|
10233
|
-
children: [varRef, " = ", expRef, "[", indexAssignment, counterRef, "]
|
|
10262
|
+
children: [varRef, " = ", expRef, "[", indexAssignment, counterRef, "]"],
|
|
10234
10263
|
names: assignmentNames
|
|
10235
|
-
}]);
|
|
10264
|
+
}, ";"]);
|
|
10236
10265
|
declaration = {
|
|
10237
10266
|
type: "Declaration",
|
|
10238
10267
|
children: ["let ", ...expRefDec, counterRef, " = 0, ", lenRef, " = ", expRef, ".length"],
|
|
@@ -11155,8 +11184,8 @@ ${input.slice(result.pos)}
|
|
|
11155
11184
|
const initCondition = {
|
|
11156
11185
|
type: "AssignmentExpression",
|
|
11157
11186
|
children: [ref, " ", initializer],
|
|
11158
|
-
hoistDec: [["", ["let ", ref], "
|
|
11159
|
-
blockPrefix: [["", [binding, "= ", ref], "
|
|
11187
|
+
hoistDec: [["", ["let ", ref], ";"]],
|
|
11188
|
+
blockPrefix: [["", [binding, "= ", ref], ";"]]
|
|
11160
11189
|
};
|
|
11161
11190
|
return initCondition;
|
|
11162
11191
|
});
|
|
@@ -13868,7 +13897,7 @@ ${input.slice(result.pos)}
|
|
|
13868
13897
|
}
|
|
13869
13898
|
}
|
|
13870
13899
|
var JSSingleLineComment$0 = $TR($EXPECT($R41, fail, "JSSingleLineComment /\\/\\/(?!\\/)[^\\r\\n]*/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
|
|
13871
|
-
return { $loc, token: $0 };
|
|
13900
|
+
return { type: "Comment", $loc, token: $0 };
|
|
13872
13901
|
});
|
|
13873
13902
|
function JSSingleLineComment(state) {
|
|
13874
13903
|
let eventData;
|
|
@@ -13917,7 +13946,7 @@ ${input.slice(result.pos)}
|
|
|
13917
13946
|
}
|
|
13918
13947
|
}
|
|
13919
13948
|
var JSMultiLineComment$0 = $TV($TEXT($S($EXPECT($L94, fail, 'JSMultiLineComment "/*"'), $Q($S($N($EXPECT($L95, fail, 'JSMultiLineComment "*/"')), $EXPECT($R42, fail, "JSMultiLineComment /./"))), $EXPECT($L95, fail, 'JSMultiLineComment "*/"'))), function($skip, $loc, $0, $1) {
|
|
13920
|
-
return { $loc, token: $1 };
|
|
13949
|
+
return { type: "Comment", $loc, token: $1 };
|
|
13921
13950
|
});
|
|
13922
13951
|
function JSMultiLineComment(state) {
|
|
13923
13952
|
let eventData;
|
|
@@ -13942,7 +13971,7 @@ ${input.slice(result.pos)}
|
|
|
13942
13971
|
}
|
|
13943
13972
|
}
|
|
13944
13973
|
var CoffeeSingleLineComment$0 = $TR($EXPECT($R43, fail, "CoffeeSingleLineComment /#(?!##(?!#))([^\\r\\n]*)/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
|
|
13945
|
-
return { $loc, token: `//${$1}` };
|
|
13974
|
+
return { type: "Comment", $loc, token: `//${$1}` };
|
|
13946
13975
|
});
|
|
13947
13976
|
function CoffeeSingleLineComment(state) {
|
|
13948
13977
|
let eventData;
|
|
@@ -13968,7 +13997,7 @@ ${input.slice(result.pos)}
|
|
|
13968
13997
|
}
|
|
13969
13998
|
var CoffeeMultiLineComment$0 = $TS($S(CoffeeHereCommentStart, $TEXT($EXPECT($R44, fail, "CoffeeMultiLineComment /[^]*?###/"))), function($skip, $loc, $0, $1, $2) {
|
|
13970
13999
|
$2 = $2.slice(0, $2.length - 3).replace(/\*\//g, "* /");
|
|
13971
|
-
return { $loc, token: `/*${$2}*/` };
|
|
14000
|
+
return { type: "Comment", $loc, token: `/*${$2}*/` };
|
|
13972
14001
|
});
|
|
13973
14002
|
function CoffeeMultiLineComment(state) {
|
|
13974
14003
|
let eventData;
|
|
@@ -21400,6 +21429,8 @@ ${input.slice(result.pos)}
|
|
|
21400
21429
|
exp.blocks.forEach((block) => insertPush(block, ref));
|
|
21401
21430
|
return;
|
|
21402
21431
|
}
|
|
21432
|
+
if (node[node.length - 1]?.type === "SemicolonDelimiter")
|
|
21433
|
+
return;
|
|
21403
21434
|
node.splice(1, 0, ref, ".push(");
|
|
21404
21435
|
node.push(")");
|
|
21405
21436
|
}
|
|
@@ -21478,7 +21509,10 @@ ${input.slice(result.pos)}
|
|
|
21478
21509
|
if (exp.else)
|
|
21479
21510
|
insertReturn(exp.else[2]);
|
|
21480
21511
|
else
|
|
21481
|
-
exp.children.push(["
|
|
21512
|
+
exp.children.push(["", {
|
|
21513
|
+
type: "ReturnStatement",
|
|
21514
|
+
children: [";return"]
|
|
21515
|
+
}]);
|
|
21482
21516
|
return;
|
|
21483
21517
|
case "PatternMatchingStatement":
|
|
21484
21518
|
insertReturn(exp.children[0][0]);
|
|
@@ -21887,11 +21921,15 @@ ${input.slice(result.pos)}
|
|
|
21887
21921
|
const [splices, thisAssignments] = gatherBindingCode(parameters, {
|
|
21888
21922
|
injectParamProps: f.name === "constructor"
|
|
21889
21923
|
});
|
|
21924
|
+
const delimiter = {
|
|
21925
|
+
type: "SemicolonDelimiter",
|
|
21926
|
+
children: [";"]
|
|
21927
|
+
};
|
|
21890
21928
|
const prefix = splices.map((s) => ["let ", s]).concat(thisAssignments).map(
|
|
21891
21929
|
(s) => s.type ? {
|
|
21892
21930
|
...s,
|
|
21893
|
-
children: [indent, ...s.children,
|
|
21894
|
-
} : [indent, s,
|
|
21931
|
+
children: [indent, ...s.children, delimiter]
|
|
21932
|
+
} : [indent, s, delimiter]
|
|
21895
21933
|
);
|
|
21896
21934
|
expressions.unshift(...prefix);
|
|
21897
21935
|
}
|
|
@@ -21950,9 +21988,10 @@ ${input.slice(result.pos)}
|
|
|
21950
21988
|
getIndent(block.expressions[0]),
|
|
21951
21989
|
{
|
|
21952
21990
|
type: "Declaration",
|
|
21953
|
-
children: ["let ", ref, returnType
|
|
21991
|
+
children: ["let ", ref, returnType],
|
|
21954
21992
|
names: []
|
|
21955
|
-
}
|
|
21993
|
+
},
|
|
21994
|
+
";"
|
|
21956
21995
|
]);
|
|
21957
21996
|
}
|
|
21958
21997
|
gatherRecursiveWithinFunction(
|
|
@@ -21964,7 +22003,7 @@ ${input.slice(result.pos)}
|
|
|
21964
22003
|
});
|
|
21965
22004
|
if (block.children.at(-2)?.type !== "ReturnStatement") {
|
|
21966
22005
|
block.expressions.push([
|
|
21967
|
-
[
|
|
22006
|
+
[getIndent(block.expressions.at(-1))],
|
|
21968
22007
|
{
|
|
21969
22008
|
type: "ReturnStatement",
|
|
21970
22009
|
expression: ref,
|
|
@@ -22448,11 +22487,11 @@ ${input.slice(result.pos)}
|
|
|
22448
22487
|
let [splices, thisAssignments] = gatherBindingCode(pattern);
|
|
22449
22488
|
const patternBindings = nonMatcherBindings(pattern);
|
|
22450
22489
|
splices = splices.map((s2) => [", ", nonMatcherBindings(s2)]);
|
|
22451
|
-
thisAssignments = thisAssignments.map((a) => [indent, a, "
|
|
22490
|
+
thisAssignments = thisAssignments.map((a) => [indent, a, ";"]);
|
|
22452
22491
|
const duplicateDeclarations = aggregateDuplicateBindings([patternBindings, splices]);
|
|
22453
|
-
prefix.push([indent, "const ", patternBindings, " = ", ref, splices, "
|
|
22492
|
+
prefix.push([indent, "const ", patternBindings, " = ", ref, splices, ";"]);
|
|
22454
22493
|
prefix.push(...thisAssignments);
|
|
22455
|
-
prefix.push(...duplicateDeclarations.map((d) => [indent, d, "
|
|
22494
|
+
prefix.push(...duplicateDeclarations.map((d) => [indent, d, ";"]));
|
|
22456
22495
|
break;
|
|
22457
22496
|
}
|
|
22458
22497
|
}
|
|
@@ -22607,6 +22646,11 @@ ${input.slice(result.pos)}
|
|
|
22607
22646
|
});
|
|
22608
22647
|
}
|
|
22609
22648
|
module.processProgram = function(root) {
|
|
22649
|
+
assert.equal(module.forbidClassImplicitCall.length, 1, "forbidClassImplicitCall");
|
|
22650
|
+
assert.equal(module.forbidIndentedApplication.length, 1, "forbidIndentedApplication");
|
|
22651
|
+
assert.equal(module.forbidTrailingMemberProperty.length, 1, "forbidTrailingMemberProperty");
|
|
22652
|
+
assert.equal(module.forbidMultiLineImplicitObjectLiteral.length, 1, "forbidMultiLineImplicitObjectLiteral");
|
|
22653
|
+
assert.equal(module.JSXTagStack.length, 0, "JSXTagStack should be empty");
|
|
22610
22654
|
addParentPointers(root);
|
|
22611
22655
|
const { expressions: statements } = root;
|
|
22612
22656
|
processPipelineExpressions(statements);
|
|
@@ -22700,7 +22744,11 @@ ${input.slice(result.pos)}
|
|
|
22700
22744
|
});
|
|
22701
22745
|
if (varIds.length) {
|
|
22702
22746
|
const indent = getIndent(statements[0]);
|
|
22703
|
-
|
|
22747
|
+
let delimiter = ";";
|
|
22748
|
+
if (statements[0][1]?.parent?.root) {
|
|
22749
|
+
delimiter = ";\n";
|
|
22750
|
+
}
|
|
22751
|
+
statements.unshift([indent, "var ", varIds.join(", "), delimiter]);
|
|
22704
22752
|
}
|
|
22705
22753
|
scopes.pop();
|
|
22706
22754
|
}
|
|
@@ -23141,6 +23189,13 @@ ${input.slice(result.pos)}
|
|
|
23141
23189
|
quoteString,
|
|
23142
23190
|
removeParentPointers
|
|
23143
23191
|
} = require_lib();
|
|
23192
|
+
var assert = {
|
|
23193
|
+
equal(a, b, msg) {
|
|
23194
|
+
if (a !== b) {
|
|
23195
|
+
throw new Error(`Assertion failed [${msg}]: ${a} !== ${b}`);
|
|
23196
|
+
}
|
|
23197
|
+
}
|
|
23198
|
+
};
|
|
23144
23199
|
}
|
|
23145
23200
|
});
|
|
23146
23201
|
|
|
@@ -23577,7 +23632,7 @@ ${input.slice(result.pos)}
|
|
|
23577
23632
|
var uncacheable;
|
|
23578
23633
|
({ parse } = import_parser.default);
|
|
23579
23634
|
({ SourceMap: SourceMap2, base64Encode: base64Encode2 } = util_exports);
|
|
23580
|
-
uncacheable = /* @__PURE__ */ new Set(["ActualAssignment", "AllowAll", "AllowClassImplicitCall", "AllowIndentedApplication", "AllowTrailingMemberProperty", "AllowedTrailingMemberExpressions", "ApplicationStart", "Arguments", "ArgumentsWithTrailingMemberExpressions", "ArrowFunction", "ArrowFunctionTail", "AssignmentExpression", "AssignmentExpressionTail", "BinaryOpExpression", "BinaryOpRHS", "BracedBlock", "BracedObjectLiteralContent", "BracedOrEmptyBlock", "CallExpression", "CallExpressionRest", "ClassImplicitCallForbidden", "CoffeeCommentEnabled", "CommaDelimiter", "ConditionalExpression", "Declaration", "Debugger", "ElementListWithIndentedApplicationForbidden", "ElseClause", "Expression", "ExpressionStatement", "ExpressionWithIndentedApplicationForbidden", "ExtendedExpression", "FatArrowBody", "ForbidClassImplicitCall", "ForbidIndentedApplication", "ForbidTrailingMemberProperty", "FunctionDeclaration", "FunctionExpression", "HoistableDeclaration", "ImplicitArguments", "ImplicitInlineObjectPropertyDelimiter", "ImplicitNestedBlock", "IndentedApplicationAllowed", "IndentedFurther", "IndentedJSXChildExpression", "InlineObjectLiteral", "InsertIndent", "JSXChild", "JSXChildren", "JSXElement", "JSXFragment", "JSXImplicitFragment", "JSXMixedChildren", "JSXNested", "JSXNestedChildren", "JSXOptionalClosingElement", "JSXOptionalClosingFragment", "JSXTag", "LeftHandSideExpression", "MemberExpression", "MemberExpressionRest", "Nested", "NestedBindingElement", "NestedBindingElements", "NestedBlockExpression", "NestedBlockExpression", "NestedBlockStatement", "NestedBlockStatements", "NestedClassSignatureElement", "NestedClassSignatureElements", "NestedDeclareElement", "NestedDeclareElements", "NestedElement", "NestedElementList", "NestedImplicitObjectLiteral", "NestedImplicitPropertyDefinition", "NestedImplicitPropertyDefinitions", "NestedInterfaceProperty", "NestedJSXChildExpression", "NestedModuleItem", "NestedModuleItems", "NestedObject", "NestedPropertyDefinitions", "NonSingleBracedBlock", "NotDedented", "ObjectLiteral", "PopIndent", "PopJSXStack", "PostfixedExpression", "PostfixedStatement", "PrimaryExpression", "PushIndent", "PushJSXOpeningElement", "PushJSXOpeningFragment", "RestoreAll", "RestoreClassImplicitCall", "RestoreIndentedApplication", "RestoreTrailingMemberProperty", "RHS", "Samedent", "ShortCircuitExpression", "SingleLineAssignmentExpression", "SingleLineComment", "SingleLineStatements", "SnugNamedProperty", "Statement", "StatementListItem", "SuffixedExpression", "SuffixedStatement", "ThinArrowFunction", "TrackIndented", "TrailingMemberExpressions", "TrailingMemberPropertyAllowed", "TypedJSXElement", "TypedJSXFragment", "UnaryExpression", "UpdateExpression"]);
|
|
23635
|
+
uncacheable = /* @__PURE__ */ new Set(["ActualAssignment", "AllowAll", "AllowClassImplicitCall", "AllowIndentedApplication", "AllowMultiLineImplicitObjectLiteral", "AllowTrailingMemberProperty", "AllowedTrailingMemberExpressions", "ApplicationStart", "Arguments", "ArgumentsWithTrailingMemberExpressions", "ArrowFunction", "ArrowFunctionTail", "AssignmentExpression", "AssignmentExpressionTail", "BinaryOpExpression", "BinaryOpRHS", "BracedBlock", "BracedObjectLiteralContent", "BracedOrEmptyBlock", "CallExpression", "CallExpressionRest", "ClassImplicitCallForbidden", "CoffeeCommentEnabled", "CommaDelimiter", "ConditionalExpression", "Declaration", "Debugger", "ElementListWithIndentedApplicationForbidden", "ElseClause", "Expression", "ExpressionStatement", "ExpressionWithIndentedApplicationForbidden", "ExtendedExpression", "FatArrowBody", "ForbidClassImplicitCall", "ForbidIndentedApplication", "ForbidMultiLineImplicitObjectLiteral", "ForbidTrailingMemberProperty", "FunctionDeclaration", "FunctionExpression", "HoistableDeclaration", "ImplicitArguments", "ImplicitInlineObjectPropertyDelimiter", "ImplicitNestedBlock", "IndentedApplicationAllowed", "IndentedFurther", "IndentedJSXChildExpression", "InlineObjectLiteral", "InsertIndent", "JSXChild", "JSXChildren", "JSXElement", "JSXFragment", "JSXImplicitFragment", "JSXMixedChildren", "JSXNested", "JSXNestedChildren", "JSXOptionalClosingElement", "JSXOptionalClosingFragment", "JSXTag", "LeftHandSideExpression", "MemberExpression", "MemberExpressionRest", "Nested", "NestedBindingElement", "NestedBindingElements", "NestedBlockExpression", "NestedBlockExpression", "NestedBlockStatement", "NestedBlockStatements", "NestedClassSignatureElement", "NestedClassSignatureElements", "NestedDeclareElement", "NestedDeclareElements", "NestedElement", "NestedElementList", "NestedImplicitObjectLiteral", "NestedImplicitPropertyDefinition", "NestedImplicitPropertyDefinitions", "NestedInterfaceProperty", "NestedJSXChildExpression", "NestedModuleItem", "NestedModuleItems", "NestedObject", "NestedPropertyDefinitions", "NonSingleBracedBlock", "NotDedented", "ObjectLiteral", "PopIndent", "PopJSXStack", "PostfixedExpression", "PostfixedStatement", "PrimaryExpression", "PushIndent", "PushJSXOpeningElement", "PushJSXOpeningFragment", "RestoreAll", "RestoreClassImplicitCall", "RestoreMultiLineImplicitObjectLiteral", "RestoreIndentedApplication", "RestoreTrailingMemberProperty", "RHS", "Samedent", "ShortCircuitExpression", "SingleLineAssignmentExpression", "SingleLineComment", "SingleLineStatements", "SnugNamedProperty", "Statement", "StatementListItem", "SuffixedExpression", "SuffixedStatement", "ThinArrowFunction", "TrackIndented", "TrailingMemberExpressions", "TrailingMemberPropertyAllowed", "TypedJSXElement", "TypedJSXFragment", "UnaryExpression", "UpdateExpression"]);
|
|
23581
23636
|
var compile = function(src, options) {
|
|
23582
23637
|
var ast, code, events, filename, ref, result, sm, srcMapJSON;
|
|
23583
23638
|
if (!options) {
|
package/dist/main.js
CHANGED
|
@@ -43,7 +43,7 @@ var require_lib = __commonJS({
|
|
|
43
43
|
children: block.children === block.expressions ? expressions : block.children.map((c) => c === block.expressions ? expressions : c)
|
|
44
44
|
};
|
|
45
45
|
if (block.bare) {
|
|
46
|
-
block.children = [[" {
|
|
46
|
+
block.children = [[" {"], ...block.children, "}"];
|
|
47
47
|
block.bare = false;
|
|
48
48
|
}
|
|
49
49
|
}
|
|
@@ -151,8 +151,16 @@ var require_lib = __commonJS({
|
|
|
151
151
|
}
|
|
152
152
|
function getIndent(statement) {
|
|
153
153
|
let indent = statement?.[0];
|
|
154
|
-
if (Array.isArray(indent))
|
|
155
|
-
indent = indent
|
|
154
|
+
if (Array.isArray(indent)) {
|
|
155
|
+
indent = indent.flat(Infinity);
|
|
156
|
+
return indent.filter((n) => n && !(n.type === "Comment")).map((n) => {
|
|
157
|
+
if (typeof n === "string")
|
|
158
|
+
return n;
|
|
159
|
+
if (n.token != null)
|
|
160
|
+
return n.token;
|
|
161
|
+
return "";
|
|
162
|
+
});
|
|
163
|
+
}
|
|
156
164
|
return indent;
|
|
157
165
|
}
|
|
158
166
|
function hasAwait(exp) {
|
|
@@ -174,10 +182,11 @@ var require_lib = __commonJS({
|
|
|
174
182
|
}
|
|
175
183
|
const block = outer.parent;
|
|
176
184
|
const { expressions } = block;
|
|
177
|
-
const index = expressions.
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
185
|
+
const index = expressions.findIndex(([, s]) => outer === s);
|
|
186
|
+
if (index < 0)
|
|
187
|
+
throw new Error("Couldn't find expression in block for hoistable declaration.");
|
|
188
|
+
const indent = expressions[index][0];
|
|
189
|
+
hoistDec[0][0] = indent;
|
|
181
190
|
expressions.splice(index, 0, hoistDec);
|
|
182
191
|
node.hoistDec = null;
|
|
183
192
|
});
|
|
@@ -317,7 +326,7 @@ var require_lib = __commonJS({
|
|
|
317
326
|
varLet = [",", ...varName, " = ", counterRef];
|
|
318
327
|
} else {
|
|
319
328
|
blockPrefix = [
|
|
320
|
-
["", forDeclaration, " = ", counterRef, "
|
|
329
|
+
["", forDeclaration, " = ", counterRef, ";"]
|
|
321
330
|
];
|
|
322
331
|
}
|
|
323
332
|
} else if (forDeclaration) {
|
|
@@ -1031,6 +1040,7 @@ ${input.slice(result.pos)}
|
|
|
1031
1040
|
OperatorDeclaration,
|
|
1032
1041
|
OperatorSignature,
|
|
1033
1042
|
AmpersandBlockRHS,
|
|
1043
|
+
AmpersandBlockRHSBody,
|
|
1034
1044
|
AmpersandUnaryPrefix,
|
|
1035
1045
|
ThinArrowFunction,
|
|
1036
1046
|
Arrow,
|
|
@@ -1784,7 +1794,8 @@ ${input.slice(result.pos)}
|
|
|
1784
1794
|
type: "BlockStatement",
|
|
1785
1795
|
expressions: statements,
|
|
1786
1796
|
children: [statements],
|
|
1787
|
-
bare: true
|
|
1797
|
+
bare: true,
|
|
1798
|
+
root: true
|
|
1788
1799
|
});
|
|
1789
1800
|
return $0;
|
|
1790
1801
|
});
|
|
@@ -2243,7 +2254,7 @@ ${input.slice(result.pos)}
|
|
|
2243
2254
|
return result;
|
|
2244
2255
|
}
|
|
2245
2256
|
}
|
|
2246
|
-
var ArgumentsWithTrailingMemberExpressions$0 = $TS($S(Arguments,
|
|
2257
|
+
var ArgumentsWithTrailingMemberExpressions$0 = $TS($S(Arguments, AllowedTrailingMemberExpressions), function($skip, $loc, $0, $1, $2) {
|
|
2247
2258
|
var args = $1;
|
|
2248
2259
|
var trailing = $2;
|
|
2249
2260
|
const call = {
|
|
@@ -6261,7 +6272,34 @@ ${input.slice(result.pos)}
|
|
|
6261
6272
|
return result;
|
|
6262
6273
|
}
|
|
6263
6274
|
}
|
|
6264
|
-
var AmpersandBlockRHS$0 = $TS($S(
|
|
6275
|
+
var AmpersandBlockRHS$0 = $TS($S(ForbidTrailingMemberProperty, $E(AmpersandBlockRHSBody), RestoreTrailingMemberProperty), function($skip, $loc, $0, $1, $2, $3) {
|
|
6276
|
+
if (!$2)
|
|
6277
|
+
return $skip;
|
|
6278
|
+
return $2;
|
|
6279
|
+
});
|
|
6280
|
+
function AmpersandBlockRHS(state) {
|
|
6281
|
+
let eventData;
|
|
6282
|
+
if (state.events) {
|
|
6283
|
+
const result = state.events.enter?.("AmpersandBlockRHS", state);
|
|
6284
|
+
if (result) {
|
|
6285
|
+
if (result.cache)
|
|
6286
|
+
return result.cache;
|
|
6287
|
+
eventData = result.data;
|
|
6288
|
+
}
|
|
6289
|
+
}
|
|
6290
|
+
if (state.tokenize) {
|
|
6291
|
+
const result = $TOKEN("AmpersandBlockRHS", state, AmpersandBlockRHS$0(state));
|
|
6292
|
+
if (state.events)
|
|
6293
|
+
state.events.exit?.("AmpersandBlockRHS", state, result, eventData);
|
|
6294
|
+
return result;
|
|
6295
|
+
} else {
|
|
6296
|
+
const result = AmpersandBlockRHS$0(state);
|
|
6297
|
+
if (state.events)
|
|
6298
|
+
state.events.exit?.("AmpersandBlockRHS", state, result, eventData);
|
|
6299
|
+
return result;
|
|
6300
|
+
}
|
|
6301
|
+
}
|
|
6302
|
+
var AmpersandBlockRHSBody$0 = $TS($S($E($S($N(_), $P(CallExpressionRest))), $E($S($N($EXPECT($R3, fail, "AmpersandBlockRHSBody /[&]/")), $P(BinaryOpRHS)))), function($skip, $loc, $0, $1, $2) {
|
|
6265
6303
|
var callExpRest = $1;
|
|
6266
6304
|
var binopRHS = $2;
|
|
6267
6305
|
if (!callExpRest && !binopRHS)
|
|
@@ -6288,10 +6326,10 @@ ${input.slice(result.pos)}
|
|
|
6288
6326
|
}
|
|
6289
6327
|
return exp;
|
|
6290
6328
|
});
|
|
6291
|
-
function
|
|
6329
|
+
function AmpersandBlockRHSBody(state) {
|
|
6292
6330
|
let eventData;
|
|
6293
6331
|
if (state.events) {
|
|
6294
|
-
const result = state.events.enter?.("
|
|
6332
|
+
const result = state.events.enter?.("AmpersandBlockRHSBody", state);
|
|
6295
6333
|
if (result) {
|
|
6296
6334
|
if (result.cache)
|
|
6297
6335
|
return result.cache;
|
|
@@ -6299,14 +6337,14 @@ ${input.slice(result.pos)}
|
|
|
6299
6337
|
}
|
|
6300
6338
|
}
|
|
6301
6339
|
if (state.tokenize) {
|
|
6302
|
-
const result = $TOKEN("
|
|
6340
|
+
const result = $TOKEN("AmpersandBlockRHSBody", state, AmpersandBlockRHSBody$0(state));
|
|
6303
6341
|
if (state.events)
|
|
6304
|
-
state.events.exit?.("
|
|
6342
|
+
state.events.exit?.("AmpersandBlockRHSBody", state, result, eventData);
|
|
6305
6343
|
return result;
|
|
6306
6344
|
} else {
|
|
6307
|
-
const result =
|
|
6345
|
+
const result = AmpersandBlockRHSBody$0(state);
|
|
6308
6346
|
if (state.events)
|
|
6309
|
-
state.events.exit?.("
|
|
6347
|
+
state.events.exit?.("AmpersandBlockRHSBody", state, result, eventData);
|
|
6310
6348
|
return result;
|
|
6311
6349
|
}
|
|
6312
6350
|
}
|
|
@@ -6888,17 +6926,10 @@ ${input.slice(result.pos)}
|
|
|
6888
6926
|
if (!statements.length)
|
|
6889
6927
|
return $skip;
|
|
6890
6928
|
statements = statements.flat();
|
|
6891
|
-
const first = statements[0];
|
|
6892
|
-
const ws = first[0];
|
|
6893
|
-
const indent = ws.at(-1);
|
|
6894
|
-
statements = [
|
|
6895
|
-
[indent, ...first.slice(1)],
|
|
6896
|
-
...statements.slice(1)
|
|
6897
|
-
];
|
|
6898
6929
|
return {
|
|
6899
6930
|
type: "BlockStatement",
|
|
6900
6931
|
expressions: statements,
|
|
6901
|
-
children: [
|
|
6932
|
+
children: [statements],
|
|
6902
6933
|
bare: true
|
|
6903
6934
|
};
|
|
6904
6935
|
});
|
|
@@ -10097,13 +10128,12 @@ ${input.slice(result.pos)}
|
|
|
10097
10128
|
});
|
|
10098
10129
|
var ForStatementControl$1 = $TS($S(CoffeeForLoopsEnabled, CoffeeForStatementParameters, $E(WhenCondition)), function($skip, $loc, $0, $1, $2, $3) {
|
|
10099
10130
|
if ($3) {
|
|
10100
|
-
const
|
|
10101
|
-
const block = "continue\n";
|
|
10131
|
+
const block = "continue;";
|
|
10102
10132
|
$2 = {
|
|
10103
10133
|
...$2,
|
|
10104
10134
|
blockPrefix: [
|
|
10105
10135
|
...$2.blockPrefix,
|
|
10106
|
-
[
|
|
10136
|
+
["", {
|
|
10107
10137
|
type: "IfStatement",
|
|
10108
10138
|
then: block,
|
|
10109
10139
|
children: ["if (!(", insertTrimmingSpace($3, ""), ")) ", block]
|
|
@@ -10170,7 +10200,6 @@ ${input.slice(result.pos)}
|
|
|
10170
10200
|
var step = $8;
|
|
10171
10201
|
var close = $9;
|
|
10172
10202
|
let blockPrefix = [];
|
|
10173
|
-
const indent = module2.currentIndent.token + " ";
|
|
10174
10203
|
exp = insertTrimmingSpace(exp, "");
|
|
10175
10204
|
declaration = insertTrimmingSpace(declaration, "");
|
|
10176
10205
|
if (kind.token === "from") {
|
|
@@ -10184,14 +10213,14 @@ ${input.slice(result.pos)}
|
|
|
10184
10213
|
}
|
|
10185
10214
|
if (declaration.own) {
|
|
10186
10215
|
const hasPropRef = module2.getRef("hasProp");
|
|
10187
|
-
blockPrefix.push([
|
|
10216
|
+
blockPrefix.push(["", "if (!", hasPropRef, ".call(", exp, ", ", declaration, ")) continue", ";"]);
|
|
10188
10217
|
}
|
|
10189
10218
|
if (index) {
|
|
10190
|
-
blockPrefix.push([
|
|
10219
|
+
blockPrefix.push(["", {
|
|
10191
10220
|
type: "AssignmentExpression",
|
|
10192
10221
|
children: [index, " = ", exp, "[", declaration, "]"],
|
|
10193
10222
|
names: index.names
|
|
10194
|
-
}, "
|
|
10223
|
+
}, ";"]);
|
|
10195
10224
|
}
|
|
10196
10225
|
kind.token = "in";
|
|
10197
10226
|
} else if (kind.token === "in") {
|
|
@@ -10227,11 +10256,11 @@ ${input.slice(result.pos)}
|
|
|
10227
10256
|
assignmentNames.push(...index.names);
|
|
10228
10257
|
}
|
|
10229
10258
|
const expRefDec = expRef !== exp ? [expRef, " = ", insertTrimmingSpace(exp, ""), ", "] : [];
|
|
10230
|
-
blockPrefix.push([
|
|
10259
|
+
blockPrefix.push(["", {
|
|
10231
10260
|
type: "AssignmentExpression",
|
|
10232
|
-
children: [varRef, " = ", expRef, "[", indexAssignment, counterRef, "]
|
|
10261
|
+
children: [varRef, " = ", expRef, "[", indexAssignment, counterRef, "]"],
|
|
10233
10262
|
names: assignmentNames
|
|
10234
|
-
}]);
|
|
10263
|
+
}, ";"]);
|
|
10235
10264
|
declaration = {
|
|
10236
10265
|
type: "Declaration",
|
|
10237
10266
|
children: ["let ", ...expRefDec, counterRef, " = 0, ", lenRef, " = ", expRef, ".length"],
|
|
@@ -11154,8 +11183,8 @@ ${input.slice(result.pos)}
|
|
|
11154
11183
|
const initCondition = {
|
|
11155
11184
|
type: "AssignmentExpression",
|
|
11156
11185
|
children: [ref, " ", initializer],
|
|
11157
|
-
hoistDec: [["", ["let ", ref], "
|
|
11158
|
-
blockPrefix: [["", [binding, "= ", ref], "
|
|
11186
|
+
hoistDec: [["", ["let ", ref], ";"]],
|
|
11187
|
+
blockPrefix: [["", [binding, "= ", ref], ";"]]
|
|
11159
11188
|
};
|
|
11160
11189
|
return initCondition;
|
|
11161
11190
|
});
|
|
@@ -13867,7 +13896,7 @@ ${input.slice(result.pos)}
|
|
|
13867
13896
|
}
|
|
13868
13897
|
}
|
|
13869
13898
|
var JSSingleLineComment$0 = $TR($EXPECT($R41, fail, "JSSingleLineComment /\\/\\/(?!\\/)[^\\r\\n]*/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
|
|
13870
|
-
return { $loc, token: $0 };
|
|
13899
|
+
return { type: "Comment", $loc, token: $0 };
|
|
13871
13900
|
});
|
|
13872
13901
|
function JSSingleLineComment(state) {
|
|
13873
13902
|
let eventData;
|
|
@@ -13916,7 +13945,7 @@ ${input.slice(result.pos)}
|
|
|
13916
13945
|
}
|
|
13917
13946
|
}
|
|
13918
13947
|
var JSMultiLineComment$0 = $TV($TEXT($S($EXPECT($L94, fail, 'JSMultiLineComment "/*"'), $Q($S($N($EXPECT($L95, fail, 'JSMultiLineComment "*/"')), $EXPECT($R42, fail, "JSMultiLineComment /./"))), $EXPECT($L95, fail, 'JSMultiLineComment "*/"'))), function($skip, $loc, $0, $1) {
|
|
13919
|
-
return { $loc, token: $1 };
|
|
13948
|
+
return { type: "Comment", $loc, token: $1 };
|
|
13920
13949
|
});
|
|
13921
13950
|
function JSMultiLineComment(state) {
|
|
13922
13951
|
let eventData;
|
|
@@ -13941,7 +13970,7 @@ ${input.slice(result.pos)}
|
|
|
13941
13970
|
}
|
|
13942
13971
|
}
|
|
13943
13972
|
var CoffeeSingleLineComment$0 = $TR($EXPECT($R43, fail, "CoffeeSingleLineComment /#(?!##(?!#))([^\\r\\n]*)/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
|
|
13944
|
-
return { $loc, token: `//${$1}` };
|
|
13973
|
+
return { type: "Comment", $loc, token: `//${$1}` };
|
|
13945
13974
|
});
|
|
13946
13975
|
function CoffeeSingleLineComment(state) {
|
|
13947
13976
|
let eventData;
|
|
@@ -13967,7 +13996,7 @@ ${input.slice(result.pos)}
|
|
|
13967
13996
|
}
|
|
13968
13997
|
var CoffeeMultiLineComment$0 = $TS($S(CoffeeHereCommentStart, $TEXT($EXPECT($R44, fail, "CoffeeMultiLineComment /[^]*?###/"))), function($skip, $loc, $0, $1, $2) {
|
|
13969
13998
|
$2 = $2.slice(0, $2.length - 3).replace(/\*\//g, "* /");
|
|
13970
|
-
return { $loc, token: `/*${$2}*/` };
|
|
13999
|
+
return { type: "Comment", $loc, token: `/*${$2}*/` };
|
|
13971
14000
|
});
|
|
13972
14001
|
function CoffeeMultiLineComment(state) {
|
|
13973
14002
|
let eventData;
|
|
@@ -21399,6 +21428,8 @@ ${input.slice(result.pos)}
|
|
|
21399
21428
|
exp.blocks.forEach((block) => insertPush(block, ref));
|
|
21400
21429
|
return;
|
|
21401
21430
|
}
|
|
21431
|
+
if (node[node.length - 1]?.type === "SemicolonDelimiter")
|
|
21432
|
+
return;
|
|
21402
21433
|
node.splice(1, 0, ref, ".push(");
|
|
21403
21434
|
node.push(")");
|
|
21404
21435
|
}
|
|
@@ -21477,7 +21508,10 @@ ${input.slice(result.pos)}
|
|
|
21477
21508
|
if (exp.else)
|
|
21478
21509
|
insertReturn(exp.else[2]);
|
|
21479
21510
|
else
|
|
21480
|
-
exp.children.push(["
|
|
21511
|
+
exp.children.push(["", {
|
|
21512
|
+
type: "ReturnStatement",
|
|
21513
|
+
children: [";return"]
|
|
21514
|
+
}]);
|
|
21481
21515
|
return;
|
|
21482
21516
|
case "PatternMatchingStatement":
|
|
21483
21517
|
insertReturn(exp.children[0][0]);
|
|
@@ -21886,11 +21920,15 @@ ${input.slice(result.pos)}
|
|
|
21886
21920
|
const [splices, thisAssignments] = gatherBindingCode(parameters, {
|
|
21887
21921
|
injectParamProps: f.name === "constructor"
|
|
21888
21922
|
});
|
|
21923
|
+
const delimiter = {
|
|
21924
|
+
type: "SemicolonDelimiter",
|
|
21925
|
+
children: [";"]
|
|
21926
|
+
};
|
|
21889
21927
|
const prefix = splices.map((s) => ["let ", s]).concat(thisAssignments).map(
|
|
21890
21928
|
(s) => s.type ? {
|
|
21891
21929
|
...s,
|
|
21892
|
-
children: [indent, ...s.children,
|
|
21893
|
-
} : [indent, s,
|
|
21930
|
+
children: [indent, ...s.children, delimiter]
|
|
21931
|
+
} : [indent, s, delimiter]
|
|
21894
21932
|
);
|
|
21895
21933
|
expressions.unshift(...prefix);
|
|
21896
21934
|
}
|
|
@@ -21949,9 +21987,10 @@ ${input.slice(result.pos)}
|
|
|
21949
21987
|
getIndent(block.expressions[0]),
|
|
21950
21988
|
{
|
|
21951
21989
|
type: "Declaration",
|
|
21952
|
-
children: ["let ", ref, returnType
|
|
21990
|
+
children: ["let ", ref, returnType],
|
|
21953
21991
|
names: []
|
|
21954
|
-
}
|
|
21992
|
+
},
|
|
21993
|
+
";"
|
|
21955
21994
|
]);
|
|
21956
21995
|
}
|
|
21957
21996
|
gatherRecursiveWithinFunction(
|
|
@@ -21963,7 +22002,7 @@ ${input.slice(result.pos)}
|
|
|
21963
22002
|
});
|
|
21964
22003
|
if (block.children.at(-2)?.type !== "ReturnStatement") {
|
|
21965
22004
|
block.expressions.push([
|
|
21966
|
-
[
|
|
22005
|
+
[getIndent(block.expressions.at(-1))],
|
|
21967
22006
|
{
|
|
21968
22007
|
type: "ReturnStatement",
|
|
21969
22008
|
expression: ref,
|
|
@@ -22447,11 +22486,11 @@ ${input.slice(result.pos)}
|
|
|
22447
22486
|
let [splices, thisAssignments] = gatherBindingCode(pattern);
|
|
22448
22487
|
const patternBindings = nonMatcherBindings(pattern);
|
|
22449
22488
|
splices = splices.map((s2) => [", ", nonMatcherBindings(s2)]);
|
|
22450
|
-
thisAssignments = thisAssignments.map((a) => [indent, a, "
|
|
22489
|
+
thisAssignments = thisAssignments.map((a) => [indent, a, ";"]);
|
|
22451
22490
|
const duplicateDeclarations = aggregateDuplicateBindings([patternBindings, splices]);
|
|
22452
|
-
prefix.push([indent, "const ", patternBindings, " = ", ref, splices, "
|
|
22491
|
+
prefix.push([indent, "const ", patternBindings, " = ", ref, splices, ";"]);
|
|
22453
22492
|
prefix.push(...thisAssignments);
|
|
22454
|
-
prefix.push(...duplicateDeclarations.map((d) => [indent, d, "
|
|
22493
|
+
prefix.push(...duplicateDeclarations.map((d) => [indent, d, ";"]));
|
|
22455
22494
|
break;
|
|
22456
22495
|
}
|
|
22457
22496
|
}
|
|
@@ -22606,6 +22645,11 @@ ${input.slice(result.pos)}
|
|
|
22606
22645
|
});
|
|
22607
22646
|
}
|
|
22608
22647
|
module2.processProgram = function(root) {
|
|
22648
|
+
assert.equal(module2.forbidClassImplicitCall.length, 1, "forbidClassImplicitCall");
|
|
22649
|
+
assert.equal(module2.forbidIndentedApplication.length, 1, "forbidIndentedApplication");
|
|
22650
|
+
assert.equal(module2.forbidTrailingMemberProperty.length, 1, "forbidTrailingMemberProperty");
|
|
22651
|
+
assert.equal(module2.forbidMultiLineImplicitObjectLiteral.length, 1, "forbidMultiLineImplicitObjectLiteral");
|
|
22652
|
+
assert.equal(module2.JSXTagStack.length, 0, "JSXTagStack should be empty");
|
|
22609
22653
|
addParentPointers(root);
|
|
22610
22654
|
const { expressions: statements } = root;
|
|
22611
22655
|
processPipelineExpressions(statements);
|
|
@@ -22699,7 +22743,11 @@ ${input.slice(result.pos)}
|
|
|
22699
22743
|
});
|
|
22700
22744
|
if (varIds.length) {
|
|
22701
22745
|
const indent = getIndent(statements[0]);
|
|
22702
|
-
|
|
22746
|
+
let delimiter = ";";
|
|
22747
|
+
if (statements[0][1]?.parent?.root) {
|
|
22748
|
+
delimiter = ";\n";
|
|
22749
|
+
}
|
|
22750
|
+
statements.unshift([indent, "var ", varIds.join(", "), delimiter]);
|
|
22703
22751
|
}
|
|
22704
22752
|
scopes.pop();
|
|
22705
22753
|
}
|
|
@@ -23140,6 +23188,13 @@ ${input.slice(result.pos)}
|
|
|
23140
23188
|
quoteString,
|
|
23141
23189
|
removeParentPointers
|
|
23142
23190
|
} = require_lib();
|
|
23191
|
+
var assert = {
|
|
23192
|
+
equal(a, b, msg) {
|
|
23193
|
+
if (a !== b) {
|
|
23194
|
+
throw new Error(`Assertion failed [${msg}]: ${a} !== ${b}`);
|
|
23195
|
+
}
|
|
23196
|
+
}
|
|
23197
|
+
};
|
|
23143
23198
|
}
|
|
23144
23199
|
});
|
|
23145
23200
|
|
|
@@ -23577,7 +23632,7 @@ var parse;
|
|
|
23577
23632
|
var uncacheable;
|
|
23578
23633
|
({ parse } = import_parser.default);
|
|
23579
23634
|
({ SourceMap: SourceMap2, base64Encode: base64Encode2 } = util_exports);
|
|
23580
|
-
uncacheable = /* @__PURE__ */ new Set(["ActualAssignment", "AllowAll", "AllowClassImplicitCall", "AllowIndentedApplication", "AllowTrailingMemberProperty", "AllowedTrailingMemberExpressions", "ApplicationStart", "Arguments", "ArgumentsWithTrailingMemberExpressions", "ArrowFunction", "ArrowFunctionTail", "AssignmentExpression", "AssignmentExpressionTail", "BinaryOpExpression", "BinaryOpRHS", "BracedBlock", "BracedObjectLiteralContent", "BracedOrEmptyBlock", "CallExpression", "CallExpressionRest", "ClassImplicitCallForbidden", "CoffeeCommentEnabled", "CommaDelimiter", "ConditionalExpression", "Declaration", "Debugger", "ElementListWithIndentedApplicationForbidden", "ElseClause", "Expression", "ExpressionStatement", "ExpressionWithIndentedApplicationForbidden", "ExtendedExpression", "FatArrowBody", "ForbidClassImplicitCall", "ForbidIndentedApplication", "ForbidTrailingMemberProperty", "FunctionDeclaration", "FunctionExpression", "HoistableDeclaration", "ImplicitArguments", "ImplicitInlineObjectPropertyDelimiter", "ImplicitNestedBlock", "IndentedApplicationAllowed", "IndentedFurther", "IndentedJSXChildExpression", "InlineObjectLiteral", "InsertIndent", "JSXChild", "JSXChildren", "JSXElement", "JSXFragment", "JSXImplicitFragment", "JSXMixedChildren", "JSXNested", "JSXNestedChildren", "JSXOptionalClosingElement", "JSXOptionalClosingFragment", "JSXTag", "LeftHandSideExpression", "MemberExpression", "MemberExpressionRest", "Nested", "NestedBindingElement", "NestedBindingElements", "NestedBlockExpression", "NestedBlockExpression", "NestedBlockStatement", "NestedBlockStatements", "NestedClassSignatureElement", "NestedClassSignatureElements", "NestedDeclareElement", "NestedDeclareElements", "NestedElement", "NestedElementList", "NestedImplicitObjectLiteral", "NestedImplicitPropertyDefinition", "NestedImplicitPropertyDefinitions", "NestedInterfaceProperty", "NestedJSXChildExpression", "NestedModuleItem", "NestedModuleItems", "NestedObject", "NestedPropertyDefinitions", "NonSingleBracedBlock", "NotDedented", "ObjectLiteral", "PopIndent", "PopJSXStack", "PostfixedExpression", "PostfixedStatement", "PrimaryExpression", "PushIndent", "PushJSXOpeningElement", "PushJSXOpeningFragment", "RestoreAll", "RestoreClassImplicitCall", "RestoreIndentedApplication", "RestoreTrailingMemberProperty", "RHS", "Samedent", "ShortCircuitExpression", "SingleLineAssignmentExpression", "SingleLineComment", "SingleLineStatements", "SnugNamedProperty", "Statement", "StatementListItem", "SuffixedExpression", "SuffixedStatement", "ThinArrowFunction", "TrackIndented", "TrailingMemberExpressions", "TrailingMemberPropertyAllowed", "TypedJSXElement", "TypedJSXFragment", "UnaryExpression", "UpdateExpression"]);
|
|
23635
|
+
uncacheable = /* @__PURE__ */ new Set(["ActualAssignment", "AllowAll", "AllowClassImplicitCall", "AllowIndentedApplication", "AllowMultiLineImplicitObjectLiteral", "AllowTrailingMemberProperty", "AllowedTrailingMemberExpressions", "ApplicationStart", "Arguments", "ArgumentsWithTrailingMemberExpressions", "ArrowFunction", "ArrowFunctionTail", "AssignmentExpression", "AssignmentExpressionTail", "BinaryOpExpression", "BinaryOpRHS", "BracedBlock", "BracedObjectLiteralContent", "BracedOrEmptyBlock", "CallExpression", "CallExpressionRest", "ClassImplicitCallForbidden", "CoffeeCommentEnabled", "CommaDelimiter", "ConditionalExpression", "Declaration", "Debugger", "ElementListWithIndentedApplicationForbidden", "ElseClause", "Expression", "ExpressionStatement", "ExpressionWithIndentedApplicationForbidden", "ExtendedExpression", "FatArrowBody", "ForbidClassImplicitCall", "ForbidIndentedApplication", "ForbidMultiLineImplicitObjectLiteral", "ForbidTrailingMemberProperty", "FunctionDeclaration", "FunctionExpression", "HoistableDeclaration", "ImplicitArguments", "ImplicitInlineObjectPropertyDelimiter", "ImplicitNestedBlock", "IndentedApplicationAllowed", "IndentedFurther", "IndentedJSXChildExpression", "InlineObjectLiteral", "InsertIndent", "JSXChild", "JSXChildren", "JSXElement", "JSXFragment", "JSXImplicitFragment", "JSXMixedChildren", "JSXNested", "JSXNestedChildren", "JSXOptionalClosingElement", "JSXOptionalClosingFragment", "JSXTag", "LeftHandSideExpression", "MemberExpression", "MemberExpressionRest", "Nested", "NestedBindingElement", "NestedBindingElements", "NestedBlockExpression", "NestedBlockExpression", "NestedBlockStatement", "NestedBlockStatements", "NestedClassSignatureElement", "NestedClassSignatureElements", "NestedDeclareElement", "NestedDeclareElements", "NestedElement", "NestedElementList", "NestedImplicitObjectLiteral", "NestedImplicitPropertyDefinition", "NestedImplicitPropertyDefinitions", "NestedInterfaceProperty", "NestedJSXChildExpression", "NestedModuleItem", "NestedModuleItems", "NestedObject", "NestedPropertyDefinitions", "NonSingleBracedBlock", "NotDedented", "ObjectLiteral", "PopIndent", "PopJSXStack", "PostfixedExpression", "PostfixedStatement", "PrimaryExpression", "PushIndent", "PushJSXOpeningElement", "PushJSXOpeningFragment", "RestoreAll", "RestoreClassImplicitCall", "RestoreMultiLineImplicitObjectLiteral", "RestoreIndentedApplication", "RestoreTrailingMemberProperty", "RHS", "Samedent", "ShortCircuitExpression", "SingleLineAssignmentExpression", "SingleLineComment", "SingleLineStatements", "SnugNamedProperty", "Statement", "StatementListItem", "SuffixedExpression", "SuffixedStatement", "ThinArrowFunction", "TrackIndented", "TrailingMemberExpressions", "TrailingMemberPropertyAllowed", "TypedJSXElement", "TypedJSXFragment", "UnaryExpression", "UpdateExpression"]);
|
|
23581
23636
|
var compile = function(src, options) {
|
|
23582
23637
|
var ast, code, events, filename, ref, result, sm, srcMapJSON;
|
|
23583
23638
|
if (!options) {
|
package/dist/main.mjs
CHANGED
|
@@ -41,7 +41,7 @@ var require_lib = __commonJS({
|
|
|
41
41
|
children: block.children === block.expressions ? expressions : block.children.map((c) => c === block.expressions ? expressions : c)
|
|
42
42
|
};
|
|
43
43
|
if (block.bare) {
|
|
44
|
-
block.children = [[" {
|
|
44
|
+
block.children = [[" {"], ...block.children, "}"];
|
|
45
45
|
block.bare = false;
|
|
46
46
|
}
|
|
47
47
|
}
|
|
@@ -149,8 +149,16 @@ var require_lib = __commonJS({
|
|
|
149
149
|
}
|
|
150
150
|
function getIndent(statement) {
|
|
151
151
|
let indent = statement?.[0];
|
|
152
|
-
if (Array.isArray(indent))
|
|
153
|
-
indent = indent
|
|
152
|
+
if (Array.isArray(indent)) {
|
|
153
|
+
indent = indent.flat(Infinity);
|
|
154
|
+
return indent.filter((n) => n && !(n.type === "Comment")).map((n) => {
|
|
155
|
+
if (typeof n === "string")
|
|
156
|
+
return n;
|
|
157
|
+
if (n.token != null)
|
|
158
|
+
return n.token;
|
|
159
|
+
return "";
|
|
160
|
+
});
|
|
161
|
+
}
|
|
154
162
|
return indent;
|
|
155
163
|
}
|
|
156
164
|
function hasAwait(exp) {
|
|
@@ -172,10 +180,11 @@ var require_lib = __commonJS({
|
|
|
172
180
|
}
|
|
173
181
|
const block = outer.parent;
|
|
174
182
|
const { expressions } = block;
|
|
175
|
-
const index = expressions.
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
183
|
+
const index = expressions.findIndex(([, s]) => outer === s);
|
|
184
|
+
if (index < 0)
|
|
185
|
+
throw new Error("Couldn't find expression in block for hoistable declaration.");
|
|
186
|
+
const indent = expressions[index][0];
|
|
187
|
+
hoistDec[0][0] = indent;
|
|
179
188
|
expressions.splice(index, 0, hoistDec);
|
|
180
189
|
node.hoistDec = null;
|
|
181
190
|
});
|
|
@@ -315,7 +324,7 @@ var require_lib = __commonJS({
|
|
|
315
324
|
varLet = [",", ...varName, " = ", counterRef];
|
|
316
325
|
} else {
|
|
317
326
|
blockPrefix = [
|
|
318
|
-
["", forDeclaration, " = ", counterRef, "
|
|
327
|
+
["", forDeclaration, " = ", counterRef, ";"]
|
|
319
328
|
];
|
|
320
329
|
}
|
|
321
330
|
} else if (forDeclaration) {
|
|
@@ -1029,6 +1038,7 @@ ${input.slice(result.pos)}
|
|
|
1029
1038
|
OperatorDeclaration,
|
|
1030
1039
|
OperatorSignature,
|
|
1031
1040
|
AmpersandBlockRHS,
|
|
1041
|
+
AmpersandBlockRHSBody,
|
|
1032
1042
|
AmpersandUnaryPrefix,
|
|
1033
1043
|
ThinArrowFunction,
|
|
1034
1044
|
Arrow,
|
|
@@ -1782,7 +1792,8 @@ ${input.slice(result.pos)}
|
|
|
1782
1792
|
type: "BlockStatement",
|
|
1783
1793
|
expressions: statements,
|
|
1784
1794
|
children: [statements],
|
|
1785
|
-
bare: true
|
|
1795
|
+
bare: true,
|
|
1796
|
+
root: true
|
|
1786
1797
|
});
|
|
1787
1798
|
return $0;
|
|
1788
1799
|
});
|
|
@@ -2241,7 +2252,7 @@ ${input.slice(result.pos)}
|
|
|
2241
2252
|
return result;
|
|
2242
2253
|
}
|
|
2243
2254
|
}
|
|
2244
|
-
var ArgumentsWithTrailingMemberExpressions$0 = $TS($S(Arguments,
|
|
2255
|
+
var ArgumentsWithTrailingMemberExpressions$0 = $TS($S(Arguments, AllowedTrailingMemberExpressions), function($skip, $loc, $0, $1, $2) {
|
|
2245
2256
|
var args = $1;
|
|
2246
2257
|
var trailing = $2;
|
|
2247
2258
|
const call = {
|
|
@@ -6259,7 +6270,34 @@ ${input.slice(result.pos)}
|
|
|
6259
6270
|
return result;
|
|
6260
6271
|
}
|
|
6261
6272
|
}
|
|
6262
|
-
var AmpersandBlockRHS$0 = $TS($S(
|
|
6273
|
+
var AmpersandBlockRHS$0 = $TS($S(ForbidTrailingMemberProperty, $E(AmpersandBlockRHSBody), RestoreTrailingMemberProperty), function($skip, $loc, $0, $1, $2, $3) {
|
|
6274
|
+
if (!$2)
|
|
6275
|
+
return $skip;
|
|
6276
|
+
return $2;
|
|
6277
|
+
});
|
|
6278
|
+
function AmpersandBlockRHS(state) {
|
|
6279
|
+
let eventData;
|
|
6280
|
+
if (state.events) {
|
|
6281
|
+
const result = state.events.enter?.("AmpersandBlockRHS", state);
|
|
6282
|
+
if (result) {
|
|
6283
|
+
if (result.cache)
|
|
6284
|
+
return result.cache;
|
|
6285
|
+
eventData = result.data;
|
|
6286
|
+
}
|
|
6287
|
+
}
|
|
6288
|
+
if (state.tokenize) {
|
|
6289
|
+
const result = $TOKEN("AmpersandBlockRHS", state, AmpersandBlockRHS$0(state));
|
|
6290
|
+
if (state.events)
|
|
6291
|
+
state.events.exit?.("AmpersandBlockRHS", state, result, eventData);
|
|
6292
|
+
return result;
|
|
6293
|
+
} else {
|
|
6294
|
+
const result = AmpersandBlockRHS$0(state);
|
|
6295
|
+
if (state.events)
|
|
6296
|
+
state.events.exit?.("AmpersandBlockRHS", state, result, eventData);
|
|
6297
|
+
return result;
|
|
6298
|
+
}
|
|
6299
|
+
}
|
|
6300
|
+
var AmpersandBlockRHSBody$0 = $TS($S($E($S($N(_), $P(CallExpressionRest))), $E($S($N($EXPECT($R3, fail, "AmpersandBlockRHSBody /[&]/")), $P(BinaryOpRHS)))), function($skip, $loc, $0, $1, $2) {
|
|
6263
6301
|
var callExpRest = $1;
|
|
6264
6302
|
var binopRHS = $2;
|
|
6265
6303
|
if (!callExpRest && !binopRHS)
|
|
@@ -6286,10 +6324,10 @@ ${input.slice(result.pos)}
|
|
|
6286
6324
|
}
|
|
6287
6325
|
return exp;
|
|
6288
6326
|
});
|
|
6289
|
-
function
|
|
6327
|
+
function AmpersandBlockRHSBody(state) {
|
|
6290
6328
|
let eventData;
|
|
6291
6329
|
if (state.events) {
|
|
6292
|
-
const result = state.events.enter?.("
|
|
6330
|
+
const result = state.events.enter?.("AmpersandBlockRHSBody", state);
|
|
6293
6331
|
if (result) {
|
|
6294
6332
|
if (result.cache)
|
|
6295
6333
|
return result.cache;
|
|
@@ -6297,14 +6335,14 @@ ${input.slice(result.pos)}
|
|
|
6297
6335
|
}
|
|
6298
6336
|
}
|
|
6299
6337
|
if (state.tokenize) {
|
|
6300
|
-
const result = $TOKEN("
|
|
6338
|
+
const result = $TOKEN("AmpersandBlockRHSBody", state, AmpersandBlockRHSBody$0(state));
|
|
6301
6339
|
if (state.events)
|
|
6302
|
-
state.events.exit?.("
|
|
6340
|
+
state.events.exit?.("AmpersandBlockRHSBody", state, result, eventData);
|
|
6303
6341
|
return result;
|
|
6304
6342
|
} else {
|
|
6305
|
-
const result =
|
|
6343
|
+
const result = AmpersandBlockRHSBody$0(state);
|
|
6306
6344
|
if (state.events)
|
|
6307
|
-
state.events.exit?.("
|
|
6345
|
+
state.events.exit?.("AmpersandBlockRHSBody", state, result, eventData);
|
|
6308
6346
|
return result;
|
|
6309
6347
|
}
|
|
6310
6348
|
}
|
|
@@ -6886,17 +6924,10 @@ ${input.slice(result.pos)}
|
|
|
6886
6924
|
if (!statements.length)
|
|
6887
6925
|
return $skip;
|
|
6888
6926
|
statements = statements.flat();
|
|
6889
|
-
const first = statements[0];
|
|
6890
|
-
const ws = first[0];
|
|
6891
|
-
const indent = ws.at(-1);
|
|
6892
|
-
statements = [
|
|
6893
|
-
[indent, ...first.slice(1)],
|
|
6894
|
-
...statements.slice(1)
|
|
6895
|
-
];
|
|
6896
6927
|
return {
|
|
6897
6928
|
type: "BlockStatement",
|
|
6898
6929
|
expressions: statements,
|
|
6899
|
-
children: [
|
|
6930
|
+
children: [statements],
|
|
6900
6931
|
bare: true
|
|
6901
6932
|
};
|
|
6902
6933
|
});
|
|
@@ -10095,13 +10126,12 @@ ${input.slice(result.pos)}
|
|
|
10095
10126
|
});
|
|
10096
10127
|
var ForStatementControl$1 = $TS($S(CoffeeForLoopsEnabled, CoffeeForStatementParameters, $E(WhenCondition)), function($skip, $loc, $0, $1, $2, $3) {
|
|
10097
10128
|
if ($3) {
|
|
10098
|
-
const
|
|
10099
|
-
const block = "continue\n";
|
|
10129
|
+
const block = "continue;";
|
|
10100
10130
|
$2 = {
|
|
10101
10131
|
...$2,
|
|
10102
10132
|
blockPrefix: [
|
|
10103
10133
|
...$2.blockPrefix,
|
|
10104
|
-
[
|
|
10134
|
+
["", {
|
|
10105
10135
|
type: "IfStatement",
|
|
10106
10136
|
then: block,
|
|
10107
10137
|
children: ["if (!(", insertTrimmingSpace($3, ""), ")) ", block]
|
|
@@ -10168,7 +10198,6 @@ ${input.slice(result.pos)}
|
|
|
10168
10198
|
var step = $8;
|
|
10169
10199
|
var close = $9;
|
|
10170
10200
|
let blockPrefix = [];
|
|
10171
|
-
const indent = module.currentIndent.token + " ";
|
|
10172
10201
|
exp = insertTrimmingSpace(exp, "");
|
|
10173
10202
|
declaration = insertTrimmingSpace(declaration, "");
|
|
10174
10203
|
if (kind.token === "from") {
|
|
@@ -10182,14 +10211,14 @@ ${input.slice(result.pos)}
|
|
|
10182
10211
|
}
|
|
10183
10212
|
if (declaration.own) {
|
|
10184
10213
|
const hasPropRef = module.getRef("hasProp");
|
|
10185
|
-
blockPrefix.push([
|
|
10214
|
+
blockPrefix.push(["", "if (!", hasPropRef, ".call(", exp, ", ", declaration, ")) continue", ";"]);
|
|
10186
10215
|
}
|
|
10187
10216
|
if (index) {
|
|
10188
|
-
blockPrefix.push([
|
|
10217
|
+
blockPrefix.push(["", {
|
|
10189
10218
|
type: "AssignmentExpression",
|
|
10190
10219
|
children: [index, " = ", exp, "[", declaration, "]"],
|
|
10191
10220
|
names: index.names
|
|
10192
|
-
}, "
|
|
10221
|
+
}, ";"]);
|
|
10193
10222
|
}
|
|
10194
10223
|
kind.token = "in";
|
|
10195
10224
|
} else if (kind.token === "in") {
|
|
@@ -10225,11 +10254,11 @@ ${input.slice(result.pos)}
|
|
|
10225
10254
|
assignmentNames.push(...index.names);
|
|
10226
10255
|
}
|
|
10227
10256
|
const expRefDec = expRef !== exp ? [expRef, " = ", insertTrimmingSpace(exp, ""), ", "] : [];
|
|
10228
|
-
blockPrefix.push([
|
|
10257
|
+
blockPrefix.push(["", {
|
|
10229
10258
|
type: "AssignmentExpression",
|
|
10230
|
-
children: [varRef, " = ", expRef, "[", indexAssignment, counterRef, "]
|
|
10259
|
+
children: [varRef, " = ", expRef, "[", indexAssignment, counterRef, "]"],
|
|
10231
10260
|
names: assignmentNames
|
|
10232
|
-
}]);
|
|
10261
|
+
}, ";"]);
|
|
10233
10262
|
declaration = {
|
|
10234
10263
|
type: "Declaration",
|
|
10235
10264
|
children: ["let ", ...expRefDec, counterRef, " = 0, ", lenRef, " = ", expRef, ".length"],
|
|
@@ -11152,8 +11181,8 @@ ${input.slice(result.pos)}
|
|
|
11152
11181
|
const initCondition = {
|
|
11153
11182
|
type: "AssignmentExpression",
|
|
11154
11183
|
children: [ref, " ", initializer],
|
|
11155
|
-
hoistDec: [["", ["let ", ref], "
|
|
11156
|
-
blockPrefix: [["", [binding, "= ", ref], "
|
|
11184
|
+
hoistDec: [["", ["let ", ref], ";"]],
|
|
11185
|
+
blockPrefix: [["", [binding, "= ", ref], ";"]]
|
|
11157
11186
|
};
|
|
11158
11187
|
return initCondition;
|
|
11159
11188
|
});
|
|
@@ -13865,7 +13894,7 @@ ${input.slice(result.pos)}
|
|
|
13865
13894
|
}
|
|
13866
13895
|
}
|
|
13867
13896
|
var JSSingleLineComment$0 = $TR($EXPECT($R41, fail, "JSSingleLineComment /\\/\\/(?!\\/)[^\\r\\n]*/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
|
|
13868
|
-
return { $loc, token: $0 };
|
|
13897
|
+
return { type: "Comment", $loc, token: $0 };
|
|
13869
13898
|
});
|
|
13870
13899
|
function JSSingleLineComment(state) {
|
|
13871
13900
|
let eventData;
|
|
@@ -13914,7 +13943,7 @@ ${input.slice(result.pos)}
|
|
|
13914
13943
|
}
|
|
13915
13944
|
}
|
|
13916
13945
|
var JSMultiLineComment$0 = $TV($TEXT($S($EXPECT($L94, fail, 'JSMultiLineComment "/*"'), $Q($S($N($EXPECT($L95, fail, 'JSMultiLineComment "*/"')), $EXPECT($R42, fail, "JSMultiLineComment /./"))), $EXPECT($L95, fail, 'JSMultiLineComment "*/"'))), function($skip, $loc, $0, $1) {
|
|
13917
|
-
return { $loc, token: $1 };
|
|
13946
|
+
return { type: "Comment", $loc, token: $1 };
|
|
13918
13947
|
});
|
|
13919
13948
|
function JSMultiLineComment(state) {
|
|
13920
13949
|
let eventData;
|
|
@@ -13939,7 +13968,7 @@ ${input.slice(result.pos)}
|
|
|
13939
13968
|
}
|
|
13940
13969
|
}
|
|
13941
13970
|
var CoffeeSingleLineComment$0 = $TR($EXPECT($R43, fail, "CoffeeSingleLineComment /#(?!##(?!#))([^\\r\\n]*)/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
|
|
13942
|
-
return { $loc, token: `//${$1}` };
|
|
13971
|
+
return { type: "Comment", $loc, token: `//${$1}` };
|
|
13943
13972
|
});
|
|
13944
13973
|
function CoffeeSingleLineComment(state) {
|
|
13945
13974
|
let eventData;
|
|
@@ -13965,7 +13994,7 @@ ${input.slice(result.pos)}
|
|
|
13965
13994
|
}
|
|
13966
13995
|
var CoffeeMultiLineComment$0 = $TS($S(CoffeeHereCommentStart, $TEXT($EXPECT($R44, fail, "CoffeeMultiLineComment /[^]*?###/"))), function($skip, $loc, $0, $1, $2) {
|
|
13967
13996
|
$2 = $2.slice(0, $2.length - 3).replace(/\*\//g, "* /");
|
|
13968
|
-
return { $loc, token: `/*${$2}*/` };
|
|
13997
|
+
return { type: "Comment", $loc, token: `/*${$2}*/` };
|
|
13969
13998
|
});
|
|
13970
13999
|
function CoffeeMultiLineComment(state) {
|
|
13971
14000
|
let eventData;
|
|
@@ -21397,6 +21426,8 @@ ${input.slice(result.pos)}
|
|
|
21397
21426
|
exp.blocks.forEach((block) => insertPush(block, ref));
|
|
21398
21427
|
return;
|
|
21399
21428
|
}
|
|
21429
|
+
if (node[node.length - 1]?.type === "SemicolonDelimiter")
|
|
21430
|
+
return;
|
|
21400
21431
|
node.splice(1, 0, ref, ".push(");
|
|
21401
21432
|
node.push(")");
|
|
21402
21433
|
}
|
|
@@ -21475,7 +21506,10 @@ ${input.slice(result.pos)}
|
|
|
21475
21506
|
if (exp.else)
|
|
21476
21507
|
insertReturn(exp.else[2]);
|
|
21477
21508
|
else
|
|
21478
|
-
exp.children.push(["
|
|
21509
|
+
exp.children.push(["", {
|
|
21510
|
+
type: "ReturnStatement",
|
|
21511
|
+
children: [";return"]
|
|
21512
|
+
}]);
|
|
21479
21513
|
return;
|
|
21480
21514
|
case "PatternMatchingStatement":
|
|
21481
21515
|
insertReturn(exp.children[0][0]);
|
|
@@ -21884,11 +21918,15 @@ ${input.slice(result.pos)}
|
|
|
21884
21918
|
const [splices, thisAssignments] = gatherBindingCode(parameters, {
|
|
21885
21919
|
injectParamProps: f.name === "constructor"
|
|
21886
21920
|
});
|
|
21921
|
+
const delimiter = {
|
|
21922
|
+
type: "SemicolonDelimiter",
|
|
21923
|
+
children: [";"]
|
|
21924
|
+
};
|
|
21887
21925
|
const prefix = splices.map((s) => ["let ", s]).concat(thisAssignments).map(
|
|
21888
21926
|
(s) => s.type ? {
|
|
21889
21927
|
...s,
|
|
21890
|
-
children: [indent, ...s.children,
|
|
21891
|
-
} : [indent, s,
|
|
21928
|
+
children: [indent, ...s.children, delimiter]
|
|
21929
|
+
} : [indent, s, delimiter]
|
|
21892
21930
|
);
|
|
21893
21931
|
expressions.unshift(...prefix);
|
|
21894
21932
|
}
|
|
@@ -21947,9 +21985,10 @@ ${input.slice(result.pos)}
|
|
|
21947
21985
|
getIndent(block.expressions[0]),
|
|
21948
21986
|
{
|
|
21949
21987
|
type: "Declaration",
|
|
21950
|
-
children: ["let ", ref, returnType
|
|
21988
|
+
children: ["let ", ref, returnType],
|
|
21951
21989
|
names: []
|
|
21952
|
-
}
|
|
21990
|
+
},
|
|
21991
|
+
";"
|
|
21953
21992
|
]);
|
|
21954
21993
|
}
|
|
21955
21994
|
gatherRecursiveWithinFunction(
|
|
@@ -21961,7 +22000,7 @@ ${input.slice(result.pos)}
|
|
|
21961
22000
|
});
|
|
21962
22001
|
if (block.children.at(-2)?.type !== "ReturnStatement") {
|
|
21963
22002
|
block.expressions.push([
|
|
21964
|
-
[
|
|
22003
|
+
[getIndent(block.expressions.at(-1))],
|
|
21965
22004
|
{
|
|
21966
22005
|
type: "ReturnStatement",
|
|
21967
22006
|
expression: ref,
|
|
@@ -22445,11 +22484,11 @@ ${input.slice(result.pos)}
|
|
|
22445
22484
|
let [splices, thisAssignments] = gatherBindingCode(pattern);
|
|
22446
22485
|
const patternBindings = nonMatcherBindings(pattern);
|
|
22447
22486
|
splices = splices.map((s2) => [", ", nonMatcherBindings(s2)]);
|
|
22448
|
-
thisAssignments = thisAssignments.map((a) => [indent, a, "
|
|
22487
|
+
thisAssignments = thisAssignments.map((a) => [indent, a, ";"]);
|
|
22449
22488
|
const duplicateDeclarations = aggregateDuplicateBindings([patternBindings, splices]);
|
|
22450
|
-
prefix.push([indent, "const ", patternBindings, " = ", ref, splices, "
|
|
22489
|
+
prefix.push([indent, "const ", patternBindings, " = ", ref, splices, ";"]);
|
|
22451
22490
|
prefix.push(...thisAssignments);
|
|
22452
|
-
prefix.push(...duplicateDeclarations.map((d) => [indent, d, "
|
|
22491
|
+
prefix.push(...duplicateDeclarations.map((d) => [indent, d, ";"]));
|
|
22453
22492
|
break;
|
|
22454
22493
|
}
|
|
22455
22494
|
}
|
|
@@ -22604,6 +22643,11 @@ ${input.slice(result.pos)}
|
|
|
22604
22643
|
});
|
|
22605
22644
|
}
|
|
22606
22645
|
module.processProgram = function(root) {
|
|
22646
|
+
assert.equal(module.forbidClassImplicitCall.length, 1, "forbidClassImplicitCall");
|
|
22647
|
+
assert.equal(module.forbidIndentedApplication.length, 1, "forbidIndentedApplication");
|
|
22648
|
+
assert.equal(module.forbidTrailingMemberProperty.length, 1, "forbidTrailingMemberProperty");
|
|
22649
|
+
assert.equal(module.forbidMultiLineImplicitObjectLiteral.length, 1, "forbidMultiLineImplicitObjectLiteral");
|
|
22650
|
+
assert.equal(module.JSXTagStack.length, 0, "JSXTagStack should be empty");
|
|
22607
22651
|
addParentPointers(root);
|
|
22608
22652
|
const { expressions: statements } = root;
|
|
22609
22653
|
processPipelineExpressions(statements);
|
|
@@ -22697,7 +22741,11 @@ ${input.slice(result.pos)}
|
|
|
22697
22741
|
});
|
|
22698
22742
|
if (varIds.length) {
|
|
22699
22743
|
const indent = getIndent(statements[0]);
|
|
22700
|
-
|
|
22744
|
+
let delimiter = ";";
|
|
22745
|
+
if (statements[0][1]?.parent?.root) {
|
|
22746
|
+
delimiter = ";\n";
|
|
22747
|
+
}
|
|
22748
|
+
statements.unshift([indent, "var ", varIds.join(", "), delimiter]);
|
|
22701
22749
|
}
|
|
22702
22750
|
scopes.pop();
|
|
22703
22751
|
}
|
|
@@ -23138,6 +23186,13 @@ ${input.slice(result.pos)}
|
|
|
23138
23186
|
quoteString,
|
|
23139
23187
|
removeParentPointers
|
|
23140
23188
|
} = require_lib();
|
|
23189
|
+
var assert = {
|
|
23190
|
+
equal(a, b, msg) {
|
|
23191
|
+
if (a !== b) {
|
|
23192
|
+
throw new Error(`Assertion failed [${msg}]: ${a} !== ${b}`);
|
|
23193
|
+
}
|
|
23194
|
+
}
|
|
23195
|
+
};
|
|
23141
23196
|
}
|
|
23142
23197
|
});
|
|
23143
23198
|
|
|
@@ -23565,7 +23620,7 @@ var parse;
|
|
|
23565
23620
|
var uncacheable;
|
|
23566
23621
|
({ parse } = import_parser.default);
|
|
23567
23622
|
({ SourceMap: SourceMap2, base64Encode: base64Encode2 } = util_exports);
|
|
23568
|
-
uncacheable = /* @__PURE__ */ new Set(["ActualAssignment", "AllowAll", "AllowClassImplicitCall", "AllowIndentedApplication", "AllowTrailingMemberProperty", "AllowedTrailingMemberExpressions", "ApplicationStart", "Arguments", "ArgumentsWithTrailingMemberExpressions", "ArrowFunction", "ArrowFunctionTail", "AssignmentExpression", "AssignmentExpressionTail", "BinaryOpExpression", "BinaryOpRHS", "BracedBlock", "BracedObjectLiteralContent", "BracedOrEmptyBlock", "CallExpression", "CallExpressionRest", "ClassImplicitCallForbidden", "CoffeeCommentEnabled", "CommaDelimiter", "ConditionalExpression", "Declaration", "Debugger", "ElementListWithIndentedApplicationForbidden", "ElseClause", "Expression", "ExpressionStatement", "ExpressionWithIndentedApplicationForbidden", "ExtendedExpression", "FatArrowBody", "ForbidClassImplicitCall", "ForbidIndentedApplication", "ForbidTrailingMemberProperty", "FunctionDeclaration", "FunctionExpression", "HoistableDeclaration", "ImplicitArguments", "ImplicitInlineObjectPropertyDelimiter", "ImplicitNestedBlock", "IndentedApplicationAllowed", "IndentedFurther", "IndentedJSXChildExpression", "InlineObjectLiteral", "InsertIndent", "JSXChild", "JSXChildren", "JSXElement", "JSXFragment", "JSXImplicitFragment", "JSXMixedChildren", "JSXNested", "JSXNestedChildren", "JSXOptionalClosingElement", "JSXOptionalClosingFragment", "JSXTag", "LeftHandSideExpression", "MemberExpression", "MemberExpressionRest", "Nested", "NestedBindingElement", "NestedBindingElements", "NestedBlockExpression", "NestedBlockExpression", "NestedBlockStatement", "NestedBlockStatements", "NestedClassSignatureElement", "NestedClassSignatureElements", "NestedDeclareElement", "NestedDeclareElements", "NestedElement", "NestedElementList", "NestedImplicitObjectLiteral", "NestedImplicitPropertyDefinition", "NestedImplicitPropertyDefinitions", "NestedInterfaceProperty", "NestedJSXChildExpression", "NestedModuleItem", "NestedModuleItems", "NestedObject", "NestedPropertyDefinitions", "NonSingleBracedBlock", "NotDedented", "ObjectLiteral", "PopIndent", "PopJSXStack", "PostfixedExpression", "PostfixedStatement", "PrimaryExpression", "PushIndent", "PushJSXOpeningElement", "PushJSXOpeningFragment", "RestoreAll", "RestoreClassImplicitCall", "RestoreIndentedApplication", "RestoreTrailingMemberProperty", "RHS", "Samedent", "ShortCircuitExpression", "SingleLineAssignmentExpression", "SingleLineComment", "SingleLineStatements", "SnugNamedProperty", "Statement", "StatementListItem", "SuffixedExpression", "SuffixedStatement", "ThinArrowFunction", "TrackIndented", "TrailingMemberExpressions", "TrailingMemberPropertyAllowed", "TypedJSXElement", "TypedJSXFragment", "UnaryExpression", "UpdateExpression"]);
|
|
23623
|
+
uncacheable = /* @__PURE__ */ new Set(["ActualAssignment", "AllowAll", "AllowClassImplicitCall", "AllowIndentedApplication", "AllowMultiLineImplicitObjectLiteral", "AllowTrailingMemberProperty", "AllowedTrailingMemberExpressions", "ApplicationStart", "Arguments", "ArgumentsWithTrailingMemberExpressions", "ArrowFunction", "ArrowFunctionTail", "AssignmentExpression", "AssignmentExpressionTail", "BinaryOpExpression", "BinaryOpRHS", "BracedBlock", "BracedObjectLiteralContent", "BracedOrEmptyBlock", "CallExpression", "CallExpressionRest", "ClassImplicitCallForbidden", "CoffeeCommentEnabled", "CommaDelimiter", "ConditionalExpression", "Declaration", "Debugger", "ElementListWithIndentedApplicationForbidden", "ElseClause", "Expression", "ExpressionStatement", "ExpressionWithIndentedApplicationForbidden", "ExtendedExpression", "FatArrowBody", "ForbidClassImplicitCall", "ForbidIndentedApplication", "ForbidMultiLineImplicitObjectLiteral", "ForbidTrailingMemberProperty", "FunctionDeclaration", "FunctionExpression", "HoistableDeclaration", "ImplicitArguments", "ImplicitInlineObjectPropertyDelimiter", "ImplicitNestedBlock", "IndentedApplicationAllowed", "IndentedFurther", "IndentedJSXChildExpression", "InlineObjectLiteral", "InsertIndent", "JSXChild", "JSXChildren", "JSXElement", "JSXFragment", "JSXImplicitFragment", "JSXMixedChildren", "JSXNested", "JSXNestedChildren", "JSXOptionalClosingElement", "JSXOptionalClosingFragment", "JSXTag", "LeftHandSideExpression", "MemberExpression", "MemberExpressionRest", "Nested", "NestedBindingElement", "NestedBindingElements", "NestedBlockExpression", "NestedBlockExpression", "NestedBlockStatement", "NestedBlockStatements", "NestedClassSignatureElement", "NestedClassSignatureElements", "NestedDeclareElement", "NestedDeclareElements", "NestedElement", "NestedElementList", "NestedImplicitObjectLiteral", "NestedImplicitPropertyDefinition", "NestedImplicitPropertyDefinitions", "NestedInterfaceProperty", "NestedJSXChildExpression", "NestedModuleItem", "NestedModuleItems", "NestedObject", "NestedPropertyDefinitions", "NonSingleBracedBlock", "NotDedented", "ObjectLiteral", "PopIndent", "PopJSXStack", "PostfixedExpression", "PostfixedStatement", "PrimaryExpression", "PushIndent", "PushJSXOpeningElement", "PushJSXOpeningFragment", "RestoreAll", "RestoreClassImplicitCall", "RestoreMultiLineImplicitObjectLiteral", "RestoreIndentedApplication", "RestoreTrailingMemberProperty", "RHS", "Samedent", "ShortCircuitExpression", "SingleLineAssignmentExpression", "SingleLineComment", "SingleLineStatements", "SnugNamedProperty", "Statement", "StatementListItem", "SuffixedExpression", "SuffixedStatement", "ThinArrowFunction", "TrackIndented", "TrailingMemberExpressions", "TrailingMemberPropertyAllowed", "TypedJSXElement", "TypedJSXFragment", "UnaryExpression", "UpdateExpression"]);
|
|
23569
23624
|
var compile = function(src, options) {
|
|
23570
23625
|
var ast, code, events, filename, ref, result, sm, srcMapJSON;
|
|
23571
23626
|
if (!options) {
|