@danielx/civet 0.8.5 → 0.8.7
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/CHANGELOG.md +10 -0
- package/dist/browser.js +152 -60
- package/dist/civet +1 -7
- package/dist/main.js +152 -60
- package/dist/main.mjs +152 -60
- package/package.json +2 -2
package/dist/main.js
CHANGED
|
@@ -538,6 +538,7 @@ __export(lib_exports, {
|
|
|
538
538
|
hasImportDeclaration: () => hasImportDeclaration,
|
|
539
539
|
hasYield: () => hasYield,
|
|
540
540
|
insertTrimmingSpace: () => insertTrimmingSpace,
|
|
541
|
+
isComma: () => isComma,
|
|
541
542
|
isEmptyBareBlock: () => isEmptyBareBlock,
|
|
542
543
|
isFunction: () => isFunction,
|
|
543
544
|
isWhitespaceOrEmpty: () => isWhitespaceOrEmpty,
|
|
@@ -2320,11 +2321,21 @@ function serialize(value, context) {
|
|
|
2320
2321
|
}
|
|
2321
2322
|
|
|
2322
2323
|
// source/parser/function.civet
|
|
2324
|
+
function getTypeArguments(args) {
|
|
2325
|
+
while (typeof args === "object" && args != null && "args" in args) {
|
|
2326
|
+
args = args.args;
|
|
2327
|
+
}
|
|
2328
|
+
if (!Array.isArray(args)) {
|
|
2329
|
+
throw new Error("getTypeArguments could not find relevant array");
|
|
2330
|
+
}
|
|
2331
|
+
return args.filter((a) => typeof a === "object" && a != null && "type" in a && a.type === "TypeArgument");
|
|
2332
|
+
}
|
|
2323
2333
|
function isVoidType(t) {
|
|
2324
|
-
return t
|
|
2334
|
+
return typeof t === "object" && t != null && "type" in t && t.type === "TypeLiteral" && "t" in t && typeof t.t === "object" && t.t != null && "type" in t.t && t.t.type === "VoidType";
|
|
2325
2335
|
}
|
|
2326
2336
|
function isPromiseVoidType(t) {
|
|
2327
|
-
|
|
2337
|
+
let args;
|
|
2338
|
+
return typeof t === "object" && t != null && "type" in t && t.type === "TypeIdentifier" && "raw" in t && t.raw === "Promise" && (args = getTypeArguments(t.args?.args)).length === 1 && isVoidType(args[0].t);
|
|
2328
2339
|
}
|
|
2329
2340
|
function implicitFunctionBlock(f) {
|
|
2330
2341
|
if (f.abstract || f.block || f.signature?.optional)
|
|
@@ -2910,7 +2921,7 @@ function processParams(f) {
|
|
|
2910
2921
|
if (isConstructor) {
|
|
2911
2922
|
const { ancestor } = findAncestor(f, ($5) => $5.type === "ClassExpression");
|
|
2912
2923
|
if (ancestor != null) {
|
|
2913
|
-
const fields = new Set(gatherRecursiveWithinFunction(ancestor, ($6) => $6.type === "FieldDefinition").map(($7) => $7.id).filter((
|
|
2924
|
+
const fields = new Set(gatherRecursiveWithinFunction(ancestor, ($6) => $6.type === "FieldDefinition").map(($7) => $7.id).filter((a1) => typeof a1 === "object" && a1 != null && "type" in a1 && a1.type === "Identifier").map(($8) => $8.name));
|
|
2914
2925
|
const classExpressions = ancestor.body.expressions;
|
|
2915
2926
|
let index = findChildIndex(classExpressions, f);
|
|
2916
2927
|
assert.notEqual(index, -1, "Could not find constructor in class");
|
|
@@ -2962,10 +2973,10 @@ function processParams(f) {
|
|
|
2962
2973
|
if (isConstructor) {
|
|
2963
2974
|
const superCalls = gatherNodes(
|
|
2964
2975
|
expressions,
|
|
2965
|
-
(
|
|
2976
|
+
(a2) => typeof a2 === "object" && a2 != null && "type" in a2 && a2.type === "CallExpression" && "children" in a2 && Array.isArray(a2.children) && a2.children.length >= 1 && typeof a2.children[0] === "object" && a2.children[0] != null && "token" in a2.children[0] && a2.children[0].token === "super"
|
|
2966
2977
|
);
|
|
2967
2978
|
if (superCalls.length) {
|
|
2968
|
-
const { child } = findAncestor(superCalls[0], (
|
|
2979
|
+
const { child } = findAncestor(superCalls[0], (a3) => a3 === block);
|
|
2969
2980
|
const index = findChildIndex(expressions, child);
|
|
2970
2981
|
if (index < 0) {
|
|
2971
2982
|
throw new Error("Could not find super call within top-level expressions");
|
|
@@ -2975,6 +2986,7 @@ function processParams(f) {
|
|
|
2975
2986
|
}
|
|
2976
2987
|
}
|
|
2977
2988
|
expressions.unshift(...prefix);
|
|
2989
|
+
braceBlock(block);
|
|
2978
2990
|
}
|
|
2979
2991
|
function processSignature(f) {
|
|
2980
2992
|
const { block, signature } = f;
|
|
@@ -3097,11 +3109,11 @@ function processCoffeeDo(ws, expression) {
|
|
|
3097
3109
|
parameter = {
|
|
3098
3110
|
...parameter,
|
|
3099
3111
|
initializer: void 0,
|
|
3100
|
-
children: parameter.children.filter((
|
|
3112
|
+
children: parameter.children.filter((a4) => a4 !== initializer)
|
|
3101
3113
|
};
|
|
3102
3114
|
} else {
|
|
3103
3115
|
args.push(parameter.children.filter(
|
|
3104
|
-
(
|
|
3116
|
+
(a5) => a5 !== parameter.typeSuffix
|
|
3105
3117
|
));
|
|
3106
3118
|
}
|
|
3107
3119
|
}
|
|
@@ -3174,7 +3186,7 @@ function makeAmpersandFunction(rhs) {
|
|
|
3174
3186
|
}
|
|
3175
3187
|
if (gatherRecursiveWithinFunction(
|
|
3176
3188
|
block,
|
|
3177
|
-
(
|
|
3189
|
+
(a6) => a6 === ref
|
|
3178
3190
|
).length > 1) {
|
|
3179
3191
|
fn.ampersandBlock = false;
|
|
3180
3192
|
}
|
|
@@ -7733,6 +7745,8 @@ var grammar = {
|
|
|
7733
7745
|
NamedImports,
|
|
7734
7746
|
OperatorNamedImports,
|
|
7735
7747
|
FromClause,
|
|
7748
|
+
ImpliedFromClause,
|
|
7749
|
+
ImpliedFrom,
|
|
7736
7750
|
ImportAssertion,
|
|
7737
7751
|
TypeAndImportSpecifier,
|
|
7738
7752
|
ImportSpecifier,
|
|
@@ -8069,6 +8083,7 @@ var grammar = {
|
|
|
8069
8083
|
NestedTypeArgumentList,
|
|
8070
8084
|
NestedTypeArgument,
|
|
8071
8085
|
SingleLineTypeArgumentList,
|
|
8086
|
+
WTypeArgument,
|
|
8072
8087
|
TypeArgumentDelimited,
|
|
8073
8088
|
TypeArgument,
|
|
8074
8089
|
TypeArgumentDelimiter,
|
|
@@ -8417,7 +8432,7 @@ var $R28 = (0, import_lib4.$R)(new RegExp("(?!\\+\\+|--)[!~+-](?!\\s)", "suy"));
|
|
|
8417
8432
|
var $R29 = (0, import_lib4.$R)(new RegExp("[:.]", "suy"));
|
|
8418
8433
|
var $R30 = (0, import_lib4.$R)(new RegExp("(?=for|if|loop|unless|until|while)", "suy"));
|
|
8419
8434
|
var $R31 = (0, import_lib4.$R)(new RegExp("(?=loop|comptime|do|for|until|while)", "suy"));
|
|
8420
|
-
var $R32 = (0, import_lib4.$R)(new RegExp('[^;"\\s]+', "suy"));
|
|
8435
|
+
var $R32 = (0, import_lib4.$R)(new RegExp('[^;"\\s=>]+', "suy"));
|
|
8421
8436
|
var $R33 = (0, import_lib4.$R)(new RegExp("(?=[0-9.])", "suy"));
|
|
8422
8437
|
var $R34 = (0, import_lib4.$R)(new RegExp("(?:0|[1-9](?:_[0-9]|[0-9])*)n", "suy"));
|
|
8423
8438
|
var $R35 = (0, import_lib4.$R)(new RegExp("(?:0|[1-9](?:_[0-9]|[0-9])*)(?=\\.(?:\\p{ID_Start}|[_$]))", "suy"));
|
|
@@ -8930,10 +8945,10 @@ var RHS$$ = [RHS$0, RHS$1];
|
|
|
8930
8945
|
function RHS(ctx, state2) {
|
|
8931
8946
|
return (0, import_lib4.$EVENT_C)(ctx, state2, "RHS", RHS$$);
|
|
8932
8947
|
}
|
|
8933
|
-
var UnaryExpression$0 = (0, import_lib4.$TS)((0, import_lib4.$S)(IndentedApplicationAllowed, (0, import_lib4.$P)(UnaryOp), (0, import_lib4.$C)(ArrayLiteral, NestedArgumentList), (0, import_lib4.$E)(UnaryPostfix)), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
8948
|
+
var UnaryExpression$0 = (0, import_lib4.$TS)((0, import_lib4.$S)(IndentedApplicationAllowed, (0, import_lib4.$P)(UnaryOp), (0, import_lib4.$C)(ArrayLiteral, NestedArgumentList), (0, import_lib4.$N)(CallExpressionRest), (0, import_lib4.$E)(UnaryPostfix)), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
8934
8949
|
var pre = $2;
|
|
8935
8950
|
var args = $3;
|
|
8936
|
-
var post = $
|
|
8951
|
+
var post = $5;
|
|
8937
8952
|
return processUnaryNestedExpression(pre, args, post) ?? $skip;
|
|
8938
8953
|
});
|
|
8939
8954
|
var UnaryExpression$1 = (0, import_lib4.$TS)((0, import_lib4.$S)((0, import_lib4.$Q)(UnaryOp), UnaryBody, (0, import_lib4.$E)(UnaryPostfix)), function($skip, $loc, $0, $1, $2, $3) {
|
|
@@ -9926,14 +9941,22 @@ var CallExpression$0 = (0, import_lib4.$TS)((0, import_lib4.$S)(Super, Arguments
|
|
|
9926
9941
|
var CallExpression$1 = (0, import_lib4.$TS)((0, import_lib4.$S)(Import, _, NamedImports, __, FromClause), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
9927
9942
|
return dynamizeImportDeclarationExpression($0);
|
|
9928
9943
|
});
|
|
9929
|
-
var CallExpression$2 = (0, import_lib4.$TS)((0, import_lib4.$S)(
|
|
9944
|
+
var CallExpression$2 = (0, import_lib4.$TS)((0, import_lib4.$S)(FromClause, __, Import, _, NamedImports), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
9945
|
+
var from = $1;
|
|
9946
|
+
var fws = $2;
|
|
9947
|
+
var i = $3;
|
|
9948
|
+
var iws = $4;
|
|
9949
|
+
var imports = $5;
|
|
9950
|
+
return dynamizeImportDeclarationExpression([i, iws, imports, fws, from]);
|
|
9951
|
+
});
|
|
9952
|
+
var CallExpression$3 = (0, import_lib4.$TS)((0, import_lib4.$S)((0, import_lib4.$EXPECT)($L15, 'CallExpression "import"'), ArgumentsWithTrailingMemberExpressions, (0, import_lib4.$Q)(CallExpressionRest)), function($skip, $loc, $0, $1, $2, $3) {
|
|
9930
9953
|
var rest = $3;
|
|
9931
9954
|
return processCallMemberExpression({
|
|
9932
9955
|
type: "CallExpression",
|
|
9933
9956
|
children: [$1, ...$2, ...rest.flat()]
|
|
9934
9957
|
});
|
|
9935
9958
|
});
|
|
9936
|
-
var CallExpression$
|
|
9959
|
+
var CallExpression$4 = (0, import_lib4.$TS)((0, import_lib4.$S)(MemberExpression, AllowedTrailingMemberExpressions, (0, import_lib4.$Q)(CallExpressionRest)), function($skip, $loc, $0, $1, $2, $3) {
|
|
9937
9960
|
var member = $1;
|
|
9938
9961
|
var trailing = $2;
|
|
9939
9962
|
var rest = $3;
|
|
@@ -9946,7 +9969,7 @@ var CallExpression$3 = (0, import_lib4.$TS)((0, import_lib4.$S)(MemberExpression
|
|
|
9946
9969
|
}
|
|
9947
9970
|
return member;
|
|
9948
9971
|
});
|
|
9949
|
-
var CallExpression$$ = [CallExpression$0, CallExpression$1, CallExpression$2, CallExpression$3];
|
|
9972
|
+
var CallExpression$$ = [CallExpression$0, CallExpression$1, CallExpression$2, CallExpression$3, CallExpression$4];
|
|
9950
9973
|
function CallExpression(ctx, state2) {
|
|
9951
9974
|
return (0, import_lib4.$EVENT_C)(ctx, state2, "CallExpression", CallExpression$$);
|
|
9952
9975
|
}
|
|
@@ -13976,9 +13999,12 @@ var ForBinding$0 = (0, import_lib4.$TS)((0, import_lib4.$S)((0, import_lib4.$C)(
|
|
|
13976
13999
|
function ForBinding(ctx, state2) {
|
|
13977
14000
|
return (0, import_lib4.$EVENT)(ctx, state2, "ForBinding", ForBinding$0);
|
|
13978
14001
|
}
|
|
13979
|
-
var SwitchStatement$0 = (0, import_lib4.$TS)((0, import_lib4.$S)(Switch, (0, import_lib4.$C)(EmptyCondition, Condition), CaseBlock), function($skip, $loc, $0, $1, $2, $3) {
|
|
13980
|
-
var
|
|
13981
|
-
var
|
|
14002
|
+
var SwitchStatement$0 = (0, import_lib4.$TS)((0, import_lib4.$S)(Switch, ForbidNewlineBinaryOp, (0, import_lib4.$E)((0, import_lib4.$C)(EmptyCondition, Condition)), RestoreNewlineBinaryOp, CaseBlock), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
14003
|
+
var s = $1;
|
|
14004
|
+
var condition = $3;
|
|
14005
|
+
var caseBlock = $5;
|
|
14006
|
+
if (!condition)
|
|
14007
|
+
return $skip;
|
|
13982
14008
|
if (condition.type === "EmptyCondition") {
|
|
13983
14009
|
caseBlock.clauses.forEach(({ cases }) => {
|
|
13984
14010
|
if (cases) {
|
|
@@ -13998,7 +14024,8 @@ var SwitchStatement$0 = (0, import_lib4.$TS)((0, import_lib4.$S)(Switch, (0, imp
|
|
|
13998
14024
|
}
|
|
13999
14025
|
return {
|
|
14000
14026
|
type: "SwitchStatement",
|
|
14001
|
-
children:
|
|
14027
|
+
children: [s, condition, caseBlock],
|
|
14028
|
+
// omit NewlineBinaryOp control
|
|
14002
14029
|
condition,
|
|
14003
14030
|
caseBlock
|
|
14004
14031
|
};
|
|
@@ -14366,8 +14393,8 @@ var SingleLineExpressionWithIndentedApplicationForbidden$0 = (0, import_lib4.$TS
|
|
|
14366
14393
|
function SingleLineExpressionWithIndentedApplicationForbidden(ctx, state2) {
|
|
14367
14394
|
return (0, import_lib4.$EVENT)(ctx, state2, "SingleLineExpressionWithIndentedApplicationForbidden", SingleLineExpressionWithIndentedApplicationForbidden$0);
|
|
14368
14395
|
}
|
|
14369
|
-
var ExpressionWithObjectApplicationForbidden$0 = (0, import_lib4.$TS)((0, import_lib4.$S)(ForbidBracedApplication, ForbidIndentedApplication,
|
|
14370
|
-
var exp = $
|
|
14396
|
+
var ExpressionWithObjectApplicationForbidden$0 = (0, import_lib4.$TS)((0, import_lib4.$S)(ForbidBracedApplication, ForbidIndentedApplication, (0, import_lib4.$E)(Expression), RestoreBracedApplication, RestoreIndentedApplication), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
14397
|
+
var exp = $3;
|
|
14371
14398
|
if (exp)
|
|
14372
14399
|
return exp;
|
|
14373
14400
|
return $skip;
|
|
@@ -14756,36 +14783,41 @@ var ImportDeclaration$0 = (0, import_lib4.$TS)((0, import_lib4.$S)(Import, _, Id
|
|
|
14756
14783
|
children: [imp, $0.slice(1)]
|
|
14757
14784
|
};
|
|
14758
14785
|
});
|
|
14759
|
-
var ImportDeclaration$1 = (0, import_lib4.$
|
|
14760
|
-
var
|
|
14761
|
-
var
|
|
14762
|
-
|
|
14763
|
-
|
|
14764
|
-
var
|
|
14765
|
-
var
|
|
14766
|
-
var imports = $6;
|
|
14767
|
-
var from = $8;
|
|
14786
|
+
var ImportDeclaration$1 = (0, import_lib4.$TS)((0, import_lib4.$S)((0, import_lib4.$C)((0, import_lib4.$S)(Import, __), ImpliedImport), Operator, (0, import_lib4.$E)(OperatorBehavior), __, OperatorNamedImports, __, FromClause), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7) {
|
|
14787
|
+
var i = $1;
|
|
14788
|
+
var behavior = $3;
|
|
14789
|
+
var ws1 = $4;
|
|
14790
|
+
var imports = $5;
|
|
14791
|
+
var ws2 = $6;
|
|
14792
|
+
var from = $7;
|
|
14768
14793
|
imports.specifiers.forEach((spec) => {
|
|
14769
14794
|
state.operators.set(spec.binding.name, spec.behavior ?? behavior);
|
|
14770
14795
|
});
|
|
14771
14796
|
return {
|
|
14772
14797
|
type: "ImportDeclaration",
|
|
14773
|
-
children: [
|
|
14774
|
-
// omit $
|
|
14798
|
+
children: [i, trimFirstSpace(ws1), imports, ws2, from],
|
|
14799
|
+
// omit $2 = Operator and $3 = OperatorBehavior
|
|
14775
14800
|
imports,
|
|
14776
14801
|
from
|
|
14777
14802
|
};
|
|
14778
14803
|
});
|
|
14779
|
-
var ImportDeclaration$
|
|
14780
|
-
var
|
|
14781
|
-
var
|
|
14782
|
-
|
|
14804
|
+
var ImportDeclaration$2 = (0, import_lib4.$TS)((0, import_lib4.$S)(Import, __, (0, import_lib4.$E)((0, import_lib4.$S)(TypeKeyword, __)), ImportClause, __, FromClause), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
|
|
14805
|
+
var t = $3;
|
|
14806
|
+
var imports = $4;
|
|
14807
|
+
var from = $6;
|
|
14808
|
+
return {
|
|
14809
|
+
type: "ImportDeclaration",
|
|
14810
|
+
children: $0,
|
|
14811
|
+
imports,
|
|
14812
|
+
from,
|
|
14813
|
+
ts: !!t
|
|
14814
|
+
};
|
|
14783
14815
|
});
|
|
14784
|
-
var ImportDeclaration$
|
|
14816
|
+
var ImportDeclaration$3 = (0, import_lib4.$T)((0, import_lib4.$S)(Import, __, ModuleSpecifier), function(value) {
|
|
14785
14817
|
var module2 = value[2];
|
|
14786
14818
|
return { "type": "ImportDeclaration", "children": value, "module": module2 };
|
|
14787
14819
|
});
|
|
14788
|
-
var ImportDeclaration$
|
|
14820
|
+
var ImportDeclaration$4 = (0, import_lib4.$TS)((0, import_lib4.$S)(ImpliedImport, (0, import_lib4.$E)((0, import_lib4.$S)(TypeKeyword, __)), ImportClause, __, FromClause), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
14789
14821
|
var i = $1;
|
|
14790
14822
|
var t = $2;
|
|
14791
14823
|
var imports = $3;
|
|
@@ -14798,22 +14830,40 @@ var ImportDeclaration$5 = (0, import_lib4.$TS)((0, import_lib4.$S)(ImpliedImport
|
|
|
14798
14830
|
const children = [i, t, imports, w, from];
|
|
14799
14831
|
return { type: "ImportDeclaration", ts: !!t, children, imports, from };
|
|
14800
14832
|
});
|
|
14801
|
-
var ImportDeclaration$
|
|
14802
|
-
var
|
|
14803
|
-
var
|
|
14804
|
-
var
|
|
14805
|
-
var
|
|
14833
|
+
var ImportDeclaration$5 = (0, import_lib4.$TS)((0, import_lib4.$S)(ImpliedFromClause, __, Import, __, Operator, (0, import_lib4.$E)(OperatorBehavior), __, OperatorNamedImports), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8) {
|
|
14834
|
+
var from = $1;
|
|
14835
|
+
var fws = $2;
|
|
14836
|
+
var i = $3;
|
|
14837
|
+
var iws = $4;
|
|
14838
|
+
var behavior = $6;
|
|
14839
|
+
var ows = $7;
|
|
14840
|
+
var imports = $8;
|
|
14806
14841
|
imports.specifiers.forEach((spec) => {
|
|
14807
14842
|
state.operators.set(spec.binding.name, spec.behavior ?? behavior);
|
|
14808
14843
|
});
|
|
14809
14844
|
return {
|
|
14810
14845
|
type: "ImportDeclaration",
|
|
14811
|
-
children: [
|
|
14812
|
-
// omit
|
|
14846
|
+
children: [i, iws, trimFirstSpace(ows), imports, fws, from],
|
|
14847
|
+
// omit Operator and OperatorBehavior
|
|
14813
14848
|
imports,
|
|
14814
14849
|
from
|
|
14815
14850
|
};
|
|
14816
14851
|
});
|
|
14852
|
+
var ImportDeclaration$6 = (0, import_lib4.$TS)((0, import_lib4.$S)(ImpliedFromClause, __, Import, __, (0, import_lib4.$E)((0, import_lib4.$S)(TypeKeyword, __)), ImportClause), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
|
|
14853
|
+
var from = $1;
|
|
14854
|
+
var fws = $2;
|
|
14855
|
+
var i = $3;
|
|
14856
|
+
var iws = $4;
|
|
14857
|
+
var t = $5;
|
|
14858
|
+
var imports = $6;
|
|
14859
|
+
return {
|
|
14860
|
+
type: "ImportDeclaration",
|
|
14861
|
+
children: [i, iws, t, imports, fws, from],
|
|
14862
|
+
imports,
|
|
14863
|
+
from,
|
|
14864
|
+
ts: !!t
|
|
14865
|
+
};
|
|
14866
|
+
});
|
|
14817
14867
|
var ImportDeclaration$$ = [ImportDeclaration$0, ImportDeclaration$1, ImportDeclaration$2, ImportDeclaration$3, ImportDeclaration$4, ImportDeclaration$5, ImportDeclaration$6];
|
|
14818
14868
|
function ImportDeclaration(ctx, state2) {
|
|
14819
14869
|
return (0, import_lib4.$EVENT_C)(ctx, state2, "ImportDeclaration", ImportDeclaration$$);
|
|
@@ -14898,6 +14948,21 @@ var FromClause$0 = (0, import_lib4.$TS)((0, import_lib4.$S)(From, __, ModuleSpec
|
|
|
14898
14948
|
function FromClause(ctx, state2) {
|
|
14899
14949
|
return (0, import_lib4.$EVENT)(ctx, state2, "FromClause", FromClause$0);
|
|
14900
14950
|
}
|
|
14951
|
+
var ImpliedFromClause$0 = (0, import_lib4.$TS)((0, import_lib4.$S)((0, import_lib4.$C)((0, import_lib4.$S)(From, __), ImpliedFrom), ModuleSpecifier), function($skip, $loc, $0, $1, $2) {
|
|
14952
|
+
var module2 = $2;
|
|
14953
|
+
if (!Array.isArray(module2))
|
|
14954
|
+
return $0;
|
|
14955
|
+
return [$1, ...module2];
|
|
14956
|
+
});
|
|
14957
|
+
function ImpliedFromClause(ctx, state2) {
|
|
14958
|
+
return (0, import_lib4.$EVENT)(ctx, state2, "ImpliedFromClause", ImpliedFromClause$0);
|
|
14959
|
+
}
|
|
14960
|
+
var ImpliedFrom$0 = (0, import_lib4.$TV)((0, import_lib4.$EXPECT)($L0, 'ImpliedFrom ""'), function($skip, $loc, $0, $1) {
|
|
14961
|
+
return { $loc, token: "from " };
|
|
14962
|
+
});
|
|
14963
|
+
function ImpliedFrom(ctx, state2) {
|
|
14964
|
+
return (0, import_lib4.$EVENT)(ctx, state2, "ImpliedFrom", ImpliedFrom$0);
|
|
14965
|
+
}
|
|
14901
14966
|
var ImportAssertion$0 = (0, import_lib4.$TS)((0, import_lib4.$S)((0, import_lib4.$E)(_), (0, import_lib4.$C)((0, import_lib4.$EXPECT)($L124, 'ImportAssertion "with"'), (0, import_lib4.$EXPECT)($L125, 'ImportAssertion "assert"')), NonIdContinue, (0, import_lib4.$E)(_), ObjectLiteral), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
14902
14967
|
var keyword = $2;
|
|
14903
14968
|
var object = $5;
|
|
@@ -15030,7 +15095,7 @@ var UnprocessedModuleSpecifier$$ = [UnprocessedModuleSpecifier$0, UnprocessedMod
|
|
|
15030
15095
|
function UnprocessedModuleSpecifier(ctx, state2) {
|
|
15031
15096
|
return (0, import_lib4.$EVENT_C)(ctx, state2, "UnprocessedModuleSpecifier", UnprocessedModuleSpecifier$$);
|
|
15032
15097
|
}
|
|
15033
|
-
var UnquotedSpecifier$0 = (0, import_lib4.$TV)((0, import_lib4.$EXPECT)($R32, 'UnquotedSpecifier /[^;"\\s]+/'), function($skip, $loc, $0, $1) {
|
|
15098
|
+
var UnquotedSpecifier$0 = (0, import_lib4.$TV)((0, import_lib4.$EXPECT)($R32, 'UnquotedSpecifier /[^;"\\s=>]+/'), function($skip, $loc, $0, $1) {
|
|
15034
15099
|
var spec = $0;
|
|
15035
15100
|
return { $loc, token: `"${spec}"` };
|
|
15036
15101
|
});
|
|
@@ -15083,13 +15148,26 @@ var ExportDeclaration$2 = (0, import_lib4.$TS)((0, import_lib4.$S)((0, import_li
|
|
|
15083
15148
|
return { type: "ExportDeclaration", declaration, ts: declaration.ts, children: $0 };
|
|
15084
15149
|
});
|
|
15085
15150
|
var ExportDeclaration$3 = (0, import_lib4.$TS)((0, import_lib4.$S)(Export, __, ExportFromClause, __, FromClause), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
15086
|
-
|
|
15151
|
+
var exports2 = $3;
|
|
15152
|
+
return { type: "ExportDeclaration", ts: exports2.ts, children: $0 };
|
|
15153
|
+
});
|
|
15154
|
+
var ExportDeclaration$4 = (0, import_lib4.$TS)((0, import_lib4.$S)(ImpliedFromClause, __, Export, __, ExportFromClause), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
15155
|
+
var from = $1;
|
|
15156
|
+
var fws = $2;
|
|
15157
|
+
var e = $3;
|
|
15158
|
+
var ews = $4;
|
|
15159
|
+
var exports2 = $5;
|
|
15160
|
+
return {
|
|
15161
|
+
type: "ExportDeclaration",
|
|
15162
|
+
ts: exports2.ts,
|
|
15163
|
+
children: [e, ews, exports2, " ", from, trimFirstSpace(fws)]
|
|
15164
|
+
};
|
|
15087
15165
|
});
|
|
15088
|
-
var ExportDeclaration$
|
|
15166
|
+
var ExportDeclaration$5 = (0, import_lib4.$TS)((0, import_lib4.$S)((0, import_lib4.$E)(Decorators), Export, __, (0, import_lib4.$C)(Declaration, VariableStatement, TypeAndNamedExports, ExportVarDec)), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
15089
15167
|
var declaration = $4;
|
|
15090
15168
|
return { type: "ExportDeclaration", declaration, ts: declaration.ts, children: $0 };
|
|
15091
15169
|
});
|
|
15092
|
-
var ExportDeclaration$$ = [ExportDeclaration$0, ExportDeclaration$1, ExportDeclaration$2, ExportDeclaration$3, ExportDeclaration$4];
|
|
15170
|
+
var ExportDeclaration$$ = [ExportDeclaration$0, ExportDeclaration$1, ExportDeclaration$2, ExportDeclaration$3, ExportDeclaration$4, ExportDeclaration$5];
|
|
15093
15171
|
function ExportDeclaration(ctx, state2) {
|
|
15094
15172
|
return (0, import_lib4.$EVENT_C)(ctx, state2, "ExportDeclaration", ExportDeclaration$$);
|
|
15095
15173
|
}
|
|
@@ -18273,11 +18351,12 @@ function TypeArrowFunction(ctx, state2) {
|
|
|
18273
18351
|
}
|
|
18274
18352
|
var TypeArguments$0 = (0, import_lib4.$TS)((0, import_lib4.$S)(OpenAngleBracket, (0, import_lib4.$P)((0, import_lib4.$S)(__, TypeArgumentDelimited)), __, CloseAngleBracket), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
18275
18353
|
var args = $2;
|
|
18276
|
-
args = args.
|
|
18354
|
+
args = args.flatMap(([ws, [arg, delim]]) => [prepend(ws, arg), delim]);
|
|
18355
|
+
args.pop();
|
|
18277
18356
|
return {
|
|
18278
18357
|
type: "TypeArguments",
|
|
18279
18358
|
ts: true,
|
|
18280
|
-
|
|
18359
|
+
args,
|
|
18281
18360
|
children: $0
|
|
18282
18361
|
};
|
|
18283
18362
|
});
|
|
@@ -18289,10 +18368,15 @@ var ImplicitTypeArguments$0 = (0, import_lib4.$TS)((0, import_lib4.$S)(TypeAppli
|
|
|
18289
18368
|
var ws = $3;
|
|
18290
18369
|
var args = $4;
|
|
18291
18370
|
var close = $5;
|
|
18292
|
-
|
|
18293
|
-
if (last
|
|
18371
|
+
const last = args[args.length - 1];
|
|
18372
|
+
if (isComma(last))
|
|
18294
18373
|
args = args.slice(0, -1);
|
|
18295
|
-
return
|
|
18374
|
+
return {
|
|
18375
|
+
type: "TypeArguments",
|
|
18376
|
+
ts: true,
|
|
18377
|
+
args,
|
|
18378
|
+
children: [open, ws, args, close]
|
|
18379
|
+
};
|
|
18296
18380
|
});
|
|
18297
18381
|
function ImplicitTypeArguments(ctx, state2) {
|
|
18298
18382
|
return (0, import_lib4.$EVENT)(ctx, state2, "ImplicitTypeArguments", ImplicitTypeArguments$0);
|
|
@@ -18310,10 +18394,10 @@ var ForbiddenImplicitTypeCalls$$ = [ForbiddenImplicitTypeCalls$0, ForbiddenImpli
|
|
|
18310
18394
|
function ForbiddenImplicitTypeCalls(ctx, state2) {
|
|
18311
18395
|
return (0, import_lib4.$EVENT_C)(ctx, state2, "ForbiddenImplicitTypeCalls", ForbiddenImplicitTypeCalls$$);
|
|
18312
18396
|
}
|
|
18313
|
-
var TypeArgumentList$0 = (0, import_lib4.$TS)((0, import_lib4.$S)((0, import_lib4.$N)(EOS), TypeArgument, (0, import_lib4.$Q)((0, import_lib4.$S)(CommaDelimiter, (0, import_lib4.$N)(EOS),
|
|
18397
|
+
var TypeArgumentList$0 = (0, import_lib4.$TS)((0, import_lib4.$S)((0, import_lib4.$N)(EOS), TypeArgument, (0, import_lib4.$Q)((0, import_lib4.$S)(CommaDelimiter, (0, import_lib4.$N)(EOS), WTypeArgument)), (0, import_lib4.$P)((0, import_lib4.$S)(CommaDelimiter, (0, import_lib4.$C)(NestedTypeBulletedTuple, NestedInterfaceBlock, NestedTypeArgumentList)))), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
18314
18398
|
return [
|
|
18315
18399
|
$2,
|
|
18316
|
-
...$3.flatMap(([comma, eos,
|
|
18400
|
+
...$3.flatMap(([comma, eos, arg]) => [comma, arg]),
|
|
18317
18401
|
...$4.flatMap(
|
|
18318
18402
|
([comma, args]) => Array.isArray(args) ? [comma, ...args] : [comma, args]
|
|
18319
18403
|
)
|
|
@@ -18328,10 +18412,10 @@ var TypeArgumentList$1 = (0, import_lib4.$TS)((0, import_lib4.$S)((0, import_lib
|
|
|
18328
18412
|
];
|
|
18329
18413
|
});
|
|
18330
18414
|
var TypeArgumentList$2 = NestedTypeArgumentList;
|
|
18331
|
-
var TypeArgumentList$3 = (0, import_lib4.$TS)((0, import_lib4.$S)(TypeArgument, (0, import_lib4.$Q)((0, import_lib4.$S)(CommaDelimiter,
|
|
18415
|
+
var TypeArgumentList$3 = (0, import_lib4.$TS)((0, import_lib4.$S)(TypeArgument, (0, import_lib4.$Q)((0, import_lib4.$S)(CommaDelimiter, WTypeArgument))), function($skip, $loc, $0, $1, $2) {
|
|
18332
18416
|
return [
|
|
18333
18417
|
$1,
|
|
18334
|
-
...$2.flatMap(([comma,
|
|
18418
|
+
...$2.flatMap(([comma, arg]) => [comma, arg])
|
|
18335
18419
|
];
|
|
18336
18420
|
});
|
|
18337
18421
|
var TypeArgumentList$$ = [TypeArgumentList$0, TypeArgumentList$1, TypeArgumentList$2, TypeArgumentList$3];
|
|
@@ -18358,17 +18442,25 @@ var NestedTypeArgument$0 = (0, import_lib4.$TS)((0, import_lib4.$S)(Nested, Sing
|
|
|
18358
18442
|
function NestedTypeArgument(ctx, state2) {
|
|
18359
18443
|
return (0, import_lib4.$EVENT)(ctx, state2, "NestedTypeArgument", NestedTypeArgument$0);
|
|
18360
18444
|
}
|
|
18361
|
-
var SingleLineTypeArgumentList$0 = (0, import_lib4.$TS)((0, import_lib4.$S)(
|
|
18362
|
-
return [$1, ...$2
|
|
18445
|
+
var SingleLineTypeArgumentList$0 = (0, import_lib4.$TS)((0, import_lib4.$S)(WTypeArgument, (0, import_lib4.$Q)((0, import_lib4.$S)((0, import_lib4.$S)((0, import_lib4.$E)(_), Comma), WTypeArgument))), function($skip, $loc, $0, $1, $2) {
|
|
18446
|
+
return [$1, ...$2];
|
|
18363
18447
|
});
|
|
18364
18448
|
function SingleLineTypeArgumentList(ctx, state2) {
|
|
18365
18449
|
return (0, import_lib4.$EVENT)(ctx, state2, "SingleLineTypeArgumentList", SingleLineTypeArgumentList$0);
|
|
18366
18450
|
}
|
|
18451
|
+
var WTypeArgument$0 = (0, import_lib4.$TS)((0, import_lib4.$S)((0, import_lib4.$E)(_), TypeArgument), function($skip, $loc, $0, $1, $2) {
|
|
18452
|
+
return prepend($1, $2);
|
|
18453
|
+
});
|
|
18454
|
+
function WTypeArgument(ctx, state2) {
|
|
18455
|
+
return (0, import_lib4.$EVENT)(ctx, state2, "WTypeArgument", WTypeArgument$0);
|
|
18456
|
+
}
|
|
18367
18457
|
var TypeArgumentDelimited$0 = (0, import_lib4.$S)(TypeArgument, TypeArgumentDelimiter);
|
|
18368
18458
|
function TypeArgumentDelimited(ctx, state2) {
|
|
18369
18459
|
return (0, import_lib4.$EVENT)(ctx, state2, "TypeArgumentDelimited", TypeArgumentDelimited$0);
|
|
18370
18460
|
}
|
|
18371
|
-
var TypeArgument$0 = Type
|
|
18461
|
+
var TypeArgument$0 = (0, import_lib4.$T)(Type, function(value) {
|
|
18462
|
+
return { "type": "TypeArgument", "ts": true, "t": value, "children": [value] };
|
|
18463
|
+
});
|
|
18372
18464
|
function TypeArgument(ctx, state2) {
|
|
18373
18465
|
return (0, import_lib4.$EVENT)(ctx, state2, "TypeArgument", TypeArgument$0);
|
|
18374
18466
|
}
|