@danielx/civet 0.5.81 → 0.5.83
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 +189 -79
- package/dist/civet +0 -0
- package/dist/main.js +189 -79
- package/dist/main.mjs +189 -79
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -115,12 +115,29 @@ var require_lib = __commonJS({
|
|
|
115
115
|
}
|
|
116
116
|
return nodes;
|
|
117
117
|
}
|
|
118
|
+
function hasAwait(exp) {
|
|
119
|
+
return gatherRecursiveWithinFunction(exp, ({ type }) => type === "Await").length > 0;
|
|
120
|
+
}
|
|
121
|
+
function hasYield(exp) {
|
|
122
|
+
return gatherRecursiveWithinFunction(exp, ({ type }) => type === "Yield").length > 0;
|
|
123
|
+
}
|
|
124
|
+
function isFunction(node) {
|
|
125
|
+
const { type } = node;
|
|
126
|
+
return type === "FunctionExpression" || type === "ArrowFunction" || type === "MethodDefinition" || node.async;
|
|
127
|
+
}
|
|
128
|
+
function gatherRecursiveWithinFunction(node, predicate) {
|
|
129
|
+
return gatherRecursive(node, predicate, isFunction);
|
|
130
|
+
}
|
|
118
131
|
module2.exports = {
|
|
119
132
|
clone,
|
|
120
133
|
deepCopy,
|
|
121
134
|
gatherNodes,
|
|
122
135
|
gatherRecursive,
|
|
123
136
|
gatherRecursiveAll,
|
|
137
|
+
gatherRecursiveWithinFunction,
|
|
138
|
+
hasAwait,
|
|
139
|
+
hasYield,
|
|
140
|
+
isFunction,
|
|
124
141
|
removeParentPointers
|
|
125
142
|
};
|
|
126
143
|
}
|
|
@@ -568,7 +585,6 @@ ${input.slice(result.pos)}
|
|
|
568
585
|
YieldExpression,
|
|
569
586
|
YieldTail,
|
|
570
587
|
ArrowFunction,
|
|
571
|
-
ArrowFunctionTail,
|
|
572
588
|
FatArrow,
|
|
573
589
|
FatArrowBody,
|
|
574
590
|
ConditionalExpression,
|
|
@@ -804,6 +820,7 @@ ${input.slice(result.pos)}
|
|
|
804
820
|
ForbidClassImplicitCall,
|
|
805
821
|
AllowClassImplicitCall,
|
|
806
822
|
RestoreClassImplicitCall,
|
|
823
|
+
ClassImplicitCallForbidden,
|
|
807
824
|
ForbidIndentedApplication,
|
|
808
825
|
AllowIndentedApplication,
|
|
809
826
|
RestoreIndentedApplication,
|
|
@@ -1840,7 +1857,7 @@ ${input.slice(result.pos)}
|
|
|
1840
1857
|
}
|
|
1841
1858
|
var ForbiddenImplicitCalls$0 = $R$0($EXPECT($R0, fail, "ForbiddenImplicitCalls /(as|of|satisfies|then|when|implements|xor|xnor)(?!\\p{ID_Continue}|[\\u200C\\u200D$])/"));
|
|
1842
1859
|
var ForbiddenImplicitCalls$1 = $EXPECT($L1, fail, 'ForbiddenImplicitCalls "/ "');
|
|
1843
|
-
var ForbiddenImplicitCalls$2 = $S(
|
|
1860
|
+
var ForbiddenImplicitCalls$2 = $S(ClassImplicitCallForbidden, Class);
|
|
1844
1861
|
var ForbiddenImplicitCalls$3 = AtAt;
|
|
1845
1862
|
var ForbiddenImplicitCalls$4 = $S(Identifier, $EXPECT($L2, fail, 'ForbiddenImplicitCalls "="'), Whitespace);
|
|
1846
1863
|
var ForbiddenImplicitCalls$5 = $TS($S(Identifier, $N($EXPECT($L3, fail, 'ForbiddenImplicitCalls "("'))), function($skip, $loc, $0, $1, $2) {
|
|
@@ -2588,53 +2605,36 @@ ${input.slice(result.pos)}
|
|
|
2588
2605
|
return result;
|
|
2589
2606
|
}
|
|
2590
2607
|
}
|
|
2591
|
-
var ArrowFunction$0 =
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
let eventData;
|
|
2600
|
-
if (state.events) {
|
|
2601
|
-
const result = state.events.enter?.("ArrowFunction", state);
|
|
2602
|
-
if (result) {
|
|
2603
|
-
if (result.cache)
|
|
2604
|
-
return result.cache;
|
|
2605
|
-
eventData = result.data;
|
|
2606
|
-
}
|
|
2608
|
+
var ArrowFunction$0 = ThinArrowFunction;
|
|
2609
|
+
var ArrowFunction$1 = $TS($S($E($S(Async, _)), Parameters, $E(ReturnTypeSuffix), FatArrow, FatArrowBody), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
2610
|
+
var async = $1;
|
|
2611
|
+
var parameters = $2;
|
|
2612
|
+
var suffix = $3;
|
|
2613
|
+
var expOrBlock = $5;
|
|
2614
|
+
if (hasAwait(expOrBlock) && !async) {
|
|
2615
|
+
async = "async ";
|
|
2607
2616
|
}
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
const result = ArrowFunction$0(state);
|
|
2615
|
-
if (state.events)
|
|
2616
|
-
state.events.exit?.("ArrowFunction", state, result, eventData);
|
|
2617
|
-
return result;
|
|
2617
|
+
let error;
|
|
2618
|
+
if (hasYield(expOrBlock)) {
|
|
2619
|
+
error = {
|
|
2620
|
+
type: "Error",
|
|
2621
|
+
message: "Can't use yield inside of => arrow function"
|
|
2622
|
+
};
|
|
2618
2623
|
}
|
|
2619
|
-
}
|
|
2620
|
-
var ArrowFunctionTail$0 = ThinArrowFunction;
|
|
2621
|
-
var ArrowFunctionTail$1 = $TS($S(Parameters, $E(ReturnTypeSuffix), FatArrow, FatArrowBody), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
2622
|
-
var parameters = $1;
|
|
2623
|
-
var suffix = $2;
|
|
2624
|
-
var expOrBlock = $4;
|
|
2625
2624
|
return {
|
|
2626
2625
|
type: "ArrowFunction",
|
|
2627
2626
|
parameters,
|
|
2628
2627
|
returnType: suffix,
|
|
2629
2628
|
ts: false,
|
|
2629
|
+
async,
|
|
2630
2630
|
block: expOrBlock,
|
|
2631
|
-
children: $0
|
|
2631
|
+
children: [async, $0.slice(1), error]
|
|
2632
2632
|
};
|
|
2633
2633
|
});
|
|
2634
|
-
function
|
|
2634
|
+
function ArrowFunction(state) {
|
|
2635
2635
|
let eventData;
|
|
2636
2636
|
if (state.events) {
|
|
2637
|
-
const result = state.events.enter?.("
|
|
2637
|
+
const result = state.events.enter?.("ArrowFunction", state);
|
|
2638
2638
|
if (result) {
|
|
2639
2639
|
if (result.cache)
|
|
2640
2640
|
return result.cache;
|
|
@@ -2642,14 +2642,14 @@ ${input.slice(result.pos)}
|
|
|
2642
2642
|
}
|
|
2643
2643
|
}
|
|
2644
2644
|
if (state.tokenize) {
|
|
2645
|
-
const result = $TOKEN("
|
|
2645
|
+
const result = $TOKEN("ArrowFunction", state, ArrowFunction$0(state) || ArrowFunction$1(state));
|
|
2646
2646
|
if (state.events)
|
|
2647
|
-
state.events.exit?.("
|
|
2647
|
+
state.events.exit?.("ArrowFunction", state, result, eventData);
|
|
2648
2648
|
return result;
|
|
2649
2649
|
} else {
|
|
2650
|
-
const result =
|
|
2650
|
+
const result = ArrowFunction$0(state) || ArrowFunction$1(state);
|
|
2651
2651
|
if (state.events)
|
|
2652
|
-
state.events.exit?.("
|
|
2652
|
+
state.events.exit?.("ArrowFunction", state, result, eventData);
|
|
2653
2653
|
return result;
|
|
2654
2654
|
}
|
|
2655
2655
|
}
|
|
@@ -3560,9 +3560,16 @@ ${input.slice(result.pos)}
|
|
|
3560
3560
|
var exp = $6;
|
|
3561
3561
|
switch (exp.type) {
|
|
3562
3562
|
case "FunctionExpression":
|
|
3563
|
+
const fnTokenIndex = exp.children.findIndex((c) => c?.token?.startsWith("function"));
|
|
3564
|
+
const children = exp.children.slice();
|
|
3565
|
+
if (exp.generator) {
|
|
3566
|
+
children.splice(fnTokenIndex, 2, children[fnTokenIndex + 1], id);
|
|
3567
|
+
} else {
|
|
3568
|
+
children.splice(fnTokenIndex, 1, id);
|
|
3569
|
+
}
|
|
3563
3570
|
return {
|
|
3564
3571
|
...exp,
|
|
3565
|
-
children
|
|
3572
|
+
children
|
|
3566
3573
|
};
|
|
3567
3574
|
default:
|
|
3568
3575
|
return [id, " = ", exp];
|
|
@@ -5663,22 +5670,28 @@ ${input.slice(result.pos)}
|
|
|
5663
5670
|
return result;
|
|
5664
5671
|
}
|
|
5665
5672
|
}
|
|
5666
|
-
var FunctionSignature$0 = $TS($S($E($S(Async,
|
|
5673
|
+
var FunctionSignature$0 = $TS($S($E($S(Async, _)), Function, $E($S($E(_), Star)), $E($S($E(_), NWBindingIdentifier)), $E(_), Parameters, $E(ReturnTypeSuffix)), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7) {
|
|
5667
5674
|
var async = $1;
|
|
5668
5675
|
var func = $2;
|
|
5669
|
-
var
|
|
5676
|
+
var generator = $3;
|
|
5670
5677
|
var wid = $4;
|
|
5671
5678
|
var w = $5;
|
|
5672
5679
|
var parameters = $6;
|
|
5673
5680
|
var suffix = $7;
|
|
5681
|
+
if (!async)
|
|
5682
|
+
async = [];
|
|
5683
|
+
if (!generator)
|
|
5684
|
+
generator = [];
|
|
5674
5685
|
return {
|
|
5675
5686
|
type: "FunctionSignature",
|
|
5676
5687
|
id: wid?.[1],
|
|
5677
5688
|
parameters,
|
|
5678
5689
|
returnType: suffix,
|
|
5679
5690
|
ts: false,
|
|
5691
|
+
async,
|
|
5692
|
+
generator,
|
|
5680
5693
|
block: null,
|
|
5681
|
-
children: !parameters.implicit ? $0 : [async, func,
|
|
5694
|
+
children: !parameters.implicit ? $0 : [async, func, generator, wid, parameters, w, suffix]
|
|
5682
5695
|
};
|
|
5683
5696
|
});
|
|
5684
5697
|
function FunctionSignature(state) {
|
|
@@ -5710,6 +5723,12 @@ ${input.slice(result.pos)}
|
|
|
5710
5723
|
signature.ts = true;
|
|
5711
5724
|
return signature;
|
|
5712
5725
|
}
|
|
5726
|
+
if (hasAwait(block) && !signature.async.length) {
|
|
5727
|
+
signature.async.push("async ");
|
|
5728
|
+
}
|
|
5729
|
+
if (hasYield(block) && !signature.generator.length) {
|
|
5730
|
+
signature.generator.push("*");
|
|
5731
|
+
}
|
|
5713
5732
|
return {
|
|
5714
5733
|
...signature,
|
|
5715
5734
|
type: "FunctionExpression",
|
|
@@ -5758,7 +5777,7 @@ ${input.slice(result.pos)}
|
|
|
5758
5777
|
body = [prefix, rhs];
|
|
5759
5778
|
}
|
|
5760
5779
|
const children = [ref, " => ", ...body];
|
|
5761
|
-
if (
|
|
5780
|
+
if (hasAwait(body)) {
|
|
5762
5781
|
children.unshift("async ");
|
|
5763
5782
|
}
|
|
5764
5783
|
return {
|
|
@@ -5958,20 +5977,32 @@ ${input.slice(result.pos)}
|
|
|
5958
5977
|
return result;
|
|
5959
5978
|
}
|
|
5960
5979
|
}
|
|
5961
|
-
var ThinArrowFunction$0 = $TS($S(Parameters, $E(ReturnTypeSuffix), $Q(_), Arrow, BracedOrEmptyBlock), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
5962
|
-
var
|
|
5963
|
-
var
|
|
5964
|
-
var
|
|
5965
|
-
var
|
|
5980
|
+
var ThinArrowFunction$0 = $TS($S($E($S(Async, _)), Parameters, $E(ReturnTypeSuffix), $Q(_), Arrow, BracedOrEmptyBlock), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
|
|
5981
|
+
var async = $1;
|
|
5982
|
+
var parameters = $2;
|
|
5983
|
+
var suffix = $3;
|
|
5984
|
+
var arrow = $5;
|
|
5985
|
+
var block = $6;
|
|
5986
|
+
if (hasAwait(block) && !async) {
|
|
5987
|
+
async = "async ";
|
|
5988
|
+
}
|
|
5989
|
+
let generator;
|
|
5990
|
+
if (hasYield(block)) {
|
|
5991
|
+
generator = "*";
|
|
5992
|
+
}
|
|
5966
5993
|
return {
|
|
5967
5994
|
type: "FunctionExpression",
|
|
5968
5995
|
id: void 0,
|
|
5969
5996
|
parameters,
|
|
5970
5997
|
returnType: suffix,
|
|
5971
5998
|
ts: false,
|
|
5999
|
+
async,
|
|
6000
|
+
generator,
|
|
5972
6001
|
block,
|
|
5973
6002
|
children: [
|
|
6003
|
+
async,
|
|
5974
6004
|
{ $loc: arrow.$loc, token: "function" },
|
|
6005
|
+
generator,
|
|
5975
6006
|
parameters,
|
|
5976
6007
|
suffix,
|
|
5977
6008
|
block
|
|
@@ -7938,9 +7969,38 @@ ${input.slice(result.pos)}
|
|
|
7938
7969
|
var MethodDefinition$1 = $TS($S(MethodSignature, $N(PropertyAccess), BracedOrEmptyBlock), function($skip, $loc, $0, $1, $2, $3) {
|
|
7939
7970
|
var signature = $1;
|
|
7940
7971
|
var block = $3;
|
|
7972
|
+
let children = $0;
|
|
7973
|
+
let generatorPos = 0;
|
|
7974
|
+
const { modifier } = signature;
|
|
7975
|
+
if (hasAwait(block)) {
|
|
7976
|
+
generatorPos++;
|
|
7977
|
+
children = children.slice();
|
|
7978
|
+
if (modifier?.get || modifier?.set) {
|
|
7979
|
+
children.push({
|
|
7980
|
+
type: "Error",
|
|
7981
|
+
message: "Getters and setters cannot be async"
|
|
7982
|
+
});
|
|
7983
|
+
} else if (modifier?.async) {
|
|
7984
|
+
} else {
|
|
7985
|
+
children.unshift("async ");
|
|
7986
|
+
}
|
|
7987
|
+
}
|
|
7988
|
+
if (hasYield(block)) {
|
|
7989
|
+
if (children === $0)
|
|
7990
|
+
children = children.slice();
|
|
7991
|
+
if (modifier?.get || modifier?.set) {
|
|
7992
|
+
children.push({
|
|
7993
|
+
type: "Error",
|
|
7994
|
+
message: "Getters and setters cannot be generators"
|
|
7995
|
+
});
|
|
7996
|
+
} else if (modifier?.generator) {
|
|
7997
|
+
} else {
|
|
7998
|
+
children.splice(generatorPos, 0, "*");
|
|
7999
|
+
}
|
|
8000
|
+
}
|
|
7941
8001
|
return {
|
|
7942
8002
|
type: "MethodDefinition",
|
|
7943
|
-
children
|
|
8003
|
+
children,
|
|
7944
8004
|
name: signature.name,
|
|
7945
8005
|
signature,
|
|
7946
8006
|
block,
|
|
@@ -7969,9 +8029,37 @@ ${input.slice(result.pos)}
|
|
|
7969
8029
|
return result;
|
|
7970
8030
|
}
|
|
7971
8031
|
}
|
|
7972
|
-
var MethodModifier$0 = $S(GetOrSet, $E(_))
|
|
7973
|
-
|
|
7974
|
-
|
|
8032
|
+
var MethodModifier$0 = $TS($S(GetOrSet, $E(_)), function($skip, $loc, $0, $1, $2) {
|
|
8033
|
+
var kind = $1;
|
|
8034
|
+
return {
|
|
8035
|
+
type: "MethodModifier",
|
|
8036
|
+
async: false,
|
|
8037
|
+
generator: false,
|
|
8038
|
+
get: kind.token === "get",
|
|
8039
|
+
set: kind.token === "set",
|
|
8040
|
+
children: $0
|
|
8041
|
+
};
|
|
8042
|
+
});
|
|
8043
|
+
var MethodModifier$1 = $TS($S($S(Async, __), $E($S(Star, __))), function($skip, $loc, $0, $1, $2) {
|
|
8044
|
+
return {
|
|
8045
|
+
type: "MethodModifier",
|
|
8046
|
+
async: true,
|
|
8047
|
+
get: false,
|
|
8048
|
+
set: false,
|
|
8049
|
+
generator: !!$1,
|
|
8050
|
+
children: $0
|
|
8051
|
+
};
|
|
8052
|
+
});
|
|
8053
|
+
var MethodModifier$2 = $TS($S(Star, __), function($skip, $loc, $0, $1, $2) {
|
|
8054
|
+
return {
|
|
8055
|
+
type: "MethodModifier",
|
|
8056
|
+
async: false,
|
|
8057
|
+
get: false,
|
|
8058
|
+
set: false,
|
|
8059
|
+
generator: true,
|
|
8060
|
+
children: $0
|
|
8061
|
+
};
|
|
8062
|
+
});
|
|
7975
8063
|
function MethodModifier(state) {
|
|
7976
8064
|
let eventData;
|
|
7977
8065
|
if (state.events) {
|
|
@@ -8004,7 +8092,8 @@ ${input.slice(result.pos)}
|
|
|
8004
8092
|
parameters
|
|
8005
8093
|
};
|
|
8006
8094
|
});
|
|
8007
|
-
var MethodSignature$1 = $TS($S($E(MethodModifier), ClassElementName, $
|
|
8095
|
+
var MethodSignature$1 = $TS($S($E(MethodModifier), ClassElementName, $E(_), NonEmptyParameters, $E(ReturnTypeSuffix)), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
8096
|
+
var modifier = $1;
|
|
8008
8097
|
var name = $2;
|
|
8009
8098
|
var parameters = $4;
|
|
8010
8099
|
var suffix = $5;
|
|
@@ -8017,7 +8106,7 @@ ${input.slice(result.pos)}
|
|
|
8017
8106
|
type: "MethodSignature",
|
|
8018
8107
|
children: $0,
|
|
8019
8108
|
name,
|
|
8020
|
-
modifier
|
|
8109
|
+
modifier,
|
|
8021
8110
|
returnType: suffix,
|
|
8022
8111
|
parameters
|
|
8023
8112
|
};
|
|
@@ -10701,6 +10790,33 @@ ${input.slice(result.pos)}
|
|
|
10701
10790
|
return result;
|
|
10702
10791
|
}
|
|
10703
10792
|
}
|
|
10793
|
+
var ClassImplicitCallForbidden$0 = $TV($EXPECT($L0, fail, 'ClassImplicitCallForbidden ""'), function($skip, $loc, $0, $1) {
|
|
10794
|
+
if (module2.classImplicitCallForbidden)
|
|
10795
|
+
return $skip;
|
|
10796
|
+
return;
|
|
10797
|
+
});
|
|
10798
|
+
function ClassImplicitCallForbidden(state) {
|
|
10799
|
+
let eventData;
|
|
10800
|
+
if (state.events) {
|
|
10801
|
+
const result = state.events.enter?.("ClassImplicitCallForbidden", state);
|
|
10802
|
+
if (result) {
|
|
10803
|
+
if (result.cache)
|
|
10804
|
+
return result.cache;
|
|
10805
|
+
eventData = result.data;
|
|
10806
|
+
}
|
|
10807
|
+
}
|
|
10808
|
+
if (state.tokenize) {
|
|
10809
|
+
const result = $TOKEN("ClassImplicitCallForbidden", state, ClassImplicitCallForbidden$0(state));
|
|
10810
|
+
if (state.events)
|
|
10811
|
+
state.events.exit?.("ClassImplicitCallForbidden", state, result, eventData);
|
|
10812
|
+
return result;
|
|
10813
|
+
} else {
|
|
10814
|
+
const result = ClassImplicitCallForbidden$0(state);
|
|
10815
|
+
if (state.events)
|
|
10816
|
+
state.events.exit?.("ClassImplicitCallForbidden", state, result, eventData);
|
|
10817
|
+
return result;
|
|
10818
|
+
}
|
|
10819
|
+
}
|
|
10704
10820
|
var ForbidIndentedApplication$0 = $TV($EXPECT($L0, fail, 'ForbidIndentedApplication ""'), function($skip, $loc, $0, $1) {
|
|
10705
10821
|
module2.forbidIndentedApplication.push(true);
|
|
10706
10822
|
});
|
|
@@ -15885,7 +16001,7 @@ ${input.slice(result.pos)}
|
|
|
15885
16001
|
}
|
|
15886
16002
|
}
|
|
15887
16003
|
var Yield$0 = $TS($S($EXPECT($L164, fail, 'Yield "yield"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
|
|
15888
|
-
return { $loc, token: $1 };
|
|
16004
|
+
return { $loc, token: $1, type: "Yield" };
|
|
15889
16005
|
});
|
|
15890
16006
|
function Yield(state) {
|
|
15891
16007
|
let eventData;
|
|
@@ -20697,15 +20813,12 @@ ${input.slice(result.pos)}
|
|
|
20697
20813
|
], exp.async)
|
|
20698
20814
|
);
|
|
20699
20815
|
}
|
|
20700
|
-
module2.hasAwait = (exp) => {
|
|
20701
|
-
return gatherRecursiveWithinFunction(exp, ({ type }) => type === "Await").length > 0;
|
|
20702
|
-
};
|
|
20703
20816
|
module2.wrapIIFE = (exp, async) => {
|
|
20704
20817
|
let prefix, suffix;
|
|
20705
20818
|
if (async) {
|
|
20706
20819
|
prefix = "(async ()=>{";
|
|
20707
20820
|
suffix = "})()";
|
|
20708
|
-
} else if (
|
|
20821
|
+
} else if (hasAwait(exp)) {
|
|
20709
20822
|
prefix = "(await (async ()=>{";
|
|
20710
20823
|
suffix = "})())";
|
|
20711
20824
|
} else {
|
|
@@ -21279,13 +21392,6 @@ ${input.slice(result.pos)}
|
|
|
21279
21392
|
}, props2]
|
|
21280
21393
|
};
|
|
21281
21394
|
};
|
|
21282
|
-
function isFunction(node) {
|
|
21283
|
-
const { type } = node;
|
|
21284
|
-
return type === "FunctionExpression" || type === "ArrowFunction" || type === "MethodDefinition" || node.async;
|
|
21285
|
-
}
|
|
21286
|
-
function gatherRecursiveWithinFunction(node, predicate) {
|
|
21287
|
-
return gatherRecursive(node, predicate, isFunction);
|
|
21288
|
-
}
|
|
21289
21395
|
function addParentPointers(node, parent) {
|
|
21290
21396
|
if (node == null)
|
|
21291
21397
|
return;
|
|
@@ -21457,7 +21563,7 @@ ${input.slice(result.pos)}
|
|
|
21457
21563
|
const { signature, block } = f;
|
|
21458
21564
|
const isConstructor = signature.name === "constructor";
|
|
21459
21565
|
const isVoid = isVoidType(signature.returnType?.t);
|
|
21460
|
-
const isSet = signature.modifier
|
|
21566
|
+
const isSet = signature.modifier?.set;
|
|
21461
21567
|
if (!isConstructor && !isSet && !isVoid) {
|
|
21462
21568
|
insertReturn(block);
|
|
21463
21569
|
}
|
|
@@ -21618,24 +21724,24 @@ ${input.slice(result.pos)}
|
|
|
21618
21724
|
};
|
|
21619
21725
|
module2.convertMethodToFunction = function(method) {
|
|
21620
21726
|
const { signature, block } = method;
|
|
21621
|
-
let
|
|
21622
|
-
if (
|
|
21623
|
-
if (
|
|
21727
|
+
let { modifier } = signature;
|
|
21728
|
+
if (modifier) {
|
|
21729
|
+
if (modifier.get || modifier.set) {
|
|
21624
21730
|
throw new Error("cannot convert get/set method to function");
|
|
21625
|
-
} else if (
|
|
21626
|
-
|
|
21731
|
+
} else if (modifier.async) {
|
|
21732
|
+
modifier = [modifier.children[0][0], " function ", ...modifier.children.slice(1)];
|
|
21627
21733
|
} else {
|
|
21628
|
-
|
|
21734
|
+
modifier = ["function ", ...modifier.children];
|
|
21629
21735
|
}
|
|
21630
21736
|
} else {
|
|
21631
|
-
|
|
21737
|
+
modifier = "function ";
|
|
21632
21738
|
}
|
|
21633
21739
|
return {
|
|
21634
21740
|
...signature,
|
|
21635
21741
|
id: signature.name,
|
|
21636
21742
|
type: "FunctionExpression",
|
|
21637
21743
|
children: [
|
|
21638
|
-
[
|
|
21744
|
+
[modifier, ...signature.children.slice(1)],
|
|
21639
21745
|
block
|
|
21640
21746
|
],
|
|
21641
21747
|
block
|
|
@@ -22610,6 +22716,10 @@ ${input.slice(result.pos)}
|
|
|
22610
22716
|
gatherNodes,
|
|
22611
22717
|
gatherRecursive,
|
|
22612
22718
|
gatherRecursiveAll,
|
|
22719
|
+
gatherRecursiveWithinFunction,
|
|
22720
|
+
hasAwait,
|
|
22721
|
+
hasYield,
|
|
22722
|
+
isFunction,
|
|
22613
22723
|
removeParentPointers
|
|
22614
22724
|
} = require_lib();
|
|
22615
22725
|
}
|
|
@@ -23049,7 +23159,7 @@ var parse;
|
|
|
23049
23159
|
var uncacheable;
|
|
23050
23160
|
({ parse } = import_parser.default);
|
|
23051
23161
|
({ SourceMap: SourceMap2, base64Encode: base64Encode2 } = util_exports);
|
|
23052
|
-
uncacheable = /* @__PURE__ */ new Set(["ActualAssignment", "AllowAll", "AllowIndentedApplication", "AllowTrailingMemberProperty", "AllowedTrailingMemberExpressions", "ApplicationStart", "Arguments", "ArgumentsWithTrailingMemberExpressions", "ArrowFunction", "ArrowFunctionTail", "AssignmentExpression", "AssignmentExpressionTail", "BinaryOpExpression", "BinaryOpRHS", "BracedBlock", "BracedObjectLiteralContent", "BracedOrEmptyBlock", "CallExpression", "CallExpressionRest", "CoffeeCommentEnabled", "CommaDelimiter", "ConditionalExpression", "Declaration", "Debugger", "ElementListWithIndentedApplicationForbidden", "ElseClause", "Expression", "ExpressionStatement", "ExpressionWithIndentedApplicationForbidden", "ExtendedExpression", "FatArrowBody", "ForbidIndentedApplication", "ForbidTrailingMemberProperty", "FunctionDeclaration", "FunctionExpression", "HoistableDeclaration", "ImplicitArguments", "ImplicitInlineObjectPropertyDelimiter", "ImplicitNestedBlock", "IndentedApplicationAllowed", "IndentedFurther", "IndentedJSXChildExpression", "InlineObjectLiteral", "InsertIndent", "JSXChild", "JSXChildren", "JSXElement", "JSXFragment", "JSXImplicitFragment", "JSXMixedChildren", "JSXNested", "JSXNestedChildren", "JSXOptionalClosingElement", "JSXOptionalClosingFragment", "JSXTag", "LeftHandSideExpression", "MemberExpression", "MemberExpressionRest", "Nested", "NestedBindingElement", "NestedBindingElements", "NestedBlockExpression", "NestedBlockExpression", "NestedBlockStatement", "NestedBlockStatements", "NestedClassSignatureElement", "NestedClassSignatureElements", "NestedDeclareElement", "NestedDeclareElements", "NestedElement", "NestedElementList", "NestedImplicitObjectLiteral", "NestedImplicitPropertyDefinition", "NestedImplicitPropertyDefinitions", "NestedInterfaceProperty", "NestedJSXChildExpression", "NestedModuleItem", "NestedModuleItems", "NestedObject", "NestedPropertyDefinitions", "NonSingleBracedBlock", "NotDedented", "ObjectLiteral", "PopIndent", "PopJSXStack", "PostfixedExpression", "PostfixedStatement", "PrimaryExpression", "PushIndent", "PushJSXOpeningElement", "PushJSXOpeningFragment", "RestoreAll", "RestoreIndentedApplication", "RestoreTrailingMemberProperty", "RHS", "Samedent", "ShortCircuitExpression", "SingleLineAssignmentExpression", "SingleLineComment", "SingleLineStatements", "SnugNamedProperty", "Statement", "StatementListItem", "SuffixedExpression", "SuffixedStatement", "ThinArrowFunction", "TrackIndented", "TrailingMemberExpressions", "TrailingMemberPropertyAllowed", "TypedJSXElement", "TypedJSXFragment", "UnaryExpression", "UpdateExpression"]);
|
|
23162
|
+
uncacheable = /* @__PURE__ */ new Set(["ActualAssignment", "AllowAll", "AllowClassImplicitCall", "AllowIndentedApplication", "AllowTrailingMemberProperty", "AllowedTrailingMemberExpressions", "ApplicationStart", "Arguments", "ArgumentsWithTrailingMemberExpressions", "ArrowFunction", "ArrowFunctionTail", "AssignmentExpression", "AssignmentExpressionTail", "BinaryOpExpression", "BinaryOpRHS", "BracedBlock", "BracedObjectLiteralContent", "BracedOrEmptyBlock", "CallExpression", "CallExpressionRest", "ClassImplicitCallForbidden", "CoffeeCommentEnabled", "CommaDelimiter", "ConditionalExpression", "Declaration", "Debugger", "ElementListWithIndentedApplicationForbidden", "ElseClause", "Expression", "ExpressionStatement", "ExpressionWithIndentedApplicationForbidden", "ExtendedExpression", "FatArrowBody", "ForbidClassImplicitCall", "ForbidIndentedApplication", "ForbidTrailingMemberProperty", "FunctionDeclaration", "FunctionExpression", "HoistableDeclaration", "ImplicitArguments", "ImplicitInlineObjectPropertyDelimiter", "ImplicitNestedBlock", "IndentedApplicationAllowed", "IndentedFurther", "IndentedJSXChildExpression", "InlineObjectLiteral", "InsertIndent", "JSXChild", "JSXChildren", "JSXElement", "JSXFragment", "JSXImplicitFragment", "JSXMixedChildren", "JSXNested", "JSXNestedChildren", "JSXOptionalClosingElement", "JSXOptionalClosingFragment", "JSXTag", "LeftHandSideExpression", "MemberExpression", "MemberExpressionRest", "Nested", "NestedBindingElement", "NestedBindingElements", "NestedBlockExpression", "NestedBlockExpression", "NestedBlockStatement", "NestedBlockStatements", "NestedClassSignatureElement", "NestedClassSignatureElements", "NestedDeclareElement", "NestedDeclareElements", "NestedElement", "NestedElementList", "NestedImplicitObjectLiteral", "NestedImplicitPropertyDefinition", "NestedImplicitPropertyDefinitions", "NestedInterfaceProperty", "NestedJSXChildExpression", "NestedModuleItem", "NestedModuleItems", "NestedObject", "NestedPropertyDefinitions", "NonSingleBracedBlock", "NotDedented", "ObjectLiteral", "PopIndent", "PopJSXStack", "PostfixedExpression", "PostfixedStatement", "PrimaryExpression", "PushIndent", "PushJSXOpeningElement", "PushJSXOpeningFragment", "RestoreAll", "RestoreClassImplicitCall", "RestoreIndentedApplication", "RestoreTrailingMemberProperty", "RHS", "Samedent", "ShortCircuitExpression", "SingleLineAssignmentExpression", "SingleLineComment", "SingleLineStatements", "SnugNamedProperty", "Statement", "StatementListItem", "SuffixedExpression", "SuffixedStatement", "ThinArrowFunction", "TrackIndented", "TrailingMemberExpressions", "TrailingMemberPropertyAllowed", "TypedJSXElement", "TypedJSXFragment", "UnaryExpression", "UpdateExpression"]);
|
|
23053
23163
|
var compile = function(src, options) {
|
|
23054
23164
|
var ast, code, events, filename, ref, result, sm, srcMapJSON;
|
|
23055
23165
|
if (!options) {
|