@danielx/civet 0.5.14 → 0.5.16
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 -0
- package/dist/browser.js +227 -177
- package/dist/main.js +227 -177
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -217,6 +217,11 @@ Things Added that CoffeeScript didn't
|
|
|
217
217
|
(assuming they are not preceded by text); this is unambiguous because
|
|
218
218
|
`>` isn't valid JSX text. For example, `<For> (item) => ...`
|
|
219
219
|
(where function body can be indented).
|
|
220
|
+
- `#foo` shorthand for `id="foo"`;
|
|
221
|
+
also `#"foo bar"`, `` #`foo ${bar}` ``, `#{expr}`
|
|
222
|
+
- `.foo` shorthand for `class="foo"` (but must be at least one space after
|
|
223
|
+
tag name); also `.foo.bar`, `."foo bar"`, `` .`foo ${bar}` ``, `.{expr}`
|
|
224
|
+
- `"civet react"` flag uses `className` instead of `class`
|
|
220
225
|
- Any braced object literal can be used as an attribute:
|
|
221
226
|
`{foo}` → `foo={foo}`, `{foo: bar}` → `foo={bar}`,
|
|
222
227
|
`{...foo}` remains as is; methods and getters/setters work too.
|
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) {
|
|
@@ -862,6 +780,7 @@ ${input.slice(result.pos)}
|
|
|
862
780
|
JSXIdentifierName,
|
|
863
781
|
JSXAttributes,
|
|
864
782
|
JSXAttribute,
|
|
783
|
+
JSXShorthandString,
|
|
865
784
|
JSXAttributeName,
|
|
866
785
|
JSXAttributeInitializer,
|
|
867
786
|
JSXAttributeValue,
|
|
@@ -1181,14 +1100,15 @@ ${input.slice(result.pos)}
|
|
|
1181
1100
|
var $R43 = $R(new RegExp("(?!\\p{ID_Continue})", "suy"));
|
|
1182
1101
|
var $R44 = $R(new RegExp("\\s", "suy"));
|
|
1183
1102
|
var $R45 = $R(new RegExp("(?:\\p{ID_Start}|[_$])(?:\\p{ID_Continue}|[\\u200C\\u200D$-])*", "suy"));
|
|
1184
|
-
var $R46 = $R(new RegExp("[^
|
|
1185
|
-
var $R47 = $R(new RegExp("[
|
|
1186
|
-
var $R48 = $R(new RegExp("
|
|
1187
|
-
var $R49 = $R(new RegExp("[\\
|
|
1188
|
-
var $R50 = $R(new RegExp("[\\
|
|
1189
|
-
var $R51 = $R(new RegExp("
|
|
1190
|
-
var $R52 = $R(new RegExp("\\
|
|
1191
|
-
var $R53 = $R(new RegExp("
|
|
1103
|
+
var $R46 = $R(new RegExp("(?:[\\w\\-:]+|\\([^()]*\\)|\\[[^\\[\\]]*\\])+", "suy"));
|
|
1104
|
+
var $R47 = $R(new RegExp("[^{}<>\\r\\n]+", "suy"));
|
|
1105
|
+
var $R48 = $R(new RegExp("[+-]?", "suy"));
|
|
1106
|
+
var $R49 = $R(new RegExp("#![^\\r\\n]*", "suy"));
|
|
1107
|
+
var $R50 = $R(new RegExp("[\\t ]*", "suy"));
|
|
1108
|
+
var $R51 = $R(new RegExp("[\\s]*", "suy"));
|
|
1109
|
+
var $R52 = $R(new RegExp("\\s+([+-]?)([a-zA-Z0-9-]+)(\\s*=\\s*([a-zA-Z0-9.+-]*))?", "suy"));
|
|
1110
|
+
var $R53 = $R(new RegExp("\\r\\n|\\n|\\r|$", "suy"));
|
|
1111
|
+
var $R54 = $R(new RegExp("[ \\t]*", "suy"));
|
|
1192
1112
|
var Program$0 = $TS($S(Reset, Init, __, $Q(TopLevelStatement), __), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
1193
1113
|
var statements = $4;
|
|
1194
1114
|
module.processProgram(statements);
|
|
@@ -10989,7 +10909,7 @@ ${input.slice(result.pos)}
|
|
|
10989
10909
|
}
|
|
10990
10910
|
}
|
|
10991
10911
|
var JSXElement$0 = JSXSelfClosingElement;
|
|
10992
|
-
var JSXElement$1 = $TS($S(JSXOpeningElement, $E(JSXChildren),
|
|
10912
|
+
var JSXElement$1 = $TS($S(JSXOpeningElement, $E(JSXChildren), $E(Whitespace), JSXClosingElement), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
10993
10913
|
if ($1[1] !== $4[2])
|
|
10994
10914
|
return $skip;
|
|
10995
10915
|
return { type: "JSXElement", children: $0 };
|
|
@@ -11002,8 +10922,9 @@ ${input.slice(result.pos)}
|
|
|
11002
10922
|
children: children.jsxChildren.length ? [...$0, ["</", open[1], ">"]] : [open.slice(0, -1), " />"]
|
|
11003
10923
|
};
|
|
11004
10924
|
});
|
|
11005
|
-
var JSXElement$3 = $
|
|
11006
|
-
|
|
10925
|
+
var JSXElement$3 = $TV(JSXOpeningElement, function($skip, $loc, $0, $1) {
|
|
10926
|
+
var elt = $0;
|
|
10927
|
+
throw new Error(`could not parse JSX element "${elt[0]}${elt[1]}${elt[elt.length - 1]}" at pos ${$loc.pos}`);
|
|
11007
10928
|
});
|
|
11008
10929
|
function JSXElement(state) {
|
|
11009
10930
|
if (state.events) {
|
|
@@ -11023,7 +10944,7 @@ ${input.slice(result.pos)}
|
|
|
11023
10944
|
return result;
|
|
11024
10945
|
}
|
|
11025
10946
|
}
|
|
11026
|
-
var JSXSelfClosingElement$0 = $TS($S($EXPECT($L5, fail, 'JSXSelfClosingElement "<"'), $TEXT(JSXElementName), $E(CompactTypeArguments), $E(JSXAttributes),
|
|
10947
|
+
var JSXSelfClosingElement$0 = $TS($S($EXPECT($L5, fail, 'JSXSelfClosingElement "<"'), $TEXT(JSXElementName), $E(CompactTypeArguments), $E(JSXAttributes), $E(Whitespace), $EXPECT($L153, fail, 'JSXSelfClosingElement "/>"')), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
|
|
11027
10948
|
return { type: "JSXElement", children: $0 };
|
|
11028
10949
|
});
|
|
11029
10950
|
function JSXSelfClosingElement(state) {
|
|
@@ -11044,7 +10965,7 @@ ${input.slice(result.pos)}
|
|
|
11044
10965
|
return result;
|
|
11045
10966
|
}
|
|
11046
10967
|
}
|
|
11047
|
-
var JSXOpeningElement$0 = $S($EXPECT($L5, fail, 'JSXOpeningElement "<"'), $TEXT(JSXElementName), $E(CompactTypeArguments), $E(JSXAttributes),
|
|
10968
|
+
var JSXOpeningElement$0 = $S($EXPECT($L5, fail, 'JSXOpeningElement "<"'), $TEXT(JSXElementName), $E(CompactTypeArguments), $E(JSXAttributes), $E(Whitespace), $EXPECT($L27, fail, 'JSXOpeningElement ">"'));
|
|
11048
10969
|
function JSXOpeningElement(state) {
|
|
11049
10970
|
if (state.events) {
|
|
11050
10971
|
const result = state.events.enter?.("JSXOpeningElement", state);
|
|
@@ -11063,7 +10984,7 @@ ${input.slice(result.pos)}
|
|
|
11063
10984
|
return result;
|
|
11064
10985
|
}
|
|
11065
10986
|
}
|
|
11066
|
-
var JSXClosingElement$0 = $S($EXPECT($L154, fail, 'JSXClosingElement "</"'),
|
|
10987
|
+
var JSXClosingElement$0 = $S($EXPECT($L154, fail, 'JSXClosingElement "</"'), $E(Whitespace), $TEXT(JSXElementName), $E(Whitespace), $EXPECT($L27, fail, 'JSXClosingElement ">"'));
|
|
11067
10988
|
function JSXClosingElement(state) {
|
|
11068
10989
|
if (state.events) {
|
|
11069
10990
|
const result = state.events.enter?.("JSXClosingElement", state);
|
|
@@ -11108,7 +11029,7 @@ ${input.slice(result.pos)}
|
|
|
11108
11029
|
return result;
|
|
11109
11030
|
}
|
|
11110
11031
|
}
|
|
11111
|
-
var JSXFragment$0 = $TS($S($EXPECT($L155, fail, 'JSXFragment "<>"'), $E(JSXChildren),
|
|
11032
|
+
var JSXFragment$0 = $TS($S($EXPECT($L155, fail, 'JSXFragment "<>"'), $E(JSXChildren), $E(Whitespace), $EXPECT($L156, fail, 'JSXFragment "</>"')), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
11112
11033
|
if ($2) {
|
|
11113
11034
|
return { type: "JSXFragment", children: $0, jsxChildren: $2.jsxChildren };
|
|
11114
11035
|
} else {
|
|
@@ -11174,7 +11095,62 @@ ${input.slice(result.pos)}
|
|
|
11174
11095
|
return result;
|
|
11175
11096
|
}
|
|
11176
11097
|
}
|
|
11177
|
-
var JSXAttributes$0 = $Q($S(
|
|
11098
|
+
var JSXAttributes$0 = $TV($Q($S($E(Whitespace), JSXAttribute)), function($skip, $loc, $0, $1) {
|
|
11099
|
+
const classes = [];
|
|
11100
|
+
let attrs = $0.filter((pair) => {
|
|
11101
|
+
const [, attr] = pair;
|
|
11102
|
+
if (attr.type === "JSXClass") {
|
|
11103
|
+
classes.push(attr.class);
|
|
11104
|
+
return false;
|
|
11105
|
+
}
|
|
11106
|
+
return true;
|
|
11107
|
+
});
|
|
11108
|
+
if (classes.length) {
|
|
11109
|
+
let braced = function(c) {
|
|
11110
|
+
return c[0] === "{" || c[0]?.token === "{";
|
|
11111
|
+
}, parseClass = function(c) {
|
|
11112
|
+
c = c.token || c;
|
|
11113
|
+
if (c.startsWith("'")) {
|
|
11114
|
+
c = '"' + c.slice(1, -1).replace(/\\*"/g, (m) => m.length % 2 == 0 ? m : "\\" + m) + '"';
|
|
11115
|
+
}
|
|
11116
|
+
return JSON.parse(c);
|
|
11117
|
+
};
|
|
11118
|
+
let className = module.config.react ? "className" : "class";
|
|
11119
|
+
attrs = attrs.filter((pair) => {
|
|
11120
|
+
const [, attr] = pair;
|
|
11121
|
+
if ((attr[0][0] === "class" || attr[0][0] === "className") && !attr[0][1]) {
|
|
11122
|
+
className = attr[0][0];
|
|
11123
|
+
classes.push(attr[1][attr[1].length - 1]);
|
|
11124
|
+
return false;
|
|
11125
|
+
}
|
|
11126
|
+
return true;
|
|
11127
|
+
});
|
|
11128
|
+
let classValue;
|
|
11129
|
+
if (classes.some(braced)) {
|
|
11130
|
+
classValue = ["{`"];
|
|
11131
|
+
classes.forEach((c, i) => {
|
|
11132
|
+
if (i > 0)
|
|
11133
|
+
classValue.push(" ");
|
|
11134
|
+
if (braced(c)) {
|
|
11135
|
+
classValue.push("$", c);
|
|
11136
|
+
} else {
|
|
11137
|
+
classValue.push(parseClass(c));
|
|
11138
|
+
}
|
|
11139
|
+
});
|
|
11140
|
+
classValue.push("`}");
|
|
11141
|
+
} else {
|
|
11142
|
+
classValue = JSON.stringify(classes.map(parseClass).join(" "));
|
|
11143
|
+
}
|
|
11144
|
+
attrs.splice(0, 0, [" ", [className, ["=", classValue]]]);
|
|
11145
|
+
}
|
|
11146
|
+
return attrs.map((pair) => {
|
|
11147
|
+
const [space, attr] = pair;
|
|
11148
|
+
if (space && attr[0] === " ") {
|
|
11149
|
+
pair = [space, attr.slice(1)];
|
|
11150
|
+
}
|
|
11151
|
+
return pair;
|
|
11152
|
+
});
|
|
11153
|
+
});
|
|
11178
11154
|
function JSXAttributes(state) {
|
|
11179
11155
|
if (state.events) {
|
|
11180
11156
|
const result = state.events.enter?.("JSXAttributes", state);
|
|
@@ -11249,6 +11225,15 @@ ${input.slice(result.pos)}
|
|
|
11249
11225
|
}
|
|
11250
11226
|
});
|
|
11251
11227
|
var JSXAttribute$2 = $S(InsertInlineOpenBrace, DotDotDot, InlineJSXAttributeValue, InsertCloseBrace);
|
|
11228
|
+
var JSXAttribute$3 = $TS($S($EXPECT($L8, fail, 'JSXAttribute "#"'), JSXShorthandString), function($skip, $loc, $0, $1, $2) {
|
|
11229
|
+
return [" ", "id=", $2];
|
|
11230
|
+
});
|
|
11231
|
+
var JSXAttribute$4 = $TS($S(Dot, JSXShorthandString), function($skip, $loc, $0, $1, $2) {
|
|
11232
|
+
return {
|
|
11233
|
+
type: "JSXClass",
|
|
11234
|
+
class: $2
|
|
11235
|
+
};
|
|
11236
|
+
});
|
|
11252
11237
|
function JSXAttribute(state) {
|
|
11253
11238
|
if (state.events) {
|
|
11254
11239
|
const result = state.events.enter?.("JSXAttribute", state);
|
|
@@ -11256,17 +11241,49 @@ ${input.slice(result.pos)}
|
|
|
11256
11241
|
return result.cache;
|
|
11257
11242
|
}
|
|
11258
11243
|
if (state.tokenize) {
|
|
11259
|
-
const result = $TOKEN("JSXAttribute", state, JSXAttribute$0(state) || JSXAttribute$1(state) || JSXAttribute$2(state));
|
|
11244
|
+
const result = $TOKEN("JSXAttribute", state, JSXAttribute$0(state) || JSXAttribute$1(state) || JSXAttribute$2(state) || JSXAttribute$3(state) || JSXAttribute$4(state));
|
|
11260
11245
|
if (state.events)
|
|
11261
11246
|
state.events.exit?.("JSXAttribute", state, result);
|
|
11262
11247
|
return result;
|
|
11263
11248
|
} else {
|
|
11264
|
-
const result = JSXAttribute$0(state) || JSXAttribute$1(state) || JSXAttribute$2(state);
|
|
11249
|
+
const result = JSXAttribute$0(state) || JSXAttribute$1(state) || JSXAttribute$2(state) || JSXAttribute$3(state) || JSXAttribute$4(state);
|
|
11265
11250
|
if (state.events)
|
|
11266
11251
|
state.events.exit?.("JSXAttribute", state, result);
|
|
11267
11252
|
return result;
|
|
11268
11253
|
}
|
|
11269
11254
|
}
|
|
11255
|
+
var JSXShorthandString$0 = $TR($EXPECT($R46, fail, "JSXShorthandString /(?:[\\w\\-:]+|\\([^()]*\\)|\\[[^\\[\\]]*\\])+/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
|
|
11256
|
+
return module.quoteString($0);
|
|
11257
|
+
});
|
|
11258
|
+
var JSXShorthandString$1 = $TS($S(StringLiteral), function($skip, $loc, $0, $1) {
|
|
11259
|
+
if (module.isTemplateLiteral($1)) {
|
|
11260
|
+
return ["{", $1, "}"];
|
|
11261
|
+
} else {
|
|
11262
|
+
return $1;
|
|
11263
|
+
}
|
|
11264
|
+
});
|
|
11265
|
+
var JSXShorthandString$2 = $TS($S(TemplateLiteral), function($skip, $loc, $0, $1) {
|
|
11266
|
+
return ["{", $1, "}"];
|
|
11267
|
+
});
|
|
11268
|
+
var JSXShorthandString$3 = $S(OpenBrace, ExtendedExpression, $E(Whitespace), CloseBrace);
|
|
11269
|
+
function JSXShorthandString(state) {
|
|
11270
|
+
if (state.events) {
|
|
11271
|
+
const result = state.events.enter?.("JSXShorthandString", state);
|
|
11272
|
+
if (result)
|
|
11273
|
+
return result.cache;
|
|
11274
|
+
}
|
|
11275
|
+
if (state.tokenize) {
|
|
11276
|
+
const result = $TOKEN("JSXShorthandString", state, JSXShorthandString$0(state) || JSXShorthandString$1(state) || JSXShorthandString$2(state) || JSXShorthandString$3(state));
|
|
11277
|
+
if (state.events)
|
|
11278
|
+
state.events.exit?.("JSXShorthandString", state, result);
|
|
11279
|
+
return result;
|
|
11280
|
+
} else {
|
|
11281
|
+
const result = JSXShorthandString$0(state) || JSXShorthandString$1(state) || JSXShorthandString$2(state) || JSXShorthandString$3(state);
|
|
11282
|
+
if (state.events)
|
|
11283
|
+
state.events.exit?.("JSXShorthandString", state, result);
|
|
11284
|
+
return result;
|
|
11285
|
+
}
|
|
11286
|
+
}
|
|
11270
11287
|
var JSXAttributeName$0 = $S(JSXIdentifierName, $E($S(Colon, JSXIdentifierName)));
|
|
11271
11288
|
var JSXAttributeName$1 = ComputedPropertyName;
|
|
11272
11289
|
function JSXAttributeName(state) {
|
|
@@ -11287,7 +11304,7 @@ ${input.slice(result.pos)}
|
|
|
11287
11304
|
return result;
|
|
11288
11305
|
}
|
|
11289
11306
|
}
|
|
11290
|
-
var JSXAttributeInitializer$0 = $S(
|
|
11307
|
+
var JSXAttributeInitializer$0 = $S($E(Whitespace), Equals, $E(Whitespace), JSXAttributeValue);
|
|
11291
11308
|
function JSXAttributeInitializer(state) {
|
|
11292
11309
|
if (state.events) {
|
|
11293
11310
|
const result = state.events.enter?.("JSXAttributeInitializer", state);
|
|
@@ -11311,7 +11328,7 @@ ${input.slice(result.pos)}
|
|
|
11311
11328
|
return $skip;
|
|
11312
11329
|
return $1;
|
|
11313
11330
|
});
|
|
11314
|
-
var JSXAttributeValue$1 = $S(OpenBrace, ExtendedExpression,
|
|
11331
|
+
var JSXAttributeValue$1 = $S(OpenBrace, ExtendedExpression, $E(Whitespace), CloseBrace);
|
|
11315
11332
|
var JSXAttributeValue$2 = JSXElement;
|
|
11316
11333
|
var JSXAttributeValue$3 = JSXFragment;
|
|
11317
11334
|
var JSXAttributeValue$4 = $S(InsertInlineOpenBrace, InlineJSXAttributeValue, InsertCloseBrace);
|
|
@@ -11653,7 +11670,7 @@ ${input.slice(result.pos)}
|
|
|
11653
11670
|
}
|
|
11654
11671
|
return $skip;
|
|
11655
11672
|
});
|
|
11656
|
-
var JSXNestedChildren$1 = $TV($Y(EOS), function($skip, $loc, $0, $1) {
|
|
11673
|
+
var JSXNestedChildren$1 = $TV($Y($C(EOS, $EXPECT($L17, fail, 'JSXNestedChildren "}"'))), function($skip, $loc, $0, $1) {
|
|
11657
11674
|
return { children: [], jsxChildren: [] };
|
|
11658
11675
|
});
|
|
11659
11676
|
function JSXNestedChildren(state) {
|
|
@@ -11711,7 +11728,7 @@ ${input.slice(result.pos)}
|
|
|
11711
11728
|
return result;
|
|
11712
11729
|
}
|
|
11713
11730
|
}
|
|
11714
|
-
var JSXText$0 = $TR($EXPECT($
|
|
11731
|
+
var JSXText$0 = $TR($EXPECT($R47, fail, "JSXText /[^{}<>\\r\\n]+/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
|
|
11715
11732
|
return {
|
|
11716
11733
|
type: "JSXText",
|
|
11717
11734
|
token: $0,
|
|
@@ -11736,7 +11753,7 @@ ${input.slice(result.pos)}
|
|
|
11736
11753
|
return result;
|
|
11737
11754
|
}
|
|
11738
11755
|
}
|
|
11739
|
-
var JSXChildExpression$0 = $S(
|
|
11756
|
+
var JSXChildExpression$0 = $S($E(Whitespace), $E($S(DotDotDot, $E(Whitespace))), ExtendedExpression);
|
|
11740
11757
|
function JSXChildExpression(state) {
|
|
11741
11758
|
if (state.events) {
|
|
11742
11759
|
const result = state.events.enter?.("JSXChildExpression", state);
|
|
@@ -12045,7 +12062,7 @@ ${input.slice(result.pos)}
|
|
|
12045
12062
|
return result;
|
|
12046
12063
|
}
|
|
12047
12064
|
}
|
|
12048
|
-
var TypeIndexSignature$0 = $S($E($S($R$0($EXPECT($
|
|
12065
|
+
var TypeIndexSignature$0 = $S($E($S($R$0($EXPECT($R48, fail, "TypeIndexSignature /[+-]?/")), $EXPECT($L129, fail, 'TypeIndexSignature "readonly"'), __)), OpenBracket, TypeIndex, CloseBracket, $E($S(__, $R$0($EXPECT($R4, fail, "TypeIndexSignature /[+-]/")), QuestionMark)));
|
|
12049
12066
|
function TypeIndexSignature(state) {
|
|
12050
12067
|
if (state.events) {
|
|
12051
12068
|
const result = state.events.enter?.("TypeIndexSignature", state);
|
|
@@ -12647,7 +12664,7 @@ ${input.slice(result.pos)}
|
|
|
12647
12664
|
return result;
|
|
12648
12665
|
}
|
|
12649
12666
|
}
|
|
12650
|
-
var Shebang$0 = $S($R$0($EXPECT($
|
|
12667
|
+
var Shebang$0 = $S($R$0($EXPECT($R49, fail, "Shebang /#![^\\r\\n]*/")), EOL);
|
|
12651
12668
|
function Shebang(state) {
|
|
12652
12669
|
if (state.events) {
|
|
12653
12670
|
const result = state.events.enter?.("Shebang", state);
|
|
@@ -12666,11 +12683,11 @@ ${input.slice(result.pos)}
|
|
|
12666
12683
|
return result;
|
|
12667
12684
|
}
|
|
12668
12685
|
}
|
|
12669
|
-
var CivetPrologue$0 = $T($S($EXPECT($
|
|
12686
|
+
var CivetPrologue$0 = $T($S($EXPECT($R50, fail, "CivetPrologue /[\\t ]*/"), DoubleQuote, CivetPrologueContent, DoubleQuote, $TEXT(StatementDelimiter), EOS), function(value) {
|
|
12670
12687
|
var content = value[2];
|
|
12671
12688
|
return content;
|
|
12672
12689
|
});
|
|
12673
|
-
var CivetPrologue$1 = $T($S($EXPECT($
|
|
12690
|
+
var CivetPrologue$1 = $T($S($EXPECT($R50, fail, "CivetPrologue /[\\t ]*/"), SingleQuote, CivetPrologueContent, SingleQuote, $TEXT(StatementDelimiter), EOS), function(value) {
|
|
12674
12691
|
var content = value[2];
|
|
12675
12692
|
return content;
|
|
12676
12693
|
});
|
|
@@ -12692,7 +12709,7 @@ ${input.slice(result.pos)}
|
|
|
12692
12709
|
return result;
|
|
12693
12710
|
}
|
|
12694
12711
|
}
|
|
12695
|
-
var CivetPrologueContent$0 = $TS($S($EXPECT($L165, fail, 'CivetPrologueContent "civet"'), $Q(CivetOption), $EXPECT($
|
|
12712
|
+
var CivetPrologueContent$0 = $TS($S($EXPECT($L165, fail, 'CivetPrologueContent "civet"'), $Q(CivetOption), $EXPECT($R51, fail, "CivetPrologueContent /[\\s]*/")), function($skip, $loc, $0, $1, $2, $3) {
|
|
12696
12713
|
var options = $2;
|
|
12697
12714
|
return {
|
|
12698
12715
|
type: "CivetPrologue",
|
|
@@ -12718,7 +12735,7 @@ ${input.slice(result.pos)}
|
|
|
12718
12735
|
return result;
|
|
12719
12736
|
}
|
|
12720
12737
|
}
|
|
12721
|
-
var CivetOption$0 = $TR($EXPECT($
|
|
12738
|
+
var CivetOption$0 = $TR($EXPECT($R52, fail, "CivetOption /\\s+([+-]?)([a-zA-Z0-9-]+)(\\s*=\\s*([a-zA-Z0-9.+-]*))?/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
|
|
12722
12739
|
const optionName = $2.replace(/-+([a-z]?)/g, (_2, l) => {
|
|
12723
12740
|
if (l)
|
|
12724
12741
|
return l.toUpperCase();
|
|
@@ -12750,7 +12767,7 @@ ${input.slice(result.pos)}
|
|
|
12750
12767
|
return result;
|
|
12751
12768
|
}
|
|
12752
12769
|
}
|
|
12753
|
-
var UnknownPrologue$0 = $S($R$0($EXPECT($
|
|
12770
|
+
var UnknownPrologue$0 = $S($R$0($EXPECT($R50, fail, "UnknownPrologue /[\\t ]*/")), BasicStringLiteral, $TEXT(StatementDelimiter), EOS);
|
|
12754
12771
|
function UnknownPrologue(state) {
|
|
12755
12772
|
if (state.events) {
|
|
12756
12773
|
const result = state.events.enter?.("UnknownPrologue", state);
|
|
@@ -12808,7 +12825,7 @@ ${input.slice(result.pos)}
|
|
|
12808
12825
|
return result;
|
|
12809
12826
|
}
|
|
12810
12827
|
}
|
|
12811
|
-
var EOL$0 = $TR($EXPECT($
|
|
12828
|
+
var EOL$0 = $TR($EXPECT($R53, fail, "EOL /\\r\\n|\\n|\\r|$/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
|
|
12812
12829
|
return { $loc, token: $0 };
|
|
12813
12830
|
});
|
|
12814
12831
|
function EOL(state) {
|
|
@@ -13449,6 +13466,7 @@ ${input.slice(result.pos)}
|
|
|
13449
13466
|
coffeeNot: false,
|
|
13450
13467
|
coffeeOf: false,
|
|
13451
13468
|
implicitReturns: true,
|
|
13469
|
+
react: false,
|
|
13452
13470
|
solid: false,
|
|
13453
13471
|
client: false,
|
|
13454
13472
|
server: false,
|
|
@@ -13606,6 +13624,14 @@ ${input.slice(result.pos)}
|
|
|
13606
13624
|
module.modifyString = function(str) {
|
|
13607
13625
|
return str.replace(/(^.?|[^\\]{2})(\\\\)*\n/g, "$1$2\\n");
|
|
13608
13626
|
};
|
|
13627
|
+
module.quoteString = function(str) {
|
|
13628
|
+
str = str.replace(/\\/g, "\\\\");
|
|
13629
|
+
if (str.includes('"') && !str.includes("'")) {
|
|
13630
|
+
return "'" + str.replace(/'/g, "\\'") + "'";
|
|
13631
|
+
} else {
|
|
13632
|
+
return '"' + str.replace(/"/g, '\\"') + '"';
|
|
13633
|
+
}
|
|
13634
|
+
};
|
|
13609
13635
|
});
|
|
13610
13636
|
function Reset(state) {
|
|
13611
13637
|
if (state.events) {
|
|
@@ -14584,7 +14610,7 @@ ${input.slice(result.pos)}
|
|
|
14584
14610
|
return result;
|
|
14585
14611
|
}
|
|
14586
14612
|
}
|
|
14587
|
-
var Indent$0 = $TR($EXPECT($
|
|
14613
|
+
var Indent$0 = $TR($EXPECT($R54, fail, "Indent /[ \\t]*/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
|
|
14588
14614
|
let level;
|
|
14589
14615
|
if (module.config.tab) {
|
|
14590
14616
|
const tabs = $0.match(/\t/g);
|
|
@@ -14782,6 +14808,88 @@ ${input.slice(result.pos)}
|
|
|
14782
14808
|
}
|
|
14783
14809
|
});
|
|
14784
14810
|
|
|
14811
|
+
// source/generate.coffee
|
|
14812
|
+
var require_generate = __commonJS({
|
|
14813
|
+
"source/generate.coffee"(exports, module) {
|
|
14814
|
+
"civet coffeeCompat";
|
|
14815
|
+
var gen;
|
|
14816
|
+
var prune;
|
|
14817
|
+
gen = function(node, options) {
|
|
14818
|
+
var $loc, token;
|
|
14819
|
+
if (node === null || node === void 0) {
|
|
14820
|
+
return "";
|
|
14821
|
+
}
|
|
14822
|
+
if (typeof node === "string") {
|
|
14823
|
+
if (options != null) {
|
|
14824
|
+
if (typeof options.updateSourceMap === "function") {
|
|
14825
|
+
options.updateSourceMap(node);
|
|
14826
|
+
}
|
|
14827
|
+
}
|
|
14828
|
+
return node;
|
|
14829
|
+
}
|
|
14830
|
+
if (Array.isArray(node)) {
|
|
14831
|
+
return node.map(function(child) {
|
|
14832
|
+
return gen(child, options);
|
|
14833
|
+
}).join("");
|
|
14834
|
+
}
|
|
14835
|
+
if (typeof node === "object") {
|
|
14836
|
+
if (options.js && node.ts) {
|
|
14837
|
+
return "";
|
|
14838
|
+
}
|
|
14839
|
+
if (!options.js && node.js) {
|
|
14840
|
+
return "";
|
|
14841
|
+
}
|
|
14842
|
+
if (node.$loc != null) {
|
|
14843
|
+
({ token, $loc } = node);
|
|
14844
|
+
if (options != null) {
|
|
14845
|
+
if (typeof options.updateSourceMap === "function") {
|
|
14846
|
+
options.updateSourceMap(token, $loc.pos);
|
|
14847
|
+
}
|
|
14848
|
+
}
|
|
14849
|
+
return token;
|
|
14850
|
+
}
|
|
14851
|
+
if (!node.children) {
|
|
14852
|
+
debugger;
|
|
14853
|
+
throw new Error("Unknown node", JSON.stringify(node));
|
|
14854
|
+
}
|
|
14855
|
+
return gen(node.children, options);
|
|
14856
|
+
}
|
|
14857
|
+
debugger;
|
|
14858
|
+
throw new Error("Unknown node", JSON.stringify(node));
|
|
14859
|
+
};
|
|
14860
|
+
module.exports = gen;
|
|
14861
|
+
prune = function(node) {
|
|
14862
|
+
var a;
|
|
14863
|
+
if (node === null || node === void 0) {
|
|
14864
|
+
return;
|
|
14865
|
+
}
|
|
14866
|
+
if (node.length === 0) {
|
|
14867
|
+
return;
|
|
14868
|
+
}
|
|
14869
|
+
if (Array.isArray(node)) {
|
|
14870
|
+
a = node.map(function(n) {
|
|
14871
|
+
return prune(n);
|
|
14872
|
+
}).filter(function(n) {
|
|
14873
|
+
return !!n;
|
|
14874
|
+
});
|
|
14875
|
+
if (a.length > 1) {
|
|
14876
|
+
return a;
|
|
14877
|
+
}
|
|
14878
|
+
if (a.length === 1) {
|
|
14879
|
+
return a[0];
|
|
14880
|
+
}
|
|
14881
|
+
return;
|
|
14882
|
+
}
|
|
14883
|
+
if (node.children != null) {
|
|
14884
|
+
node.children = prune(node.children) || [];
|
|
14885
|
+
return node;
|
|
14886
|
+
}
|
|
14887
|
+
return node;
|
|
14888
|
+
};
|
|
14889
|
+
gen.prune = prune;
|
|
14890
|
+
}
|
|
14891
|
+
});
|
|
14892
|
+
|
|
14785
14893
|
// source/util.coffee
|
|
14786
14894
|
var require_util = __commonJS({
|
|
14787
14895
|
"source/util.coffee"(exports, module) {
|
|
@@ -15119,11 +15227,13 @@ ${input.slice(result.pos)}
|
|
|
15119
15227
|
var makeCache;
|
|
15120
15228
|
var parse;
|
|
15121
15229
|
var prune;
|
|
15230
|
+
var uncacheable;
|
|
15122
15231
|
var util;
|
|
15123
15232
|
({ parse } = require_parser());
|
|
15124
15233
|
({ prune } = gen = require_generate());
|
|
15125
15234
|
({ SourceMap, base64Encode } = util = require_util());
|
|
15126
15235
|
defaultOptions = {};
|
|
15236
|
+
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"]);
|
|
15127
15237
|
module.exports = {
|
|
15128
15238
|
parse,
|
|
15129
15239
|
compile: function(src, options = defaultOptions) {
|
|
@@ -15176,69 +15286,9 @@ ${"//#"} sourceMappingURL=data:application/json;base64,${base64Encode(JSON.strin
|
|
|
15176
15286
|
exit: function(ruleName, state, result) {
|
|
15177
15287
|
var cache;
|
|
15178
15288
|
cache = caches.get(ruleName);
|
|
15179
|
-
if (!cache) {
|
|
15180
|
-
|
|
15181
|
-
|
|
15182
|
-
case "Samedent":
|
|
15183
|
-
case "IndentedFurther":
|
|
15184
|
-
case "PushIndent":
|
|
15185
|
-
case "PopIndent":
|
|
15186
|
-
case "Nested":
|
|
15187
|
-
case "InsertIndent":
|
|
15188
|
-
case "Arguments":
|
|
15189
|
-
case "ArgumentsWithTrailingCallExpressions":
|
|
15190
|
-
case "ApplicationStart":
|
|
15191
|
-
case "CallExpression":
|
|
15192
|
-
case "CallExpressionRest":
|
|
15193
|
-
case "LeftHandSideExpression":
|
|
15194
|
-
case "ActualAssignment":
|
|
15195
|
-
case "UpdateExpression":
|
|
15196
|
-
case "UnaryExpression":
|
|
15197
|
-
case "BinaryOpExpression":
|
|
15198
|
-
case "BinaryOpRHS":
|
|
15199
|
-
case "ConditionalExpression":
|
|
15200
|
-
case "ShortCircuitExpression":
|
|
15201
|
-
case "ImplicitNestedBlock":
|
|
15202
|
-
case "ObjectLiteral":
|
|
15203
|
-
case "NestedObject":
|
|
15204
|
-
case "NestedImplicitObjectLiteral":
|
|
15205
|
-
case "BracedObjectLiteralContent":
|
|
15206
|
-
case "NestedPropertyDefinitions":
|
|
15207
|
-
case "NestedImplicitPropertyDefinition":
|
|
15208
|
-
case "NestedImplicitPropertyDefinitions":
|
|
15209
|
-
case "NestedBlockStatement":
|
|
15210
|
-
case "NestedElement":
|
|
15211
|
-
case "NestedElementList":
|
|
15212
|
-
case "NestedBindingElement":
|
|
15213
|
-
case "NestedBindingElements":
|
|
15214
|
-
case "NestedInterfaceProperty":
|
|
15215
|
-
case "MemberExpression":
|
|
15216
|
-
case "PrimaryExpression":
|
|
15217
|
-
case "IndentedApplicationAllowed":
|
|
15218
|
-
case "ExpressionWithIndentedApplicationSuppressed":
|
|
15219
|
-
case "SuppressIndentedApplication":
|
|
15220
|
-
case "AssignmentExpressionTail":
|
|
15221
|
-
case "AssignmentExpression":
|
|
15222
|
-
case "ExtendedExpression":
|
|
15223
|
-
case "Expression":
|
|
15224
|
-
case "MemberExpressionRest":
|
|
15225
|
-
case "ElseClause":
|
|
15226
|
-
case "CoffeeCommentEnabled":
|
|
15227
|
-
case "SingleLineComment":
|
|
15228
|
-
case "Debugger":
|
|
15229
|
-
case "JSXElement":
|
|
15230
|
-
case "TypedJSXElement":
|
|
15231
|
-
case "JSXFragment":
|
|
15232
|
-
case "TypedJSXFragment":
|
|
15233
|
-
case "JSXChild":
|
|
15234
|
-
case "JSXChildren":
|
|
15235
|
-
case "JSXNestedChildren":
|
|
15236
|
-
case "JSXMixedChildren":
|
|
15237
|
-
break;
|
|
15238
|
-
default:
|
|
15239
|
-
cache = /* @__PURE__ */ new Map();
|
|
15240
|
-
caches.set(ruleName, cache);
|
|
15241
|
-
}
|
|
15289
|
+
if (!cache && !uncacheable.has(ruleName)) {
|
|
15290
|
+
cache = /* @__PURE__ */ new Map();
|
|
15291
|
+
caches.set(ruleName, cache);
|
|
15242
15292
|
}
|
|
15243
15293
|
if (cache) {
|
|
15244
15294
|
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) {
|
|
@@ -861,6 +779,7 @@ ${input.slice(result.pos)}
|
|
|
861
779
|
JSXIdentifierName,
|
|
862
780
|
JSXAttributes,
|
|
863
781
|
JSXAttribute,
|
|
782
|
+
JSXShorthandString,
|
|
864
783
|
JSXAttributeName,
|
|
865
784
|
JSXAttributeInitializer,
|
|
866
785
|
JSXAttributeValue,
|
|
@@ -1180,14 +1099,15 @@ ${input.slice(result.pos)}
|
|
|
1180
1099
|
var $R43 = $R(new RegExp("(?!\\p{ID_Continue})", "suy"));
|
|
1181
1100
|
var $R44 = $R(new RegExp("\\s", "suy"));
|
|
1182
1101
|
var $R45 = $R(new RegExp("(?:\\p{ID_Start}|[_$])(?:\\p{ID_Continue}|[\\u200C\\u200D$-])*", "suy"));
|
|
1183
|
-
var $R46 = $R(new RegExp("[^
|
|
1184
|
-
var $R47 = $R(new RegExp("[
|
|
1185
|
-
var $R48 = $R(new RegExp("
|
|
1186
|
-
var $R49 = $R(new RegExp("[\\
|
|
1187
|
-
var $R50 = $R(new RegExp("[\\
|
|
1188
|
-
var $R51 = $R(new RegExp("
|
|
1189
|
-
var $R52 = $R(new RegExp("\\
|
|
1190
|
-
var $R53 = $R(new RegExp("
|
|
1102
|
+
var $R46 = $R(new RegExp("(?:[\\w\\-:]+|\\([^()]*\\)|\\[[^\\[\\]]*\\])+", "suy"));
|
|
1103
|
+
var $R47 = $R(new RegExp("[^{}<>\\r\\n]+", "suy"));
|
|
1104
|
+
var $R48 = $R(new RegExp("[+-]?", "suy"));
|
|
1105
|
+
var $R49 = $R(new RegExp("#![^\\r\\n]*", "suy"));
|
|
1106
|
+
var $R50 = $R(new RegExp("[\\t ]*", "suy"));
|
|
1107
|
+
var $R51 = $R(new RegExp("[\\s]*", "suy"));
|
|
1108
|
+
var $R52 = $R(new RegExp("\\s+([+-]?)([a-zA-Z0-9-]+)(\\s*=\\s*([a-zA-Z0-9.+-]*))?", "suy"));
|
|
1109
|
+
var $R53 = $R(new RegExp("\\r\\n|\\n|\\r|$", "suy"));
|
|
1110
|
+
var $R54 = $R(new RegExp("[ \\t]*", "suy"));
|
|
1191
1111
|
var Program$0 = $TS($S(Reset, Init, __, $Q(TopLevelStatement), __), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
1192
1112
|
var statements = $4;
|
|
1193
1113
|
module2.processProgram(statements);
|
|
@@ -10988,7 +10908,7 @@ ${input.slice(result.pos)}
|
|
|
10988
10908
|
}
|
|
10989
10909
|
}
|
|
10990
10910
|
var JSXElement$0 = JSXSelfClosingElement;
|
|
10991
|
-
var JSXElement$1 = $TS($S(JSXOpeningElement, $E(JSXChildren),
|
|
10911
|
+
var JSXElement$1 = $TS($S(JSXOpeningElement, $E(JSXChildren), $E(Whitespace), JSXClosingElement), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
10992
10912
|
if ($1[1] !== $4[2])
|
|
10993
10913
|
return $skip;
|
|
10994
10914
|
return { type: "JSXElement", children: $0 };
|
|
@@ -11001,8 +10921,9 @@ ${input.slice(result.pos)}
|
|
|
11001
10921
|
children: children.jsxChildren.length ? [...$0, ["</", open[1], ">"]] : [open.slice(0, -1), " />"]
|
|
11002
10922
|
};
|
|
11003
10923
|
});
|
|
11004
|
-
var JSXElement$3 = $
|
|
11005
|
-
|
|
10924
|
+
var JSXElement$3 = $TV(JSXOpeningElement, function($skip, $loc, $0, $1) {
|
|
10925
|
+
var elt = $0;
|
|
10926
|
+
throw new Error(`could not parse JSX element "${elt[0]}${elt[1]}${elt[elt.length - 1]}" at pos ${$loc.pos}`);
|
|
11006
10927
|
});
|
|
11007
10928
|
function JSXElement(state) {
|
|
11008
10929
|
if (state.events) {
|
|
@@ -11022,7 +10943,7 @@ ${input.slice(result.pos)}
|
|
|
11022
10943
|
return result;
|
|
11023
10944
|
}
|
|
11024
10945
|
}
|
|
11025
|
-
var JSXSelfClosingElement$0 = $TS($S($EXPECT($L5, fail, 'JSXSelfClosingElement "<"'), $TEXT(JSXElementName), $E(CompactTypeArguments), $E(JSXAttributes),
|
|
10946
|
+
var JSXSelfClosingElement$0 = $TS($S($EXPECT($L5, fail, 'JSXSelfClosingElement "<"'), $TEXT(JSXElementName), $E(CompactTypeArguments), $E(JSXAttributes), $E(Whitespace), $EXPECT($L153, fail, 'JSXSelfClosingElement "/>"')), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
|
|
11026
10947
|
return { type: "JSXElement", children: $0 };
|
|
11027
10948
|
});
|
|
11028
10949
|
function JSXSelfClosingElement(state) {
|
|
@@ -11043,7 +10964,7 @@ ${input.slice(result.pos)}
|
|
|
11043
10964
|
return result;
|
|
11044
10965
|
}
|
|
11045
10966
|
}
|
|
11046
|
-
var JSXOpeningElement$0 = $S($EXPECT($L5, fail, 'JSXOpeningElement "<"'), $TEXT(JSXElementName), $E(CompactTypeArguments), $E(JSXAttributes),
|
|
10967
|
+
var JSXOpeningElement$0 = $S($EXPECT($L5, fail, 'JSXOpeningElement "<"'), $TEXT(JSXElementName), $E(CompactTypeArguments), $E(JSXAttributes), $E(Whitespace), $EXPECT($L27, fail, 'JSXOpeningElement ">"'));
|
|
11047
10968
|
function JSXOpeningElement(state) {
|
|
11048
10969
|
if (state.events) {
|
|
11049
10970
|
const result = state.events.enter?.("JSXOpeningElement", state);
|
|
@@ -11062,7 +10983,7 @@ ${input.slice(result.pos)}
|
|
|
11062
10983
|
return result;
|
|
11063
10984
|
}
|
|
11064
10985
|
}
|
|
11065
|
-
var JSXClosingElement$0 = $S($EXPECT($L154, fail, 'JSXClosingElement "</"'),
|
|
10986
|
+
var JSXClosingElement$0 = $S($EXPECT($L154, fail, 'JSXClosingElement "</"'), $E(Whitespace), $TEXT(JSXElementName), $E(Whitespace), $EXPECT($L27, fail, 'JSXClosingElement ">"'));
|
|
11066
10987
|
function JSXClosingElement(state) {
|
|
11067
10988
|
if (state.events) {
|
|
11068
10989
|
const result = state.events.enter?.("JSXClosingElement", state);
|
|
@@ -11107,7 +11028,7 @@ ${input.slice(result.pos)}
|
|
|
11107
11028
|
return result;
|
|
11108
11029
|
}
|
|
11109
11030
|
}
|
|
11110
|
-
var JSXFragment$0 = $TS($S($EXPECT($L155, fail, 'JSXFragment "<>"'), $E(JSXChildren),
|
|
11031
|
+
var JSXFragment$0 = $TS($S($EXPECT($L155, fail, 'JSXFragment "<>"'), $E(JSXChildren), $E(Whitespace), $EXPECT($L156, fail, 'JSXFragment "</>"')), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
11111
11032
|
if ($2) {
|
|
11112
11033
|
return { type: "JSXFragment", children: $0, jsxChildren: $2.jsxChildren };
|
|
11113
11034
|
} else {
|
|
@@ -11173,7 +11094,62 @@ ${input.slice(result.pos)}
|
|
|
11173
11094
|
return result;
|
|
11174
11095
|
}
|
|
11175
11096
|
}
|
|
11176
|
-
var JSXAttributes$0 = $Q($S(
|
|
11097
|
+
var JSXAttributes$0 = $TV($Q($S($E(Whitespace), JSXAttribute)), function($skip, $loc, $0, $1) {
|
|
11098
|
+
const classes = [];
|
|
11099
|
+
let attrs = $0.filter((pair) => {
|
|
11100
|
+
const [, attr] = pair;
|
|
11101
|
+
if (attr.type === "JSXClass") {
|
|
11102
|
+
classes.push(attr.class);
|
|
11103
|
+
return false;
|
|
11104
|
+
}
|
|
11105
|
+
return true;
|
|
11106
|
+
});
|
|
11107
|
+
if (classes.length) {
|
|
11108
|
+
let braced = function(c) {
|
|
11109
|
+
return c[0] === "{" || c[0]?.token === "{";
|
|
11110
|
+
}, parseClass = function(c) {
|
|
11111
|
+
c = c.token || c;
|
|
11112
|
+
if (c.startsWith("'")) {
|
|
11113
|
+
c = '"' + c.slice(1, -1).replace(/\\*"/g, (m) => m.length % 2 == 0 ? m : "\\" + m) + '"';
|
|
11114
|
+
}
|
|
11115
|
+
return JSON.parse(c);
|
|
11116
|
+
};
|
|
11117
|
+
let className = module2.config.react ? "className" : "class";
|
|
11118
|
+
attrs = attrs.filter((pair) => {
|
|
11119
|
+
const [, attr] = pair;
|
|
11120
|
+
if ((attr[0][0] === "class" || attr[0][0] === "className") && !attr[0][1]) {
|
|
11121
|
+
className = attr[0][0];
|
|
11122
|
+
classes.push(attr[1][attr[1].length - 1]);
|
|
11123
|
+
return false;
|
|
11124
|
+
}
|
|
11125
|
+
return true;
|
|
11126
|
+
});
|
|
11127
|
+
let classValue;
|
|
11128
|
+
if (classes.some(braced)) {
|
|
11129
|
+
classValue = ["{`"];
|
|
11130
|
+
classes.forEach((c, i) => {
|
|
11131
|
+
if (i > 0)
|
|
11132
|
+
classValue.push(" ");
|
|
11133
|
+
if (braced(c)) {
|
|
11134
|
+
classValue.push("$", c);
|
|
11135
|
+
} else {
|
|
11136
|
+
classValue.push(parseClass(c));
|
|
11137
|
+
}
|
|
11138
|
+
});
|
|
11139
|
+
classValue.push("`}");
|
|
11140
|
+
} else {
|
|
11141
|
+
classValue = JSON.stringify(classes.map(parseClass).join(" "));
|
|
11142
|
+
}
|
|
11143
|
+
attrs.splice(0, 0, [" ", [className, ["=", classValue]]]);
|
|
11144
|
+
}
|
|
11145
|
+
return attrs.map((pair) => {
|
|
11146
|
+
const [space, attr] = pair;
|
|
11147
|
+
if (space && attr[0] === " ") {
|
|
11148
|
+
pair = [space, attr.slice(1)];
|
|
11149
|
+
}
|
|
11150
|
+
return pair;
|
|
11151
|
+
});
|
|
11152
|
+
});
|
|
11177
11153
|
function JSXAttributes(state) {
|
|
11178
11154
|
if (state.events) {
|
|
11179
11155
|
const result = state.events.enter?.("JSXAttributes", state);
|
|
@@ -11248,6 +11224,15 @@ ${input.slice(result.pos)}
|
|
|
11248
11224
|
}
|
|
11249
11225
|
});
|
|
11250
11226
|
var JSXAttribute$2 = $S(InsertInlineOpenBrace, DotDotDot, InlineJSXAttributeValue, InsertCloseBrace);
|
|
11227
|
+
var JSXAttribute$3 = $TS($S($EXPECT($L8, fail, 'JSXAttribute "#"'), JSXShorthandString), function($skip, $loc, $0, $1, $2) {
|
|
11228
|
+
return [" ", "id=", $2];
|
|
11229
|
+
});
|
|
11230
|
+
var JSXAttribute$4 = $TS($S(Dot, JSXShorthandString), function($skip, $loc, $0, $1, $2) {
|
|
11231
|
+
return {
|
|
11232
|
+
type: "JSXClass",
|
|
11233
|
+
class: $2
|
|
11234
|
+
};
|
|
11235
|
+
});
|
|
11251
11236
|
function JSXAttribute(state) {
|
|
11252
11237
|
if (state.events) {
|
|
11253
11238
|
const result = state.events.enter?.("JSXAttribute", state);
|
|
@@ -11255,17 +11240,49 @@ ${input.slice(result.pos)}
|
|
|
11255
11240
|
return result.cache;
|
|
11256
11241
|
}
|
|
11257
11242
|
if (state.tokenize) {
|
|
11258
|
-
const result = $TOKEN("JSXAttribute", state, JSXAttribute$0(state) || JSXAttribute$1(state) || JSXAttribute$2(state));
|
|
11243
|
+
const result = $TOKEN("JSXAttribute", state, JSXAttribute$0(state) || JSXAttribute$1(state) || JSXAttribute$2(state) || JSXAttribute$3(state) || JSXAttribute$4(state));
|
|
11259
11244
|
if (state.events)
|
|
11260
11245
|
state.events.exit?.("JSXAttribute", state, result);
|
|
11261
11246
|
return result;
|
|
11262
11247
|
} else {
|
|
11263
|
-
const result = JSXAttribute$0(state) || JSXAttribute$1(state) || JSXAttribute$2(state);
|
|
11248
|
+
const result = JSXAttribute$0(state) || JSXAttribute$1(state) || JSXAttribute$2(state) || JSXAttribute$3(state) || JSXAttribute$4(state);
|
|
11264
11249
|
if (state.events)
|
|
11265
11250
|
state.events.exit?.("JSXAttribute", state, result);
|
|
11266
11251
|
return result;
|
|
11267
11252
|
}
|
|
11268
11253
|
}
|
|
11254
|
+
var JSXShorthandString$0 = $TR($EXPECT($R46, fail, "JSXShorthandString /(?:[\\w\\-:]+|\\([^()]*\\)|\\[[^\\[\\]]*\\])+/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
|
|
11255
|
+
return module2.quoteString($0);
|
|
11256
|
+
});
|
|
11257
|
+
var JSXShorthandString$1 = $TS($S(StringLiteral), function($skip, $loc, $0, $1) {
|
|
11258
|
+
if (module2.isTemplateLiteral($1)) {
|
|
11259
|
+
return ["{", $1, "}"];
|
|
11260
|
+
} else {
|
|
11261
|
+
return $1;
|
|
11262
|
+
}
|
|
11263
|
+
});
|
|
11264
|
+
var JSXShorthandString$2 = $TS($S(TemplateLiteral), function($skip, $loc, $0, $1) {
|
|
11265
|
+
return ["{", $1, "}"];
|
|
11266
|
+
});
|
|
11267
|
+
var JSXShorthandString$3 = $S(OpenBrace, ExtendedExpression, $E(Whitespace), CloseBrace);
|
|
11268
|
+
function JSXShorthandString(state) {
|
|
11269
|
+
if (state.events) {
|
|
11270
|
+
const result = state.events.enter?.("JSXShorthandString", state);
|
|
11271
|
+
if (result)
|
|
11272
|
+
return result.cache;
|
|
11273
|
+
}
|
|
11274
|
+
if (state.tokenize) {
|
|
11275
|
+
const result = $TOKEN("JSXShorthandString", state, JSXShorthandString$0(state) || JSXShorthandString$1(state) || JSXShorthandString$2(state) || JSXShorthandString$3(state));
|
|
11276
|
+
if (state.events)
|
|
11277
|
+
state.events.exit?.("JSXShorthandString", state, result);
|
|
11278
|
+
return result;
|
|
11279
|
+
} else {
|
|
11280
|
+
const result = JSXShorthandString$0(state) || JSXShorthandString$1(state) || JSXShorthandString$2(state) || JSXShorthandString$3(state);
|
|
11281
|
+
if (state.events)
|
|
11282
|
+
state.events.exit?.("JSXShorthandString", state, result);
|
|
11283
|
+
return result;
|
|
11284
|
+
}
|
|
11285
|
+
}
|
|
11269
11286
|
var JSXAttributeName$0 = $S(JSXIdentifierName, $E($S(Colon, JSXIdentifierName)));
|
|
11270
11287
|
var JSXAttributeName$1 = ComputedPropertyName;
|
|
11271
11288
|
function JSXAttributeName(state) {
|
|
@@ -11286,7 +11303,7 @@ ${input.slice(result.pos)}
|
|
|
11286
11303
|
return result;
|
|
11287
11304
|
}
|
|
11288
11305
|
}
|
|
11289
|
-
var JSXAttributeInitializer$0 = $S(
|
|
11306
|
+
var JSXAttributeInitializer$0 = $S($E(Whitespace), Equals, $E(Whitespace), JSXAttributeValue);
|
|
11290
11307
|
function JSXAttributeInitializer(state) {
|
|
11291
11308
|
if (state.events) {
|
|
11292
11309
|
const result = state.events.enter?.("JSXAttributeInitializer", state);
|
|
@@ -11310,7 +11327,7 @@ ${input.slice(result.pos)}
|
|
|
11310
11327
|
return $skip;
|
|
11311
11328
|
return $1;
|
|
11312
11329
|
});
|
|
11313
|
-
var JSXAttributeValue$1 = $S(OpenBrace, ExtendedExpression,
|
|
11330
|
+
var JSXAttributeValue$1 = $S(OpenBrace, ExtendedExpression, $E(Whitespace), CloseBrace);
|
|
11314
11331
|
var JSXAttributeValue$2 = JSXElement;
|
|
11315
11332
|
var JSXAttributeValue$3 = JSXFragment;
|
|
11316
11333
|
var JSXAttributeValue$4 = $S(InsertInlineOpenBrace, InlineJSXAttributeValue, InsertCloseBrace);
|
|
@@ -11652,7 +11669,7 @@ ${input.slice(result.pos)}
|
|
|
11652
11669
|
}
|
|
11653
11670
|
return $skip;
|
|
11654
11671
|
});
|
|
11655
|
-
var JSXNestedChildren$1 = $TV($Y(EOS), function($skip, $loc, $0, $1) {
|
|
11672
|
+
var JSXNestedChildren$1 = $TV($Y($C(EOS, $EXPECT($L17, fail, 'JSXNestedChildren "}"'))), function($skip, $loc, $0, $1) {
|
|
11656
11673
|
return { children: [], jsxChildren: [] };
|
|
11657
11674
|
});
|
|
11658
11675
|
function JSXNestedChildren(state) {
|
|
@@ -11710,7 +11727,7 @@ ${input.slice(result.pos)}
|
|
|
11710
11727
|
return result;
|
|
11711
11728
|
}
|
|
11712
11729
|
}
|
|
11713
|
-
var JSXText$0 = $TR($EXPECT($
|
|
11730
|
+
var JSXText$0 = $TR($EXPECT($R47, fail, "JSXText /[^{}<>\\r\\n]+/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
|
|
11714
11731
|
return {
|
|
11715
11732
|
type: "JSXText",
|
|
11716
11733
|
token: $0,
|
|
@@ -11735,7 +11752,7 @@ ${input.slice(result.pos)}
|
|
|
11735
11752
|
return result;
|
|
11736
11753
|
}
|
|
11737
11754
|
}
|
|
11738
|
-
var JSXChildExpression$0 = $S(
|
|
11755
|
+
var JSXChildExpression$0 = $S($E(Whitespace), $E($S(DotDotDot, $E(Whitespace))), ExtendedExpression);
|
|
11739
11756
|
function JSXChildExpression(state) {
|
|
11740
11757
|
if (state.events) {
|
|
11741
11758
|
const result = state.events.enter?.("JSXChildExpression", state);
|
|
@@ -12044,7 +12061,7 @@ ${input.slice(result.pos)}
|
|
|
12044
12061
|
return result;
|
|
12045
12062
|
}
|
|
12046
12063
|
}
|
|
12047
|
-
var TypeIndexSignature$0 = $S($E($S($R$0($EXPECT($
|
|
12064
|
+
var TypeIndexSignature$0 = $S($E($S($R$0($EXPECT($R48, fail, "TypeIndexSignature /[+-]?/")), $EXPECT($L129, fail, 'TypeIndexSignature "readonly"'), __)), OpenBracket, TypeIndex, CloseBracket, $E($S(__, $R$0($EXPECT($R4, fail, "TypeIndexSignature /[+-]/")), QuestionMark)));
|
|
12048
12065
|
function TypeIndexSignature(state) {
|
|
12049
12066
|
if (state.events) {
|
|
12050
12067
|
const result = state.events.enter?.("TypeIndexSignature", state);
|
|
@@ -12646,7 +12663,7 @@ ${input.slice(result.pos)}
|
|
|
12646
12663
|
return result;
|
|
12647
12664
|
}
|
|
12648
12665
|
}
|
|
12649
|
-
var Shebang$0 = $S($R$0($EXPECT($
|
|
12666
|
+
var Shebang$0 = $S($R$0($EXPECT($R49, fail, "Shebang /#![^\\r\\n]*/")), EOL);
|
|
12650
12667
|
function Shebang(state) {
|
|
12651
12668
|
if (state.events) {
|
|
12652
12669
|
const result = state.events.enter?.("Shebang", state);
|
|
@@ -12665,11 +12682,11 @@ ${input.slice(result.pos)}
|
|
|
12665
12682
|
return result;
|
|
12666
12683
|
}
|
|
12667
12684
|
}
|
|
12668
|
-
var CivetPrologue$0 = $T($S($EXPECT($
|
|
12685
|
+
var CivetPrologue$0 = $T($S($EXPECT($R50, fail, "CivetPrologue /[\\t ]*/"), DoubleQuote, CivetPrologueContent, DoubleQuote, $TEXT(StatementDelimiter), EOS), function(value) {
|
|
12669
12686
|
var content = value[2];
|
|
12670
12687
|
return content;
|
|
12671
12688
|
});
|
|
12672
|
-
var CivetPrologue$1 = $T($S($EXPECT($
|
|
12689
|
+
var CivetPrologue$1 = $T($S($EXPECT($R50, fail, "CivetPrologue /[\\t ]*/"), SingleQuote, CivetPrologueContent, SingleQuote, $TEXT(StatementDelimiter), EOS), function(value) {
|
|
12673
12690
|
var content = value[2];
|
|
12674
12691
|
return content;
|
|
12675
12692
|
});
|
|
@@ -12691,7 +12708,7 @@ ${input.slice(result.pos)}
|
|
|
12691
12708
|
return result;
|
|
12692
12709
|
}
|
|
12693
12710
|
}
|
|
12694
|
-
var CivetPrologueContent$0 = $TS($S($EXPECT($L165, fail, 'CivetPrologueContent "civet"'), $Q(CivetOption), $EXPECT($
|
|
12711
|
+
var CivetPrologueContent$0 = $TS($S($EXPECT($L165, fail, 'CivetPrologueContent "civet"'), $Q(CivetOption), $EXPECT($R51, fail, "CivetPrologueContent /[\\s]*/")), function($skip, $loc, $0, $1, $2, $3) {
|
|
12695
12712
|
var options = $2;
|
|
12696
12713
|
return {
|
|
12697
12714
|
type: "CivetPrologue",
|
|
@@ -12717,7 +12734,7 @@ ${input.slice(result.pos)}
|
|
|
12717
12734
|
return result;
|
|
12718
12735
|
}
|
|
12719
12736
|
}
|
|
12720
|
-
var CivetOption$0 = $TR($EXPECT($
|
|
12737
|
+
var CivetOption$0 = $TR($EXPECT($R52, fail, "CivetOption /\\s+([+-]?)([a-zA-Z0-9-]+)(\\s*=\\s*([a-zA-Z0-9.+-]*))?/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
|
|
12721
12738
|
const optionName = $2.replace(/-+([a-z]?)/g, (_2, l) => {
|
|
12722
12739
|
if (l)
|
|
12723
12740
|
return l.toUpperCase();
|
|
@@ -12749,7 +12766,7 @@ ${input.slice(result.pos)}
|
|
|
12749
12766
|
return result;
|
|
12750
12767
|
}
|
|
12751
12768
|
}
|
|
12752
|
-
var UnknownPrologue$0 = $S($R$0($EXPECT($
|
|
12769
|
+
var UnknownPrologue$0 = $S($R$0($EXPECT($R50, fail, "UnknownPrologue /[\\t ]*/")), BasicStringLiteral, $TEXT(StatementDelimiter), EOS);
|
|
12753
12770
|
function UnknownPrologue(state) {
|
|
12754
12771
|
if (state.events) {
|
|
12755
12772
|
const result = state.events.enter?.("UnknownPrologue", state);
|
|
@@ -12807,7 +12824,7 @@ ${input.slice(result.pos)}
|
|
|
12807
12824
|
return result;
|
|
12808
12825
|
}
|
|
12809
12826
|
}
|
|
12810
|
-
var EOL$0 = $TR($EXPECT($
|
|
12827
|
+
var EOL$0 = $TR($EXPECT($R53, fail, "EOL /\\r\\n|\\n|\\r|$/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
|
|
12811
12828
|
return { $loc, token: $0 };
|
|
12812
12829
|
});
|
|
12813
12830
|
function EOL(state) {
|
|
@@ -13448,6 +13465,7 @@ ${input.slice(result.pos)}
|
|
|
13448
13465
|
coffeeNot: false,
|
|
13449
13466
|
coffeeOf: false,
|
|
13450
13467
|
implicitReturns: true,
|
|
13468
|
+
react: false,
|
|
13451
13469
|
solid: false,
|
|
13452
13470
|
client: false,
|
|
13453
13471
|
server: false,
|
|
@@ -13605,6 +13623,14 @@ ${input.slice(result.pos)}
|
|
|
13605
13623
|
module2.modifyString = function(str) {
|
|
13606
13624
|
return str.replace(/(^.?|[^\\]{2})(\\\\)*\n/g, "$1$2\\n");
|
|
13607
13625
|
};
|
|
13626
|
+
module2.quoteString = function(str) {
|
|
13627
|
+
str = str.replace(/\\/g, "\\\\");
|
|
13628
|
+
if (str.includes('"') && !str.includes("'")) {
|
|
13629
|
+
return "'" + str.replace(/'/g, "\\'") + "'";
|
|
13630
|
+
} else {
|
|
13631
|
+
return '"' + str.replace(/"/g, '\\"') + '"';
|
|
13632
|
+
}
|
|
13633
|
+
};
|
|
13608
13634
|
});
|
|
13609
13635
|
function Reset(state) {
|
|
13610
13636
|
if (state.events) {
|
|
@@ -14583,7 +14609,7 @@ ${input.slice(result.pos)}
|
|
|
14583
14609
|
return result;
|
|
14584
14610
|
}
|
|
14585
14611
|
}
|
|
14586
|
-
var Indent$0 = $TR($EXPECT($
|
|
14612
|
+
var Indent$0 = $TR($EXPECT($R54, fail, "Indent /[ \\t]*/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
|
|
14587
14613
|
let level;
|
|
14588
14614
|
if (module2.config.tab) {
|
|
14589
14615
|
const tabs = $0.match(/\t/g);
|
|
@@ -14781,6 +14807,88 @@ ${input.slice(result.pos)}
|
|
|
14781
14807
|
}
|
|
14782
14808
|
});
|
|
14783
14809
|
|
|
14810
|
+
// source/generate.coffee
|
|
14811
|
+
var require_generate = __commonJS({
|
|
14812
|
+
"source/generate.coffee"(exports2, module2) {
|
|
14813
|
+
"civet coffeeCompat";
|
|
14814
|
+
var gen2;
|
|
14815
|
+
var prune2;
|
|
14816
|
+
gen2 = function(node, options) {
|
|
14817
|
+
var $loc, token;
|
|
14818
|
+
if (node === null || node === void 0) {
|
|
14819
|
+
return "";
|
|
14820
|
+
}
|
|
14821
|
+
if (typeof node === "string") {
|
|
14822
|
+
if (options != null) {
|
|
14823
|
+
if (typeof options.updateSourceMap === "function") {
|
|
14824
|
+
options.updateSourceMap(node);
|
|
14825
|
+
}
|
|
14826
|
+
}
|
|
14827
|
+
return node;
|
|
14828
|
+
}
|
|
14829
|
+
if (Array.isArray(node)) {
|
|
14830
|
+
return node.map(function(child) {
|
|
14831
|
+
return gen2(child, options);
|
|
14832
|
+
}).join("");
|
|
14833
|
+
}
|
|
14834
|
+
if (typeof node === "object") {
|
|
14835
|
+
if (options.js && node.ts) {
|
|
14836
|
+
return "";
|
|
14837
|
+
}
|
|
14838
|
+
if (!options.js && node.js) {
|
|
14839
|
+
return "";
|
|
14840
|
+
}
|
|
14841
|
+
if (node.$loc != null) {
|
|
14842
|
+
({ token, $loc } = node);
|
|
14843
|
+
if (options != null) {
|
|
14844
|
+
if (typeof options.updateSourceMap === "function") {
|
|
14845
|
+
options.updateSourceMap(token, $loc.pos);
|
|
14846
|
+
}
|
|
14847
|
+
}
|
|
14848
|
+
return token;
|
|
14849
|
+
}
|
|
14850
|
+
if (!node.children) {
|
|
14851
|
+
debugger;
|
|
14852
|
+
throw new Error("Unknown node", JSON.stringify(node));
|
|
14853
|
+
}
|
|
14854
|
+
return gen2(node.children, options);
|
|
14855
|
+
}
|
|
14856
|
+
debugger;
|
|
14857
|
+
throw new Error("Unknown node", JSON.stringify(node));
|
|
14858
|
+
};
|
|
14859
|
+
module2.exports = gen2;
|
|
14860
|
+
prune2 = function(node) {
|
|
14861
|
+
var a;
|
|
14862
|
+
if (node === null || node === void 0) {
|
|
14863
|
+
return;
|
|
14864
|
+
}
|
|
14865
|
+
if (node.length === 0) {
|
|
14866
|
+
return;
|
|
14867
|
+
}
|
|
14868
|
+
if (Array.isArray(node)) {
|
|
14869
|
+
a = node.map(function(n) {
|
|
14870
|
+
return prune2(n);
|
|
14871
|
+
}).filter(function(n) {
|
|
14872
|
+
return !!n;
|
|
14873
|
+
});
|
|
14874
|
+
if (a.length > 1) {
|
|
14875
|
+
return a;
|
|
14876
|
+
}
|
|
14877
|
+
if (a.length === 1) {
|
|
14878
|
+
return a[0];
|
|
14879
|
+
}
|
|
14880
|
+
return;
|
|
14881
|
+
}
|
|
14882
|
+
if (node.children != null) {
|
|
14883
|
+
node.children = prune2(node.children) || [];
|
|
14884
|
+
return node;
|
|
14885
|
+
}
|
|
14886
|
+
return node;
|
|
14887
|
+
};
|
|
14888
|
+
gen2.prune = prune2;
|
|
14889
|
+
}
|
|
14890
|
+
});
|
|
14891
|
+
|
|
14784
14892
|
// source/util.coffee
|
|
14785
14893
|
var require_util = __commonJS({
|
|
14786
14894
|
"source/util.coffee"(exports2, module2) {
|
|
@@ -15116,11 +15224,13 @@ var gen;
|
|
|
15116
15224
|
var makeCache;
|
|
15117
15225
|
var parse;
|
|
15118
15226
|
var prune;
|
|
15227
|
+
var uncacheable;
|
|
15119
15228
|
var util;
|
|
15120
15229
|
({ parse } = require_parser());
|
|
15121
15230
|
({ prune } = gen = require_generate());
|
|
15122
15231
|
({ SourceMap, base64Encode } = util = require_util());
|
|
15123
15232
|
defaultOptions = {};
|
|
15233
|
+
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"]);
|
|
15124
15234
|
module.exports = {
|
|
15125
15235
|
parse,
|
|
15126
15236
|
compile: function(src, options = defaultOptions) {
|
|
@@ -15173,69 +15283,9 @@ makeCache = function() {
|
|
|
15173
15283
|
exit: function(ruleName, state, result) {
|
|
15174
15284
|
var cache;
|
|
15175
15285
|
cache = caches.get(ruleName);
|
|
15176
|
-
if (!cache) {
|
|
15177
|
-
|
|
15178
|
-
|
|
15179
|
-
case "Samedent":
|
|
15180
|
-
case "IndentedFurther":
|
|
15181
|
-
case "PushIndent":
|
|
15182
|
-
case "PopIndent":
|
|
15183
|
-
case "Nested":
|
|
15184
|
-
case "InsertIndent":
|
|
15185
|
-
case "Arguments":
|
|
15186
|
-
case "ArgumentsWithTrailingCallExpressions":
|
|
15187
|
-
case "ApplicationStart":
|
|
15188
|
-
case "CallExpression":
|
|
15189
|
-
case "CallExpressionRest":
|
|
15190
|
-
case "LeftHandSideExpression":
|
|
15191
|
-
case "ActualAssignment":
|
|
15192
|
-
case "UpdateExpression":
|
|
15193
|
-
case "UnaryExpression":
|
|
15194
|
-
case "BinaryOpExpression":
|
|
15195
|
-
case "BinaryOpRHS":
|
|
15196
|
-
case "ConditionalExpression":
|
|
15197
|
-
case "ShortCircuitExpression":
|
|
15198
|
-
case "ImplicitNestedBlock":
|
|
15199
|
-
case "ObjectLiteral":
|
|
15200
|
-
case "NestedObject":
|
|
15201
|
-
case "NestedImplicitObjectLiteral":
|
|
15202
|
-
case "BracedObjectLiteralContent":
|
|
15203
|
-
case "NestedPropertyDefinitions":
|
|
15204
|
-
case "NestedImplicitPropertyDefinition":
|
|
15205
|
-
case "NestedImplicitPropertyDefinitions":
|
|
15206
|
-
case "NestedBlockStatement":
|
|
15207
|
-
case "NestedElement":
|
|
15208
|
-
case "NestedElementList":
|
|
15209
|
-
case "NestedBindingElement":
|
|
15210
|
-
case "NestedBindingElements":
|
|
15211
|
-
case "NestedInterfaceProperty":
|
|
15212
|
-
case "MemberExpression":
|
|
15213
|
-
case "PrimaryExpression":
|
|
15214
|
-
case "IndentedApplicationAllowed":
|
|
15215
|
-
case "ExpressionWithIndentedApplicationSuppressed":
|
|
15216
|
-
case "SuppressIndentedApplication":
|
|
15217
|
-
case "AssignmentExpressionTail":
|
|
15218
|
-
case "AssignmentExpression":
|
|
15219
|
-
case "ExtendedExpression":
|
|
15220
|
-
case "Expression":
|
|
15221
|
-
case "MemberExpressionRest":
|
|
15222
|
-
case "ElseClause":
|
|
15223
|
-
case "CoffeeCommentEnabled":
|
|
15224
|
-
case "SingleLineComment":
|
|
15225
|
-
case "Debugger":
|
|
15226
|
-
case "JSXElement":
|
|
15227
|
-
case "TypedJSXElement":
|
|
15228
|
-
case "JSXFragment":
|
|
15229
|
-
case "TypedJSXFragment":
|
|
15230
|
-
case "JSXChild":
|
|
15231
|
-
case "JSXChildren":
|
|
15232
|
-
case "JSXNestedChildren":
|
|
15233
|
-
case "JSXMixedChildren":
|
|
15234
|
-
break;
|
|
15235
|
-
default:
|
|
15236
|
-
cache = /* @__PURE__ */ new Map();
|
|
15237
|
-
caches.set(ruleName, cache);
|
|
15238
|
-
}
|
|
15286
|
+
if (!cache && !uncacheable.has(ruleName)) {
|
|
15287
|
+
cache = /* @__PURE__ */ new Map();
|
|
15288
|
+
caches.set(ruleName, cache);
|
|
15239
15289
|
}
|
|
15240
15290
|
if (cache) {
|
|
15241
15291
|
if (result) {
|