@danielx/civet 0.5.25 → 0.5.26
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 +92 -70
- package/dist/esbuild-plugin.js +17 -0
- package/dist/main.js +92 -70
- package/dist/main.mjs +92 -70
- package/package.json +3 -1
package/README.md
CHANGED
|
@@ -232,10 +232,13 @@ Things Added that CoffeeScript didn't
|
|
|
232
232
|
to specify how to use left-hand side
|
|
233
233
|
- `|> await`, `|> yield`, and `|> return` (at end)
|
|
234
234
|
for wrapping left-hand side with that operation
|
|
235
|
-
- Flagging shorthand [from LiveScript](https://livescript.net/#literals)
|
|
235
|
+
- Flagging shorthand based on [from LiveScript](https://livescript.net/#literals-objects):
|
|
236
|
+
`{+debug, -live, !verbose}` → `{debug: true, live: false, verbose: false}`
|
|
236
237
|
- JSX enhancements (inspired by [solid-dsl discussions](https://github.com/solidjs-community/solid-dsl/discussions)):
|
|
237
238
|
- Indentation: instead of explicitly closing `<tag>`s or `<>`s,
|
|
238
239
|
you can indent the children and Civet will close your tags for you
|
|
240
|
+
- Multiple adjacent elements and/or fragments get automatically
|
|
241
|
+
combined into a fragment.
|
|
239
242
|
- Arrow function children do not need to be wrapped in braces
|
|
240
243
|
(assuming they are not preceded by text); this is unambiguous because
|
|
241
244
|
`>` isn't valid JSX text. For example, `<For> (item) => ...`
|
|
@@ -245,6 +248,7 @@ Things Added that CoffeeScript didn't
|
|
|
245
248
|
- `.foo` shorthand for `class="foo"` (but must be at least one space after
|
|
246
249
|
tag name); also `.foo.bar`, `."foo bar"`, `` .`foo ${bar}` ``, `.{expr}`
|
|
247
250
|
- `"civet react"` flag uses `className` instead of `class`
|
|
251
|
+
- `+foo` shorthand for `foo={true}`, `-foo`/`!foo` shorthand for `foo={false}`
|
|
248
252
|
- Any braced object literal can be used as an attribute:
|
|
249
253
|
`{foo}` → `foo={foo}`, `{foo: bar}` → `foo={bar}`,
|
|
250
254
|
`{...foo}` remains as is; methods and getters/setters work too.
|
package/dist/browser.js
CHANGED
|
@@ -793,12 +793,12 @@ ${input.slice(result.pos)}
|
|
|
793
793
|
When,
|
|
794
794
|
While,
|
|
795
795
|
Yield,
|
|
796
|
-
|
|
796
|
+
JSXImplicitFragment,
|
|
797
|
+
JSXTag,
|
|
797
798
|
JSXElement,
|
|
798
799
|
JSXSelfClosingElement,
|
|
799
800
|
JSXOpeningElement,
|
|
800
801
|
JSXClosingElement,
|
|
801
|
-
TypedJSXFragment,
|
|
802
802
|
JSXFragment,
|
|
803
803
|
JSXElementName,
|
|
804
804
|
JSXIdentifierName,
|
|
@@ -1089,7 +1089,7 @@ ${input.slice(result.pos)}
|
|
|
1089
1089
|
var $R1 = $R(new RegExp("[&]", "suy"));
|
|
1090
1090
|
var $R2 = $R(new RegExp("[!~+-]+", "suy"));
|
|
1091
1091
|
var $R3 = $R(new RegExp("(?:\\p{ID_Start}|[_$])(?:\\p{ID_Continue}|[\\u200C\\u200D$])*", "suy"));
|
|
1092
|
-
var $R4 = $R(new RegExp("[
|
|
1092
|
+
var $R4 = $R(new RegExp("[!+-]", "suy"));
|
|
1093
1093
|
var $R5 = $R(new RegExp("<(?!\\p{ID_Start}|[_$])", "suy"));
|
|
1094
1094
|
var $R6 = $R(new RegExp("[!~+-](?!\\s|[!~+-]*&)", "suy"));
|
|
1095
1095
|
var $R7 = $R(new RegExp("(?=[\\s\\)])", "suy"));
|
|
@@ -1136,12 +1136,13 @@ ${input.slice(result.pos)}
|
|
|
1136
1136
|
var $R48 = $R(new RegExp("(?:-[^-]|[^-]*)*", "suy"));
|
|
1137
1137
|
var $R49 = $R(new RegExp("[^{}<>\\r\\n]+", "suy"));
|
|
1138
1138
|
var $R50 = $R(new RegExp("[+-]?", "suy"));
|
|
1139
|
-
var $R51 = $R(new RegExp("
|
|
1140
|
-
var $R52 = $R(new RegExp("[\\
|
|
1141
|
-
var $R53 = $R(new RegExp("[\\
|
|
1142
|
-
var $R54 = $R(new RegExp("
|
|
1143
|
-
var $R55 = $R(new RegExp("\\
|
|
1144
|
-
var $R56 = $R(new RegExp("
|
|
1139
|
+
var $R51 = $R(new RegExp("[+-]", "suy"));
|
|
1140
|
+
var $R52 = $R(new RegExp("#![^\\r\\n]*", "suy"));
|
|
1141
|
+
var $R53 = $R(new RegExp("[\\t ]*", "suy"));
|
|
1142
|
+
var $R54 = $R(new RegExp("[\\s]*", "suy"));
|
|
1143
|
+
var $R55 = $R(new RegExp("\\s+([+-]?)([a-zA-Z0-9-]+)(\\s*=\\s*([a-zA-Z0-9.+-]*))?", "suy"));
|
|
1144
|
+
var $R56 = $R(new RegExp("\\r\\n|\\n|\\r|$", "suy"));
|
|
1145
|
+
var $R57 = $R(new RegExp("[ \\t]*", "suy"));
|
|
1145
1146
|
var Program$0 = $TS($S(Reset, Init, __, $Q(TopLevelStatement), __), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
1146
1147
|
var statements = $4;
|
|
1147
1148
|
module.processProgram(statements);
|
|
@@ -2162,8 +2163,7 @@ ${input.slice(result.pos)}
|
|
|
2162
2163
|
var PrimaryExpression$7 = RegularExpressionLiteral;
|
|
2163
2164
|
var PrimaryExpression$8 = TemplateLiteral;
|
|
2164
2165
|
var PrimaryExpression$9 = ParenthesizedExpression;
|
|
2165
|
-
var PrimaryExpression$10 =
|
|
2166
|
-
var PrimaryExpression$11 = TypedJSXFragment;
|
|
2166
|
+
var PrimaryExpression$10 = JSXImplicitFragment;
|
|
2167
2167
|
function PrimaryExpression(state) {
|
|
2168
2168
|
if (state.events) {
|
|
2169
2169
|
const result = state.events.enter?.("PrimaryExpression", state);
|
|
@@ -2171,12 +2171,12 @@ ${input.slice(result.pos)}
|
|
|
2171
2171
|
return result.cache;
|
|
2172
2172
|
}
|
|
2173
2173
|
if (state.tokenize) {
|
|
2174
|
-
const result = $TOKEN("PrimaryExpression", state, PrimaryExpression$0(state) || PrimaryExpression$1(state) || PrimaryExpression$2(state) || PrimaryExpression$3(state) || PrimaryExpression$4(state) || PrimaryExpression$5(state) || PrimaryExpression$6(state) || PrimaryExpression$7(state) || PrimaryExpression$8(state) || PrimaryExpression$9(state) || PrimaryExpression$10(state)
|
|
2174
|
+
const result = $TOKEN("PrimaryExpression", state, PrimaryExpression$0(state) || PrimaryExpression$1(state) || PrimaryExpression$2(state) || PrimaryExpression$3(state) || PrimaryExpression$4(state) || PrimaryExpression$5(state) || PrimaryExpression$6(state) || PrimaryExpression$7(state) || PrimaryExpression$8(state) || PrimaryExpression$9(state) || PrimaryExpression$10(state));
|
|
2175
2175
|
if (state.events)
|
|
2176
2176
|
state.events.exit?.("PrimaryExpression", state, result);
|
|
2177
2177
|
return result;
|
|
2178
2178
|
} else {
|
|
2179
|
-
const result = PrimaryExpression$0(state) || PrimaryExpression$1(state) || PrimaryExpression$2(state) || PrimaryExpression$3(state) || PrimaryExpression$4(state) || PrimaryExpression$5(state) || PrimaryExpression$6(state) || PrimaryExpression$7(state) || PrimaryExpression$8(state) || PrimaryExpression$9(state) || PrimaryExpression$10(state)
|
|
2179
|
+
const result = PrimaryExpression$0(state) || PrimaryExpression$1(state) || PrimaryExpression$2(state) || PrimaryExpression$3(state) || PrimaryExpression$4(state) || PrimaryExpression$5(state) || PrimaryExpression$6(state) || PrimaryExpression$7(state) || PrimaryExpression$8(state) || PrimaryExpression$9(state) || PrimaryExpression$10(state);
|
|
2180
2180
|
if (state.events)
|
|
2181
2181
|
state.events.exit?.("PrimaryExpression", state, result);
|
|
2182
2182
|
return result;
|
|
@@ -4780,7 +4780,8 @@ ${input.slice(result.pos)}
|
|
|
4780
4780
|
return result;
|
|
4781
4781
|
}
|
|
4782
4782
|
}
|
|
4783
|
-
var ArrayElementExpression$0 =
|
|
4783
|
+
var ArrayElementExpression$0 = JSXTag;
|
|
4784
|
+
var ArrayElementExpression$1 = $TS($S($E(ExtendedExpression), __, DotDotDot, $Y(ArrayElementDelimiter)), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
4784
4785
|
var exp = $1;
|
|
4785
4786
|
var ws = $2;
|
|
4786
4787
|
var dots = $3;
|
|
@@ -4798,7 +4799,7 @@ ${input.slice(result.pos)}
|
|
|
4798
4799
|
names: exp.names
|
|
4799
4800
|
};
|
|
4800
4801
|
});
|
|
4801
|
-
var ArrayElementExpression$
|
|
4802
|
+
var ArrayElementExpression$2 = $TS($S($E($S($E($S(__, DotDotDot, __)), ExtendedExpression)), $Y(ArrayElementDelimiter)), function($skip, $loc, $0, $1, $2) {
|
|
4802
4803
|
var expMaybeSpread = $1;
|
|
4803
4804
|
if (expMaybeSpread) {
|
|
4804
4805
|
const [spread, exp] = expMaybeSpread;
|
|
@@ -4828,12 +4829,12 @@ ${input.slice(result.pos)}
|
|
|
4828
4829
|
return result.cache;
|
|
4829
4830
|
}
|
|
4830
4831
|
if (state.tokenize) {
|
|
4831
|
-
const result = $TOKEN("ArrayElementExpression", state, ArrayElementExpression$0(state) || ArrayElementExpression$1(state));
|
|
4832
|
+
const result = $TOKEN("ArrayElementExpression", state, ArrayElementExpression$0(state) || ArrayElementExpression$1(state) || ArrayElementExpression$2(state));
|
|
4832
4833
|
if (state.events)
|
|
4833
4834
|
state.events.exit?.("ArrayElementExpression", state, result);
|
|
4834
4835
|
return result;
|
|
4835
4836
|
} else {
|
|
4836
|
-
const result = ArrayElementExpression$0(state) || ArrayElementExpression$1(state);
|
|
4837
|
+
const result = ArrayElementExpression$0(state) || ArrayElementExpression$1(state) || ArrayElementExpression$2(state);
|
|
4837
4838
|
if (state.events)
|
|
4838
4839
|
state.events.exit?.("ArrayElementExpression", state, result);
|
|
4839
4840
|
return result;
|
|
@@ -5159,7 +5160,7 @@ ${input.slice(result.pos)}
|
|
|
5159
5160
|
value
|
|
5160
5161
|
};
|
|
5161
5162
|
});
|
|
5162
|
-
var PropertyDefinition$1 = $TS($S(__, $TEXT($EXPECT($R4, fail, "PropertyDefinition /[
|
|
5163
|
+
var PropertyDefinition$1 = $TS($S(__, $TEXT($EXPECT($R4, fail, "PropertyDefinition /[!+-]/")), IdentifierName), function($skip, $loc, $0, $1, $2, $3) {
|
|
5163
5164
|
var ws = $1;
|
|
5164
5165
|
var toggle = $2;
|
|
5165
5166
|
var id = $3;
|
|
@@ -11004,29 +11005,62 @@ ${input.slice(result.pos)}
|
|
|
11004
11005
|
return result;
|
|
11005
11006
|
}
|
|
11006
11007
|
}
|
|
11007
|
-
var
|
|
11008
|
-
const
|
|
11008
|
+
var JSXImplicitFragment$0 = $TS($S(JSXTag, $Q($S(Samedent, JSXTag))), function($skip, $loc, $0, $1, $2) {
|
|
11009
|
+
const jsx = $2.length === 0 ? $1 : {
|
|
11010
|
+
type: "JSXFragment",
|
|
11011
|
+
children: [
|
|
11012
|
+
"<>\n",
|
|
11013
|
+
module.currentIndent.token,
|
|
11014
|
+
...$0,
|
|
11015
|
+
"\n",
|
|
11016
|
+
module.currentIndent.token,
|
|
11017
|
+
"</>"
|
|
11018
|
+
],
|
|
11019
|
+
jsxChildren: [$1].concat($2.map(([, tag]) => tag))
|
|
11020
|
+
};
|
|
11021
|
+
const type = module.typeOfJSX(jsx);
|
|
11009
11022
|
return type ? [
|
|
11010
11023
|
{ ts: true, children: ["("] },
|
|
11011
|
-
|
|
11024
|
+
jsx,
|
|
11012
11025
|
{ ts: true, children: [" as any as ", type, ")"] }
|
|
11013
|
-
] :
|
|
11026
|
+
] : jsx;
|
|
11014
11027
|
});
|
|
11015
|
-
function
|
|
11028
|
+
function JSXImplicitFragment(state) {
|
|
11029
|
+
if (state.events) {
|
|
11030
|
+
const result = state.events.enter?.("JSXImplicitFragment", state);
|
|
11031
|
+
if (result)
|
|
11032
|
+
return result.cache;
|
|
11033
|
+
}
|
|
11034
|
+
if (state.tokenize) {
|
|
11035
|
+
const result = $TOKEN("JSXImplicitFragment", state, JSXImplicitFragment$0(state));
|
|
11036
|
+
if (state.events)
|
|
11037
|
+
state.events.exit?.("JSXImplicitFragment", state, result);
|
|
11038
|
+
return result;
|
|
11039
|
+
} else {
|
|
11040
|
+
const result = JSXImplicitFragment$0(state);
|
|
11041
|
+
if (state.events)
|
|
11042
|
+
state.events.exit?.("JSXImplicitFragment", state, result);
|
|
11043
|
+
return result;
|
|
11044
|
+
}
|
|
11045
|
+
}
|
|
11046
|
+
var JSXTag$0 = JSXElement;
|
|
11047
|
+
var JSXTag$1 = JSXFragment;
|
|
11048
|
+
var JSXTag$2 = JSXComment;
|
|
11049
|
+
function JSXTag(state) {
|
|
11016
11050
|
if (state.events) {
|
|
11017
|
-
const result = state.events.enter?.("
|
|
11051
|
+
const result = state.events.enter?.("JSXTag", state);
|
|
11018
11052
|
if (result)
|
|
11019
11053
|
return result.cache;
|
|
11020
11054
|
}
|
|
11021
11055
|
if (state.tokenize) {
|
|
11022
|
-
const result = $TOKEN("
|
|
11056
|
+
const result = $TOKEN("JSXTag", state, JSXTag$0(state) || JSXTag$1(state) || JSXTag$2(state));
|
|
11023
11057
|
if (state.events)
|
|
11024
|
-
state.events.exit?.("
|
|
11058
|
+
state.events.exit?.("JSXTag", state, result);
|
|
11025
11059
|
return result;
|
|
11026
11060
|
} else {
|
|
11027
|
-
const result =
|
|
11061
|
+
const result = JSXTag$0(state) || JSXTag$1(state) || JSXTag$2(state);
|
|
11028
11062
|
if (state.events)
|
|
11029
|
-
state.events.exit?.("
|
|
11063
|
+
state.events.exit?.("JSXTag", state, result);
|
|
11030
11064
|
return result;
|
|
11031
11065
|
}
|
|
11032
11066
|
}
|
|
@@ -11125,32 +11159,6 @@ ${input.slice(result.pos)}
|
|
|
11125
11159
|
return result;
|
|
11126
11160
|
}
|
|
11127
11161
|
}
|
|
11128
|
-
var TypedJSXFragment$0 = $TS($S(JSXFragment), function($skip, $loc, $0, $1) {
|
|
11129
|
-
const type = module.typeOfJSXFragment($1);
|
|
11130
|
-
return type ? [
|
|
11131
|
-
{ ts: true, children: ["("] },
|
|
11132
|
-
$1,
|
|
11133
|
-
{ ts: true, children: [" as any as ", type, ")"] }
|
|
11134
|
-
] : $1;
|
|
11135
|
-
});
|
|
11136
|
-
function TypedJSXFragment(state) {
|
|
11137
|
-
if (state.events) {
|
|
11138
|
-
const result = state.events.enter?.("TypedJSXFragment", state);
|
|
11139
|
-
if (result)
|
|
11140
|
-
return result.cache;
|
|
11141
|
-
}
|
|
11142
|
-
if (state.tokenize) {
|
|
11143
|
-
const result = $TOKEN("TypedJSXFragment", state, TypedJSXFragment$0(state));
|
|
11144
|
-
if (state.events)
|
|
11145
|
-
state.events.exit?.("TypedJSXFragment", state, result);
|
|
11146
|
-
return result;
|
|
11147
|
-
} else {
|
|
11148
|
-
const result = TypedJSXFragment$0(state);
|
|
11149
|
-
if (state.events)
|
|
11150
|
-
state.events.exit?.("TypedJSXFragment", state, result);
|
|
11151
|
-
return result;
|
|
11152
|
-
}
|
|
11153
|
-
}
|
|
11154
11162
|
var JSXFragment$0 = $TS($S($EXPECT($L156, fail, 'JSXFragment "<>"'), $E(JSXChildren), $E(Whitespace), $EXPECT($L157, fail, 'JSXFragment "</>"')), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
11155
11163
|
if ($2) {
|
|
11156
11164
|
return { type: "JSXFragment", children: $0, jsxChildren: $2.jsxChildren };
|
|
@@ -11378,6 +11386,12 @@ ${input.slice(result.pos)}
|
|
|
11378
11386
|
class: $2
|
|
11379
11387
|
};
|
|
11380
11388
|
});
|
|
11389
|
+
var JSXAttribute$5 = $TS($S($TEXT($EXPECT($R4, fail, "JSXAttribute /[!+-]/")), JSXAttributeName), function($skip, $loc, $0, $1, $2) {
|
|
11390
|
+
var toggle = $1;
|
|
11391
|
+
var id = $2;
|
|
11392
|
+
const value = toggle === "+" ? "true" : "false";
|
|
11393
|
+
return [" ", id, "={", value, "}"];
|
|
11394
|
+
});
|
|
11381
11395
|
function JSXAttribute(state) {
|
|
11382
11396
|
if (state.events) {
|
|
11383
11397
|
const result = state.events.enter?.("JSXAttribute", state);
|
|
@@ -11385,12 +11399,12 @@ ${input.slice(result.pos)}
|
|
|
11385
11399
|
return result.cache;
|
|
11386
11400
|
}
|
|
11387
11401
|
if (state.tokenize) {
|
|
11388
|
-
const result = $TOKEN("JSXAttribute", state, JSXAttribute$0(state) || JSXAttribute$1(state) || JSXAttribute$2(state) || JSXAttribute$3(state) || JSXAttribute$4(state));
|
|
11402
|
+
const result = $TOKEN("JSXAttribute", state, JSXAttribute$0(state) || JSXAttribute$1(state) || JSXAttribute$2(state) || JSXAttribute$3(state) || JSXAttribute$4(state) || JSXAttribute$5(state));
|
|
11389
11403
|
if (state.events)
|
|
11390
11404
|
state.events.exit?.("JSXAttribute", state, result);
|
|
11391
11405
|
return result;
|
|
11392
11406
|
} else {
|
|
11393
|
-
const result = JSXAttribute$0(state) || JSXAttribute$1(state) || JSXAttribute$2(state) || JSXAttribute$3(state) || JSXAttribute$4(state);
|
|
11407
|
+
const result = JSXAttribute$0(state) || JSXAttribute$1(state) || JSXAttribute$2(state) || JSXAttribute$3(state) || JSXAttribute$4(state) || JSXAttribute$5(state);
|
|
11394
11408
|
if (state.events)
|
|
11395
11409
|
state.events.exit?.("JSXAttribute", state, result);
|
|
11396
11410
|
return result;
|
|
@@ -12299,7 +12313,7 @@ ${input.slice(result.pos)}
|
|
|
12299
12313
|
return result;
|
|
12300
12314
|
}
|
|
12301
12315
|
}
|
|
12302
|
-
var TypeIndexSignature$0 = $S($E($S($R$0($EXPECT($R50, fail, "TypeIndexSignature /[+-]?/")), $EXPECT($L130, fail, 'TypeIndexSignature "readonly"'), __)), OpenBracket, TypeIndex, CloseBracket, $E($S(__, $R$0($EXPECT($
|
|
12316
|
+
var TypeIndexSignature$0 = $S($E($S($R$0($EXPECT($R50, fail, "TypeIndexSignature /[+-]?/")), $EXPECT($L130, fail, 'TypeIndexSignature "readonly"'), __)), OpenBracket, TypeIndex, CloseBracket, $E($S(__, $R$0($EXPECT($R51, fail, "TypeIndexSignature /[+-]/")), QuestionMark)));
|
|
12303
12317
|
function TypeIndexSignature(state) {
|
|
12304
12318
|
if (state.events) {
|
|
12305
12319
|
const result = state.events.enter?.("TypeIndexSignature", state);
|
|
@@ -12901,7 +12915,7 @@ ${input.slice(result.pos)}
|
|
|
12901
12915
|
return result;
|
|
12902
12916
|
}
|
|
12903
12917
|
}
|
|
12904
|
-
var Shebang$0 = $S($R$0($EXPECT($
|
|
12918
|
+
var Shebang$0 = $S($R$0($EXPECT($R52, fail, "Shebang /#![^\\r\\n]*/")), EOL);
|
|
12905
12919
|
function Shebang(state) {
|
|
12906
12920
|
if (state.events) {
|
|
12907
12921
|
const result = state.events.enter?.("Shebang", state);
|
|
@@ -12920,11 +12934,11 @@ ${input.slice(result.pos)}
|
|
|
12920
12934
|
return result;
|
|
12921
12935
|
}
|
|
12922
12936
|
}
|
|
12923
|
-
var CivetPrologue$0 = $T($S($EXPECT($
|
|
12937
|
+
var CivetPrologue$0 = $T($S($EXPECT($R53, fail, "CivetPrologue /[\\t ]*/"), DoubleQuote, CivetPrologueContent, DoubleQuote, $TEXT(StatementDelimiter), $E(EOS)), function(value) {
|
|
12924
12938
|
var content = value[2];
|
|
12925
12939
|
return content;
|
|
12926
12940
|
});
|
|
12927
|
-
var CivetPrologue$1 = $T($S($EXPECT($
|
|
12941
|
+
var CivetPrologue$1 = $T($S($EXPECT($R53, fail, "CivetPrologue /[\\t ]*/"), SingleQuote, CivetPrologueContent, SingleQuote, $TEXT(StatementDelimiter), $E(EOS)), function(value) {
|
|
12928
12942
|
var content = value[2];
|
|
12929
12943
|
return content;
|
|
12930
12944
|
});
|
|
@@ -12946,7 +12960,7 @@ ${input.slice(result.pos)}
|
|
|
12946
12960
|
return result;
|
|
12947
12961
|
}
|
|
12948
12962
|
}
|
|
12949
|
-
var CivetPrologueContent$0 = $TS($S($EXPECT($L168, fail, 'CivetPrologueContent "civet"'), NonIdContinue, $Q(CivetOption), $EXPECT($
|
|
12963
|
+
var CivetPrologueContent$0 = $TS($S($EXPECT($L168, fail, 'CivetPrologueContent "civet"'), NonIdContinue, $Q(CivetOption), $EXPECT($R54, fail, "CivetPrologueContent /[\\s]*/")), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
12950
12964
|
var options = $3;
|
|
12951
12965
|
return {
|
|
12952
12966
|
type: "CivetPrologue",
|
|
@@ -12972,7 +12986,7 @@ ${input.slice(result.pos)}
|
|
|
12972
12986
|
return result;
|
|
12973
12987
|
}
|
|
12974
12988
|
}
|
|
12975
|
-
var CivetOption$0 = $TR($EXPECT($
|
|
12989
|
+
var CivetOption$0 = $TR($EXPECT($R55, 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) {
|
|
12976
12990
|
const optionName = $2.replace(/-+([a-z]?)/g, (_2, l) => {
|
|
12977
12991
|
if (l)
|
|
12978
12992
|
return l.toUpperCase();
|
|
@@ -13004,7 +13018,7 @@ ${input.slice(result.pos)}
|
|
|
13004
13018
|
return result;
|
|
13005
13019
|
}
|
|
13006
13020
|
}
|
|
13007
|
-
var UnknownPrologue$0 = $S($R$0($EXPECT($
|
|
13021
|
+
var UnknownPrologue$0 = $S($R$0($EXPECT($R53, fail, "UnknownPrologue /[\\t ]*/")), BasicStringLiteral, $TEXT(StatementDelimiter), EOS);
|
|
13008
13022
|
function UnknownPrologue(state) {
|
|
13009
13023
|
if (state.events) {
|
|
13010
13024
|
const result = state.events.enter?.("UnknownPrologue", state);
|
|
@@ -13062,7 +13076,7 @@ ${input.slice(result.pos)}
|
|
|
13062
13076
|
return result;
|
|
13063
13077
|
}
|
|
13064
13078
|
}
|
|
13065
|
-
var EOL$0 = $TR($EXPECT($
|
|
13079
|
+
var EOL$0 = $TR($EXPECT($R56, fail, "EOL /\\r\\n|\\n|\\r|$/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
|
|
13066
13080
|
return { $loc, token: $0 };
|
|
13067
13081
|
});
|
|
13068
13082
|
function EOL(state) {
|
|
@@ -13779,12 +13793,20 @@ ${input.slice(result.pos)}
|
|
|
13779
13793
|
declareRef[base](ref);
|
|
13780
13794
|
return refs[base] = ref;
|
|
13781
13795
|
};
|
|
13782
|
-
module.
|
|
13796
|
+
module.typeOfJSX = function(node) {
|
|
13797
|
+
switch (node.type) {
|
|
13798
|
+
case "JSXElement":
|
|
13799
|
+
return module.typeOfJSXElement(node);
|
|
13800
|
+
case "JSXFragment":
|
|
13801
|
+
return module.typeOfJSXFragment(node);
|
|
13802
|
+
}
|
|
13803
|
+
};
|
|
13804
|
+
module.typeOfJSXElement = function(node) {
|
|
13783
13805
|
if (module.config.solid) {
|
|
13784
13806
|
if (module.config.server && !module.config.client) {
|
|
13785
13807
|
return ["string"];
|
|
13786
13808
|
}
|
|
13787
|
-
let open =
|
|
13809
|
+
let open = node.children;
|
|
13788
13810
|
while (Array.isArray(open[0]))
|
|
13789
13811
|
open = open[0];
|
|
13790
13812
|
open = open[1];
|
|
@@ -13796,11 +13818,11 @@ ${input.slice(result.pos)}
|
|
|
13796
13818
|
}
|
|
13797
13819
|
}
|
|
13798
13820
|
};
|
|
13799
|
-
module.typeOfJSXFragment = function(
|
|
13821
|
+
module.typeOfJSXFragment = function(node) {
|
|
13800
13822
|
if (module.config.solid) {
|
|
13801
13823
|
let type = [];
|
|
13802
13824
|
let lastType;
|
|
13803
|
-
for (let child of
|
|
13825
|
+
for (let child of node.jsxChildren) {
|
|
13804
13826
|
switch (child.type) {
|
|
13805
13827
|
case "JSXText":
|
|
13806
13828
|
if (lastType !== "JSXText") {
|
|
@@ -14877,7 +14899,7 @@ ${input.slice(result.pos)}
|
|
|
14877
14899
|
return result;
|
|
14878
14900
|
}
|
|
14879
14901
|
}
|
|
14880
|
-
var Indent$0 = $TR($EXPECT($
|
|
14902
|
+
var Indent$0 = $TR($EXPECT($R57, fail, "Indent /[ \\t]*/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
|
|
14881
14903
|
let level;
|
|
14882
14904
|
if (module.config.tab) {
|
|
14883
14905
|
const tabs = $0.match(/\t/g);
|
|
@@ -15495,7 +15517,7 @@ ${input.slice(result.pos)}
|
|
|
15495
15517
|
({ parse } = import_parser.default);
|
|
15496
15518
|
({ SourceMap: SourceMap2, base64Encode: base64Encode2 } = util_exports);
|
|
15497
15519
|
defaultOptions = {};
|
|
15498
|
-
uncacheable = /* @__PURE__ */ new Set(["TrackIndented", "Samedent", "IndentedFurther", "PushIndent", "PopIndent", "Nested", "InsertIndent", "Arguments", "ArgumentsWithTrailingCallExpressions", "ApplicationStart", "CallExpression", "CallExpressionRest", "LeftHandSideExpression", "ActualAssignment", "UpdateExpression", "UnaryExpression", "BinaryOpExpression", "BinaryOpRHS", "ConditionalExpression", "ShortCircuitExpression", "InlineObjectLiteral", "ImplicitInlineObjectPropertyDelimiter", "ImplicitNestedBlock", "IndentedJSXChildExpression", "NestedJSXChildExpression", "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"]);
|
|
15520
|
+
uncacheable = /* @__PURE__ */ new Set(["TrackIndented", "Samedent", "IndentedFurther", "PushIndent", "PopIndent", "Nested", "InsertIndent", "Arguments", "ArgumentsWithTrailingCallExpressions", "ApplicationStart", "CallExpression", "CallExpressionRest", "LeftHandSideExpression", "ActualAssignment", "UpdateExpression", "UnaryExpression", "BinaryOpExpression", "BinaryOpRHS", "ConditionalExpression", "ShortCircuitExpression", "InlineObjectLiteral", "ImplicitInlineObjectPropertyDelimiter", "FatArrowBody", "ThinArrowFunction", "ArrowFunctionTail", "ArrowFunction", "ImplicitNestedBlock", "BracedBlock", "BracedOrEmptyBlock", "NestedBlockExpression", "NestedBlockExpression", "NestedBlockStatements", "SingleLineStatements", "ExpressionStatement", "Statement", "IndentedJSXChildExpression", "NestedJSXChildExpression", "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", "JSXImplicitFragment", "JSXTag", "JSXElement", "TypedJSXElement", "JSXFragment", "TypedJSXFragment", "JSXChild", "JSXChildren", "JSXNestedChildren", "JSXMixedChildren"]);
|
|
15499
15521
|
var compile = function(src, options = defaultOptions) {
|
|
15500
15522
|
var ast, code, events, filename, sm, srcMapJSON;
|
|
15501
15523
|
filename = options.filename || "unknown";
|
package/dist/esbuild-plugin.js
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
@file esbuild plugin for Civet language
|
|
3
|
+
|
|
4
|
+
@example
|
|
5
|
+
```javascript
|
|
6
|
+
import esbuild from 'esbuild'
|
|
7
|
+
import civetPlugin from '@danielx/civet/esbuild-plugin'
|
|
8
|
+
|
|
9
|
+
esbuild.build({
|
|
10
|
+
...,
|
|
11
|
+
plugins: [
|
|
12
|
+
civetPlugin
|
|
13
|
+
]
|
|
14
|
+
}).catch(() => process.exit(1))
|
|
15
|
+
```
|
|
16
|
+
*/
|
|
17
|
+
|
|
1
18
|
const { readFile } = require('fs/promises')
|
|
2
19
|
const path = require('path')
|
|
3
20
|
|
package/dist/main.js
CHANGED
|
@@ -792,12 +792,12 @@ ${input.slice(result.pos)}
|
|
|
792
792
|
When,
|
|
793
793
|
While,
|
|
794
794
|
Yield,
|
|
795
|
-
|
|
795
|
+
JSXImplicitFragment,
|
|
796
|
+
JSXTag,
|
|
796
797
|
JSXElement,
|
|
797
798
|
JSXSelfClosingElement,
|
|
798
799
|
JSXOpeningElement,
|
|
799
800
|
JSXClosingElement,
|
|
800
|
-
TypedJSXFragment,
|
|
801
801
|
JSXFragment,
|
|
802
802
|
JSXElementName,
|
|
803
803
|
JSXIdentifierName,
|
|
@@ -1088,7 +1088,7 @@ ${input.slice(result.pos)}
|
|
|
1088
1088
|
var $R1 = $R(new RegExp("[&]", "suy"));
|
|
1089
1089
|
var $R2 = $R(new RegExp("[!~+-]+", "suy"));
|
|
1090
1090
|
var $R3 = $R(new RegExp("(?:\\p{ID_Start}|[_$])(?:\\p{ID_Continue}|[\\u200C\\u200D$])*", "suy"));
|
|
1091
|
-
var $R4 = $R(new RegExp("[
|
|
1091
|
+
var $R4 = $R(new RegExp("[!+-]", "suy"));
|
|
1092
1092
|
var $R5 = $R(new RegExp("<(?!\\p{ID_Start}|[_$])", "suy"));
|
|
1093
1093
|
var $R6 = $R(new RegExp("[!~+-](?!\\s|[!~+-]*&)", "suy"));
|
|
1094
1094
|
var $R7 = $R(new RegExp("(?=[\\s\\)])", "suy"));
|
|
@@ -1135,12 +1135,13 @@ ${input.slice(result.pos)}
|
|
|
1135
1135
|
var $R48 = $R(new RegExp("(?:-[^-]|[^-]*)*", "suy"));
|
|
1136
1136
|
var $R49 = $R(new RegExp("[^{}<>\\r\\n]+", "suy"));
|
|
1137
1137
|
var $R50 = $R(new RegExp("[+-]?", "suy"));
|
|
1138
|
-
var $R51 = $R(new RegExp("
|
|
1139
|
-
var $R52 = $R(new RegExp("[\\
|
|
1140
|
-
var $R53 = $R(new RegExp("[\\
|
|
1141
|
-
var $R54 = $R(new RegExp("
|
|
1142
|
-
var $R55 = $R(new RegExp("\\
|
|
1143
|
-
var $R56 = $R(new RegExp("
|
|
1138
|
+
var $R51 = $R(new RegExp("[+-]", "suy"));
|
|
1139
|
+
var $R52 = $R(new RegExp("#![^\\r\\n]*", "suy"));
|
|
1140
|
+
var $R53 = $R(new RegExp("[\\t ]*", "suy"));
|
|
1141
|
+
var $R54 = $R(new RegExp("[\\s]*", "suy"));
|
|
1142
|
+
var $R55 = $R(new RegExp("\\s+([+-]?)([a-zA-Z0-9-]+)(\\s*=\\s*([a-zA-Z0-9.+-]*))?", "suy"));
|
|
1143
|
+
var $R56 = $R(new RegExp("\\r\\n|\\n|\\r|$", "suy"));
|
|
1144
|
+
var $R57 = $R(new RegExp("[ \\t]*", "suy"));
|
|
1144
1145
|
var Program$0 = $TS($S(Reset, Init, __, $Q(TopLevelStatement), __), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
1145
1146
|
var statements = $4;
|
|
1146
1147
|
module2.processProgram(statements);
|
|
@@ -2161,8 +2162,7 @@ ${input.slice(result.pos)}
|
|
|
2161
2162
|
var PrimaryExpression$7 = RegularExpressionLiteral;
|
|
2162
2163
|
var PrimaryExpression$8 = TemplateLiteral;
|
|
2163
2164
|
var PrimaryExpression$9 = ParenthesizedExpression;
|
|
2164
|
-
var PrimaryExpression$10 =
|
|
2165
|
-
var PrimaryExpression$11 = TypedJSXFragment;
|
|
2165
|
+
var PrimaryExpression$10 = JSXImplicitFragment;
|
|
2166
2166
|
function PrimaryExpression(state) {
|
|
2167
2167
|
if (state.events) {
|
|
2168
2168
|
const result = state.events.enter?.("PrimaryExpression", state);
|
|
@@ -2170,12 +2170,12 @@ ${input.slice(result.pos)}
|
|
|
2170
2170
|
return result.cache;
|
|
2171
2171
|
}
|
|
2172
2172
|
if (state.tokenize) {
|
|
2173
|
-
const result = $TOKEN("PrimaryExpression", state, PrimaryExpression$0(state) || PrimaryExpression$1(state) || PrimaryExpression$2(state) || PrimaryExpression$3(state) || PrimaryExpression$4(state) || PrimaryExpression$5(state) || PrimaryExpression$6(state) || PrimaryExpression$7(state) || PrimaryExpression$8(state) || PrimaryExpression$9(state) || PrimaryExpression$10(state)
|
|
2173
|
+
const result = $TOKEN("PrimaryExpression", state, PrimaryExpression$0(state) || PrimaryExpression$1(state) || PrimaryExpression$2(state) || PrimaryExpression$3(state) || PrimaryExpression$4(state) || PrimaryExpression$5(state) || PrimaryExpression$6(state) || PrimaryExpression$7(state) || PrimaryExpression$8(state) || PrimaryExpression$9(state) || PrimaryExpression$10(state));
|
|
2174
2174
|
if (state.events)
|
|
2175
2175
|
state.events.exit?.("PrimaryExpression", state, result);
|
|
2176
2176
|
return result;
|
|
2177
2177
|
} else {
|
|
2178
|
-
const result = PrimaryExpression$0(state) || PrimaryExpression$1(state) || PrimaryExpression$2(state) || PrimaryExpression$3(state) || PrimaryExpression$4(state) || PrimaryExpression$5(state) || PrimaryExpression$6(state) || PrimaryExpression$7(state) || PrimaryExpression$8(state) || PrimaryExpression$9(state) || PrimaryExpression$10(state)
|
|
2178
|
+
const result = PrimaryExpression$0(state) || PrimaryExpression$1(state) || PrimaryExpression$2(state) || PrimaryExpression$3(state) || PrimaryExpression$4(state) || PrimaryExpression$5(state) || PrimaryExpression$6(state) || PrimaryExpression$7(state) || PrimaryExpression$8(state) || PrimaryExpression$9(state) || PrimaryExpression$10(state);
|
|
2179
2179
|
if (state.events)
|
|
2180
2180
|
state.events.exit?.("PrimaryExpression", state, result);
|
|
2181
2181
|
return result;
|
|
@@ -4779,7 +4779,8 @@ ${input.slice(result.pos)}
|
|
|
4779
4779
|
return result;
|
|
4780
4780
|
}
|
|
4781
4781
|
}
|
|
4782
|
-
var ArrayElementExpression$0 =
|
|
4782
|
+
var ArrayElementExpression$0 = JSXTag;
|
|
4783
|
+
var ArrayElementExpression$1 = $TS($S($E(ExtendedExpression), __, DotDotDot, $Y(ArrayElementDelimiter)), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
4783
4784
|
var exp = $1;
|
|
4784
4785
|
var ws = $2;
|
|
4785
4786
|
var dots = $3;
|
|
@@ -4797,7 +4798,7 @@ ${input.slice(result.pos)}
|
|
|
4797
4798
|
names: exp.names
|
|
4798
4799
|
};
|
|
4799
4800
|
});
|
|
4800
|
-
var ArrayElementExpression$
|
|
4801
|
+
var ArrayElementExpression$2 = $TS($S($E($S($E($S(__, DotDotDot, __)), ExtendedExpression)), $Y(ArrayElementDelimiter)), function($skip, $loc, $0, $1, $2) {
|
|
4801
4802
|
var expMaybeSpread = $1;
|
|
4802
4803
|
if (expMaybeSpread) {
|
|
4803
4804
|
const [spread, exp] = expMaybeSpread;
|
|
@@ -4827,12 +4828,12 @@ ${input.slice(result.pos)}
|
|
|
4827
4828
|
return result.cache;
|
|
4828
4829
|
}
|
|
4829
4830
|
if (state.tokenize) {
|
|
4830
|
-
const result = $TOKEN("ArrayElementExpression", state, ArrayElementExpression$0(state) || ArrayElementExpression$1(state));
|
|
4831
|
+
const result = $TOKEN("ArrayElementExpression", state, ArrayElementExpression$0(state) || ArrayElementExpression$1(state) || ArrayElementExpression$2(state));
|
|
4831
4832
|
if (state.events)
|
|
4832
4833
|
state.events.exit?.("ArrayElementExpression", state, result);
|
|
4833
4834
|
return result;
|
|
4834
4835
|
} else {
|
|
4835
|
-
const result = ArrayElementExpression$0(state) || ArrayElementExpression$1(state);
|
|
4836
|
+
const result = ArrayElementExpression$0(state) || ArrayElementExpression$1(state) || ArrayElementExpression$2(state);
|
|
4836
4837
|
if (state.events)
|
|
4837
4838
|
state.events.exit?.("ArrayElementExpression", state, result);
|
|
4838
4839
|
return result;
|
|
@@ -5158,7 +5159,7 @@ ${input.slice(result.pos)}
|
|
|
5158
5159
|
value
|
|
5159
5160
|
};
|
|
5160
5161
|
});
|
|
5161
|
-
var PropertyDefinition$1 = $TS($S(__, $TEXT($EXPECT($R4, fail, "PropertyDefinition /[
|
|
5162
|
+
var PropertyDefinition$1 = $TS($S(__, $TEXT($EXPECT($R4, fail, "PropertyDefinition /[!+-]/")), IdentifierName), function($skip, $loc, $0, $1, $2, $3) {
|
|
5162
5163
|
var ws = $1;
|
|
5163
5164
|
var toggle = $2;
|
|
5164
5165
|
var id = $3;
|
|
@@ -11003,29 +11004,62 @@ ${input.slice(result.pos)}
|
|
|
11003
11004
|
return result;
|
|
11004
11005
|
}
|
|
11005
11006
|
}
|
|
11006
|
-
var
|
|
11007
|
-
const
|
|
11007
|
+
var JSXImplicitFragment$0 = $TS($S(JSXTag, $Q($S(Samedent, JSXTag))), function($skip, $loc, $0, $1, $2) {
|
|
11008
|
+
const jsx = $2.length === 0 ? $1 : {
|
|
11009
|
+
type: "JSXFragment",
|
|
11010
|
+
children: [
|
|
11011
|
+
"<>\n",
|
|
11012
|
+
module2.currentIndent.token,
|
|
11013
|
+
...$0,
|
|
11014
|
+
"\n",
|
|
11015
|
+
module2.currentIndent.token,
|
|
11016
|
+
"</>"
|
|
11017
|
+
],
|
|
11018
|
+
jsxChildren: [$1].concat($2.map(([, tag]) => tag))
|
|
11019
|
+
};
|
|
11020
|
+
const type = module2.typeOfJSX(jsx);
|
|
11008
11021
|
return type ? [
|
|
11009
11022
|
{ ts: true, children: ["("] },
|
|
11010
|
-
|
|
11023
|
+
jsx,
|
|
11011
11024
|
{ ts: true, children: [" as any as ", type, ")"] }
|
|
11012
|
-
] :
|
|
11025
|
+
] : jsx;
|
|
11013
11026
|
});
|
|
11014
|
-
function
|
|
11027
|
+
function JSXImplicitFragment(state) {
|
|
11028
|
+
if (state.events) {
|
|
11029
|
+
const result = state.events.enter?.("JSXImplicitFragment", state);
|
|
11030
|
+
if (result)
|
|
11031
|
+
return result.cache;
|
|
11032
|
+
}
|
|
11033
|
+
if (state.tokenize) {
|
|
11034
|
+
const result = $TOKEN("JSXImplicitFragment", state, JSXImplicitFragment$0(state));
|
|
11035
|
+
if (state.events)
|
|
11036
|
+
state.events.exit?.("JSXImplicitFragment", state, result);
|
|
11037
|
+
return result;
|
|
11038
|
+
} else {
|
|
11039
|
+
const result = JSXImplicitFragment$0(state);
|
|
11040
|
+
if (state.events)
|
|
11041
|
+
state.events.exit?.("JSXImplicitFragment", state, result);
|
|
11042
|
+
return result;
|
|
11043
|
+
}
|
|
11044
|
+
}
|
|
11045
|
+
var JSXTag$0 = JSXElement;
|
|
11046
|
+
var JSXTag$1 = JSXFragment;
|
|
11047
|
+
var JSXTag$2 = JSXComment;
|
|
11048
|
+
function JSXTag(state) {
|
|
11015
11049
|
if (state.events) {
|
|
11016
|
-
const result = state.events.enter?.("
|
|
11050
|
+
const result = state.events.enter?.("JSXTag", state);
|
|
11017
11051
|
if (result)
|
|
11018
11052
|
return result.cache;
|
|
11019
11053
|
}
|
|
11020
11054
|
if (state.tokenize) {
|
|
11021
|
-
const result = $TOKEN("
|
|
11055
|
+
const result = $TOKEN("JSXTag", state, JSXTag$0(state) || JSXTag$1(state) || JSXTag$2(state));
|
|
11022
11056
|
if (state.events)
|
|
11023
|
-
state.events.exit?.("
|
|
11057
|
+
state.events.exit?.("JSXTag", state, result);
|
|
11024
11058
|
return result;
|
|
11025
11059
|
} else {
|
|
11026
|
-
const result =
|
|
11060
|
+
const result = JSXTag$0(state) || JSXTag$1(state) || JSXTag$2(state);
|
|
11027
11061
|
if (state.events)
|
|
11028
|
-
state.events.exit?.("
|
|
11062
|
+
state.events.exit?.("JSXTag", state, result);
|
|
11029
11063
|
return result;
|
|
11030
11064
|
}
|
|
11031
11065
|
}
|
|
@@ -11124,32 +11158,6 @@ ${input.slice(result.pos)}
|
|
|
11124
11158
|
return result;
|
|
11125
11159
|
}
|
|
11126
11160
|
}
|
|
11127
|
-
var TypedJSXFragment$0 = $TS($S(JSXFragment), function($skip, $loc, $0, $1) {
|
|
11128
|
-
const type = module2.typeOfJSXFragment($1);
|
|
11129
|
-
return type ? [
|
|
11130
|
-
{ ts: true, children: ["("] },
|
|
11131
|
-
$1,
|
|
11132
|
-
{ ts: true, children: [" as any as ", type, ")"] }
|
|
11133
|
-
] : $1;
|
|
11134
|
-
});
|
|
11135
|
-
function TypedJSXFragment(state) {
|
|
11136
|
-
if (state.events) {
|
|
11137
|
-
const result = state.events.enter?.("TypedJSXFragment", state);
|
|
11138
|
-
if (result)
|
|
11139
|
-
return result.cache;
|
|
11140
|
-
}
|
|
11141
|
-
if (state.tokenize) {
|
|
11142
|
-
const result = $TOKEN("TypedJSXFragment", state, TypedJSXFragment$0(state));
|
|
11143
|
-
if (state.events)
|
|
11144
|
-
state.events.exit?.("TypedJSXFragment", state, result);
|
|
11145
|
-
return result;
|
|
11146
|
-
} else {
|
|
11147
|
-
const result = TypedJSXFragment$0(state);
|
|
11148
|
-
if (state.events)
|
|
11149
|
-
state.events.exit?.("TypedJSXFragment", state, result);
|
|
11150
|
-
return result;
|
|
11151
|
-
}
|
|
11152
|
-
}
|
|
11153
11161
|
var JSXFragment$0 = $TS($S($EXPECT($L156, fail, 'JSXFragment "<>"'), $E(JSXChildren), $E(Whitespace), $EXPECT($L157, fail, 'JSXFragment "</>"')), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
11154
11162
|
if ($2) {
|
|
11155
11163
|
return { type: "JSXFragment", children: $0, jsxChildren: $2.jsxChildren };
|
|
@@ -11377,6 +11385,12 @@ ${input.slice(result.pos)}
|
|
|
11377
11385
|
class: $2
|
|
11378
11386
|
};
|
|
11379
11387
|
});
|
|
11388
|
+
var JSXAttribute$5 = $TS($S($TEXT($EXPECT($R4, fail, "JSXAttribute /[!+-]/")), JSXAttributeName), function($skip, $loc, $0, $1, $2) {
|
|
11389
|
+
var toggle = $1;
|
|
11390
|
+
var id = $2;
|
|
11391
|
+
const value = toggle === "+" ? "true" : "false";
|
|
11392
|
+
return [" ", id, "={", value, "}"];
|
|
11393
|
+
});
|
|
11380
11394
|
function JSXAttribute(state) {
|
|
11381
11395
|
if (state.events) {
|
|
11382
11396
|
const result = state.events.enter?.("JSXAttribute", state);
|
|
@@ -11384,12 +11398,12 @@ ${input.slice(result.pos)}
|
|
|
11384
11398
|
return result.cache;
|
|
11385
11399
|
}
|
|
11386
11400
|
if (state.tokenize) {
|
|
11387
|
-
const result = $TOKEN("JSXAttribute", state, JSXAttribute$0(state) || JSXAttribute$1(state) || JSXAttribute$2(state) || JSXAttribute$3(state) || JSXAttribute$4(state));
|
|
11401
|
+
const result = $TOKEN("JSXAttribute", state, JSXAttribute$0(state) || JSXAttribute$1(state) || JSXAttribute$2(state) || JSXAttribute$3(state) || JSXAttribute$4(state) || JSXAttribute$5(state));
|
|
11388
11402
|
if (state.events)
|
|
11389
11403
|
state.events.exit?.("JSXAttribute", state, result);
|
|
11390
11404
|
return result;
|
|
11391
11405
|
} else {
|
|
11392
|
-
const result = JSXAttribute$0(state) || JSXAttribute$1(state) || JSXAttribute$2(state) || JSXAttribute$3(state) || JSXAttribute$4(state);
|
|
11406
|
+
const result = JSXAttribute$0(state) || JSXAttribute$1(state) || JSXAttribute$2(state) || JSXAttribute$3(state) || JSXAttribute$4(state) || JSXAttribute$5(state);
|
|
11393
11407
|
if (state.events)
|
|
11394
11408
|
state.events.exit?.("JSXAttribute", state, result);
|
|
11395
11409
|
return result;
|
|
@@ -12298,7 +12312,7 @@ ${input.slice(result.pos)}
|
|
|
12298
12312
|
return result;
|
|
12299
12313
|
}
|
|
12300
12314
|
}
|
|
12301
|
-
var TypeIndexSignature$0 = $S($E($S($R$0($EXPECT($R50, fail, "TypeIndexSignature /[+-]?/")), $EXPECT($L130, fail, 'TypeIndexSignature "readonly"'), __)), OpenBracket, TypeIndex, CloseBracket, $E($S(__, $R$0($EXPECT($
|
|
12315
|
+
var TypeIndexSignature$0 = $S($E($S($R$0($EXPECT($R50, fail, "TypeIndexSignature /[+-]?/")), $EXPECT($L130, fail, 'TypeIndexSignature "readonly"'), __)), OpenBracket, TypeIndex, CloseBracket, $E($S(__, $R$0($EXPECT($R51, fail, "TypeIndexSignature /[+-]/")), QuestionMark)));
|
|
12302
12316
|
function TypeIndexSignature(state) {
|
|
12303
12317
|
if (state.events) {
|
|
12304
12318
|
const result = state.events.enter?.("TypeIndexSignature", state);
|
|
@@ -12900,7 +12914,7 @@ ${input.slice(result.pos)}
|
|
|
12900
12914
|
return result;
|
|
12901
12915
|
}
|
|
12902
12916
|
}
|
|
12903
|
-
var Shebang$0 = $S($R$0($EXPECT($
|
|
12917
|
+
var Shebang$0 = $S($R$0($EXPECT($R52, fail, "Shebang /#![^\\r\\n]*/")), EOL);
|
|
12904
12918
|
function Shebang(state) {
|
|
12905
12919
|
if (state.events) {
|
|
12906
12920
|
const result = state.events.enter?.("Shebang", state);
|
|
@@ -12919,11 +12933,11 @@ ${input.slice(result.pos)}
|
|
|
12919
12933
|
return result;
|
|
12920
12934
|
}
|
|
12921
12935
|
}
|
|
12922
|
-
var CivetPrologue$0 = $T($S($EXPECT($
|
|
12936
|
+
var CivetPrologue$0 = $T($S($EXPECT($R53, fail, "CivetPrologue /[\\t ]*/"), DoubleQuote, CivetPrologueContent, DoubleQuote, $TEXT(StatementDelimiter), $E(EOS)), function(value) {
|
|
12923
12937
|
var content = value[2];
|
|
12924
12938
|
return content;
|
|
12925
12939
|
});
|
|
12926
|
-
var CivetPrologue$1 = $T($S($EXPECT($
|
|
12940
|
+
var CivetPrologue$1 = $T($S($EXPECT($R53, fail, "CivetPrologue /[\\t ]*/"), SingleQuote, CivetPrologueContent, SingleQuote, $TEXT(StatementDelimiter), $E(EOS)), function(value) {
|
|
12927
12941
|
var content = value[2];
|
|
12928
12942
|
return content;
|
|
12929
12943
|
});
|
|
@@ -12945,7 +12959,7 @@ ${input.slice(result.pos)}
|
|
|
12945
12959
|
return result;
|
|
12946
12960
|
}
|
|
12947
12961
|
}
|
|
12948
|
-
var CivetPrologueContent$0 = $TS($S($EXPECT($L168, fail, 'CivetPrologueContent "civet"'), NonIdContinue, $Q(CivetOption), $EXPECT($
|
|
12962
|
+
var CivetPrologueContent$0 = $TS($S($EXPECT($L168, fail, 'CivetPrologueContent "civet"'), NonIdContinue, $Q(CivetOption), $EXPECT($R54, fail, "CivetPrologueContent /[\\s]*/")), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
12949
12963
|
var options = $3;
|
|
12950
12964
|
return {
|
|
12951
12965
|
type: "CivetPrologue",
|
|
@@ -12971,7 +12985,7 @@ ${input.slice(result.pos)}
|
|
|
12971
12985
|
return result;
|
|
12972
12986
|
}
|
|
12973
12987
|
}
|
|
12974
|
-
var CivetOption$0 = $TR($EXPECT($
|
|
12988
|
+
var CivetOption$0 = $TR($EXPECT($R55, 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) {
|
|
12975
12989
|
const optionName = $2.replace(/-+([a-z]?)/g, (_2, l) => {
|
|
12976
12990
|
if (l)
|
|
12977
12991
|
return l.toUpperCase();
|
|
@@ -13003,7 +13017,7 @@ ${input.slice(result.pos)}
|
|
|
13003
13017
|
return result;
|
|
13004
13018
|
}
|
|
13005
13019
|
}
|
|
13006
|
-
var UnknownPrologue$0 = $S($R$0($EXPECT($
|
|
13020
|
+
var UnknownPrologue$0 = $S($R$0($EXPECT($R53, fail, "UnknownPrologue /[\\t ]*/")), BasicStringLiteral, $TEXT(StatementDelimiter), EOS);
|
|
13007
13021
|
function UnknownPrologue(state) {
|
|
13008
13022
|
if (state.events) {
|
|
13009
13023
|
const result = state.events.enter?.("UnknownPrologue", state);
|
|
@@ -13061,7 +13075,7 @@ ${input.slice(result.pos)}
|
|
|
13061
13075
|
return result;
|
|
13062
13076
|
}
|
|
13063
13077
|
}
|
|
13064
|
-
var EOL$0 = $TR($EXPECT($
|
|
13078
|
+
var EOL$0 = $TR($EXPECT($R56, fail, "EOL /\\r\\n|\\n|\\r|$/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
|
|
13065
13079
|
return { $loc, token: $0 };
|
|
13066
13080
|
});
|
|
13067
13081
|
function EOL(state) {
|
|
@@ -13778,12 +13792,20 @@ ${input.slice(result.pos)}
|
|
|
13778
13792
|
declareRef[base](ref);
|
|
13779
13793
|
return refs[base] = ref;
|
|
13780
13794
|
};
|
|
13781
|
-
module2.
|
|
13795
|
+
module2.typeOfJSX = function(node) {
|
|
13796
|
+
switch (node.type) {
|
|
13797
|
+
case "JSXElement":
|
|
13798
|
+
return module2.typeOfJSXElement(node);
|
|
13799
|
+
case "JSXFragment":
|
|
13800
|
+
return module2.typeOfJSXFragment(node);
|
|
13801
|
+
}
|
|
13802
|
+
};
|
|
13803
|
+
module2.typeOfJSXElement = function(node) {
|
|
13782
13804
|
if (module2.config.solid) {
|
|
13783
13805
|
if (module2.config.server && !module2.config.client) {
|
|
13784
13806
|
return ["string"];
|
|
13785
13807
|
}
|
|
13786
|
-
let open =
|
|
13808
|
+
let open = node.children;
|
|
13787
13809
|
while (Array.isArray(open[0]))
|
|
13788
13810
|
open = open[0];
|
|
13789
13811
|
open = open[1];
|
|
@@ -13795,11 +13817,11 @@ ${input.slice(result.pos)}
|
|
|
13795
13817
|
}
|
|
13796
13818
|
}
|
|
13797
13819
|
};
|
|
13798
|
-
module2.typeOfJSXFragment = function(
|
|
13820
|
+
module2.typeOfJSXFragment = function(node) {
|
|
13799
13821
|
if (module2.config.solid) {
|
|
13800
13822
|
let type = [];
|
|
13801
13823
|
let lastType;
|
|
13802
|
-
for (let child of
|
|
13824
|
+
for (let child of node.jsxChildren) {
|
|
13803
13825
|
switch (child.type) {
|
|
13804
13826
|
case "JSXText":
|
|
13805
13827
|
if (lastType !== "JSXText") {
|
|
@@ -14876,7 +14898,7 @@ ${input.slice(result.pos)}
|
|
|
14876
14898
|
return result;
|
|
14877
14899
|
}
|
|
14878
14900
|
}
|
|
14879
|
-
var Indent$0 = $TR($EXPECT($
|
|
14901
|
+
var Indent$0 = $TR($EXPECT($R57, fail, "Indent /[ \\t]*/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
|
|
14880
14902
|
let level;
|
|
14881
14903
|
if (module2.config.tab) {
|
|
14882
14904
|
const tabs = $0.match(/\t/g);
|
|
@@ -15495,7 +15517,7 @@ var uncacheable;
|
|
|
15495
15517
|
({ parse } = import_parser.default);
|
|
15496
15518
|
({ SourceMap: SourceMap2, base64Encode: base64Encode2 } = util_exports);
|
|
15497
15519
|
defaultOptions = {};
|
|
15498
|
-
uncacheable = /* @__PURE__ */ new Set(["TrackIndented", "Samedent", "IndentedFurther", "PushIndent", "PopIndent", "Nested", "InsertIndent", "Arguments", "ArgumentsWithTrailingCallExpressions", "ApplicationStart", "CallExpression", "CallExpressionRest", "LeftHandSideExpression", "ActualAssignment", "UpdateExpression", "UnaryExpression", "BinaryOpExpression", "BinaryOpRHS", "ConditionalExpression", "ShortCircuitExpression", "InlineObjectLiteral", "ImplicitInlineObjectPropertyDelimiter", "ImplicitNestedBlock", "IndentedJSXChildExpression", "NestedJSXChildExpression", "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"]);
|
|
15520
|
+
uncacheable = /* @__PURE__ */ new Set(["TrackIndented", "Samedent", "IndentedFurther", "PushIndent", "PopIndent", "Nested", "InsertIndent", "Arguments", "ArgumentsWithTrailingCallExpressions", "ApplicationStart", "CallExpression", "CallExpressionRest", "LeftHandSideExpression", "ActualAssignment", "UpdateExpression", "UnaryExpression", "BinaryOpExpression", "BinaryOpRHS", "ConditionalExpression", "ShortCircuitExpression", "InlineObjectLiteral", "ImplicitInlineObjectPropertyDelimiter", "FatArrowBody", "ThinArrowFunction", "ArrowFunctionTail", "ArrowFunction", "ImplicitNestedBlock", "BracedBlock", "BracedOrEmptyBlock", "NestedBlockExpression", "NestedBlockExpression", "NestedBlockStatements", "SingleLineStatements", "ExpressionStatement", "Statement", "IndentedJSXChildExpression", "NestedJSXChildExpression", "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", "JSXImplicitFragment", "JSXTag", "JSXElement", "TypedJSXElement", "JSXFragment", "TypedJSXFragment", "JSXChild", "JSXChildren", "JSXNestedChildren", "JSXMixedChildren"]);
|
|
15499
15521
|
var compile = function(src, options = defaultOptions) {
|
|
15500
15522
|
var ast, code, events, filename, sm, srcMapJSON;
|
|
15501
15523
|
filename = options.filename || "unknown";
|
package/dist/main.mjs
CHANGED
|
@@ -790,12 +790,12 @@ ${input.slice(result.pos)}
|
|
|
790
790
|
When,
|
|
791
791
|
While,
|
|
792
792
|
Yield,
|
|
793
|
-
|
|
793
|
+
JSXImplicitFragment,
|
|
794
|
+
JSXTag,
|
|
794
795
|
JSXElement,
|
|
795
796
|
JSXSelfClosingElement,
|
|
796
797
|
JSXOpeningElement,
|
|
797
798
|
JSXClosingElement,
|
|
798
|
-
TypedJSXFragment,
|
|
799
799
|
JSXFragment,
|
|
800
800
|
JSXElementName,
|
|
801
801
|
JSXIdentifierName,
|
|
@@ -1086,7 +1086,7 @@ ${input.slice(result.pos)}
|
|
|
1086
1086
|
var $R1 = $R(new RegExp("[&]", "suy"));
|
|
1087
1087
|
var $R2 = $R(new RegExp("[!~+-]+", "suy"));
|
|
1088
1088
|
var $R3 = $R(new RegExp("(?:\\p{ID_Start}|[_$])(?:\\p{ID_Continue}|[\\u200C\\u200D$])*", "suy"));
|
|
1089
|
-
var $R4 = $R(new RegExp("[
|
|
1089
|
+
var $R4 = $R(new RegExp("[!+-]", "suy"));
|
|
1090
1090
|
var $R5 = $R(new RegExp("<(?!\\p{ID_Start}|[_$])", "suy"));
|
|
1091
1091
|
var $R6 = $R(new RegExp("[!~+-](?!\\s|[!~+-]*&)", "suy"));
|
|
1092
1092
|
var $R7 = $R(new RegExp("(?=[\\s\\)])", "suy"));
|
|
@@ -1133,12 +1133,13 @@ ${input.slice(result.pos)}
|
|
|
1133
1133
|
var $R48 = $R(new RegExp("(?:-[^-]|[^-]*)*", "suy"));
|
|
1134
1134
|
var $R49 = $R(new RegExp("[^{}<>\\r\\n]+", "suy"));
|
|
1135
1135
|
var $R50 = $R(new RegExp("[+-]?", "suy"));
|
|
1136
|
-
var $R51 = $R(new RegExp("
|
|
1137
|
-
var $R52 = $R(new RegExp("[\\
|
|
1138
|
-
var $R53 = $R(new RegExp("[\\
|
|
1139
|
-
var $R54 = $R(new RegExp("
|
|
1140
|
-
var $R55 = $R(new RegExp("\\
|
|
1141
|
-
var $R56 = $R(new RegExp("
|
|
1136
|
+
var $R51 = $R(new RegExp("[+-]", "suy"));
|
|
1137
|
+
var $R52 = $R(new RegExp("#![^\\r\\n]*", "suy"));
|
|
1138
|
+
var $R53 = $R(new RegExp("[\\t ]*", "suy"));
|
|
1139
|
+
var $R54 = $R(new RegExp("[\\s]*", "suy"));
|
|
1140
|
+
var $R55 = $R(new RegExp("\\s+([+-]?)([a-zA-Z0-9-]+)(\\s*=\\s*([a-zA-Z0-9.+-]*))?", "suy"));
|
|
1141
|
+
var $R56 = $R(new RegExp("\\r\\n|\\n|\\r|$", "suy"));
|
|
1142
|
+
var $R57 = $R(new RegExp("[ \\t]*", "suy"));
|
|
1142
1143
|
var Program$0 = $TS($S(Reset, Init, __, $Q(TopLevelStatement), __), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
1143
1144
|
var statements = $4;
|
|
1144
1145
|
module.processProgram(statements);
|
|
@@ -2159,8 +2160,7 @@ ${input.slice(result.pos)}
|
|
|
2159
2160
|
var PrimaryExpression$7 = RegularExpressionLiteral;
|
|
2160
2161
|
var PrimaryExpression$8 = TemplateLiteral;
|
|
2161
2162
|
var PrimaryExpression$9 = ParenthesizedExpression;
|
|
2162
|
-
var PrimaryExpression$10 =
|
|
2163
|
-
var PrimaryExpression$11 = TypedJSXFragment;
|
|
2163
|
+
var PrimaryExpression$10 = JSXImplicitFragment;
|
|
2164
2164
|
function PrimaryExpression(state) {
|
|
2165
2165
|
if (state.events) {
|
|
2166
2166
|
const result = state.events.enter?.("PrimaryExpression", state);
|
|
@@ -2168,12 +2168,12 @@ ${input.slice(result.pos)}
|
|
|
2168
2168
|
return result.cache;
|
|
2169
2169
|
}
|
|
2170
2170
|
if (state.tokenize) {
|
|
2171
|
-
const result = $TOKEN("PrimaryExpression", state, PrimaryExpression$0(state) || PrimaryExpression$1(state) || PrimaryExpression$2(state) || PrimaryExpression$3(state) || PrimaryExpression$4(state) || PrimaryExpression$5(state) || PrimaryExpression$6(state) || PrimaryExpression$7(state) || PrimaryExpression$8(state) || PrimaryExpression$9(state) || PrimaryExpression$10(state)
|
|
2171
|
+
const result = $TOKEN("PrimaryExpression", state, PrimaryExpression$0(state) || PrimaryExpression$1(state) || PrimaryExpression$2(state) || PrimaryExpression$3(state) || PrimaryExpression$4(state) || PrimaryExpression$5(state) || PrimaryExpression$6(state) || PrimaryExpression$7(state) || PrimaryExpression$8(state) || PrimaryExpression$9(state) || PrimaryExpression$10(state));
|
|
2172
2172
|
if (state.events)
|
|
2173
2173
|
state.events.exit?.("PrimaryExpression", state, result);
|
|
2174
2174
|
return result;
|
|
2175
2175
|
} else {
|
|
2176
|
-
const result = PrimaryExpression$0(state) || PrimaryExpression$1(state) || PrimaryExpression$2(state) || PrimaryExpression$3(state) || PrimaryExpression$4(state) || PrimaryExpression$5(state) || PrimaryExpression$6(state) || PrimaryExpression$7(state) || PrimaryExpression$8(state) || PrimaryExpression$9(state) || PrimaryExpression$10(state)
|
|
2176
|
+
const result = PrimaryExpression$0(state) || PrimaryExpression$1(state) || PrimaryExpression$2(state) || PrimaryExpression$3(state) || PrimaryExpression$4(state) || PrimaryExpression$5(state) || PrimaryExpression$6(state) || PrimaryExpression$7(state) || PrimaryExpression$8(state) || PrimaryExpression$9(state) || PrimaryExpression$10(state);
|
|
2177
2177
|
if (state.events)
|
|
2178
2178
|
state.events.exit?.("PrimaryExpression", state, result);
|
|
2179
2179
|
return result;
|
|
@@ -4777,7 +4777,8 @@ ${input.slice(result.pos)}
|
|
|
4777
4777
|
return result;
|
|
4778
4778
|
}
|
|
4779
4779
|
}
|
|
4780
|
-
var ArrayElementExpression$0 =
|
|
4780
|
+
var ArrayElementExpression$0 = JSXTag;
|
|
4781
|
+
var ArrayElementExpression$1 = $TS($S($E(ExtendedExpression), __, DotDotDot, $Y(ArrayElementDelimiter)), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
4781
4782
|
var exp = $1;
|
|
4782
4783
|
var ws = $2;
|
|
4783
4784
|
var dots = $3;
|
|
@@ -4795,7 +4796,7 @@ ${input.slice(result.pos)}
|
|
|
4795
4796
|
names: exp.names
|
|
4796
4797
|
};
|
|
4797
4798
|
});
|
|
4798
|
-
var ArrayElementExpression$
|
|
4799
|
+
var ArrayElementExpression$2 = $TS($S($E($S($E($S(__, DotDotDot, __)), ExtendedExpression)), $Y(ArrayElementDelimiter)), function($skip, $loc, $0, $1, $2) {
|
|
4799
4800
|
var expMaybeSpread = $1;
|
|
4800
4801
|
if (expMaybeSpread) {
|
|
4801
4802
|
const [spread, exp] = expMaybeSpread;
|
|
@@ -4825,12 +4826,12 @@ ${input.slice(result.pos)}
|
|
|
4825
4826
|
return result.cache;
|
|
4826
4827
|
}
|
|
4827
4828
|
if (state.tokenize) {
|
|
4828
|
-
const result = $TOKEN("ArrayElementExpression", state, ArrayElementExpression$0(state) || ArrayElementExpression$1(state));
|
|
4829
|
+
const result = $TOKEN("ArrayElementExpression", state, ArrayElementExpression$0(state) || ArrayElementExpression$1(state) || ArrayElementExpression$2(state));
|
|
4829
4830
|
if (state.events)
|
|
4830
4831
|
state.events.exit?.("ArrayElementExpression", state, result);
|
|
4831
4832
|
return result;
|
|
4832
4833
|
} else {
|
|
4833
|
-
const result = ArrayElementExpression$0(state) || ArrayElementExpression$1(state);
|
|
4834
|
+
const result = ArrayElementExpression$0(state) || ArrayElementExpression$1(state) || ArrayElementExpression$2(state);
|
|
4834
4835
|
if (state.events)
|
|
4835
4836
|
state.events.exit?.("ArrayElementExpression", state, result);
|
|
4836
4837
|
return result;
|
|
@@ -5156,7 +5157,7 @@ ${input.slice(result.pos)}
|
|
|
5156
5157
|
value
|
|
5157
5158
|
};
|
|
5158
5159
|
});
|
|
5159
|
-
var PropertyDefinition$1 = $TS($S(__, $TEXT($EXPECT($R4, fail, "PropertyDefinition /[
|
|
5160
|
+
var PropertyDefinition$1 = $TS($S(__, $TEXT($EXPECT($R4, fail, "PropertyDefinition /[!+-]/")), IdentifierName), function($skip, $loc, $0, $1, $2, $3) {
|
|
5160
5161
|
var ws = $1;
|
|
5161
5162
|
var toggle = $2;
|
|
5162
5163
|
var id = $3;
|
|
@@ -11001,29 +11002,62 @@ ${input.slice(result.pos)}
|
|
|
11001
11002
|
return result;
|
|
11002
11003
|
}
|
|
11003
11004
|
}
|
|
11004
|
-
var
|
|
11005
|
-
const
|
|
11005
|
+
var JSXImplicitFragment$0 = $TS($S(JSXTag, $Q($S(Samedent, JSXTag))), function($skip, $loc, $0, $1, $2) {
|
|
11006
|
+
const jsx = $2.length === 0 ? $1 : {
|
|
11007
|
+
type: "JSXFragment",
|
|
11008
|
+
children: [
|
|
11009
|
+
"<>\n",
|
|
11010
|
+
module.currentIndent.token,
|
|
11011
|
+
...$0,
|
|
11012
|
+
"\n",
|
|
11013
|
+
module.currentIndent.token,
|
|
11014
|
+
"</>"
|
|
11015
|
+
],
|
|
11016
|
+
jsxChildren: [$1].concat($2.map(([, tag]) => tag))
|
|
11017
|
+
};
|
|
11018
|
+
const type = module.typeOfJSX(jsx);
|
|
11006
11019
|
return type ? [
|
|
11007
11020
|
{ ts: true, children: ["("] },
|
|
11008
|
-
|
|
11021
|
+
jsx,
|
|
11009
11022
|
{ ts: true, children: [" as any as ", type, ")"] }
|
|
11010
|
-
] :
|
|
11023
|
+
] : jsx;
|
|
11011
11024
|
});
|
|
11012
|
-
function
|
|
11025
|
+
function JSXImplicitFragment(state) {
|
|
11026
|
+
if (state.events) {
|
|
11027
|
+
const result = state.events.enter?.("JSXImplicitFragment", state);
|
|
11028
|
+
if (result)
|
|
11029
|
+
return result.cache;
|
|
11030
|
+
}
|
|
11031
|
+
if (state.tokenize) {
|
|
11032
|
+
const result = $TOKEN("JSXImplicitFragment", state, JSXImplicitFragment$0(state));
|
|
11033
|
+
if (state.events)
|
|
11034
|
+
state.events.exit?.("JSXImplicitFragment", state, result);
|
|
11035
|
+
return result;
|
|
11036
|
+
} else {
|
|
11037
|
+
const result = JSXImplicitFragment$0(state);
|
|
11038
|
+
if (state.events)
|
|
11039
|
+
state.events.exit?.("JSXImplicitFragment", state, result);
|
|
11040
|
+
return result;
|
|
11041
|
+
}
|
|
11042
|
+
}
|
|
11043
|
+
var JSXTag$0 = JSXElement;
|
|
11044
|
+
var JSXTag$1 = JSXFragment;
|
|
11045
|
+
var JSXTag$2 = JSXComment;
|
|
11046
|
+
function JSXTag(state) {
|
|
11013
11047
|
if (state.events) {
|
|
11014
|
-
const result = state.events.enter?.("
|
|
11048
|
+
const result = state.events.enter?.("JSXTag", state);
|
|
11015
11049
|
if (result)
|
|
11016
11050
|
return result.cache;
|
|
11017
11051
|
}
|
|
11018
11052
|
if (state.tokenize) {
|
|
11019
|
-
const result = $TOKEN("
|
|
11053
|
+
const result = $TOKEN("JSXTag", state, JSXTag$0(state) || JSXTag$1(state) || JSXTag$2(state));
|
|
11020
11054
|
if (state.events)
|
|
11021
|
-
state.events.exit?.("
|
|
11055
|
+
state.events.exit?.("JSXTag", state, result);
|
|
11022
11056
|
return result;
|
|
11023
11057
|
} else {
|
|
11024
|
-
const result =
|
|
11058
|
+
const result = JSXTag$0(state) || JSXTag$1(state) || JSXTag$2(state);
|
|
11025
11059
|
if (state.events)
|
|
11026
|
-
state.events.exit?.("
|
|
11060
|
+
state.events.exit?.("JSXTag", state, result);
|
|
11027
11061
|
return result;
|
|
11028
11062
|
}
|
|
11029
11063
|
}
|
|
@@ -11122,32 +11156,6 @@ ${input.slice(result.pos)}
|
|
|
11122
11156
|
return result;
|
|
11123
11157
|
}
|
|
11124
11158
|
}
|
|
11125
|
-
var TypedJSXFragment$0 = $TS($S(JSXFragment), function($skip, $loc, $0, $1) {
|
|
11126
|
-
const type = module.typeOfJSXFragment($1);
|
|
11127
|
-
return type ? [
|
|
11128
|
-
{ ts: true, children: ["("] },
|
|
11129
|
-
$1,
|
|
11130
|
-
{ ts: true, children: [" as any as ", type, ")"] }
|
|
11131
|
-
] : $1;
|
|
11132
|
-
});
|
|
11133
|
-
function TypedJSXFragment(state) {
|
|
11134
|
-
if (state.events) {
|
|
11135
|
-
const result = state.events.enter?.("TypedJSXFragment", state);
|
|
11136
|
-
if (result)
|
|
11137
|
-
return result.cache;
|
|
11138
|
-
}
|
|
11139
|
-
if (state.tokenize) {
|
|
11140
|
-
const result = $TOKEN("TypedJSXFragment", state, TypedJSXFragment$0(state));
|
|
11141
|
-
if (state.events)
|
|
11142
|
-
state.events.exit?.("TypedJSXFragment", state, result);
|
|
11143
|
-
return result;
|
|
11144
|
-
} else {
|
|
11145
|
-
const result = TypedJSXFragment$0(state);
|
|
11146
|
-
if (state.events)
|
|
11147
|
-
state.events.exit?.("TypedJSXFragment", state, result);
|
|
11148
|
-
return result;
|
|
11149
|
-
}
|
|
11150
|
-
}
|
|
11151
11159
|
var JSXFragment$0 = $TS($S($EXPECT($L156, fail, 'JSXFragment "<>"'), $E(JSXChildren), $E(Whitespace), $EXPECT($L157, fail, 'JSXFragment "</>"')), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
11152
11160
|
if ($2) {
|
|
11153
11161
|
return { type: "JSXFragment", children: $0, jsxChildren: $2.jsxChildren };
|
|
@@ -11375,6 +11383,12 @@ ${input.slice(result.pos)}
|
|
|
11375
11383
|
class: $2
|
|
11376
11384
|
};
|
|
11377
11385
|
});
|
|
11386
|
+
var JSXAttribute$5 = $TS($S($TEXT($EXPECT($R4, fail, "JSXAttribute /[!+-]/")), JSXAttributeName), function($skip, $loc, $0, $1, $2) {
|
|
11387
|
+
var toggle = $1;
|
|
11388
|
+
var id = $2;
|
|
11389
|
+
const value = toggle === "+" ? "true" : "false";
|
|
11390
|
+
return [" ", id, "={", value, "}"];
|
|
11391
|
+
});
|
|
11378
11392
|
function JSXAttribute(state) {
|
|
11379
11393
|
if (state.events) {
|
|
11380
11394
|
const result = state.events.enter?.("JSXAttribute", state);
|
|
@@ -11382,12 +11396,12 @@ ${input.slice(result.pos)}
|
|
|
11382
11396
|
return result.cache;
|
|
11383
11397
|
}
|
|
11384
11398
|
if (state.tokenize) {
|
|
11385
|
-
const result = $TOKEN("JSXAttribute", state, JSXAttribute$0(state) || JSXAttribute$1(state) || JSXAttribute$2(state) || JSXAttribute$3(state) || JSXAttribute$4(state));
|
|
11399
|
+
const result = $TOKEN("JSXAttribute", state, JSXAttribute$0(state) || JSXAttribute$1(state) || JSXAttribute$2(state) || JSXAttribute$3(state) || JSXAttribute$4(state) || JSXAttribute$5(state));
|
|
11386
11400
|
if (state.events)
|
|
11387
11401
|
state.events.exit?.("JSXAttribute", state, result);
|
|
11388
11402
|
return result;
|
|
11389
11403
|
} else {
|
|
11390
|
-
const result = JSXAttribute$0(state) || JSXAttribute$1(state) || JSXAttribute$2(state) || JSXAttribute$3(state) || JSXAttribute$4(state);
|
|
11404
|
+
const result = JSXAttribute$0(state) || JSXAttribute$1(state) || JSXAttribute$2(state) || JSXAttribute$3(state) || JSXAttribute$4(state) || JSXAttribute$5(state);
|
|
11391
11405
|
if (state.events)
|
|
11392
11406
|
state.events.exit?.("JSXAttribute", state, result);
|
|
11393
11407
|
return result;
|
|
@@ -12296,7 +12310,7 @@ ${input.slice(result.pos)}
|
|
|
12296
12310
|
return result;
|
|
12297
12311
|
}
|
|
12298
12312
|
}
|
|
12299
|
-
var TypeIndexSignature$0 = $S($E($S($R$0($EXPECT($R50, fail, "TypeIndexSignature /[+-]?/")), $EXPECT($L130, fail, 'TypeIndexSignature "readonly"'), __)), OpenBracket, TypeIndex, CloseBracket, $E($S(__, $R$0($EXPECT($
|
|
12313
|
+
var TypeIndexSignature$0 = $S($E($S($R$0($EXPECT($R50, fail, "TypeIndexSignature /[+-]?/")), $EXPECT($L130, fail, 'TypeIndexSignature "readonly"'), __)), OpenBracket, TypeIndex, CloseBracket, $E($S(__, $R$0($EXPECT($R51, fail, "TypeIndexSignature /[+-]/")), QuestionMark)));
|
|
12300
12314
|
function TypeIndexSignature(state) {
|
|
12301
12315
|
if (state.events) {
|
|
12302
12316
|
const result = state.events.enter?.("TypeIndexSignature", state);
|
|
@@ -12898,7 +12912,7 @@ ${input.slice(result.pos)}
|
|
|
12898
12912
|
return result;
|
|
12899
12913
|
}
|
|
12900
12914
|
}
|
|
12901
|
-
var Shebang$0 = $S($R$0($EXPECT($
|
|
12915
|
+
var Shebang$0 = $S($R$0($EXPECT($R52, fail, "Shebang /#![^\\r\\n]*/")), EOL);
|
|
12902
12916
|
function Shebang(state) {
|
|
12903
12917
|
if (state.events) {
|
|
12904
12918
|
const result = state.events.enter?.("Shebang", state);
|
|
@@ -12917,11 +12931,11 @@ ${input.slice(result.pos)}
|
|
|
12917
12931
|
return result;
|
|
12918
12932
|
}
|
|
12919
12933
|
}
|
|
12920
|
-
var CivetPrologue$0 = $T($S($EXPECT($
|
|
12934
|
+
var CivetPrologue$0 = $T($S($EXPECT($R53, fail, "CivetPrologue /[\\t ]*/"), DoubleQuote, CivetPrologueContent, DoubleQuote, $TEXT(StatementDelimiter), $E(EOS)), function(value) {
|
|
12921
12935
|
var content = value[2];
|
|
12922
12936
|
return content;
|
|
12923
12937
|
});
|
|
12924
|
-
var CivetPrologue$1 = $T($S($EXPECT($
|
|
12938
|
+
var CivetPrologue$1 = $T($S($EXPECT($R53, fail, "CivetPrologue /[\\t ]*/"), SingleQuote, CivetPrologueContent, SingleQuote, $TEXT(StatementDelimiter), $E(EOS)), function(value) {
|
|
12925
12939
|
var content = value[2];
|
|
12926
12940
|
return content;
|
|
12927
12941
|
});
|
|
@@ -12943,7 +12957,7 @@ ${input.slice(result.pos)}
|
|
|
12943
12957
|
return result;
|
|
12944
12958
|
}
|
|
12945
12959
|
}
|
|
12946
|
-
var CivetPrologueContent$0 = $TS($S($EXPECT($L168, fail, 'CivetPrologueContent "civet"'), NonIdContinue, $Q(CivetOption), $EXPECT($
|
|
12960
|
+
var CivetPrologueContent$0 = $TS($S($EXPECT($L168, fail, 'CivetPrologueContent "civet"'), NonIdContinue, $Q(CivetOption), $EXPECT($R54, fail, "CivetPrologueContent /[\\s]*/")), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
12947
12961
|
var options = $3;
|
|
12948
12962
|
return {
|
|
12949
12963
|
type: "CivetPrologue",
|
|
@@ -12969,7 +12983,7 @@ ${input.slice(result.pos)}
|
|
|
12969
12983
|
return result;
|
|
12970
12984
|
}
|
|
12971
12985
|
}
|
|
12972
|
-
var CivetOption$0 = $TR($EXPECT($
|
|
12986
|
+
var CivetOption$0 = $TR($EXPECT($R55, 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) {
|
|
12973
12987
|
const optionName = $2.replace(/-+([a-z]?)/g, (_2, l) => {
|
|
12974
12988
|
if (l)
|
|
12975
12989
|
return l.toUpperCase();
|
|
@@ -13001,7 +13015,7 @@ ${input.slice(result.pos)}
|
|
|
13001
13015
|
return result;
|
|
13002
13016
|
}
|
|
13003
13017
|
}
|
|
13004
|
-
var UnknownPrologue$0 = $S($R$0($EXPECT($
|
|
13018
|
+
var UnknownPrologue$0 = $S($R$0($EXPECT($R53, fail, "UnknownPrologue /[\\t ]*/")), BasicStringLiteral, $TEXT(StatementDelimiter), EOS);
|
|
13005
13019
|
function UnknownPrologue(state) {
|
|
13006
13020
|
if (state.events) {
|
|
13007
13021
|
const result = state.events.enter?.("UnknownPrologue", state);
|
|
@@ -13059,7 +13073,7 @@ ${input.slice(result.pos)}
|
|
|
13059
13073
|
return result;
|
|
13060
13074
|
}
|
|
13061
13075
|
}
|
|
13062
|
-
var EOL$0 = $TR($EXPECT($
|
|
13076
|
+
var EOL$0 = $TR($EXPECT($R56, fail, "EOL /\\r\\n|\\n|\\r|$/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
|
|
13063
13077
|
return { $loc, token: $0 };
|
|
13064
13078
|
});
|
|
13065
13079
|
function EOL(state) {
|
|
@@ -13776,12 +13790,20 @@ ${input.slice(result.pos)}
|
|
|
13776
13790
|
declareRef[base](ref);
|
|
13777
13791
|
return refs[base] = ref;
|
|
13778
13792
|
};
|
|
13779
|
-
module.
|
|
13793
|
+
module.typeOfJSX = function(node) {
|
|
13794
|
+
switch (node.type) {
|
|
13795
|
+
case "JSXElement":
|
|
13796
|
+
return module.typeOfJSXElement(node);
|
|
13797
|
+
case "JSXFragment":
|
|
13798
|
+
return module.typeOfJSXFragment(node);
|
|
13799
|
+
}
|
|
13800
|
+
};
|
|
13801
|
+
module.typeOfJSXElement = function(node) {
|
|
13780
13802
|
if (module.config.solid) {
|
|
13781
13803
|
if (module.config.server && !module.config.client) {
|
|
13782
13804
|
return ["string"];
|
|
13783
13805
|
}
|
|
13784
|
-
let open =
|
|
13806
|
+
let open = node.children;
|
|
13785
13807
|
while (Array.isArray(open[0]))
|
|
13786
13808
|
open = open[0];
|
|
13787
13809
|
open = open[1];
|
|
@@ -13793,11 +13815,11 @@ ${input.slice(result.pos)}
|
|
|
13793
13815
|
}
|
|
13794
13816
|
}
|
|
13795
13817
|
};
|
|
13796
|
-
module.typeOfJSXFragment = function(
|
|
13818
|
+
module.typeOfJSXFragment = function(node) {
|
|
13797
13819
|
if (module.config.solid) {
|
|
13798
13820
|
let type = [];
|
|
13799
13821
|
let lastType;
|
|
13800
|
-
for (let child of
|
|
13822
|
+
for (let child of node.jsxChildren) {
|
|
13801
13823
|
switch (child.type) {
|
|
13802
13824
|
case "JSXText":
|
|
13803
13825
|
if (lastType !== "JSXText") {
|
|
@@ -14874,7 +14896,7 @@ ${input.slice(result.pos)}
|
|
|
14874
14896
|
return result;
|
|
14875
14897
|
}
|
|
14876
14898
|
}
|
|
14877
|
-
var Indent$0 = $TR($EXPECT($
|
|
14899
|
+
var Indent$0 = $TR($EXPECT($R57, fail, "Indent /[ \\t]*/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
|
|
14878
14900
|
let level;
|
|
14879
14901
|
if (module.config.tab) {
|
|
14880
14902
|
const tabs = $0.match(/\t/g);
|
|
@@ -15484,7 +15506,7 @@ var uncacheable;
|
|
|
15484
15506
|
({ parse } = import_parser.default);
|
|
15485
15507
|
({ SourceMap: SourceMap2, base64Encode: base64Encode2 } = util_exports);
|
|
15486
15508
|
defaultOptions = {};
|
|
15487
|
-
uncacheable = /* @__PURE__ */ new Set(["TrackIndented", "Samedent", "IndentedFurther", "PushIndent", "PopIndent", "Nested", "InsertIndent", "Arguments", "ArgumentsWithTrailingCallExpressions", "ApplicationStart", "CallExpression", "CallExpressionRest", "LeftHandSideExpression", "ActualAssignment", "UpdateExpression", "UnaryExpression", "BinaryOpExpression", "BinaryOpRHS", "ConditionalExpression", "ShortCircuitExpression", "InlineObjectLiteral", "ImplicitInlineObjectPropertyDelimiter", "ImplicitNestedBlock", "IndentedJSXChildExpression", "NestedJSXChildExpression", "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"]);
|
|
15509
|
+
uncacheable = /* @__PURE__ */ new Set(["TrackIndented", "Samedent", "IndentedFurther", "PushIndent", "PopIndent", "Nested", "InsertIndent", "Arguments", "ArgumentsWithTrailingCallExpressions", "ApplicationStart", "CallExpression", "CallExpressionRest", "LeftHandSideExpression", "ActualAssignment", "UpdateExpression", "UnaryExpression", "BinaryOpExpression", "BinaryOpRHS", "ConditionalExpression", "ShortCircuitExpression", "InlineObjectLiteral", "ImplicitInlineObjectPropertyDelimiter", "FatArrowBody", "ThinArrowFunction", "ArrowFunctionTail", "ArrowFunction", "ImplicitNestedBlock", "BracedBlock", "BracedOrEmptyBlock", "NestedBlockExpression", "NestedBlockExpression", "NestedBlockStatements", "SingleLineStatements", "ExpressionStatement", "Statement", "IndentedJSXChildExpression", "NestedJSXChildExpression", "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", "JSXImplicitFragment", "JSXTag", "JSXElement", "TypedJSXElement", "JSXFragment", "TypedJSXFragment", "JSXChild", "JSXChildren", "JSXNestedChildren", "JSXMixedChildren"]);
|
|
15488
15510
|
var compile = function(src, options = defaultOptions) {
|
|
15489
15511
|
var ast, code, events, filename, sm, srcMapJSON;
|
|
15490
15512
|
filename = options.filename || "unknown";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@danielx/civet",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.26",
|
|
4
4
|
"description": "CoffeeScript style syntax for TypeScript",
|
|
5
5
|
"main": "dist/main.js",
|
|
6
6
|
"module": "dist/main.mjs",
|
|
@@ -46,6 +46,8 @@
|
|
|
46
46
|
"esbuild-coffeescript": "^2.1.0",
|
|
47
47
|
"marked": "^4.2.4",
|
|
48
48
|
"mocha": "^10.0.0",
|
|
49
|
+
"prettier": "^2.8.1",
|
|
50
|
+
"terser": "^5.16.1",
|
|
49
51
|
"ts-node": "^10.9.1",
|
|
50
52
|
"tslib": "^2.4.0",
|
|
51
53
|
"typescript": "^4.7.4",
|