Skip to content

Commit 9ca1db5

Browse files
authored
chore: update prebundle to v1.5.0 and migrate config to TS (#6459)
1 parent 3e5f9ec commit 9ca1db5

File tree

13 files changed

+47
-42
lines changed

13 files changed

+47
-42
lines changed

nx.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
],
1313
"prebundle": [
1414
"{projectRoot}/package.json",
15-
"{projectRoot}/prebundle.config.mjs"
15+
"{projectRoot}/prebundle.config.ts"
1616
]
1717
},
1818
"targetDefaults": {

packages/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
"postcss": "^8.5.6",
8989
"postcss-load-config": "6.0.1",
9090
"postcss-loader": "8.2.0",
91-
"prebundle": "1.4.2",
91+
"prebundle": "1.5.0",
9292
"range-parser": "^1.2.1",
9393
"reduce-configs": "^1.1.1",
9494
"rslog": "^1.3.0",

packages/core/prebundle.config.mjs renamed to packages/core/prebundle.config.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
1-
// @ts-check
21
import fs from 'node:fs';
32
import { join } from 'node:path';
3+
import type { Config } from 'prebundle';
44

5-
function replaceFileContent(filePath, replaceFn) {
5+
function replaceFileContent(
6+
filePath: string,
7+
replaceFn: (content: string) => string,
8+
) {
69
const content = fs.readFileSync(filePath, 'utf-8');
710
const newContent = replaceFn(content);
811
if (newContent !== content) {
912
fs.writeFileSync(filePath, newContent);
1013
}
1114
}
1215

13-
/** @type {import('prebundle').Config} */
1416
export default {
1517
prettier: true,
1618
externals: {
@@ -179,4 +181,4 @@ export type SourceMapGenerator = unknown;
179181
},
180182
},
181183
],
182-
};
184+
} satisfies Config;

packages/core/rslib.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { nodeMinifyConfig } from '@rsbuild/config/rslib.config.ts';
44
import type { Rspack, rsbuild } from '@rslib/core';
55
import { defineConfig } from '@rslib/core';
66
import pkgJson from './package.json' with { type: 'json' };
7-
import prebundleConfig from './prebundle.config.mjs';
7+
import prebundleConfig from './prebundle.config.ts';
88

99
export const define = {
1010
RSBUILD_VERSION: JSON.stringify(pkgJson.version),

packages/plugin-babel/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"@scripts/test-helper": "workspace:*",
4545
"@types/node": "^22.18.12",
4646
"babel-loader": "10.0.0",
47-
"prebundle": "1.4.2",
47+
"prebundle": "1.5.0",
4848
"typescript": "^5.9.3"
4949
},
5050
"peerDependencies": {

packages/plugin-babel/prebundle.config.mjs renamed to packages/plugin-babel/prebundle.config.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// @ts-check
2-
/** @type {import('prebundle').Config} */
1+
import type { Config } from 'prebundle';
2+
33
export default {
44
prettier: true,
55
dependencies: [
@@ -11,4 +11,4 @@ export default {
1111
},
1212
},
1313
],
14-
};
14+
} satisfies Config;

packages/plugin-less/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"@types/less": "^3.0.8",
4141
"less": "4.3.0",
4242
"less-loader": "^12.3.0",
43-
"prebundle": "1.4.2",
43+
"prebundle": "1.5.0",
4444
"typescript": "^5.9.3"
4545
},
4646
"peerDependencies": {

packages/plugin-less/prebundle.config.mjs renamed to packages/plugin-less/prebundle.config.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
import fs from 'node:fs';
2-
// @ts-check
32
import { join } from 'node:path';
3+
import type { Config } from 'prebundle';
44

5-
function replaceFileContent(filePath, replaceFn) {
5+
function replaceFileContent(
6+
filePath: string,
7+
replaceFn: (content: string) => string,
8+
) {
69
const content = fs.readFileSync(filePath, 'utf-8');
710
const newContent = replaceFn(content);
811
if (newContent !== content) {
912
fs.writeFileSync(filePath, newContent);
1013
}
1114
}
1215

13-
/** @type {import('prebundle').Config} */
1416
export default {
1517
prettier: true,
1618
dependencies: [
@@ -41,4 +43,4 @@ export default {
4143
},
4244
},
4345
],
44-
};
46+
} satisfies Config;

packages/plugin-sass/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"@scripts/test-helper": "workspace:*",
4343
"@types/node": "^22.18.12",
4444
"@types/sass-loader": "^8.0.10",
45-
"prebundle": "1.4.2",
45+
"prebundle": "1.5.0",
4646
"resolve-url-loader": "^5.0.0",
4747
"sass-loader": "^16.0.6",
4848
"typescript": "^5.9.3"

packages/plugin-sass/prebundle.config.mjs renamed to packages/plugin-sass/prebundle.config.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
1-
// @ts-check
21
import fs from 'node:fs';
32
import { join } from 'node:path';
3+
import type { Config } from 'prebundle';
44

5-
function replaceFileContent(filePath, replaceFn) {
5+
function replaceFileContent(
6+
filePath: string,
7+
replaceFn: (content: string) => string,
8+
) {
69
const content = fs.readFileSync(filePath, 'utf-8');
710
const newContent = replaceFn(content);
811
if (newContent !== content) {
912
fs.writeFileSync(filePath, newContent);
1013
}
1114
}
1215

13-
/** @type {import('prebundle').Config} */
1416
export default {
1517
prettier: true,
1618
dependencies: [
@@ -41,4 +43,4 @@ export default {
4143
},
4244
},
4345
],
44-
};
46+
} satisfies Config;

0 commit comments

Comments
 (0)