@danielx/civet 0.5.1 → 0.5.3
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 +2 -1
- package/dist/browser.js +85 -58
- package/dist/main.js +85 -58
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Civet
|
|
2
2
|
=====
|
|
3
3
|
|
|
4
|
-
[](https://github.com/DanielXMoore/Civet/actions/workflows/build.yml)
|
|
5
5
|
[](https://www.npmjs.com/package/@danielx/civet)
|
|
6
6
|
[](https://www.npmjs.com/package/@danielx/civet)
|
|
7
7
|
[](https://discord.com/invite/xkrW9GebBc)
|
|
@@ -208,6 +208,7 @@ Things Added that CoffeeScript didn't
|
|
|
208
208
|
- Any braced object literal can be used as an attribute:
|
|
209
209
|
`{foo}` → `foo={foo}`, `{foo: bar}` → `foo={bar}`,
|
|
210
210
|
`{...foo}` remains as is; methods and getters/setters work too.
|
|
211
|
+
- `...foo` shorthand for `{...foo}`
|
|
211
212
|
- Attribute values without whitespace or suitably wrapped
|
|
212
213
|
(parenthesized expressions, strings and template strings,
|
|
213
214
|
regular expressions, array literals, braced object literals)
|
package/dist/browser.js
CHANGED
|
@@ -897,6 +897,7 @@ ${input.slice(result.pos)}
|
|
|
897
897
|
TypeBinaryOp,
|
|
898
898
|
FunctionType,
|
|
899
899
|
TypeArguments,
|
|
900
|
+
CompactTypeArguments,
|
|
900
901
|
TypeParameters,
|
|
901
902
|
TypeParameter,
|
|
902
903
|
TypeConstraint,
|
|
@@ -1307,7 +1308,7 @@ ${input.slice(result.pos)}
|
|
|
1307
1308
|
return result;
|
|
1308
1309
|
}
|
|
1309
1310
|
}
|
|
1310
|
-
var ExplicitArguments$0 = $S(OpenParen, $E(ArgumentList), $E($S(__, Comma)), __, CloseParen);
|
|
1311
|
+
var ExplicitArguments$0 = $S($E(TypeArguments), OpenParen, $E(ArgumentList), $E($S(__, Comma)), __, CloseParen);
|
|
1311
1312
|
function ExplicitArguments(state) {
|
|
1312
1313
|
if (state.events) {
|
|
1313
1314
|
const result = state.events.enter?.("ExplicitArguments", state);
|
|
@@ -2801,7 +2802,7 @@ ${input.slice(result.pos)}
|
|
|
2801
2802
|
}
|
|
2802
2803
|
let blockPrefix;
|
|
2803
2804
|
if (after.length) {
|
|
2804
|
-
const spliceRef = module.
|
|
2805
|
+
const spliceRef = module.getRef("splice");
|
|
2805
2806
|
blockPrefix = {
|
|
2806
2807
|
children: ["[", module.insertTrimmingSpace(after, ""), "] = ", spliceRef, ".call(", restIdentifier, ", -", after.length.toString(), ")"],
|
|
2807
2808
|
names: after.flatMap((p) => p.names)
|
|
@@ -2816,6 +2817,7 @@ ${input.slice(result.pos)}
|
|
|
2816
2817
|
{ ...rest, children: rest.children.slice(0, -1) },
|
|
2817
2818
|
close
|
|
2818
2819
|
],
|
|
2820
|
+
tp,
|
|
2819
2821
|
names,
|
|
2820
2822
|
blockPrefix
|
|
2821
2823
|
};
|
|
@@ -2823,7 +2825,8 @@ ${input.slice(result.pos)}
|
|
|
2823
2825
|
return {
|
|
2824
2826
|
type: "Parameters",
|
|
2825
2827
|
children: [tp, open, ...pes, close],
|
|
2826
|
-
names: pes.flatMap((p) => p.names)
|
|
2828
|
+
names: pes.flatMap((p) => p.names),
|
|
2829
|
+
tp
|
|
2827
2830
|
};
|
|
2828
2831
|
});
|
|
2829
2832
|
function NonEmptyParameters(state) {
|
|
@@ -3126,7 +3129,7 @@ ${input.slice(result.pos)}
|
|
|
3126
3129
|
names.push(...restBinding.names);
|
|
3127
3130
|
}
|
|
3128
3131
|
if (after.length) {
|
|
3129
|
-
const spliceRef = module.
|
|
3132
|
+
const spliceRef = module.getRef("splice");
|
|
3130
3133
|
blockPrefix = {
|
|
3131
3134
|
children: ["[", module.insertTrimmingSpace(after, ""), "] = ", spliceRef, ".call(", restIdentifier, ", -", after.length.toString(), ")"],
|
|
3132
3135
|
names: after.flatMap((p) => p.names)
|
|
@@ -3359,7 +3362,7 @@ ${input.slice(result.pos)}
|
|
|
3359
3362
|
restIdentifier = restBinding.names[0];
|
|
3360
3363
|
}
|
|
3361
3364
|
if (after.length) {
|
|
3362
|
-
const spliceRef = module.
|
|
3365
|
+
const spliceRef = module.getRef("splice");
|
|
3363
3366
|
blockPrefix = {
|
|
3364
3367
|
children: ["[", module.insertTrimmingSpace(after, ""), "] = ", spliceRef, ".call(", restIdentifier, ", -", after.length.toString(), ")"],
|
|
3365
3368
|
names: after.flatMap((p) => p.names)
|
|
@@ -5427,14 +5430,14 @@ ${input.slice(result.pos)}
|
|
|
5427
5430
|
});
|
|
5428
5431
|
var BinaryOpSymbol$29 = $TS($S(CoffeeOfEnabled, $EXPECT($L74, fail, 'BinaryOpSymbol "in"'), NonIdContinue), function($skip, $loc, $0, $1, $2, $3) {
|
|
5429
5432
|
return {
|
|
5430
|
-
ref: module.
|
|
5433
|
+
ref: module.getRef("indexOf"),
|
|
5431
5434
|
suffix: " >= 0",
|
|
5432
5435
|
special: true
|
|
5433
5436
|
};
|
|
5434
5437
|
});
|
|
5435
5438
|
var BinaryOpSymbol$30 = $TS($S(CoffeeOfEnabled, $EXPECT($L73, fail, 'BinaryOpSymbol "not"'), NonIdContinue, __, $EXPECT($L74, fail, 'BinaryOpSymbol "in"'), NonIdContinue), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
|
|
5436
5439
|
return {
|
|
5437
|
-
ref: module.
|
|
5440
|
+
ref: module.getRef("indexOf"),
|
|
5438
5441
|
suffix: " < 0",
|
|
5439
5442
|
special: true
|
|
5440
5443
|
};
|
|
@@ -6245,7 +6248,7 @@ ${input.slice(result.pos)}
|
|
|
6245
6248
|
}
|
|
6246
6249
|
if (declaration.own) {
|
|
6247
6250
|
const indent2 = module.currentIndent.token + " ";
|
|
6248
|
-
const hasPropRef = module.
|
|
6251
|
+
const hasPropRef = module.getRef("hasProp");
|
|
6249
6252
|
blockPrefix.push([indent2, "if (!", hasPropRef, ".call(", exp, ", ", declaration, ")) continue\n"]);
|
|
6250
6253
|
}
|
|
6251
6254
|
kind.token = "in";
|
|
@@ -10601,7 +10604,7 @@ ${input.slice(result.pos)}
|
|
|
10601
10604
|
return result;
|
|
10602
10605
|
}
|
|
10603
10606
|
}
|
|
10604
|
-
var JSXSelfClosingElement$0 = $S($EXPECT($L5, fail, 'JSXSelfClosingElement "<"'), $TEXT(JSXElementName), $E(JSXAttributes), __, $EXPECT($L147, fail, 'JSXSelfClosingElement "/>"'));
|
|
10607
|
+
var JSXSelfClosingElement$0 = $S($EXPECT($L5, fail, 'JSXSelfClosingElement "<"'), $TEXT(JSXElementName), $E(CompactTypeArguments), $E(JSXAttributes), __, $EXPECT($L147, fail, 'JSXSelfClosingElement "/>"'));
|
|
10605
10608
|
function JSXSelfClosingElement(state) {
|
|
10606
10609
|
if (state.events) {
|
|
10607
10610
|
const result = state.events.enter?.("JSXSelfClosingElement", state);
|
|
@@ -10620,7 +10623,7 @@ ${input.slice(result.pos)}
|
|
|
10620
10623
|
return result;
|
|
10621
10624
|
}
|
|
10622
10625
|
}
|
|
10623
|
-
var JSXOpeningElement$0 = $S($EXPECT($L5, fail, 'JSXOpeningElement "<"'), $TEXT(JSXElementName), $E(JSXAttributes), __, $EXPECT($L27, fail, 'JSXOpeningElement ">"'));
|
|
10626
|
+
var JSXOpeningElement$0 = $S($EXPECT($L5, fail, 'JSXOpeningElement "<"'), $TEXT(JSXElementName), $E(CompactTypeArguments), $E(JSXAttributes), __, $EXPECT($L27, fail, 'JSXOpeningElement ">"'));
|
|
10624
10627
|
function JSXOpeningElement(state) {
|
|
10625
10628
|
if (state.events) {
|
|
10626
10629
|
const result = state.events.enter?.("JSXOpeningElement", state);
|
|
@@ -10792,6 +10795,7 @@ ${input.slice(result.pos)}
|
|
|
10792
10795
|
return $0;
|
|
10793
10796
|
}
|
|
10794
10797
|
});
|
|
10798
|
+
var JSXAttribute$2 = $S(InsertInlineOpenBrace, DotDotDot, InlineJSXAttributeValue, InsertCloseBrace);
|
|
10795
10799
|
function JSXAttribute(state) {
|
|
10796
10800
|
if (state.events) {
|
|
10797
10801
|
const result = state.events.enter?.("JSXAttribute", state);
|
|
@@ -10799,12 +10803,12 @@ ${input.slice(result.pos)}
|
|
|
10799
10803
|
return result.cache;
|
|
10800
10804
|
}
|
|
10801
10805
|
if (state.tokenize) {
|
|
10802
|
-
const result = $TOKEN("JSXAttribute", state, JSXAttribute$0(state) || JSXAttribute$1(state));
|
|
10806
|
+
const result = $TOKEN("JSXAttribute", state, JSXAttribute$0(state) || JSXAttribute$1(state) || JSXAttribute$2(state));
|
|
10803
10807
|
if (state.events)
|
|
10804
10808
|
state.events.exit?.("JSXAttribute", state, result);
|
|
10805
10809
|
return result;
|
|
10806
10810
|
} else {
|
|
10807
|
-
const result = JSXAttribute$0(state) || JSXAttribute$1(state);
|
|
10811
|
+
const result = JSXAttribute$0(state) || JSXAttribute$1(state) || JSXAttribute$2(state);
|
|
10808
10812
|
if (state.events)
|
|
10809
10813
|
state.events.exit?.("JSXAttribute", state, result);
|
|
10810
10814
|
return result;
|
|
@@ -12010,9 +12014,36 @@ ${input.slice(result.pos)}
|
|
|
12010
12014
|
return result;
|
|
12011
12015
|
}
|
|
12012
12016
|
}
|
|
12013
|
-
var
|
|
12017
|
+
var CompactTypeArguments$0 = $TS($S($EXPECT($L5, fail, 'CompactTypeArguments "<"'), __, Type, $Q($S(__, Comma, __, Type)), $E($S(__, Comma)), __, $EXPECT($L27, fail, 'CompactTypeArguments ">"')), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7) {
|
|
12014
12018
|
return { ts: true, children: $0 };
|
|
12015
12019
|
});
|
|
12020
|
+
function CompactTypeArguments(state) {
|
|
12021
|
+
if (state.events) {
|
|
12022
|
+
const result = state.events.enter?.("CompactTypeArguments", state);
|
|
12023
|
+
if (result)
|
|
12024
|
+
return result.cache;
|
|
12025
|
+
}
|
|
12026
|
+
if (state.tokenize) {
|
|
12027
|
+
const result = $TOKEN("CompactTypeArguments", state, CompactTypeArguments$0(state));
|
|
12028
|
+
if (state.events)
|
|
12029
|
+
state.events.exit?.("CompactTypeArguments", state, result);
|
|
12030
|
+
return result;
|
|
12031
|
+
} else {
|
|
12032
|
+
const result = CompactTypeArguments$0(state);
|
|
12033
|
+
if (state.events)
|
|
12034
|
+
state.events.exit?.("CompactTypeArguments", state, result);
|
|
12035
|
+
return result;
|
|
12036
|
+
}
|
|
12037
|
+
}
|
|
12038
|
+
var TypeParameters$0 = $TS($S(__, $EXPECT($L5, fail, 'TypeParameters "<"'), $P(TypeParameter), __, $EXPECT($L27, fail, 'TypeParameters ">"')), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
12039
|
+
var parameters = $3;
|
|
12040
|
+
return {
|
|
12041
|
+
type: "TypeParameters",
|
|
12042
|
+
parameters,
|
|
12043
|
+
ts: true,
|
|
12044
|
+
children: $0
|
|
12045
|
+
};
|
|
12046
|
+
});
|
|
12016
12047
|
function TypeParameters(state) {
|
|
12017
12048
|
if (state.events) {
|
|
12018
12049
|
const result = state.events.enter?.("TypeParameters", state);
|
|
@@ -12897,51 +12928,48 @@ ${input.slice(result.pos)}
|
|
|
12897
12928
|
tab: void 0,
|
|
12898
12929
|
verbose: false
|
|
12899
12930
|
};
|
|
12900
|
-
|
|
12901
|
-
const asAny = {
|
|
12931
|
+
module.asAny = {
|
|
12902
12932
|
ts: true,
|
|
12903
12933
|
children: [" as any"]
|
|
12904
12934
|
};
|
|
12905
12935
|
module.prelude = [];
|
|
12906
|
-
|
|
12907
|
-
|
|
12908
|
-
|
|
12909
|
-
|
|
12910
|
-
|
|
12911
|
-
|
|
12912
|
-
|
|
12913
|
-
}
|
|
12914
|
-
|
|
12915
|
-
|
|
12916
|
-
|
|
12917
|
-
|
|
12918
|
-
|
|
12919
|
-
|
|
12920
|
-
|
|
12921
|
-
base: "indexOf",
|
|
12922
|
-
id: "indexOf"
|
|
12923
|
-
};
|
|
12924
|
-
const typeSuffix = {
|
|
12925
|
-
ts: true,
|
|
12926
|
-
children: [": <T>(this: T[], searchElement: T) => boolean"]
|
|
12927
|
-
};
|
|
12928
|
-
module.prelude.push(["", ["const ", indexOfRef, typeSuffix, " = [].indexOf", asAny, "\n"]]);
|
|
12929
|
-
return indexOfRef;
|
|
12936
|
+
const declareRef = {
|
|
12937
|
+
indexOf(indexOfRef) {
|
|
12938
|
+
const typeSuffix = {
|
|
12939
|
+
ts: true,
|
|
12940
|
+
children: [": <T>(this: T[], searchElement: T) => boolean"]
|
|
12941
|
+
};
|
|
12942
|
+
module.prelude.push(["", ["const ", indexOfRef, typeSuffix, " = [].indexOf", module.asAny, "\n"]]);
|
|
12943
|
+
},
|
|
12944
|
+
hasProp(hasPropRef) {
|
|
12945
|
+
const typeSuffix = {
|
|
12946
|
+
ts: true,
|
|
12947
|
+
children: [": <T>(this: T, prop: keyof T) => boolean"]
|
|
12948
|
+
};
|
|
12949
|
+
module.prelude.push(["", ["const ", hasPropRef, typeSuffix, " = {}.hasOwnProperty", module.asAny, "\n"]]);
|
|
12950
|
+
}
|
|
12930
12951
|
};
|
|
12931
|
-
|
|
12932
|
-
|
|
12933
|
-
|
|
12934
|
-
|
|
12952
|
+
const refs = {};
|
|
12953
|
+
module.getRef = function(base) {
|
|
12954
|
+
if (refs.hasOwnProperty(base))
|
|
12955
|
+
return refs[base];
|
|
12956
|
+
const ref = {
|
|
12935
12957
|
type: "Ref",
|
|
12936
|
-
base
|
|
12937
|
-
id:
|
|
12938
|
-
};
|
|
12939
|
-
const typeSuffix = {
|
|
12940
|
-
ts: true,
|
|
12941
|
-
children: [": <T>(this: T, prop: keyof T) => boolean"]
|
|
12958
|
+
base,
|
|
12959
|
+
id: base
|
|
12942
12960
|
};
|
|
12943
|
-
|
|
12944
|
-
|
|
12961
|
+
if (declareRef.hasOwnProperty(base))
|
|
12962
|
+
declareRef[base](ref);
|
|
12963
|
+
return refs[base] = ref;
|
|
12964
|
+
};
|
|
12965
|
+
module.typeOfJSXElement = function($12) {
|
|
12966
|
+
if (module.config.solid) {
|
|
12967
|
+
let open = $12;
|
|
12968
|
+
while (Array.isArray(open[0]))
|
|
12969
|
+
open = open[0];
|
|
12970
|
+
open = open[1];
|
|
12971
|
+
return typeof open === "string" && open[0] === open[0].toLowerCase() ? [module.getRef("IntrinsicElements"), '<"', open, '">'] : ["ReturnType<typeof ", open, ">"];
|
|
12972
|
+
}
|
|
12945
12973
|
};
|
|
12946
12974
|
Object.defineProperty(module.config, "coffeeCompat", {
|
|
12947
12975
|
set(b) {
|
|
@@ -13518,7 +13546,10 @@ ${input.slice(result.pos)}
|
|
|
13518
13546
|
return nodes;
|
|
13519
13547
|
}
|
|
13520
13548
|
function processParams(f) {
|
|
13521
|
-
const { parameters, block } = f;
|
|
13549
|
+
const { type, parameters, block } = f;
|
|
13550
|
+
if (type === "ArrowFunction" && parameters && parameters.tp && parameters.tp.parameters.length === 1) {
|
|
13551
|
+
parameters.tp.parameters.push(",");
|
|
13552
|
+
}
|
|
13522
13553
|
if (!block)
|
|
13523
13554
|
return;
|
|
13524
13555
|
const { expressions } = block;
|
|
@@ -13651,17 +13682,13 @@ ${input.slice(result.pos)}
|
|
|
13651
13682
|
});
|
|
13652
13683
|
}
|
|
13653
13684
|
function checkSpliceRef(statements) {
|
|
13654
|
-
const spliceRef = module.
|
|
13685
|
+
const spliceRef = module.getRef("splice");
|
|
13655
13686
|
if (gatherRecursiveAll(statements, (n) => n === spliceRef).length) {
|
|
13656
13687
|
const typeSuffix = {
|
|
13657
13688
|
ts: true,
|
|
13658
13689
|
children: [": <T>(this: T[], start: number, deleteCount?: number) => T[]"]
|
|
13659
13690
|
};
|
|
13660
|
-
const
|
|
13661
|
-
ts: true,
|
|
13662
|
-
children: [" as any"]
|
|
13663
|
-
};
|
|
13664
|
-
module.prelude.push(["", ["const ", spliceRef, typeSuffix, " = [].splice", asAny, "\n"]]);
|
|
13691
|
+
module.prelude.push(["", ["const ", spliceRef, typeSuffix, " = [].splice", module.asAny, "\n"]]);
|
|
13665
13692
|
}
|
|
13666
13693
|
}
|
|
13667
13694
|
module.attachPostfixStatementAsExpression = function(exp, post) {
|
package/dist/main.js
CHANGED
|
@@ -896,6 +896,7 @@ ${input.slice(result.pos)}
|
|
|
896
896
|
TypeBinaryOp,
|
|
897
897
|
FunctionType,
|
|
898
898
|
TypeArguments,
|
|
899
|
+
CompactTypeArguments,
|
|
899
900
|
TypeParameters,
|
|
900
901
|
TypeParameter,
|
|
901
902
|
TypeConstraint,
|
|
@@ -1306,7 +1307,7 @@ ${input.slice(result.pos)}
|
|
|
1306
1307
|
return result;
|
|
1307
1308
|
}
|
|
1308
1309
|
}
|
|
1309
|
-
var ExplicitArguments$0 = $S(OpenParen, $E(ArgumentList), $E($S(__, Comma)), __, CloseParen);
|
|
1310
|
+
var ExplicitArguments$0 = $S($E(TypeArguments), OpenParen, $E(ArgumentList), $E($S(__, Comma)), __, CloseParen);
|
|
1310
1311
|
function ExplicitArguments(state) {
|
|
1311
1312
|
if (state.events) {
|
|
1312
1313
|
const result = state.events.enter?.("ExplicitArguments", state);
|
|
@@ -2800,7 +2801,7 @@ ${input.slice(result.pos)}
|
|
|
2800
2801
|
}
|
|
2801
2802
|
let blockPrefix;
|
|
2802
2803
|
if (after.length) {
|
|
2803
|
-
const spliceRef = module2.
|
|
2804
|
+
const spliceRef = module2.getRef("splice");
|
|
2804
2805
|
blockPrefix = {
|
|
2805
2806
|
children: ["[", module2.insertTrimmingSpace(after, ""), "] = ", spliceRef, ".call(", restIdentifier, ", -", after.length.toString(), ")"],
|
|
2806
2807
|
names: after.flatMap((p) => p.names)
|
|
@@ -2815,6 +2816,7 @@ ${input.slice(result.pos)}
|
|
|
2815
2816
|
{ ...rest, children: rest.children.slice(0, -1) },
|
|
2816
2817
|
close
|
|
2817
2818
|
],
|
|
2819
|
+
tp,
|
|
2818
2820
|
names,
|
|
2819
2821
|
blockPrefix
|
|
2820
2822
|
};
|
|
@@ -2822,7 +2824,8 @@ ${input.slice(result.pos)}
|
|
|
2822
2824
|
return {
|
|
2823
2825
|
type: "Parameters",
|
|
2824
2826
|
children: [tp, open, ...pes, close],
|
|
2825
|
-
names: pes.flatMap((p) => p.names)
|
|
2827
|
+
names: pes.flatMap((p) => p.names),
|
|
2828
|
+
tp
|
|
2826
2829
|
};
|
|
2827
2830
|
});
|
|
2828
2831
|
function NonEmptyParameters(state) {
|
|
@@ -3125,7 +3128,7 @@ ${input.slice(result.pos)}
|
|
|
3125
3128
|
names.push(...restBinding.names);
|
|
3126
3129
|
}
|
|
3127
3130
|
if (after.length) {
|
|
3128
|
-
const spliceRef = module2.
|
|
3131
|
+
const spliceRef = module2.getRef("splice");
|
|
3129
3132
|
blockPrefix = {
|
|
3130
3133
|
children: ["[", module2.insertTrimmingSpace(after, ""), "] = ", spliceRef, ".call(", restIdentifier, ", -", after.length.toString(), ")"],
|
|
3131
3134
|
names: after.flatMap((p) => p.names)
|
|
@@ -3358,7 +3361,7 @@ ${input.slice(result.pos)}
|
|
|
3358
3361
|
restIdentifier = restBinding.names[0];
|
|
3359
3362
|
}
|
|
3360
3363
|
if (after.length) {
|
|
3361
|
-
const spliceRef = module2.
|
|
3364
|
+
const spliceRef = module2.getRef("splice");
|
|
3362
3365
|
blockPrefix = {
|
|
3363
3366
|
children: ["[", module2.insertTrimmingSpace(after, ""), "] = ", spliceRef, ".call(", restIdentifier, ", -", after.length.toString(), ")"],
|
|
3364
3367
|
names: after.flatMap((p) => p.names)
|
|
@@ -5426,14 +5429,14 @@ ${input.slice(result.pos)}
|
|
|
5426
5429
|
});
|
|
5427
5430
|
var BinaryOpSymbol$29 = $TS($S(CoffeeOfEnabled, $EXPECT($L74, fail, 'BinaryOpSymbol "in"'), NonIdContinue), function($skip, $loc, $0, $1, $2, $3) {
|
|
5428
5431
|
return {
|
|
5429
|
-
ref: module2.
|
|
5432
|
+
ref: module2.getRef("indexOf"),
|
|
5430
5433
|
suffix: " >= 0",
|
|
5431
5434
|
special: true
|
|
5432
5435
|
};
|
|
5433
5436
|
});
|
|
5434
5437
|
var BinaryOpSymbol$30 = $TS($S(CoffeeOfEnabled, $EXPECT($L73, fail, 'BinaryOpSymbol "not"'), NonIdContinue, __, $EXPECT($L74, fail, 'BinaryOpSymbol "in"'), NonIdContinue), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
|
|
5435
5438
|
return {
|
|
5436
|
-
ref: module2.
|
|
5439
|
+
ref: module2.getRef("indexOf"),
|
|
5437
5440
|
suffix: " < 0",
|
|
5438
5441
|
special: true
|
|
5439
5442
|
};
|
|
@@ -6244,7 +6247,7 @@ ${input.slice(result.pos)}
|
|
|
6244
6247
|
}
|
|
6245
6248
|
if (declaration.own) {
|
|
6246
6249
|
const indent2 = module2.currentIndent.token + " ";
|
|
6247
|
-
const hasPropRef = module2.
|
|
6250
|
+
const hasPropRef = module2.getRef("hasProp");
|
|
6248
6251
|
blockPrefix.push([indent2, "if (!", hasPropRef, ".call(", exp, ", ", declaration, ")) continue\n"]);
|
|
6249
6252
|
}
|
|
6250
6253
|
kind.token = "in";
|
|
@@ -10600,7 +10603,7 @@ ${input.slice(result.pos)}
|
|
|
10600
10603
|
return result;
|
|
10601
10604
|
}
|
|
10602
10605
|
}
|
|
10603
|
-
var JSXSelfClosingElement$0 = $S($EXPECT($L5, fail, 'JSXSelfClosingElement "<"'), $TEXT(JSXElementName), $E(JSXAttributes), __, $EXPECT($L147, fail, 'JSXSelfClosingElement "/>"'));
|
|
10606
|
+
var JSXSelfClosingElement$0 = $S($EXPECT($L5, fail, 'JSXSelfClosingElement "<"'), $TEXT(JSXElementName), $E(CompactTypeArguments), $E(JSXAttributes), __, $EXPECT($L147, fail, 'JSXSelfClosingElement "/>"'));
|
|
10604
10607
|
function JSXSelfClosingElement(state) {
|
|
10605
10608
|
if (state.events) {
|
|
10606
10609
|
const result = state.events.enter?.("JSXSelfClosingElement", state);
|
|
@@ -10619,7 +10622,7 @@ ${input.slice(result.pos)}
|
|
|
10619
10622
|
return result;
|
|
10620
10623
|
}
|
|
10621
10624
|
}
|
|
10622
|
-
var JSXOpeningElement$0 = $S($EXPECT($L5, fail, 'JSXOpeningElement "<"'), $TEXT(JSXElementName), $E(JSXAttributes), __, $EXPECT($L27, fail, 'JSXOpeningElement ">"'));
|
|
10625
|
+
var JSXOpeningElement$0 = $S($EXPECT($L5, fail, 'JSXOpeningElement "<"'), $TEXT(JSXElementName), $E(CompactTypeArguments), $E(JSXAttributes), __, $EXPECT($L27, fail, 'JSXOpeningElement ">"'));
|
|
10623
10626
|
function JSXOpeningElement(state) {
|
|
10624
10627
|
if (state.events) {
|
|
10625
10628
|
const result = state.events.enter?.("JSXOpeningElement", state);
|
|
@@ -10791,6 +10794,7 @@ ${input.slice(result.pos)}
|
|
|
10791
10794
|
return $0;
|
|
10792
10795
|
}
|
|
10793
10796
|
});
|
|
10797
|
+
var JSXAttribute$2 = $S(InsertInlineOpenBrace, DotDotDot, InlineJSXAttributeValue, InsertCloseBrace);
|
|
10794
10798
|
function JSXAttribute(state) {
|
|
10795
10799
|
if (state.events) {
|
|
10796
10800
|
const result = state.events.enter?.("JSXAttribute", state);
|
|
@@ -10798,12 +10802,12 @@ ${input.slice(result.pos)}
|
|
|
10798
10802
|
return result.cache;
|
|
10799
10803
|
}
|
|
10800
10804
|
if (state.tokenize) {
|
|
10801
|
-
const result = $TOKEN("JSXAttribute", state, JSXAttribute$0(state) || JSXAttribute$1(state));
|
|
10805
|
+
const result = $TOKEN("JSXAttribute", state, JSXAttribute$0(state) || JSXAttribute$1(state) || JSXAttribute$2(state));
|
|
10802
10806
|
if (state.events)
|
|
10803
10807
|
state.events.exit?.("JSXAttribute", state, result);
|
|
10804
10808
|
return result;
|
|
10805
10809
|
} else {
|
|
10806
|
-
const result = JSXAttribute$0(state) || JSXAttribute$1(state);
|
|
10810
|
+
const result = JSXAttribute$0(state) || JSXAttribute$1(state) || JSXAttribute$2(state);
|
|
10807
10811
|
if (state.events)
|
|
10808
10812
|
state.events.exit?.("JSXAttribute", state, result);
|
|
10809
10813
|
return result;
|
|
@@ -12009,9 +12013,36 @@ ${input.slice(result.pos)}
|
|
|
12009
12013
|
return result;
|
|
12010
12014
|
}
|
|
12011
12015
|
}
|
|
12012
|
-
var
|
|
12016
|
+
var CompactTypeArguments$0 = $TS($S($EXPECT($L5, fail, 'CompactTypeArguments "<"'), __, Type, $Q($S(__, Comma, __, Type)), $E($S(__, Comma)), __, $EXPECT($L27, fail, 'CompactTypeArguments ">"')), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7) {
|
|
12013
12017
|
return { ts: true, children: $0 };
|
|
12014
12018
|
});
|
|
12019
|
+
function CompactTypeArguments(state) {
|
|
12020
|
+
if (state.events) {
|
|
12021
|
+
const result = state.events.enter?.("CompactTypeArguments", state);
|
|
12022
|
+
if (result)
|
|
12023
|
+
return result.cache;
|
|
12024
|
+
}
|
|
12025
|
+
if (state.tokenize) {
|
|
12026
|
+
const result = $TOKEN("CompactTypeArguments", state, CompactTypeArguments$0(state));
|
|
12027
|
+
if (state.events)
|
|
12028
|
+
state.events.exit?.("CompactTypeArguments", state, result);
|
|
12029
|
+
return result;
|
|
12030
|
+
} else {
|
|
12031
|
+
const result = CompactTypeArguments$0(state);
|
|
12032
|
+
if (state.events)
|
|
12033
|
+
state.events.exit?.("CompactTypeArguments", state, result);
|
|
12034
|
+
return result;
|
|
12035
|
+
}
|
|
12036
|
+
}
|
|
12037
|
+
var TypeParameters$0 = $TS($S(__, $EXPECT($L5, fail, 'TypeParameters "<"'), $P(TypeParameter), __, $EXPECT($L27, fail, 'TypeParameters ">"')), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
12038
|
+
var parameters = $3;
|
|
12039
|
+
return {
|
|
12040
|
+
type: "TypeParameters",
|
|
12041
|
+
parameters,
|
|
12042
|
+
ts: true,
|
|
12043
|
+
children: $0
|
|
12044
|
+
};
|
|
12045
|
+
});
|
|
12015
12046
|
function TypeParameters(state) {
|
|
12016
12047
|
if (state.events) {
|
|
12017
12048
|
const result = state.events.enter?.("TypeParameters", state);
|
|
@@ -12896,51 +12927,48 @@ ${input.slice(result.pos)}
|
|
|
12896
12927
|
tab: void 0,
|
|
12897
12928
|
verbose: false
|
|
12898
12929
|
};
|
|
12899
|
-
|
|
12900
|
-
const asAny = {
|
|
12930
|
+
module2.asAny = {
|
|
12901
12931
|
ts: true,
|
|
12902
12932
|
children: [" as any"]
|
|
12903
12933
|
};
|
|
12904
12934
|
module2.prelude = [];
|
|
12905
|
-
|
|
12906
|
-
|
|
12907
|
-
|
|
12908
|
-
|
|
12909
|
-
|
|
12910
|
-
|
|
12911
|
-
|
|
12912
|
-
}
|
|
12913
|
-
|
|
12914
|
-
|
|
12915
|
-
|
|
12916
|
-
|
|
12917
|
-
|
|
12918
|
-
|
|
12919
|
-
|
|
12920
|
-
base: "indexOf",
|
|
12921
|
-
id: "indexOf"
|
|
12922
|
-
};
|
|
12923
|
-
const typeSuffix = {
|
|
12924
|
-
ts: true,
|
|
12925
|
-
children: [": <T>(this: T[], searchElement: T) => boolean"]
|
|
12926
|
-
};
|
|
12927
|
-
module2.prelude.push(["", ["const ", indexOfRef, typeSuffix, " = [].indexOf", asAny, "\n"]]);
|
|
12928
|
-
return indexOfRef;
|
|
12935
|
+
const declareRef = {
|
|
12936
|
+
indexOf(indexOfRef) {
|
|
12937
|
+
const typeSuffix = {
|
|
12938
|
+
ts: true,
|
|
12939
|
+
children: [": <T>(this: T[], searchElement: T) => boolean"]
|
|
12940
|
+
};
|
|
12941
|
+
module2.prelude.push(["", ["const ", indexOfRef, typeSuffix, " = [].indexOf", module2.asAny, "\n"]]);
|
|
12942
|
+
},
|
|
12943
|
+
hasProp(hasPropRef) {
|
|
12944
|
+
const typeSuffix = {
|
|
12945
|
+
ts: true,
|
|
12946
|
+
children: [": <T>(this: T, prop: keyof T) => boolean"]
|
|
12947
|
+
};
|
|
12948
|
+
module2.prelude.push(["", ["const ", hasPropRef, typeSuffix, " = {}.hasOwnProperty", module2.asAny, "\n"]]);
|
|
12949
|
+
}
|
|
12929
12950
|
};
|
|
12930
|
-
|
|
12931
|
-
|
|
12932
|
-
|
|
12933
|
-
|
|
12951
|
+
const refs = {};
|
|
12952
|
+
module2.getRef = function(base) {
|
|
12953
|
+
if (refs.hasOwnProperty(base))
|
|
12954
|
+
return refs[base];
|
|
12955
|
+
const ref = {
|
|
12934
12956
|
type: "Ref",
|
|
12935
|
-
base
|
|
12936
|
-
id:
|
|
12937
|
-
};
|
|
12938
|
-
const typeSuffix = {
|
|
12939
|
-
ts: true,
|
|
12940
|
-
children: [": <T>(this: T, prop: keyof T) => boolean"]
|
|
12957
|
+
base,
|
|
12958
|
+
id: base
|
|
12941
12959
|
};
|
|
12942
|
-
|
|
12943
|
-
|
|
12960
|
+
if (declareRef.hasOwnProperty(base))
|
|
12961
|
+
declareRef[base](ref);
|
|
12962
|
+
return refs[base] = ref;
|
|
12963
|
+
};
|
|
12964
|
+
module2.typeOfJSXElement = function($12) {
|
|
12965
|
+
if (module2.config.solid) {
|
|
12966
|
+
let open = $12;
|
|
12967
|
+
while (Array.isArray(open[0]))
|
|
12968
|
+
open = open[0];
|
|
12969
|
+
open = open[1];
|
|
12970
|
+
return typeof open === "string" && open[0] === open[0].toLowerCase() ? [module2.getRef("IntrinsicElements"), '<"', open, '">'] : ["ReturnType<typeof ", open, ">"];
|
|
12971
|
+
}
|
|
12944
12972
|
};
|
|
12945
12973
|
Object.defineProperty(module2.config, "coffeeCompat", {
|
|
12946
12974
|
set(b) {
|
|
@@ -13517,7 +13545,10 @@ ${input.slice(result.pos)}
|
|
|
13517
13545
|
return nodes;
|
|
13518
13546
|
}
|
|
13519
13547
|
function processParams(f) {
|
|
13520
|
-
const { parameters, block } = f;
|
|
13548
|
+
const { type, parameters, block } = f;
|
|
13549
|
+
if (type === "ArrowFunction" && parameters && parameters.tp && parameters.tp.parameters.length === 1) {
|
|
13550
|
+
parameters.tp.parameters.push(",");
|
|
13551
|
+
}
|
|
13521
13552
|
if (!block)
|
|
13522
13553
|
return;
|
|
13523
13554
|
const { expressions } = block;
|
|
@@ -13650,17 +13681,13 @@ ${input.slice(result.pos)}
|
|
|
13650
13681
|
});
|
|
13651
13682
|
}
|
|
13652
13683
|
function checkSpliceRef(statements) {
|
|
13653
|
-
const spliceRef = module2.
|
|
13684
|
+
const spliceRef = module2.getRef("splice");
|
|
13654
13685
|
if (gatherRecursiveAll(statements, (n) => n === spliceRef).length) {
|
|
13655
13686
|
const typeSuffix = {
|
|
13656
13687
|
ts: true,
|
|
13657
13688
|
children: [": <T>(this: T[], start: number, deleteCount?: number) => T[]"]
|
|
13658
13689
|
};
|
|
13659
|
-
const
|
|
13660
|
-
ts: true,
|
|
13661
|
-
children: [" as any"]
|
|
13662
|
-
};
|
|
13663
|
-
module2.prelude.push(["", ["const ", spliceRef, typeSuffix, " = [].splice", asAny, "\n"]]);
|
|
13690
|
+
module2.prelude.push(["", ["const ", spliceRef, typeSuffix, " = [].splice", module2.asAny, "\n"]]);
|
|
13664
13691
|
}
|
|
13665
13692
|
}
|
|
13666
13693
|
module2.attachPostfixStatementAsExpression = function(exp, post) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@danielx/civet",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.3",
|
|
4
4
|
"description": "CoffeeScript style syntax for TypeScript",
|
|
5
5
|
"main": "dist/main.js",
|
|
6
6
|
"exports": {
|
|
@@ -21,8 +21,9 @@
|
|
|
21
21
|
"node": "^18.6.0 || ^16.17.0"
|
|
22
22
|
},
|
|
23
23
|
"scripts": {
|
|
24
|
-
"prepublishOnly": "yarn build && yarn test",
|
|
25
24
|
"build": "bash ./build/build.sh",
|
|
25
|
+
"npm-release": "bash ./build/npm-release.sh",
|
|
26
|
+
"prepublishOnly": "yarn build && yarn test",
|
|
26
27
|
"test": "c8 mocha"
|
|
27
28
|
},
|
|
28
29
|
"author": "Daniel X. Moore",
|
|
@@ -74,4 +75,4 @@
|
|
|
74
75
|
"test"
|
|
75
76
|
]
|
|
76
77
|
}
|
|
77
|
-
}
|
|
78
|
+
}
|