@danielx/civet 0.5.92 → 0.5.94
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 +323 -179
- package/dist/civet +1 -1
- package/dist/esbuild-plugin.js +119 -26
- package/dist/esm.mjs +9 -4
- package/dist/main.js +323 -179
- package/dist/main.mjs +323 -179
- package/dist/types.d.ts +8 -1
- package/package.json +4 -1
- package/register.js +9 -0
- package/dist/browser.js.gzip +0 -0
package/dist/browser.js
CHANGED
|
@@ -386,6 +386,82 @@ var Civet = (() => {
|
|
|
386
386
|
return '"' + str.replace(/"/g, '\\"') + '"';
|
|
387
387
|
}
|
|
388
388
|
}
|
|
389
|
+
function lastAccessInCallExpression(exp) {
|
|
390
|
+
let children, i;
|
|
391
|
+
do {
|
|
392
|
+
({ children } = exp);
|
|
393
|
+
i = children.length - 1;
|
|
394
|
+
while (i >= 0 && (children[i].type === "Call" || children[i].type === "NonNullAssertion" || children[i].type === "Optional"))
|
|
395
|
+
i--;
|
|
396
|
+
if (i < 0)
|
|
397
|
+
return;
|
|
398
|
+
} while (children[i].type === "MemberExpression" && (exp = children[i]));
|
|
399
|
+
return children[i];
|
|
400
|
+
}
|
|
401
|
+
function convertMethodToFunction(method) {
|
|
402
|
+
const { signature, block } = method;
|
|
403
|
+
let { modifier } = signature;
|
|
404
|
+
if (modifier) {
|
|
405
|
+
if (modifier.get || modifier.set) {
|
|
406
|
+
return;
|
|
407
|
+
} else if (modifier.async) {
|
|
408
|
+
modifier = [modifier.children[0][0], " function ", ...modifier.children.slice(1)];
|
|
409
|
+
} else {
|
|
410
|
+
modifier = ["function ", ...modifier.children];
|
|
411
|
+
}
|
|
412
|
+
} else {
|
|
413
|
+
modifier = "function ";
|
|
414
|
+
}
|
|
415
|
+
return {
|
|
416
|
+
...signature,
|
|
417
|
+
id: signature.name,
|
|
418
|
+
type: "FunctionExpression",
|
|
419
|
+
children: [
|
|
420
|
+
[modifier, ...signature.children.slice(1)],
|
|
421
|
+
block
|
|
422
|
+
],
|
|
423
|
+
block
|
|
424
|
+
};
|
|
425
|
+
}
|
|
426
|
+
function convertObjectToJSXAttributes(obj) {
|
|
427
|
+
const { content } = obj;
|
|
428
|
+
const parts = [];
|
|
429
|
+
const rest = [];
|
|
430
|
+
for (let i = 0; i < content.length; i++) {
|
|
431
|
+
if (i > 0)
|
|
432
|
+
parts.push(" ");
|
|
433
|
+
const part = content[i];
|
|
434
|
+
switch (part.type) {
|
|
435
|
+
case "Identifier":
|
|
436
|
+
parts.push([part.name, "={", part.name, "}"]);
|
|
437
|
+
break;
|
|
438
|
+
case "Property":
|
|
439
|
+
if (part.name.type === "ComputedPropertyName") {
|
|
440
|
+
rest.push(part);
|
|
441
|
+
} else {
|
|
442
|
+
parts.push([part.name, "={", insertTrimmingSpace(part.value, ""), "}"]);
|
|
443
|
+
}
|
|
444
|
+
break;
|
|
445
|
+
case "SpreadProperty":
|
|
446
|
+
parts.push(["{", part.dots, part.value, "}"]);
|
|
447
|
+
break;
|
|
448
|
+
case "MethodDefinition":
|
|
449
|
+
const func = convertMethodToFunction(part);
|
|
450
|
+
if (func) {
|
|
451
|
+
parts.push([part.name, "={", convertMethodToFunction(part), "}"]);
|
|
452
|
+
} else {
|
|
453
|
+
rest.push(part);
|
|
454
|
+
}
|
|
455
|
+
break;
|
|
456
|
+
default:
|
|
457
|
+
throw new Error(`invalid object literal type in JSX attribute: ${part.type}`);
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
if (rest.length) {
|
|
461
|
+
parts.push(["{...{", ...rest, "}}"]);
|
|
462
|
+
}
|
|
463
|
+
return parts;
|
|
464
|
+
}
|
|
389
465
|
function processCoffeeInterpolation(s, parts, e, $loc) {
|
|
390
466
|
if (parts.length === 0 || parts.length === 1 && parts[0].token != null) {
|
|
391
467
|
return {
|
|
@@ -475,6 +551,8 @@ var Civet = (() => {
|
|
|
475
551
|
};
|
|
476
552
|
}
|
|
477
553
|
function processUnaryExpression(pre, exp, post) {
|
|
554
|
+
if (!(pre.length || post))
|
|
555
|
+
return exp;
|
|
478
556
|
if (post?.token === "?") {
|
|
479
557
|
post = {
|
|
480
558
|
$loc: post.$loc,
|
|
@@ -524,26 +602,16 @@ var Civet = (() => {
|
|
|
524
602
|
};
|
|
525
603
|
}
|
|
526
604
|
}
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
return Object.assign({}, exp, { children });
|
|
532
|
-
} else if (Array.isArray(exp)) {
|
|
533
|
-
const children = [...pre, ...exp];
|
|
534
|
-
if (post)
|
|
535
|
-
children.push(post);
|
|
536
|
-
return { children };
|
|
537
|
-
} else {
|
|
538
|
-
const children = [...pre, exp];
|
|
539
|
-
if (post)
|
|
540
|
-
children.push(post);
|
|
541
|
-
return { children };
|
|
542
|
-
}
|
|
605
|
+
return {
|
|
606
|
+
type: "UnaryExpression",
|
|
607
|
+
children: [...pre, exp, post]
|
|
608
|
+
};
|
|
543
609
|
}
|
|
544
610
|
module.exports = {
|
|
545
611
|
blockWithPrefix,
|
|
546
612
|
clone,
|
|
613
|
+
convertMethodToFunction,
|
|
614
|
+
convertObjectToJSXAttributes,
|
|
547
615
|
deepCopy,
|
|
548
616
|
findAncestor,
|
|
549
617
|
forRange,
|
|
@@ -559,6 +627,7 @@ var Civet = (() => {
|
|
|
559
627
|
hoistRefDecs,
|
|
560
628
|
insertTrimmingSpace,
|
|
561
629
|
isFunction,
|
|
630
|
+
lastAccessInCallExpression,
|
|
562
631
|
literalValue,
|
|
563
632
|
modifyString,
|
|
564
633
|
processCoffeeInterpolation,
|
|
@@ -1062,6 +1131,7 @@ ${input.slice(result.pos)}
|
|
|
1062
1131
|
SliceParameters,
|
|
1063
1132
|
PropertyAccess,
|
|
1064
1133
|
PropertyGlob,
|
|
1134
|
+
PropertyBind,
|
|
1065
1135
|
SuperProperty,
|
|
1066
1136
|
MetaProperty,
|
|
1067
1137
|
ReturnValue,
|
|
@@ -1849,7 +1919,7 @@ ${input.slice(result.pos)}
|
|
|
1849
1919
|
var $R48 = $R(new RegExp("(?!\\p{ID_Continue})", "suy"));
|
|
1850
1920
|
var $R49 = $R(new RegExp("\\s", "suy"));
|
|
1851
1921
|
var $R50 = $R(new RegExp("(?:\\p{ID_Start}|[_$])(?:\\p{ID_Continue}|[\\u200C\\u200D$-])*", "suy"));
|
|
1852
|
-
var $R51 = $R(new RegExp("[\\s>]", "suy"));
|
|
1922
|
+
var $R51 = $R(new RegExp("[\\s>]|\\/>", "suy"));
|
|
1853
1923
|
var $R52 = $R(new RegExp("(?:[\\w\\-:]+|\\([^()]*\\)|\\[[^\\[\\]]*\\])+", "suy"));
|
|
1854
1924
|
var $R53 = $R(new RegExp(`"[^"]*"|'[^']*'`, "suy"));
|
|
1855
1925
|
var $R54 = $R(new RegExp("[<>]", "suy"));
|
|
@@ -3119,9 +3189,9 @@ ${input.slice(result.pos)}
|
|
|
3119
3189
|
return result;
|
|
3120
3190
|
}
|
|
3121
3191
|
}
|
|
3122
|
-
var FatArrow$0 = $TS($S(
|
|
3192
|
+
var FatArrow$0 = $TS($S($E(_), $EXPECT($L8, fail, 'FatArrow "=>"')), function($skip, $loc, $0, $1, $2) {
|
|
3123
3193
|
var ws = $1;
|
|
3124
|
-
if (!ws
|
|
3194
|
+
if (!ws)
|
|
3125
3195
|
return " =>";
|
|
3126
3196
|
return $0;
|
|
3127
3197
|
});
|
|
@@ -4132,11 +4202,8 @@ ${input.slice(result.pos)}
|
|
|
4132
4202
|
return result;
|
|
4133
4203
|
}
|
|
4134
4204
|
}
|
|
4135
|
-
var LeftHandSideExpression$0 = $
|
|
4136
|
-
|
|
4137
|
-
return $0;
|
|
4138
|
-
return $2;
|
|
4139
|
-
});
|
|
4205
|
+
var LeftHandSideExpression$0 = $S($P($S(New, $N($C($EXPECT($L5, fail, 'LeftHandSideExpression "."'), $EXPECT($L10, fail, 'LeftHandSideExpression ":"'))), __)), CallExpression, $E(TypeArguments));
|
|
4206
|
+
var LeftHandSideExpression$1 = CallExpression;
|
|
4140
4207
|
function LeftHandSideExpression(state) {
|
|
4141
4208
|
let eventData;
|
|
4142
4209
|
if (state.events) {
|
|
@@ -4148,12 +4215,12 @@ ${input.slice(result.pos)}
|
|
|
4148
4215
|
}
|
|
4149
4216
|
}
|
|
4150
4217
|
if (state.tokenize) {
|
|
4151
|
-
const result = $TOKEN("LeftHandSideExpression", state, LeftHandSideExpression$0(state));
|
|
4218
|
+
const result = $TOKEN("LeftHandSideExpression", state, LeftHandSideExpression$0(state) || LeftHandSideExpression$1(state));
|
|
4152
4219
|
if (state.events)
|
|
4153
4220
|
state.events.exit?.("LeftHandSideExpression", state, result, eventData);
|
|
4154
4221
|
return result;
|
|
4155
4222
|
} else {
|
|
4156
|
-
const result = LeftHandSideExpression$0(state);
|
|
4223
|
+
const result = LeftHandSideExpression$0(state) || LeftHandSideExpression$1(state);
|
|
4157
4224
|
if (state.events)
|
|
4158
4225
|
state.events.exit?.("LeftHandSideExpression", state, result, eventData);
|
|
4159
4226
|
return result;
|
|
@@ -4161,14 +4228,14 @@ ${input.slice(result.pos)}
|
|
|
4161
4228
|
}
|
|
4162
4229
|
var CallExpression$0 = $TS($S($EXPECT($L14, fail, 'CallExpression "super"'), ArgumentsWithTrailingMemberExpressions, $Q(CallExpressionRest)), function($skip, $loc, $0, $1, $2, $3) {
|
|
4163
4230
|
var rest = $3;
|
|
4164
|
-
return module.
|
|
4231
|
+
return module.processCallMemberExpression({
|
|
4165
4232
|
type: "CallExpression",
|
|
4166
4233
|
children: [$1, ...$2, ...rest.flat()]
|
|
4167
4234
|
});
|
|
4168
4235
|
});
|
|
4169
4236
|
var CallExpression$1 = $TS($S($EXPECT($L15, fail, 'CallExpression "import"'), ArgumentsWithTrailingMemberExpressions, $Q(CallExpressionRest)), function($skip, $loc, $0, $1, $2, $3) {
|
|
4170
4237
|
var rest = $3;
|
|
4171
|
-
return module.
|
|
4238
|
+
return module.processCallMemberExpression({
|
|
4172
4239
|
type: "CallExpression",
|
|
4173
4240
|
children: [$1, ...$2, ...rest.flat()]
|
|
4174
4241
|
});
|
|
@@ -4179,7 +4246,7 @@ ${input.slice(result.pos)}
|
|
|
4179
4246
|
var rest = $3;
|
|
4180
4247
|
if (rest.length || trailing.length) {
|
|
4181
4248
|
rest = rest.flat();
|
|
4182
|
-
return module.
|
|
4249
|
+
return module.processCallMemberExpression({
|
|
4183
4250
|
type: "CallExpression",
|
|
4184
4251
|
children: [member, ...trailing, ...rest]
|
|
4185
4252
|
});
|
|
@@ -4322,7 +4389,7 @@ ${input.slice(result.pos)}
|
|
|
4322
4389
|
var MemberExpression$0 = $TS($S($C(PrimaryExpression, SuperProperty, MetaProperty), $Q(MemberExpressionRest)), function($skip, $loc, $0, $1, $2) {
|
|
4323
4390
|
var rest = $2;
|
|
4324
4391
|
if (rest.length || Array.isArray($1)) {
|
|
4325
|
-
return module.
|
|
4392
|
+
return module.processCallMemberExpression({
|
|
4326
4393
|
type: "MemberExpression",
|
|
4327
4394
|
children: [$1, ...rest].flat()
|
|
4328
4395
|
});
|
|
@@ -4362,7 +4429,8 @@ ${input.slice(result.pos)}
|
|
|
4362
4429
|
});
|
|
4363
4430
|
var MemberExpressionRest$1 = PropertyAccess;
|
|
4364
4431
|
var MemberExpressionRest$2 = PropertyGlob;
|
|
4365
|
-
var MemberExpressionRest$3 =
|
|
4432
|
+
var MemberExpressionRest$3 = PropertyBind;
|
|
4433
|
+
var MemberExpressionRest$4 = NonNullAssertion;
|
|
4366
4434
|
function MemberExpressionRest(state) {
|
|
4367
4435
|
let eventData;
|
|
4368
4436
|
if (state.events) {
|
|
@@ -4374,12 +4442,12 @@ ${input.slice(result.pos)}
|
|
|
4374
4442
|
}
|
|
4375
4443
|
}
|
|
4376
4444
|
if (state.tokenize) {
|
|
4377
|
-
const result = $TOKEN("MemberExpressionRest", state, MemberExpressionRest$0(state) || MemberExpressionRest$1(state) || MemberExpressionRest$2(state) || MemberExpressionRest$3(state));
|
|
4445
|
+
const result = $TOKEN("MemberExpressionRest", state, MemberExpressionRest$0(state) || MemberExpressionRest$1(state) || MemberExpressionRest$2(state) || MemberExpressionRest$3(state) || MemberExpressionRest$4(state));
|
|
4378
4446
|
if (state.events)
|
|
4379
4447
|
state.events.exit?.("MemberExpressionRest", state, result, eventData);
|
|
4380
4448
|
return result;
|
|
4381
4449
|
} else {
|
|
4382
|
-
const result = MemberExpressionRest$0(state) || MemberExpressionRest$1(state) || MemberExpressionRest$2(state) || MemberExpressionRest$3(state);
|
|
4450
|
+
const result = MemberExpressionRest$0(state) || MemberExpressionRest$1(state) || MemberExpressionRest$2(state) || MemberExpressionRest$3(state) || MemberExpressionRest$4(state);
|
|
4383
4451
|
if (state.events)
|
|
4384
4452
|
state.events.exit?.("MemberExpressionRest", state, result, eventData);
|
|
4385
4453
|
return result;
|
|
@@ -4589,9 +4657,11 @@ ${input.slice(result.pos)}
|
|
|
4589
4657
|
}
|
|
4590
4658
|
}
|
|
4591
4659
|
var PropertyGlob$0 = $TS($S(OptionalDot, BracedObjectLiteral), function($skip, $loc, $0, $1, $2) {
|
|
4660
|
+
var dot = $1;
|
|
4592
4661
|
var object = $2;
|
|
4593
4662
|
return {
|
|
4594
4663
|
type: "PropertyGlob",
|
|
4664
|
+
dot,
|
|
4595
4665
|
object,
|
|
4596
4666
|
children: $0
|
|
4597
4667
|
};
|
|
@@ -4618,6 +4688,38 @@ ${input.slice(result.pos)}
|
|
|
4618
4688
|
return result;
|
|
4619
4689
|
}
|
|
4620
4690
|
}
|
|
4691
|
+
var PropertyBind$0 = $TS($S($E($C(QuestionMark, NonNullAssertion)), At, OptionalDot, $C(IdentifierName, PrivateIdentifier)), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
4692
|
+
var modifier = $1;
|
|
4693
|
+
var dot = $3;
|
|
4694
|
+
var id = $4;
|
|
4695
|
+
return {
|
|
4696
|
+
type: "PropertyBind",
|
|
4697
|
+
name: id.name,
|
|
4698
|
+
children: [modifier, dot, id]
|
|
4699
|
+
};
|
|
4700
|
+
});
|
|
4701
|
+
function PropertyBind(state) {
|
|
4702
|
+
let eventData;
|
|
4703
|
+
if (state.events) {
|
|
4704
|
+
const result = state.events.enter?.("PropertyBind", state);
|
|
4705
|
+
if (result) {
|
|
4706
|
+
if (result.cache)
|
|
4707
|
+
return result.cache;
|
|
4708
|
+
eventData = result.data;
|
|
4709
|
+
}
|
|
4710
|
+
}
|
|
4711
|
+
if (state.tokenize) {
|
|
4712
|
+
const result = $TOKEN("PropertyBind", state, PropertyBind$0(state));
|
|
4713
|
+
if (state.events)
|
|
4714
|
+
state.events.exit?.("PropertyBind", state, result, eventData);
|
|
4715
|
+
return result;
|
|
4716
|
+
} else {
|
|
4717
|
+
const result = PropertyBind$0(state);
|
|
4718
|
+
if (state.events)
|
|
4719
|
+
state.events.exit?.("PropertyBind", state, result, eventData);
|
|
4720
|
+
return result;
|
|
4721
|
+
}
|
|
4722
|
+
}
|
|
4621
4723
|
var SuperProperty$0 = $S($EXPECT($L14, fail, 'SuperProperty "super"'), MemberBracketContent);
|
|
4622
4724
|
var SuperProperty$1 = $S($EXPECT($L14, fail, 'SuperProperty "super"'), $N($C(QuestionMark, NonNullAssertion)), PropertyAccess);
|
|
4623
4725
|
function SuperProperty(state) {
|
|
@@ -4722,10 +4824,13 @@ ${input.slice(result.pos)}
|
|
|
4722
4824
|
}
|
|
4723
4825
|
}
|
|
4724
4826
|
var Parameters$0 = NonEmptyParameters;
|
|
4725
|
-
var Parameters$1 = $
|
|
4827
|
+
var Parameters$1 = $TS($S($E(TypeParameters), Loc), function($skip, $loc, $0, $1, $2) {
|
|
4828
|
+
var tp = $1;
|
|
4829
|
+
var p = $2;
|
|
4726
4830
|
return {
|
|
4727
4831
|
type: "Parameters",
|
|
4728
|
-
children: [{ $loc, token: "()" }],
|
|
4832
|
+
children: [tp, { $loc: p.$loc, token: "()" }],
|
|
4833
|
+
tp,
|
|
4729
4834
|
names: [],
|
|
4730
4835
|
implicit: true
|
|
4731
4836
|
};
|
|
@@ -4771,9 +4876,8 @@ ${input.slice(result.pos)}
|
|
|
4771
4876
|
}
|
|
4772
4877
|
let blockPrefix;
|
|
4773
4878
|
if (after.length) {
|
|
4774
|
-
const spliceRef = module.getRef("splice");
|
|
4775
4879
|
blockPrefix = {
|
|
4776
|
-
children: ["[", insertTrimmingSpace(after, ""), "] = ",
|
|
4880
|
+
children: ["[", insertTrimmingSpace(after, ""), "] = ", restIdentifier, ".splice(-", after.length.toString(), ")"],
|
|
4777
4881
|
names: after.flatMap((p) => p.names)
|
|
4778
4882
|
};
|
|
4779
4883
|
}
|
|
@@ -6157,7 +6261,7 @@ ${input.slice(result.pos)}
|
|
|
6157
6261
|
async,
|
|
6158
6262
|
generator,
|
|
6159
6263
|
block: null,
|
|
6160
|
-
children: !parameters.implicit ?
|
|
6264
|
+
children: !parameters.implicit ? [async, func, generator, wid, w, parameters, suffix] : [async, func, generator, wid, parameters, w, suffix]
|
|
6161
6265
|
};
|
|
6162
6266
|
});
|
|
6163
6267
|
function FunctionSignature(state) {
|
|
@@ -6470,7 +6574,7 @@ ${input.slice(result.pos)}
|
|
|
6470
6574
|
return result;
|
|
6471
6575
|
}
|
|
6472
6576
|
}
|
|
6473
|
-
var ThinArrowFunction$0 = $TS($S($E($S(Async, _)), Parameters, $E(ReturnTypeSuffix), $
|
|
6577
|
+
var ThinArrowFunction$0 = $TS($S($E($S(Async, _)), Parameters, $E(ReturnTypeSuffix), $E(_), Arrow, BracedOrEmptyBlock), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
|
|
6474
6578
|
var async = $1;
|
|
6475
6579
|
var parameters = $2;
|
|
6476
6580
|
var suffix = $3;
|
|
@@ -8136,11 +8240,11 @@ ${input.slice(result.pos)}
|
|
|
8136
8240
|
return result;
|
|
8137
8241
|
}
|
|
8138
8242
|
}
|
|
8139
|
-
var PropertyDefinition$0 = $TS($S(__,
|
|
8243
|
+
var PropertyDefinition$0 = $TS($S(__, AtThis, IdentifierReference), function($skip, $loc, $0, $1, $2, $3) {
|
|
8140
8244
|
var ws = $1;
|
|
8141
8245
|
var at = $2;
|
|
8142
8246
|
var id = $3;
|
|
8143
|
-
const value = [
|
|
8247
|
+
const value = [at, ".", id];
|
|
8144
8248
|
return {
|
|
8145
8249
|
type: "Property",
|
|
8146
8250
|
children: [ws, id, ": ", ...value],
|
|
@@ -8198,26 +8302,19 @@ ${input.slice(result.pos)}
|
|
|
8198
8302
|
if (value.type === "Identifier") {
|
|
8199
8303
|
return { ...value, children: [ws, ...value.children] };
|
|
8200
8304
|
}
|
|
8201
|
-
|
|
8202
|
-
|
|
8203
|
-
|
|
8204
|
-
i = children.length - 1;
|
|
8205
|
-
while (i >= 0 && (children[i].type === "Call" || children[i].type === "NonNullAssertion" || children[i].type === "Optional"))
|
|
8206
|
-
i--;
|
|
8207
|
-
if (i < 0)
|
|
8208
|
-
return $skip;
|
|
8209
|
-
} while (children[i].type === "MemberExpression" && (exp = children[i]));
|
|
8210
|
-
const last = children[i];
|
|
8305
|
+
const last = lastAccessInCallExpression(value);
|
|
8306
|
+
if (!last)
|
|
8307
|
+
return $skip;
|
|
8211
8308
|
let name;
|
|
8212
|
-
if (last.
|
|
8213
|
-
({ name } = last);
|
|
8214
|
-
} else if (last.type === "Index") {
|
|
8309
|
+
if (last.type === "Index") {
|
|
8215
8310
|
name = {
|
|
8216
8311
|
type: "ComputedPropertyName",
|
|
8217
8312
|
children: last.children
|
|
8218
8313
|
};
|
|
8219
8314
|
} else {
|
|
8220
|
-
|
|
8315
|
+
({ name } = last);
|
|
8316
|
+
if (!name)
|
|
8317
|
+
return $skip;
|
|
8221
8318
|
}
|
|
8222
8319
|
return {
|
|
8223
8320
|
type: "Property",
|
|
@@ -8542,7 +8639,7 @@ ${input.slice(result.pos)}
|
|
|
8542
8639
|
return result;
|
|
8543
8640
|
}
|
|
8544
8641
|
}
|
|
8545
|
-
var MethodModifier$0 = $TS($S(GetOrSet, $E(_)), function($skip, $loc, $0, $1, $2) {
|
|
8642
|
+
var MethodModifier$0 = $TS($S(GetOrSet, $E(_), $Y(ClassElementName)), function($skip, $loc, $0, $1, $2, $3) {
|
|
8546
8643
|
var kind = $1;
|
|
8547
8644
|
return {
|
|
8548
8645
|
type: "MethodModifier",
|
|
@@ -12523,7 +12620,7 @@ ${input.slice(result.pos)}
|
|
|
12523
12620
|
return result;
|
|
12524
12621
|
}
|
|
12525
12622
|
}
|
|
12526
|
-
var ExportDeclaration$0 = $TS($S(Export, __, Default, __, $C(HoistableDeclaration, ClassDeclaration, ExtendedExpression)), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
12623
|
+
var ExportDeclaration$0 = $TS($S($E(Decorators), Export, __, Default, __, $C(HoistableDeclaration, ClassDeclaration, ExtendedExpression)), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
|
|
12527
12624
|
return { type: "ExportDeclaration", children: $0 };
|
|
12528
12625
|
});
|
|
12529
12626
|
var ExportDeclaration$1 = $TS($S(Export, __, ExportFromClause, __, FromClause), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
@@ -17204,42 +17301,7 @@ ${input.slice(result.pos)}
|
|
|
17204
17301
|
}
|
|
17205
17302
|
}
|
|
17206
17303
|
var JSXAttribute$0 = $TS($S(BracedObjectLiteral), function($skip, $loc, $0, $1) {
|
|
17207
|
-
|
|
17208
|
-
const parts = [];
|
|
17209
|
-
const rest = [];
|
|
17210
|
-
for (let i = 1; i < children.length - 1; i++) {
|
|
17211
|
-
if (i > 1)
|
|
17212
|
-
parts.push(" ");
|
|
17213
|
-
const part = children[i];
|
|
17214
|
-
switch (part.type) {
|
|
17215
|
-
case "Identifier":
|
|
17216
|
-
parts.push([part.name, "={", part.name, "}"]);
|
|
17217
|
-
break;
|
|
17218
|
-
case "Property":
|
|
17219
|
-
if (part.name.type === "ComputedPropertyName") {
|
|
17220
|
-
rest.push(part);
|
|
17221
|
-
} else {
|
|
17222
|
-
parts.push([part.name, "={", insertTrimmingSpace(part.value, ""), "}"]);
|
|
17223
|
-
}
|
|
17224
|
-
break;
|
|
17225
|
-
case "SpreadProperty":
|
|
17226
|
-
parts.push(["{", part.dots, part.value, "}"]);
|
|
17227
|
-
break;
|
|
17228
|
-
case "MethodDefinition":
|
|
17229
|
-
try {
|
|
17230
|
-
parts.push([part.name, "={", module.convertMethodToFunction(part), "}"]);
|
|
17231
|
-
} catch {
|
|
17232
|
-
rest.push(part);
|
|
17233
|
-
}
|
|
17234
|
-
break;
|
|
17235
|
-
default:
|
|
17236
|
-
throw new Error(`invalid object literal type in JSX attribute: ${part.type}`);
|
|
17237
|
-
}
|
|
17238
|
-
}
|
|
17239
|
-
if (rest.length) {
|
|
17240
|
-
parts.push(["{...{", ...rest, "}}"]);
|
|
17241
|
-
}
|
|
17242
|
-
return parts;
|
|
17304
|
+
return convertObjectToJSXAttributes($1);
|
|
17243
17305
|
});
|
|
17244
17306
|
var JSXAttribute$1 = $TS($S(JSXAttributeName, $C(JSXAttributeInitializer, $Y(JSXAttributeSpace))), function($skip, $loc, $0, $1, $2) {
|
|
17245
17307
|
var name = $1;
|
|
@@ -17259,16 +17321,73 @@ ${input.slice(result.pos)}
|
|
|
17259
17321
|
}
|
|
17260
17322
|
});
|
|
17261
17323
|
var JSXAttribute$2 = $S(InsertInlineOpenBrace, DotDotDot, InlineJSXAttributeValue, InsertCloseBrace, $Y(JSXAttributeSpace));
|
|
17262
|
-
var JSXAttribute$3 = $TS($S($
|
|
17324
|
+
var JSXAttribute$3 = $TS($S(AtThis, $E(Identifier), $Q(InlineJSXCallExpressionRest), $Y(JSXAttributeSpace)), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
17325
|
+
var at = $1;
|
|
17326
|
+
var id = $2;
|
|
17327
|
+
var rest = $3;
|
|
17328
|
+
const access = id && {
|
|
17329
|
+
type: "PropertyAccess",
|
|
17330
|
+
children: [".", id],
|
|
17331
|
+
name: id
|
|
17332
|
+
};
|
|
17333
|
+
const expr = module.processCallMemberExpression({
|
|
17334
|
+
type: "CallExpression",
|
|
17335
|
+
children: [at, access, ...rest.flat()]
|
|
17336
|
+
});
|
|
17337
|
+
const last = lastAccessInCallExpression(expr);
|
|
17338
|
+
if (!last)
|
|
17339
|
+
return $skip;
|
|
17340
|
+
let name;
|
|
17341
|
+
if (last.type === "Index") {
|
|
17342
|
+
return [
|
|
17343
|
+
"{...{",
|
|
17344
|
+
{ ...last, type: "ComputedPropertyName" },
|
|
17345
|
+
": ",
|
|
17346
|
+
expr,
|
|
17347
|
+
"}}"
|
|
17348
|
+
];
|
|
17349
|
+
} else if (last.name) {
|
|
17350
|
+
return [last.name, "={", expr, "}"];
|
|
17351
|
+
}
|
|
17352
|
+
return $skip;
|
|
17353
|
+
});
|
|
17354
|
+
var JSXAttribute$4 = $TS($S(Identifier, $P(InlineJSXCallExpressionRest), $Y(JSXAttributeSpace)), function($skip, $loc, $0, $1, $2, $3) {
|
|
17355
|
+
var id = $1;
|
|
17356
|
+
var rest = $2;
|
|
17357
|
+
const expr = module.processCallMemberExpression({
|
|
17358
|
+
type: "CallExpression",
|
|
17359
|
+
children: [id, ...rest.flat()]
|
|
17360
|
+
});
|
|
17361
|
+
if (expr.type === "ObjectExpression") {
|
|
17362
|
+
return convertObjectToJSXAttributes(expr);
|
|
17363
|
+
}
|
|
17364
|
+
const last = lastAccessInCallExpression(expr);
|
|
17365
|
+
if (!last)
|
|
17366
|
+
return $skip;
|
|
17367
|
+
let name;
|
|
17368
|
+
if (last.type === "Index") {
|
|
17369
|
+
return [
|
|
17370
|
+
"{...{",
|
|
17371
|
+
{ ...last, type: "ComputedPropertyName" },
|
|
17372
|
+
": ",
|
|
17373
|
+
expr,
|
|
17374
|
+
"}}"
|
|
17375
|
+
];
|
|
17376
|
+
} else if (last.name) {
|
|
17377
|
+
return [last.name, "={", expr, "}"];
|
|
17378
|
+
}
|
|
17379
|
+
return $skip;
|
|
17380
|
+
});
|
|
17381
|
+
var JSXAttribute$5 = $TS($S($EXPECT($L13, fail, 'JSXAttribute "#"'), JSXShorthandString), function($skip, $loc, $0, $1, $2) {
|
|
17263
17382
|
return [" ", "id=", $2];
|
|
17264
17383
|
});
|
|
17265
|
-
var JSXAttribute$
|
|
17384
|
+
var JSXAttribute$6 = $TS($S(Dot, JSXShorthandString), function($skip, $loc, $0, $1, $2) {
|
|
17266
17385
|
return {
|
|
17267
17386
|
type: "JSXClass",
|
|
17268
17387
|
class: $2
|
|
17269
17388
|
};
|
|
17270
17389
|
});
|
|
17271
|
-
var JSXAttribute$
|
|
17390
|
+
var JSXAttribute$7 = $TS($S($TEXT($EXPECT($R6, fail, "JSXAttribute /[!+-]/")), JSXAttributeName, $Y(JSXAttributeSpace)), function($skip, $loc, $0, $1, $2, $3) {
|
|
17272
17391
|
var toggle = $1;
|
|
17273
17392
|
var id = $2;
|
|
17274
17393
|
const value = toggle === "+" ? "true" : "false";
|
|
@@ -17285,18 +17404,18 @@ ${input.slice(result.pos)}
|
|
|
17285
17404
|
}
|
|
17286
17405
|
}
|
|
17287
17406
|
if (state.tokenize) {
|
|
17288
|
-
const result = $TOKEN("JSXAttribute", state, JSXAttribute$0(state) || JSXAttribute$1(state) || JSXAttribute$2(state) || JSXAttribute$3(state) || JSXAttribute$4(state) || JSXAttribute$5(state));
|
|
17407
|
+
const result = $TOKEN("JSXAttribute", state, JSXAttribute$0(state) || JSXAttribute$1(state) || JSXAttribute$2(state) || JSXAttribute$3(state) || JSXAttribute$4(state) || JSXAttribute$5(state) || JSXAttribute$6(state) || JSXAttribute$7(state));
|
|
17289
17408
|
if (state.events)
|
|
17290
17409
|
state.events.exit?.("JSXAttribute", state, result, eventData);
|
|
17291
17410
|
return result;
|
|
17292
17411
|
} else {
|
|
17293
|
-
const result = JSXAttribute$0(state) || JSXAttribute$1(state) || JSXAttribute$2(state) || JSXAttribute$3(state) || JSXAttribute$4(state) || JSXAttribute$5(state);
|
|
17412
|
+
const result = JSXAttribute$0(state) || JSXAttribute$1(state) || JSXAttribute$2(state) || JSXAttribute$3(state) || JSXAttribute$4(state) || JSXAttribute$5(state) || JSXAttribute$6(state) || JSXAttribute$7(state);
|
|
17294
17413
|
if (state.events)
|
|
17295
17414
|
state.events.exit?.("JSXAttribute", state, result, eventData);
|
|
17296
17415
|
return result;
|
|
17297
17416
|
}
|
|
17298
17417
|
}
|
|
17299
|
-
var JSXAttributeSpace$0 = $R$0($EXPECT($R51, fail, "JSXAttributeSpace /[\\s>]
|
|
17418
|
+
var JSXAttributeSpace$0 = $R$0($EXPECT($R51, fail, "JSXAttributeSpace /[\\s>]|\\/>/"));
|
|
17300
17419
|
function JSXAttributeSpace(state) {
|
|
17301
17420
|
let eventData;
|
|
17302
17421
|
if (state.events) {
|
|
@@ -17399,11 +17518,14 @@ ${input.slice(result.pos)}
|
|
|
17399
17518
|
var JSXAttributeValue$0 = $S(OpenBrace, PostfixedExpression, $E(Whitespace), CloseBrace);
|
|
17400
17519
|
var JSXAttributeValue$1 = JSXElement;
|
|
17401
17520
|
var JSXAttributeValue$2 = JSXFragment;
|
|
17402
|
-
var JSXAttributeValue$3 = $TS($S(InsertInlineOpenBrace, InlineJSXAttributeValue, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3) {
|
|
17403
|
-
|
|
17521
|
+
var JSXAttributeValue$3 = $TS($S(InsertInlineOpenBrace, InlineJSXAttributeValue, InsertCloseBrace, $Y(JSXAttributeSpace)), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
17522
|
+
var open = $1;
|
|
17523
|
+
var value = $2;
|
|
17524
|
+
var close = $3;
|
|
17525
|
+
if (value.type === "StringLiteral") {
|
|
17404
17526
|
return $skip;
|
|
17405
17527
|
}
|
|
17406
|
-
return
|
|
17528
|
+
return [open, value, close];
|
|
17407
17529
|
});
|
|
17408
17530
|
var JSXAttributeValue$4 = $R$0($EXPECT($R53, fail, `JSXAttributeValue /"[^"]*"|'[^']*'/`));
|
|
17409
17531
|
function JSXAttributeValue(state) {
|
|
@@ -17586,12 +17708,41 @@ ${input.slice(result.pos)}
|
|
|
17586
17708
|
return result;
|
|
17587
17709
|
}
|
|
17588
17710
|
}
|
|
17589
|
-
var InlineJSXCallExpression$0 = $S($EXPECT($L14, fail, 'InlineJSXCallExpression "super"'), ExplicitArguments)
|
|
17590
|
-
|
|
17711
|
+
var InlineJSXCallExpression$0 = $TS($S($EXPECT($L14, fail, 'InlineJSXCallExpression "super"'), ExplicitArguments, $Q(InlineJSXCallExpressionRest)), function($skip, $loc, $0, $1, $2, $3) {
|
|
17712
|
+
var args = $2;
|
|
17713
|
+
var rest = $3;
|
|
17714
|
+
return module.processCallMemberExpression({
|
|
17715
|
+
type: "CallExpression",
|
|
17716
|
+
children: [
|
|
17717
|
+
$1,
|
|
17718
|
+
{ type: "Call", children: args },
|
|
17719
|
+
...rest.flat()
|
|
17720
|
+
]
|
|
17721
|
+
});
|
|
17722
|
+
});
|
|
17723
|
+
var InlineJSXCallExpression$1 = $TS($S($EXPECT($L15, fail, 'InlineJSXCallExpression "import"'), ExplicitArguments, $Q(InlineJSXCallExpressionRest)), function($skip, $loc, $0, $1, $2, $3) {
|
|
17724
|
+
var args = $2;
|
|
17725
|
+
var rest = $3;
|
|
17726
|
+
return module.processCallMemberExpression({
|
|
17727
|
+
type: "CallExpression",
|
|
17728
|
+
children: [
|
|
17729
|
+
$1,
|
|
17730
|
+
{ type: "Call", children: args },
|
|
17731
|
+
...rest.flat()
|
|
17732
|
+
]
|
|
17733
|
+
});
|
|
17734
|
+
});
|
|
17591
17735
|
var InlineJSXCallExpression$2 = $TS($S(InlineJSXMemberExpression, $Q(InlineJSXCallExpressionRest)), function($skip, $loc, $0, $1, $2) {
|
|
17592
|
-
|
|
17593
|
-
|
|
17594
|
-
|
|
17736
|
+
var member = $1;
|
|
17737
|
+
var rest = $2;
|
|
17738
|
+
if (rest.length) {
|
|
17739
|
+
rest = rest.flat();
|
|
17740
|
+
return module.processCallMemberExpression({
|
|
17741
|
+
type: "CallExpression",
|
|
17742
|
+
children: [member, ...rest]
|
|
17743
|
+
});
|
|
17744
|
+
}
|
|
17745
|
+
return member;
|
|
17595
17746
|
});
|
|
17596
17747
|
function InlineJSXCallExpression(state) {
|
|
17597
17748
|
let eventData;
|
|
@@ -17615,9 +17766,20 @@ ${input.slice(result.pos)}
|
|
|
17615
17766
|
return result;
|
|
17616
17767
|
}
|
|
17617
17768
|
}
|
|
17618
|
-
var InlineJSXCallExpressionRest$0 =
|
|
17619
|
-
var InlineJSXCallExpressionRest$1 = TemplateLiteral
|
|
17620
|
-
|
|
17769
|
+
var InlineJSXCallExpressionRest$0 = InlineJSXMemberExpressionRest;
|
|
17770
|
+
var InlineJSXCallExpressionRest$1 = $TV($C(TemplateLiteral, StringLiteral), function($skip, $loc, $0, $1) {
|
|
17771
|
+
if ($1.type === "StringLiteral") {
|
|
17772
|
+
return "`" + $1.token.slice(1, -1).replace(/(`|\$\{)/g, "\\$1") + "`";
|
|
17773
|
+
}
|
|
17774
|
+
return $1;
|
|
17775
|
+
});
|
|
17776
|
+
var InlineJSXCallExpressionRest$2 = $TS($S($E($C(OptionalShorthand, NonNullAssertion)), ExplicitArguments), function($skip, $loc, $0, $1, $2) {
|
|
17777
|
+
var args = $2;
|
|
17778
|
+
args = { type: "Call", children: args };
|
|
17779
|
+
if (!$1)
|
|
17780
|
+
return args;
|
|
17781
|
+
return [$1, args];
|
|
17782
|
+
});
|
|
17621
17783
|
function InlineJSXCallExpressionRest(state) {
|
|
17622
17784
|
let eventData;
|
|
17623
17785
|
if (state.events) {
|
|
@@ -17640,13 +17802,16 @@ ${input.slice(result.pos)}
|
|
|
17640
17802
|
return result;
|
|
17641
17803
|
}
|
|
17642
17804
|
}
|
|
17643
|
-
var InlineJSXMemberExpression$0 = $TS($S(InlineJSXPrimaryExpression, $Q(InlineJSXMemberExpressionRest)), function($skip, $loc, $0, $1, $2) {
|
|
17644
|
-
|
|
17645
|
-
|
|
17805
|
+
var InlineJSXMemberExpression$0 = $TS($S($C(InlineJSXPrimaryExpression, SuperProperty, MetaProperty), $Q(InlineJSXMemberExpressionRest)), function($skip, $loc, $0, $1, $2) {
|
|
17806
|
+
var rest = $2;
|
|
17807
|
+
if (rest.length || Array.isArray($1)) {
|
|
17808
|
+
return module.processCallMemberExpression({
|
|
17809
|
+
type: "MemberExpression",
|
|
17810
|
+
children: [$1, ...rest].flat()
|
|
17811
|
+
});
|
|
17812
|
+
}
|
|
17646
17813
|
return $1;
|
|
17647
17814
|
});
|
|
17648
|
-
var InlineJSXMemberExpression$1 = SuperProperty;
|
|
17649
|
-
var InlineJSXMemberExpression$2 = MetaProperty;
|
|
17650
17815
|
function InlineJSXMemberExpression(state) {
|
|
17651
17816
|
let eventData;
|
|
17652
17817
|
if (state.events) {
|
|
@@ -17658,12 +17823,12 @@ ${input.slice(result.pos)}
|
|
|
17658
17823
|
}
|
|
17659
17824
|
}
|
|
17660
17825
|
if (state.tokenize) {
|
|
17661
|
-
const result = $TOKEN("InlineJSXMemberExpression", state, InlineJSXMemberExpression$0(state)
|
|
17826
|
+
const result = $TOKEN("InlineJSXMemberExpression", state, InlineJSXMemberExpression$0(state));
|
|
17662
17827
|
if (state.events)
|
|
17663
17828
|
state.events.exit?.("InlineJSXMemberExpression", state, result, eventData);
|
|
17664
17829
|
return result;
|
|
17665
17830
|
} else {
|
|
17666
|
-
const result = InlineJSXMemberExpression$0(state)
|
|
17831
|
+
const result = InlineJSXMemberExpression$0(state);
|
|
17667
17832
|
if (state.events)
|
|
17668
17833
|
state.events.exit?.("InlineJSXMemberExpression", state, result, eventData);
|
|
17669
17834
|
return result;
|
|
@@ -17679,7 +17844,9 @@ ${input.slice(result.pos)}
|
|
|
17679
17844
|
return $2;
|
|
17680
17845
|
});
|
|
17681
17846
|
var InlineJSXMemberExpressionRest$1 = PropertyAccess;
|
|
17682
|
-
var InlineJSXMemberExpressionRest$2 =
|
|
17847
|
+
var InlineJSXMemberExpressionRest$2 = PropertyGlob;
|
|
17848
|
+
var InlineJSXMemberExpressionRest$3 = PropertyBind;
|
|
17849
|
+
var InlineJSXMemberExpressionRest$4 = NonNullAssertion;
|
|
17683
17850
|
function InlineJSXMemberExpressionRest(state) {
|
|
17684
17851
|
let eventData;
|
|
17685
17852
|
if (state.events) {
|
|
@@ -17691,12 +17858,12 @@ ${input.slice(result.pos)}
|
|
|
17691
17858
|
}
|
|
17692
17859
|
}
|
|
17693
17860
|
if (state.tokenize) {
|
|
17694
|
-
const result = $TOKEN("InlineJSXMemberExpressionRest", state, InlineJSXMemberExpressionRest$0(state) || InlineJSXMemberExpressionRest$1(state) || InlineJSXMemberExpressionRest$2(state));
|
|
17861
|
+
const result = $TOKEN("InlineJSXMemberExpressionRest", state, InlineJSXMemberExpressionRest$0(state) || InlineJSXMemberExpressionRest$1(state) || InlineJSXMemberExpressionRest$2(state) || InlineJSXMemberExpressionRest$3(state) || InlineJSXMemberExpressionRest$4(state));
|
|
17695
17862
|
if (state.events)
|
|
17696
17863
|
state.events.exit?.("InlineJSXMemberExpressionRest", state, result, eventData);
|
|
17697
17864
|
return result;
|
|
17698
17865
|
} else {
|
|
17699
|
-
const result = InlineJSXMemberExpressionRest$0(state) || InlineJSXMemberExpressionRest$1(state) || InlineJSXMemberExpressionRest$2(state);
|
|
17866
|
+
const result = InlineJSXMemberExpressionRest$0(state) || InlineJSXMemberExpressionRest$1(state) || InlineJSXMemberExpressionRest$2(state) || InlineJSXMemberExpressionRest$3(state) || InlineJSXMemberExpressionRest$4(state);
|
|
17700
17867
|
if (state.events)
|
|
17701
17868
|
state.events.exit?.("InlineJSXMemberExpressionRest", state, result, eventData);
|
|
17702
17869
|
return result;
|
|
@@ -19783,7 +19950,7 @@ ${input.slice(result.pos)}
|
|
|
19783
19950
|
return result;
|
|
19784
19951
|
}
|
|
19785
19952
|
}
|
|
19786
|
-
var TypeParameters$0 = $TS($S(
|
|
19953
|
+
var TypeParameters$0 = $TS($S($E(_), $EXPECT($L132, fail, 'TypeParameters "<"'), $P(TypeParameter), __, $EXPECT($L31, fail, 'TypeParameters ">"')), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
19787
19954
|
var parameters = $3;
|
|
19788
19955
|
return {
|
|
19789
19956
|
type: "TypeParameters",
|
|
@@ -19814,7 +19981,7 @@ ${input.slice(result.pos)}
|
|
|
19814
19981
|
return result;
|
|
19815
19982
|
}
|
|
19816
19983
|
}
|
|
19817
|
-
var TypeParameter$0 = $S(__, Identifier, $E(TypeConstraint), $E(TypeInitializer), TypeParameterDelimiter);
|
|
19984
|
+
var TypeParameter$0 = $S(__, $E($S($EXPECT($L129, fail, 'TypeParameter "const"'), $E(_))), Identifier, $E(TypeConstraint), $E(TypeInitializer), TypeParameterDelimiter);
|
|
19818
19985
|
function TypeParameter(state) {
|
|
19819
19986
|
let eventData;
|
|
19820
19987
|
if (state.events) {
|
|
@@ -21313,12 +21480,12 @@ ${input.slice(result.pos)}
|
|
|
21313
21480
|
Object.assign(module.config, directive.config);
|
|
21314
21481
|
}
|
|
21315
21482
|
});
|
|
21316
|
-
module.
|
|
21483
|
+
module.processCallMemberExpression = (node) => {
|
|
21317
21484
|
const { children } = node;
|
|
21318
21485
|
for (let i = 0; i < children.length; i++) {
|
|
21319
21486
|
const glob = children[i];
|
|
21320
21487
|
if (glob?.type === "PropertyGlob") {
|
|
21321
|
-
const prefix = children.slice(0, i).concat(glob.
|
|
21488
|
+
const prefix = children.slice(0, i).concat(glob.dot);
|
|
21322
21489
|
const parts = [];
|
|
21323
21490
|
for (const part of glob.object.content) {
|
|
21324
21491
|
if (part.type === "MethodDefinition") {
|
|
@@ -21343,7 +21510,7 @@ ${input.slice(result.pos)}
|
|
|
21343
21510
|
});
|
|
21344
21511
|
} else {
|
|
21345
21512
|
parts.push({
|
|
21346
|
-
type: part.type,
|
|
21513
|
+
type: part.type === "Identifier" ? "Property" : part.type,
|
|
21347
21514
|
name: part.name,
|
|
21348
21515
|
value,
|
|
21349
21516
|
delim: part.delim,
|
|
@@ -21361,6 +21528,7 @@ ${input.slice(result.pos)}
|
|
|
21361
21528
|
}
|
|
21362
21529
|
const object = {
|
|
21363
21530
|
type: "ObjectExpression",
|
|
21531
|
+
content: parts,
|
|
21364
21532
|
children: [
|
|
21365
21533
|
glob.object.children[0],
|
|
21366
21534
|
...parts,
|
|
@@ -21369,10 +21537,24 @@ ${input.slice(result.pos)}
|
|
|
21369
21537
|
};
|
|
21370
21538
|
if (i === children.length - 1)
|
|
21371
21539
|
return object;
|
|
21372
|
-
return module.
|
|
21540
|
+
return module.processCallMemberExpression({
|
|
21373
21541
|
...node,
|
|
21374
21542
|
children: [object, ...children.slice(i + 1)]
|
|
21375
21543
|
});
|
|
21544
|
+
} else if (glob?.type === "PropertyBind") {
|
|
21545
|
+
const prefix = children.slice(0, i);
|
|
21546
|
+
return module.processCallMemberExpression({
|
|
21547
|
+
...node,
|
|
21548
|
+
children: [
|
|
21549
|
+
prefix,
|
|
21550
|
+
{
|
|
21551
|
+
...glob,
|
|
21552
|
+
type: "PropertyAccess",
|
|
21553
|
+
children: [...glob.children, ".bind(", prefix, ")"]
|
|
21554
|
+
},
|
|
21555
|
+
...children.slice(i + 1)
|
|
21556
|
+
]
|
|
21557
|
+
});
|
|
21376
21558
|
}
|
|
21377
21559
|
}
|
|
21378
21560
|
return node;
|
|
@@ -21934,10 +22116,9 @@ ${input.slice(result.pos)}
|
|
|
21934
22116
|
names.push(...rest.names);
|
|
21935
22117
|
}
|
|
21936
22118
|
if (after.length) {
|
|
21937
|
-
const spliceRef = module.getRef("splice");
|
|
21938
22119
|
blockPrefix = {
|
|
21939
22120
|
type: "PostRestBindingElements",
|
|
21940
|
-
children: ["[", insertTrimmingSpace(after, ""), "] = ",
|
|
22121
|
+
children: ["[", insertTrimmingSpace(after, ""), "] = ", restIdentifier, ".splice(-", after.length.toString(), ")"],
|
|
21941
22122
|
names: after.flatMap((p) => p.names)
|
|
21942
22123
|
};
|
|
21943
22124
|
}
|
|
@@ -22298,16 +22479,6 @@ ${input.slice(result.pos)}
|
|
|
22298
22479
|
exp.children.push(...post);
|
|
22299
22480
|
});
|
|
22300
22481
|
}
|
|
22301
|
-
function checkSpliceRef(statements) {
|
|
22302
|
-
const spliceRef = module.getRef("splice");
|
|
22303
|
-
if (gatherRecursiveAll(statements, (n) => n === spliceRef).length) {
|
|
22304
|
-
const typeSuffix = {
|
|
22305
|
-
ts: true,
|
|
22306
|
-
children: [": <T>(this: T[], start: number, deleteCount?: number) => T[]"]
|
|
22307
|
-
};
|
|
22308
|
-
module.prelude.push(["", ["const ", spliceRef, typeSuffix, " = [].splice", module.asAny, "\n"]]);
|
|
22309
|
-
}
|
|
22310
|
-
}
|
|
22311
22482
|
module.attachPostfixStatementAsExpression = function(exp, post) {
|
|
22312
22483
|
let clause;
|
|
22313
22484
|
switch (post[1].type) {
|
|
@@ -22327,31 +22498,6 @@ ${input.slice(result.pos)}
|
|
|
22327
22498
|
throw new Error("Unknown postfix statement");
|
|
22328
22499
|
}
|
|
22329
22500
|
};
|
|
22330
|
-
module.convertMethodToFunction = function(method) {
|
|
22331
|
-
const { signature, block } = method;
|
|
22332
|
-
let { modifier } = signature;
|
|
22333
|
-
if (modifier) {
|
|
22334
|
-
if (modifier.get || modifier.set) {
|
|
22335
|
-
throw new Error("cannot convert get/set method to function");
|
|
22336
|
-
} else if (modifier.async) {
|
|
22337
|
-
modifier = [modifier.children[0][0], " function ", ...modifier.children.slice(1)];
|
|
22338
|
-
} else {
|
|
22339
|
-
modifier = ["function ", ...modifier.children];
|
|
22340
|
-
}
|
|
22341
|
-
} else {
|
|
22342
|
-
modifier = "function ";
|
|
22343
|
-
}
|
|
22344
|
-
return {
|
|
22345
|
-
...signature,
|
|
22346
|
-
id: signature.name,
|
|
22347
|
-
type: "FunctionExpression",
|
|
22348
|
-
children: [
|
|
22349
|
-
[modifier, ...signature.children.slice(1)],
|
|
22350
|
-
block
|
|
22351
|
-
],
|
|
22352
|
-
block
|
|
22353
|
-
};
|
|
22354
|
-
};
|
|
22355
22501
|
function getPatternConditions(pattern, ref, conditions) {
|
|
22356
22502
|
switch (pattern.type) {
|
|
22357
22503
|
case "ArrayMatchingPattern": {
|
|
@@ -22795,7 +22941,6 @@ ${input.slice(result.pos)}
|
|
|
22795
22941
|
processTryExpressions(statements);
|
|
22796
22942
|
hoistRefDecs(statements);
|
|
22797
22943
|
gatherRecursiveAll(statements, (n) => n.type === "IterationExpression").forEach((e) => expressionizeIteration(e));
|
|
22798
|
-
checkSpliceRef(statements);
|
|
22799
22944
|
statements.unshift(...module.prelude);
|
|
22800
22945
|
if (module.config.autoLet) {
|
|
22801
22946
|
createLetDecs(statements, []);
|
|
@@ -23325,6 +23470,8 @@ ${input.slice(result.pos)}
|
|
|
23325
23470
|
var {
|
|
23326
23471
|
blockWithPrefix,
|
|
23327
23472
|
clone,
|
|
23473
|
+
convertMethodToFunction,
|
|
23474
|
+
convertObjectToJSXAttributes,
|
|
23328
23475
|
deepCopy,
|
|
23329
23476
|
findAncestor,
|
|
23330
23477
|
forRange,
|
|
@@ -23340,6 +23487,7 @@ ${input.slice(result.pos)}
|
|
|
23340
23487
|
hoistRefDecs,
|
|
23341
23488
|
insertTrimmingSpace,
|
|
23342
23489
|
isFunction,
|
|
23490
|
+
lastAccessInCallExpression,
|
|
23343
23491
|
literalValue,
|
|
23344
23492
|
modifyString,
|
|
23345
23493
|
processCoffeeInterpolation,
|
|
@@ -23606,17 +23754,17 @@ ${input.slice(result.pos)}
|
|
|
23606
23754
|
smRegexp = /\n\/\/# sourceMappingURL=data:application\/json;charset=utf-8;base64,([+a-zA-Z0-9\/]*=?=?)$/;
|
|
23607
23755
|
SourceMap.remap = function(codeWithSourceMap, upstreamMap, sourcePath, targetPath) {
|
|
23608
23756
|
var codeWithoutSourceMap, composedLines, newSourceMap, parsed, remappedCodeWithSourceMap, remappedSourceMapJSON, sourceMapText;
|
|
23609
|
-
sourceMapText =
|
|
23757
|
+
sourceMapText = null;
|
|
23758
|
+
codeWithoutSourceMap = codeWithSourceMap.replace(smRegexp, (match, sm) => {
|
|
23759
|
+
sourceMapText = sm;
|
|
23760
|
+
return "";
|
|
23761
|
+
});
|
|
23610
23762
|
if (sourceMapText) {
|
|
23611
|
-
parsed = SourceMap.parseWithLines(sourceMapText
|
|
23612
|
-
|
|
23613
|
-
|
|
23614
|
-
return codeWithSourceMap;
|
|
23763
|
+
parsed = SourceMap.parseWithLines(sourceMapText);
|
|
23764
|
+
composedLines = SourceMap.composeLines(upstreamMap.data.lines, parsed.lines);
|
|
23765
|
+
upstreamMap.data.lines = composedLines;
|
|
23615
23766
|
}
|
|
23616
|
-
composedLines = SourceMap.composeLines(upstreamMap.data.lines, parsed.lines);
|
|
23617
|
-
upstreamMap.data.lines = composedLines;
|
|
23618
23767
|
remappedSourceMapJSON = upstreamMap.json(sourcePath, targetPath);
|
|
23619
|
-
codeWithoutSourceMap = codeWithSourceMap.replace(smRegexp, "");
|
|
23620
23768
|
newSourceMap = `${"sourceMapping"}URL=data:application/json;charset=utf-8;base64,${base64Encode(JSON.stringify(remappedSourceMapJSON))}`;
|
|
23621
23769
|
remappedCodeWithSourceMap = `${codeWithoutSourceMap}
|
|
23622
23770
|
//# ${newSourceMap}`;
|
|
@@ -23786,15 +23934,14 @@ ${input.slice(result.pos)}
|
|
|
23786
23934
|
// source/main.coffee
|
|
23787
23935
|
"civet coffeeCompat";
|
|
23788
23936
|
var SourceMap2;
|
|
23789
|
-
var base64Encode2;
|
|
23790
23937
|
var makeCache;
|
|
23791
23938
|
var parse;
|
|
23792
23939
|
var uncacheable;
|
|
23793
23940
|
({ parse } = import_parser.default);
|
|
23794
|
-
({ SourceMap: SourceMap2
|
|
23941
|
+
({ SourceMap: SourceMap2 } = util_exports);
|
|
23795
23942
|
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", "Dedented", "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", "NestedNonAssignmentExtendedExpression", "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"]);
|
|
23796
23943
|
var compile = function(src, options) {
|
|
23797
|
-
var ast, code, events, filename, ref, result, sm
|
|
23944
|
+
var ast, code, events, filename, ref, result, sm;
|
|
23798
23945
|
if (!options) {
|
|
23799
23946
|
options = {};
|
|
23800
23947
|
} else {
|
|
@@ -23816,10 +23963,7 @@ ${input.slice(result.pos)}
|
|
|
23816
23963
|
options.updateSourceMap = sm.updateSourceMap;
|
|
23817
23964
|
code = generate_default(ast, options);
|
|
23818
23965
|
if (options.inlineMap) {
|
|
23819
|
-
|
|
23820
|
-
return `${code}
|
|
23821
|
-
${"//#"} sourceMappingURL=data:application/json;base64,${base64Encode2(JSON.stringify(srcMapJSON))}
|
|
23822
|
-
`;
|
|
23966
|
+
return SourceMap2.remap(code, sm, filename, filename + ".tsx");
|
|
23823
23967
|
} else {
|
|
23824
23968
|
return {
|
|
23825
23969
|
code,
|