@danielx/civet 0.5.13 → 0.5.15
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 +5 -1
- package/dist/browser.js +105 -154
- package/dist/main.js +105 -154
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -213,10 +213,14 @@ Things Added that CoffeeScript didn't
|
|
|
213
213
|
- JSX enhancements (inspired by [solid-dsl discussions](https://github.com/solidjs-community/solid-dsl/discussions)):
|
|
214
214
|
- Indentation: instead of explicitly closing `<tag>`s or `<>`s,
|
|
215
215
|
you can indent the children and Civet will close your tags for you
|
|
216
|
+
- Arrow function children do not need to be wrapped in braces
|
|
217
|
+
(assuming they are not preceded by text); this is unambiguous because
|
|
218
|
+
`>` isn't valid JSX text. For example, `<For> (item) => ...`
|
|
219
|
+
(where function body can be indented).
|
|
216
220
|
- Any braced object literal can be used as an attribute:
|
|
217
221
|
`{foo}` → `foo={foo}`, `{foo: bar}` → `foo={bar}`,
|
|
218
222
|
`{...foo}` remains as is; methods and getters/setters work too.
|
|
219
|
-
- `...foo` shorthand for `{...foo}`
|
|
223
|
+
- Attribute `...foo` shorthand for `{...foo}`
|
|
220
224
|
- Attribute values without whitespace or suitably wrapped
|
|
221
225
|
(parenthesized expressions, strings and template strings,
|
|
222
226
|
regular expressions, array literals, braced object literals)
|
package/dist/browser.js
CHANGED
|
@@ -5,88 +5,6 @@ var Civet = (() => {
|
|
|
5
5
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
6
6
|
};
|
|
7
7
|
|
|
8
|
-
// source/generate.coffee
|
|
9
|
-
var require_generate = __commonJS({
|
|
10
|
-
"source/generate.coffee"(exports, module) {
|
|
11
|
-
"civet coffeeCompat";
|
|
12
|
-
var gen;
|
|
13
|
-
var prune;
|
|
14
|
-
gen = function(node, options) {
|
|
15
|
-
var $loc, token;
|
|
16
|
-
if (node === null || node === void 0) {
|
|
17
|
-
return "";
|
|
18
|
-
}
|
|
19
|
-
if (typeof node === "string") {
|
|
20
|
-
if (options != null) {
|
|
21
|
-
if (typeof options.updateSourceMap === "function") {
|
|
22
|
-
options.updateSourceMap(node);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
return node;
|
|
26
|
-
}
|
|
27
|
-
if (Array.isArray(node)) {
|
|
28
|
-
return node.map(function(child) {
|
|
29
|
-
return gen(child, options);
|
|
30
|
-
}).join("");
|
|
31
|
-
}
|
|
32
|
-
if (typeof node === "object") {
|
|
33
|
-
if (options.js && node.ts) {
|
|
34
|
-
return "";
|
|
35
|
-
}
|
|
36
|
-
if (!options.js && node.js) {
|
|
37
|
-
return "";
|
|
38
|
-
}
|
|
39
|
-
if (node.$loc != null) {
|
|
40
|
-
({ token, $loc } = node);
|
|
41
|
-
if (options != null) {
|
|
42
|
-
if (typeof options.updateSourceMap === "function") {
|
|
43
|
-
options.updateSourceMap(token, $loc.pos);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
return token;
|
|
47
|
-
}
|
|
48
|
-
if (!node.children) {
|
|
49
|
-
debugger;
|
|
50
|
-
throw new Error("Unknown node", JSON.stringify(node));
|
|
51
|
-
}
|
|
52
|
-
return gen(node.children, options);
|
|
53
|
-
}
|
|
54
|
-
debugger;
|
|
55
|
-
throw new Error("Unknown node", JSON.stringify(node));
|
|
56
|
-
};
|
|
57
|
-
module.exports = gen;
|
|
58
|
-
prune = function(node) {
|
|
59
|
-
var a;
|
|
60
|
-
if (node === null || node === void 0) {
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
if (node.length === 0) {
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
if (Array.isArray(node)) {
|
|
67
|
-
a = node.map(function(n) {
|
|
68
|
-
return prune(n);
|
|
69
|
-
}).filter(function(n) {
|
|
70
|
-
return !!n;
|
|
71
|
-
});
|
|
72
|
-
if (a.length > 1) {
|
|
73
|
-
return a;
|
|
74
|
-
}
|
|
75
|
-
if (a.length === 1) {
|
|
76
|
-
return a[0];
|
|
77
|
-
}
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
if (node.children != null) {
|
|
81
|
-
node.children = prune(node.children) || [];
|
|
82
|
-
return node;
|
|
83
|
-
}
|
|
84
|
-
return node;
|
|
85
|
-
};
|
|
86
|
-
gen.prune = prune;
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
|
|
90
8
|
// source/parser.hera
|
|
91
9
|
var require_parser = __commonJS({
|
|
92
10
|
"source/parser.hera"(exports, module) {
|
|
@@ -11002,8 +10920,9 @@ ${input.slice(result.pos)}
|
|
|
11002
10920
|
children: children.jsxChildren.length ? [...$0, ["</", open[1], ">"]] : [open.slice(0, -1), " />"]
|
|
11003
10921
|
};
|
|
11004
10922
|
});
|
|
11005
|
-
var JSXElement$3 = $
|
|
11006
|
-
|
|
10923
|
+
var JSXElement$3 = $TV(JSXOpeningElement, function($skip, $loc, $0, $1) {
|
|
10924
|
+
var elt = $0;
|
|
10925
|
+
throw new Error(`could not parse JSX element "${elt[0]}${elt[1]}${elt[elt.length - 1]}" at pos ${$loc.pos}`);
|
|
11007
10926
|
});
|
|
11008
10927
|
function JSXElement(state) {
|
|
11009
10928
|
if (state.events) {
|
|
@@ -11653,7 +11572,7 @@ ${input.slice(result.pos)}
|
|
|
11653
11572
|
}
|
|
11654
11573
|
return $skip;
|
|
11655
11574
|
});
|
|
11656
|
-
var JSXNestedChildren$1 = $TV($Y(EOS), function($skip, $loc, $0, $1) {
|
|
11575
|
+
var JSXNestedChildren$1 = $TV($Y($C(EOS, $EXPECT($L17, fail, 'JSXNestedChildren "}"'))), function($skip, $loc, $0, $1) {
|
|
11657
11576
|
return { children: [], jsxChildren: [] };
|
|
11658
11577
|
});
|
|
11659
11578
|
function JSXNestedChildren(state) {
|
|
@@ -11674,10 +11593,17 @@ ${input.slice(result.pos)}
|
|
|
11674
11593
|
return result;
|
|
11675
11594
|
}
|
|
11676
11595
|
}
|
|
11677
|
-
var JSXChild$0 =
|
|
11678
|
-
var JSXChild$1 =
|
|
11679
|
-
var JSXChild$2 =
|
|
11680
|
-
|
|
11596
|
+
var JSXChild$0 = JSXElement;
|
|
11597
|
+
var JSXChild$1 = JSXFragment;
|
|
11598
|
+
var JSXChild$2 = $TS($S(OpenBrace, $E(JSXChildExpression), __, CloseBrace), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
11599
|
+
var expression = $2;
|
|
11600
|
+
return {
|
|
11601
|
+
type: "JSXChildExpression",
|
|
11602
|
+
children: $0,
|
|
11603
|
+
expression
|
|
11604
|
+
};
|
|
11605
|
+
});
|
|
11606
|
+
var JSXChild$3 = $TS($S(InsertInlineOpenBrace, ArrowFunction, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3) {
|
|
11681
11607
|
var expression = $2;
|
|
11682
11608
|
return {
|
|
11683
11609
|
type: "JSXChildExpression",
|
|
@@ -11685,6 +11611,7 @@ ${input.slice(result.pos)}
|
|
|
11685
11611
|
expression
|
|
11686
11612
|
};
|
|
11687
11613
|
});
|
|
11614
|
+
var JSXChild$4 = JSXText;
|
|
11688
11615
|
function JSXChild(state) {
|
|
11689
11616
|
if (state.events) {
|
|
11690
11617
|
const result = state.events.enter?.("JSXChild", state);
|
|
@@ -11692,12 +11619,12 @@ ${input.slice(result.pos)}
|
|
|
11692
11619
|
return result.cache;
|
|
11693
11620
|
}
|
|
11694
11621
|
if (state.tokenize) {
|
|
11695
|
-
const result = $TOKEN("JSXChild", state, JSXChild$0(state) || JSXChild$1(state) || JSXChild$2(state) || JSXChild$3(state));
|
|
11622
|
+
const result = $TOKEN("JSXChild", state, JSXChild$0(state) || JSXChild$1(state) || JSXChild$2(state) || JSXChild$3(state) || JSXChild$4(state));
|
|
11696
11623
|
if (state.events)
|
|
11697
11624
|
state.events.exit?.("JSXChild", state, result);
|
|
11698
11625
|
return result;
|
|
11699
11626
|
} else {
|
|
11700
|
-
const result = JSXChild$0(state) || JSXChild$1(state) || JSXChild$2(state) || JSXChild$3(state);
|
|
11627
|
+
const result = JSXChild$0(state) || JSXChild$1(state) || JSXChild$2(state) || JSXChild$3(state) || JSXChild$4(state);
|
|
11701
11628
|
if (state.events)
|
|
11702
11629
|
state.events.exit?.("JSXChild", state, result);
|
|
11703
11630
|
return result;
|
|
@@ -14774,6 +14701,88 @@ ${input.slice(result.pos)}
|
|
|
14774
14701
|
}
|
|
14775
14702
|
});
|
|
14776
14703
|
|
|
14704
|
+
// source/generate.coffee
|
|
14705
|
+
var require_generate = __commonJS({
|
|
14706
|
+
"source/generate.coffee"(exports, module) {
|
|
14707
|
+
"civet coffeeCompat";
|
|
14708
|
+
var gen;
|
|
14709
|
+
var prune;
|
|
14710
|
+
gen = function(node, options) {
|
|
14711
|
+
var $loc, token;
|
|
14712
|
+
if (node === null || node === void 0) {
|
|
14713
|
+
return "";
|
|
14714
|
+
}
|
|
14715
|
+
if (typeof node === "string") {
|
|
14716
|
+
if (options != null) {
|
|
14717
|
+
if (typeof options.updateSourceMap === "function") {
|
|
14718
|
+
options.updateSourceMap(node);
|
|
14719
|
+
}
|
|
14720
|
+
}
|
|
14721
|
+
return node;
|
|
14722
|
+
}
|
|
14723
|
+
if (Array.isArray(node)) {
|
|
14724
|
+
return node.map(function(child) {
|
|
14725
|
+
return gen(child, options);
|
|
14726
|
+
}).join("");
|
|
14727
|
+
}
|
|
14728
|
+
if (typeof node === "object") {
|
|
14729
|
+
if (options.js && node.ts) {
|
|
14730
|
+
return "";
|
|
14731
|
+
}
|
|
14732
|
+
if (!options.js && node.js) {
|
|
14733
|
+
return "";
|
|
14734
|
+
}
|
|
14735
|
+
if (node.$loc != null) {
|
|
14736
|
+
({ token, $loc } = node);
|
|
14737
|
+
if (options != null) {
|
|
14738
|
+
if (typeof options.updateSourceMap === "function") {
|
|
14739
|
+
options.updateSourceMap(token, $loc.pos);
|
|
14740
|
+
}
|
|
14741
|
+
}
|
|
14742
|
+
return token;
|
|
14743
|
+
}
|
|
14744
|
+
if (!node.children) {
|
|
14745
|
+
debugger;
|
|
14746
|
+
throw new Error("Unknown node", JSON.stringify(node));
|
|
14747
|
+
}
|
|
14748
|
+
return gen(node.children, options);
|
|
14749
|
+
}
|
|
14750
|
+
debugger;
|
|
14751
|
+
throw new Error("Unknown node", JSON.stringify(node));
|
|
14752
|
+
};
|
|
14753
|
+
module.exports = gen;
|
|
14754
|
+
prune = function(node) {
|
|
14755
|
+
var a;
|
|
14756
|
+
if (node === null || node === void 0) {
|
|
14757
|
+
return;
|
|
14758
|
+
}
|
|
14759
|
+
if (node.length === 0) {
|
|
14760
|
+
return;
|
|
14761
|
+
}
|
|
14762
|
+
if (Array.isArray(node)) {
|
|
14763
|
+
a = node.map(function(n) {
|
|
14764
|
+
return prune(n);
|
|
14765
|
+
}).filter(function(n) {
|
|
14766
|
+
return !!n;
|
|
14767
|
+
});
|
|
14768
|
+
if (a.length > 1) {
|
|
14769
|
+
return a;
|
|
14770
|
+
}
|
|
14771
|
+
if (a.length === 1) {
|
|
14772
|
+
return a[0];
|
|
14773
|
+
}
|
|
14774
|
+
return;
|
|
14775
|
+
}
|
|
14776
|
+
if (node.children != null) {
|
|
14777
|
+
node.children = prune(node.children) || [];
|
|
14778
|
+
return node;
|
|
14779
|
+
}
|
|
14780
|
+
return node;
|
|
14781
|
+
};
|
|
14782
|
+
gen.prune = prune;
|
|
14783
|
+
}
|
|
14784
|
+
});
|
|
14785
|
+
|
|
14777
14786
|
// source/util.coffee
|
|
14778
14787
|
var require_util = __commonJS({
|
|
14779
14788
|
"source/util.coffee"(exports, module) {
|
|
@@ -15111,11 +15120,13 @@ ${input.slice(result.pos)}
|
|
|
15111
15120
|
var makeCache;
|
|
15112
15121
|
var parse;
|
|
15113
15122
|
var prune;
|
|
15123
|
+
var uncacheable;
|
|
15114
15124
|
var util;
|
|
15115
15125
|
({ parse } = require_parser());
|
|
15116
15126
|
({ prune } = gen = require_generate());
|
|
15117
15127
|
({ SourceMap, base64Encode } = util = require_util());
|
|
15118
15128
|
defaultOptions = {};
|
|
15129
|
+
uncacheable = /* @__PURE__ */ new Set(["TrackIndented", "Samedent", "IndentedFurther", "PushIndent", "PopIndent", "Nested", "InsertIndent", "Arguments", "ArgumentsWithTrailingCallExpressions", "ApplicationStart", "CallExpression", "CallExpressionRest", "LeftHandSideExpression", "ActualAssignment", "UpdateExpression", "UnaryExpression", "BinaryOpExpression", "BinaryOpRHS", "ConditionalExpression", "ShortCircuitExpression", "ImplicitNestedBlock", "ObjectLiteral", "NestedObject", "NestedImplicitObjectLiteral", "BracedObjectLiteralContent", "NestedPropertyDefinitions", "NestedImplicitPropertyDefinition", "NestedImplicitPropertyDefinitions", "NestedBlockStatement", "NestedElement", "NestedElementList", "NestedBindingElement", "NestedBindingElements", "NestedInterfaceProperty", "MemberExpression", "PrimaryExpression", "IndentedApplicationAllowed", "ExpressionWithIndentedApplicationSuppressed", "SuppressIndentedApplication", "AssignmentExpressionTail", "AssignmentExpression", "ExtendedExpression", "Expression", "MemberExpressionRest", "ElseClause", "CoffeeCommentEnabled", "SingleLineComment", "Debugger", "JSXElement", "TypedJSXElement", "JSXFragment", "TypedJSXFragment", "JSXChild", "JSXChildren", "JSXNestedChildren", "JSXMixedChildren"]);
|
|
15119
15130
|
module.exports = {
|
|
15120
15131
|
parse,
|
|
15121
15132
|
compile: function(src, options = defaultOptions) {
|
|
@@ -15168,69 +15179,9 @@ ${"//#"} sourceMappingURL=data:application/json;base64,${base64Encode(JSON.strin
|
|
|
15168
15179
|
exit: function(ruleName, state, result) {
|
|
15169
15180
|
var cache;
|
|
15170
15181
|
cache = caches.get(ruleName);
|
|
15171
|
-
if (!cache) {
|
|
15172
|
-
|
|
15173
|
-
|
|
15174
|
-
case "Samedent":
|
|
15175
|
-
case "IndentedFurther":
|
|
15176
|
-
case "PushIndent":
|
|
15177
|
-
case "PopIndent":
|
|
15178
|
-
case "Nested":
|
|
15179
|
-
case "InsertIndent":
|
|
15180
|
-
case "Arguments":
|
|
15181
|
-
case "ArgumentsWithTrailingCallExpressions":
|
|
15182
|
-
case "ApplicationStart":
|
|
15183
|
-
case "CallExpression":
|
|
15184
|
-
case "CallExpressionRest":
|
|
15185
|
-
case "LeftHandSideExpression":
|
|
15186
|
-
case "ActualAssignment":
|
|
15187
|
-
case "UpdateExpression":
|
|
15188
|
-
case "UnaryExpression":
|
|
15189
|
-
case "BinaryOpExpression":
|
|
15190
|
-
case "BinaryOpRHS":
|
|
15191
|
-
case "ConditionalExpression":
|
|
15192
|
-
case "ShortCircuitExpression":
|
|
15193
|
-
case "ImplicitNestedBlock":
|
|
15194
|
-
case "ObjectLiteral":
|
|
15195
|
-
case "NestedObject":
|
|
15196
|
-
case "NestedImplicitObjectLiteral":
|
|
15197
|
-
case "BracedObjectLiteralContent":
|
|
15198
|
-
case "NestedPropertyDefinitions":
|
|
15199
|
-
case "NestedImplicitPropertyDefinition":
|
|
15200
|
-
case "NestedImplicitPropertyDefinitions":
|
|
15201
|
-
case "NestedBlockStatement":
|
|
15202
|
-
case "NestedElement":
|
|
15203
|
-
case "NestedElementList":
|
|
15204
|
-
case "NestedBindingElement":
|
|
15205
|
-
case "NestedBindingElements":
|
|
15206
|
-
case "NestedInterfaceProperty":
|
|
15207
|
-
case "MemberExpression":
|
|
15208
|
-
case "PrimaryExpression":
|
|
15209
|
-
case "IndentedApplicationAllowed":
|
|
15210
|
-
case "ExpressionWithIndentedApplicationSuppressed":
|
|
15211
|
-
case "SuppressIndentedApplication":
|
|
15212
|
-
case "AssignmentExpressionTail":
|
|
15213
|
-
case "AssignmentExpression":
|
|
15214
|
-
case "ExtendedExpression":
|
|
15215
|
-
case "Expression":
|
|
15216
|
-
case "MemberExpressionRest":
|
|
15217
|
-
case "ElseClause":
|
|
15218
|
-
case "CoffeeCommentEnabled":
|
|
15219
|
-
case "SingleLineComment":
|
|
15220
|
-
case "Debugger":
|
|
15221
|
-
case "JSXElement":
|
|
15222
|
-
case "TypedJSXElement":
|
|
15223
|
-
case "JSXFragment":
|
|
15224
|
-
case "TypedJSXFragment":
|
|
15225
|
-
case "JSXChild":
|
|
15226
|
-
case "JSXChildren":
|
|
15227
|
-
case "JSXNestedChildren":
|
|
15228
|
-
case "JSXMixedChildren":
|
|
15229
|
-
break;
|
|
15230
|
-
default:
|
|
15231
|
-
cache = /* @__PURE__ */ new Map();
|
|
15232
|
-
caches.set(ruleName, cache);
|
|
15233
|
-
}
|
|
15182
|
+
if (!cache && !uncacheable.has(ruleName)) {
|
|
15183
|
+
cache = /* @__PURE__ */ new Map();
|
|
15184
|
+
caches.set(ruleName, cache);
|
|
15234
15185
|
}
|
|
15235
15186
|
if (cache) {
|
|
15236
15187
|
if (result) {
|
package/dist/main.js
CHANGED
|
@@ -4,88 +4,6 @@ var __commonJS = (cb, mod) => function __require() {
|
|
|
4
4
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
5
5
|
};
|
|
6
6
|
|
|
7
|
-
// source/generate.coffee
|
|
8
|
-
var require_generate = __commonJS({
|
|
9
|
-
"source/generate.coffee"(exports2, module2) {
|
|
10
|
-
"civet coffeeCompat";
|
|
11
|
-
var gen2;
|
|
12
|
-
var prune2;
|
|
13
|
-
gen2 = function(node, options) {
|
|
14
|
-
var $loc, token;
|
|
15
|
-
if (node === null || node === void 0) {
|
|
16
|
-
return "";
|
|
17
|
-
}
|
|
18
|
-
if (typeof node === "string") {
|
|
19
|
-
if (options != null) {
|
|
20
|
-
if (typeof options.updateSourceMap === "function") {
|
|
21
|
-
options.updateSourceMap(node);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
return node;
|
|
25
|
-
}
|
|
26
|
-
if (Array.isArray(node)) {
|
|
27
|
-
return node.map(function(child) {
|
|
28
|
-
return gen2(child, options);
|
|
29
|
-
}).join("");
|
|
30
|
-
}
|
|
31
|
-
if (typeof node === "object") {
|
|
32
|
-
if (options.js && node.ts) {
|
|
33
|
-
return "";
|
|
34
|
-
}
|
|
35
|
-
if (!options.js && node.js) {
|
|
36
|
-
return "";
|
|
37
|
-
}
|
|
38
|
-
if (node.$loc != null) {
|
|
39
|
-
({ token, $loc } = node);
|
|
40
|
-
if (options != null) {
|
|
41
|
-
if (typeof options.updateSourceMap === "function") {
|
|
42
|
-
options.updateSourceMap(token, $loc.pos);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
return token;
|
|
46
|
-
}
|
|
47
|
-
if (!node.children) {
|
|
48
|
-
debugger;
|
|
49
|
-
throw new Error("Unknown node", JSON.stringify(node));
|
|
50
|
-
}
|
|
51
|
-
return gen2(node.children, options);
|
|
52
|
-
}
|
|
53
|
-
debugger;
|
|
54
|
-
throw new Error("Unknown node", JSON.stringify(node));
|
|
55
|
-
};
|
|
56
|
-
module2.exports = gen2;
|
|
57
|
-
prune2 = function(node) {
|
|
58
|
-
var a;
|
|
59
|
-
if (node === null || node === void 0) {
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
if (node.length === 0) {
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
if (Array.isArray(node)) {
|
|
66
|
-
a = node.map(function(n) {
|
|
67
|
-
return prune2(n);
|
|
68
|
-
}).filter(function(n) {
|
|
69
|
-
return !!n;
|
|
70
|
-
});
|
|
71
|
-
if (a.length > 1) {
|
|
72
|
-
return a;
|
|
73
|
-
}
|
|
74
|
-
if (a.length === 1) {
|
|
75
|
-
return a[0];
|
|
76
|
-
}
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
if (node.children != null) {
|
|
80
|
-
node.children = prune2(node.children) || [];
|
|
81
|
-
return node;
|
|
82
|
-
}
|
|
83
|
-
return node;
|
|
84
|
-
};
|
|
85
|
-
gen2.prune = prune2;
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
|
|
89
7
|
// source/parser.hera
|
|
90
8
|
var require_parser = __commonJS({
|
|
91
9
|
"source/parser.hera"(exports2, module2) {
|
|
@@ -11001,8 +10919,9 @@ ${input.slice(result.pos)}
|
|
|
11001
10919
|
children: children.jsxChildren.length ? [...$0, ["</", open[1], ">"]] : [open.slice(0, -1), " />"]
|
|
11002
10920
|
};
|
|
11003
10921
|
});
|
|
11004
|
-
var JSXElement$3 = $
|
|
11005
|
-
|
|
10922
|
+
var JSXElement$3 = $TV(JSXOpeningElement, function($skip, $loc, $0, $1) {
|
|
10923
|
+
var elt = $0;
|
|
10924
|
+
throw new Error(`could not parse JSX element "${elt[0]}${elt[1]}${elt[elt.length - 1]}" at pos ${$loc.pos}`);
|
|
11006
10925
|
});
|
|
11007
10926
|
function JSXElement(state) {
|
|
11008
10927
|
if (state.events) {
|
|
@@ -11652,7 +11571,7 @@ ${input.slice(result.pos)}
|
|
|
11652
11571
|
}
|
|
11653
11572
|
return $skip;
|
|
11654
11573
|
});
|
|
11655
|
-
var JSXNestedChildren$1 = $TV($Y(EOS), function($skip, $loc, $0, $1) {
|
|
11574
|
+
var JSXNestedChildren$1 = $TV($Y($C(EOS, $EXPECT($L17, fail, 'JSXNestedChildren "}"'))), function($skip, $loc, $0, $1) {
|
|
11656
11575
|
return { children: [], jsxChildren: [] };
|
|
11657
11576
|
});
|
|
11658
11577
|
function JSXNestedChildren(state) {
|
|
@@ -11673,10 +11592,9 @@ ${input.slice(result.pos)}
|
|
|
11673
11592
|
return result;
|
|
11674
11593
|
}
|
|
11675
11594
|
}
|
|
11676
|
-
var JSXChild$0 =
|
|
11677
|
-
var JSXChild$1 =
|
|
11678
|
-
var JSXChild$2 =
|
|
11679
|
-
var JSXChild$3 = $TS($S(OpenBrace, $E(JSXChildExpression), __, CloseBrace), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
11595
|
+
var JSXChild$0 = JSXElement;
|
|
11596
|
+
var JSXChild$1 = JSXFragment;
|
|
11597
|
+
var JSXChild$2 = $TS($S(OpenBrace, $E(JSXChildExpression), __, CloseBrace), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
11680
11598
|
var expression = $2;
|
|
11681
11599
|
return {
|
|
11682
11600
|
type: "JSXChildExpression",
|
|
@@ -11684,6 +11602,15 @@ ${input.slice(result.pos)}
|
|
|
11684
11602
|
expression
|
|
11685
11603
|
};
|
|
11686
11604
|
});
|
|
11605
|
+
var JSXChild$3 = $TS($S(InsertInlineOpenBrace, ArrowFunction, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3) {
|
|
11606
|
+
var expression = $2;
|
|
11607
|
+
return {
|
|
11608
|
+
type: "JSXChildExpression",
|
|
11609
|
+
children: $0,
|
|
11610
|
+
expression
|
|
11611
|
+
};
|
|
11612
|
+
});
|
|
11613
|
+
var JSXChild$4 = JSXText;
|
|
11687
11614
|
function JSXChild(state) {
|
|
11688
11615
|
if (state.events) {
|
|
11689
11616
|
const result = state.events.enter?.("JSXChild", state);
|
|
@@ -11691,12 +11618,12 @@ ${input.slice(result.pos)}
|
|
|
11691
11618
|
return result.cache;
|
|
11692
11619
|
}
|
|
11693
11620
|
if (state.tokenize) {
|
|
11694
|
-
const result = $TOKEN("JSXChild", state, JSXChild$0(state) || JSXChild$1(state) || JSXChild$2(state) || JSXChild$3(state));
|
|
11621
|
+
const result = $TOKEN("JSXChild", state, JSXChild$0(state) || JSXChild$1(state) || JSXChild$2(state) || JSXChild$3(state) || JSXChild$4(state));
|
|
11695
11622
|
if (state.events)
|
|
11696
11623
|
state.events.exit?.("JSXChild", state, result);
|
|
11697
11624
|
return result;
|
|
11698
11625
|
} else {
|
|
11699
|
-
const result = JSXChild$0(state) || JSXChild$1(state) || JSXChild$2(state) || JSXChild$3(state);
|
|
11626
|
+
const result = JSXChild$0(state) || JSXChild$1(state) || JSXChild$2(state) || JSXChild$3(state) || JSXChild$4(state);
|
|
11700
11627
|
if (state.events)
|
|
11701
11628
|
state.events.exit?.("JSXChild", state, result);
|
|
11702
11629
|
return result;
|
|
@@ -14773,6 +14700,88 @@ ${input.slice(result.pos)}
|
|
|
14773
14700
|
}
|
|
14774
14701
|
});
|
|
14775
14702
|
|
|
14703
|
+
// source/generate.coffee
|
|
14704
|
+
var require_generate = __commonJS({
|
|
14705
|
+
"source/generate.coffee"(exports2, module2) {
|
|
14706
|
+
"civet coffeeCompat";
|
|
14707
|
+
var gen2;
|
|
14708
|
+
var prune2;
|
|
14709
|
+
gen2 = function(node, options) {
|
|
14710
|
+
var $loc, token;
|
|
14711
|
+
if (node === null || node === void 0) {
|
|
14712
|
+
return "";
|
|
14713
|
+
}
|
|
14714
|
+
if (typeof node === "string") {
|
|
14715
|
+
if (options != null) {
|
|
14716
|
+
if (typeof options.updateSourceMap === "function") {
|
|
14717
|
+
options.updateSourceMap(node);
|
|
14718
|
+
}
|
|
14719
|
+
}
|
|
14720
|
+
return node;
|
|
14721
|
+
}
|
|
14722
|
+
if (Array.isArray(node)) {
|
|
14723
|
+
return node.map(function(child) {
|
|
14724
|
+
return gen2(child, options);
|
|
14725
|
+
}).join("");
|
|
14726
|
+
}
|
|
14727
|
+
if (typeof node === "object") {
|
|
14728
|
+
if (options.js && node.ts) {
|
|
14729
|
+
return "";
|
|
14730
|
+
}
|
|
14731
|
+
if (!options.js && node.js) {
|
|
14732
|
+
return "";
|
|
14733
|
+
}
|
|
14734
|
+
if (node.$loc != null) {
|
|
14735
|
+
({ token, $loc } = node);
|
|
14736
|
+
if (options != null) {
|
|
14737
|
+
if (typeof options.updateSourceMap === "function") {
|
|
14738
|
+
options.updateSourceMap(token, $loc.pos);
|
|
14739
|
+
}
|
|
14740
|
+
}
|
|
14741
|
+
return token;
|
|
14742
|
+
}
|
|
14743
|
+
if (!node.children) {
|
|
14744
|
+
debugger;
|
|
14745
|
+
throw new Error("Unknown node", JSON.stringify(node));
|
|
14746
|
+
}
|
|
14747
|
+
return gen2(node.children, options);
|
|
14748
|
+
}
|
|
14749
|
+
debugger;
|
|
14750
|
+
throw new Error("Unknown node", JSON.stringify(node));
|
|
14751
|
+
};
|
|
14752
|
+
module2.exports = gen2;
|
|
14753
|
+
prune2 = function(node) {
|
|
14754
|
+
var a;
|
|
14755
|
+
if (node === null || node === void 0) {
|
|
14756
|
+
return;
|
|
14757
|
+
}
|
|
14758
|
+
if (node.length === 0) {
|
|
14759
|
+
return;
|
|
14760
|
+
}
|
|
14761
|
+
if (Array.isArray(node)) {
|
|
14762
|
+
a = node.map(function(n) {
|
|
14763
|
+
return prune2(n);
|
|
14764
|
+
}).filter(function(n) {
|
|
14765
|
+
return !!n;
|
|
14766
|
+
});
|
|
14767
|
+
if (a.length > 1) {
|
|
14768
|
+
return a;
|
|
14769
|
+
}
|
|
14770
|
+
if (a.length === 1) {
|
|
14771
|
+
return a[0];
|
|
14772
|
+
}
|
|
14773
|
+
return;
|
|
14774
|
+
}
|
|
14775
|
+
if (node.children != null) {
|
|
14776
|
+
node.children = prune2(node.children) || [];
|
|
14777
|
+
return node;
|
|
14778
|
+
}
|
|
14779
|
+
return node;
|
|
14780
|
+
};
|
|
14781
|
+
gen2.prune = prune2;
|
|
14782
|
+
}
|
|
14783
|
+
});
|
|
14784
|
+
|
|
14776
14785
|
// source/util.coffee
|
|
14777
14786
|
var require_util = __commonJS({
|
|
14778
14787
|
"source/util.coffee"(exports2, module2) {
|
|
@@ -15108,11 +15117,13 @@ var gen;
|
|
|
15108
15117
|
var makeCache;
|
|
15109
15118
|
var parse;
|
|
15110
15119
|
var prune;
|
|
15120
|
+
var uncacheable;
|
|
15111
15121
|
var util;
|
|
15112
15122
|
({ parse } = require_parser());
|
|
15113
15123
|
({ prune } = gen = require_generate());
|
|
15114
15124
|
({ SourceMap, base64Encode } = util = require_util());
|
|
15115
15125
|
defaultOptions = {};
|
|
15126
|
+
uncacheable = /* @__PURE__ */ new Set(["TrackIndented", "Samedent", "IndentedFurther", "PushIndent", "PopIndent", "Nested", "InsertIndent", "Arguments", "ArgumentsWithTrailingCallExpressions", "ApplicationStart", "CallExpression", "CallExpressionRest", "LeftHandSideExpression", "ActualAssignment", "UpdateExpression", "UnaryExpression", "BinaryOpExpression", "BinaryOpRHS", "ConditionalExpression", "ShortCircuitExpression", "ImplicitNestedBlock", "ObjectLiteral", "NestedObject", "NestedImplicitObjectLiteral", "BracedObjectLiteralContent", "NestedPropertyDefinitions", "NestedImplicitPropertyDefinition", "NestedImplicitPropertyDefinitions", "NestedBlockStatement", "NestedElement", "NestedElementList", "NestedBindingElement", "NestedBindingElements", "NestedInterfaceProperty", "MemberExpression", "PrimaryExpression", "IndentedApplicationAllowed", "ExpressionWithIndentedApplicationSuppressed", "SuppressIndentedApplication", "AssignmentExpressionTail", "AssignmentExpression", "ExtendedExpression", "Expression", "MemberExpressionRest", "ElseClause", "CoffeeCommentEnabled", "SingleLineComment", "Debugger", "JSXElement", "TypedJSXElement", "JSXFragment", "TypedJSXFragment", "JSXChild", "JSXChildren", "JSXNestedChildren", "JSXMixedChildren"]);
|
|
15116
15127
|
module.exports = {
|
|
15117
15128
|
parse,
|
|
15118
15129
|
compile: function(src, options = defaultOptions) {
|
|
@@ -15165,69 +15176,9 @@ makeCache = function() {
|
|
|
15165
15176
|
exit: function(ruleName, state, result) {
|
|
15166
15177
|
var cache;
|
|
15167
15178
|
cache = caches.get(ruleName);
|
|
15168
|
-
if (!cache) {
|
|
15169
|
-
|
|
15170
|
-
|
|
15171
|
-
case "Samedent":
|
|
15172
|
-
case "IndentedFurther":
|
|
15173
|
-
case "PushIndent":
|
|
15174
|
-
case "PopIndent":
|
|
15175
|
-
case "Nested":
|
|
15176
|
-
case "InsertIndent":
|
|
15177
|
-
case "Arguments":
|
|
15178
|
-
case "ArgumentsWithTrailingCallExpressions":
|
|
15179
|
-
case "ApplicationStart":
|
|
15180
|
-
case "CallExpression":
|
|
15181
|
-
case "CallExpressionRest":
|
|
15182
|
-
case "LeftHandSideExpression":
|
|
15183
|
-
case "ActualAssignment":
|
|
15184
|
-
case "UpdateExpression":
|
|
15185
|
-
case "UnaryExpression":
|
|
15186
|
-
case "BinaryOpExpression":
|
|
15187
|
-
case "BinaryOpRHS":
|
|
15188
|
-
case "ConditionalExpression":
|
|
15189
|
-
case "ShortCircuitExpression":
|
|
15190
|
-
case "ImplicitNestedBlock":
|
|
15191
|
-
case "ObjectLiteral":
|
|
15192
|
-
case "NestedObject":
|
|
15193
|
-
case "NestedImplicitObjectLiteral":
|
|
15194
|
-
case "BracedObjectLiteralContent":
|
|
15195
|
-
case "NestedPropertyDefinitions":
|
|
15196
|
-
case "NestedImplicitPropertyDefinition":
|
|
15197
|
-
case "NestedImplicitPropertyDefinitions":
|
|
15198
|
-
case "NestedBlockStatement":
|
|
15199
|
-
case "NestedElement":
|
|
15200
|
-
case "NestedElementList":
|
|
15201
|
-
case "NestedBindingElement":
|
|
15202
|
-
case "NestedBindingElements":
|
|
15203
|
-
case "NestedInterfaceProperty":
|
|
15204
|
-
case "MemberExpression":
|
|
15205
|
-
case "PrimaryExpression":
|
|
15206
|
-
case "IndentedApplicationAllowed":
|
|
15207
|
-
case "ExpressionWithIndentedApplicationSuppressed":
|
|
15208
|
-
case "SuppressIndentedApplication":
|
|
15209
|
-
case "AssignmentExpressionTail":
|
|
15210
|
-
case "AssignmentExpression":
|
|
15211
|
-
case "ExtendedExpression":
|
|
15212
|
-
case "Expression":
|
|
15213
|
-
case "MemberExpressionRest":
|
|
15214
|
-
case "ElseClause":
|
|
15215
|
-
case "CoffeeCommentEnabled":
|
|
15216
|
-
case "SingleLineComment":
|
|
15217
|
-
case "Debugger":
|
|
15218
|
-
case "JSXElement":
|
|
15219
|
-
case "TypedJSXElement":
|
|
15220
|
-
case "JSXFragment":
|
|
15221
|
-
case "TypedJSXFragment":
|
|
15222
|
-
case "JSXChild":
|
|
15223
|
-
case "JSXChildren":
|
|
15224
|
-
case "JSXNestedChildren":
|
|
15225
|
-
case "JSXMixedChildren":
|
|
15226
|
-
break;
|
|
15227
|
-
default:
|
|
15228
|
-
cache = /* @__PURE__ */ new Map();
|
|
15229
|
-
caches.set(ruleName, cache);
|
|
15230
|
-
}
|
|
15179
|
+
if (!cache && !uncacheable.has(ruleName)) {
|
|
15180
|
+
cache = /* @__PURE__ */ new Map();
|
|
15181
|
+
caches.set(ruleName, cache);
|
|
15231
15182
|
}
|
|
15232
15183
|
if (cache) {
|
|
15233
15184
|
if (result) {
|