@danielx/civet 0.4.34 → 0.4.35
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 +16 -17
- package/dist/browser.js +108 -17
- package/dist/main.js +108 -17
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -97,7 +97,7 @@ Things Kept from CoffeeScript
|
|
|
97
97
|
- RestElement/RestParameter in any position `(first, ...midle, last) ->` -> `function(first, ...middle) { let [last] = middle.splice(-1)}`
|
|
98
98
|
- `///` Heregexp
|
|
99
99
|
- With some [changes](#things-changed-from-coffeescript).
|
|
100
|
-
- JSX
|
|
100
|
+
- JSX
|
|
101
101
|
|
|
102
102
|
Things Removed from CoffeeScript
|
|
103
103
|
---
|
|
@@ -142,17 +142,7 @@ Things Changed from CoffeeScript
|
|
|
142
142
|
- Postfix iteration/conditionals always wrap the statement [#5431](https://github.com/jashkenas/coffeescript/issues/5431)
|
|
143
143
|
`try x() if y` -> `if (y) try x()`
|
|
144
144
|
- Civet tries to keep the transpiled output verbatim as much as possible.
|
|
145
|
-
In Coffee `(x)` -> `x;` but in Civet `(x)` -> `(x)
|
|
146
|
-
Also in Coffee
|
|
147
|
-
```coffee
|
|
148
|
-
x + 3
|
|
149
|
-
```
|
|
150
|
-
-> `x + 3` without the spacing
|
|
151
|
-
In Civet
|
|
152
|
-
```typescript
|
|
153
|
-
x + 3
|
|
154
|
-
```
|
|
155
|
-
remains as is.
|
|
145
|
+
In Coffee `(x)` -> `x;` but in Civet `(x)` -> `(x)`. Spacing and comments are also preserved as much as possible.
|
|
156
146
|
- Heregex / re.X
|
|
157
147
|
- Stay closer to the [Python spec](https://docs.python.org/3/library/re.html#re.X)
|
|
158
148
|
- Allows both kinds of substitutions `#{..}`, `${..}`.
|
|
@@ -181,8 +171,8 @@ Things Added that CoffeeScript didn't
|
|
|
181
171
|
```
|
|
182
172
|
```typescript
|
|
183
173
|
class A {
|
|
184
|
-
readonly x = 3
|
|
185
|
-
}
|
|
174
|
+
readonly x = 3
|
|
175
|
+
}
|
|
186
176
|
```
|
|
187
177
|
- JS Compatability
|
|
188
178
|
- `var`, `let`, `const`
|
|
@@ -196,7 +186,7 @@ Things Added that CoffeeScript didn't
|
|
|
196
186
|
- `get`/`set` method definitions
|
|
197
187
|
- Private identifiers `#id`
|
|
198
188
|
- Convenience for ES6+ Features
|
|
199
|
-
- Const assignment shorthand `a := b` -> `const a = b
|
|
189
|
+
- Const assignment shorthand `a := b` -> `const a = b`, `{a, b} := c` -> `const {a, b} = c`
|
|
200
190
|
- `@#id` -> `this.#id` shorthand for private identifiers
|
|
201
191
|
- `import` shorthand: `x from ./x` -> `import x from "./x"`
|
|
202
192
|
- `export` shorthand: `export x, y` -> `export {x, y}`
|
|
@@ -211,8 +201,17 @@ Things Added that CoffeeScript didn't
|
|
|
211
201
|
- unary operators `x.map !!&`, -> `x.map($ => !!$)`
|
|
212
202
|
- binary operators `x.map &+1` -> `x.map($ => $+1)`
|
|
213
203
|
- Flagging shorthand [from LiveScript](https://livescript.net/#literals) `{+debug, -live}` -> `{debug: true, live: false}`
|
|
214
|
-
-
|
|
215
|
-
|
|
204
|
+
- JSX enhancements:
|
|
205
|
+
- Indentation: instead of explicitly closing `<tag>`s or `<>`s,
|
|
206
|
+
you can indent the children and Civet will close your tags for you
|
|
207
|
+
- Any braced object literal can be used as an attribute.
|
|
208
|
+
`{foo}` -> `foo={foo}`, `{foo: bar}` -> `foo={bar}`,
|
|
209
|
+
`{...foo}` remains as is; methods and getters/setters work too.
|
|
210
|
+
- Many attribute values (basic literals, array literals, braced object
|
|
211
|
+
literals, regular expressions, template strings, and parenthesized
|
|
212
|
+
expressions) do not need braces. `foo=bar` -> `foo={bar}`
|
|
213
|
+
- Attributes can use computed property names:
|
|
214
|
+
`[expr]={value}` -> `{...{[expr]: value}}`
|
|
216
215
|
- CoffeeScript improvements
|
|
217
216
|
- Postfix loop `run() loop` -> `while(true) run()`
|
|
218
217
|
- Character range literals `["a".."z"]`, `['f'..'a']`, `['0'..'9']`
|
package/dist/browser.js
CHANGED
|
@@ -612,6 +612,7 @@ ${input.slice(result.pos)}
|
|
|
612
612
|
NamedProperty,
|
|
613
613
|
SnugNamedProperty,
|
|
614
614
|
PropertyName,
|
|
615
|
+
ComputedPropertyName,
|
|
615
616
|
Decorator,
|
|
616
617
|
Decorators,
|
|
617
618
|
MethodDefinition,
|
|
@@ -841,6 +842,8 @@ ${input.slice(result.pos)}
|
|
|
841
842
|
JSXAttributeName,
|
|
842
843
|
JSXAttributeInitializer,
|
|
843
844
|
JSXAttributeValue,
|
|
845
|
+
InlineJSXAttributeValue,
|
|
846
|
+
JSXMixedChildren,
|
|
844
847
|
JSXChildren,
|
|
845
848
|
JSXNestedChildren,
|
|
846
849
|
JSXChild,
|
|
@@ -5022,12 +5025,7 @@ ${input.slice(result.pos)}
|
|
|
5022
5025
|
var PropertyName$0 = NumericLiteral;
|
|
5023
5026
|
var PropertyName$1 = StringLiteral;
|
|
5024
5027
|
var PropertyName$2 = IdentifierName;
|
|
5025
|
-
var PropertyName$3 =
|
|
5026
|
-
return {
|
|
5027
|
-
type: "ComputedPropertyName",
|
|
5028
|
-
children: $0
|
|
5029
|
-
};
|
|
5030
|
-
});
|
|
5028
|
+
var PropertyName$3 = ComputedPropertyName;
|
|
5031
5029
|
function PropertyName(state) {
|
|
5032
5030
|
if (state.events) {
|
|
5033
5031
|
const result = state.events.enter?.("PropertyName", state);
|
|
@@ -5046,6 +5044,30 @@ ${input.slice(result.pos)}
|
|
|
5046
5044
|
return result;
|
|
5047
5045
|
}
|
|
5048
5046
|
}
|
|
5047
|
+
var ComputedPropertyName$0 = $TS($S(OpenBracket, ExtendedExpression, __, CloseBracket), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
5048
|
+
return {
|
|
5049
|
+
type: "ComputedPropertyName",
|
|
5050
|
+
children: $0
|
|
5051
|
+
};
|
|
5052
|
+
});
|
|
5053
|
+
function ComputedPropertyName(state) {
|
|
5054
|
+
if (state.events) {
|
|
5055
|
+
const result = state.events.enter?.("ComputedPropertyName", state);
|
|
5056
|
+
if (result)
|
|
5057
|
+
return result.cache;
|
|
5058
|
+
}
|
|
5059
|
+
if (state.tokenize) {
|
|
5060
|
+
const result = $TOKEN("ComputedPropertyName", state, ComputedPropertyName$0(state));
|
|
5061
|
+
if (state.events)
|
|
5062
|
+
state.events.exit?.("ComputedPropertyName", state, result);
|
|
5063
|
+
return result;
|
|
5064
|
+
} else {
|
|
5065
|
+
const result = ComputedPropertyName$0(state);
|
|
5066
|
+
if (state.events)
|
|
5067
|
+
state.events.exit?.("ComputedPropertyName", state, result);
|
|
5068
|
+
return result;
|
|
5069
|
+
}
|
|
5070
|
+
}
|
|
5049
5071
|
var Decorator$0 = $S(AtAt, IdentifierReference, $E(Arguments));
|
|
5050
5072
|
function Decorator(state) {
|
|
5051
5073
|
if (state.events) {
|
|
@@ -10491,11 +10513,10 @@ ${input.slice(result.pos)}
|
|
|
10491
10513
|
return $skip;
|
|
10492
10514
|
return $0;
|
|
10493
10515
|
});
|
|
10494
|
-
var JSXElement$2 = $TS($S(JSXOpeningElement,
|
|
10516
|
+
var JSXElement$2 = $TS($S(JSXOpeningElement, JSXMixedChildren, InsertNewline, InsertIndent), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
10495
10517
|
var open = $1;
|
|
10496
|
-
var
|
|
10497
|
-
|
|
10498
|
-
if (c1.length || c2.length) {
|
|
10518
|
+
var children = $2;
|
|
10519
|
+
if (children.length) {
|
|
10499
10520
|
return [...$0, ["</", open[1], ">"]];
|
|
10500
10521
|
} else {
|
|
10501
10522
|
return [open.slice(0, -1), " />"];
|
|
@@ -10580,7 +10601,7 @@ ${input.slice(result.pos)}
|
|
|
10580
10601
|
}
|
|
10581
10602
|
}
|
|
10582
10603
|
var JSXFragment$0 = $S($EXPECT($L146, fail, 'JSXFragment "<>"'), $E(JSXChildren), $EXPECT($L147, fail, 'JSXFragment "</>"'));
|
|
10583
|
-
var JSXFragment$1 = $TS($S($EXPECT($L146, fail, 'JSXFragment "<>"'),
|
|
10604
|
+
var JSXFragment$1 = $TS($S($EXPECT($L146, fail, 'JSXFragment "<>"'), JSXMixedChildren, InsertNewline, InsertIndent), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
10584
10605
|
return [...$0, "</>"];
|
|
10585
10606
|
});
|
|
10586
10607
|
function JSXFragment(state) {
|
|
@@ -10696,7 +10717,23 @@ ${input.slice(result.pos)}
|
|
|
10696
10717
|
}
|
|
10697
10718
|
return parts;
|
|
10698
10719
|
});
|
|
10699
|
-
var JSXAttribute$1 = $S(JSXAttributeName, $E(JSXAttributeInitializer))
|
|
10720
|
+
var JSXAttribute$1 = $TS($S(JSXAttributeName, $E(JSXAttributeInitializer)), function($skip, $loc, $0, $1, $2) {
|
|
10721
|
+
var name = $1;
|
|
10722
|
+
var value = $2;
|
|
10723
|
+
if (name.type === "ComputedPropertyName") {
|
|
10724
|
+
if (value) {
|
|
10725
|
+
value = value[value.length - 1];
|
|
10726
|
+
if (value[0]?.token === "{" && value[value.length - 1]?.token === "}") {
|
|
10727
|
+
value = value.slice(1, -1);
|
|
10728
|
+
}
|
|
10729
|
+
} else {
|
|
10730
|
+
value = "true";
|
|
10731
|
+
}
|
|
10732
|
+
return ["{...{", name, ": ", value, "}}"];
|
|
10733
|
+
} else {
|
|
10734
|
+
return $0;
|
|
10735
|
+
}
|
|
10736
|
+
});
|
|
10700
10737
|
function JSXAttribute(state) {
|
|
10701
10738
|
if (state.events) {
|
|
10702
10739
|
const result = state.events.enter?.("JSXAttribute", state);
|
|
@@ -10716,6 +10753,7 @@ ${input.slice(result.pos)}
|
|
|
10716
10753
|
}
|
|
10717
10754
|
}
|
|
10718
10755
|
var JSXAttributeName$0 = $S(JSXIdentifierName, $E($S(Colon, JSXIdentifierName)));
|
|
10756
|
+
var JSXAttributeName$1 = ComputedPropertyName;
|
|
10719
10757
|
function JSXAttributeName(state) {
|
|
10720
10758
|
if (state.events) {
|
|
10721
10759
|
const result = state.events.enter?.("JSXAttributeName", state);
|
|
@@ -10723,12 +10761,12 @@ ${input.slice(result.pos)}
|
|
|
10723
10761
|
return result.cache;
|
|
10724
10762
|
}
|
|
10725
10763
|
if (state.tokenize) {
|
|
10726
|
-
const result = $TOKEN("JSXAttributeName", state, JSXAttributeName$0(state));
|
|
10764
|
+
const result = $TOKEN("JSXAttributeName", state, JSXAttributeName$0(state) || JSXAttributeName$1(state));
|
|
10727
10765
|
if (state.events)
|
|
10728
10766
|
state.events.exit?.("JSXAttributeName", state, result);
|
|
10729
10767
|
return result;
|
|
10730
10768
|
} else {
|
|
10731
|
-
const result = JSXAttributeName$0(state);
|
|
10769
|
+
const result = JSXAttributeName$0(state) || JSXAttributeName$1(state);
|
|
10732
10770
|
if (state.events)
|
|
10733
10771
|
state.events.exit?.("JSXAttributeName", state, result);
|
|
10734
10772
|
return result;
|
|
@@ -10758,6 +10796,7 @@ ${input.slice(result.pos)}
|
|
|
10758
10796
|
var JSXAttributeValue$2 = $S(OpenBrace, ExtendedExpression, __, CloseBrace);
|
|
10759
10797
|
var JSXAttributeValue$3 = JSXElement;
|
|
10760
10798
|
var JSXAttributeValue$4 = JSXFragment;
|
|
10799
|
+
var JSXAttributeValue$5 = $S(InsertInlineOpenBrace, InlineJSXAttributeValue, InsertCloseBrace);
|
|
10761
10800
|
function JSXAttributeValue(state) {
|
|
10762
10801
|
if (state.events) {
|
|
10763
10802
|
const result = state.events.enter?.("JSXAttributeValue", state);
|
|
@@ -10765,17 +10804,68 @@ ${input.slice(result.pos)}
|
|
|
10765
10804
|
return result.cache;
|
|
10766
10805
|
}
|
|
10767
10806
|
if (state.tokenize) {
|
|
10768
|
-
const result = $TOKEN("JSXAttributeValue", state, JSXAttributeValue$0(state) || JSXAttributeValue$1(state) || JSXAttributeValue$2(state) || JSXAttributeValue$3(state) || JSXAttributeValue$4(state));
|
|
10807
|
+
const result = $TOKEN("JSXAttributeValue", state, JSXAttributeValue$0(state) || JSXAttributeValue$1(state) || JSXAttributeValue$2(state) || JSXAttributeValue$3(state) || JSXAttributeValue$4(state) || JSXAttributeValue$5(state));
|
|
10769
10808
|
if (state.events)
|
|
10770
10809
|
state.events.exit?.("JSXAttributeValue", state, result);
|
|
10771
10810
|
return result;
|
|
10772
10811
|
} else {
|
|
10773
|
-
const result = JSXAttributeValue$0(state) || JSXAttributeValue$1(state) || JSXAttributeValue$2(state) || JSXAttributeValue$3(state) || JSXAttributeValue$4(state);
|
|
10812
|
+
const result = JSXAttributeValue$0(state) || JSXAttributeValue$1(state) || JSXAttributeValue$2(state) || JSXAttributeValue$3(state) || JSXAttributeValue$4(state) || JSXAttributeValue$5(state);
|
|
10774
10813
|
if (state.events)
|
|
10775
10814
|
state.events.exit?.("JSXAttributeValue", state, result);
|
|
10776
10815
|
return result;
|
|
10777
10816
|
}
|
|
10778
10817
|
}
|
|
10818
|
+
var InlineJSXAttributeValue$0 = NullLiteral;
|
|
10819
|
+
var InlineJSXAttributeValue$1 = BooleanLiteral;
|
|
10820
|
+
var InlineJSXAttributeValue$2 = NumericLiteral;
|
|
10821
|
+
var InlineJSXAttributeValue$3 = ThisLiteral;
|
|
10822
|
+
var InlineJSXAttributeValue$4 = ArrayLiteral;
|
|
10823
|
+
var InlineJSXAttributeValue$5 = BracedObjectLiteral;
|
|
10824
|
+
var InlineJSXAttributeValue$6 = IdentifierReference;
|
|
10825
|
+
var InlineJSXAttributeValue$7 = RegularExpressionLiteral;
|
|
10826
|
+
var InlineJSXAttributeValue$8 = TemplateLiteral;
|
|
10827
|
+
var InlineJSXAttributeValue$9 = ParenthesizedExpression;
|
|
10828
|
+
function InlineJSXAttributeValue(state) {
|
|
10829
|
+
if (state.events) {
|
|
10830
|
+
const result = state.events.enter?.("InlineJSXAttributeValue", state);
|
|
10831
|
+
if (result)
|
|
10832
|
+
return result.cache;
|
|
10833
|
+
}
|
|
10834
|
+
if (state.tokenize) {
|
|
10835
|
+
const result = $TOKEN("InlineJSXAttributeValue", state, InlineJSXAttributeValue$0(state) || InlineJSXAttributeValue$1(state) || InlineJSXAttributeValue$2(state) || InlineJSXAttributeValue$3(state) || InlineJSXAttributeValue$4(state) || InlineJSXAttributeValue$5(state) || InlineJSXAttributeValue$6(state) || InlineJSXAttributeValue$7(state) || InlineJSXAttributeValue$8(state) || InlineJSXAttributeValue$9(state));
|
|
10836
|
+
if (state.events)
|
|
10837
|
+
state.events.exit?.("InlineJSXAttributeValue", state, result);
|
|
10838
|
+
return result;
|
|
10839
|
+
} else {
|
|
10840
|
+
const result = InlineJSXAttributeValue$0(state) || InlineJSXAttributeValue$1(state) || InlineJSXAttributeValue$2(state) || InlineJSXAttributeValue$3(state) || InlineJSXAttributeValue$4(state) || InlineJSXAttributeValue$5(state) || InlineJSXAttributeValue$6(state) || InlineJSXAttributeValue$7(state) || InlineJSXAttributeValue$8(state) || InlineJSXAttributeValue$9(state);
|
|
10841
|
+
if (state.events)
|
|
10842
|
+
state.events.exit?.("InlineJSXAttributeValue", state, result);
|
|
10843
|
+
return result;
|
|
10844
|
+
}
|
|
10845
|
+
}
|
|
10846
|
+
var JSXMixedChildren$0 = $TS($S($Q($C(_, JSXChild)), JSXNestedChildren), function($skip, $loc, $0, $1, $2) {
|
|
10847
|
+
var c1 = $1;
|
|
10848
|
+
var c2 = $2;
|
|
10849
|
+
return c1.concat(c2);
|
|
10850
|
+
});
|
|
10851
|
+
function JSXMixedChildren(state) {
|
|
10852
|
+
if (state.events) {
|
|
10853
|
+
const result = state.events.enter?.("JSXMixedChildren", state);
|
|
10854
|
+
if (result)
|
|
10855
|
+
return result.cache;
|
|
10856
|
+
}
|
|
10857
|
+
if (state.tokenize) {
|
|
10858
|
+
const result = $TOKEN("JSXMixedChildren", state, JSXMixedChildren$0(state));
|
|
10859
|
+
if (state.events)
|
|
10860
|
+
state.events.exit?.("JSXMixedChildren", state, result);
|
|
10861
|
+
return result;
|
|
10862
|
+
} else {
|
|
10863
|
+
const result = JSXMixedChildren$0(state);
|
|
10864
|
+
if (state.events)
|
|
10865
|
+
state.events.exit?.("JSXMixedChildren", state, result);
|
|
10866
|
+
return result;
|
|
10867
|
+
}
|
|
10868
|
+
}
|
|
10779
10869
|
var JSXChildren$0 = $Q($S(__, JSXChild));
|
|
10780
10870
|
function JSXChildren(state) {
|
|
10781
10871
|
if (state.events) {
|
|
@@ -11976,7 +12066,7 @@ ${input.slice(result.pos)}
|
|
|
11976
12066
|
}
|
|
11977
12067
|
}
|
|
11978
12068
|
var InsertInlineOpenBrace$0 = $TV($EXPECT($L0, fail, 'InsertInlineOpenBrace ""'), function($skip, $loc, $0, $1) {
|
|
11979
|
-
return
|
|
12069
|
+
return { $loc, token: "{" };
|
|
11980
12070
|
});
|
|
11981
12071
|
function InsertInlineOpenBrace(state) {
|
|
11982
12072
|
if (state.events) {
|
|
@@ -14042,6 +14132,7 @@ ${"//#"} sourceMappingURL=data:application/json;base64,${base64Encode(JSON.strin
|
|
|
14042
14132
|
case "JSXChildren":
|
|
14043
14133
|
case "JSXFragment":
|
|
14044
14134
|
case "JSXNestedChildren":
|
|
14135
|
+
case "JSXMixedChildren":
|
|
14045
14136
|
break;
|
|
14046
14137
|
default:
|
|
14047
14138
|
cache = /* @__PURE__ */ new Map();
|
package/dist/main.js
CHANGED
|
@@ -611,6 +611,7 @@ ${input.slice(result.pos)}
|
|
|
611
611
|
NamedProperty,
|
|
612
612
|
SnugNamedProperty,
|
|
613
613
|
PropertyName,
|
|
614
|
+
ComputedPropertyName,
|
|
614
615
|
Decorator,
|
|
615
616
|
Decorators,
|
|
616
617
|
MethodDefinition,
|
|
@@ -840,6 +841,8 @@ ${input.slice(result.pos)}
|
|
|
840
841
|
JSXAttributeName,
|
|
841
842
|
JSXAttributeInitializer,
|
|
842
843
|
JSXAttributeValue,
|
|
844
|
+
InlineJSXAttributeValue,
|
|
845
|
+
JSXMixedChildren,
|
|
843
846
|
JSXChildren,
|
|
844
847
|
JSXNestedChildren,
|
|
845
848
|
JSXChild,
|
|
@@ -5021,12 +5024,7 @@ ${input.slice(result.pos)}
|
|
|
5021
5024
|
var PropertyName$0 = NumericLiteral;
|
|
5022
5025
|
var PropertyName$1 = StringLiteral;
|
|
5023
5026
|
var PropertyName$2 = IdentifierName;
|
|
5024
|
-
var PropertyName$3 =
|
|
5025
|
-
return {
|
|
5026
|
-
type: "ComputedPropertyName",
|
|
5027
|
-
children: $0
|
|
5028
|
-
};
|
|
5029
|
-
});
|
|
5027
|
+
var PropertyName$3 = ComputedPropertyName;
|
|
5030
5028
|
function PropertyName(state) {
|
|
5031
5029
|
if (state.events) {
|
|
5032
5030
|
const result = state.events.enter?.("PropertyName", state);
|
|
@@ -5045,6 +5043,30 @@ ${input.slice(result.pos)}
|
|
|
5045
5043
|
return result;
|
|
5046
5044
|
}
|
|
5047
5045
|
}
|
|
5046
|
+
var ComputedPropertyName$0 = $TS($S(OpenBracket, ExtendedExpression, __, CloseBracket), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
5047
|
+
return {
|
|
5048
|
+
type: "ComputedPropertyName",
|
|
5049
|
+
children: $0
|
|
5050
|
+
};
|
|
5051
|
+
});
|
|
5052
|
+
function ComputedPropertyName(state) {
|
|
5053
|
+
if (state.events) {
|
|
5054
|
+
const result = state.events.enter?.("ComputedPropertyName", state);
|
|
5055
|
+
if (result)
|
|
5056
|
+
return result.cache;
|
|
5057
|
+
}
|
|
5058
|
+
if (state.tokenize) {
|
|
5059
|
+
const result = $TOKEN("ComputedPropertyName", state, ComputedPropertyName$0(state));
|
|
5060
|
+
if (state.events)
|
|
5061
|
+
state.events.exit?.("ComputedPropertyName", state, result);
|
|
5062
|
+
return result;
|
|
5063
|
+
} else {
|
|
5064
|
+
const result = ComputedPropertyName$0(state);
|
|
5065
|
+
if (state.events)
|
|
5066
|
+
state.events.exit?.("ComputedPropertyName", state, result);
|
|
5067
|
+
return result;
|
|
5068
|
+
}
|
|
5069
|
+
}
|
|
5048
5070
|
var Decorator$0 = $S(AtAt, IdentifierReference, $E(Arguments));
|
|
5049
5071
|
function Decorator(state) {
|
|
5050
5072
|
if (state.events) {
|
|
@@ -10490,11 +10512,10 @@ ${input.slice(result.pos)}
|
|
|
10490
10512
|
return $skip;
|
|
10491
10513
|
return $0;
|
|
10492
10514
|
});
|
|
10493
|
-
var JSXElement$2 = $TS($S(JSXOpeningElement,
|
|
10515
|
+
var JSXElement$2 = $TS($S(JSXOpeningElement, JSXMixedChildren, InsertNewline, InsertIndent), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
10494
10516
|
var open = $1;
|
|
10495
|
-
var
|
|
10496
|
-
|
|
10497
|
-
if (c1.length || c2.length) {
|
|
10517
|
+
var children = $2;
|
|
10518
|
+
if (children.length) {
|
|
10498
10519
|
return [...$0, ["</", open[1], ">"]];
|
|
10499
10520
|
} else {
|
|
10500
10521
|
return [open.slice(0, -1), " />"];
|
|
@@ -10579,7 +10600,7 @@ ${input.slice(result.pos)}
|
|
|
10579
10600
|
}
|
|
10580
10601
|
}
|
|
10581
10602
|
var JSXFragment$0 = $S($EXPECT($L146, fail, 'JSXFragment "<>"'), $E(JSXChildren), $EXPECT($L147, fail, 'JSXFragment "</>"'));
|
|
10582
|
-
var JSXFragment$1 = $TS($S($EXPECT($L146, fail, 'JSXFragment "<>"'),
|
|
10603
|
+
var JSXFragment$1 = $TS($S($EXPECT($L146, fail, 'JSXFragment "<>"'), JSXMixedChildren, InsertNewline, InsertIndent), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
10583
10604
|
return [...$0, "</>"];
|
|
10584
10605
|
});
|
|
10585
10606
|
function JSXFragment(state) {
|
|
@@ -10695,7 +10716,23 @@ ${input.slice(result.pos)}
|
|
|
10695
10716
|
}
|
|
10696
10717
|
return parts;
|
|
10697
10718
|
});
|
|
10698
|
-
var JSXAttribute$1 = $S(JSXAttributeName, $E(JSXAttributeInitializer))
|
|
10719
|
+
var JSXAttribute$1 = $TS($S(JSXAttributeName, $E(JSXAttributeInitializer)), function($skip, $loc, $0, $1, $2) {
|
|
10720
|
+
var name = $1;
|
|
10721
|
+
var value = $2;
|
|
10722
|
+
if (name.type === "ComputedPropertyName") {
|
|
10723
|
+
if (value) {
|
|
10724
|
+
value = value[value.length - 1];
|
|
10725
|
+
if (value[0]?.token === "{" && value[value.length - 1]?.token === "}") {
|
|
10726
|
+
value = value.slice(1, -1);
|
|
10727
|
+
}
|
|
10728
|
+
} else {
|
|
10729
|
+
value = "true";
|
|
10730
|
+
}
|
|
10731
|
+
return ["{...{", name, ": ", value, "}}"];
|
|
10732
|
+
} else {
|
|
10733
|
+
return $0;
|
|
10734
|
+
}
|
|
10735
|
+
});
|
|
10699
10736
|
function JSXAttribute(state) {
|
|
10700
10737
|
if (state.events) {
|
|
10701
10738
|
const result = state.events.enter?.("JSXAttribute", state);
|
|
@@ -10715,6 +10752,7 @@ ${input.slice(result.pos)}
|
|
|
10715
10752
|
}
|
|
10716
10753
|
}
|
|
10717
10754
|
var JSXAttributeName$0 = $S(JSXIdentifierName, $E($S(Colon, JSXIdentifierName)));
|
|
10755
|
+
var JSXAttributeName$1 = ComputedPropertyName;
|
|
10718
10756
|
function JSXAttributeName(state) {
|
|
10719
10757
|
if (state.events) {
|
|
10720
10758
|
const result = state.events.enter?.("JSXAttributeName", state);
|
|
@@ -10722,12 +10760,12 @@ ${input.slice(result.pos)}
|
|
|
10722
10760
|
return result.cache;
|
|
10723
10761
|
}
|
|
10724
10762
|
if (state.tokenize) {
|
|
10725
|
-
const result = $TOKEN("JSXAttributeName", state, JSXAttributeName$0(state));
|
|
10763
|
+
const result = $TOKEN("JSXAttributeName", state, JSXAttributeName$0(state) || JSXAttributeName$1(state));
|
|
10726
10764
|
if (state.events)
|
|
10727
10765
|
state.events.exit?.("JSXAttributeName", state, result);
|
|
10728
10766
|
return result;
|
|
10729
10767
|
} else {
|
|
10730
|
-
const result = JSXAttributeName$0(state);
|
|
10768
|
+
const result = JSXAttributeName$0(state) || JSXAttributeName$1(state);
|
|
10731
10769
|
if (state.events)
|
|
10732
10770
|
state.events.exit?.("JSXAttributeName", state, result);
|
|
10733
10771
|
return result;
|
|
@@ -10757,6 +10795,7 @@ ${input.slice(result.pos)}
|
|
|
10757
10795
|
var JSXAttributeValue$2 = $S(OpenBrace, ExtendedExpression, __, CloseBrace);
|
|
10758
10796
|
var JSXAttributeValue$3 = JSXElement;
|
|
10759
10797
|
var JSXAttributeValue$4 = JSXFragment;
|
|
10798
|
+
var JSXAttributeValue$5 = $S(InsertInlineOpenBrace, InlineJSXAttributeValue, InsertCloseBrace);
|
|
10760
10799
|
function JSXAttributeValue(state) {
|
|
10761
10800
|
if (state.events) {
|
|
10762
10801
|
const result = state.events.enter?.("JSXAttributeValue", state);
|
|
@@ -10764,17 +10803,68 @@ ${input.slice(result.pos)}
|
|
|
10764
10803
|
return result.cache;
|
|
10765
10804
|
}
|
|
10766
10805
|
if (state.tokenize) {
|
|
10767
|
-
const result = $TOKEN("JSXAttributeValue", state, JSXAttributeValue$0(state) || JSXAttributeValue$1(state) || JSXAttributeValue$2(state) || JSXAttributeValue$3(state) || JSXAttributeValue$4(state));
|
|
10806
|
+
const result = $TOKEN("JSXAttributeValue", state, JSXAttributeValue$0(state) || JSXAttributeValue$1(state) || JSXAttributeValue$2(state) || JSXAttributeValue$3(state) || JSXAttributeValue$4(state) || JSXAttributeValue$5(state));
|
|
10768
10807
|
if (state.events)
|
|
10769
10808
|
state.events.exit?.("JSXAttributeValue", state, result);
|
|
10770
10809
|
return result;
|
|
10771
10810
|
} else {
|
|
10772
|
-
const result = JSXAttributeValue$0(state) || JSXAttributeValue$1(state) || JSXAttributeValue$2(state) || JSXAttributeValue$3(state) || JSXAttributeValue$4(state);
|
|
10811
|
+
const result = JSXAttributeValue$0(state) || JSXAttributeValue$1(state) || JSXAttributeValue$2(state) || JSXAttributeValue$3(state) || JSXAttributeValue$4(state) || JSXAttributeValue$5(state);
|
|
10773
10812
|
if (state.events)
|
|
10774
10813
|
state.events.exit?.("JSXAttributeValue", state, result);
|
|
10775
10814
|
return result;
|
|
10776
10815
|
}
|
|
10777
10816
|
}
|
|
10817
|
+
var InlineJSXAttributeValue$0 = NullLiteral;
|
|
10818
|
+
var InlineJSXAttributeValue$1 = BooleanLiteral;
|
|
10819
|
+
var InlineJSXAttributeValue$2 = NumericLiteral;
|
|
10820
|
+
var InlineJSXAttributeValue$3 = ThisLiteral;
|
|
10821
|
+
var InlineJSXAttributeValue$4 = ArrayLiteral;
|
|
10822
|
+
var InlineJSXAttributeValue$5 = BracedObjectLiteral;
|
|
10823
|
+
var InlineJSXAttributeValue$6 = IdentifierReference;
|
|
10824
|
+
var InlineJSXAttributeValue$7 = RegularExpressionLiteral;
|
|
10825
|
+
var InlineJSXAttributeValue$8 = TemplateLiteral;
|
|
10826
|
+
var InlineJSXAttributeValue$9 = ParenthesizedExpression;
|
|
10827
|
+
function InlineJSXAttributeValue(state) {
|
|
10828
|
+
if (state.events) {
|
|
10829
|
+
const result = state.events.enter?.("InlineJSXAttributeValue", state);
|
|
10830
|
+
if (result)
|
|
10831
|
+
return result.cache;
|
|
10832
|
+
}
|
|
10833
|
+
if (state.tokenize) {
|
|
10834
|
+
const result = $TOKEN("InlineJSXAttributeValue", state, InlineJSXAttributeValue$0(state) || InlineJSXAttributeValue$1(state) || InlineJSXAttributeValue$2(state) || InlineJSXAttributeValue$3(state) || InlineJSXAttributeValue$4(state) || InlineJSXAttributeValue$5(state) || InlineJSXAttributeValue$6(state) || InlineJSXAttributeValue$7(state) || InlineJSXAttributeValue$8(state) || InlineJSXAttributeValue$9(state));
|
|
10835
|
+
if (state.events)
|
|
10836
|
+
state.events.exit?.("InlineJSXAttributeValue", state, result);
|
|
10837
|
+
return result;
|
|
10838
|
+
} else {
|
|
10839
|
+
const result = InlineJSXAttributeValue$0(state) || InlineJSXAttributeValue$1(state) || InlineJSXAttributeValue$2(state) || InlineJSXAttributeValue$3(state) || InlineJSXAttributeValue$4(state) || InlineJSXAttributeValue$5(state) || InlineJSXAttributeValue$6(state) || InlineJSXAttributeValue$7(state) || InlineJSXAttributeValue$8(state) || InlineJSXAttributeValue$9(state);
|
|
10840
|
+
if (state.events)
|
|
10841
|
+
state.events.exit?.("InlineJSXAttributeValue", state, result);
|
|
10842
|
+
return result;
|
|
10843
|
+
}
|
|
10844
|
+
}
|
|
10845
|
+
var JSXMixedChildren$0 = $TS($S($Q($C(_, JSXChild)), JSXNestedChildren), function($skip, $loc, $0, $1, $2) {
|
|
10846
|
+
var c1 = $1;
|
|
10847
|
+
var c2 = $2;
|
|
10848
|
+
return c1.concat(c2);
|
|
10849
|
+
});
|
|
10850
|
+
function JSXMixedChildren(state) {
|
|
10851
|
+
if (state.events) {
|
|
10852
|
+
const result = state.events.enter?.("JSXMixedChildren", state);
|
|
10853
|
+
if (result)
|
|
10854
|
+
return result.cache;
|
|
10855
|
+
}
|
|
10856
|
+
if (state.tokenize) {
|
|
10857
|
+
const result = $TOKEN("JSXMixedChildren", state, JSXMixedChildren$0(state));
|
|
10858
|
+
if (state.events)
|
|
10859
|
+
state.events.exit?.("JSXMixedChildren", state, result);
|
|
10860
|
+
return result;
|
|
10861
|
+
} else {
|
|
10862
|
+
const result = JSXMixedChildren$0(state);
|
|
10863
|
+
if (state.events)
|
|
10864
|
+
state.events.exit?.("JSXMixedChildren", state, result);
|
|
10865
|
+
return result;
|
|
10866
|
+
}
|
|
10867
|
+
}
|
|
10778
10868
|
var JSXChildren$0 = $Q($S(__, JSXChild));
|
|
10779
10869
|
function JSXChildren(state) {
|
|
10780
10870
|
if (state.events) {
|
|
@@ -11975,7 +12065,7 @@ ${input.slice(result.pos)}
|
|
|
11975
12065
|
}
|
|
11976
12066
|
}
|
|
11977
12067
|
var InsertInlineOpenBrace$0 = $TV($EXPECT($L0, fail, 'InsertInlineOpenBrace ""'), function($skip, $loc, $0, $1) {
|
|
11978
|
-
return
|
|
12068
|
+
return { $loc, token: "{" };
|
|
11979
12069
|
});
|
|
11980
12070
|
function InsertInlineOpenBrace(state) {
|
|
11981
12071
|
if (state.events) {
|
|
@@ -14039,6 +14129,7 @@ makeCache = function() {
|
|
|
14039
14129
|
case "JSXChildren":
|
|
14040
14130
|
case "JSXFragment":
|
|
14041
14131
|
case "JSXNestedChildren":
|
|
14132
|
+
case "JSXMixedChildren":
|
|
14042
14133
|
break;
|
|
14043
14134
|
default:
|
|
14044
14135
|
cache = /* @__PURE__ */ new Map();
|