@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/main.mjs
CHANGED
|
@@ -383,6 +383,82 @@ var require_lib = __commonJS({
|
|
|
383
383
|
return '"' + str.replace(/"/g, '\\"') + '"';
|
|
384
384
|
}
|
|
385
385
|
}
|
|
386
|
+
function lastAccessInCallExpression(exp) {
|
|
387
|
+
let children, i;
|
|
388
|
+
do {
|
|
389
|
+
({ children } = exp);
|
|
390
|
+
i = children.length - 1;
|
|
391
|
+
while (i >= 0 && (children[i].type === "Call" || children[i].type === "NonNullAssertion" || children[i].type === "Optional"))
|
|
392
|
+
i--;
|
|
393
|
+
if (i < 0)
|
|
394
|
+
return;
|
|
395
|
+
} while (children[i].type === "MemberExpression" && (exp = children[i]));
|
|
396
|
+
return children[i];
|
|
397
|
+
}
|
|
398
|
+
function convertMethodToFunction(method) {
|
|
399
|
+
const { signature, block } = method;
|
|
400
|
+
let { modifier } = signature;
|
|
401
|
+
if (modifier) {
|
|
402
|
+
if (modifier.get || modifier.set) {
|
|
403
|
+
return;
|
|
404
|
+
} else if (modifier.async) {
|
|
405
|
+
modifier = [modifier.children[0][0], " function ", ...modifier.children.slice(1)];
|
|
406
|
+
} else {
|
|
407
|
+
modifier = ["function ", ...modifier.children];
|
|
408
|
+
}
|
|
409
|
+
} else {
|
|
410
|
+
modifier = "function ";
|
|
411
|
+
}
|
|
412
|
+
return {
|
|
413
|
+
...signature,
|
|
414
|
+
id: signature.name,
|
|
415
|
+
type: "FunctionExpression",
|
|
416
|
+
children: [
|
|
417
|
+
[modifier, ...signature.children.slice(1)],
|
|
418
|
+
block
|
|
419
|
+
],
|
|
420
|
+
block
|
|
421
|
+
};
|
|
422
|
+
}
|
|
423
|
+
function convertObjectToJSXAttributes(obj) {
|
|
424
|
+
const { content } = obj;
|
|
425
|
+
const parts = [];
|
|
426
|
+
const rest = [];
|
|
427
|
+
for (let i = 0; i < content.length; i++) {
|
|
428
|
+
if (i > 0)
|
|
429
|
+
parts.push(" ");
|
|
430
|
+
const part = content[i];
|
|
431
|
+
switch (part.type) {
|
|
432
|
+
case "Identifier":
|
|
433
|
+
parts.push([part.name, "={", part.name, "}"]);
|
|
434
|
+
break;
|
|
435
|
+
case "Property":
|
|
436
|
+
if (part.name.type === "ComputedPropertyName") {
|
|
437
|
+
rest.push(part);
|
|
438
|
+
} else {
|
|
439
|
+
parts.push([part.name, "={", insertTrimmingSpace(part.value, ""), "}"]);
|
|
440
|
+
}
|
|
441
|
+
break;
|
|
442
|
+
case "SpreadProperty":
|
|
443
|
+
parts.push(["{", part.dots, part.value, "}"]);
|
|
444
|
+
break;
|
|
445
|
+
case "MethodDefinition":
|
|
446
|
+
const func = convertMethodToFunction(part);
|
|
447
|
+
if (func) {
|
|
448
|
+
parts.push([part.name, "={", convertMethodToFunction(part), "}"]);
|
|
449
|
+
} else {
|
|
450
|
+
rest.push(part);
|
|
451
|
+
}
|
|
452
|
+
break;
|
|
453
|
+
default:
|
|
454
|
+
throw new Error(`invalid object literal type in JSX attribute: ${part.type}`);
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
if (rest.length) {
|
|
458
|
+
parts.push(["{...{", ...rest, "}}"]);
|
|
459
|
+
}
|
|
460
|
+
return parts;
|
|
461
|
+
}
|
|
386
462
|
function processCoffeeInterpolation(s, parts, e, $loc) {
|
|
387
463
|
if (parts.length === 0 || parts.length === 1 && parts[0].token != null) {
|
|
388
464
|
return {
|
|
@@ -472,6 +548,8 @@ var require_lib = __commonJS({
|
|
|
472
548
|
};
|
|
473
549
|
}
|
|
474
550
|
function processUnaryExpression(pre, exp, post) {
|
|
551
|
+
if (!(pre.length || post))
|
|
552
|
+
return exp;
|
|
475
553
|
if (post?.token === "?") {
|
|
476
554
|
post = {
|
|
477
555
|
$loc: post.$loc,
|
|
@@ -521,26 +599,16 @@ var require_lib = __commonJS({
|
|
|
521
599
|
};
|
|
522
600
|
}
|
|
523
601
|
}
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
return Object.assign({}, exp, { children });
|
|
529
|
-
} else if (Array.isArray(exp)) {
|
|
530
|
-
const children = [...pre, ...exp];
|
|
531
|
-
if (post)
|
|
532
|
-
children.push(post);
|
|
533
|
-
return { children };
|
|
534
|
-
} else {
|
|
535
|
-
const children = [...pre, exp];
|
|
536
|
-
if (post)
|
|
537
|
-
children.push(post);
|
|
538
|
-
return { children };
|
|
539
|
-
}
|
|
602
|
+
return {
|
|
603
|
+
type: "UnaryExpression",
|
|
604
|
+
children: [...pre, exp, post]
|
|
605
|
+
};
|
|
540
606
|
}
|
|
541
607
|
module.exports = {
|
|
542
608
|
blockWithPrefix,
|
|
543
609
|
clone,
|
|
610
|
+
convertMethodToFunction,
|
|
611
|
+
convertObjectToJSXAttributes,
|
|
544
612
|
deepCopy,
|
|
545
613
|
findAncestor,
|
|
546
614
|
forRange,
|
|
@@ -556,6 +624,7 @@ var require_lib = __commonJS({
|
|
|
556
624
|
hoistRefDecs,
|
|
557
625
|
insertTrimmingSpace,
|
|
558
626
|
isFunction,
|
|
627
|
+
lastAccessInCallExpression,
|
|
559
628
|
literalValue,
|
|
560
629
|
modifyString,
|
|
561
630
|
processCoffeeInterpolation,
|
|
@@ -1059,6 +1128,7 @@ ${input.slice(result.pos)}
|
|
|
1059
1128
|
SliceParameters,
|
|
1060
1129
|
PropertyAccess,
|
|
1061
1130
|
PropertyGlob,
|
|
1131
|
+
PropertyBind,
|
|
1062
1132
|
SuperProperty,
|
|
1063
1133
|
MetaProperty,
|
|
1064
1134
|
ReturnValue,
|
|
@@ -1846,7 +1916,7 @@ ${input.slice(result.pos)}
|
|
|
1846
1916
|
var $R48 = $R(new RegExp("(?!\\p{ID_Continue})", "suy"));
|
|
1847
1917
|
var $R49 = $R(new RegExp("\\s", "suy"));
|
|
1848
1918
|
var $R50 = $R(new RegExp("(?:\\p{ID_Start}|[_$])(?:\\p{ID_Continue}|[\\u200C\\u200D$-])*", "suy"));
|
|
1849
|
-
var $R51 = $R(new RegExp("[\\s>]", "suy"));
|
|
1919
|
+
var $R51 = $R(new RegExp("[\\s>]|\\/>", "suy"));
|
|
1850
1920
|
var $R52 = $R(new RegExp("(?:[\\w\\-:]+|\\([^()]*\\)|\\[[^\\[\\]]*\\])+", "suy"));
|
|
1851
1921
|
var $R53 = $R(new RegExp(`"[^"]*"|'[^']*'`, "suy"));
|
|
1852
1922
|
var $R54 = $R(new RegExp("[<>]", "suy"));
|
|
@@ -3116,9 +3186,9 @@ ${input.slice(result.pos)}
|
|
|
3116
3186
|
return result;
|
|
3117
3187
|
}
|
|
3118
3188
|
}
|
|
3119
|
-
var FatArrow$0 = $TS($S(
|
|
3189
|
+
var FatArrow$0 = $TS($S($E(_), $EXPECT($L8, fail, 'FatArrow "=>"')), function($skip, $loc, $0, $1, $2) {
|
|
3120
3190
|
var ws = $1;
|
|
3121
|
-
if (!ws
|
|
3191
|
+
if (!ws)
|
|
3122
3192
|
return " =>";
|
|
3123
3193
|
return $0;
|
|
3124
3194
|
});
|
|
@@ -4129,11 +4199,8 @@ ${input.slice(result.pos)}
|
|
|
4129
4199
|
return result;
|
|
4130
4200
|
}
|
|
4131
4201
|
}
|
|
4132
|
-
var LeftHandSideExpression$0 = $
|
|
4133
|
-
|
|
4134
|
-
return $0;
|
|
4135
|
-
return $2;
|
|
4136
|
-
});
|
|
4202
|
+
var LeftHandSideExpression$0 = $S($P($S(New, $N($C($EXPECT($L5, fail, 'LeftHandSideExpression "."'), $EXPECT($L10, fail, 'LeftHandSideExpression ":"'))), __)), CallExpression, $E(TypeArguments));
|
|
4203
|
+
var LeftHandSideExpression$1 = CallExpression;
|
|
4137
4204
|
function LeftHandSideExpression(state) {
|
|
4138
4205
|
let eventData;
|
|
4139
4206
|
if (state.events) {
|
|
@@ -4145,12 +4212,12 @@ ${input.slice(result.pos)}
|
|
|
4145
4212
|
}
|
|
4146
4213
|
}
|
|
4147
4214
|
if (state.tokenize) {
|
|
4148
|
-
const result = $TOKEN("LeftHandSideExpression", state, LeftHandSideExpression$0(state));
|
|
4215
|
+
const result = $TOKEN("LeftHandSideExpression", state, LeftHandSideExpression$0(state) || LeftHandSideExpression$1(state));
|
|
4149
4216
|
if (state.events)
|
|
4150
4217
|
state.events.exit?.("LeftHandSideExpression", state, result, eventData);
|
|
4151
4218
|
return result;
|
|
4152
4219
|
} else {
|
|
4153
|
-
const result = LeftHandSideExpression$0(state);
|
|
4220
|
+
const result = LeftHandSideExpression$0(state) || LeftHandSideExpression$1(state);
|
|
4154
4221
|
if (state.events)
|
|
4155
4222
|
state.events.exit?.("LeftHandSideExpression", state, result, eventData);
|
|
4156
4223
|
return result;
|
|
@@ -4158,14 +4225,14 @@ ${input.slice(result.pos)}
|
|
|
4158
4225
|
}
|
|
4159
4226
|
var CallExpression$0 = $TS($S($EXPECT($L14, fail, 'CallExpression "super"'), ArgumentsWithTrailingMemberExpressions, $Q(CallExpressionRest)), function($skip, $loc, $0, $1, $2, $3) {
|
|
4160
4227
|
var rest = $3;
|
|
4161
|
-
return module.
|
|
4228
|
+
return module.processCallMemberExpression({
|
|
4162
4229
|
type: "CallExpression",
|
|
4163
4230
|
children: [$1, ...$2, ...rest.flat()]
|
|
4164
4231
|
});
|
|
4165
4232
|
});
|
|
4166
4233
|
var CallExpression$1 = $TS($S($EXPECT($L15, fail, 'CallExpression "import"'), ArgumentsWithTrailingMemberExpressions, $Q(CallExpressionRest)), function($skip, $loc, $0, $1, $2, $3) {
|
|
4167
4234
|
var rest = $3;
|
|
4168
|
-
return module.
|
|
4235
|
+
return module.processCallMemberExpression({
|
|
4169
4236
|
type: "CallExpression",
|
|
4170
4237
|
children: [$1, ...$2, ...rest.flat()]
|
|
4171
4238
|
});
|
|
@@ -4176,7 +4243,7 @@ ${input.slice(result.pos)}
|
|
|
4176
4243
|
var rest = $3;
|
|
4177
4244
|
if (rest.length || trailing.length) {
|
|
4178
4245
|
rest = rest.flat();
|
|
4179
|
-
return module.
|
|
4246
|
+
return module.processCallMemberExpression({
|
|
4180
4247
|
type: "CallExpression",
|
|
4181
4248
|
children: [member, ...trailing, ...rest]
|
|
4182
4249
|
});
|
|
@@ -4319,7 +4386,7 @@ ${input.slice(result.pos)}
|
|
|
4319
4386
|
var MemberExpression$0 = $TS($S($C(PrimaryExpression, SuperProperty, MetaProperty), $Q(MemberExpressionRest)), function($skip, $loc, $0, $1, $2) {
|
|
4320
4387
|
var rest = $2;
|
|
4321
4388
|
if (rest.length || Array.isArray($1)) {
|
|
4322
|
-
return module.
|
|
4389
|
+
return module.processCallMemberExpression({
|
|
4323
4390
|
type: "MemberExpression",
|
|
4324
4391
|
children: [$1, ...rest].flat()
|
|
4325
4392
|
});
|
|
@@ -4359,7 +4426,8 @@ ${input.slice(result.pos)}
|
|
|
4359
4426
|
});
|
|
4360
4427
|
var MemberExpressionRest$1 = PropertyAccess;
|
|
4361
4428
|
var MemberExpressionRest$2 = PropertyGlob;
|
|
4362
|
-
var MemberExpressionRest$3 =
|
|
4429
|
+
var MemberExpressionRest$3 = PropertyBind;
|
|
4430
|
+
var MemberExpressionRest$4 = NonNullAssertion;
|
|
4363
4431
|
function MemberExpressionRest(state) {
|
|
4364
4432
|
let eventData;
|
|
4365
4433
|
if (state.events) {
|
|
@@ -4371,12 +4439,12 @@ ${input.slice(result.pos)}
|
|
|
4371
4439
|
}
|
|
4372
4440
|
}
|
|
4373
4441
|
if (state.tokenize) {
|
|
4374
|
-
const result = $TOKEN("MemberExpressionRest", state, MemberExpressionRest$0(state) || MemberExpressionRest$1(state) || MemberExpressionRest$2(state) || MemberExpressionRest$3(state));
|
|
4442
|
+
const result = $TOKEN("MemberExpressionRest", state, MemberExpressionRest$0(state) || MemberExpressionRest$1(state) || MemberExpressionRest$2(state) || MemberExpressionRest$3(state) || MemberExpressionRest$4(state));
|
|
4375
4443
|
if (state.events)
|
|
4376
4444
|
state.events.exit?.("MemberExpressionRest", state, result, eventData);
|
|
4377
4445
|
return result;
|
|
4378
4446
|
} else {
|
|
4379
|
-
const result = MemberExpressionRest$0(state) || MemberExpressionRest$1(state) || MemberExpressionRest$2(state) || MemberExpressionRest$3(state);
|
|
4447
|
+
const result = MemberExpressionRest$0(state) || MemberExpressionRest$1(state) || MemberExpressionRest$2(state) || MemberExpressionRest$3(state) || MemberExpressionRest$4(state);
|
|
4380
4448
|
if (state.events)
|
|
4381
4449
|
state.events.exit?.("MemberExpressionRest", state, result, eventData);
|
|
4382
4450
|
return result;
|
|
@@ -4586,9 +4654,11 @@ ${input.slice(result.pos)}
|
|
|
4586
4654
|
}
|
|
4587
4655
|
}
|
|
4588
4656
|
var PropertyGlob$0 = $TS($S(OptionalDot, BracedObjectLiteral), function($skip, $loc, $0, $1, $2) {
|
|
4657
|
+
var dot = $1;
|
|
4589
4658
|
var object = $2;
|
|
4590
4659
|
return {
|
|
4591
4660
|
type: "PropertyGlob",
|
|
4661
|
+
dot,
|
|
4592
4662
|
object,
|
|
4593
4663
|
children: $0
|
|
4594
4664
|
};
|
|
@@ -4615,6 +4685,38 @@ ${input.slice(result.pos)}
|
|
|
4615
4685
|
return result;
|
|
4616
4686
|
}
|
|
4617
4687
|
}
|
|
4688
|
+
var PropertyBind$0 = $TS($S($E($C(QuestionMark, NonNullAssertion)), At, OptionalDot, $C(IdentifierName, PrivateIdentifier)), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
4689
|
+
var modifier = $1;
|
|
4690
|
+
var dot = $3;
|
|
4691
|
+
var id = $4;
|
|
4692
|
+
return {
|
|
4693
|
+
type: "PropertyBind",
|
|
4694
|
+
name: id.name,
|
|
4695
|
+
children: [modifier, dot, id]
|
|
4696
|
+
};
|
|
4697
|
+
});
|
|
4698
|
+
function PropertyBind(state) {
|
|
4699
|
+
let eventData;
|
|
4700
|
+
if (state.events) {
|
|
4701
|
+
const result = state.events.enter?.("PropertyBind", state);
|
|
4702
|
+
if (result) {
|
|
4703
|
+
if (result.cache)
|
|
4704
|
+
return result.cache;
|
|
4705
|
+
eventData = result.data;
|
|
4706
|
+
}
|
|
4707
|
+
}
|
|
4708
|
+
if (state.tokenize) {
|
|
4709
|
+
const result = $TOKEN("PropertyBind", state, PropertyBind$0(state));
|
|
4710
|
+
if (state.events)
|
|
4711
|
+
state.events.exit?.("PropertyBind", state, result, eventData);
|
|
4712
|
+
return result;
|
|
4713
|
+
} else {
|
|
4714
|
+
const result = PropertyBind$0(state);
|
|
4715
|
+
if (state.events)
|
|
4716
|
+
state.events.exit?.("PropertyBind", state, result, eventData);
|
|
4717
|
+
return result;
|
|
4718
|
+
}
|
|
4719
|
+
}
|
|
4618
4720
|
var SuperProperty$0 = $S($EXPECT($L14, fail, 'SuperProperty "super"'), MemberBracketContent);
|
|
4619
4721
|
var SuperProperty$1 = $S($EXPECT($L14, fail, 'SuperProperty "super"'), $N($C(QuestionMark, NonNullAssertion)), PropertyAccess);
|
|
4620
4722
|
function SuperProperty(state) {
|
|
@@ -4719,10 +4821,13 @@ ${input.slice(result.pos)}
|
|
|
4719
4821
|
}
|
|
4720
4822
|
}
|
|
4721
4823
|
var Parameters$0 = NonEmptyParameters;
|
|
4722
|
-
var Parameters$1 = $
|
|
4824
|
+
var Parameters$1 = $TS($S($E(TypeParameters), Loc), function($skip, $loc, $0, $1, $2) {
|
|
4825
|
+
var tp = $1;
|
|
4826
|
+
var p = $2;
|
|
4723
4827
|
return {
|
|
4724
4828
|
type: "Parameters",
|
|
4725
|
-
children: [{ $loc, token: "()" }],
|
|
4829
|
+
children: [tp, { $loc: p.$loc, token: "()" }],
|
|
4830
|
+
tp,
|
|
4726
4831
|
names: [],
|
|
4727
4832
|
implicit: true
|
|
4728
4833
|
};
|
|
@@ -4768,9 +4873,8 @@ ${input.slice(result.pos)}
|
|
|
4768
4873
|
}
|
|
4769
4874
|
let blockPrefix;
|
|
4770
4875
|
if (after.length) {
|
|
4771
|
-
const spliceRef = module.getRef("splice");
|
|
4772
4876
|
blockPrefix = {
|
|
4773
|
-
children: ["[", insertTrimmingSpace(after, ""), "] = ",
|
|
4877
|
+
children: ["[", insertTrimmingSpace(after, ""), "] = ", restIdentifier, ".splice(-", after.length.toString(), ")"],
|
|
4774
4878
|
names: after.flatMap((p) => p.names)
|
|
4775
4879
|
};
|
|
4776
4880
|
}
|
|
@@ -6154,7 +6258,7 @@ ${input.slice(result.pos)}
|
|
|
6154
6258
|
async,
|
|
6155
6259
|
generator,
|
|
6156
6260
|
block: null,
|
|
6157
|
-
children: !parameters.implicit ?
|
|
6261
|
+
children: !parameters.implicit ? [async, func, generator, wid, w, parameters, suffix] : [async, func, generator, wid, parameters, w, suffix]
|
|
6158
6262
|
};
|
|
6159
6263
|
});
|
|
6160
6264
|
function FunctionSignature(state) {
|
|
@@ -6467,7 +6571,7 @@ ${input.slice(result.pos)}
|
|
|
6467
6571
|
return result;
|
|
6468
6572
|
}
|
|
6469
6573
|
}
|
|
6470
|
-
var ThinArrowFunction$0 = $TS($S($E($S(Async, _)), Parameters, $E(ReturnTypeSuffix), $
|
|
6574
|
+
var ThinArrowFunction$0 = $TS($S($E($S(Async, _)), Parameters, $E(ReturnTypeSuffix), $E(_), Arrow, BracedOrEmptyBlock), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
|
|
6471
6575
|
var async = $1;
|
|
6472
6576
|
var parameters = $2;
|
|
6473
6577
|
var suffix = $3;
|
|
@@ -8133,11 +8237,11 @@ ${input.slice(result.pos)}
|
|
|
8133
8237
|
return result;
|
|
8134
8238
|
}
|
|
8135
8239
|
}
|
|
8136
|
-
var PropertyDefinition$0 = $TS($S(__,
|
|
8240
|
+
var PropertyDefinition$0 = $TS($S(__, AtThis, IdentifierReference), function($skip, $loc, $0, $1, $2, $3) {
|
|
8137
8241
|
var ws = $1;
|
|
8138
8242
|
var at = $2;
|
|
8139
8243
|
var id = $3;
|
|
8140
|
-
const value = [
|
|
8244
|
+
const value = [at, ".", id];
|
|
8141
8245
|
return {
|
|
8142
8246
|
type: "Property",
|
|
8143
8247
|
children: [ws, id, ": ", ...value],
|
|
@@ -8195,26 +8299,19 @@ ${input.slice(result.pos)}
|
|
|
8195
8299
|
if (value.type === "Identifier") {
|
|
8196
8300
|
return { ...value, children: [ws, ...value.children] };
|
|
8197
8301
|
}
|
|
8198
|
-
|
|
8199
|
-
|
|
8200
|
-
|
|
8201
|
-
i = children.length - 1;
|
|
8202
|
-
while (i >= 0 && (children[i].type === "Call" || children[i].type === "NonNullAssertion" || children[i].type === "Optional"))
|
|
8203
|
-
i--;
|
|
8204
|
-
if (i < 0)
|
|
8205
|
-
return $skip;
|
|
8206
|
-
} while (children[i].type === "MemberExpression" && (exp = children[i]));
|
|
8207
|
-
const last = children[i];
|
|
8302
|
+
const last = lastAccessInCallExpression(value);
|
|
8303
|
+
if (!last)
|
|
8304
|
+
return $skip;
|
|
8208
8305
|
let name;
|
|
8209
|
-
if (last.
|
|
8210
|
-
({ name } = last);
|
|
8211
|
-
} else if (last.type === "Index") {
|
|
8306
|
+
if (last.type === "Index") {
|
|
8212
8307
|
name = {
|
|
8213
8308
|
type: "ComputedPropertyName",
|
|
8214
8309
|
children: last.children
|
|
8215
8310
|
};
|
|
8216
8311
|
} else {
|
|
8217
|
-
|
|
8312
|
+
({ name } = last);
|
|
8313
|
+
if (!name)
|
|
8314
|
+
return $skip;
|
|
8218
8315
|
}
|
|
8219
8316
|
return {
|
|
8220
8317
|
type: "Property",
|
|
@@ -8539,7 +8636,7 @@ ${input.slice(result.pos)}
|
|
|
8539
8636
|
return result;
|
|
8540
8637
|
}
|
|
8541
8638
|
}
|
|
8542
|
-
var MethodModifier$0 = $TS($S(GetOrSet, $E(_)), function($skip, $loc, $0, $1, $2) {
|
|
8639
|
+
var MethodModifier$0 = $TS($S(GetOrSet, $E(_), $Y(ClassElementName)), function($skip, $loc, $0, $1, $2, $3) {
|
|
8543
8640
|
var kind = $1;
|
|
8544
8641
|
return {
|
|
8545
8642
|
type: "MethodModifier",
|
|
@@ -12520,7 +12617,7 @@ ${input.slice(result.pos)}
|
|
|
12520
12617
|
return result;
|
|
12521
12618
|
}
|
|
12522
12619
|
}
|
|
12523
|
-
var ExportDeclaration$0 = $TS($S(Export, __, Default, __, $C(HoistableDeclaration, ClassDeclaration, ExtendedExpression)), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
12620
|
+
var ExportDeclaration$0 = $TS($S($E(Decorators), Export, __, Default, __, $C(HoistableDeclaration, ClassDeclaration, ExtendedExpression)), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
|
|
12524
12621
|
return { type: "ExportDeclaration", children: $0 };
|
|
12525
12622
|
});
|
|
12526
12623
|
var ExportDeclaration$1 = $TS($S(Export, __, ExportFromClause, __, FromClause), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
@@ -17201,42 +17298,7 @@ ${input.slice(result.pos)}
|
|
|
17201
17298
|
}
|
|
17202
17299
|
}
|
|
17203
17300
|
var JSXAttribute$0 = $TS($S(BracedObjectLiteral), function($skip, $loc, $0, $1) {
|
|
17204
|
-
|
|
17205
|
-
const parts = [];
|
|
17206
|
-
const rest = [];
|
|
17207
|
-
for (let i = 1; i < children.length - 1; i++) {
|
|
17208
|
-
if (i > 1)
|
|
17209
|
-
parts.push(" ");
|
|
17210
|
-
const part = children[i];
|
|
17211
|
-
switch (part.type) {
|
|
17212
|
-
case "Identifier":
|
|
17213
|
-
parts.push([part.name, "={", part.name, "}"]);
|
|
17214
|
-
break;
|
|
17215
|
-
case "Property":
|
|
17216
|
-
if (part.name.type === "ComputedPropertyName") {
|
|
17217
|
-
rest.push(part);
|
|
17218
|
-
} else {
|
|
17219
|
-
parts.push([part.name, "={", insertTrimmingSpace(part.value, ""), "}"]);
|
|
17220
|
-
}
|
|
17221
|
-
break;
|
|
17222
|
-
case "SpreadProperty":
|
|
17223
|
-
parts.push(["{", part.dots, part.value, "}"]);
|
|
17224
|
-
break;
|
|
17225
|
-
case "MethodDefinition":
|
|
17226
|
-
try {
|
|
17227
|
-
parts.push([part.name, "={", module.convertMethodToFunction(part), "}"]);
|
|
17228
|
-
} catch {
|
|
17229
|
-
rest.push(part);
|
|
17230
|
-
}
|
|
17231
|
-
break;
|
|
17232
|
-
default:
|
|
17233
|
-
throw new Error(`invalid object literal type in JSX attribute: ${part.type}`);
|
|
17234
|
-
}
|
|
17235
|
-
}
|
|
17236
|
-
if (rest.length) {
|
|
17237
|
-
parts.push(["{...{", ...rest, "}}"]);
|
|
17238
|
-
}
|
|
17239
|
-
return parts;
|
|
17301
|
+
return convertObjectToJSXAttributes($1);
|
|
17240
17302
|
});
|
|
17241
17303
|
var JSXAttribute$1 = $TS($S(JSXAttributeName, $C(JSXAttributeInitializer, $Y(JSXAttributeSpace))), function($skip, $loc, $0, $1, $2) {
|
|
17242
17304
|
var name = $1;
|
|
@@ -17256,16 +17318,73 @@ ${input.slice(result.pos)}
|
|
|
17256
17318
|
}
|
|
17257
17319
|
});
|
|
17258
17320
|
var JSXAttribute$2 = $S(InsertInlineOpenBrace, DotDotDot, InlineJSXAttributeValue, InsertCloseBrace, $Y(JSXAttributeSpace));
|
|
17259
|
-
var JSXAttribute$3 = $TS($S($
|
|
17321
|
+
var JSXAttribute$3 = $TS($S(AtThis, $E(Identifier), $Q(InlineJSXCallExpressionRest), $Y(JSXAttributeSpace)), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
17322
|
+
var at = $1;
|
|
17323
|
+
var id = $2;
|
|
17324
|
+
var rest = $3;
|
|
17325
|
+
const access = id && {
|
|
17326
|
+
type: "PropertyAccess",
|
|
17327
|
+
children: [".", id],
|
|
17328
|
+
name: id
|
|
17329
|
+
};
|
|
17330
|
+
const expr = module.processCallMemberExpression({
|
|
17331
|
+
type: "CallExpression",
|
|
17332
|
+
children: [at, access, ...rest.flat()]
|
|
17333
|
+
});
|
|
17334
|
+
const last = lastAccessInCallExpression(expr);
|
|
17335
|
+
if (!last)
|
|
17336
|
+
return $skip;
|
|
17337
|
+
let name;
|
|
17338
|
+
if (last.type === "Index") {
|
|
17339
|
+
return [
|
|
17340
|
+
"{...{",
|
|
17341
|
+
{ ...last, type: "ComputedPropertyName" },
|
|
17342
|
+
": ",
|
|
17343
|
+
expr,
|
|
17344
|
+
"}}"
|
|
17345
|
+
];
|
|
17346
|
+
} else if (last.name) {
|
|
17347
|
+
return [last.name, "={", expr, "}"];
|
|
17348
|
+
}
|
|
17349
|
+
return $skip;
|
|
17350
|
+
});
|
|
17351
|
+
var JSXAttribute$4 = $TS($S(Identifier, $P(InlineJSXCallExpressionRest), $Y(JSXAttributeSpace)), function($skip, $loc, $0, $1, $2, $3) {
|
|
17352
|
+
var id = $1;
|
|
17353
|
+
var rest = $2;
|
|
17354
|
+
const expr = module.processCallMemberExpression({
|
|
17355
|
+
type: "CallExpression",
|
|
17356
|
+
children: [id, ...rest.flat()]
|
|
17357
|
+
});
|
|
17358
|
+
if (expr.type === "ObjectExpression") {
|
|
17359
|
+
return convertObjectToJSXAttributes(expr);
|
|
17360
|
+
}
|
|
17361
|
+
const last = lastAccessInCallExpression(expr);
|
|
17362
|
+
if (!last)
|
|
17363
|
+
return $skip;
|
|
17364
|
+
let name;
|
|
17365
|
+
if (last.type === "Index") {
|
|
17366
|
+
return [
|
|
17367
|
+
"{...{",
|
|
17368
|
+
{ ...last, type: "ComputedPropertyName" },
|
|
17369
|
+
": ",
|
|
17370
|
+
expr,
|
|
17371
|
+
"}}"
|
|
17372
|
+
];
|
|
17373
|
+
} else if (last.name) {
|
|
17374
|
+
return [last.name, "={", expr, "}"];
|
|
17375
|
+
}
|
|
17376
|
+
return $skip;
|
|
17377
|
+
});
|
|
17378
|
+
var JSXAttribute$5 = $TS($S($EXPECT($L13, fail, 'JSXAttribute "#"'), JSXShorthandString), function($skip, $loc, $0, $1, $2) {
|
|
17260
17379
|
return [" ", "id=", $2];
|
|
17261
17380
|
});
|
|
17262
|
-
var JSXAttribute$
|
|
17381
|
+
var JSXAttribute$6 = $TS($S(Dot, JSXShorthandString), function($skip, $loc, $0, $1, $2) {
|
|
17263
17382
|
return {
|
|
17264
17383
|
type: "JSXClass",
|
|
17265
17384
|
class: $2
|
|
17266
17385
|
};
|
|
17267
17386
|
});
|
|
17268
|
-
var JSXAttribute$
|
|
17387
|
+
var JSXAttribute$7 = $TS($S($TEXT($EXPECT($R6, fail, "JSXAttribute /[!+-]/")), JSXAttributeName, $Y(JSXAttributeSpace)), function($skip, $loc, $0, $1, $2, $3) {
|
|
17269
17388
|
var toggle = $1;
|
|
17270
17389
|
var id = $2;
|
|
17271
17390
|
const value = toggle === "+" ? "true" : "false";
|
|
@@ -17282,18 +17401,18 @@ ${input.slice(result.pos)}
|
|
|
17282
17401
|
}
|
|
17283
17402
|
}
|
|
17284
17403
|
if (state.tokenize) {
|
|
17285
|
-
const result = $TOKEN("JSXAttribute", state, JSXAttribute$0(state) || JSXAttribute$1(state) || JSXAttribute$2(state) || JSXAttribute$3(state) || JSXAttribute$4(state) || JSXAttribute$5(state));
|
|
17404
|
+
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));
|
|
17286
17405
|
if (state.events)
|
|
17287
17406
|
state.events.exit?.("JSXAttribute", state, result, eventData);
|
|
17288
17407
|
return result;
|
|
17289
17408
|
} else {
|
|
17290
|
-
const result = JSXAttribute$0(state) || JSXAttribute$1(state) || JSXAttribute$2(state) || JSXAttribute$3(state) || JSXAttribute$4(state) || JSXAttribute$5(state);
|
|
17409
|
+
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);
|
|
17291
17410
|
if (state.events)
|
|
17292
17411
|
state.events.exit?.("JSXAttribute", state, result, eventData);
|
|
17293
17412
|
return result;
|
|
17294
17413
|
}
|
|
17295
17414
|
}
|
|
17296
|
-
var JSXAttributeSpace$0 = $R$0($EXPECT($R51, fail, "JSXAttributeSpace /[\\s>]
|
|
17415
|
+
var JSXAttributeSpace$0 = $R$0($EXPECT($R51, fail, "JSXAttributeSpace /[\\s>]|\\/>/"));
|
|
17297
17416
|
function JSXAttributeSpace(state) {
|
|
17298
17417
|
let eventData;
|
|
17299
17418
|
if (state.events) {
|
|
@@ -17396,11 +17515,14 @@ ${input.slice(result.pos)}
|
|
|
17396
17515
|
var JSXAttributeValue$0 = $S(OpenBrace, PostfixedExpression, $E(Whitespace), CloseBrace);
|
|
17397
17516
|
var JSXAttributeValue$1 = JSXElement;
|
|
17398
17517
|
var JSXAttributeValue$2 = JSXFragment;
|
|
17399
|
-
var JSXAttributeValue$3 = $TS($S(InsertInlineOpenBrace, InlineJSXAttributeValue, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3) {
|
|
17400
|
-
|
|
17518
|
+
var JSXAttributeValue$3 = $TS($S(InsertInlineOpenBrace, InlineJSXAttributeValue, InsertCloseBrace, $Y(JSXAttributeSpace)), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
17519
|
+
var open = $1;
|
|
17520
|
+
var value = $2;
|
|
17521
|
+
var close = $3;
|
|
17522
|
+
if (value.type === "StringLiteral") {
|
|
17401
17523
|
return $skip;
|
|
17402
17524
|
}
|
|
17403
|
-
return
|
|
17525
|
+
return [open, value, close];
|
|
17404
17526
|
});
|
|
17405
17527
|
var JSXAttributeValue$4 = $R$0($EXPECT($R53, fail, `JSXAttributeValue /"[^"]*"|'[^']*'/`));
|
|
17406
17528
|
function JSXAttributeValue(state) {
|
|
@@ -17583,12 +17705,41 @@ ${input.slice(result.pos)}
|
|
|
17583
17705
|
return result;
|
|
17584
17706
|
}
|
|
17585
17707
|
}
|
|
17586
|
-
var InlineJSXCallExpression$0 = $S($EXPECT($L14, fail, 'InlineJSXCallExpression "super"'), ExplicitArguments)
|
|
17587
|
-
|
|
17708
|
+
var InlineJSXCallExpression$0 = $TS($S($EXPECT($L14, fail, 'InlineJSXCallExpression "super"'), ExplicitArguments, $Q(InlineJSXCallExpressionRest)), function($skip, $loc, $0, $1, $2, $3) {
|
|
17709
|
+
var args = $2;
|
|
17710
|
+
var rest = $3;
|
|
17711
|
+
return module.processCallMemberExpression({
|
|
17712
|
+
type: "CallExpression",
|
|
17713
|
+
children: [
|
|
17714
|
+
$1,
|
|
17715
|
+
{ type: "Call", children: args },
|
|
17716
|
+
...rest.flat()
|
|
17717
|
+
]
|
|
17718
|
+
});
|
|
17719
|
+
});
|
|
17720
|
+
var InlineJSXCallExpression$1 = $TS($S($EXPECT($L15, fail, 'InlineJSXCallExpression "import"'), ExplicitArguments, $Q(InlineJSXCallExpressionRest)), function($skip, $loc, $0, $1, $2, $3) {
|
|
17721
|
+
var args = $2;
|
|
17722
|
+
var rest = $3;
|
|
17723
|
+
return module.processCallMemberExpression({
|
|
17724
|
+
type: "CallExpression",
|
|
17725
|
+
children: [
|
|
17726
|
+
$1,
|
|
17727
|
+
{ type: "Call", children: args },
|
|
17728
|
+
...rest.flat()
|
|
17729
|
+
]
|
|
17730
|
+
});
|
|
17731
|
+
});
|
|
17588
17732
|
var InlineJSXCallExpression$2 = $TS($S(InlineJSXMemberExpression, $Q(InlineJSXCallExpressionRest)), function($skip, $loc, $0, $1, $2) {
|
|
17589
|
-
|
|
17590
|
-
|
|
17591
|
-
|
|
17733
|
+
var member = $1;
|
|
17734
|
+
var rest = $2;
|
|
17735
|
+
if (rest.length) {
|
|
17736
|
+
rest = rest.flat();
|
|
17737
|
+
return module.processCallMemberExpression({
|
|
17738
|
+
type: "CallExpression",
|
|
17739
|
+
children: [member, ...rest]
|
|
17740
|
+
});
|
|
17741
|
+
}
|
|
17742
|
+
return member;
|
|
17592
17743
|
});
|
|
17593
17744
|
function InlineJSXCallExpression(state) {
|
|
17594
17745
|
let eventData;
|
|
@@ -17612,9 +17763,20 @@ ${input.slice(result.pos)}
|
|
|
17612
17763
|
return result;
|
|
17613
17764
|
}
|
|
17614
17765
|
}
|
|
17615
|
-
var InlineJSXCallExpressionRest$0 =
|
|
17616
|
-
var InlineJSXCallExpressionRest$1 = TemplateLiteral
|
|
17617
|
-
|
|
17766
|
+
var InlineJSXCallExpressionRest$0 = InlineJSXMemberExpressionRest;
|
|
17767
|
+
var InlineJSXCallExpressionRest$1 = $TV($C(TemplateLiteral, StringLiteral), function($skip, $loc, $0, $1) {
|
|
17768
|
+
if ($1.type === "StringLiteral") {
|
|
17769
|
+
return "`" + $1.token.slice(1, -1).replace(/(`|\$\{)/g, "\\$1") + "`";
|
|
17770
|
+
}
|
|
17771
|
+
return $1;
|
|
17772
|
+
});
|
|
17773
|
+
var InlineJSXCallExpressionRest$2 = $TS($S($E($C(OptionalShorthand, NonNullAssertion)), ExplicitArguments), function($skip, $loc, $0, $1, $2) {
|
|
17774
|
+
var args = $2;
|
|
17775
|
+
args = { type: "Call", children: args };
|
|
17776
|
+
if (!$1)
|
|
17777
|
+
return args;
|
|
17778
|
+
return [$1, args];
|
|
17779
|
+
});
|
|
17618
17780
|
function InlineJSXCallExpressionRest(state) {
|
|
17619
17781
|
let eventData;
|
|
17620
17782
|
if (state.events) {
|
|
@@ -17637,13 +17799,16 @@ ${input.slice(result.pos)}
|
|
|
17637
17799
|
return result;
|
|
17638
17800
|
}
|
|
17639
17801
|
}
|
|
17640
|
-
var InlineJSXMemberExpression$0 = $TS($S(InlineJSXPrimaryExpression, $Q(InlineJSXMemberExpressionRest)), function($skip, $loc, $0, $1, $2) {
|
|
17641
|
-
|
|
17642
|
-
|
|
17802
|
+
var InlineJSXMemberExpression$0 = $TS($S($C(InlineJSXPrimaryExpression, SuperProperty, MetaProperty), $Q(InlineJSXMemberExpressionRest)), function($skip, $loc, $0, $1, $2) {
|
|
17803
|
+
var rest = $2;
|
|
17804
|
+
if (rest.length || Array.isArray($1)) {
|
|
17805
|
+
return module.processCallMemberExpression({
|
|
17806
|
+
type: "MemberExpression",
|
|
17807
|
+
children: [$1, ...rest].flat()
|
|
17808
|
+
});
|
|
17809
|
+
}
|
|
17643
17810
|
return $1;
|
|
17644
17811
|
});
|
|
17645
|
-
var InlineJSXMemberExpression$1 = SuperProperty;
|
|
17646
|
-
var InlineJSXMemberExpression$2 = MetaProperty;
|
|
17647
17812
|
function InlineJSXMemberExpression(state) {
|
|
17648
17813
|
let eventData;
|
|
17649
17814
|
if (state.events) {
|
|
@@ -17655,12 +17820,12 @@ ${input.slice(result.pos)}
|
|
|
17655
17820
|
}
|
|
17656
17821
|
}
|
|
17657
17822
|
if (state.tokenize) {
|
|
17658
|
-
const result = $TOKEN("InlineJSXMemberExpression", state, InlineJSXMemberExpression$0(state)
|
|
17823
|
+
const result = $TOKEN("InlineJSXMemberExpression", state, InlineJSXMemberExpression$0(state));
|
|
17659
17824
|
if (state.events)
|
|
17660
17825
|
state.events.exit?.("InlineJSXMemberExpression", state, result, eventData);
|
|
17661
17826
|
return result;
|
|
17662
17827
|
} else {
|
|
17663
|
-
const result = InlineJSXMemberExpression$0(state)
|
|
17828
|
+
const result = InlineJSXMemberExpression$0(state);
|
|
17664
17829
|
if (state.events)
|
|
17665
17830
|
state.events.exit?.("InlineJSXMemberExpression", state, result, eventData);
|
|
17666
17831
|
return result;
|
|
@@ -17676,7 +17841,9 @@ ${input.slice(result.pos)}
|
|
|
17676
17841
|
return $2;
|
|
17677
17842
|
});
|
|
17678
17843
|
var InlineJSXMemberExpressionRest$1 = PropertyAccess;
|
|
17679
|
-
var InlineJSXMemberExpressionRest$2 =
|
|
17844
|
+
var InlineJSXMemberExpressionRest$2 = PropertyGlob;
|
|
17845
|
+
var InlineJSXMemberExpressionRest$3 = PropertyBind;
|
|
17846
|
+
var InlineJSXMemberExpressionRest$4 = NonNullAssertion;
|
|
17680
17847
|
function InlineJSXMemberExpressionRest(state) {
|
|
17681
17848
|
let eventData;
|
|
17682
17849
|
if (state.events) {
|
|
@@ -17688,12 +17855,12 @@ ${input.slice(result.pos)}
|
|
|
17688
17855
|
}
|
|
17689
17856
|
}
|
|
17690
17857
|
if (state.tokenize) {
|
|
17691
|
-
const result = $TOKEN("InlineJSXMemberExpressionRest", state, InlineJSXMemberExpressionRest$0(state) || InlineJSXMemberExpressionRest$1(state) || InlineJSXMemberExpressionRest$2(state));
|
|
17858
|
+
const result = $TOKEN("InlineJSXMemberExpressionRest", state, InlineJSXMemberExpressionRest$0(state) || InlineJSXMemberExpressionRest$1(state) || InlineJSXMemberExpressionRest$2(state) || InlineJSXMemberExpressionRest$3(state) || InlineJSXMemberExpressionRest$4(state));
|
|
17692
17859
|
if (state.events)
|
|
17693
17860
|
state.events.exit?.("InlineJSXMemberExpressionRest", state, result, eventData);
|
|
17694
17861
|
return result;
|
|
17695
17862
|
} else {
|
|
17696
|
-
const result = InlineJSXMemberExpressionRest$0(state) || InlineJSXMemberExpressionRest$1(state) || InlineJSXMemberExpressionRest$2(state);
|
|
17863
|
+
const result = InlineJSXMemberExpressionRest$0(state) || InlineJSXMemberExpressionRest$1(state) || InlineJSXMemberExpressionRest$2(state) || InlineJSXMemberExpressionRest$3(state) || InlineJSXMemberExpressionRest$4(state);
|
|
17697
17864
|
if (state.events)
|
|
17698
17865
|
state.events.exit?.("InlineJSXMemberExpressionRest", state, result, eventData);
|
|
17699
17866
|
return result;
|
|
@@ -19780,7 +19947,7 @@ ${input.slice(result.pos)}
|
|
|
19780
19947
|
return result;
|
|
19781
19948
|
}
|
|
19782
19949
|
}
|
|
19783
|
-
var TypeParameters$0 = $TS($S(
|
|
19950
|
+
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) {
|
|
19784
19951
|
var parameters = $3;
|
|
19785
19952
|
return {
|
|
19786
19953
|
type: "TypeParameters",
|
|
@@ -19811,7 +19978,7 @@ ${input.slice(result.pos)}
|
|
|
19811
19978
|
return result;
|
|
19812
19979
|
}
|
|
19813
19980
|
}
|
|
19814
|
-
var TypeParameter$0 = $S(__, Identifier, $E(TypeConstraint), $E(TypeInitializer), TypeParameterDelimiter);
|
|
19981
|
+
var TypeParameter$0 = $S(__, $E($S($EXPECT($L129, fail, 'TypeParameter "const"'), $E(_))), Identifier, $E(TypeConstraint), $E(TypeInitializer), TypeParameterDelimiter);
|
|
19815
19982
|
function TypeParameter(state) {
|
|
19816
19983
|
let eventData;
|
|
19817
19984
|
if (state.events) {
|
|
@@ -21310,12 +21477,12 @@ ${input.slice(result.pos)}
|
|
|
21310
21477
|
Object.assign(module.config, directive.config);
|
|
21311
21478
|
}
|
|
21312
21479
|
});
|
|
21313
|
-
module.
|
|
21480
|
+
module.processCallMemberExpression = (node) => {
|
|
21314
21481
|
const { children } = node;
|
|
21315
21482
|
for (let i = 0; i < children.length; i++) {
|
|
21316
21483
|
const glob = children[i];
|
|
21317
21484
|
if (glob?.type === "PropertyGlob") {
|
|
21318
|
-
const prefix = children.slice(0, i).concat(glob.
|
|
21485
|
+
const prefix = children.slice(0, i).concat(glob.dot);
|
|
21319
21486
|
const parts = [];
|
|
21320
21487
|
for (const part of glob.object.content) {
|
|
21321
21488
|
if (part.type === "MethodDefinition") {
|
|
@@ -21340,7 +21507,7 @@ ${input.slice(result.pos)}
|
|
|
21340
21507
|
});
|
|
21341
21508
|
} else {
|
|
21342
21509
|
parts.push({
|
|
21343
|
-
type: part.type,
|
|
21510
|
+
type: part.type === "Identifier" ? "Property" : part.type,
|
|
21344
21511
|
name: part.name,
|
|
21345
21512
|
value,
|
|
21346
21513
|
delim: part.delim,
|
|
@@ -21358,6 +21525,7 @@ ${input.slice(result.pos)}
|
|
|
21358
21525
|
}
|
|
21359
21526
|
const object = {
|
|
21360
21527
|
type: "ObjectExpression",
|
|
21528
|
+
content: parts,
|
|
21361
21529
|
children: [
|
|
21362
21530
|
glob.object.children[0],
|
|
21363
21531
|
...parts,
|
|
@@ -21366,10 +21534,24 @@ ${input.slice(result.pos)}
|
|
|
21366
21534
|
};
|
|
21367
21535
|
if (i === children.length - 1)
|
|
21368
21536
|
return object;
|
|
21369
|
-
return module.
|
|
21537
|
+
return module.processCallMemberExpression({
|
|
21370
21538
|
...node,
|
|
21371
21539
|
children: [object, ...children.slice(i + 1)]
|
|
21372
21540
|
});
|
|
21541
|
+
} else if (glob?.type === "PropertyBind") {
|
|
21542
|
+
const prefix = children.slice(0, i);
|
|
21543
|
+
return module.processCallMemberExpression({
|
|
21544
|
+
...node,
|
|
21545
|
+
children: [
|
|
21546
|
+
prefix,
|
|
21547
|
+
{
|
|
21548
|
+
...glob,
|
|
21549
|
+
type: "PropertyAccess",
|
|
21550
|
+
children: [...glob.children, ".bind(", prefix, ")"]
|
|
21551
|
+
},
|
|
21552
|
+
...children.slice(i + 1)
|
|
21553
|
+
]
|
|
21554
|
+
});
|
|
21373
21555
|
}
|
|
21374
21556
|
}
|
|
21375
21557
|
return node;
|
|
@@ -21931,10 +22113,9 @@ ${input.slice(result.pos)}
|
|
|
21931
22113
|
names.push(...rest.names);
|
|
21932
22114
|
}
|
|
21933
22115
|
if (after.length) {
|
|
21934
|
-
const spliceRef = module.getRef("splice");
|
|
21935
22116
|
blockPrefix = {
|
|
21936
22117
|
type: "PostRestBindingElements",
|
|
21937
|
-
children: ["[", insertTrimmingSpace(after, ""), "] = ",
|
|
22118
|
+
children: ["[", insertTrimmingSpace(after, ""), "] = ", restIdentifier, ".splice(-", after.length.toString(), ")"],
|
|
21938
22119
|
names: after.flatMap((p) => p.names)
|
|
21939
22120
|
};
|
|
21940
22121
|
}
|
|
@@ -22295,16 +22476,6 @@ ${input.slice(result.pos)}
|
|
|
22295
22476
|
exp.children.push(...post);
|
|
22296
22477
|
});
|
|
22297
22478
|
}
|
|
22298
|
-
function checkSpliceRef(statements) {
|
|
22299
|
-
const spliceRef = module.getRef("splice");
|
|
22300
|
-
if (gatherRecursiveAll(statements, (n) => n === spliceRef).length) {
|
|
22301
|
-
const typeSuffix = {
|
|
22302
|
-
ts: true,
|
|
22303
|
-
children: [": <T>(this: T[], start: number, deleteCount?: number) => T[]"]
|
|
22304
|
-
};
|
|
22305
|
-
module.prelude.push(["", ["const ", spliceRef, typeSuffix, " = [].splice", module.asAny, "\n"]]);
|
|
22306
|
-
}
|
|
22307
|
-
}
|
|
22308
22479
|
module.attachPostfixStatementAsExpression = function(exp, post) {
|
|
22309
22480
|
let clause;
|
|
22310
22481
|
switch (post[1].type) {
|
|
@@ -22324,31 +22495,6 @@ ${input.slice(result.pos)}
|
|
|
22324
22495
|
throw new Error("Unknown postfix statement");
|
|
22325
22496
|
}
|
|
22326
22497
|
};
|
|
22327
|
-
module.convertMethodToFunction = function(method) {
|
|
22328
|
-
const { signature, block } = method;
|
|
22329
|
-
let { modifier } = signature;
|
|
22330
|
-
if (modifier) {
|
|
22331
|
-
if (modifier.get || modifier.set) {
|
|
22332
|
-
throw new Error("cannot convert get/set method to function");
|
|
22333
|
-
} else if (modifier.async) {
|
|
22334
|
-
modifier = [modifier.children[0][0], " function ", ...modifier.children.slice(1)];
|
|
22335
|
-
} else {
|
|
22336
|
-
modifier = ["function ", ...modifier.children];
|
|
22337
|
-
}
|
|
22338
|
-
} else {
|
|
22339
|
-
modifier = "function ";
|
|
22340
|
-
}
|
|
22341
|
-
return {
|
|
22342
|
-
...signature,
|
|
22343
|
-
id: signature.name,
|
|
22344
|
-
type: "FunctionExpression",
|
|
22345
|
-
children: [
|
|
22346
|
-
[modifier, ...signature.children.slice(1)],
|
|
22347
|
-
block
|
|
22348
|
-
],
|
|
22349
|
-
block
|
|
22350
|
-
};
|
|
22351
|
-
};
|
|
22352
22498
|
function getPatternConditions(pattern, ref, conditions) {
|
|
22353
22499
|
switch (pattern.type) {
|
|
22354
22500
|
case "ArrayMatchingPattern": {
|
|
@@ -22792,7 +22938,6 @@ ${input.slice(result.pos)}
|
|
|
22792
22938
|
processTryExpressions(statements);
|
|
22793
22939
|
hoistRefDecs(statements);
|
|
22794
22940
|
gatherRecursiveAll(statements, (n) => n.type === "IterationExpression").forEach((e) => expressionizeIteration(e));
|
|
22795
|
-
checkSpliceRef(statements);
|
|
22796
22941
|
statements.unshift(...module.prelude);
|
|
22797
22942
|
if (module.config.autoLet) {
|
|
22798
22943
|
createLetDecs(statements, []);
|
|
@@ -23322,6 +23467,8 @@ ${input.slice(result.pos)}
|
|
|
23322
23467
|
var {
|
|
23323
23468
|
blockWithPrefix,
|
|
23324
23469
|
clone,
|
|
23470
|
+
convertMethodToFunction,
|
|
23471
|
+
convertObjectToJSXAttributes,
|
|
23325
23472
|
deepCopy,
|
|
23326
23473
|
findAncestor,
|
|
23327
23474
|
forRange,
|
|
@@ -23337,6 +23484,7 @@ ${input.slice(result.pos)}
|
|
|
23337
23484
|
hoistRefDecs,
|
|
23338
23485
|
insertTrimmingSpace,
|
|
23339
23486
|
isFunction,
|
|
23487
|
+
lastAccessInCallExpression,
|
|
23340
23488
|
literalValue,
|
|
23341
23489
|
modifyString,
|
|
23342
23490
|
processCoffeeInterpolation,
|
|
@@ -23594,17 +23742,17 @@ SourceMap.parseWithLines = function(base64encodedJSONstr) {
|
|
|
23594
23742
|
smRegexp = /\n\/\/# sourceMappingURL=data:application\/json;charset=utf-8;base64,([+a-zA-Z0-9\/]*=?=?)$/;
|
|
23595
23743
|
SourceMap.remap = function(codeWithSourceMap, upstreamMap, sourcePath, targetPath) {
|
|
23596
23744
|
var codeWithoutSourceMap, composedLines, newSourceMap, parsed, remappedCodeWithSourceMap, remappedSourceMapJSON, sourceMapText;
|
|
23597
|
-
sourceMapText =
|
|
23745
|
+
sourceMapText = null;
|
|
23746
|
+
codeWithoutSourceMap = codeWithSourceMap.replace(smRegexp, (match, sm) => {
|
|
23747
|
+
sourceMapText = sm;
|
|
23748
|
+
return "";
|
|
23749
|
+
});
|
|
23598
23750
|
if (sourceMapText) {
|
|
23599
|
-
parsed = SourceMap.parseWithLines(sourceMapText
|
|
23600
|
-
|
|
23601
|
-
|
|
23602
|
-
return codeWithSourceMap;
|
|
23751
|
+
parsed = SourceMap.parseWithLines(sourceMapText);
|
|
23752
|
+
composedLines = SourceMap.composeLines(upstreamMap.data.lines, parsed.lines);
|
|
23753
|
+
upstreamMap.data.lines = composedLines;
|
|
23603
23754
|
}
|
|
23604
|
-
composedLines = SourceMap.composeLines(upstreamMap.data.lines, parsed.lines);
|
|
23605
|
-
upstreamMap.data.lines = composedLines;
|
|
23606
23755
|
remappedSourceMapJSON = upstreamMap.json(sourcePath, targetPath);
|
|
23607
|
-
codeWithoutSourceMap = codeWithSourceMap.replace(smRegexp, "");
|
|
23608
23756
|
newSourceMap = `${"sourceMapping"}URL=data:application/json;charset=utf-8;base64,${base64Encode(JSON.stringify(remappedSourceMapJSON))}`;
|
|
23609
23757
|
remappedCodeWithSourceMap = `${codeWithoutSourceMap}
|
|
23610
23758
|
//# ${newSourceMap}`;
|
|
@@ -23774,15 +23922,14 @@ remapPosition = function(position, sourcemapLines) {
|
|
|
23774
23922
|
// source/main.coffee
|
|
23775
23923
|
"civet coffeeCompat";
|
|
23776
23924
|
var SourceMap2;
|
|
23777
|
-
var base64Encode2;
|
|
23778
23925
|
var makeCache;
|
|
23779
23926
|
var parse;
|
|
23780
23927
|
var uncacheable;
|
|
23781
23928
|
({ parse } = import_parser.default);
|
|
23782
|
-
({ SourceMap: SourceMap2
|
|
23929
|
+
({ SourceMap: SourceMap2 } = util_exports);
|
|
23783
23930
|
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"]);
|
|
23784
23931
|
var compile = function(src, options) {
|
|
23785
|
-
var ast, code, events, filename, ref, result, sm
|
|
23932
|
+
var ast, code, events, filename, ref, result, sm;
|
|
23786
23933
|
if (!options) {
|
|
23787
23934
|
options = {};
|
|
23788
23935
|
} else {
|
|
@@ -23804,10 +23951,7 @@ var compile = function(src, options) {
|
|
|
23804
23951
|
options.updateSourceMap = sm.updateSourceMap;
|
|
23805
23952
|
code = generate_default(ast, options);
|
|
23806
23953
|
if (options.inlineMap) {
|
|
23807
|
-
|
|
23808
|
-
return `${code}
|
|
23809
|
-
${"//#"} sourceMappingURL=data:application/json;base64,${base64Encode2(JSON.stringify(srcMapJSON))}
|
|
23810
|
-
`;
|
|
23954
|
+
return SourceMap2.remap(code, sm, filename, filename + ".tsx");
|
|
23811
23955
|
} else {
|
|
23812
23956
|
return {
|
|
23813
23957
|
code,
|