@danielx/civet 0.5.50 → 0.5.51
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/dist/browser.js +83 -7
- package/dist/main.js +83 -7
- package/dist/main.mjs +83 -7
- package/package.json +1 -1
package/dist/browser.js
CHANGED
|
@@ -953,6 +953,7 @@ ${input.slice(result.pos)}
|
|
|
953
953
|
CoffeeNotEnabled,
|
|
954
954
|
CoffeeOfEnabled,
|
|
955
955
|
CoffeePrototypeEnabled,
|
|
956
|
+
ObjectIsEnabled,
|
|
956
957
|
Reset,
|
|
957
958
|
Init,
|
|
958
959
|
Indent,
|
|
@@ -1133,7 +1134,7 @@ ${input.slice(result.pos)}
|
|
|
1133
1134
|
var $L167 = $L("infer");
|
|
1134
1135
|
var $L168 = $L("[]");
|
|
1135
1136
|
var $L169 = $L("civet");
|
|
1136
|
-
var $R0 = $R(new RegExp("(as|for|of|satisfies|then|when)(?!\\p{ID_Continue}|[\\u200C\\u200D$])", "suy"));
|
|
1137
|
+
var $R0 = $R(new RegExp("(as|for|of|satisfies|then|when|implements)(?!\\p{ID_Continue}|[\\u200C\\u200D$])", "suy"));
|
|
1137
1138
|
var $R1 = $R(new RegExp("[&]", "suy"));
|
|
1138
1139
|
var $R2 = $R(new RegExp("[!~+-]+", "suy"));
|
|
1139
1140
|
var $R3 = $R(new RegExp("(?:\\p{ID_Start}|[_$])(?:\\p{ID_Continue}|[\\u200C\\u200D$])*", "suy"));
|
|
@@ -1486,7 +1487,7 @@ ${input.slice(result.pos)}
|
|
|
1486
1487
|
return result;
|
|
1487
1488
|
}
|
|
1488
1489
|
}
|
|
1489
|
-
var ForbiddenImplicitCalls$0 = $R$0($EXPECT($R0, fail, "ForbiddenImplicitCalls /(as|for|of|satisfies|then|when)(?!\\p{ID_Continue}|[\\u200C\\u200D$])/"));
|
|
1490
|
+
var ForbiddenImplicitCalls$0 = $R$0($EXPECT($R0, fail, "ForbiddenImplicitCalls /(as|for|of|satisfies|then|when|implements)(?!\\p{ID_Continue}|[\\u200C\\u200D$])/"));
|
|
1490
1491
|
var ForbiddenImplicitCalls$1 = $EXPECT($L0, fail, 'ForbiddenImplicitCalls "/ "');
|
|
1491
1492
|
var ForbiddenImplicitCalls$2 = AtAt;
|
|
1492
1493
|
function ForbiddenImplicitCalls(state) {
|
|
@@ -6546,8 +6547,13 @@ ${input.slice(result.pos)}
|
|
|
6546
6547
|
var BinaryOpSymbol$6 = $EXPECT($L54, fail, 'BinaryOpSymbol "-"');
|
|
6547
6548
|
var BinaryOpSymbol$7 = $EXPECT($L55, fail, 'BinaryOpSymbol "<="');
|
|
6548
6549
|
var BinaryOpSymbol$8 = $EXPECT($L56, fail, 'BinaryOpSymbol ">="');
|
|
6549
|
-
var BinaryOpSymbol$9 = $
|
|
6550
|
-
return
|
|
6550
|
+
var BinaryOpSymbol$9 = $TV($EXPECT($L57, fail, 'BinaryOpSymbol "<?"'), function($skip, $loc, $0, $1) {
|
|
6551
|
+
return {
|
|
6552
|
+
$loc,
|
|
6553
|
+
token: "instanceof",
|
|
6554
|
+
relational: true,
|
|
6555
|
+
special: true
|
|
6556
|
+
};
|
|
6551
6557
|
});
|
|
6552
6558
|
var BinaryOpSymbol$10 = $EXPECT($L58, fail, 'BinaryOpSymbol "<<"');
|
|
6553
6559
|
var BinaryOpSymbol$11 = $TR($EXPECT($R5, fail, "BinaryOpSymbol /<(?!\\p{ID_Start}|[_$])/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
|
|
@@ -6595,6 +6601,7 @@ ${input.slice(result.pos)}
|
|
|
6595
6601
|
return {
|
|
6596
6602
|
$loc,
|
|
6597
6603
|
token: "instanceof",
|
|
6604
|
+
relational: true,
|
|
6598
6605
|
special: true,
|
|
6599
6606
|
negated: true
|
|
6600
6607
|
};
|
|
@@ -6642,10 +6649,27 @@ ${input.slice(result.pos)}
|
|
|
6642
6649
|
special: true
|
|
6643
6650
|
};
|
|
6644
6651
|
});
|
|
6645
|
-
var BinaryOpSymbol$34 = $
|
|
6652
|
+
var BinaryOpSymbol$34 = $TS($S($N(CoffeeNotEnabled), $EXPECT($L75, fail, 'BinaryOpSymbol "is"'), NonIdContinue, __, $EXPECT($L73, fail, 'BinaryOpSymbol "not"'), NonIdContinue), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
|
|
6653
|
+
if (module.config.objectIs) {
|
|
6654
|
+
return {
|
|
6655
|
+
call: module.getRef("is"),
|
|
6656
|
+
relational: true,
|
|
6657
|
+
special: true,
|
|
6658
|
+
asConst: true,
|
|
6659
|
+
negated: true
|
|
6660
|
+
};
|
|
6661
|
+
}
|
|
6646
6662
|
return "!==";
|
|
6647
6663
|
});
|
|
6648
|
-
var BinaryOpSymbol$35 = $
|
|
6664
|
+
var BinaryOpSymbol$35 = $TS($S($EXPECT($L75, fail, 'BinaryOpSymbol "is"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
|
|
6665
|
+
if (module.config.objectIs) {
|
|
6666
|
+
return {
|
|
6667
|
+
call: module.getRef("is"),
|
|
6668
|
+
relational: true,
|
|
6669
|
+
special: true,
|
|
6670
|
+
asConst: true
|
|
6671
|
+
};
|
|
6672
|
+
}
|
|
6649
6673
|
return "===";
|
|
6650
6674
|
});
|
|
6651
6675
|
var BinaryOpSymbol$36 = $TS($S($EXPECT($L74, fail, 'BinaryOpSymbol "in"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
|
|
@@ -14604,7 +14628,7 @@ ${input.slice(result.pos)}
|
|
|
14604
14628
|
return result;
|
|
14605
14629
|
}
|
|
14606
14630
|
}
|
|
14607
|
-
var InterfaceExtendsClause$0 = $S(ExtendsToken, InterfaceExtendsTarget);
|
|
14631
|
+
var InterfaceExtendsClause$0 = $S(ExtendsToken, InterfaceExtendsTarget, $Q($S(Comma, InterfaceExtendsTarget)));
|
|
14608
14632
|
function InterfaceExtendsClause(state) {
|
|
14609
14633
|
let eventData;
|
|
14610
14634
|
if (state.events) {
|
|
@@ -16752,6 +16776,33 @@ ${input.slice(result.pos)}
|
|
|
16752
16776
|
return result;
|
|
16753
16777
|
}
|
|
16754
16778
|
}
|
|
16779
|
+
var ObjectIsEnabled$0 = $TV($EXPECT($L14, fail, 'ObjectIsEnabled ""'), function($skip, $loc, $0, $1) {
|
|
16780
|
+
if (module.config.objectIs)
|
|
16781
|
+
return;
|
|
16782
|
+
return $skip;
|
|
16783
|
+
});
|
|
16784
|
+
function ObjectIsEnabled(state) {
|
|
16785
|
+
let eventData;
|
|
16786
|
+
if (state.events) {
|
|
16787
|
+
const result = state.events.enter?.("ObjectIsEnabled", state);
|
|
16788
|
+
if (result) {
|
|
16789
|
+
if (result.cache)
|
|
16790
|
+
return result.cache;
|
|
16791
|
+
eventData = result.data;
|
|
16792
|
+
}
|
|
16793
|
+
}
|
|
16794
|
+
if (state.tokenize) {
|
|
16795
|
+
const result = $TOKEN("ObjectIsEnabled", state, ObjectIsEnabled$0(state));
|
|
16796
|
+
if (state.events)
|
|
16797
|
+
state.events.exit?.("ObjectIsEnabled", state, result, eventData);
|
|
16798
|
+
return result;
|
|
16799
|
+
} else {
|
|
16800
|
+
const result = ObjectIsEnabled$0(state);
|
|
16801
|
+
if (state.events)
|
|
16802
|
+
state.events.exit?.("ObjectIsEnabled", state, result, eventData);
|
|
16803
|
+
return result;
|
|
16804
|
+
}
|
|
16805
|
+
}
|
|
16755
16806
|
var Reset$0 = $TV($EXPECT($L14, fail, 'Reset ""'), function($skip, $loc, $0, $1) {
|
|
16756
16807
|
module.indentLevels = [{
|
|
16757
16808
|
level: 0,
|
|
@@ -16800,6 +16851,7 @@ ${input.slice(result.pos)}
|
|
|
16800
16851
|
coffeeOf: false,
|
|
16801
16852
|
coffeePrototype: false,
|
|
16802
16853
|
implicitReturns: true,
|
|
16854
|
+
objectIs: false,
|
|
16803
16855
|
react: false,
|
|
16804
16856
|
solid: false,
|
|
16805
16857
|
client: false,
|
|
@@ -16811,6 +16863,10 @@ ${input.slice(result.pos)}
|
|
|
16811
16863
|
ts: true,
|
|
16812
16864
|
children: [" as any"]
|
|
16813
16865
|
};
|
|
16866
|
+
module.asConst = {
|
|
16867
|
+
ts: true,
|
|
16868
|
+
children: [" as const"]
|
|
16869
|
+
};
|
|
16814
16870
|
module.prelude = [];
|
|
16815
16871
|
const declareRef = {
|
|
16816
16872
|
indexOf(indexOfRef) {
|
|
@@ -16827,6 +16883,13 @@ ${input.slice(result.pos)}
|
|
|
16827
16883
|
};
|
|
16828
16884
|
module.prelude.push(["", ["const ", hasPropRef, typeSuffix, " = {}.hasOwnProperty", module.asAny, "\n"]]);
|
|
16829
16885
|
},
|
|
16886
|
+
is(isRef) {
|
|
16887
|
+
const typeSuffix = {
|
|
16888
|
+
ts: true,
|
|
16889
|
+
children: [": { <B, A extends B> (a: A, b: B): b is A, <A, B> (a: A, b: B): a is A & B }"]
|
|
16890
|
+
};
|
|
16891
|
+
module.prelude.push(["", ["const ", isRef, typeSuffix, " = Object.is", module.asAny, "\n"]]);
|
|
16892
|
+
},
|
|
16830
16893
|
modulo(moduloRef) {
|
|
16831
16894
|
const typeSuffix = {
|
|
16832
16895
|
ts: true,
|
|
@@ -16886,6 +16949,12 @@ ${input.slice(result.pos)}
|
|
|
16886
16949
|
declareRef[base](ref);
|
|
16887
16950
|
return refs[base] = ref;
|
|
16888
16951
|
};
|
|
16952
|
+
module.makeAsConst = function(node) {
|
|
16953
|
+
if (node.type === "Literal" && node.raw !== "null" || node.type === "ArrayExpression" || node.type === "ObjectExpression") {
|
|
16954
|
+
return { ...node, children: [...node.children, module.asConst] };
|
|
16955
|
+
}
|
|
16956
|
+
return node;
|
|
16957
|
+
};
|
|
16889
16958
|
module.typeOfJSX = function(node) {
|
|
16890
16959
|
switch (node.type) {
|
|
16891
16960
|
case "JSXElement":
|
|
@@ -16965,6 +17034,9 @@ ${input.slice(result.pos)}
|
|
|
16965
17034
|
]) {
|
|
16966
17035
|
module.config[option] = b;
|
|
16967
17036
|
}
|
|
17037
|
+
if (b) {
|
|
17038
|
+
module.config.objectIs = false;
|
|
17039
|
+
}
|
|
16968
17040
|
}
|
|
16969
17041
|
});
|
|
16970
17042
|
module.modifyString = function(str) {
|
|
@@ -17308,6 +17380,10 @@ ${input.slice(result.pos)}
|
|
|
17308
17380
|
const op = expandedOps[i];
|
|
17309
17381
|
if (op.special) {
|
|
17310
17382
|
let [a, wsOp, op2, wsB, b] = expandedOps.slice(i - 2, i + 3);
|
|
17383
|
+
if (op2.asConst) {
|
|
17384
|
+
a = module.makeAsConst(a);
|
|
17385
|
+
b = module.makeAsConst(b);
|
|
17386
|
+
}
|
|
17311
17387
|
let children;
|
|
17312
17388
|
if (op2.call) {
|
|
17313
17389
|
wsOp = module.insertTrimmingSpace(wsOp, "");
|
package/dist/main.js
CHANGED
|
@@ -952,6 +952,7 @@ ${input.slice(result.pos)}
|
|
|
952
952
|
CoffeeNotEnabled,
|
|
953
953
|
CoffeeOfEnabled,
|
|
954
954
|
CoffeePrototypeEnabled,
|
|
955
|
+
ObjectIsEnabled,
|
|
955
956
|
Reset,
|
|
956
957
|
Init,
|
|
957
958
|
Indent,
|
|
@@ -1132,7 +1133,7 @@ ${input.slice(result.pos)}
|
|
|
1132
1133
|
var $L167 = $L("infer");
|
|
1133
1134
|
var $L168 = $L("[]");
|
|
1134
1135
|
var $L169 = $L("civet");
|
|
1135
|
-
var $R0 = $R(new RegExp("(as|for|of|satisfies|then|when)(?!\\p{ID_Continue}|[\\u200C\\u200D$])", "suy"));
|
|
1136
|
+
var $R0 = $R(new RegExp("(as|for|of|satisfies|then|when|implements)(?!\\p{ID_Continue}|[\\u200C\\u200D$])", "suy"));
|
|
1136
1137
|
var $R1 = $R(new RegExp("[&]", "suy"));
|
|
1137
1138
|
var $R2 = $R(new RegExp("[!~+-]+", "suy"));
|
|
1138
1139
|
var $R3 = $R(new RegExp("(?:\\p{ID_Start}|[_$])(?:\\p{ID_Continue}|[\\u200C\\u200D$])*", "suy"));
|
|
@@ -1485,7 +1486,7 @@ ${input.slice(result.pos)}
|
|
|
1485
1486
|
return result;
|
|
1486
1487
|
}
|
|
1487
1488
|
}
|
|
1488
|
-
var ForbiddenImplicitCalls$0 = $R$0($EXPECT($R0, fail, "ForbiddenImplicitCalls /(as|for|of|satisfies|then|when)(?!\\p{ID_Continue}|[\\u200C\\u200D$])/"));
|
|
1489
|
+
var ForbiddenImplicitCalls$0 = $R$0($EXPECT($R0, fail, "ForbiddenImplicitCalls /(as|for|of|satisfies|then|when|implements)(?!\\p{ID_Continue}|[\\u200C\\u200D$])/"));
|
|
1489
1490
|
var ForbiddenImplicitCalls$1 = $EXPECT($L0, fail, 'ForbiddenImplicitCalls "/ "');
|
|
1490
1491
|
var ForbiddenImplicitCalls$2 = AtAt;
|
|
1491
1492
|
function ForbiddenImplicitCalls(state) {
|
|
@@ -6545,8 +6546,13 @@ ${input.slice(result.pos)}
|
|
|
6545
6546
|
var BinaryOpSymbol$6 = $EXPECT($L54, fail, 'BinaryOpSymbol "-"');
|
|
6546
6547
|
var BinaryOpSymbol$7 = $EXPECT($L55, fail, 'BinaryOpSymbol "<="');
|
|
6547
6548
|
var BinaryOpSymbol$8 = $EXPECT($L56, fail, 'BinaryOpSymbol ">="');
|
|
6548
|
-
var BinaryOpSymbol$9 = $
|
|
6549
|
-
return
|
|
6549
|
+
var BinaryOpSymbol$9 = $TV($EXPECT($L57, fail, 'BinaryOpSymbol "<?"'), function($skip, $loc, $0, $1) {
|
|
6550
|
+
return {
|
|
6551
|
+
$loc,
|
|
6552
|
+
token: "instanceof",
|
|
6553
|
+
relational: true,
|
|
6554
|
+
special: true
|
|
6555
|
+
};
|
|
6550
6556
|
});
|
|
6551
6557
|
var BinaryOpSymbol$10 = $EXPECT($L58, fail, 'BinaryOpSymbol "<<"');
|
|
6552
6558
|
var BinaryOpSymbol$11 = $TR($EXPECT($R5, fail, "BinaryOpSymbol /<(?!\\p{ID_Start}|[_$])/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
|
|
@@ -6594,6 +6600,7 @@ ${input.slice(result.pos)}
|
|
|
6594
6600
|
return {
|
|
6595
6601
|
$loc,
|
|
6596
6602
|
token: "instanceof",
|
|
6603
|
+
relational: true,
|
|
6597
6604
|
special: true,
|
|
6598
6605
|
negated: true
|
|
6599
6606
|
};
|
|
@@ -6641,10 +6648,27 @@ ${input.slice(result.pos)}
|
|
|
6641
6648
|
special: true
|
|
6642
6649
|
};
|
|
6643
6650
|
});
|
|
6644
|
-
var BinaryOpSymbol$34 = $
|
|
6651
|
+
var BinaryOpSymbol$34 = $TS($S($N(CoffeeNotEnabled), $EXPECT($L75, fail, 'BinaryOpSymbol "is"'), NonIdContinue, __, $EXPECT($L73, fail, 'BinaryOpSymbol "not"'), NonIdContinue), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
|
|
6652
|
+
if (module2.config.objectIs) {
|
|
6653
|
+
return {
|
|
6654
|
+
call: module2.getRef("is"),
|
|
6655
|
+
relational: true,
|
|
6656
|
+
special: true,
|
|
6657
|
+
asConst: true,
|
|
6658
|
+
negated: true
|
|
6659
|
+
};
|
|
6660
|
+
}
|
|
6645
6661
|
return "!==";
|
|
6646
6662
|
});
|
|
6647
|
-
var BinaryOpSymbol$35 = $
|
|
6663
|
+
var BinaryOpSymbol$35 = $TS($S($EXPECT($L75, fail, 'BinaryOpSymbol "is"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
|
|
6664
|
+
if (module2.config.objectIs) {
|
|
6665
|
+
return {
|
|
6666
|
+
call: module2.getRef("is"),
|
|
6667
|
+
relational: true,
|
|
6668
|
+
special: true,
|
|
6669
|
+
asConst: true
|
|
6670
|
+
};
|
|
6671
|
+
}
|
|
6648
6672
|
return "===";
|
|
6649
6673
|
});
|
|
6650
6674
|
var BinaryOpSymbol$36 = $TS($S($EXPECT($L74, fail, 'BinaryOpSymbol "in"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
|
|
@@ -14603,7 +14627,7 @@ ${input.slice(result.pos)}
|
|
|
14603
14627
|
return result;
|
|
14604
14628
|
}
|
|
14605
14629
|
}
|
|
14606
|
-
var InterfaceExtendsClause$0 = $S(ExtendsToken, InterfaceExtendsTarget);
|
|
14630
|
+
var InterfaceExtendsClause$0 = $S(ExtendsToken, InterfaceExtendsTarget, $Q($S(Comma, InterfaceExtendsTarget)));
|
|
14607
14631
|
function InterfaceExtendsClause(state) {
|
|
14608
14632
|
let eventData;
|
|
14609
14633
|
if (state.events) {
|
|
@@ -16751,6 +16775,33 @@ ${input.slice(result.pos)}
|
|
|
16751
16775
|
return result;
|
|
16752
16776
|
}
|
|
16753
16777
|
}
|
|
16778
|
+
var ObjectIsEnabled$0 = $TV($EXPECT($L14, fail, 'ObjectIsEnabled ""'), function($skip, $loc, $0, $1) {
|
|
16779
|
+
if (module2.config.objectIs)
|
|
16780
|
+
return;
|
|
16781
|
+
return $skip;
|
|
16782
|
+
});
|
|
16783
|
+
function ObjectIsEnabled(state) {
|
|
16784
|
+
let eventData;
|
|
16785
|
+
if (state.events) {
|
|
16786
|
+
const result = state.events.enter?.("ObjectIsEnabled", state);
|
|
16787
|
+
if (result) {
|
|
16788
|
+
if (result.cache)
|
|
16789
|
+
return result.cache;
|
|
16790
|
+
eventData = result.data;
|
|
16791
|
+
}
|
|
16792
|
+
}
|
|
16793
|
+
if (state.tokenize) {
|
|
16794
|
+
const result = $TOKEN("ObjectIsEnabled", state, ObjectIsEnabled$0(state));
|
|
16795
|
+
if (state.events)
|
|
16796
|
+
state.events.exit?.("ObjectIsEnabled", state, result, eventData);
|
|
16797
|
+
return result;
|
|
16798
|
+
} else {
|
|
16799
|
+
const result = ObjectIsEnabled$0(state);
|
|
16800
|
+
if (state.events)
|
|
16801
|
+
state.events.exit?.("ObjectIsEnabled", state, result, eventData);
|
|
16802
|
+
return result;
|
|
16803
|
+
}
|
|
16804
|
+
}
|
|
16754
16805
|
var Reset$0 = $TV($EXPECT($L14, fail, 'Reset ""'), function($skip, $loc, $0, $1) {
|
|
16755
16806
|
module2.indentLevels = [{
|
|
16756
16807
|
level: 0,
|
|
@@ -16799,6 +16850,7 @@ ${input.slice(result.pos)}
|
|
|
16799
16850
|
coffeeOf: false,
|
|
16800
16851
|
coffeePrototype: false,
|
|
16801
16852
|
implicitReturns: true,
|
|
16853
|
+
objectIs: false,
|
|
16802
16854
|
react: false,
|
|
16803
16855
|
solid: false,
|
|
16804
16856
|
client: false,
|
|
@@ -16810,6 +16862,10 @@ ${input.slice(result.pos)}
|
|
|
16810
16862
|
ts: true,
|
|
16811
16863
|
children: [" as any"]
|
|
16812
16864
|
};
|
|
16865
|
+
module2.asConst = {
|
|
16866
|
+
ts: true,
|
|
16867
|
+
children: [" as const"]
|
|
16868
|
+
};
|
|
16813
16869
|
module2.prelude = [];
|
|
16814
16870
|
const declareRef = {
|
|
16815
16871
|
indexOf(indexOfRef) {
|
|
@@ -16826,6 +16882,13 @@ ${input.slice(result.pos)}
|
|
|
16826
16882
|
};
|
|
16827
16883
|
module2.prelude.push(["", ["const ", hasPropRef, typeSuffix, " = {}.hasOwnProperty", module2.asAny, "\n"]]);
|
|
16828
16884
|
},
|
|
16885
|
+
is(isRef) {
|
|
16886
|
+
const typeSuffix = {
|
|
16887
|
+
ts: true,
|
|
16888
|
+
children: [": { <B, A extends B> (a: A, b: B): b is A, <A, B> (a: A, b: B): a is A & B }"]
|
|
16889
|
+
};
|
|
16890
|
+
module2.prelude.push(["", ["const ", isRef, typeSuffix, " = Object.is", module2.asAny, "\n"]]);
|
|
16891
|
+
},
|
|
16829
16892
|
modulo(moduloRef) {
|
|
16830
16893
|
const typeSuffix = {
|
|
16831
16894
|
ts: true,
|
|
@@ -16885,6 +16948,12 @@ ${input.slice(result.pos)}
|
|
|
16885
16948
|
declareRef[base](ref);
|
|
16886
16949
|
return refs[base] = ref;
|
|
16887
16950
|
};
|
|
16951
|
+
module2.makeAsConst = function(node) {
|
|
16952
|
+
if (node.type === "Literal" && node.raw !== "null" || node.type === "ArrayExpression" || node.type === "ObjectExpression") {
|
|
16953
|
+
return { ...node, children: [...node.children, module2.asConst] };
|
|
16954
|
+
}
|
|
16955
|
+
return node;
|
|
16956
|
+
};
|
|
16888
16957
|
module2.typeOfJSX = function(node) {
|
|
16889
16958
|
switch (node.type) {
|
|
16890
16959
|
case "JSXElement":
|
|
@@ -16964,6 +17033,9 @@ ${input.slice(result.pos)}
|
|
|
16964
17033
|
]) {
|
|
16965
17034
|
module2.config[option] = b;
|
|
16966
17035
|
}
|
|
17036
|
+
if (b) {
|
|
17037
|
+
module2.config.objectIs = false;
|
|
17038
|
+
}
|
|
16967
17039
|
}
|
|
16968
17040
|
});
|
|
16969
17041
|
module2.modifyString = function(str) {
|
|
@@ -17307,6 +17379,10 @@ ${input.slice(result.pos)}
|
|
|
17307
17379
|
const op = expandedOps[i];
|
|
17308
17380
|
if (op.special) {
|
|
17309
17381
|
let [a, wsOp, op2, wsB, b] = expandedOps.slice(i - 2, i + 3);
|
|
17382
|
+
if (op2.asConst) {
|
|
17383
|
+
a = module2.makeAsConst(a);
|
|
17384
|
+
b = module2.makeAsConst(b);
|
|
17385
|
+
}
|
|
17310
17386
|
let children;
|
|
17311
17387
|
if (op2.call) {
|
|
17312
17388
|
wsOp = module2.insertTrimmingSpace(wsOp, "");
|
package/dist/main.mjs
CHANGED
|
@@ -950,6 +950,7 @@ ${input.slice(result.pos)}
|
|
|
950
950
|
CoffeeNotEnabled,
|
|
951
951
|
CoffeeOfEnabled,
|
|
952
952
|
CoffeePrototypeEnabled,
|
|
953
|
+
ObjectIsEnabled,
|
|
953
954
|
Reset,
|
|
954
955
|
Init,
|
|
955
956
|
Indent,
|
|
@@ -1130,7 +1131,7 @@ ${input.slice(result.pos)}
|
|
|
1130
1131
|
var $L167 = $L("infer");
|
|
1131
1132
|
var $L168 = $L("[]");
|
|
1132
1133
|
var $L169 = $L("civet");
|
|
1133
|
-
var $R0 = $R(new RegExp("(as|for|of|satisfies|then|when)(?!\\p{ID_Continue}|[\\u200C\\u200D$])", "suy"));
|
|
1134
|
+
var $R0 = $R(new RegExp("(as|for|of|satisfies|then|when|implements)(?!\\p{ID_Continue}|[\\u200C\\u200D$])", "suy"));
|
|
1134
1135
|
var $R1 = $R(new RegExp("[&]", "suy"));
|
|
1135
1136
|
var $R2 = $R(new RegExp("[!~+-]+", "suy"));
|
|
1136
1137
|
var $R3 = $R(new RegExp("(?:\\p{ID_Start}|[_$])(?:\\p{ID_Continue}|[\\u200C\\u200D$])*", "suy"));
|
|
@@ -1483,7 +1484,7 @@ ${input.slice(result.pos)}
|
|
|
1483
1484
|
return result;
|
|
1484
1485
|
}
|
|
1485
1486
|
}
|
|
1486
|
-
var ForbiddenImplicitCalls$0 = $R$0($EXPECT($R0, fail, "ForbiddenImplicitCalls /(as|for|of|satisfies|then|when)(?!\\p{ID_Continue}|[\\u200C\\u200D$])/"));
|
|
1487
|
+
var ForbiddenImplicitCalls$0 = $R$0($EXPECT($R0, fail, "ForbiddenImplicitCalls /(as|for|of|satisfies|then|when|implements)(?!\\p{ID_Continue}|[\\u200C\\u200D$])/"));
|
|
1487
1488
|
var ForbiddenImplicitCalls$1 = $EXPECT($L0, fail, 'ForbiddenImplicitCalls "/ "');
|
|
1488
1489
|
var ForbiddenImplicitCalls$2 = AtAt;
|
|
1489
1490
|
function ForbiddenImplicitCalls(state) {
|
|
@@ -6543,8 +6544,13 @@ ${input.slice(result.pos)}
|
|
|
6543
6544
|
var BinaryOpSymbol$6 = $EXPECT($L54, fail, 'BinaryOpSymbol "-"');
|
|
6544
6545
|
var BinaryOpSymbol$7 = $EXPECT($L55, fail, 'BinaryOpSymbol "<="');
|
|
6545
6546
|
var BinaryOpSymbol$8 = $EXPECT($L56, fail, 'BinaryOpSymbol ">="');
|
|
6546
|
-
var BinaryOpSymbol$9 = $
|
|
6547
|
-
return
|
|
6547
|
+
var BinaryOpSymbol$9 = $TV($EXPECT($L57, fail, 'BinaryOpSymbol "<?"'), function($skip, $loc, $0, $1) {
|
|
6548
|
+
return {
|
|
6549
|
+
$loc,
|
|
6550
|
+
token: "instanceof",
|
|
6551
|
+
relational: true,
|
|
6552
|
+
special: true
|
|
6553
|
+
};
|
|
6548
6554
|
});
|
|
6549
6555
|
var BinaryOpSymbol$10 = $EXPECT($L58, fail, 'BinaryOpSymbol "<<"');
|
|
6550
6556
|
var BinaryOpSymbol$11 = $TR($EXPECT($R5, fail, "BinaryOpSymbol /<(?!\\p{ID_Start}|[_$])/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
|
|
@@ -6592,6 +6598,7 @@ ${input.slice(result.pos)}
|
|
|
6592
6598
|
return {
|
|
6593
6599
|
$loc,
|
|
6594
6600
|
token: "instanceof",
|
|
6601
|
+
relational: true,
|
|
6595
6602
|
special: true,
|
|
6596
6603
|
negated: true
|
|
6597
6604
|
};
|
|
@@ -6639,10 +6646,27 @@ ${input.slice(result.pos)}
|
|
|
6639
6646
|
special: true
|
|
6640
6647
|
};
|
|
6641
6648
|
});
|
|
6642
|
-
var BinaryOpSymbol$34 = $
|
|
6649
|
+
var BinaryOpSymbol$34 = $TS($S($N(CoffeeNotEnabled), $EXPECT($L75, fail, 'BinaryOpSymbol "is"'), NonIdContinue, __, $EXPECT($L73, fail, 'BinaryOpSymbol "not"'), NonIdContinue), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
|
|
6650
|
+
if (module.config.objectIs) {
|
|
6651
|
+
return {
|
|
6652
|
+
call: module.getRef("is"),
|
|
6653
|
+
relational: true,
|
|
6654
|
+
special: true,
|
|
6655
|
+
asConst: true,
|
|
6656
|
+
negated: true
|
|
6657
|
+
};
|
|
6658
|
+
}
|
|
6643
6659
|
return "!==";
|
|
6644
6660
|
});
|
|
6645
|
-
var BinaryOpSymbol$35 = $
|
|
6661
|
+
var BinaryOpSymbol$35 = $TS($S($EXPECT($L75, fail, 'BinaryOpSymbol "is"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
|
|
6662
|
+
if (module.config.objectIs) {
|
|
6663
|
+
return {
|
|
6664
|
+
call: module.getRef("is"),
|
|
6665
|
+
relational: true,
|
|
6666
|
+
special: true,
|
|
6667
|
+
asConst: true
|
|
6668
|
+
};
|
|
6669
|
+
}
|
|
6646
6670
|
return "===";
|
|
6647
6671
|
});
|
|
6648
6672
|
var BinaryOpSymbol$36 = $TS($S($EXPECT($L74, fail, 'BinaryOpSymbol "in"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
|
|
@@ -14601,7 +14625,7 @@ ${input.slice(result.pos)}
|
|
|
14601
14625
|
return result;
|
|
14602
14626
|
}
|
|
14603
14627
|
}
|
|
14604
|
-
var InterfaceExtendsClause$0 = $S(ExtendsToken, InterfaceExtendsTarget);
|
|
14628
|
+
var InterfaceExtendsClause$0 = $S(ExtendsToken, InterfaceExtendsTarget, $Q($S(Comma, InterfaceExtendsTarget)));
|
|
14605
14629
|
function InterfaceExtendsClause(state) {
|
|
14606
14630
|
let eventData;
|
|
14607
14631
|
if (state.events) {
|
|
@@ -16749,6 +16773,33 @@ ${input.slice(result.pos)}
|
|
|
16749
16773
|
return result;
|
|
16750
16774
|
}
|
|
16751
16775
|
}
|
|
16776
|
+
var ObjectIsEnabled$0 = $TV($EXPECT($L14, fail, 'ObjectIsEnabled ""'), function($skip, $loc, $0, $1) {
|
|
16777
|
+
if (module.config.objectIs)
|
|
16778
|
+
return;
|
|
16779
|
+
return $skip;
|
|
16780
|
+
});
|
|
16781
|
+
function ObjectIsEnabled(state) {
|
|
16782
|
+
let eventData;
|
|
16783
|
+
if (state.events) {
|
|
16784
|
+
const result = state.events.enter?.("ObjectIsEnabled", state);
|
|
16785
|
+
if (result) {
|
|
16786
|
+
if (result.cache)
|
|
16787
|
+
return result.cache;
|
|
16788
|
+
eventData = result.data;
|
|
16789
|
+
}
|
|
16790
|
+
}
|
|
16791
|
+
if (state.tokenize) {
|
|
16792
|
+
const result = $TOKEN("ObjectIsEnabled", state, ObjectIsEnabled$0(state));
|
|
16793
|
+
if (state.events)
|
|
16794
|
+
state.events.exit?.("ObjectIsEnabled", state, result, eventData);
|
|
16795
|
+
return result;
|
|
16796
|
+
} else {
|
|
16797
|
+
const result = ObjectIsEnabled$0(state);
|
|
16798
|
+
if (state.events)
|
|
16799
|
+
state.events.exit?.("ObjectIsEnabled", state, result, eventData);
|
|
16800
|
+
return result;
|
|
16801
|
+
}
|
|
16802
|
+
}
|
|
16752
16803
|
var Reset$0 = $TV($EXPECT($L14, fail, 'Reset ""'), function($skip, $loc, $0, $1) {
|
|
16753
16804
|
module.indentLevels = [{
|
|
16754
16805
|
level: 0,
|
|
@@ -16797,6 +16848,7 @@ ${input.slice(result.pos)}
|
|
|
16797
16848
|
coffeeOf: false,
|
|
16798
16849
|
coffeePrototype: false,
|
|
16799
16850
|
implicitReturns: true,
|
|
16851
|
+
objectIs: false,
|
|
16800
16852
|
react: false,
|
|
16801
16853
|
solid: false,
|
|
16802
16854
|
client: false,
|
|
@@ -16808,6 +16860,10 @@ ${input.slice(result.pos)}
|
|
|
16808
16860
|
ts: true,
|
|
16809
16861
|
children: [" as any"]
|
|
16810
16862
|
};
|
|
16863
|
+
module.asConst = {
|
|
16864
|
+
ts: true,
|
|
16865
|
+
children: [" as const"]
|
|
16866
|
+
};
|
|
16811
16867
|
module.prelude = [];
|
|
16812
16868
|
const declareRef = {
|
|
16813
16869
|
indexOf(indexOfRef) {
|
|
@@ -16824,6 +16880,13 @@ ${input.slice(result.pos)}
|
|
|
16824
16880
|
};
|
|
16825
16881
|
module.prelude.push(["", ["const ", hasPropRef, typeSuffix, " = {}.hasOwnProperty", module.asAny, "\n"]]);
|
|
16826
16882
|
},
|
|
16883
|
+
is(isRef) {
|
|
16884
|
+
const typeSuffix = {
|
|
16885
|
+
ts: true,
|
|
16886
|
+
children: [": { <B, A extends B> (a: A, b: B): b is A, <A, B> (a: A, b: B): a is A & B }"]
|
|
16887
|
+
};
|
|
16888
|
+
module.prelude.push(["", ["const ", isRef, typeSuffix, " = Object.is", module.asAny, "\n"]]);
|
|
16889
|
+
},
|
|
16827
16890
|
modulo(moduloRef) {
|
|
16828
16891
|
const typeSuffix = {
|
|
16829
16892
|
ts: true,
|
|
@@ -16883,6 +16946,12 @@ ${input.slice(result.pos)}
|
|
|
16883
16946
|
declareRef[base](ref);
|
|
16884
16947
|
return refs[base] = ref;
|
|
16885
16948
|
};
|
|
16949
|
+
module.makeAsConst = function(node) {
|
|
16950
|
+
if (node.type === "Literal" && node.raw !== "null" || node.type === "ArrayExpression" || node.type === "ObjectExpression") {
|
|
16951
|
+
return { ...node, children: [...node.children, module.asConst] };
|
|
16952
|
+
}
|
|
16953
|
+
return node;
|
|
16954
|
+
};
|
|
16886
16955
|
module.typeOfJSX = function(node) {
|
|
16887
16956
|
switch (node.type) {
|
|
16888
16957
|
case "JSXElement":
|
|
@@ -16962,6 +17031,9 @@ ${input.slice(result.pos)}
|
|
|
16962
17031
|
]) {
|
|
16963
17032
|
module.config[option] = b;
|
|
16964
17033
|
}
|
|
17034
|
+
if (b) {
|
|
17035
|
+
module.config.objectIs = false;
|
|
17036
|
+
}
|
|
16965
17037
|
}
|
|
16966
17038
|
});
|
|
16967
17039
|
module.modifyString = function(str) {
|
|
@@ -17305,6 +17377,10 @@ ${input.slice(result.pos)}
|
|
|
17305
17377
|
const op = expandedOps[i];
|
|
17306
17378
|
if (op.special) {
|
|
17307
17379
|
let [a, wsOp, op2, wsB, b] = expandedOps.slice(i - 2, i + 3);
|
|
17380
|
+
if (op2.asConst) {
|
|
17381
|
+
a = module.makeAsConst(a);
|
|
17382
|
+
b = module.makeAsConst(b);
|
|
17383
|
+
}
|
|
17308
17384
|
let children;
|
|
17309
17385
|
if (op2.call) {
|
|
17310
17386
|
wsOp = module.insertTrimmingSpace(wsOp, "");
|