@danielx/civet 0.5.74 → 0.5.75
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/README.md +1 -36
- package/dist/browser.js +73 -18
- package/dist/main.js +73 -18
- package/dist/main.mjs +73 -18
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,6 +10,7 @@ Civet
|
|
|
10
10
|
The modern way to write TypeScript.
|
|
11
11
|
|
|
12
12
|
- [Documentation](https://civet.dev/)
|
|
13
|
+
- [Design Philosophy](https://civet.dev/philosophy)
|
|
13
14
|
- [Civet Playground](https://civet.dev/playground)
|
|
14
15
|
- [Civet VSCode Extension](https://marketplace.visualstudio.com/items?itemName=DanielX.civet)
|
|
15
16
|
- [Discord Server](https://discord.gg/xkrW9GebBc)
|
|
@@ -371,42 +372,6 @@ esbuild.build({
|
|
|
371
372
|
|
|
372
373
|
It's super fast and works great!
|
|
373
374
|
|
|
374
|
-
Philosophy
|
|
375
|
-
---
|
|
376
|
-
|
|
377
|
-
Civet is a **large language that feels small**. Civet is large because it is mostly a **superset of TypeScript**,
|
|
378
|
-
an already large language. Civet feels small because of the coherent design aesthetic: related
|
|
379
|
-
features look and behave similarly, so when seeing a new feature you can have a good idea what it does,
|
|
380
|
-
and your existing knowledge of JavaScript and other languages leads you in the right direction.
|
|
381
|
-
|
|
382
|
-
Civet works with **existing tools**. We're not trying to replace the TypeScript type checker; we want to
|
|
383
|
-
amplify its power. We're not trying to change ES semantics; we want to present them in a coherent and expressive
|
|
384
|
-
way.
|
|
385
|
-
|
|
386
|
-
**Less syntax** is preferred.
|
|
387
|
-
|
|
388
|
-
**Context matters**. The same tokens can mean different things in different contexts. This shouldn't be arbitrary
|
|
389
|
-
but based on pragmatic concerns. Things should be consistent where possible, especially conceptually.
|
|
390
|
-
|
|
391
|
-
Civet builds on top of **history**. We've taken inspiration from languages like CoffeeScript, Elm, LiveScript, Flow,
|
|
392
|
-
Haskell, Perl, Python, Ruby, Crystal, Bash, and others.
|
|
393
|
-
|
|
394
|
-
Civet is **pragmatic**. Civet design is informed by 25+ years of JavaScript development. Frontend frameworks
|
|
395
|
-
have come and gone but they all addressed issues that were important for their time. We focus heavily on
|
|
396
|
-
addressing concerns that real developers feel every day. A key criteria for evaluating features is "how does it
|
|
397
|
-
work in practice?".
|
|
398
|
-
|
|
399
|
-
Civet **evolves**. As the official JS and TS specifications evolve into the future, Civet also evolves favoring **compatibility**.
|
|
400
|
-
This may lead us to difficult choices where the future spec has evolved differently than we anticipated (pipe operators,
|
|
401
|
-
do expressions, pattern matching). In those cases, Civet will adapt to match the latest spec while providing configuration
|
|
402
|
-
options to allow migration bit by bit while keeping existing code working.
|
|
403
|
-
|
|
404
|
-
Civet is **configurable**. There is no single "right way" for everyone at all times. Some of us have older CoffeeScript
|
|
405
|
-
codebases that would benefit from added types. Others have massive TypeScript applications that could benefit from
|
|
406
|
-
new language features and shorthand syntax. Civet provides a way to get the benefits bit by bit without a complete
|
|
407
|
-
rewrite. This same configurability lets us experiment with language features to gain experience and improve them before
|
|
408
|
-
locking them in. It also allows us to adapt to a changing future.
|
|
409
|
-
|
|
410
375
|
Sponsorship
|
|
411
376
|
---
|
|
412
377
|
If you are so inclined, you can sponsor Civet on [Open Collective](https://opencollective.com/civet).
|
package/dist/browser.js
CHANGED
|
@@ -600,6 +600,7 @@ ${input.slice(result.pos)}
|
|
|
600
600
|
NestedElementList,
|
|
601
601
|
NestedElement,
|
|
602
602
|
ArrayElementDelimiter,
|
|
603
|
+
ElementListWithIndentedApplicationForbidden,
|
|
603
604
|
ElementList,
|
|
604
605
|
ElementListRest,
|
|
605
606
|
ArrayElementExpression,
|
|
@@ -5484,9 +5485,13 @@ ${input.slice(result.pos)}
|
|
|
5484
5485
|
};
|
|
5485
5486
|
}
|
|
5486
5487
|
const { ref } = rhs;
|
|
5488
|
+
const children = [ref, " => ", prefix, rhs];
|
|
5489
|
+
if (module.hasAwait(rhs)) {
|
|
5490
|
+
children.unshift("async ");
|
|
5491
|
+
}
|
|
5487
5492
|
return {
|
|
5488
5493
|
type: "ArrowFunction",
|
|
5489
|
-
children
|
|
5494
|
+
children,
|
|
5490
5495
|
ampersandBlock: true
|
|
5491
5496
|
};
|
|
5492
5497
|
});
|
|
@@ -6519,7 +6524,7 @@ ${input.slice(result.pos)}
|
|
|
6519
6524
|
var ArrayLiteral$0 = $T($S(ArrayBindingPattern, UpcomingAssignment), function(value) {
|
|
6520
6525
|
return value[0];
|
|
6521
6526
|
});
|
|
6522
|
-
var ArrayLiteral$1 = $TS($S(OpenBracket, AllowAll, $E($S(ArrayLiteralContent, __, CloseBracket)),
|
|
6527
|
+
var ArrayLiteral$1 = $TS($S(OpenBracket, AllowAll, $E($S(ArrayLiteralContent, __, CloseBracket)), RestoreAll), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
6523
6528
|
var open = $1;
|
|
6524
6529
|
if (!$3)
|
|
6525
6530
|
return $skip;
|
|
@@ -6656,7 +6661,7 @@ ${input.slice(result.pos)}
|
|
|
6656
6661
|
var ArrayLiteralContent$0 = RangeExpression;
|
|
6657
6662
|
var ArrayLiteralContent$1 = $S(NestedImplicitObjectLiteral, $Q($S(__, Comma, NestedImplicitObjectLiteral)));
|
|
6658
6663
|
var ArrayLiteralContent$2 = NestedElementList;
|
|
6659
|
-
var ArrayLiteralContent$3 = $TS($S(
|
|
6664
|
+
var ArrayLiteralContent$3 = $TS($S(ElementListWithIndentedApplicationForbidden, InsertComma, $E(NestedElementList)), function($skip, $loc, $0, $1, $2, $3) {
|
|
6660
6665
|
var list = $1;
|
|
6661
6666
|
var comma = $2;
|
|
6662
6667
|
var nested = $3;
|
|
@@ -6785,6 +6790,33 @@ ${input.slice(result.pos)}
|
|
|
6785
6790
|
return result;
|
|
6786
6791
|
}
|
|
6787
6792
|
}
|
|
6793
|
+
var ElementListWithIndentedApplicationForbidden$0 = $TS($S(ForbidIndentedApplication, $E(ElementList), RestoreIndentedApplication), function($skip, $loc, $0, $1, $2, $3) {
|
|
6794
|
+
if ($2)
|
|
6795
|
+
return $2;
|
|
6796
|
+
return $skip;
|
|
6797
|
+
});
|
|
6798
|
+
function ElementListWithIndentedApplicationForbidden(state) {
|
|
6799
|
+
let eventData;
|
|
6800
|
+
if (state.events) {
|
|
6801
|
+
const result = state.events.enter?.("ElementListWithIndentedApplicationForbidden", state);
|
|
6802
|
+
if (result) {
|
|
6803
|
+
if (result.cache)
|
|
6804
|
+
return result.cache;
|
|
6805
|
+
eventData = result.data;
|
|
6806
|
+
}
|
|
6807
|
+
}
|
|
6808
|
+
if (state.tokenize) {
|
|
6809
|
+
const result = $TOKEN("ElementListWithIndentedApplicationForbidden", state, ElementListWithIndentedApplicationForbidden$0(state));
|
|
6810
|
+
if (state.events)
|
|
6811
|
+
state.events.exit?.("ElementListWithIndentedApplicationForbidden", state, result, eventData);
|
|
6812
|
+
return result;
|
|
6813
|
+
} else {
|
|
6814
|
+
const result = ElementListWithIndentedApplicationForbidden$0(state);
|
|
6815
|
+
if (state.events)
|
|
6816
|
+
state.events.exit?.("ElementListWithIndentedApplicationForbidden", state, result, eventData);
|
|
6817
|
+
return result;
|
|
6818
|
+
}
|
|
6819
|
+
}
|
|
6788
6820
|
var ElementList$0 = $TS($S(ArrayElementExpression, $Q(ElementListRest)), function($skip, $loc, $0, $1, $2) {
|
|
6789
6821
|
var first = $1;
|
|
6790
6822
|
var rest = $2;
|
|
@@ -9277,7 +9309,7 @@ ${input.slice(result.pos)}
|
|
|
9277
9309
|
return result;
|
|
9278
9310
|
}
|
|
9279
9311
|
}
|
|
9280
|
-
var WhenCondition$0 = $T($S(__, When,
|
|
9312
|
+
var WhenCondition$0 = $T($S(__, When, ExpressionWithIndentedApplicationForbidden), function(value) {
|
|
9281
9313
|
var exp = value[2];
|
|
9282
9314
|
return exp;
|
|
9283
9315
|
});
|
|
@@ -9303,7 +9335,7 @@ ${input.slice(result.pos)}
|
|
|
9303
9335
|
return result;
|
|
9304
9336
|
}
|
|
9305
9337
|
}
|
|
9306
|
-
var CoffeeForStatementParameters$0 = $TS($S($E($S(Await, __)), InsertOpenParen, CoffeeForDeclaration, $E(CoffeeForIndex), __, $C(In, Of, From),
|
|
9338
|
+
var CoffeeForStatementParameters$0 = $TS($S($E($S(Await, __)), InsertOpenParen, CoffeeForDeclaration, $E(CoffeeForIndex), __, $C(In, Of, From), ExpressionWithIndentedApplicationForbidden, $E($S(__, By, ExpressionWithIndentedApplicationForbidden)), InsertCloseParen), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
|
|
9307
9339
|
var open = $2;
|
|
9308
9340
|
var declaration = $3;
|
|
9309
9341
|
var index = $4;
|
|
@@ -9790,7 +9822,7 @@ ${input.slice(result.pos)}
|
|
|
9790
9822
|
var e = $0;
|
|
9791
9823
|
return {
|
|
9792
9824
|
type: "SwitchExpression",
|
|
9793
|
-
children:
|
|
9825
|
+
children: module.wrapIIFE(e.children),
|
|
9794
9826
|
expression: e.expression,
|
|
9795
9827
|
caseBlock: e.caseBlock
|
|
9796
9828
|
};
|
|
@@ -10100,7 +10132,7 @@ ${input.slice(result.pos)}
|
|
|
10100
10132
|
return {
|
|
10101
10133
|
type: "TryExpression",
|
|
10102
10134
|
blocks: t.blocks,
|
|
10103
|
-
children:
|
|
10135
|
+
children: module.wrapIIFE(t)
|
|
10104
10136
|
};
|
|
10105
10137
|
});
|
|
10106
10138
|
function TryExpression(state) {
|
|
@@ -10796,7 +10828,7 @@ ${input.slice(result.pos)}
|
|
|
10796
10828
|
var DebuggerExpression$0 = $TS($S(Debugger), function($skip, $loc, $0, $1) {
|
|
10797
10829
|
return {
|
|
10798
10830
|
type: "DebuggerExpression",
|
|
10799
|
-
children:
|
|
10831
|
+
children: module.wrapIIFE($1)
|
|
10800
10832
|
};
|
|
10801
10833
|
});
|
|
10802
10834
|
function DebuggerExpression(state) {
|
|
@@ -10824,7 +10856,7 @@ ${input.slice(result.pos)}
|
|
|
10824
10856
|
var ThrowExpression$0 = $TS($S(Throw, ExtendedExpression), function($skip, $loc, $0, $1, $2) {
|
|
10825
10857
|
return {
|
|
10826
10858
|
type: "ThrowExpression",
|
|
10827
|
-
children:
|
|
10859
|
+
children: module.wrapIIFE($0)
|
|
10828
10860
|
};
|
|
10829
10861
|
});
|
|
10830
10862
|
function ThrowExpression(state) {
|
|
@@ -13565,7 +13597,7 @@ ${input.slice(result.pos)}
|
|
|
13565
13597
|
}
|
|
13566
13598
|
}
|
|
13567
13599
|
var Await$0 = $TS($S($EXPECT($L104, fail, 'Await "await"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
|
|
13568
|
-
return { $loc, token: $1 };
|
|
13600
|
+
return { $loc, token: $1, type: "Await" };
|
|
13569
13601
|
});
|
|
13570
13602
|
function Await(state) {
|
|
13571
13603
|
let eventData;
|
|
@@ -19974,7 +20006,7 @@ ${input.slice(result.pos)}
|
|
|
19974
20006
|
const i = exp.children.indexOf(exp.block);
|
|
19975
20007
|
if (exp.subtype === "DoStatement") {
|
|
19976
20008
|
insertReturn(exp.block);
|
|
19977
|
-
exp.children.splice(i, 1,
|
|
20009
|
+
exp.children.splice(i, 1, ...module.wrapIIFE(exp.children));
|
|
19978
20010
|
return;
|
|
19979
20011
|
}
|
|
19980
20012
|
const resultsRef = {
|
|
@@ -19983,8 +20015,28 @@ ${input.slice(result.pos)}
|
|
|
19983
20015
|
id: "results"
|
|
19984
20016
|
};
|
|
19985
20017
|
insertPush(exp.block, resultsRef);
|
|
19986
|
-
exp.children.splice(i, 1,
|
|
20018
|
+
exp.children.splice(i, 1, module.wrapIIFE(
|
|
20019
|
+
["const ", resultsRef, "=[];", ...exp.children, "; return ", resultsRef]
|
|
20020
|
+
));
|
|
19987
20021
|
}
|
|
20022
|
+
module.hasAwait = (exp) => {
|
|
20023
|
+
return gatherRecursiveWithinFunction(exp, ({ type }) => type === "Await").length > 0;
|
|
20024
|
+
};
|
|
20025
|
+
module.wrapIIFE = (exp) => {
|
|
20026
|
+
let prefix, suffix;
|
|
20027
|
+
if (module.hasAwait(exp)) {
|
|
20028
|
+
prefix = "(await (async ()=>{";
|
|
20029
|
+
suffix = "})())";
|
|
20030
|
+
} else {
|
|
20031
|
+
prefix = "(()=>{";
|
|
20032
|
+
suffix = "})()";
|
|
20033
|
+
}
|
|
20034
|
+
if (Array.isArray(exp)) {
|
|
20035
|
+
return [prefix, ...exp, suffix];
|
|
20036
|
+
} else {
|
|
20037
|
+
return [prefix, exp, suffix];
|
|
20038
|
+
}
|
|
20039
|
+
};
|
|
19988
20040
|
function wrapIterationReturningResults(statement, outerRef) {
|
|
19989
20041
|
if (statement.type === "DoStatement") {
|
|
19990
20042
|
if (outerRef) {
|
|
@@ -20596,12 +20648,14 @@ ${input.slice(result.pos)}
|
|
|
20596
20648
|
return;
|
|
20597
20649
|
if (typeof node !== "object")
|
|
20598
20650
|
return;
|
|
20599
|
-
node.parent = parent;
|
|
20600
20651
|
if (Array.isArray(node)) {
|
|
20601
20652
|
for (const child of node) {
|
|
20602
|
-
addParentPointers(child,
|
|
20653
|
+
addParentPointers(child, parent);
|
|
20603
20654
|
}
|
|
20604
|
-
|
|
20655
|
+
return;
|
|
20656
|
+
}
|
|
20657
|
+
node.parent = parent;
|
|
20658
|
+
if (node.children) {
|
|
20605
20659
|
for (const child of node.children) {
|
|
20606
20660
|
addParentPointers(child, node);
|
|
20607
20661
|
}
|
|
@@ -21219,11 +21273,11 @@ ${input.slice(result.pos)}
|
|
|
21219
21273
|
});
|
|
21220
21274
|
if (module.config.implicitReturns && s.type === "SwitchExpression") {
|
|
21221
21275
|
insertReturn(root[0]);
|
|
21222
|
-
root.
|
|
21223
|
-
root.push("})()");
|
|
21276
|
+
root.splice(0, 1, module.wrapIIFE(root[0]));
|
|
21224
21277
|
}
|
|
21225
21278
|
s.type = "PatternMatchingStatement";
|
|
21226
21279
|
s.children = [root];
|
|
21280
|
+
addParentPointers(s, s.parent);
|
|
21227
21281
|
});
|
|
21228
21282
|
}
|
|
21229
21283
|
function processPipelineExpressions(statements) {
|
|
@@ -21278,6 +21332,7 @@ ${input.slice(result.pos)}
|
|
|
21278
21332
|
}
|
|
21279
21333
|
children.push(arg);
|
|
21280
21334
|
s.children = children;
|
|
21335
|
+
addParentPointers(s, s.parent);
|
|
21281
21336
|
});
|
|
21282
21337
|
}
|
|
21283
21338
|
module.processProgram = function(statements) {
|
|
@@ -22254,7 +22309,7 @@ ${input.slice(result.pos)}
|
|
|
22254
22309
|
var uncacheable;
|
|
22255
22310
|
({ parse } = import_parser.default);
|
|
22256
22311
|
({ SourceMap: SourceMap2, base64Encode: base64Encode2 } = util_exports);
|
|
22257
|
-
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", "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"]);
|
|
22312
|
+
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"]);
|
|
22258
22313
|
var compile = function(src, options) {
|
|
22259
22314
|
var ast, code, events, filename, ref, result, sm, srcMapJSON;
|
|
22260
22315
|
if (!options) {
|
package/dist/main.js
CHANGED
|
@@ -599,6 +599,7 @@ ${input.slice(result.pos)}
|
|
|
599
599
|
NestedElementList,
|
|
600
600
|
NestedElement,
|
|
601
601
|
ArrayElementDelimiter,
|
|
602
|
+
ElementListWithIndentedApplicationForbidden,
|
|
602
603
|
ElementList,
|
|
603
604
|
ElementListRest,
|
|
604
605
|
ArrayElementExpression,
|
|
@@ -5483,9 +5484,13 @@ ${input.slice(result.pos)}
|
|
|
5483
5484
|
};
|
|
5484
5485
|
}
|
|
5485
5486
|
const { ref } = rhs;
|
|
5487
|
+
const children = [ref, " => ", prefix, rhs];
|
|
5488
|
+
if (module2.hasAwait(rhs)) {
|
|
5489
|
+
children.unshift("async ");
|
|
5490
|
+
}
|
|
5486
5491
|
return {
|
|
5487
5492
|
type: "ArrowFunction",
|
|
5488
|
-
children
|
|
5493
|
+
children,
|
|
5489
5494
|
ampersandBlock: true
|
|
5490
5495
|
};
|
|
5491
5496
|
});
|
|
@@ -6518,7 +6523,7 @@ ${input.slice(result.pos)}
|
|
|
6518
6523
|
var ArrayLiteral$0 = $T($S(ArrayBindingPattern, UpcomingAssignment), function(value) {
|
|
6519
6524
|
return value[0];
|
|
6520
6525
|
});
|
|
6521
|
-
var ArrayLiteral$1 = $TS($S(OpenBracket, AllowAll, $E($S(ArrayLiteralContent, __, CloseBracket)),
|
|
6526
|
+
var ArrayLiteral$1 = $TS($S(OpenBracket, AllowAll, $E($S(ArrayLiteralContent, __, CloseBracket)), RestoreAll), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
6522
6527
|
var open = $1;
|
|
6523
6528
|
if (!$3)
|
|
6524
6529
|
return $skip;
|
|
@@ -6655,7 +6660,7 @@ ${input.slice(result.pos)}
|
|
|
6655
6660
|
var ArrayLiteralContent$0 = RangeExpression;
|
|
6656
6661
|
var ArrayLiteralContent$1 = $S(NestedImplicitObjectLiteral, $Q($S(__, Comma, NestedImplicitObjectLiteral)));
|
|
6657
6662
|
var ArrayLiteralContent$2 = NestedElementList;
|
|
6658
|
-
var ArrayLiteralContent$3 = $TS($S(
|
|
6663
|
+
var ArrayLiteralContent$3 = $TS($S(ElementListWithIndentedApplicationForbidden, InsertComma, $E(NestedElementList)), function($skip, $loc, $0, $1, $2, $3) {
|
|
6659
6664
|
var list = $1;
|
|
6660
6665
|
var comma = $2;
|
|
6661
6666
|
var nested = $3;
|
|
@@ -6784,6 +6789,33 @@ ${input.slice(result.pos)}
|
|
|
6784
6789
|
return result;
|
|
6785
6790
|
}
|
|
6786
6791
|
}
|
|
6792
|
+
var ElementListWithIndentedApplicationForbidden$0 = $TS($S(ForbidIndentedApplication, $E(ElementList), RestoreIndentedApplication), function($skip, $loc, $0, $1, $2, $3) {
|
|
6793
|
+
if ($2)
|
|
6794
|
+
return $2;
|
|
6795
|
+
return $skip;
|
|
6796
|
+
});
|
|
6797
|
+
function ElementListWithIndentedApplicationForbidden(state) {
|
|
6798
|
+
let eventData;
|
|
6799
|
+
if (state.events) {
|
|
6800
|
+
const result = state.events.enter?.("ElementListWithIndentedApplicationForbidden", state);
|
|
6801
|
+
if (result) {
|
|
6802
|
+
if (result.cache)
|
|
6803
|
+
return result.cache;
|
|
6804
|
+
eventData = result.data;
|
|
6805
|
+
}
|
|
6806
|
+
}
|
|
6807
|
+
if (state.tokenize) {
|
|
6808
|
+
const result = $TOKEN("ElementListWithIndentedApplicationForbidden", state, ElementListWithIndentedApplicationForbidden$0(state));
|
|
6809
|
+
if (state.events)
|
|
6810
|
+
state.events.exit?.("ElementListWithIndentedApplicationForbidden", state, result, eventData);
|
|
6811
|
+
return result;
|
|
6812
|
+
} else {
|
|
6813
|
+
const result = ElementListWithIndentedApplicationForbidden$0(state);
|
|
6814
|
+
if (state.events)
|
|
6815
|
+
state.events.exit?.("ElementListWithIndentedApplicationForbidden", state, result, eventData);
|
|
6816
|
+
return result;
|
|
6817
|
+
}
|
|
6818
|
+
}
|
|
6787
6819
|
var ElementList$0 = $TS($S(ArrayElementExpression, $Q(ElementListRest)), function($skip, $loc, $0, $1, $2) {
|
|
6788
6820
|
var first = $1;
|
|
6789
6821
|
var rest = $2;
|
|
@@ -9276,7 +9308,7 @@ ${input.slice(result.pos)}
|
|
|
9276
9308
|
return result;
|
|
9277
9309
|
}
|
|
9278
9310
|
}
|
|
9279
|
-
var WhenCondition$0 = $T($S(__, When,
|
|
9311
|
+
var WhenCondition$0 = $T($S(__, When, ExpressionWithIndentedApplicationForbidden), function(value) {
|
|
9280
9312
|
var exp = value[2];
|
|
9281
9313
|
return exp;
|
|
9282
9314
|
});
|
|
@@ -9302,7 +9334,7 @@ ${input.slice(result.pos)}
|
|
|
9302
9334
|
return result;
|
|
9303
9335
|
}
|
|
9304
9336
|
}
|
|
9305
|
-
var CoffeeForStatementParameters$0 = $TS($S($E($S(Await, __)), InsertOpenParen, CoffeeForDeclaration, $E(CoffeeForIndex), __, $C(In, Of, From),
|
|
9337
|
+
var CoffeeForStatementParameters$0 = $TS($S($E($S(Await, __)), InsertOpenParen, CoffeeForDeclaration, $E(CoffeeForIndex), __, $C(In, Of, From), ExpressionWithIndentedApplicationForbidden, $E($S(__, By, ExpressionWithIndentedApplicationForbidden)), InsertCloseParen), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
|
|
9306
9338
|
var open = $2;
|
|
9307
9339
|
var declaration = $3;
|
|
9308
9340
|
var index = $4;
|
|
@@ -9789,7 +9821,7 @@ ${input.slice(result.pos)}
|
|
|
9789
9821
|
var e = $0;
|
|
9790
9822
|
return {
|
|
9791
9823
|
type: "SwitchExpression",
|
|
9792
|
-
children:
|
|
9824
|
+
children: module2.wrapIIFE(e.children),
|
|
9793
9825
|
expression: e.expression,
|
|
9794
9826
|
caseBlock: e.caseBlock
|
|
9795
9827
|
};
|
|
@@ -10099,7 +10131,7 @@ ${input.slice(result.pos)}
|
|
|
10099
10131
|
return {
|
|
10100
10132
|
type: "TryExpression",
|
|
10101
10133
|
blocks: t.blocks,
|
|
10102
|
-
children:
|
|
10134
|
+
children: module2.wrapIIFE(t)
|
|
10103
10135
|
};
|
|
10104
10136
|
});
|
|
10105
10137
|
function TryExpression(state) {
|
|
@@ -10795,7 +10827,7 @@ ${input.slice(result.pos)}
|
|
|
10795
10827
|
var DebuggerExpression$0 = $TS($S(Debugger), function($skip, $loc, $0, $1) {
|
|
10796
10828
|
return {
|
|
10797
10829
|
type: "DebuggerExpression",
|
|
10798
|
-
children:
|
|
10830
|
+
children: module2.wrapIIFE($1)
|
|
10799
10831
|
};
|
|
10800
10832
|
});
|
|
10801
10833
|
function DebuggerExpression(state) {
|
|
@@ -10823,7 +10855,7 @@ ${input.slice(result.pos)}
|
|
|
10823
10855
|
var ThrowExpression$0 = $TS($S(Throw, ExtendedExpression), function($skip, $loc, $0, $1, $2) {
|
|
10824
10856
|
return {
|
|
10825
10857
|
type: "ThrowExpression",
|
|
10826
|
-
children:
|
|
10858
|
+
children: module2.wrapIIFE($0)
|
|
10827
10859
|
};
|
|
10828
10860
|
});
|
|
10829
10861
|
function ThrowExpression(state) {
|
|
@@ -13564,7 +13596,7 @@ ${input.slice(result.pos)}
|
|
|
13564
13596
|
}
|
|
13565
13597
|
}
|
|
13566
13598
|
var Await$0 = $TS($S($EXPECT($L104, fail, 'Await "await"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
|
|
13567
|
-
return { $loc, token: $1 };
|
|
13599
|
+
return { $loc, token: $1, type: "Await" };
|
|
13568
13600
|
});
|
|
13569
13601
|
function Await(state) {
|
|
13570
13602
|
let eventData;
|
|
@@ -19973,7 +20005,7 @@ ${input.slice(result.pos)}
|
|
|
19973
20005
|
const i = exp.children.indexOf(exp.block);
|
|
19974
20006
|
if (exp.subtype === "DoStatement") {
|
|
19975
20007
|
insertReturn(exp.block);
|
|
19976
|
-
exp.children.splice(i, 1,
|
|
20008
|
+
exp.children.splice(i, 1, ...module2.wrapIIFE(exp.children));
|
|
19977
20009
|
return;
|
|
19978
20010
|
}
|
|
19979
20011
|
const resultsRef = {
|
|
@@ -19982,8 +20014,28 @@ ${input.slice(result.pos)}
|
|
|
19982
20014
|
id: "results"
|
|
19983
20015
|
};
|
|
19984
20016
|
insertPush(exp.block, resultsRef);
|
|
19985
|
-
exp.children.splice(i, 1,
|
|
20017
|
+
exp.children.splice(i, 1, module2.wrapIIFE(
|
|
20018
|
+
["const ", resultsRef, "=[];", ...exp.children, "; return ", resultsRef]
|
|
20019
|
+
));
|
|
19986
20020
|
}
|
|
20021
|
+
module2.hasAwait = (exp) => {
|
|
20022
|
+
return gatherRecursiveWithinFunction(exp, ({ type }) => type === "Await").length > 0;
|
|
20023
|
+
};
|
|
20024
|
+
module2.wrapIIFE = (exp) => {
|
|
20025
|
+
let prefix, suffix;
|
|
20026
|
+
if (module2.hasAwait(exp)) {
|
|
20027
|
+
prefix = "(await (async ()=>{";
|
|
20028
|
+
suffix = "})())";
|
|
20029
|
+
} else {
|
|
20030
|
+
prefix = "(()=>{";
|
|
20031
|
+
suffix = "})()";
|
|
20032
|
+
}
|
|
20033
|
+
if (Array.isArray(exp)) {
|
|
20034
|
+
return [prefix, ...exp, suffix];
|
|
20035
|
+
} else {
|
|
20036
|
+
return [prefix, exp, suffix];
|
|
20037
|
+
}
|
|
20038
|
+
};
|
|
19987
20039
|
function wrapIterationReturningResults(statement, outerRef) {
|
|
19988
20040
|
if (statement.type === "DoStatement") {
|
|
19989
20041
|
if (outerRef) {
|
|
@@ -20595,12 +20647,14 @@ ${input.slice(result.pos)}
|
|
|
20595
20647
|
return;
|
|
20596
20648
|
if (typeof node !== "object")
|
|
20597
20649
|
return;
|
|
20598
|
-
node.parent = parent;
|
|
20599
20650
|
if (Array.isArray(node)) {
|
|
20600
20651
|
for (const child of node) {
|
|
20601
|
-
addParentPointers(child,
|
|
20652
|
+
addParentPointers(child, parent);
|
|
20602
20653
|
}
|
|
20603
|
-
|
|
20654
|
+
return;
|
|
20655
|
+
}
|
|
20656
|
+
node.parent = parent;
|
|
20657
|
+
if (node.children) {
|
|
20604
20658
|
for (const child of node.children) {
|
|
20605
20659
|
addParentPointers(child, node);
|
|
20606
20660
|
}
|
|
@@ -21218,11 +21272,11 @@ ${input.slice(result.pos)}
|
|
|
21218
21272
|
});
|
|
21219
21273
|
if (module2.config.implicitReturns && s.type === "SwitchExpression") {
|
|
21220
21274
|
insertReturn(root[0]);
|
|
21221
|
-
root.
|
|
21222
|
-
root.push("})()");
|
|
21275
|
+
root.splice(0, 1, module2.wrapIIFE(root[0]));
|
|
21223
21276
|
}
|
|
21224
21277
|
s.type = "PatternMatchingStatement";
|
|
21225
21278
|
s.children = [root];
|
|
21279
|
+
addParentPointers(s, s.parent);
|
|
21226
21280
|
});
|
|
21227
21281
|
}
|
|
21228
21282
|
function processPipelineExpressions(statements) {
|
|
@@ -21277,6 +21331,7 @@ ${input.slice(result.pos)}
|
|
|
21277
21331
|
}
|
|
21278
21332
|
children.push(arg);
|
|
21279
21333
|
s.children = children;
|
|
21334
|
+
addParentPointers(s, s.parent);
|
|
21280
21335
|
});
|
|
21281
21336
|
}
|
|
21282
21337
|
module2.processProgram = function(statements) {
|
|
@@ -22254,7 +22309,7 @@ var parse;
|
|
|
22254
22309
|
var uncacheable;
|
|
22255
22310
|
({ parse } = import_parser.default);
|
|
22256
22311
|
({ SourceMap: SourceMap2, base64Encode: base64Encode2 } = util_exports);
|
|
22257
|
-
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", "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"]);
|
|
22312
|
+
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"]);
|
|
22258
22313
|
var compile = function(src, options) {
|
|
22259
22314
|
var ast, code, events, filename, ref, result, sm, srcMapJSON;
|
|
22260
22315
|
if (!options) {
|
package/dist/main.mjs
CHANGED
|
@@ -597,6 +597,7 @@ ${input.slice(result.pos)}
|
|
|
597
597
|
NestedElementList,
|
|
598
598
|
NestedElement,
|
|
599
599
|
ArrayElementDelimiter,
|
|
600
|
+
ElementListWithIndentedApplicationForbidden,
|
|
600
601
|
ElementList,
|
|
601
602
|
ElementListRest,
|
|
602
603
|
ArrayElementExpression,
|
|
@@ -5481,9 +5482,13 @@ ${input.slice(result.pos)}
|
|
|
5481
5482
|
};
|
|
5482
5483
|
}
|
|
5483
5484
|
const { ref } = rhs;
|
|
5485
|
+
const children = [ref, " => ", prefix, rhs];
|
|
5486
|
+
if (module.hasAwait(rhs)) {
|
|
5487
|
+
children.unshift("async ");
|
|
5488
|
+
}
|
|
5484
5489
|
return {
|
|
5485
5490
|
type: "ArrowFunction",
|
|
5486
|
-
children
|
|
5491
|
+
children,
|
|
5487
5492
|
ampersandBlock: true
|
|
5488
5493
|
};
|
|
5489
5494
|
});
|
|
@@ -6516,7 +6521,7 @@ ${input.slice(result.pos)}
|
|
|
6516
6521
|
var ArrayLiteral$0 = $T($S(ArrayBindingPattern, UpcomingAssignment), function(value) {
|
|
6517
6522
|
return value[0];
|
|
6518
6523
|
});
|
|
6519
|
-
var ArrayLiteral$1 = $TS($S(OpenBracket, AllowAll, $E($S(ArrayLiteralContent, __, CloseBracket)),
|
|
6524
|
+
var ArrayLiteral$1 = $TS($S(OpenBracket, AllowAll, $E($S(ArrayLiteralContent, __, CloseBracket)), RestoreAll), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
6520
6525
|
var open = $1;
|
|
6521
6526
|
if (!$3)
|
|
6522
6527
|
return $skip;
|
|
@@ -6653,7 +6658,7 @@ ${input.slice(result.pos)}
|
|
|
6653
6658
|
var ArrayLiteralContent$0 = RangeExpression;
|
|
6654
6659
|
var ArrayLiteralContent$1 = $S(NestedImplicitObjectLiteral, $Q($S(__, Comma, NestedImplicitObjectLiteral)));
|
|
6655
6660
|
var ArrayLiteralContent$2 = NestedElementList;
|
|
6656
|
-
var ArrayLiteralContent$3 = $TS($S(
|
|
6661
|
+
var ArrayLiteralContent$3 = $TS($S(ElementListWithIndentedApplicationForbidden, InsertComma, $E(NestedElementList)), function($skip, $loc, $0, $1, $2, $3) {
|
|
6657
6662
|
var list = $1;
|
|
6658
6663
|
var comma = $2;
|
|
6659
6664
|
var nested = $3;
|
|
@@ -6782,6 +6787,33 @@ ${input.slice(result.pos)}
|
|
|
6782
6787
|
return result;
|
|
6783
6788
|
}
|
|
6784
6789
|
}
|
|
6790
|
+
var ElementListWithIndentedApplicationForbidden$0 = $TS($S(ForbidIndentedApplication, $E(ElementList), RestoreIndentedApplication), function($skip, $loc, $0, $1, $2, $3) {
|
|
6791
|
+
if ($2)
|
|
6792
|
+
return $2;
|
|
6793
|
+
return $skip;
|
|
6794
|
+
});
|
|
6795
|
+
function ElementListWithIndentedApplicationForbidden(state) {
|
|
6796
|
+
let eventData;
|
|
6797
|
+
if (state.events) {
|
|
6798
|
+
const result = state.events.enter?.("ElementListWithIndentedApplicationForbidden", state);
|
|
6799
|
+
if (result) {
|
|
6800
|
+
if (result.cache)
|
|
6801
|
+
return result.cache;
|
|
6802
|
+
eventData = result.data;
|
|
6803
|
+
}
|
|
6804
|
+
}
|
|
6805
|
+
if (state.tokenize) {
|
|
6806
|
+
const result = $TOKEN("ElementListWithIndentedApplicationForbidden", state, ElementListWithIndentedApplicationForbidden$0(state));
|
|
6807
|
+
if (state.events)
|
|
6808
|
+
state.events.exit?.("ElementListWithIndentedApplicationForbidden", state, result, eventData);
|
|
6809
|
+
return result;
|
|
6810
|
+
} else {
|
|
6811
|
+
const result = ElementListWithIndentedApplicationForbidden$0(state);
|
|
6812
|
+
if (state.events)
|
|
6813
|
+
state.events.exit?.("ElementListWithIndentedApplicationForbidden", state, result, eventData);
|
|
6814
|
+
return result;
|
|
6815
|
+
}
|
|
6816
|
+
}
|
|
6785
6817
|
var ElementList$0 = $TS($S(ArrayElementExpression, $Q(ElementListRest)), function($skip, $loc, $0, $1, $2) {
|
|
6786
6818
|
var first = $1;
|
|
6787
6819
|
var rest = $2;
|
|
@@ -9274,7 +9306,7 @@ ${input.slice(result.pos)}
|
|
|
9274
9306
|
return result;
|
|
9275
9307
|
}
|
|
9276
9308
|
}
|
|
9277
|
-
var WhenCondition$0 = $T($S(__, When,
|
|
9309
|
+
var WhenCondition$0 = $T($S(__, When, ExpressionWithIndentedApplicationForbidden), function(value) {
|
|
9278
9310
|
var exp = value[2];
|
|
9279
9311
|
return exp;
|
|
9280
9312
|
});
|
|
@@ -9300,7 +9332,7 @@ ${input.slice(result.pos)}
|
|
|
9300
9332
|
return result;
|
|
9301
9333
|
}
|
|
9302
9334
|
}
|
|
9303
|
-
var CoffeeForStatementParameters$0 = $TS($S($E($S(Await, __)), InsertOpenParen, CoffeeForDeclaration, $E(CoffeeForIndex), __, $C(In, Of, From),
|
|
9335
|
+
var CoffeeForStatementParameters$0 = $TS($S($E($S(Await, __)), InsertOpenParen, CoffeeForDeclaration, $E(CoffeeForIndex), __, $C(In, Of, From), ExpressionWithIndentedApplicationForbidden, $E($S(__, By, ExpressionWithIndentedApplicationForbidden)), InsertCloseParen), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
|
|
9304
9336
|
var open = $2;
|
|
9305
9337
|
var declaration = $3;
|
|
9306
9338
|
var index = $4;
|
|
@@ -9787,7 +9819,7 @@ ${input.slice(result.pos)}
|
|
|
9787
9819
|
var e = $0;
|
|
9788
9820
|
return {
|
|
9789
9821
|
type: "SwitchExpression",
|
|
9790
|
-
children:
|
|
9822
|
+
children: module.wrapIIFE(e.children),
|
|
9791
9823
|
expression: e.expression,
|
|
9792
9824
|
caseBlock: e.caseBlock
|
|
9793
9825
|
};
|
|
@@ -10097,7 +10129,7 @@ ${input.slice(result.pos)}
|
|
|
10097
10129
|
return {
|
|
10098
10130
|
type: "TryExpression",
|
|
10099
10131
|
blocks: t.blocks,
|
|
10100
|
-
children:
|
|
10132
|
+
children: module.wrapIIFE(t)
|
|
10101
10133
|
};
|
|
10102
10134
|
});
|
|
10103
10135
|
function TryExpression(state) {
|
|
@@ -10793,7 +10825,7 @@ ${input.slice(result.pos)}
|
|
|
10793
10825
|
var DebuggerExpression$0 = $TS($S(Debugger), function($skip, $loc, $0, $1) {
|
|
10794
10826
|
return {
|
|
10795
10827
|
type: "DebuggerExpression",
|
|
10796
|
-
children:
|
|
10828
|
+
children: module.wrapIIFE($1)
|
|
10797
10829
|
};
|
|
10798
10830
|
});
|
|
10799
10831
|
function DebuggerExpression(state) {
|
|
@@ -10821,7 +10853,7 @@ ${input.slice(result.pos)}
|
|
|
10821
10853
|
var ThrowExpression$0 = $TS($S(Throw, ExtendedExpression), function($skip, $loc, $0, $1, $2) {
|
|
10822
10854
|
return {
|
|
10823
10855
|
type: "ThrowExpression",
|
|
10824
|
-
children:
|
|
10856
|
+
children: module.wrapIIFE($0)
|
|
10825
10857
|
};
|
|
10826
10858
|
});
|
|
10827
10859
|
function ThrowExpression(state) {
|
|
@@ -13562,7 +13594,7 @@ ${input.slice(result.pos)}
|
|
|
13562
13594
|
}
|
|
13563
13595
|
}
|
|
13564
13596
|
var Await$0 = $TS($S($EXPECT($L104, fail, 'Await "await"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
|
|
13565
|
-
return { $loc, token: $1 };
|
|
13597
|
+
return { $loc, token: $1, type: "Await" };
|
|
13566
13598
|
});
|
|
13567
13599
|
function Await(state) {
|
|
13568
13600
|
let eventData;
|
|
@@ -19971,7 +20003,7 @@ ${input.slice(result.pos)}
|
|
|
19971
20003
|
const i = exp.children.indexOf(exp.block);
|
|
19972
20004
|
if (exp.subtype === "DoStatement") {
|
|
19973
20005
|
insertReturn(exp.block);
|
|
19974
|
-
exp.children.splice(i, 1,
|
|
20006
|
+
exp.children.splice(i, 1, ...module.wrapIIFE(exp.children));
|
|
19975
20007
|
return;
|
|
19976
20008
|
}
|
|
19977
20009
|
const resultsRef = {
|
|
@@ -19980,8 +20012,28 @@ ${input.slice(result.pos)}
|
|
|
19980
20012
|
id: "results"
|
|
19981
20013
|
};
|
|
19982
20014
|
insertPush(exp.block, resultsRef);
|
|
19983
|
-
exp.children.splice(i, 1,
|
|
20015
|
+
exp.children.splice(i, 1, module.wrapIIFE(
|
|
20016
|
+
["const ", resultsRef, "=[];", ...exp.children, "; return ", resultsRef]
|
|
20017
|
+
));
|
|
19984
20018
|
}
|
|
20019
|
+
module.hasAwait = (exp) => {
|
|
20020
|
+
return gatherRecursiveWithinFunction(exp, ({ type }) => type === "Await").length > 0;
|
|
20021
|
+
};
|
|
20022
|
+
module.wrapIIFE = (exp) => {
|
|
20023
|
+
let prefix, suffix;
|
|
20024
|
+
if (module.hasAwait(exp)) {
|
|
20025
|
+
prefix = "(await (async ()=>{";
|
|
20026
|
+
suffix = "})())";
|
|
20027
|
+
} else {
|
|
20028
|
+
prefix = "(()=>{";
|
|
20029
|
+
suffix = "})()";
|
|
20030
|
+
}
|
|
20031
|
+
if (Array.isArray(exp)) {
|
|
20032
|
+
return [prefix, ...exp, suffix];
|
|
20033
|
+
} else {
|
|
20034
|
+
return [prefix, exp, suffix];
|
|
20035
|
+
}
|
|
20036
|
+
};
|
|
19985
20037
|
function wrapIterationReturningResults(statement, outerRef) {
|
|
19986
20038
|
if (statement.type === "DoStatement") {
|
|
19987
20039
|
if (outerRef) {
|
|
@@ -20593,12 +20645,14 @@ ${input.slice(result.pos)}
|
|
|
20593
20645
|
return;
|
|
20594
20646
|
if (typeof node !== "object")
|
|
20595
20647
|
return;
|
|
20596
|
-
node.parent = parent;
|
|
20597
20648
|
if (Array.isArray(node)) {
|
|
20598
20649
|
for (const child of node) {
|
|
20599
|
-
addParentPointers(child,
|
|
20650
|
+
addParentPointers(child, parent);
|
|
20600
20651
|
}
|
|
20601
|
-
|
|
20652
|
+
return;
|
|
20653
|
+
}
|
|
20654
|
+
node.parent = parent;
|
|
20655
|
+
if (node.children) {
|
|
20602
20656
|
for (const child of node.children) {
|
|
20603
20657
|
addParentPointers(child, node);
|
|
20604
20658
|
}
|
|
@@ -21216,11 +21270,11 @@ ${input.slice(result.pos)}
|
|
|
21216
21270
|
});
|
|
21217
21271
|
if (module.config.implicitReturns && s.type === "SwitchExpression") {
|
|
21218
21272
|
insertReturn(root[0]);
|
|
21219
|
-
root.
|
|
21220
|
-
root.push("})()");
|
|
21273
|
+
root.splice(0, 1, module.wrapIIFE(root[0]));
|
|
21221
21274
|
}
|
|
21222
21275
|
s.type = "PatternMatchingStatement";
|
|
21223
21276
|
s.children = [root];
|
|
21277
|
+
addParentPointers(s, s.parent);
|
|
21224
21278
|
});
|
|
21225
21279
|
}
|
|
21226
21280
|
function processPipelineExpressions(statements) {
|
|
@@ -21275,6 +21329,7 @@ ${input.slice(result.pos)}
|
|
|
21275
21329
|
}
|
|
21276
21330
|
children.push(arg);
|
|
21277
21331
|
s.children = children;
|
|
21332
|
+
addParentPointers(s, s.parent);
|
|
21278
21333
|
});
|
|
21279
21334
|
}
|
|
21280
21335
|
module.processProgram = function(statements) {
|
|
@@ -22242,7 +22297,7 @@ var parse;
|
|
|
22242
22297
|
var uncacheable;
|
|
22243
22298
|
({ parse } = import_parser.default);
|
|
22244
22299
|
({ SourceMap: SourceMap2, base64Encode: base64Encode2 } = util_exports);
|
|
22245
|
-
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", "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"]);
|
|
22300
|
+
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"]);
|
|
22246
22301
|
var compile = function(src, options) {
|
|
22247
22302
|
var ast, code, events, filename, ref, result, sm, srcMapJSON;
|
|
22248
22303
|
if (!options) {
|