with-zephyr 0.1.1-next.1 → 0.1.1-next.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/dist/index.js +70 -3
- package/dist/zephyr-manifest.json +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -47923,17 +47923,17 @@ const astro_astroConfig = {
|
|
|
47923
47923
|
{
|
|
47924
47924
|
type: 'define-config-function',
|
|
47925
47925
|
matcher: /defineConfig\s*\(\s*\(\s*\)\s*=>\s*\(\s*\{/,
|
|
47926
|
-
transform: '
|
|
47926
|
+
transform: 'addToAstroIntegrationsInFunctionOrCreate'
|
|
47927
47927
|
},
|
|
47928
47928
|
{
|
|
47929
47929
|
type: 'define-config',
|
|
47930
47930
|
matcher: /defineConfig\s*\(\s*\{/,
|
|
47931
|
-
transform: '
|
|
47931
|
+
transform: 'addToAstroIntegrationsOrCreate'
|
|
47932
47932
|
},
|
|
47933
47933
|
{
|
|
47934
47934
|
type: 'export-default',
|
|
47935
47935
|
matcher: /export\s+default\s+\{/,
|
|
47936
|
-
transform: '
|
|
47936
|
+
transform: 'addToAstroIntegrationsOrCreate'
|
|
47937
47937
|
}
|
|
47938
47938
|
]
|
|
47939
47939
|
};
|
|
@@ -48489,6 +48489,71 @@ function addToAstroIntegrationsInFunction(ast) {
|
|
|
48489
48489
|
}
|
|
48490
48490
|
});
|
|
48491
48491
|
}
|
|
48492
|
+
function addToAstroIntegrationsOrCreate(ast) {
|
|
48493
|
+
let integrationAdded = false;
|
|
48494
|
+
(0, traverse_lib["default"])(ast, {
|
|
48495
|
+
CallExpression (path) {
|
|
48496
|
+
if (types_lib.isIdentifier(path.node.callee, {
|
|
48497
|
+
name: 'defineConfig'
|
|
48498
|
+
}) && 1 === path.node.arguments.length && types_lib.isObjectExpression(path.node.arguments[0])) {
|
|
48499
|
+
const configObject = path.node.arguments[0];
|
|
48500
|
+
let integrationsProperty = null;
|
|
48501
|
+
for (const prop of configObject.properties)if (types_lib.isObjectProperty(prop) && types_lib.isIdentifier(prop.key, {
|
|
48502
|
+
name: 'integrations'
|
|
48503
|
+
}) && types_lib.isArrayExpression(prop.value)) {
|
|
48504
|
+
integrationsProperty = prop;
|
|
48505
|
+
break;
|
|
48506
|
+
}
|
|
48507
|
+
if (integrationsProperty && types_lib.isArrayExpression(integrationsProperty.value)) {
|
|
48508
|
+
integrationsProperty.value.elements.push(types_lib.callExpression(types_lib.identifier('withZephyr'), []));
|
|
48509
|
+
integrationAdded = true;
|
|
48510
|
+
} else if (!integrationsProperty) {
|
|
48511
|
+
const newIntegrationsProperty = types_lib.objectProperty(types_lib.identifier('integrations'), types_lib.arrayExpression([
|
|
48512
|
+
types_lib.callExpression(types_lib.identifier('withZephyr'), [])
|
|
48513
|
+
]));
|
|
48514
|
+
configObject.properties.push(newIntegrationsProperty);
|
|
48515
|
+
integrationAdded = true;
|
|
48516
|
+
}
|
|
48517
|
+
}
|
|
48518
|
+
}
|
|
48519
|
+
});
|
|
48520
|
+
if (!integrationAdded) addToAstroIntegrations(ast);
|
|
48521
|
+
}
|
|
48522
|
+
function addToAstroIntegrationsInFunctionOrCreate(ast) {
|
|
48523
|
+
let integrationAdded = false;
|
|
48524
|
+
(0, traverse_lib["default"])(ast, {
|
|
48525
|
+
CallExpression (path) {
|
|
48526
|
+
if (types_lib.isIdentifier(path.node.callee, {
|
|
48527
|
+
name: 'defineConfig'
|
|
48528
|
+
}) && 1 === path.node.arguments.length && types_lib.isArrowFunctionExpression(path.node.arguments[0])) {
|
|
48529
|
+
const arrowFunc = path.node.arguments[0];
|
|
48530
|
+
let objExpr = null;
|
|
48531
|
+
if (types_lib.isParenthesizedExpression(arrowFunc.body) && types_lib.isObjectExpression(arrowFunc.body.expression)) objExpr = arrowFunc.body.expression;
|
|
48532
|
+
else if (types_lib.isObjectExpression(arrowFunc.body)) objExpr = arrowFunc.body;
|
|
48533
|
+
if (objExpr) {
|
|
48534
|
+
let integrationsProperty = null;
|
|
48535
|
+
for (const prop of objExpr.properties)if (types_lib.isObjectProperty(prop) && types_lib.isIdentifier(prop.key, {
|
|
48536
|
+
name: 'integrations'
|
|
48537
|
+
}) && types_lib.isArrayExpression(prop.value)) {
|
|
48538
|
+
integrationsProperty = prop;
|
|
48539
|
+
break;
|
|
48540
|
+
}
|
|
48541
|
+
if (integrationsProperty && types_lib.isArrayExpression(integrationsProperty.value)) {
|
|
48542
|
+
integrationsProperty.value.elements.push(types_lib.callExpression(types_lib.identifier('withZephyr'), []));
|
|
48543
|
+
integrationAdded = true;
|
|
48544
|
+
} else if (!integrationsProperty) {
|
|
48545
|
+
const newIntegrationsProperty = types_lib.objectProperty(types_lib.identifier('integrations'), types_lib.arrayExpression([
|
|
48546
|
+
types_lib.callExpression(types_lib.identifier('withZephyr'), [])
|
|
48547
|
+
]));
|
|
48548
|
+
objExpr.properties.push(newIntegrationsProperty);
|
|
48549
|
+
integrationAdded = true;
|
|
48550
|
+
}
|
|
48551
|
+
}
|
|
48552
|
+
}
|
|
48553
|
+
}
|
|
48554
|
+
});
|
|
48555
|
+
if (!integrationAdded) addToAstroIntegrationsInFunction(ast);
|
|
48556
|
+
}
|
|
48492
48557
|
function addToRollupFunction(ast) {
|
|
48493
48558
|
(0, traverse_lib["default"])(ast, {
|
|
48494
48559
|
ArrowFunctionExpression (path) {
|
|
@@ -48590,6 +48655,8 @@ const TRANSFORMERS = {
|
|
|
48590
48655
|
addToVitePluginsInFunction: addToVitePluginsInFunction,
|
|
48591
48656
|
addToAstroIntegrations: addToAstroIntegrations,
|
|
48592
48657
|
addToAstroIntegrationsInFunction: addToAstroIntegrationsInFunction,
|
|
48658
|
+
addToAstroIntegrationsOrCreate: addToAstroIntegrationsOrCreate,
|
|
48659
|
+
addToAstroIntegrationsInFunctionOrCreate: addToAstroIntegrationsInFunctionOrCreate,
|
|
48593
48660
|
addToRollupFunction: addToRollupFunction,
|
|
48594
48661
|
addToRollupArrayConfig: addToRollupArrayConfig,
|
|
48595
48662
|
wrapModuleExports: wrapModuleExports,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "with-zephyr",
|
|
3
|
-
"version": "0.1.1-next.
|
|
3
|
+
"version": "0.1.1-next.3",
|
|
4
4
|
"description": "A codemod to automatically add withZephyr plugin to bundler configurations",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"repository": {
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@types/node": "^24.5.2",
|
|
39
39
|
"@rslib/core": "^0.13.3",
|
|
40
40
|
"typescript": "^5.9.2",
|
|
41
|
-
"zephyr-rsbuild-plugin": "0.1.1-next.
|
|
41
|
+
"zephyr-rsbuild-plugin": "0.1.1-next.3"
|
|
42
42
|
},
|
|
43
43
|
"keywords": [
|
|
44
44
|
"zephyr",
|