@batijs/core 0.0.11 → 0.0.12
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/index.js +106 -114
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -19684,9 +19684,9 @@ var require_main3 = __commonJS({
|
|
|
19684
19684
|
}
|
|
19685
19685
|
});
|
|
19686
19686
|
|
|
19687
|
-
// ../../node_modules/.pnpm/@babel+parser@7.21.
|
|
19687
|
+
// ../../node_modules/.pnpm/@babel+parser@7.21.8/node_modules/@babel/parser/lib/index.js
|
|
19688
19688
|
var require_lib = __commonJS({
|
|
19689
|
-
"../../node_modules/.pnpm/@babel+parser@7.21.
|
|
19689
|
+
"../../node_modules/.pnpm/@babel+parser@7.21.8/node_modules/@babel/parser/lib/index.js"(exports) {
|
|
19690
19690
|
"use strict";
|
|
19691
19691
|
init_esm_shims();
|
|
19692
19692
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -20390,7 +20390,6 @@ var require_lib = __commonJS({
|
|
|
20390
20390
|
AwaitBindingIdentifier: "Can not use 'await' as identifier inside an async function.",
|
|
20391
20391
|
AwaitBindingIdentifierInStaticBlock: "Can not use 'await' as identifier inside a static block.",
|
|
20392
20392
|
AwaitExpressionFormalParameter: "'await' is not allowed in async function parameters.",
|
|
20393
|
-
AwaitInUsingBinding: "'await' is not allowed to be used as a name in 'using' declarations.",
|
|
20394
20393
|
AwaitNotInAsyncContext: "'await' is only allowed within async functions and at the top levels of modules.",
|
|
20395
20394
|
AwaitNotInAsyncFunction: "'await' is only allowed within async functions.",
|
|
20396
20395
|
BadGetterArity: "A 'get' accessor must not have any formal parameters.",
|
|
@@ -24032,14 +24031,14 @@ var require_lib = __commonJS({
|
|
|
24032
24031
|
node.typeParameters = null;
|
|
24033
24032
|
}
|
|
24034
24033
|
node.extends = [];
|
|
24035
|
-
node.implements = [];
|
|
24036
|
-
node.mixins = [];
|
|
24037
24034
|
if (this.eat(81)) {
|
|
24038
24035
|
do {
|
|
24039
24036
|
node.extends.push(this.flowParseInterfaceExtends());
|
|
24040
24037
|
} while (!isClass && this.eat(12));
|
|
24041
24038
|
}
|
|
24042
24039
|
if (isClass) {
|
|
24040
|
+
node.implements = [];
|
|
24041
|
+
node.mixins = [];
|
|
24043
24042
|
if (this.eatContextual(115)) {
|
|
24044
24043
|
do {
|
|
24045
24044
|
node.mixins.push(this.flowParseInterfaceExtends());
|
|
@@ -27768,15 +27767,19 @@ var require_lib = __commonJS({
|
|
|
27768
27767
|
}
|
|
27769
27768
|
}
|
|
27770
27769
|
tsParseBindingListForSignature() {
|
|
27771
|
-
|
|
27772
|
-
|
|
27770
|
+
const list = super.parseBindingList(11, 41, 2);
|
|
27771
|
+
for (const pattern of list) {
|
|
27772
|
+
const {
|
|
27773
|
+
type
|
|
27774
|
+
} = pattern;
|
|
27775
|
+
if (type === "AssignmentPattern" || type === "TSParameterProperty") {
|
|
27773
27776
|
this.raise(TSErrors.UnsupportedSignatureParameterKind, {
|
|
27774
27777
|
at: pattern,
|
|
27775
|
-
type
|
|
27778
|
+
type
|
|
27776
27779
|
});
|
|
27777
27780
|
}
|
|
27778
|
-
|
|
27779
|
-
|
|
27781
|
+
}
|
|
27782
|
+
return list;
|
|
27780
27783
|
}
|
|
27781
27784
|
tsParseTypeMemberSemicolon() {
|
|
27782
27785
|
if (!this.eat(12) && !this.isLineTerminator()) {
|
|
@@ -27798,7 +27801,7 @@ var require_lib = __commonJS({
|
|
|
27798
27801
|
}
|
|
27799
27802
|
tsTryParseIndexSignature(node) {
|
|
27800
27803
|
if (!(this.match(0) && this.tsLookAhead(this.tsIsUnambiguouslyIndexSignature.bind(this)))) {
|
|
27801
|
-
return
|
|
27804
|
+
return;
|
|
27802
27805
|
}
|
|
27803
27806
|
this.expect(0);
|
|
27804
27807
|
const id = this.parseIdentifier();
|
|
@@ -28101,18 +28104,17 @@ var require_lib = __commonJS({
|
|
|
28101
28104
|
}
|
|
28102
28105
|
tsParseLiteralTypeNode() {
|
|
28103
28106
|
const node = this.startNode();
|
|
28104
|
-
|
|
28105
|
-
|
|
28106
|
-
|
|
28107
|
-
|
|
28108
|
-
|
|
28109
|
-
|
|
28110
|
-
|
|
28111
|
-
|
|
28112
|
-
|
|
28113
|
-
|
|
28114
|
-
|
|
28115
|
-
})();
|
|
28107
|
+
switch (this.state.type) {
|
|
28108
|
+
case 132:
|
|
28109
|
+
case 133:
|
|
28110
|
+
case 131:
|
|
28111
|
+
case 85:
|
|
28112
|
+
case 86:
|
|
28113
|
+
node.literal = super.parseExprAtom();
|
|
28114
|
+
break;
|
|
28115
|
+
default:
|
|
28116
|
+
this.unexpected();
|
|
28117
|
+
}
|
|
28116
28118
|
return this.finishNode(node, "TSLiteralType");
|
|
28117
28119
|
}
|
|
28118
28120
|
tsParseTemplateLiteralType() {
|
|
@@ -28360,10 +28362,14 @@ var require_lib = __commonJS({
|
|
|
28360
28362
|
});
|
|
28361
28363
|
}
|
|
28362
28364
|
tsTryParseTypeOrTypePredicateAnnotation() {
|
|
28363
|
-
|
|
28365
|
+
if (this.match(14)) {
|
|
28366
|
+
return this.tsParseTypeOrTypePredicateAnnotation(14);
|
|
28367
|
+
}
|
|
28364
28368
|
}
|
|
28365
28369
|
tsTryParseTypeAnnotation() {
|
|
28366
|
-
|
|
28370
|
+
if (this.match(14)) {
|
|
28371
|
+
return this.tsParseTypeAnnotation();
|
|
28372
|
+
}
|
|
28367
28373
|
}
|
|
28368
28374
|
tsTryParseType() {
|
|
28369
28375
|
return this.tsEatThenParseType(14);
|
|
@@ -28539,17 +28545,19 @@ var require_lib = __commonJS({
|
|
|
28539
28545
|
}
|
|
28540
28546
|
}
|
|
28541
28547
|
tsEatThenParseType(token) {
|
|
28542
|
-
|
|
28548
|
+
if (this.match(token)) {
|
|
28549
|
+
return this.tsNextThenParseType();
|
|
28550
|
+
}
|
|
28543
28551
|
}
|
|
28544
28552
|
tsExpectThenParseType(token) {
|
|
28545
|
-
return this.
|
|
28553
|
+
return this.tsInType(() => {
|
|
28554
|
+
this.expect(token);
|
|
28555
|
+
return this.tsParseType();
|
|
28556
|
+
});
|
|
28546
28557
|
}
|
|
28547
28558
|
tsNextThenParseType() {
|
|
28548
|
-
return this.tsDoThenParseType(() => this.next());
|
|
28549
|
-
}
|
|
28550
|
-
tsDoThenParseType(cb) {
|
|
28551
28559
|
return this.tsInType(() => {
|
|
28552
|
-
|
|
28560
|
+
this.next();
|
|
28553
28561
|
return this.tsParseType();
|
|
28554
28562
|
});
|
|
28555
28563
|
}
|
|
@@ -28661,7 +28669,7 @@ var require_lib = __commonJS({
|
|
|
28661
28669
|
tsTryParseAndCatch(f) {
|
|
28662
28670
|
const result = this.tryParse((abort) => f() || abort());
|
|
28663
28671
|
if (result.aborted || !result.node)
|
|
28664
|
-
return
|
|
28672
|
+
return;
|
|
28665
28673
|
if (result.error)
|
|
28666
28674
|
this.state = result.failState;
|
|
28667
28675
|
return result.node;
|
|
@@ -28671,58 +28679,55 @@ var require_lib = __commonJS({
|
|
|
28671
28679
|
const result = f();
|
|
28672
28680
|
if (result !== void 0 && result !== false) {
|
|
28673
28681
|
return result;
|
|
28674
|
-
} else {
|
|
28675
|
-
this.state = state;
|
|
28676
|
-
return void 0;
|
|
28677
28682
|
}
|
|
28683
|
+
this.state = state;
|
|
28678
28684
|
}
|
|
28679
28685
|
tsTryParseDeclare(nany) {
|
|
28680
28686
|
if (this.isLineTerminator()) {
|
|
28681
28687
|
return;
|
|
28682
28688
|
}
|
|
28683
|
-
let
|
|
28689
|
+
let startType = this.state.type;
|
|
28684
28690
|
let kind;
|
|
28685
28691
|
if (this.isContextual(99)) {
|
|
28686
|
-
|
|
28692
|
+
startType = 74;
|
|
28687
28693
|
kind = "let";
|
|
28688
28694
|
}
|
|
28689
28695
|
return this.tsInAmbientContext(() => {
|
|
28690
|
-
|
|
28691
|
-
|
|
28692
|
-
|
|
28693
|
-
|
|
28694
|
-
|
|
28695
|
-
nany.declare = true;
|
|
28696
|
-
return this.parseClass(nany, true, false);
|
|
28697
|
-
}
|
|
28698
|
-
if (starttype === 124) {
|
|
28699
|
-
return this.tsParseEnumDeclaration(nany, {
|
|
28700
|
-
declare: true
|
|
28701
|
-
});
|
|
28702
|
-
}
|
|
28703
|
-
if (starttype === 110) {
|
|
28704
|
-
return this.tsParseAmbientExternalModuleDeclaration(nany);
|
|
28705
|
-
}
|
|
28706
|
-
if (starttype === 75 || starttype === 74) {
|
|
28707
|
-
if (!this.match(75) || !this.isLookaheadContextual("enum")) {
|
|
28696
|
+
switch (startType) {
|
|
28697
|
+
case 68:
|
|
28698
|
+
nany.declare = true;
|
|
28699
|
+
return super.parseFunctionStatement(nany, false, false);
|
|
28700
|
+
case 80:
|
|
28708
28701
|
nany.declare = true;
|
|
28709
|
-
return this.
|
|
28702
|
+
return this.parseClass(nany, true, false);
|
|
28703
|
+
case 124:
|
|
28704
|
+
return this.tsParseEnumDeclaration(nany, {
|
|
28705
|
+
declare: true
|
|
28706
|
+
});
|
|
28707
|
+
case 110:
|
|
28708
|
+
return this.tsParseAmbientExternalModuleDeclaration(nany);
|
|
28709
|
+
case 75:
|
|
28710
|
+
case 74:
|
|
28711
|
+
if (!this.match(75) || !this.isLookaheadContextual("enum")) {
|
|
28712
|
+
nany.declare = true;
|
|
28713
|
+
return this.parseVarStatement(nany, kind || this.state.value, true);
|
|
28714
|
+
}
|
|
28715
|
+
this.expect(75);
|
|
28716
|
+
return this.tsParseEnumDeclaration(nany, {
|
|
28717
|
+
const: true,
|
|
28718
|
+
declare: true
|
|
28719
|
+
});
|
|
28720
|
+
case 127: {
|
|
28721
|
+
const result = this.tsParseInterfaceDeclaration(nany, {
|
|
28722
|
+
declare: true
|
|
28723
|
+
});
|
|
28724
|
+
if (result)
|
|
28725
|
+
return result;
|
|
28710
28726
|
}
|
|
28711
|
-
|
|
28712
|
-
|
|
28713
|
-
|
|
28714
|
-
|
|
28715
|
-
});
|
|
28716
|
-
}
|
|
28717
|
-
if (starttype === 127) {
|
|
28718
|
-
const result = this.tsParseInterfaceDeclaration(nany, {
|
|
28719
|
-
declare: true
|
|
28720
|
-
});
|
|
28721
|
-
if (result)
|
|
28722
|
-
return result;
|
|
28723
|
-
}
|
|
28724
|
-
if (tokenIsIdentifier(starttype)) {
|
|
28725
|
-
return this.tsParseDeclaration(nany, this.state.value, true, null);
|
|
28727
|
+
default:
|
|
28728
|
+
if (tokenIsIdentifier(startType)) {
|
|
28729
|
+
return this.tsParseDeclaration(nany, this.state.value, true, null);
|
|
28730
|
+
}
|
|
28726
28731
|
}
|
|
28727
28732
|
});
|
|
28728
28733
|
}
|
|
@@ -28735,9 +28740,8 @@ var require_lib = __commonJS({
|
|
|
28735
28740
|
const declaration = this.tsTryParseDeclare(node);
|
|
28736
28741
|
if (declaration) {
|
|
28737
28742
|
declaration.declare = true;
|
|
28738
|
-
return declaration;
|
|
28739
28743
|
}
|
|
28740
|
-
|
|
28744
|
+
return declaration;
|
|
28741
28745
|
}
|
|
28742
28746
|
case "global":
|
|
28743
28747
|
if (this.match(5)) {
|
|
@@ -28794,9 +28798,8 @@ var require_lib = __commonJS({
|
|
|
28794
28798
|
return !this.isLineTerminator();
|
|
28795
28799
|
}
|
|
28796
28800
|
tsTryParseGenericAsyncArrowFunction(startLoc) {
|
|
28797
|
-
if (!this.match(47))
|
|
28798
|
-
return
|
|
28799
|
-
}
|
|
28801
|
+
if (!this.match(47))
|
|
28802
|
+
return;
|
|
28800
28803
|
const oldMaybeInArrowParameters = this.state.maybeInArrowParameters;
|
|
28801
28804
|
this.state.maybeInArrowParameters = true;
|
|
28802
28805
|
const res = this.tsTryParseAndCatch(() => {
|
|
@@ -28808,15 +28811,13 @@ var require_lib = __commonJS({
|
|
|
28808
28811
|
return node;
|
|
28809
28812
|
});
|
|
28810
28813
|
this.state.maybeInArrowParameters = oldMaybeInArrowParameters;
|
|
28811
|
-
if (!res)
|
|
28812
|
-
return
|
|
28813
|
-
}
|
|
28814
|
+
if (!res)
|
|
28815
|
+
return;
|
|
28814
28816
|
return super.parseArrowExpression(res, null, true);
|
|
28815
28817
|
}
|
|
28816
28818
|
tsParseTypeArgumentsInExpression() {
|
|
28817
|
-
if (this.reScan_lt() !== 47)
|
|
28818
|
-
return
|
|
28819
|
-
}
|
|
28819
|
+
if (this.reScan_lt() !== 47)
|
|
28820
|
+
return;
|
|
28820
28821
|
return this.tsParseTypeArguments();
|
|
28821
28822
|
}
|
|
28822
28823
|
tsParseTypeArguments() {
|
|
@@ -29476,7 +29477,7 @@ var require_lib = __commonJS({
|
|
|
29476
29477
|
return super.parseAsyncArrowFromCallExpression(node, call);
|
|
29477
29478
|
}
|
|
29478
29479
|
parseMaybeAssign(refExpressionErrors, afterLeftParse) {
|
|
29479
|
-
var _jsx, _jsx2, _typeCast, _jsx3, _typeCast2
|
|
29480
|
+
var _jsx, _jsx2, _typeCast, _jsx3, _typeCast2;
|
|
29480
29481
|
let state;
|
|
29481
29482
|
let jsx2;
|
|
29482
29483
|
let typeCast;
|
|
@@ -29537,13 +29538,7 @@ var require_lib = __commonJS({
|
|
|
29537
29538
|
this.state = typeCast.failState;
|
|
29538
29539
|
return typeCast.node;
|
|
29539
29540
|
}
|
|
29540
|
-
|
|
29541
|
-
throw jsx2.error;
|
|
29542
|
-
if (arrow.thrown)
|
|
29543
|
-
throw arrow.error;
|
|
29544
|
-
if ((_typeCast2 = typeCast) != null && _typeCast2.thrown)
|
|
29545
|
-
throw typeCast.error;
|
|
29546
|
-
throw ((_jsx4 = jsx2) == null ? void 0 : _jsx4.error) || arrow.error || ((_typeCast3 = typeCast) == null ? void 0 : _typeCast3.error);
|
|
29541
|
+
throw ((_jsx3 = jsx2) == null ? void 0 : _jsx3.error) || arrow.error || ((_typeCast2 = typeCast) == null ? void 0 : _typeCast2.error);
|
|
29547
29542
|
}
|
|
29548
29543
|
reportReservedArrowTypeParam(node) {
|
|
29549
29544
|
var _node$extra;
|
|
@@ -29556,9 +29551,8 @@ var require_lib = __commonJS({
|
|
|
29556
29551
|
parseMaybeUnary(refExpressionErrors, sawUnary) {
|
|
29557
29552
|
if (!this.hasPlugin("jsx") && this.match(47)) {
|
|
29558
29553
|
return this.tsParseTypeAssertion();
|
|
29559
|
-
} else {
|
|
29560
|
-
return super.parseMaybeUnary(refExpressionErrors, sawUnary);
|
|
29561
29554
|
}
|
|
29555
|
+
return super.parseMaybeUnary(refExpressionErrors, sawUnary);
|
|
29562
29556
|
}
|
|
29563
29557
|
parseArrow(node) {
|
|
29564
29558
|
if (this.match(14)) {
|
|
@@ -29664,12 +29658,10 @@ var require_lib = __commonJS({
|
|
|
29664
29658
|
}, type) || super.isValidLVal(type, isUnparenthesizedInAssign, binding);
|
|
29665
29659
|
}
|
|
29666
29660
|
parseBindingAtom() {
|
|
29667
|
-
|
|
29668
|
-
|
|
29669
|
-
return this.parseIdentifier(true);
|
|
29670
|
-
default:
|
|
29671
|
-
return super.parseBindingAtom();
|
|
29661
|
+
if (this.state.type === 78) {
|
|
29662
|
+
return this.parseIdentifier(true);
|
|
29672
29663
|
}
|
|
29664
|
+
return super.parseBindingAtom();
|
|
29673
29665
|
}
|
|
29674
29666
|
parseMaybeDecoratorArguments(expr) {
|
|
29675
29667
|
if (this.match(47) || this.match(51)) {
|
|
@@ -29687,9 +29679,8 @@ var require_lib = __commonJS({
|
|
|
29687
29679
|
if (this.state.isAmbientContext && this.match(12) && this.lookaheadCharCode() === close) {
|
|
29688
29680
|
this.next();
|
|
29689
29681
|
return false;
|
|
29690
|
-
} else {
|
|
29691
|
-
return super.checkCommaAfterRest(close);
|
|
29692
29682
|
}
|
|
29683
|
+
return super.checkCommaAfterRest(close);
|
|
29693
29684
|
}
|
|
29694
29685
|
isClassMethod() {
|
|
29695
29686
|
return this.match(47) || super.isClassMethod();
|
|
@@ -29984,9 +29975,8 @@ var require_lib = __commonJS({
|
|
|
29984
29975
|
function isNumber(expression, estree2) {
|
|
29985
29976
|
if (estree2) {
|
|
29986
29977
|
return expression.type === "Literal" && (typeof expression.value === "number" || "bigint" in expression);
|
|
29987
|
-
} else {
|
|
29988
|
-
return expression.type === "NumericLiteral" || expression.type === "BigIntLiteral";
|
|
29989
29978
|
}
|
|
29979
|
+
return expression.type === "NumericLiteral" || expression.type === "BigIntLiteral";
|
|
29990
29980
|
}
|
|
29991
29981
|
function isNegativeNumber(expression, estree2) {
|
|
29992
29982
|
if (expression.type === "UnaryExpression") {
|
|
@@ -30003,10 +29993,9 @@ var require_lib = __commonJS({
|
|
|
30003
29993
|
function isUncomputedMemberExpressionChain(expression) {
|
|
30004
29994
|
if (expression.type === "Identifier")
|
|
30005
29995
|
return true;
|
|
30006
|
-
if (expression.type !== "MemberExpression")
|
|
30007
|
-
return false;
|
|
30008
|
-
if (expression.computed)
|
|
29996
|
+
if (expression.type !== "MemberExpression" || expression.computed) {
|
|
30009
29997
|
return false;
|
|
29998
|
+
}
|
|
30010
29999
|
return isUncomputedMemberExpressionChain(expression.object);
|
|
30011
30000
|
}
|
|
30012
30001
|
var PlaceholderErrors = ParseErrorEnum`placeholders`({
|
|
@@ -33035,11 +33024,6 @@ var require_lib = __commonJS({
|
|
|
33035
33024
|
return node;
|
|
33036
33025
|
}
|
|
33037
33026
|
parseVarId(decl, kind) {
|
|
33038
|
-
if (kind === "using" && !this.inModule && this.match(96)) {
|
|
33039
|
-
this.raise(Errors.AwaitInUsingBinding, {
|
|
33040
|
-
at: this.state.startLoc
|
|
33041
|
-
});
|
|
33042
|
-
}
|
|
33043
33027
|
const id = this.parseBindingAtom();
|
|
33044
33028
|
this.checkLVal(id, {
|
|
33045
33029
|
in: {
|
|
@@ -34404,10 +34388,10 @@ var flags = new Map(features.map((f) => [f.split(":").at(-1), f]));
|
|
|
34404
34388
|
init_esm_shims();
|
|
34405
34389
|
var import_ast_types = __toESM(require_main(), 1);
|
|
34406
34390
|
|
|
34407
|
-
// ../../node_modules/.pnpm/magicast@0.2.
|
|
34391
|
+
// ../../node_modules/.pnpm/magicast@0.2.6/node_modules/magicast/dist/index.mjs
|
|
34408
34392
|
init_esm_shims();
|
|
34409
34393
|
|
|
34410
|
-
// ../../node_modules/.pnpm/magicast@0.2.
|
|
34394
|
+
// ../../node_modules/.pnpm/magicast@0.2.6/node_modules/magicast/dist/shared/magicast.457bd4a4.mjs
|
|
34411
34395
|
init_esm_shims();
|
|
34412
34396
|
var recast = __toESM(require_main3(), 1);
|
|
34413
34397
|
var import_recast = __toESM(require_main3(), 1);
|
|
@@ -35104,6 +35088,11 @@ function proxify(node, mod) {
|
|
|
35104
35088
|
proxy = proxifyIdentifier(node);
|
|
35105
35089
|
break;
|
|
35106
35090
|
}
|
|
35091
|
+
case "TSAsExpression":
|
|
35092
|
+
case "TSSatisfiesExpression": {
|
|
35093
|
+
proxy = proxify(node.expression, mod);
|
|
35094
|
+
break;
|
|
35095
|
+
}
|
|
35107
35096
|
default:
|
|
35108
35097
|
throw new MagicastError(`Casting "${node.type}" is not supported`, {
|
|
35109
35098
|
ast: node,
|
|
@@ -35396,7 +35385,7 @@ var builders = {
|
|
|
35396
35385
|
}
|
|
35397
35386
|
};
|
|
35398
35387
|
|
|
35399
|
-
// ../../node_modules/.pnpm/magicast@0.2.
|
|
35388
|
+
// ../../node_modules/.pnpm/magicast@0.2.6/node_modules/magicast/dist/index.mjs
|
|
35400
35389
|
var import_recast2 = __toESM(require_main3(), 1);
|
|
35401
35390
|
var import_parser = __toESM(require_lib(), 1);
|
|
35402
35391
|
|
|
@@ -35507,7 +35496,7 @@ async function loadRelativeFileAsMagicast(relativePath, meta) {
|
|
|
35507
35496
|
// src/magicast.ts
|
|
35508
35497
|
init_esm_shims();
|
|
35509
35498
|
|
|
35510
|
-
// ../../node_modules/.pnpm/magicast@0.2.
|
|
35499
|
+
// ../../node_modules/.pnpm/magicast@0.2.6/node_modules/magicast/dist/helpers.mjs
|
|
35511
35500
|
init_esm_shims();
|
|
35512
35501
|
var import_recast3 = __toESM(require_main3(), 1);
|
|
35513
35502
|
var import_parser2 = __toESM(require_lib(), 1);
|
|
@@ -35516,8 +35505,11 @@ function getDefaultExportOptions(magicast) {
|
|
|
35516
35505
|
}
|
|
35517
35506
|
function addVitePlugin(magicast, plugin) {
|
|
35518
35507
|
const config = getDefaultExportOptions(magicast);
|
|
35508
|
+
const insertionIndex = plugin.index ?? config.plugins?.length ?? 0;
|
|
35519
35509
|
config.plugins || (config.plugins = []);
|
|
35520
|
-
config.plugins.
|
|
35510
|
+
config.plugins.splice(
|
|
35511
|
+
insertionIndex,
|
|
35512
|
+
0,
|
|
35521
35513
|
plugin.options ? builders.functionCall(plugin.constructor, plugin.options) : builders.functionCall(plugin.constructor)
|
|
35522
35514
|
);
|
|
35523
35515
|
magicast.imports.$add({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@batijs/core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.12",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -8,16 +8,15 @@
|
|
|
8
8
|
"author": "",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"devDependencies": {
|
|
11
|
+
"@magne4000/import-fixer": "^0.8.2",
|
|
11
12
|
"@types/eslint": "^8.37.0",
|
|
12
|
-
"@types/node": "^16.18.
|
|
13
|
+
"@types/node": "^16.18.27",
|
|
13
14
|
"ast-types": "^0.14.2",
|
|
14
15
|
"esbuild": "^0.17.18",
|
|
15
|
-
"
|
|
16
|
-
"magicast": "^0.2.4",
|
|
17
|
-
"tsx": "^3.12.6",
|
|
16
|
+
"magicast": "^0.2.6",
|
|
18
17
|
"typescript": "^5.0.4",
|
|
19
|
-
"
|
|
20
|
-
"@batijs/tsup": "0.0.
|
|
18
|
+
"vitest": "^0.31.0",
|
|
19
|
+
"@batijs/tsup": "0.0.12"
|
|
21
20
|
},
|
|
22
21
|
"exports": {
|
|
23
22
|
".": "./dist/index.js"
|
|
@@ -36,7 +35,8 @@
|
|
|
36
35
|
"dist/"
|
|
37
36
|
],
|
|
38
37
|
"scripts": {
|
|
39
|
-
"test": "
|
|
38
|
+
"test": "vitest",
|
|
39
|
+
"test:ci": "vitest run",
|
|
40
40
|
"build": "tsup"
|
|
41
41
|
}
|
|
42
42
|
}
|