with-zephyr 0.0.0-canary.16 → 0.0.0-canary.18
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 +89 -10
- package/dist/zephyr-manifest.json +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -43515,7 +43515,10 @@ const parseClass = (glob, position)=>{
|
|
|
43515
43515
|
true
|
|
43516
43516
|
];
|
|
43517
43517
|
};
|
|
43518
|
-
const unescape_unescape = (s, { windowsPathsNoEscape = false } = {})=>
|
|
43518
|
+
const unescape_unescape = (s, { windowsPathsNoEscape = false, magicalBraces = true } = {})=>{
|
|
43519
|
+
if (magicalBraces) return windowsPathsNoEscape ? s.replace(/\[([^\/\\])\]/g, '$1') : s.replace(/((?!\\).|^)\[([^\/\\])\]/g, '$1$2').replace(/\\([^\/])/g, '$1');
|
|
43520
|
+
return windowsPathsNoEscape ? s.replace(/\[([^\/\\{}])\]/g, '$1') : s.replace(/((?!\\).|^)\[([^\/\\{}])\]/g, '$1$2').replace(/\\([^\/{}])/g, '$1');
|
|
43521
|
+
};
|
|
43519
43522
|
const types = new Set([
|
|
43520
43523
|
'!',
|
|
43521
43524
|
'?',
|
|
@@ -43760,7 +43763,7 @@ class ast_AST {
|
|
|
43760
43763
|
const dot = allowDot ?? !!this.#options.dot;
|
|
43761
43764
|
if (this.#root === this) this.#fillNegs();
|
|
43762
43765
|
if (!this.type) {
|
|
43763
|
-
const noEmpty = this.isStart() && this.isEnd();
|
|
43766
|
+
const noEmpty = this.isStart() && this.isEnd() && !this.#parts.some((s)=>'string' != typeof s);
|
|
43764
43767
|
const src = this.#parts.map((p)=>{
|
|
43765
43768
|
const [re, _, hasMagic, uflag] = 'string' == typeof p ? ast_AST.#parseGlob(p, this.#hasMagic, noEmpty) : p.toRegExpSource(allowDot);
|
|
43766
43769
|
this.#hasMagic = this.#hasMagic || hasMagic;
|
|
@@ -43857,8 +43860,7 @@ class ast_AST {
|
|
|
43857
43860
|
}
|
|
43858
43861
|
}
|
|
43859
43862
|
if ('*' === c) {
|
|
43860
|
-
|
|
43861
|
-
else re += star;
|
|
43863
|
+
re += noEmpty && '*' === glob ? starNoEmpty : star;
|
|
43862
43864
|
hasMagic = true;
|
|
43863
43865
|
continue;
|
|
43864
43866
|
}
|
|
@@ -43877,7 +43879,10 @@ class ast_AST {
|
|
|
43877
43879
|
];
|
|
43878
43880
|
}
|
|
43879
43881
|
}
|
|
43880
|
-
const escape_escape = (s, { windowsPathsNoEscape = false } = {})=>
|
|
43882
|
+
const escape_escape = (s, { windowsPathsNoEscape = false, magicalBraces = false } = {})=>{
|
|
43883
|
+
if (magicalBraces) return windowsPathsNoEscape ? s.replace(/[?*()[\]{}]/g, '[$&]') : s.replace(/[?*()[\]\\{}]/g, '\\$&');
|
|
43884
|
+
return windowsPathsNoEscape ? s.replace(/[?*()[\]]/g, '[$&]') : s.replace(/[?*()[\]\\]/g, '\\$&');
|
|
43885
|
+
};
|
|
43881
43886
|
const minimatch = (p, pattern, options = {})=>{
|
|
43882
43887
|
assertValidPattern(pattern);
|
|
43883
43888
|
if (!options.nocomment && '#' === pattern.charAt(0)) return false;
|
|
@@ -44413,13 +44418,19 @@ class esm_Minimatch {
|
|
|
44413
44418
|
if (p !== GLOBSTAR || prev === GLOBSTAR) return;
|
|
44414
44419
|
if (void 0 === prev) if (void 0 !== next && next !== GLOBSTAR) pp[i + 1] = '(?:\\/|' + twoStar + '\\/)?' + next;
|
|
44415
44420
|
else pp[i] = twoStar;
|
|
44416
|
-
else if (void 0 === next) pp[i - 1] = prev + '(
|
|
44421
|
+
else if (void 0 === next) pp[i - 1] = prev + '(?:\\/|\\/' + twoStar + ')?';
|
|
44417
44422
|
else if (next !== GLOBSTAR) {
|
|
44418
44423
|
pp[i - 1] = prev + '(?:\\/|\\/' + twoStar + '\\/)' + next;
|
|
44419
44424
|
pp[i + 1] = GLOBSTAR;
|
|
44420
44425
|
}
|
|
44421
44426
|
});
|
|
44422
|
-
|
|
44427
|
+
const filtered = pp.filter((p)=>p !== GLOBSTAR);
|
|
44428
|
+
if (this.partial && filtered.length >= 1) {
|
|
44429
|
+
const prefixes = [];
|
|
44430
|
+
for(let i = 1; i <= filtered.length; i++)prefixes.push(filtered.slice(0, i).join('/'));
|
|
44431
|
+
return '(?:' + prefixes.join('|') + ')';
|
|
44432
|
+
}
|
|
44433
|
+
return filtered.join('/');
|
|
44423
44434
|
}).join('|');
|
|
44424
44435
|
const [open, close] = set.length > 1 ? [
|
|
44425
44436
|
'(?:',
|
|
@@ -44429,6 +44440,7 @@ class esm_Minimatch {
|
|
|
44429
44440
|
''
|
|
44430
44441
|
];
|
|
44431
44442
|
re = '^' + open + re + close + '$';
|
|
44443
|
+
if (this.partial) re = '^(?:\\/|' + open + re.slice(1, -1) + close + ')$';
|
|
44432
44444
|
if (this.negate) re = '^(?!' + re + ').+$';
|
|
44433
44445
|
try {
|
|
44434
44446
|
this.regexp = new RegExp(re, [
|
|
@@ -47923,17 +47935,17 @@ const astro_astroConfig = {
|
|
|
47923
47935
|
{
|
|
47924
47936
|
type: 'define-config-function',
|
|
47925
47937
|
matcher: /defineConfig\s*\(\s*\(\s*\)\s*=>\s*\(\s*\{/,
|
|
47926
|
-
transform: '
|
|
47938
|
+
transform: 'addToAstroIntegrationsInFunctionOrCreate'
|
|
47927
47939
|
},
|
|
47928
47940
|
{
|
|
47929
47941
|
type: 'define-config',
|
|
47930
47942
|
matcher: /defineConfig\s*\(\s*\{/,
|
|
47931
|
-
transform: '
|
|
47943
|
+
transform: 'addToAstroIntegrationsOrCreate'
|
|
47932
47944
|
},
|
|
47933
47945
|
{
|
|
47934
47946
|
type: 'export-default',
|
|
47935
47947
|
matcher: /export\s+default\s+\{/,
|
|
47936
|
-
transform: '
|
|
47948
|
+
transform: 'addToAstroIntegrationsOrCreate'
|
|
47937
47949
|
}
|
|
47938
47950
|
]
|
|
47939
47951
|
};
|
|
@@ -48489,6 +48501,71 @@ function addToAstroIntegrationsInFunction(ast) {
|
|
|
48489
48501
|
}
|
|
48490
48502
|
});
|
|
48491
48503
|
}
|
|
48504
|
+
function addToAstroIntegrationsOrCreate(ast) {
|
|
48505
|
+
let integrationAdded = false;
|
|
48506
|
+
(0, traverse_lib["default"])(ast, {
|
|
48507
|
+
CallExpression (path) {
|
|
48508
|
+
if (types_lib.isIdentifier(path.node.callee, {
|
|
48509
|
+
name: 'defineConfig'
|
|
48510
|
+
}) && 1 === path.node.arguments.length && types_lib.isObjectExpression(path.node.arguments[0])) {
|
|
48511
|
+
const configObject = path.node.arguments[0];
|
|
48512
|
+
let integrationsProperty = null;
|
|
48513
|
+
for (const prop of configObject.properties)if (types_lib.isObjectProperty(prop) && types_lib.isIdentifier(prop.key, {
|
|
48514
|
+
name: 'integrations'
|
|
48515
|
+
}) && types_lib.isArrayExpression(prop.value)) {
|
|
48516
|
+
integrationsProperty = prop;
|
|
48517
|
+
break;
|
|
48518
|
+
}
|
|
48519
|
+
if (integrationsProperty && types_lib.isArrayExpression(integrationsProperty.value)) {
|
|
48520
|
+
integrationsProperty.value.elements.push(types_lib.callExpression(types_lib.identifier('withZephyr'), []));
|
|
48521
|
+
integrationAdded = true;
|
|
48522
|
+
} else if (!integrationsProperty) {
|
|
48523
|
+
const newIntegrationsProperty = types_lib.objectProperty(types_lib.identifier('integrations'), types_lib.arrayExpression([
|
|
48524
|
+
types_lib.callExpression(types_lib.identifier('withZephyr'), [])
|
|
48525
|
+
]));
|
|
48526
|
+
configObject.properties.push(newIntegrationsProperty);
|
|
48527
|
+
integrationAdded = true;
|
|
48528
|
+
}
|
|
48529
|
+
}
|
|
48530
|
+
}
|
|
48531
|
+
});
|
|
48532
|
+
if (!integrationAdded) addToAstroIntegrations(ast);
|
|
48533
|
+
}
|
|
48534
|
+
function addToAstroIntegrationsInFunctionOrCreate(ast) {
|
|
48535
|
+
let integrationAdded = false;
|
|
48536
|
+
(0, traverse_lib["default"])(ast, {
|
|
48537
|
+
CallExpression (path) {
|
|
48538
|
+
if (types_lib.isIdentifier(path.node.callee, {
|
|
48539
|
+
name: 'defineConfig'
|
|
48540
|
+
}) && 1 === path.node.arguments.length && types_lib.isArrowFunctionExpression(path.node.arguments[0])) {
|
|
48541
|
+
const arrowFunc = path.node.arguments[0];
|
|
48542
|
+
let objExpr = null;
|
|
48543
|
+
if (types_lib.isParenthesizedExpression(arrowFunc.body) && types_lib.isObjectExpression(arrowFunc.body.expression)) objExpr = arrowFunc.body.expression;
|
|
48544
|
+
else if (types_lib.isObjectExpression(arrowFunc.body)) objExpr = arrowFunc.body;
|
|
48545
|
+
if (objExpr) {
|
|
48546
|
+
let integrationsProperty = null;
|
|
48547
|
+
for (const prop of objExpr.properties)if (types_lib.isObjectProperty(prop) && types_lib.isIdentifier(prop.key, {
|
|
48548
|
+
name: 'integrations'
|
|
48549
|
+
}) && types_lib.isArrayExpression(prop.value)) {
|
|
48550
|
+
integrationsProperty = prop;
|
|
48551
|
+
break;
|
|
48552
|
+
}
|
|
48553
|
+
if (integrationsProperty && types_lib.isArrayExpression(integrationsProperty.value)) {
|
|
48554
|
+
integrationsProperty.value.elements.push(types_lib.callExpression(types_lib.identifier('withZephyr'), []));
|
|
48555
|
+
integrationAdded = true;
|
|
48556
|
+
} else if (!integrationsProperty) {
|
|
48557
|
+
const newIntegrationsProperty = types_lib.objectProperty(types_lib.identifier('integrations'), types_lib.arrayExpression([
|
|
48558
|
+
types_lib.callExpression(types_lib.identifier('withZephyr'), [])
|
|
48559
|
+
]));
|
|
48560
|
+
objExpr.properties.push(newIntegrationsProperty);
|
|
48561
|
+
integrationAdded = true;
|
|
48562
|
+
}
|
|
48563
|
+
}
|
|
48564
|
+
}
|
|
48565
|
+
}
|
|
48566
|
+
});
|
|
48567
|
+
if (!integrationAdded) addToAstroIntegrationsInFunction(ast);
|
|
48568
|
+
}
|
|
48492
48569
|
function addToRollupFunction(ast) {
|
|
48493
48570
|
(0, traverse_lib["default"])(ast, {
|
|
48494
48571
|
ArrowFunctionExpression (path) {
|
|
@@ -48590,6 +48667,8 @@ const TRANSFORMERS = {
|
|
|
48590
48667
|
addToVitePluginsInFunction: addToVitePluginsInFunction,
|
|
48591
48668
|
addToAstroIntegrations: addToAstroIntegrations,
|
|
48592
48669
|
addToAstroIntegrationsInFunction: addToAstroIntegrationsInFunction,
|
|
48670
|
+
addToAstroIntegrationsOrCreate: addToAstroIntegrationsOrCreate,
|
|
48671
|
+
addToAstroIntegrationsInFunctionOrCreate: addToAstroIntegrationsInFunctionOrCreate,
|
|
48593
48672
|
addToRollupFunction: addToRollupFunction,
|
|
48594
48673
|
addToRollupArrayConfig: addToRollupArrayConfig,
|
|
48595
48674
|
wrapModuleExports: wrapModuleExports,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "with-zephyr",
|
|
3
|
-
"version": "0.0.0-canary.
|
|
3
|
+
"version": "0.0.0-canary.18",
|
|
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.0.0-canary.
|
|
41
|
+
"zephyr-rsbuild-plugin": "0.0.0-canary.18"
|
|
42
42
|
},
|
|
43
43
|
"keywords": [
|
|
44
44
|
"zephyr",
|