Skip to content

Commit da88f02

Browse files
committed
Bump size-limit packages to version 12.0.0
1 parent e1c89e1 commit da88f02

File tree

3 files changed

+4152
-3452
lines changed

3 files changed

+4152
-3452
lines changed

packages/toolkit/.size-limit.mts

Lines changed: 41 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -12,51 +12,62 @@ const allPackageEntryPoints = [
1212
'./dist/react/redux-toolkit-react.modern.mjs',
1313
'./dist/query/rtk-query.modern.mjs',
1414
'./dist/query/react/rtk-query-react.modern.mjs',
15-
] as const
15+
] as const satisfies string[]
1616

17-
const dependencies = Object.keys(packageJson.dependencies ?? {})
17+
const peerAndProductionDependencies = Object.keys({
18+
...packageJson.dependencies,
19+
...packageJson.peerDependencies,
20+
} as const)
1821

1922
const sizeLimitConfig: SizeLimitConfig = (
2023
await Promise.all(
2124
allNodeEnvs.flatMap((nodeEnv) => {
22-
const modifyWebpackConfig = ((config: Configuration) => {
23-
;(config.optimization ??= {}).nodeEnv = nodeEnv
24-
25-
return config
26-
}) satisfies Check['modifyWebpackConfig']
25+
const modifyWebpackConfig = ((config: Configuration): Configuration =>
26+
({
27+
...config,
28+
optimization: {
29+
...config.optimization,
30+
nodeEnv,
31+
},
32+
}) as const satisfies Configuration) satisfies Check['modifyWebpackConfig']
2733

2834
return allPackageEntryPoints.map(async (entryPoint, index) => {
2935
const allNamedImports = Object.keys(await import(entryPoint)).filter(
3036
(namedImport) => namedImport !== 'default',
3137
)
3238

33-
const sizeLimitConfigWithDependencies = allNamedImports
34-
.map<Check>((namedImport, namedImportIndex) => ({
39+
const sizeLimitConfigWithDependencies = [
40+
...allNamedImports.map(
41+
(namedImport, namedImportIndex) =>
42+
({
43+
path: entryPoint,
44+
name: `${(index + 1).toString()}-${(namedImportIndex + 1).toString()}. import { ${namedImport} } from "${entryPoint}" ('${nodeEnv}' mode)`,
45+
import: `{ ${namedImport} }`,
46+
modifyWebpackConfig,
47+
}) as const satisfies Check,
48+
),
49+
{
50+
path: entryPoint,
51+
name: `${(index + 1).toString()}-${(allNamedImports.length + 1).toString()}. import * from "${entryPoint}" ('${nodeEnv}' mode)`,
52+
import: '*',
53+
modifyWebpackConfig,
54+
},
55+
{
3556
path: entryPoint,
36-
name: `${index + 1}-${namedImportIndex + 1}. import { ${namedImport} } from "${entryPoint}" ('${nodeEnv}' mode)`,
37-
import: `{ ${namedImport} }`,
57+
name: `${(index + 1).toString()}-${(allNamedImports.length + 2).toString()}. import "${entryPoint}" ('${nodeEnv}' mode)`,
3858
modifyWebpackConfig,
39-
}))
40-
.concat([
41-
{
42-
path: entryPoint,
43-
name: `${index + 1}-${allNamedImports.length + 1}. import * from "${entryPoint}" ('${nodeEnv}' mode)`,
44-
import: '*',
45-
modifyWebpackConfig,
46-
},
47-
{
48-
path: entryPoint,
49-
name: `${index + 1}-${allNamedImports.length + 2}. import "${entryPoint}" ('${nodeEnv}' mode)`,
50-
modifyWebpackConfig,
51-
},
52-
])
59+
},
60+
] as const satisfies SizeLimitConfig
5361

5462
const sizeLimitConfigWithoutDependencies =
55-
sizeLimitConfigWithDependencies.map((check) => ({
56-
...check,
57-
name: `${check.name} (excluding dependencies)`,
58-
ignore: dependencies,
59-
}))
63+
sizeLimitConfigWithDependencies.map(
64+
(check) =>
65+
({
66+
...check,
67+
name: `${check.name} (excluding dependencies)`,
68+
ignore: peerAndProductionDependencies,
69+
}) as const satisfies Check,
70+
)
6071

6172
return [
6273
// ...sizeLimitConfigWithDependencies,

packages/toolkit/package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,8 @@
188188
"@babel/helper-module-imports": "^7.24.7",
189189
"@microsoft/api-extractor": "^7.13.2",
190190
"@phryneas/ts-version": "^1.0.2",
191-
"@size-limit/file": "^11.0.1",
192-
"@size-limit/webpack": "^11.0.1",
191+
"@size-limit/file": "^12.0.0",
192+
"@size-limit/webpack": "^12.0.0",
193193
"@testing-library/dom": "^10.4.0",
194194
"@testing-library/react": "^16.0.1",
195195
"@testing-library/react-render-stream": "^1.0.3",
@@ -219,6 +219,7 @@
219219
"eslint-plugin-react-hooks": "^4.2.0",
220220
"fs-extra": "^9.1.0",
221221
"invariant": "^2.2.4",
222+
"jiti": "^2.6.1",
222223
"jsdom": "^25.0.1",
223224
"json-stringify-safe": "^5.0.1",
224225
"msw": "^2.1.4",
@@ -228,7 +229,7 @@
228229
"react": "^19.0.0",
229230
"react-dom": "^19.0.0",
230231
"rimraf": "^3.0.2",
231-
"size-limit": "^11.0.1",
232+
"size-limit": "^12.0.0",
232233
"tslib": "^1.10.0",
233234
"tsup": "^8.4.0",
234235
"tsx": "^4.19.0",

0 commit comments

Comments
 (0)