@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.mjs
CHANGED
|
@@ -113,12 +113,29 @@ var require_lib = __commonJS({
|
|
|
113
113
|
}
|
|
114
114
|
return nodes;
|
|
115
115
|
}
|
|
116
|
+
function hasAwait(exp) {
|
|
117
|
+
return gatherRecursiveWithinFunction(exp, ({ type }) => type === "Await").length > 0;
|
|
118
|
+
}
|
|
119
|
+
function hasYield(exp) {
|
|
120
|
+
return gatherRecursiveWithinFunction(exp, ({ type }) => type === "Yield").length > 0;
|
|
121
|
+
}
|
|
122
|
+
function isFunction(node) {
|
|
123
|
+
const { type } = node;
|
|
124
|
+
return type === "FunctionExpression" || type === "ArrowFunction" || type === "MethodDefinition" || node.async;
|
|
125
|
+
}
|
|
126
|
+
function gatherRecursiveWithinFunction(node, predicate) {
|
|
127
|
+
return gatherRecursive(node, predicate, isFunction);
|
|
128
|
+
}
|
|
116
129
|
module.exports = {
|
|
117
130
|
clone,
|
|
118
131
|
deepCopy,
|
|
119
132
|
gatherNodes,
|
|
120
133
|
gatherRecursive,
|
|
121
134
|
gatherRecursiveAll,
|
|
135
|
+
gatherRecursiveWithinFunction,
|
|
136
|
+
hasAwait,
|
|
137
|
+
hasYield,
|
|
138
|
+
isFunction,
|
|
122
139
|
removeParentPointers
|
|
123
140
|
};
|
|
124
141
|
}
|
|
@@ -566,7 +583,6 @@ ${input.slice(result.pos)}
|
|
|
566
583
|
YieldExpression,
|
|
567
584
|
YieldTail,
|
|
568
585
|
ArrowFunction,
|
|
569
|
-
ArrowFunctionTail,
|
|
570
586
|
FatArrow,
|
|
571
587
|
FatArrowBody,
|
|
572
588
|
ConditionalExpression,
|
|
@@ -802,6 +818,7 @@ ${input.slice(result.pos)}
|
|
|
802
818
|
ForbidClassImplicitCall,
|
|
803
819
|
AllowClassImplicitCall,
|
|
804
820
|
RestoreClassImplicitCall,
|
|
821
|
+
ClassImplicitCallForbidden,
|
|
805
822
|
ForbidIndentedApplication,
|
|
806
823
|
AllowIndentedApplication,
|
|
807
824
|
RestoreIndentedApplication,
|
|
@@ -1838,7 +1855,7 @@ ${input.slice(result.pos)}
|
|
|
1838
1855
|
}
|
|
1839
1856
|
var ForbiddenImplicitCalls$0 = $R$0($EXPECT($R0, fail, "ForbiddenImplicitCalls /(as|of|satisfies|then|when|implements|xor|xnor)(?!\\p{ID_Continue}|[\\u200C\\u200D$])/"));
|
|
1840
1857
|
var ForbiddenImplicitCalls$1 = $EXPECT($L1, fail, 'ForbiddenImplicitCalls "/ "');
|
|
1841
|
-
var ForbiddenImplicitCalls$2 = $S(
|
|
1858
|
+
var ForbiddenImplicitCalls$2 = $S(ClassImplicitCallForbidden, Class);
|
|
1842
1859
|
var ForbiddenImplicitCalls$3 = AtAt;
|
|
1843
1860
|
var ForbiddenImplicitCalls$4 = $S(Identifier, $EXPECT($L2, fail, 'ForbiddenImplicitCalls "="'), Whitespace);
|
|
1844
1861
|
var ForbiddenImplicitCalls$5 = $TS($S(Identifier, $N($EXPECT($L3, fail, 'ForbiddenImplicitCalls "("'))), function($skip, $loc, $0, $1, $2) {
|
|
@@ -2586,53 +2603,36 @@ ${input.slice(result.pos)}
|
|
|
2586
2603
|
return result;
|
|
2587
2604
|
}
|
|
2588
2605
|
}
|
|
2589
|
-
var ArrowFunction$0 =
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
let eventData;
|
|
2598
|
-
if (state.events) {
|
|
2599
|
-
const result = state.events.enter?.("ArrowFunction", state);
|
|
2600
|
-
if (result) {
|
|
2601
|
-
if (result.cache)
|
|
2602
|
-
return result.cache;
|
|
2603
|
-
eventData = result.data;
|
|
2604
|
-
}
|
|
2606
|
+
var ArrowFunction$0 = ThinArrowFunction;
|
|
2607
|
+
var ArrowFunction$1 = $TS($S($E($S(Async, _)), Parameters, $E(ReturnTypeSuffix), FatArrow, FatArrowBody), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
2608
|
+
var async = $1;
|
|
2609
|
+
var parameters = $2;
|
|
2610
|
+
var suffix = $3;
|
|
2611
|
+
var expOrBlock = $5;
|
|
2612
|
+
if (hasAwait(expOrBlock) && !async) {
|
|
2613
|
+
async = "async ";
|
|
2605
2614
|
}
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
const result = ArrowFunction$0(state);
|
|
2613
|
-
if (state.events)
|
|
2614
|
-
state.events.exit?.("ArrowFunction", state, result, eventData);
|
|
2615
|
-
return result;
|
|
2615
|
+
let error;
|
|
2616
|
+
if (hasYield(expOrBlock)) {
|
|
2617
|
+
error = {
|
|
2618
|
+
type: "Error",
|
|
2619
|
+
message: "Can't use yield inside of => arrow function"
|
|
2620
|
+
};
|
|
2616
2621
|
}
|
|
2617
|
-
}
|
|
2618
|
-
var ArrowFunctionTail$0 = ThinArrowFunction;
|
|
2619
|
-
var ArrowFunctionTail$1 = $TS($S(Parameters, $E(ReturnTypeSuffix), FatArrow, FatArrowBody), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
2620
|
-
var parameters = $1;
|
|
2621
|
-
var suffix = $2;
|
|
2622
|
-
var expOrBlock = $4;
|
|
2623
2622
|
return {
|
|
2624
2623
|
type: "ArrowFunction",
|
|
2625
2624
|
parameters,
|
|
2626
2625
|
returnType: suffix,
|
|
2627
2626
|
ts: false,
|
|
2627
|
+
async,
|
|
2628
2628
|
block: expOrBlock,
|
|
2629
|
-
children: $0
|
|
2629
|
+
children: [async, $0.slice(1), error]
|
|
2630
2630
|
};
|
|
2631
2631
|
});
|
|
2632
|
-
function
|
|
2632
|
+
function ArrowFunction(state) {
|
|
2633
2633
|
let eventData;
|
|
2634
2634
|
if (state.events) {
|
|
2635
|
-
const result = state.events.enter?.("
|
|
2635
|
+
const result = state.events.enter?.("ArrowFunction", state);
|
|
2636
2636
|
if (result) {
|
|
2637
2637
|
if (result.cache)
|
|
2638
2638
|
return result.cache;
|
|
@@ -2640,14 +2640,14 @@ ${input.slice(result.pos)}
|
|
|
2640
2640
|
}
|
|
2641
2641
|
}
|
|
2642
2642
|
if (state.tokenize) {
|
|
2643
|
-
const result = $TOKEN("
|
|
2643
|
+
const result = $TOKEN("ArrowFunction", state, ArrowFunction$0(state) || ArrowFunction$1(state));
|
|
2644
2644
|
if (state.events)
|
|
2645
|
-
state.events.exit?.("
|
|
2645
|
+
state.events.exit?.("ArrowFunction", state, result, eventData);
|
|
2646
2646
|
return result;
|
|
2647
2647
|
} else {
|
|
2648
|
-
const result =
|
|
2648
|
+
const result = ArrowFunction$0(state) || ArrowFunction$1(state);
|
|
2649
2649
|
if (state.events)
|
|
2650
|
-
state.events.exit?.("
|
|
2650
|
+
state.events.exit?.("ArrowFunction", state, result, eventData);
|
|
2651
2651
|
return result;
|
|
2652
2652
|
}
|
|
2653
2653
|
}
|
|
@@ -3558,9 +3558,16 @@ ${input.slice(result.pos)}
|
|
|
3558
3558
|
var exp = $6;
|
|
3559
3559
|
switch (exp.type) {
|
|
3560
3560
|
case "FunctionExpression":
|
|
3561
|
+
const fnTokenIndex = exp.children.findIndex((c) => c?.token?.startsWith("function"));
|
|
3562
|
+
const children = exp.children.slice();
|
|
3563
|
+
if (exp.generator) {
|
|
3564
|
+
children.splice(fnTokenIndex, 2, children[fnTokenIndex + 1], id);
|
|
3565
|
+
} else {
|
|
3566
|
+
children.splice(fnTokenIndex, 1, id);
|
|
3567
|
+
}
|
|
3561
3568
|
return {
|
|
3562
3569
|
...exp,
|
|
3563
|
-
children
|
|
3570
|
+
children
|
|
3564
3571
|
};
|
|
3565
3572
|
default:
|
|
3566
3573
|
return [id, " = ", exp];
|
|
@@ -5661,22 +5668,28 @@ ${input.slice(result.pos)}
|
|
|
5661
5668
|
return result;
|
|
5662
5669
|
}
|
|
5663
5670
|
}
|
|
5664
|
-
var FunctionSignature$0 = $TS($S($E($S(Async,
|
|
5671
|
+
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) {
|
|
5665
5672
|
var async = $1;
|
|
5666
5673
|
var func = $2;
|
|
5667
|
-
var
|
|
5674
|
+
var generator = $3;
|
|
5668
5675
|
var wid = $4;
|
|
5669
5676
|
var w = $5;
|
|
5670
5677
|
var parameters = $6;
|
|
5671
5678
|
var suffix = $7;
|
|
5679
|
+
if (!async)
|
|
5680
|
+
async = [];
|
|
5681
|
+
if (!generator)
|
|
5682
|
+
generator = [];
|
|
5672
5683
|
return {
|
|
5673
5684
|
type: "FunctionSignature",
|
|
5674
5685
|
id: wid?.[1],
|
|
5675
5686
|
parameters,
|
|
5676
5687
|
returnType: suffix,
|
|
5677
5688
|
ts: false,
|
|
5689
|
+
async,
|
|
5690
|
+
generator,
|
|
5678
5691
|
block: null,
|
|
5679
|
-
children: !parameters.implicit ? $0 : [async, func,
|
|
5692
|
+
children: !parameters.implicit ? $0 : [async, func, generator, wid, parameters, w, suffix]
|
|
5680
5693
|
};
|
|
5681
5694
|
});
|
|
5682
5695
|
function FunctionSignature(state) {
|
|
@@ -5708,6 +5721,12 @@ ${input.slice(result.pos)}
|
|
|
5708
5721
|
signature.ts = true;
|
|
5709
5722
|
return signature;
|
|
5710
5723
|
}
|
|
5724
|
+
if (hasAwait(block) && !signature.async.length) {
|
|
5725
|
+
signature.async.push("async ");
|
|
5726
|
+
}
|
|
5727
|
+
if (hasYield(block) && !signature.generator.length) {
|
|
5728
|
+
signature.generator.push("*");
|
|
5729
|
+
}
|
|
5711
5730
|
return {
|
|
5712
5731
|
...signature,
|
|
5713
5732
|
type: "FunctionExpression",
|
|
@@ -5756,7 +5775,7 @@ ${input.slice(result.pos)}
|
|
|
5756
5775
|
body = [prefix, rhs];
|
|
5757
5776
|
}
|
|
5758
5777
|
const children = [ref, " => ", ...body];
|
|
5759
|
-
if (
|
|
5778
|
+
if (hasAwait(body)) {
|
|
5760
5779
|
children.unshift("async ");
|
|
5761
5780
|
}
|
|
5762
5781
|
return {
|
|
@@ -5956,20 +5975,32 @@ ${input.slice(result.pos)}
|
|
|
5956
5975
|
return result;
|
|
5957
5976
|
}
|
|
5958
5977
|
}
|
|
5959
|
-
var ThinArrowFunction$0 = $TS($S(Parameters, $E(ReturnTypeSuffix), $Q(_), Arrow, BracedOrEmptyBlock), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
5960
|
-
var
|
|
5961
|
-
var
|
|
5962
|
-
var
|
|
5963
|
-
var
|
|
5978
|
+
var ThinArrowFunction$0 = $TS($S($E($S(Async, _)), Parameters, $E(ReturnTypeSuffix), $Q(_), Arrow, BracedOrEmptyBlock), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
|
|
5979
|
+
var async = $1;
|
|
5980
|
+
var parameters = $2;
|
|
5981
|
+
var suffix = $3;
|
|
5982
|
+
var arrow = $5;
|
|
5983
|
+
var block = $6;
|
|
5984
|
+
if (hasAwait(block) && !async) {
|
|
5985
|
+
async = "async ";
|
|
5986
|
+
}
|
|
5987
|
+
let generator;
|
|
5988
|
+
if (hasYield(block)) {
|
|
5989
|
+
generator = "*";
|
|
5990
|
+
}
|
|
5964
5991
|
return {
|
|
5965
5992
|
type: "FunctionExpression",
|
|
5966
5993
|
id: void 0,
|
|
5967
5994
|
parameters,
|
|
5968
5995
|
returnType: suffix,
|
|
5969
5996
|
ts: false,
|
|
5997
|
+
async,
|
|
5998
|
+
generator,
|
|
5970
5999
|
block,
|
|
5971
6000
|
children: [
|
|
6001
|
+
async,
|
|
5972
6002
|
{ $loc: arrow.$loc, token: "function" },
|
|
6003
|
+
generator,
|
|
5973
6004
|
parameters,
|
|
5974
6005
|
suffix,
|
|
5975
6006
|
block
|
|
@@ -7936,9 +7967,38 @@ ${input.slice(result.pos)}
|
|
|
7936
7967
|
var MethodDefinition$1 = $TS($S(MethodSignature, $N(PropertyAccess), BracedOrEmptyBlock), function($skip, $loc, $0, $1, $2, $3) {
|
|
7937
7968
|
var signature = $1;
|
|
7938
7969
|
var block = $3;
|
|
7970
|
+
let children = $0;
|
|
7971
|
+
let generatorPos = 0;
|
|
7972
|
+
const { modifier } = signature;
|
|
7973
|
+
if (hasAwait(block)) {
|
|
7974
|
+
generatorPos++;
|
|
7975
|
+
children = children.slice();
|
|
7976
|
+
if (modifier?.get || modifier?.set) {
|
|
7977
|
+
children.push({
|
|
7978
|
+
type: "Error",
|
|
7979
|
+
message: "Getters and setters cannot be async"
|
|
7980
|
+
});
|
|
7981
|
+
} else if (modifier?.async) {
|
|
7982
|
+
} else {
|
|
7983
|
+
children.unshift("async ");
|
|
7984
|
+
}
|
|
7985
|
+
}
|
|
7986
|
+
if (hasYield(block)) {
|
|
7987
|
+
if (children === $0)
|
|
7988
|
+
children = children.slice();
|
|
7989
|
+
if (modifier?.get || modifier?.set) {
|
|
7990
|
+
children.push({
|
|
7991
|
+
type: "Error",
|
|
7992
|
+
message: "Getters and setters cannot be generators"
|
|
7993
|
+
});
|
|
7994
|
+
} else if (modifier?.generator) {
|
|
7995
|
+
} else {
|
|
7996
|
+
children.splice(generatorPos, 0, "*");
|
|
7997
|
+
}
|
|
7998
|
+
}
|
|
7939
7999
|
return {
|
|
7940
8000
|
type: "MethodDefinition",
|
|
7941
|
-
children
|
|
8001
|
+
children,
|
|
7942
8002
|
name: signature.name,
|
|
7943
8003
|
signature,
|
|
7944
8004
|
block,
|
|
@@ -7967,9 +8027,37 @@ ${input.slice(result.pos)}
|
|
|
7967
8027
|
return result;
|
|
7968
8028
|
}
|
|
7969
8029
|
}
|
|
7970
|
-
var MethodModifier$0 = $S(GetOrSet, $E(_))
|
|
7971
|
-
|
|
7972
|
-
|
|
8030
|
+
var MethodModifier$0 = $TS($S(GetOrSet, $E(_)), function($skip, $loc, $0, $1, $2) {
|
|
8031
|
+
var kind = $1;
|
|
8032
|
+
return {
|
|
8033
|
+
type: "MethodModifier",
|
|
8034
|
+
async: false,
|
|
8035
|
+
generator: false,
|
|
8036
|
+
get: kind.token === "get",
|
|
8037
|
+
set: kind.token === "set",
|
|
8038
|
+
children: $0
|
|
8039
|
+
};
|
|
8040
|
+
});
|
|
8041
|
+
var MethodModifier$1 = $TS($S($S(Async, __), $E($S(Star, __))), function($skip, $loc, $0, $1, $2) {
|
|
8042
|
+
return {
|
|
8043
|
+
type: "MethodModifier",
|
|
8044
|
+
async: true,
|
|
8045
|
+
get: false,
|
|
8046
|
+
set: false,
|
|
8047
|
+
generator: !!$1,
|
|
8048
|
+
children: $0
|
|
8049
|
+
};
|
|
8050
|
+
});
|
|
8051
|
+
var MethodModifier$2 = $TS($S(Star, __), function($skip, $loc, $0, $1, $2) {
|
|
8052
|
+
return {
|
|
8053
|
+
type: "MethodModifier",
|
|
8054
|
+
async: false,
|
|
8055
|
+
get: false,
|
|
8056
|
+
set: false,
|
|
8057
|
+
generator: true,
|
|
8058
|
+
children: $0
|
|
8059
|
+
};
|
|
8060
|
+
});
|
|
7973
8061
|
function MethodModifier(state) {
|
|
7974
8062
|
let eventData;
|
|
7975
8063
|
if (state.events) {
|
|
@@ -8002,7 +8090,8 @@ ${input.slice(result.pos)}
|
|
|
8002
8090
|
parameters
|
|
8003
8091
|
};
|
|
8004
8092
|
});
|
|
8005
|
-
var MethodSignature$1 = $TS($S($E(MethodModifier), ClassElementName, $
|
|
8093
|
+
var MethodSignature$1 = $TS($S($E(MethodModifier), ClassElementName, $E(_), NonEmptyParameters, $E(ReturnTypeSuffix)), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
8094
|
+
var modifier = $1;
|
|
8006
8095
|
var name = $2;
|
|
8007
8096
|
var parameters = $4;
|
|
8008
8097
|
var suffix = $5;
|
|
@@ -8015,7 +8104,7 @@ ${input.slice(result.pos)}
|
|
|
8015
8104
|
type: "MethodSignature",
|
|
8016
8105
|
children: $0,
|
|
8017
8106
|
name,
|
|
8018
|
-
modifier
|
|
8107
|
+
modifier,
|
|
8019
8108
|
returnType: suffix,
|
|
8020
8109
|
parameters
|
|
8021
8110
|
};
|
|
@@ -10699,6 +10788,33 @@ ${input.slice(result.pos)}
|
|
|
10699
10788
|
return result;
|
|
10700
10789
|
}
|
|
10701
10790
|
}
|
|
10791
|
+
var ClassImplicitCallForbidden$0 = $TV($EXPECT($L0, fail, 'ClassImplicitCallForbidden ""'), function($skip, $loc, $0, $1) {
|
|
10792
|
+
if (module.classImplicitCallForbidden)
|
|
10793
|
+
return $skip;
|
|
10794
|
+
return;
|
|
10795
|
+
});
|
|
10796
|
+
function ClassImplicitCallForbidden(state) {
|
|
10797
|
+
let eventData;
|
|
10798
|
+
if (state.events) {
|
|
10799
|
+
const result = state.events.enter?.("ClassImplicitCallForbidden", state);
|
|
10800
|
+
if (result) {
|
|
10801
|
+
if (result.cache)
|
|
10802
|
+
return result.cache;
|
|
10803
|
+
eventData = result.data;
|
|
10804
|
+
}
|
|
10805
|
+
}
|
|
10806
|
+
if (state.tokenize) {
|
|
10807
|
+
const result = $TOKEN("ClassImplicitCallForbidden", state, ClassImplicitCallForbidden$0(state));
|
|
10808
|
+
if (state.events)
|
|
10809
|
+
state.events.exit?.("ClassImplicitCallForbidden", state, result, eventData);
|
|
10810
|
+
return result;
|
|
10811
|
+
} else {
|
|
10812
|
+
const result = ClassImplicitCallForbidden$0(state);
|
|
10813
|
+
if (state.events)
|
|
10814
|
+
state.events.exit?.("ClassImplicitCallForbidden", state, result, eventData);
|
|
10815
|
+
return result;
|
|
10816
|
+
}
|
|
10817
|
+
}
|
|
10702
10818
|
var ForbidIndentedApplication$0 = $TV($EXPECT($L0, fail, 'ForbidIndentedApplication ""'), function($skip, $loc, $0, $1) {
|
|
10703
10819
|
module.forbidIndentedApplication.push(true);
|
|
10704
10820
|
});
|
|
@@ -15883,7 +15999,7 @@ ${input.slice(result.pos)}
|
|
|
15883
15999
|
}
|
|
15884
16000
|
}
|
|
15885
16001
|
var Yield$0 = $TS($S($EXPECT($L164, fail, 'Yield "yield"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
|
|
15886
|
-
return { $loc, token: $1 };
|
|
16002
|
+
return { $loc, token: $1, type: "Yield" };
|
|
15887
16003
|
});
|
|
15888
16004
|
function Yield(state) {
|
|
15889
16005
|
let eventData;
|
|
@@ -20695,15 +20811,12 @@ ${input.slice(result.pos)}
|
|
|
20695
20811
|
], exp.async)
|
|
20696
20812
|
);
|
|
20697
20813
|
}
|
|
20698
|
-
module.hasAwait = (exp) => {
|
|
20699
|
-
return gatherRecursiveWithinFunction(exp, ({ type }) => type === "Await").length > 0;
|
|
20700
|
-
};
|
|
20701
20814
|
module.wrapIIFE = (exp, async) => {
|
|
20702
20815
|
let prefix, suffix;
|
|
20703
20816
|
if (async) {
|
|
20704
20817
|
prefix = "(async ()=>{";
|
|
20705
20818
|
suffix = "})()";
|
|
20706
|
-
} else if (
|
|
20819
|
+
} else if (hasAwait(exp)) {
|
|
20707
20820
|
prefix = "(await (async ()=>{";
|
|
20708
20821
|
suffix = "})())";
|
|
20709
20822
|
} else {
|
|
@@ -21277,13 +21390,6 @@ ${input.slice(result.pos)}
|
|
|
21277
21390
|
}, props2]
|
|
21278
21391
|
};
|
|
21279
21392
|
};
|
|
21280
|
-
function isFunction(node) {
|
|
21281
|
-
const { type } = node;
|
|
21282
|
-
return type === "FunctionExpression" || type === "ArrowFunction" || type === "MethodDefinition" || node.async;
|
|
21283
|
-
}
|
|
21284
|
-
function gatherRecursiveWithinFunction(node, predicate) {
|
|
21285
|
-
return gatherRecursive(node, predicate, isFunction);
|
|
21286
|
-
}
|
|
21287
21393
|
function addParentPointers(node, parent) {
|
|
21288
21394
|
if (node == null)
|
|
21289
21395
|
return;
|
|
@@ -21455,7 +21561,7 @@ ${input.slice(result.pos)}
|
|
|
21455
21561
|
const { signature, block } = f;
|
|
21456
21562
|
const isConstructor = signature.name === "constructor";
|
|
21457
21563
|
const isVoid = isVoidType(signature.returnType?.t);
|
|
21458
|
-
const isSet = signature.modifier
|
|
21564
|
+
const isSet = signature.modifier?.set;
|
|
21459
21565
|
if (!isConstructor && !isSet && !isVoid) {
|
|
21460
21566
|
insertReturn(block);
|
|
21461
21567
|
}
|
|
@@ -21616,24 +21722,24 @@ ${input.slice(result.pos)}
|
|
|
21616
21722
|
};
|
|
21617
21723
|
module.convertMethodToFunction = function(method) {
|
|
21618
21724
|
const { signature, block } = method;
|
|
21619
|
-
let
|
|
21620
|
-
if (
|
|
21621
|
-
if (
|
|
21725
|
+
let { modifier } = signature;
|
|
21726
|
+
if (modifier) {
|
|
21727
|
+
if (modifier.get || modifier.set) {
|
|
21622
21728
|
throw new Error("cannot convert get/set method to function");
|
|
21623
|
-
} else if (
|
|
21624
|
-
|
|
21729
|
+
} else if (modifier.async) {
|
|
21730
|
+
modifier = [modifier.children[0][0], " function ", ...modifier.children.slice(1)];
|
|
21625
21731
|
} else {
|
|
21626
|
-
|
|
21732
|
+
modifier = ["function ", ...modifier.children];
|
|
21627
21733
|
}
|
|
21628
21734
|
} else {
|
|
21629
|
-
|
|
21735
|
+
modifier = "function ";
|
|
21630
21736
|
}
|
|
21631
21737
|
return {
|
|
21632
21738
|
...signature,
|
|
21633
21739
|
id: signature.name,
|
|
21634
21740
|
type: "FunctionExpression",
|
|
21635
21741
|
children: [
|
|
21636
|
-
[
|
|
21742
|
+
[modifier, ...signature.children.slice(1)],
|
|
21637
21743
|
block
|
|
21638
21744
|
],
|
|
21639
21745
|
block
|
|
@@ -22608,6 +22714,10 @@ ${input.slice(result.pos)}
|
|
|
22608
22714
|
gatherNodes,
|
|
22609
22715
|
gatherRecursive,
|
|
22610
22716
|
gatherRecursiveAll,
|
|
22717
|
+
gatherRecursiveWithinFunction,
|
|
22718
|
+
hasAwait,
|
|
22719
|
+
hasYield,
|
|
22720
|
+
isFunction,
|
|
22611
22721
|
removeParentPointers
|
|
22612
22722
|
} = require_lib();
|
|
22613
22723
|
}
|
|
@@ -23037,7 +23147,7 @@ var parse;
|
|
|
23037
23147
|
var uncacheable;
|
|
23038
23148
|
({ parse } = import_parser.default);
|
|
23039
23149
|
({ SourceMap: SourceMap2, base64Encode: base64Encode2 } = util_exports);
|
|
23040
|
-
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"]);
|
|
23150
|
+
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"]);
|
|
23041
23151
|
var compile = function(src, options) {
|
|
23042
23152
|
var ast, code, events, filename, ref, result, sm, srcMapJSON;
|
|
23043
23153
|
if (!options) {
|