@danielx/civet 0.5.88 → 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 +99 -47
- package/dist/main.js +99 -47
- package/dist/main.mjs +99 -47
- 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) {
|
|
@@ -319,7 +327,7 @@ var Civet = (() => {
|
|
|
319
327
|
varLet = [",", ...varName, " = ", counterRef];
|
|
320
328
|
} else {
|
|
321
329
|
blockPrefix = [
|
|
322
|
-
["", forDeclaration, " = ", counterRef, "
|
|
330
|
+
["", forDeclaration, " = ", counterRef, ";"]
|
|
323
331
|
];
|
|
324
332
|
}
|
|
325
333
|
} else if (forDeclaration) {
|
|
@@ -1033,6 +1041,7 @@ ${input.slice(result.pos)}
|
|
|
1033
1041
|
OperatorDeclaration,
|
|
1034
1042
|
OperatorSignature,
|
|
1035
1043
|
AmpersandBlockRHS,
|
|
1044
|
+
AmpersandBlockRHSBody,
|
|
1036
1045
|
AmpersandUnaryPrefix,
|
|
1037
1046
|
ThinArrowFunction,
|
|
1038
1047
|
Arrow,
|
|
@@ -1786,7 +1795,8 @@ ${input.slice(result.pos)}
|
|
|
1786
1795
|
type: "BlockStatement",
|
|
1787
1796
|
expressions: statements,
|
|
1788
1797
|
children: [statements],
|
|
1789
|
-
bare: true
|
|
1798
|
+
bare: true,
|
|
1799
|
+
root: true
|
|
1790
1800
|
});
|
|
1791
1801
|
return $0;
|
|
1792
1802
|
});
|
|
@@ -2245,7 +2255,7 @@ ${input.slice(result.pos)}
|
|
|
2245
2255
|
return result;
|
|
2246
2256
|
}
|
|
2247
2257
|
}
|
|
2248
|
-
var ArgumentsWithTrailingMemberExpressions$0 = $TS($S(Arguments,
|
|
2258
|
+
var ArgumentsWithTrailingMemberExpressions$0 = $TS($S(Arguments, AllowedTrailingMemberExpressions), function($skip, $loc, $0, $1, $2) {
|
|
2249
2259
|
var args = $1;
|
|
2250
2260
|
var trailing = $2;
|
|
2251
2261
|
const call = {
|
|
@@ -6263,7 +6273,34 @@ ${input.slice(result.pos)}
|
|
|
6263
6273
|
return result;
|
|
6264
6274
|
}
|
|
6265
6275
|
}
|
|
6266
|
-
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) {
|
|
6267
6304
|
var callExpRest = $1;
|
|
6268
6305
|
var binopRHS = $2;
|
|
6269
6306
|
if (!callExpRest && !binopRHS)
|
|
@@ -6290,10 +6327,10 @@ ${input.slice(result.pos)}
|
|
|
6290
6327
|
}
|
|
6291
6328
|
return exp;
|
|
6292
6329
|
});
|
|
6293
|
-
function
|
|
6330
|
+
function AmpersandBlockRHSBody(state) {
|
|
6294
6331
|
let eventData;
|
|
6295
6332
|
if (state.events) {
|
|
6296
|
-
const result = state.events.enter?.("
|
|
6333
|
+
const result = state.events.enter?.("AmpersandBlockRHSBody", state);
|
|
6297
6334
|
if (result) {
|
|
6298
6335
|
if (result.cache)
|
|
6299
6336
|
return result.cache;
|
|
@@ -6301,14 +6338,14 @@ ${input.slice(result.pos)}
|
|
|
6301
6338
|
}
|
|
6302
6339
|
}
|
|
6303
6340
|
if (state.tokenize) {
|
|
6304
|
-
const result = $TOKEN("
|
|
6341
|
+
const result = $TOKEN("AmpersandBlockRHSBody", state, AmpersandBlockRHSBody$0(state));
|
|
6305
6342
|
if (state.events)
|
|
6306
|
-
state.events.exit?.("
|
|
6343
|
+
state.events.exit?.("AmpersandBlockRHSBody", state, result, eventData);
|
|
6307
6344
|
return result;
|
|
6308
6345
|
} else {
|
|
6309
|
-
const result =
|
|
6346
|
+
const result = AmpersandBlockRHSBody$0(state);
|
|
6310
6347
|
if (state.events)
|
|
6311
|
-
state.events.exit?.("
|
|
6348
|
+
state.events.exit?.("AmpersandBlockRHSBody", state, result, eventData);
|
|
6312
6349
|
return result;
|
|
6313
6350
|
}
|
|
6314
6351
|
}
|
|
@@ -6890,17 +6927,10 @@ ${input.slice(result.pos)}
|
|
|
6890
6927
|
if (!statements.length)
|
|
6891
6928
|
return $skip;
|
|
6892
6929
|
statements = statements.flat();
|
|
6893
|
-
const first = statements[0];
|
|
6894
|
-
const ws = first[0];
|
|
6895
|
-
const indent = ws.at(-1);
|
|
6896
|
-
statements = [
|
|
6897
|
-
[indent, ...first.slice(1)],
|
|
6898
|
-
...statements.slice(1)
|
|
6899
|
-
];
|
|
6900
6930
|
return {
|
|
6901
6931
|
type: "BlockStatement",
|
|
6902
6932
|
expressions: statements,
|
|
6903
|
-
children: [
|
|
6933
|
+
children: [statements],
|
|
6904
6934
|
bare: true
|
|
6905
6935
|
};
|
|
6906
6936
|
});
|
|
@@ -10099,13 +10129,12 @@ ${input.slice(result.pos)}
|
|
|
10099
10129
|
});
|
|
10100
10130
|
var ForStatementControl$1 = $TS($S(CoffeeForLoopsEnabled, CoffeeForStatementParameters, $E(WhenCondition)), function($skip, $loc, $0, $1, $2, $3) {
|
|
10101
10131
|
if ($3) {
|
|
10102
|
-
const
|
|
10103
|
-
const block = "continue\n";
|
|
10132
|
+
const block = "continue;";
|
|
10104
10133
|
$2 = {
|
|
10105
10134
|
...$2,
|
|
10106
10135
|
blockPrefix: [
|
|
10107
10136
|
...$2.blockPrefix,
|
|
10108
|
-
[
|
|
10137
|
+
["", {
|
|
10109
10138
|
type: "IfStatement",
|
|
10110
10139
|
then: block,
|
|
10111
10140
|
children: ["if (!(", insertTrimmingSpace($3, ""), ")) ", block]
|
|
@@ -10172,7 +10201,6 @@ ${input.slice(result.pos)}
|
|
|
10172
10201
|
var step = $8;
|
|
10173
10202
|
var close = $9;
|
|
10174
10203
|
let blockPrefix = [];
|
|
10175
|
-
const indent = module.currentIndent.token + " ";
|
|
10176
10204
|
exp = insertTrimmingSpace(exp, "");
|
|
10177
10205
|
declaration = insertTrimmingSpace(declaration, "");
|
|
10178
10206
|
if (kind.token === "from") {
|
|
@@ -10186,14 +10214,14 @@ ${input.slice(result.pos)}
|
|
|
10186
10214
|
}
|
|
10187
10215
|
if (declaration.own) {
|
|
10188
10216
|
const hasPropRef = module.getRef("hasProp");
|
|
10189
|
-
blockPrefix.push([
|
|
10217
|
+
blockPrefix.push(["", "if (!", hasPropRef, ".call(", exp, ", ", declaration, ")) continue", ";"]);
|
|
10190
10218
|
}
|
|
10191
10219
|
if (index) {
|
|
10192
|
-
blockPrefix.push([
|
|
10220
|
+
blockPrefix.push(["", {
|
|
10193
10221
|
type: "AssignmentExpression",
|
|
10194
10222
|
children: [index, " = ", exp, "[", declaration, "]"],
|
|
10195
10223
|
names: index.names
|
|
10196
|
-
}, "
|
|
10224
|
+
}, ";"]);
|
|
10197
10225
|
}
|
|
10198
10226
|
kind.token = "in";
|
|
10199
10227
|
} else if (kind.token === "in") {
|
|
@@ -10229,11 +10257,11 @@ ${input.slice(result.pos)}
|
|
|
10229
10257
|
assignmentNames.push(...index.names);
|
|
10230
10258
|
}
|
|
10231
10259
|
const expRefDec = expRef !== exp ? [expRef, " = ", insertTrimmingSpace(exp, ""), ", "] : [];
|
|
10232
|
-
blockPrefix.push([
|
|
10260
|
+
blockPrefix.push(["", {
|
|
10233
10261
|
type: "AssignmentExpression",
|
|
10234
|
-
children: [varRef, " = ", expRef, "[", indexAssignment, counterRef, "]
|
|
10262
|
+
children: [varRef, " = ", expRef, "[", indexAssignment, counterRef, "]"],
|
|
10235
10263
|
names: assignmentNames
|
|
10236
|
-
}]);
|
|
10264
|
+
}, ";"]);
|
|
10237
10265
|
declaration = {
|
|
10238
10266
|
type: "Declaration",
|
|
10239
10267
|
children: ["let ", ...expRefDec, counterRef, " = 0, ", lenRef, " = ", expRef, ".length"],
|
|
@@ -11157,7 +11185,7 @@ ${input.slice(result.pos)}
|
|
|
11157
11185
|
type: "AssignmentExpression",
|
|
11158
11186
|
children: [ref, " ", initializer],
|
|
11159
11187
|
hoistDec: [["", ["let ", ref], ";"]],
|
|
11160
|
-
blockPrefix: [["", [binding, "= ", ref], "
|
|
11188
|
+
blockPrefix: [["", [binding, "= ", ref], ";"]]
|
|
11161
11189
|
};
|
|
11162
11190
|
return initCondition;
|
|
11163
11191
|
});
|
|
@@ -13869,7 +13897,7 @@ ${input.slice(result.pos)}
|
|
|
13869
13897
|
}
|
|
13870
13898
|
}
|
|
13871
13899
|
var JSSingleLineComment$0 = $TR($EXPECT($R41, fail, "JSSingleLineComment /\\/\\/(?!\\/)[^\\r\\n]*/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
|
|
13872
|
-
return { $loc, token: $0 };
|
|
13900
|
+
return { type: "Comment", $loc, token: $0 };
|
|
13873
13901
|
});
|
|
13874
13902
|
function JSSingleLineComment(state) {
|
|
13875
13903
|
let eventData;
|
|
@@ -13918,7 +13946,7 @@ ${input.slice(result.pos)}
|
|
|
13918
13946
|
}
|
|
13919
13947
|
}
|
|
13920
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) {
|
|
13921
|
-
return { $loc, token: $1 };
|
|
13949
|
+
return { type: "Comment", $loc, token: $1 };
|
|
13922
13950
|
});
|
|
13923
13951
|
function JSMultiLineComment(state) {
|
|
13924
13952
|
let eventData;
|
|
@@ -13943,7 +13971,7 @@ ${input.slice(result.pos)}
|
|
|
13943
13971
|
}
|
|
13944
13972
|
}
|
|
13945
13973
|
var CoffeeSingleLineComment$0 = $TR($EXPECT($R43, fail, "CoffeeSingleLineComment /#(?!##(?!#))([^\\r\\n]*)/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
|
|
13946
|
-
return { $loc, token: `//${$1}` };
|
|
13974
|
+
return { type: "Comment", $loc, token: `//${$1}` };
|
|
13947
13975
|
});
|
|
13948
13976
|
function CoffeeSingleLineComment(state) {
|
|
13949
13977
|
let eventData;
|
|
@@ -13969,7 +13997,7 @@ ${input.slice(result.pos)}
|
|
|
13969
13997
|
}
|
|
13970
13998
|
var CoffeeMultiLineComment$0 = $TS($S(CoffeeHereCommentStart, $TEXT($EXPECT($R44, fail, "CoffeeMultiLineComment /[^]*?###/"))), function($skip, $loc, $0, $1, $2) {
|
|
13971
13999
|
$2 = $2.slice(0, $2.length - 3).replace(/\*\//g, "* /");
|
|
13972
|
-
return { $loc, token: `/*${$2}*/` };
|
|
14000
|
+
return { type: "Comment", $loc, token: `/*${$2}*/` };
|
|
13973
14001
|
});
|
|
13974
14002
|
function CoffeeMultiLineComment(state) {
|
|
13975
14003
|
let eventData;
|
|
@@ -21481,7 +21509,10 @@ ${input.slice(result.pos)}
|
|
|
21481
21509
|
if (exp.else)
|
|
21482
21510
|
insertReturn(exp.else[2]);
|
|
21483
21511
|
else
|
|
21484
|
-
exp.children.push(["
|
|
21512
|
+
exp.children.push(["", {
|
|
21513
|
+
type: "ReturnStatement",
|
|
21514
|
+
children: [";return"]
|
|
21515
|
+
}]);
|
|
21485
21516
|
return;
|
|
21486
21517
|
case "PatternMatchingStatement":
|
|
21487
21518
|
insertReturn(exp.children[0][0]);
|
|
@@ -21890,11 +21921,15 @@ ${input.slice(result.pos)}
|
|
|
21890
21921
|
const [splices, thisAssignments] = gatherBindingCode(parameters, {
|
|
21891
21922
|
injectParamProps: f.name === "constructor"
|
|
21892
21923
|
});
|
|
21924
|
+
const delimiter = {
|
|
21925
|
+
type: "SemicolonDelimiter",
|
|
21926
|
+
children: [";"]
|
|
21927
|
+
};
|
|
21893
21928
|
const prefix = splices.map((s) => ["let ", s]).concat(thisAssignments).map(
|
|
21894
21929
|
(s) => s.type ? {
|
|
21895
21930
|
...s,
|
|
21896
|
-
children: [indent, ...s.children,
|
|
21897
|
-
} : [indent, s,
|
|
21931
|
+
children: [indent, ...s.children, delimiter]
|
|
21932
|
+
} : [indent, s, delimiter]
|
|
21898
21933
|
);
|
|
21899
21934
|
expressions.unshift(...prefix);
|
|
21900
21935
|
}
|
|
@@ -21953,9 +21988,10 @@ ${input.slice(result.pos)}
|
|
|
21953
21988
|
getIndent(block.expressions[0]),
|
|
21954
21989
|
{
|
|
21955
21990
|
type: "Declaration",
|
|
21956
|
-
children: ["let ", ref, returnType
|
|
21991
|
+
children: ["let ", ref, returnType],
|
|
21957
21992
|
names: []
|
|
21958
|
-
}
|
|
21993
|
+
},
|
|
21994
|
+
";"
|
|
21959
21995
|
]);
|
|
21960
21996
|
}
|
|
21961
21997
|
gatherRecursiveWithinFunction(
|
|
@@ -21967,7 +22003,7 @@ ${input.slice(result.pos)}
|
|
|
21967
22003
|
});
|
|
21968
22004
|
if (block.children.at(-2)?.type !== "ReturnStatement") {
|
|
21969
22005
|
block.expressions.push([
|
|
21970
|
-
[
|
|
22006
|
+
[getIndent(block.expressions.at(-1))],
|
|
21971
22007
|
{
|
|
21972
22008
|
type: "ReturnStatement",
|
|
21973
22009
|
expression: ref,
|
|
@@ -22451,11 +22487,11 @@ ${input.slice(result.pos)}
|
|
|
22451
22487
|
let [splices, thisAssignments] = gatherBindingCode(pattern);
|
|
22452
22488
|
const patternBindings = nonMatcherBindings(pattern);
|
|
22453
22489
|
splices = splices.map((s2) => [", ", nonMatcherBindings(s2)]);
|
|
22454
|
-
thisAssignments = thisAssignments.map((a) => [indent, a, "
|
|
22490
|
+
thisAssignments = thisAssignments.map((a) => [indent, a, ";"]);
|
|
22455
22491
|
const duplicateDeclarations = aggregateDuplicateBindings([patternBindings, splices]);
|
|
22456
|
-
prefix.push([indent, "const ", patternBindings, " = ", ref, splices, "
|
|
22492
|
+
prefix.push([indent, "const ", patternBindings, " = ", ref, splices, ";"]);
|
|
22457
22493
|
prefix.push(...thisAssignments);
|
|
22458
|
-
prefix.push(...duplicateDeclarations.map((d) => [indent, d, "
|
|
22494
|
+
prefix.push(...duplicateDeclarations.map((d) => [indent, d, ";"]));
|
|
22459
22495
|
break;
|
|
22460
22496
|
}
|
|
22461
22497
|
}
|
|
@@ -22610,6 +22646,11 @@ ${input.slice(result.pos)}
|
|
|
22610
22646
|
});
|
|
22611
22647
|
}
|
|
22612
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");
|
|
22613
22654
|
addParentPointers(root);
|
|
22614
22655
|
const { expressions: statements } = root;
|
|
22615
22656
|
processPipelineExpressions(statements);
|
|
@@ -22703,7 +22744,11 @@ ${input.slice(result.pos)}
|
|
|
22703
22744
|
});
|
|
22704
22745
|
if (varIds.length) {
|
|
22705
22746
|
const indent = getIndent(statements[0]);
|
|
22706
|
-
|
|
22747
|
+
let delimiter = ";";
|
|
22748
|
+
if (statements[0][1]?.parent?.root) {
|
|
22749
|
+
delimiter = ";\n";
|
|
22750
|
+
}
|
|
22751
|
+
statements.unshift([indent, "var ", varIds.join(", "), delimiter]);
|
|
22707
22752
|
}
|
|
22708
22753
|
scopes.pop();
|
|
22709
22754
|
}
|
|
@@ -23144,6 +23189,13 @@ ${input.slice(result.pos)}
|
|
|
23144
23189
|
quoteString,
|
|
23145
23190
|
removeParentPointers
|
|
23146
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
|
+
};
|
|
23147
23199
|
}
|
|
23148
23200
|
});
|
|
23149
23201
|
|
|
@@ -23580,7 +23632,7 @@ ${input.slice(result.pos)}
|
|
|
23580
23632
|
var uncacheable;
|
|
23581
23633
|
({ parse } = import_parser.default);
|
|
23582
23634
|
({ SourceMap: SourceMap2, base64Encode: base64Encode2 } = util_exports);
|
|
23583
|
-
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"]);
|
|
23584
23636
|
var compile = function(src, options) {
|
|
23585
23637
|
var ast, code, events, filename, ref, result, sm, srcMapJSON;
|
|
23586
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) {
|
|
@@ -318,7 +326,7 @@ var require_lib = __commonJS({
|
|
|
318
326
|
varLet = [",", ...varName, " = ", counterRef];
|
|
319
327
|
} else {
|
|
320
328
|
blockPrefix = [
|
|
321
|
-
["", forDeclaration, " = ", counterRef, "
|
|
329
|
+
["", forDeclaration, " = ", counterRef, ";"]
|
|
322
330
|
];
|
|
323
331
|
}
|
|
324
332
|
} else if (forDeclaration) {
|
|
@@ -1032,6 +1040,7 @@ ${input.slice(result.pos)}
|
|
|
1032
1040
|
OperatorDeclaration,
|
|
1033
1041
|
OperatorSignature,
|
|
1034
1042
|
AmpersandBlockRHS,
|
|
1043
|
+
AmpersandBlockRHSBody,
|
|
1035
1044
|
AmpersandUnaryPrefix,
|
|
1036
1045
|
ThinArrowFunction,
|
|
1037
1046
|
Arrow,
|
|
@@ -1785,7 +1794,8 @@ ${input.slice(result.pos)}
|
|
|
1785
1794
|
type: "BlockStatement",
|
|
1786
1795
|
expressions: statements,
|
|
1787
1796
|
children: [statements],
|
|
1788
|
-
bare: true
|
|
1797
|
+
bare: true,
|
|
1798
|
+
root: true
|
|
1789
1799
|
});
|
|
1790
1800
|
return $0;
|
|
1791
1801
|
});
|
|
@@ -2244,7 +2254,7 @@ ${input.slice(result.pos)}
|
|
|
2244
2254
|
return result;
|
|
2245
2255
|
}
|
|
2246
2256
|
}
|
|
2247
|
-
var ArgumentsWithTrailingMemberExpressions$0 = $TS($S(Arguments,
|
|
2257
|
+
var ArgumentsWithTrailingMemberExpressions$0 = $TS($S(Arguments, AllowedTrailingMemberExpressions), function($skip, $loc, $0, $1, $2) {
|
|
2248
2258
|
var args = $1;
|
|
2249
2259
|
var trailing = $2;
|
|
2250
2260
|
const call = {
|
|
@@ -6262,7 +6272,34 @@ ${input.slice(result.pos)}
|
|
|
6262
6272
|
return result;
|
|
6263
6273
|
}
|
|
6264
6274
|
}
|
|
6265
|
-
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) {
|
|
6266
6303
|
var callExpRest = $1;
|
|
6267
6304
|
var binopRHS = $2;
|
|
6268
6305
|
if (!callExpRest && !binopRHS)
|
|
@@ -6289,10 +6326,10 @@ ${input.slice(result.pos)}
|
|
|
6289
6326
|
}
|
|
6290
6327
|
return exp;
|
|
6291
6328
|
});
|
|
6292
|
-
function
|
|
6329
|
+
function AmpersandBlockRHSBody(state) {
|
|
6293
6330
|
let eventData;
|
|
6294
6331
|
if (state.events) {
|
|
6295
|
-
const result = state.events.enter?.("
|
|
6332
|
+
const result = state.events.enter?.("AmpersandBlockRHSBody", state);
|
|
6296
6333
|
if (result) {
|
|
6297
6334
|
if (result.cache)
|
|
6298
6335
|
return result.cache;
|
|
@@ -6300,14 +6337,14 @@ ${input.slice(result.pos)}
|
|
|
6300
6337
|
}
|
|
6301
6338
|
}
|
|
6302
6339
|
if (state.tokenize) {
|
|
6303
|
-
const result = $TOKEN("
|
|
6340
|
+
const result = $TOKEN("AmpersandBlockRHSBody", state, AmpersandBlockRHSBody$0(state));
|
|
6304
6341
|
if (state.events)
|
|
6305
|
-
state.events.exit?.("
|
|
6342
|
+
state.events.exit?.("AmpersandBlockRHSBody", state, result, eventData);
|
|
6306
6343
|
return result;
|
|
6307
6344
|
} else {
|
|
6308
|
-
const result =
|
|
6345
|
+
const result = AmpersandBlockRHSBody$0(state);
|
|
6309
6346
|
if (state.events)
|
|
6310
|
-
state.events.exit?.("
|
|
6347
|
+
state.events.exit?.("AmpersandBlockRHSBody", state, result, eventData);
|
|
6311
6348
|
return result;
|
|
6312
6349
|
}
|
|
6313
6350
|
}
|
|
@@ -6889,17 +6926,10 @@ ${input.slice(result.pos)}
|
|
|
6889
6926
|
if (!statements.length)
|
|
6890
6927
|
return $skip;
|
|
6891
6928
|
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
6929
|
return {
|
|
6900
6930
|
type: "BlockStatement",
|
|
6901
6931
|
expressions: statements,
|
|
6902
|
-
children: [
|
|
6932
|
+
children: [statements],
|
|
6903
6933
|
bare: true
|
|
6904
6934
|
};
|
|
6905
6935
|
});
|
|
@@ -10098,13 +10128,12 @@ ${input.slice(result.pos)}
|
|
|
10098
10128
|
});
|
|
10099
10129
|
var ForStatementControl$1 = $TS($S(CoffeeForLoopsEnabled, CoffeeForStatementParameters, $E(WhenCondition)), function($skip, $loc, $0, $1, $2, $3) {
|
|
10100
10130
|
if ($3) {
|
|
10101
|
-
const
|
|
10102
|
-
const block = "continue\n";
|
|
10131
|
+
const block = "continue;";
|
|
10103
10132
|
$2 = {
|
|
10104
10133
|
...$2,
|
|
10105
10134
|
blockPrefix: [
|
|
10106
10135
|
...$2.blockPrefix,
|
|
10107
|
-
[
|
|
10136
|
+
["", {
|
|
10108
10137
|
type: "IfStatement",
|
|
10109
10138
|
then: block,
|
|
10110
10139
|
children: ["if (!(", insertTrimmingSpace($3, ""), ")) ", block]
|
|
@@ -10171,7 +10200,6 @@ ${input.slice(result.pos)}
|
|
|
10171
10200
|
var step = $8;
|
|
10172
10201
|
var close = $9;
|
|
10173
10202
|
let blockPrefix = [];
|
|
10174
|
-
const indent = module2.currentIndent.token + " ";
|
|
10175
10203
|
exp = insertTrimmingSpace(exp, "");
|
|
10176
10204
|
declaration = insertTrimmingSpace(declaration, "");
|
|
10177
10205
|
if (kind.token === "from") {
|
|
@@ -10185,14 +10213,14 @@ ${input.slice(result.pos)}
|
|
|
10185
10213
|
}
|
|
10186
10214
|
if (declaration.own) {
|
|
10187
10215
|
const hasPropRef = module2.getRef("hasProp");
|
|
10188
|
-
blockPrefix.push([
|
|
10216
|
+
blockPrefix.push(["", "if (!", hasPropRef, ".call(", exp, ", ", declaration, ")) continue", ";"]);
|
|
10189
10217
|
}
|
|
10190
10218
|
if (index) {
|
|
10191
|
-
blockPrefix.push([
|
|
10219
|
+
blockPrefix.push(["", {
|
|
10192
10220
|
type: "AssignmentExpression",
|
|
10193
10221
|
children: [index, " = ", exp, "[", declaration, "]"],
|
|
10194
10222
|
names: index.names
|
|
10195
|
-
}, "
|
|
10223
|
+
}, ";"]);
|
|
10196
10224
|
}
|
|
10197
10225
|
kind.token = "in";
|
|
10198
10226
|
} else if (kind.token === "in") {
|
|
@@ -10228,11 +10256,11 @@ ${input.slice(result.pos)}
|
|
|
10228
10256
|
assignmentNames.push(...index.names);
|
|
10229
10257
|
}
|
|
10230
10258
|
const expRefDec = expRef !== exp ? [expRef, " = ", insertTrimmingSpace(exp, ""), ", "] : [];
|
|
10231
|
-
blockPrefix.push([
|
|
10259
|
+
blockPrefix.push(["", {
|
|
10232
10260
|
type: "AssignmentExpression",
|
|
10233
|
-
children: [varRef, " = ", expRef, "[", indexAssignment, counterRef, "]
|
|
10261
|
+
children: [varRef, " = ", expRef, "[", indexAssignment, counterRef, "]"],
|
|
10234
10262
|
names: assignmentNames
|
|
10235
|
-
}]);
|
|
10263
|
+
}, ";"]);
|
|
10236
10264
|
declaration = {
|
|
10237
10265
|
type: "Declaration",
|
|
10238
10266
|
children: ["let ", ...expRefDec, counterRef, " = 0, ", lenRef, " = ", expRef, ".length"],
|
|
@@ -11156,7 +11184,7 @@ ${input.slice(result.pos)}
|
|
|
11156
11184
|
type: "AssignmentExpression",
|
|
11157
11185
|
children: [ref, " ", initializer],
|
|
11158
11186
|
hoistDec: [["", ["let ", ref], ";"]],
|
|
11159
|
-
blockPrefix: [["", [binding, "= ", ref], "
|
|
11187
|
+
blockPrefix: [["", [binding, "= ", ref], ";"]]
|
|
11160
11188
|
};
|
|
11161
11189
|
return initCondition;
|
|
11162
11190
|
});
|
|
@@ -13868,7 +13896,7 @@ ${input.slice(result.pos)}
|
|
|
13868
13896
|
}
|
|
13869
13897
|
}
|
|
13870
13898
|
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 };
|
|
13899
|
+
return { type: "Comment", $loc, token: $0 };
|
|
13872
13900
|
});
|
|
13873
13901
|
function JSSingleLineComment(state) {
|
|
13874
13902
|
let eventData;
|
|
@@ -13917,7 +13945,7 @@ ${input.slice(result.pos)}
|
|
|
13917
13945
|
}
|
|
13918
13946
|
}
|
|
13919
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) {
|
|
13920
|
-
return { $loc, token: $1 };
|
|
13948
|
+
return { type: "Comment", $loc, token: $1 };
|
|
13921
13949
|
});
|
|
13922
13950
|
function JSMultiLineComment(state) {
|
|
13923
13951
|
let eventData;
|
|
@@ -13942,7 +13970,7 @@ ${input.slice(result.pos)}
|
|
|
13942
13970
|
}
|
|
13943
13971
|
}
|
|
13944
13972
|
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}` };
|
|
13973
|
+
return { type: "Comment", $loc, token: `//${$1}` };
|
|
13946
13974
|
});
|
|
13947
13975
|
function CoffeeSingleLineComment(state) {
|
|
13948
13976
|
let eventData;
|
|
@@ -13968,7 +13996,7 @@ ${input.slice(result.pos)}
|
|
|
13968
13996
|
}
|
|
13969
13997
|
var CoffeeMultiLineComment$0 = $TS($S(CoffeeHereCommentStart, $TEXT($EXPECT($R44, fail, "CoffeeMultiLineComment /[^]*?###/"))), function($skip, $loc, $0, $1, $2) {
|
|
13970
13998
|
$2 = $2.slice(0, $2.length - 3).replace(/\*\//g, "* /");
|
|
13971
|
-
return { $loc, token: `/*${$2}*/` };
|
|
13999
|
+
return { type: "Comment", $loc, token: `/*${$2}*/` };
|
|
13972
14000
|
});
|
|
13973
14001
|
function CoffeeMultiLineComment(state) {
|
|
13974
14002
|
let eventData;
|
|
@@ -21480,7 +21508,10 @@ ${input.slice(result.pos)}
|
|
|
21480
21508
|
if (exp.else)
|
|
21481
21509
|
insertReturn(exp.else[2]);
|
|
21482
21510
|
else
|
|
21483
|
-
exp.children.push(["
|
|
21511
|
+
exp.children.push(["", {
|
|
21512
|
+
type: "ReturnStatement",
|
|
21513
|
+
children: [";return"]
|
|
21514
|
+
}]);
|
|
21484
21515
|
return;
|
|
21485
21516
|
case "PatternMatchingStatement":
|
|
21486
21517
|
insertReturn(exp.children[0][0]);
|
|
@@ -21889,11 +21920,15 @@ ${input.slice(result.pos)}
|
|
|
21889
21920
|
const [splices, thisAssignments] = gatherBindingCode(parameters, {
|
|
21890
21921
|
injectParamProps: f.name === "constructor"
|
|
21891
21922
|
});
|
|
21923
|
+
const delimiter = {
|
|
21924
|
+
type: "SemicolonDelimiter",
|
|
21925
|
+
children: [";"]
|
|
21926
|
+
};
|
|
21892
21927
|
const prefix = splices.map((s) => ["let ", s]).concat(thisAssignments).map(
|
|
21893
21928
|
(s) => s.type ? {
|
|
21894
21929
|
...s,
|
|
21895
|
-
children: [indent, ...s.children,
|
|
21896
|
-
} : [indent, s,
|
|
21930
|
+
children: [indent, ...s.children, delimiter]
|
|
21931
|
+
} : [indent, s, delimiter]
|
|
21897
21932
|
);
|
|
21898
21933
|
expressions.unshift(...prefix);
|
|
21899
21934
|
}
|
|
@@ -21952,9 +21987,10 @@ ${input.slice(result.pos)}
|
|
|
21952
21987
|
getIndent(block.expressions[0]),
|
|
21953
21988
|
{
|
|
21954
21989
|
type: "Declaration",
|
|
21955
|
-
children: ["let ", ref, returnType
|
|
21990
|
+
children: ["let ", ref, returnType],
|
|
21956
21991
|
names: []
|
|
21957
|
-
}
|
|
21992
|
+
},
|
|
21993
|
+
";"
|
|
21958
21994
|
]);
|
|
21959
21995
|
}
|
|
21960
21996
|
gatherRecursiveWithinFunction(
|
|
@@ -21966,7 +22002,7 @@ ${input.slice(result.pos)}
|
|
|
21966
22002
|
});
|
|
21967
22003
|
if (block.children.at(-2)?.type !== "ReturnStatement") {
|
|
21968
22004
|
block.expressions.push([
|
|
21969
|
-
[
|
|
22005
|
+
[getIndent(block.expressions.at(-1))],
|
|
21970
22006
|
{
|
|
21971
22007
|
type: "ReturnStatement",
|
|
21972
22008
|
expression: ref,
|
|
@@ -22450,11 +22486,11 @@ ${input.slice(result.pos)}
|
|
|
22450
22486
|
let [splices, thisAssignments] = gatherBindingCode(pattern);
|
|
22451
22487
|
const patternBindings = nonMatcherBindings(pattern);
|
|
22452
22488
|
splices = splices.map((s2) => [", ", nonMatcherBindings(s2)]);
|
|
22453
|
-
thisAssignments = thisAssignments.map((a) => [indent, a, "
|
|
22489
|
+
thisAssignments = thisAssignments.map((a) => [indent, a, ";"]);
|
|
22454
22490
|
const duplicateDeclarations = aggregateDuplicateBindings([patternBindings, splices]);
|
|
22455
|
-
prefix.push([indent, "const ", patternBindings, " = ", ref, splices, "
|
|
22491
|
+
prefix.push([indent, "const ", patternBindings, " = ", ref, splices, ";"]);
|
|
22456
22492
|
prefix.push(...thisAssignments);
|
|
22457
|
-
prefix.push(...duplicateDeclarations.map((d) => [indent, d, "
|
|
22493
|
+
prefix.push(...duplicateDeclarations.map((d) => [indent, d, ";"]));
|
|
22458
22494
|
break;
|
|
22459
22495
|
}
|
|
22460
22496
|
}
|
|
@@ -22609,6 +22645,11 @@ ${input.slice(result.pos)}
|
|
|
22609
22645
|
});
|
|
22610
22646
|
}
|
|
22611
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");
|
|
22612
22653
|
addParentPointers(root);
|
|
22613
22654
|
const { expressions: statements } = root;
|
|
22614
22655
|
processPipelineExpressions(statements);
|
|
@@ -22702,7 +22743,11 @@ ${input.slice(result.pos)}
|
|
|
22702
22743
|
});
|
|
22703
22744
|
if (varIds.length) {
|
|
22704
22745
|
const indent = getIndent(statements[0]);
|
|
22705
|
-
|
|
22746
|
+
let delimiter = ";";
|
|
22747
|
+
if (statements[0][1]?.parent?.root) {
|
|
22748
|
+
delimiter = ";\n";
|
|
22749
|
+
}
|
|
22750
|
+
statements.unshift([indent, "var ", varIds.join(", "), delimiter]);
|
|
22706
22751
|
}
|
|
22707
22752
|
scopes.pop();
|
|
22708
22753
|
}
|
|
@@ -23143,6 +23188,13 @@ ${input.slice(result.pos)}
|
|
|
23143
23188
|
quoteString,
|
|
23144
23189
|
removeParentPointers
|
|
23145
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
|
+
};
|
|
23146
23198
|
}
|
|
23147
23199
|
});
|
|
23148
23200
|
|
|
@@ -23580,7 +23632,7 @@ var parse;
|
|
|
23580
23632
|
var uncacheable;
|
|
23581
23633
|
({ parse } = import_parser.default);
|
|
23582
23634
|
({ SourceMap: SourceMap2, base64Encode: base64Encode2 } = util_exports);
|
|
23583
|
-
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"]);
|
|
23584
23636
|
var compile = function(src, options) {
|
|
23585
23637
|
var ast, code, events, filename, ref, result, sm, srcMapJSON;
|
|
23586
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) {
|
|
@@ -316,7 +324,7 @@ var require_lib = __commonJS({
|
|
|
316
324
|
varLet = [",", ...varName, " = ", counterRef];
|
|
317
325
|
} else {
|
|
318
326
|
blockPrefix = [
|
|
319
|
-
["", forDeclaration, " = ", counterRef, "
|
|
327
|
+
["", forDeclaration, " = ", counterRef, ";"]
|
|
320
328
|
];
|
|
321
329
|
}
|
|
322
330
|
} else if (forDeclaration) {
|
|
@@ -1030,6 +1038,7 @@ ${input.slice(result.pos)}
|
|
|
1030
1038
|
OperatorDeclaration,
|
|
1031
1039
|
OperatorSignature,
|
|
1032
1040
|
AmpersandBlockRHS,
|
|
1041
|
+
AmpersandBlockRHSBody,
|
|
1033
1042
|
AmpersandUnaryPrefix,
|
|
1034
1043
|
ThinArrowFunction,
|
|
1035
1044
|
Arrow,
|
|
@@ -1783,7 +1792,8 @@ ${input.slice(result.pos)}
|
|
|
1783
1792
|
type: "BlockStatement",
|
|
1784
1793
|
expressions: statements,
|
|
1785
1794
|
children: [statements],
|
|
1786
|
-
bare: true
|
|
1795
|
+
bare: true,
|
|
1796
|
+
root: true
|
|
1787
1797
|
});
|
|
1788
1798
|
return $0;
|
|
1789
1799
|
});
|
|
@@ -2242,7 +2252,7 @@ ${input.slice(result.pos)}
|
|
|
2242
2252
|
return result;
|
|
2243
2253
|
}
|
|
2244
2254
|
}
|
|
2245
|
-
var ArgumentsWithTrailingMemberExpressions$0 = $TS($S(Arguments,
|
|
2255
|
+
var ArgumentsWithTrailingMemberExpressions$0 = $TS($S(Arguments, AllowedTrailingMemberExpressions), function($skip, $loc, $0, $1, $2) {
|
|
2246
2256
|
var args = $1;
|
|
2247
2257
|
var trailing = $2;
|
|
2248
2258
|
const call = {
|
|
@@ -6260,7 +6270,34 @@ ${input.slice(result.pos)}
|
|
|
6260
6270
|
return result;
|
|
6261
6271
|
}
|
|
6262
6272
|
}
|
|
6263
|
-
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) {
|
|
6264
6301
|
var callExpRest = $1;
|
|
6265
6302
|
var binopRHS = $2;
|
|
6266
6303
|
if (!callExpRest && !binopRHS)
|
|
@@ -6287,10 +6324,10 @@ ${input.slice(result.pos)}
|
|
|
6287
6324
|
}
|
|
6288
6325
|
return exp;
|
|
6289
6326
|
});
|
|
6290
|
-
function
|
|
6327
|
+
function AmpersandBlockRHSBody(state) {
|
|
6291
6328
|
let eventData;
|
|
6292
6329
|
if (state.events) {
|
|
6293
|
-
const result = state.events.enter?.("
|
|
6330
|
+
const result = state.events.enter?.("AmpersandBlockRHSBody", state);
|
|
6294
6331
|
if (result) {
|
|
6295
6332
|
if (result.cache)
|
|
6296
6333
|
return result.cache;
|
|
@@ -6298,14 +6335,14 @@ ${input.slice(result.pos)}
|
|
|
6298
6335
|
}
|
|
6299
6336
|
}
|
|
6300
6337
|
if (state.tokenize) {
|
|
6301
|
-
const result = $TOKEN("
|
|
6338
|
+
const result = $TOKEN("AmpersandBlockRHSBody", state, AmpersandBlockRHSBody$0(state));
|
|
6302
6339
|
if (state.events)
|
|
6303
|
-
state.events.exit?.("
|
|
6340
|
+
state.events.exit?.("AmpersandBlockRHSBody", state, result, eventData);
|
|
6304
6341
|
return result;
|
|
6305
6342
|
} else {
|
|
6306
|
-
const result =
|
|
6343
|
+
const result = AmpersandBlockRHSBody$0(state);
|
|
6307
6344
|
if (state.events)
|
|
6308
|
-
state.events.exit?.("
|
|
6345
|
+
state.events.exit?.("AmpersandBlockRHSBody", state, result, eventData);
|
|
6309
6346
|
return result;
|
|
6310
6347
|
}
|
|
6311
6348
|
}
|
|
@@ -6887,17 +6924,10 @@ ${input.slice(result.pos)}
|
|
|
6887
6924
|
if (!statements.length)
|
|
6888
6925
|
return $skip;
|
|
6889
6926
|
statements = statements.flat();
|
|
6890
|
-
const first = statements[0];
|
|
6891
|
-
const ws = first[0];
|
|
6892
|
-
const indent = ws.at(-1);
|
|
6893
|
-
statements = [
|
|
6894
|
-
[indent, ...first.slice(1)],
|
|
6895
|
-
...statements.slice(1)
|
|
6896
|
-
];
|
|
6897
6927
|
return {
|
|
6898
6928
|
type: "BlockStatement",
|
|
6899
6929
|
expressions: statements,
|
|
6900
|
-
children: [
|
|
6930
|
+
children: [statements],
|
|
6901
6931
|
bare: true
|
|
6902
6932
|
};
|
|
6903
6933
|
});
|
|
@@ -10096,13 +10126,12 @@ ${input.slice(result.pos)}
|
|
|
10096
10126
|
});
|
|
10097
10127
|
var ForStatementControl$1 = $TS($S(CoffeeForLoopsEnabled, CoffeeForStatementParameters, $E(WhenCondition)), function($skip, $loc, $0, $1, $2, $3) {
|
|
10098
10128
|
if ($3) {
|
|
10099
|
-
const
|
|
10100
|
-
const block = "continue\n";
|
|
10129
|
+
const block = "continue;";
|
|
10101
10130
|
$2 = {
|
|
10102
10131
|
...$2,
|
|
10103
10132
|
blockPrefix: [
|
|
10104
10133
|
...$2.blockPrefix,
|
|
10105
|
-
[
|
|
10134
|
+
["", {
|
|
10106
10135
|
type: "IfStatement",
|
|
10107
10136
|
then: block,
|
|
10108
10137
|
children: ["if (!(", insertTrimmingSpace($3, ""), ")) ", block]
|
|
@@ -10169,7 +10198,6 @@ ${input.slice(result.pos)}
|
|
|
10169
10198
|
var step = $8;
|
|
10170
10199
|
var close = $9;
|
|
10171
10200
|
let blockPrefix = [];
|
|
10172
|
-
const indent = module.currentIndent.token + " ";
|
|
10173
10201
|
exp = insertTrimmingSpace(exp, "");
|
|
10174
10202
|
declaration = insertTrimmingSpace(declaration, "");
|
|
10175
10203
|
if (kind.token === "from") {
|
|
@@ -10183,14 +10211,14 @@ ${input.slice(result.pos)}
|
|
|
10183
10211
|
}
|
|
10184
10212
|
if (declaration.own) {
|
|
10185
10213
|
const hasPropRef = module.getRef("hasProp");
|
|
10186
|
-
blockPrefix.push([
|
|
10214
|
+
blockPrefix.push(["", "if (!", hasPropRef, ".call(", exp, ", ", declaration, ")) continue", ";"]);
|
|
10187
10215
|
}
|
|
10188
10216
|
if (index) {
|
|
10189
|
-
blockPrefix.push([
|
|
10217
|
+
blockPrefix.push(["", {
|
|
10190
10218
|
type: "AssignmentExpression",
|
|
10191
10219
|
children: [index, " = ", exp, "[", declaration, "]"],
|
|
10192
10220
|
names: index.names
|
|
10193
|
-
}, "
|
|
10221
|
+
}, ";"]);
|
|
10194
10222
|
}
|
|
10195
10223
|
kind.token = "in";
|
|
10196
10224
|
} else if (kind.token === "in") {
|
|
@@ -10226,11 +10254,11 @@ ${input.slice(result.pos)}
|
|
|
10226
10254
|
assignmentNames.push(...index.names);
|
|
10227
10255
|
}
|
|
10228
10256
|
const expRefDec = expRef !== exp ? [expRef, " = ", insertTrimmingSpace(exp, ""), ", "] : [];
|
|
10229
|
-
blockPrefix.push([
|
|
10257
|
+
blockPrefix.push(["", {
|
|
10230
10258
|
type: "AssignmentExpression",
|
|
10231
|
-
children: [varRef, " = ", expRef, "[", indexAssignment, counterRef, "]
|
|
10259
|
+
children: [varRef, " = ", expRef, "[", indexAssignment, counterRef, "]"],
|
|
10232
10260
|
names: assignmentNames
|
|
10233
|
-
}]);
|
|
10261
|
+
}, ";"]);
|
|
10234
10262
|
declaration = {
|
|
10235
10263
|
type: "Declaration",
|
|
10236
10264
|
children: ["let ", ...expRefDec, counterRef, " = 0, ", lenRef, " = ", expRef, ".length"],
|
|
@@ -11154,7 +11182,7 @@ ${input.slice(result.pos)}
|
|
|
11154
11182
|
type: "AssignmentExpression",
|
|
11155
11183
|
children: [ref, " ", initializer],
|
|
11156
11184
|
hoistDec: [["", ["let ", ref], ";"]],
|
|
11157
|
-
blockPrefix: [["", [binding, "= ", ref], "
|
|
11185
|
+
blockPrefix: [["", [binding, "= ", ref], ";"]]
|
|
11158
11186
|
};
|
|
11159
11187
|
return initCondition;
|
|
11160
11188
|
});
|
|
@@ -13866,7 +13894,7 @@ ${input.slice(result.pos)}
|
|
|
13866
13894
|
}
|
|
13867
13895
|
}
|
|
13868
13896
|
var JSSingleLineComment$0 = $TR($EXPECT($R41, fail, "JSSingleLineComment /\\/\\/(?!\\/)[^\\r\\n]*/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
|
|
13869
|
-
return { $loc, token: $0 };
|
|
13897
|
+
return { type: "Comment", $loc, token: $0 };
|
|
13870
13898
|
});
|
|
13871
13899
|
function JSSingleLineComment(state) {
|
|
13872
13900
|
let eventData;
|
|
@@ -13915,7 +13943,7 @@ ${input.slice(result.pos)}
|
|
|
13915
13943
|
}
|
|
13916
13944
|
}
|
|
13917
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) {
|
|
13918
|
-
return { $loc, token: $1 };
|
|
13946
|
+
return { type: "Comment", $loc, token: $1 };
|
|
13919
13947
|
});
|
|
13920
13948
|
function JSMultiLineComment(state) {
|
|
13921
13949
|
let eventData;
|
|
@@ -13940,7 +13968,7 @@ ${input.slice(result.pos)}
|
|
|
13940
13968
|
}
|
|
13941
13969
|
}
|
|
13942
13970
|
var CoffeeSingleLineComment$0 = $TR($EXPECT($R43, fail, "CoffeeSingleLineComment /#(?!##(?!#))([^\\r\\n]*)/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
|
|
13943
|
-
return { $loc, token: `//${$1}` };
|
|
13971
|
+
return { type: "Comment", $loc, token: `//${$1}` };
|
|
13944
13972
|
});
|
|
13945
13973
|
function CoffeeSingleLineComment(state) {
|
|
13946
13974
|
let eventData;
|
|
@@ -13966,7 +13994,7 @@ ${input.slice(result.pos)}
|
|
|
13966
13994
|
}
|
|
13967
13995
|
var CoffeeMultiLineComment$0 = $TS($S(CoffeeHereCommentStart, $TEXT($EXPECT($R44, fail, "CoffeeMultiLineComment /[^]*?###/"))), function($skip, $loc, $0, $1, $2) {
|
|
13968
13996
|
$2 = $2.slice(0, $2.length - 3).replace(/\*\//g, "* /");
|
|
13969
|
-
return { $loc, token: `/*${$2}*/` };
|
|
13997
|
+
return { type: "Comment", $loc, token: `/*${$2}*/` };
|
|
13970
13998
|
});
|
|
13971
13999
|
function CoffeeMultiLineComment(state) {
|
|
13972
14000
|
let eventData;
|
|
@@ -21478,7 +21506,10 @@ ${input.slice(result.pos)}
|
|
|
21478
21506
|
if (exp.else)
|
|
21479
21507
|
insertReturn(exp.else[2]);
|
|
21480
21508
|
else
|
|
21481
|
-
exp.children.push(["
|
|
21509
|
+
exp.children.push(["", {
|
|
21510
|
+
type: "ReturnStatement",
|
|
21511
|
+
children: [";return"]
|
|
21512
|
+
}]);
|
|
21482
21513
|
return;
|
|
21483
21514
|
case "PatternMatchingStatement":
|
|
21484
21515
|
insertReturn(exp.children[0][0]);
|
|
@@ -21887,11 +21918,15 @@ ${input.slice(result.pos)}
|
|
|
21887
21918
|
const [splices, thisAssignments] = gatherBindingCode(parameters, {
|
|
21888
21919
|
injectParamProps: f.name === "constructor"
|
|
21889
21920
|
});
|
|
21921
|
+
const delimiter = {
|
|
21922
|
+
type: "SemicolonDelimiter",
|
|
21923
|
+
children: [";"]
|
|
21924
|
+
};
|
|
21890
21925
|
const prefix = splices.map((s) => ["let ", s]).concat(thisAssignments).map(
|
|
21891
21926
|
(s) => s.type ? {
|
|
21892
21927
|
...s,
|
|
21893
|
-
children: [indent, ...s.children,
|
|
21894
|
-
} : [indent, s,
|
|
21928
|
+
children: [indent, ...s.children, delimiter]
|
|
21929
|
+
} : [indent, s, delimiter]
|
|
21895
21930
|
);
|
|
21896
21931
|
expressions.unshift(...prefix);
|
|
21897
21932
|
}
|
|
@@ -21950,9 +21985,10 @@ ${input.slice(result.pos)}
|
|
|
21950
21985
|
getIndent(block.expressions[0]),
|
|
21951
21986
|
{
|
|
21952
21987
|
type: "Declaration",
|
|
21953
|
-
children: ["let ", ref, returnType
|
|
21988
|
+
children: ["let ", ref, returnType],
|
|
21954
21989
|
names: []
|
|
21955
|
-
}
|
|
21990
|
+
},
|
|
21991
|
+
";"
|
|
21956
21992
|
]);
|
|
21957
21993
|
}
|
|
21958
21994
|
gatherRecursiveWithinFunction(
|
|
@@ -21964,7 +22000,7 @@ ${input.slice(result.pos)}
|
|
|
21964
22000
|
});
|
|
21965
22001
|
if (block.children.at(-2)?.type !== "ReturnStatement") {
|
|
21966
22002
|
block.expressions.push([
|
|
21967
|
-
[
|
|
22003
|
+
[getIndent(block.expressions.at(-1))],
|
|
21968
22004
|
{
|
|
21969
22005
|
type: "ReturnStatement",
|
|
21970
22006
|
expression: ref,
|
|
@@ -22448,11 +22484,11 @@ ${input.slice(result.pos)}
|
|
|
22448
22484
|
let [splices, thisAssignments] = gatherBindingCode(pattern);
|
|
22449
22485
|
const patternBindings = nonMatcherBindings(pattern);
|
|
22450
22486
|
splices = splices.map((s2) => [", ", nonMatcherBindings(s2)]);
|
|
22451
|
-
thisAssignments = thisAssignments.map((a) => [indent, a, "
|
|
22487
|
+
thisAssignments = thisAssignments.map((a) => [indent, a, ";"]);
|
|
22452
22488
|
const duplicateDeclarations = aggregateDuplicateBindings([patternBindings, splices]);
|
|
22453
|
-
prefix.push([indent, "const ", patternBindings, " = ", ref, splices, "
|
|
22489
|
+
prefix.push([indent, "const ", patternBindings, " = ", ref, splices, ";"]);
|
|
22454
22490
|
prefix.push(...thisAssignments);
|
|
22455
|
-
prefix.push(...duplicateDeclarations.map((d) => [indent, d, "
|
|
22491
|
+
prefix.push(...duplicateDeclarations.map((d) => [indent, d, ";"]));
|
|
22456
22492
|
break;
|
|
22457
22493
|
}
|
|
22458
22494
|
}
|
|
@@ -22607,6 +22643,11 @@ ${input.slice(result.pos)}
|
|
|
22607
22643
|
});
|
|
22608
22644
|
}
|
|
22609
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");
|
|
22610
22651
|
addParentPointers(root);
|
|
22611
22652
|
const { expressions: statements } = root;
|
|
22612
22653
|
processPipelineExpressions(statements);
|
|
@@ -22700,7 +22741,11 @@ ${input.slice(result.pos)}
|
|
|
22700
22741
|
});
|
|
22701
22742
|
if (varIds.length) {
|
|
22702
22743
|
const indent = getIndent(statements[0]);
|
|
22703
|
-
|
|
22744
|
+
let delimiter = ";";
|
|
22745
|
+
if (statements[0][1]?.parent?.root) {
|
|
22746
|
+
delimiter = ";\n";
|
|
22747
|
+
}
|
|
22748
|
+
statements.unshift([indent, "var ", varIds.join(", "), delimiter]);
|
|
22704
22749
|
}
|
|
22705
22750
|
scopes.pop();
|
|
22706
22751
|
}
|
|
@@ -23141,6 +23186,13 @@ ${input.slice(result.pos)}
|
|
|
23141
23186
|
quoteString,
|
|
23142
23187
|
removeParentPointers
|
|
23143
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
|
+
};
|
|
23144
23196
|
}
|
|
23145
23197
|
});
|
|
23146
23198
|
|
|
@@ -23568,7 +23620,7 @@ var parse;
|
|
|
23568
23620
|
var uncacheable;
|
|
23569
23621
|
({ parse } = import_parser.default);
|
|
23570
23622
|
({ SourceMap: SourceMap2, base64Encode: base64Encode2 } = util_exports);
|
|
23571
|
-
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"]);
|
|
23572
23624
|
var compile = function(src, options) {
|
|
23573
23625
|
var ast, code, events, filename, ref, result, sm, srcMapJSON;
|
|
23574
23626
|
if (!options) {
|