@mui/internal-bundle-size-checker 1.0.9-canary.76 → 1.0.9-canary.78
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/README.md +7 -0
- package/package.json +3 -3
- package/src/configLoader.js +11 -0
- package/src/types.d.ts +1 -1
package/README.md
CHANGED
|
@@ -66,6 +66,13 @@ export default defineConfig(async () => {
|
|
|
66
66
|
importedNames: ['Button'],
|
|
67
67
|
// When externals is not specified, peer dependencies will be automatically excluded
|
|
68
68
|
},
|
|
69
|
+
// Expand a package into one entry per export from its package.json
|
|
70
|
+
{ id: '@mui/material', expand: true },
|
|
71
|
+
// Expand with glob exclusions (matched against the export subpath, e.g. `styles/colors`)
|
|
72
|
+
{
|
|
73
|
+
id: '@mui/material',
|
|
74
|
+
expand: { exclude: ['styles/**', 'internal/*'] },
|
|
75
|
+
},
|
|
69
76
|
// ...
|
|
70
77
|
],
|
|
71
78
|
// Optional upload configuration
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/internal-bundle-size-checker",
|
|
3
|
-
"version": "1.0.9-canary.
|
|
3
|
+
"version": "1.0.9-canary.78",
|
|
4
4
|
"author": "MUI Team",
|
|
5
5
|
"description": "Bundle size checker for MUI packages.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"micromatch": "^4.0.8",
|
|
37
37
|
"piscina": "^5.1.4",
|
|
38
38
|
"rollup-plugin-visualizer": "^7.0.1",
|
|
39
|
-
"vite": "^8.0.
|
|
39
|
+
"vite": "^8.0.10",
|
|
40
40
|
"yargs": "^18.0.0",
|
|
41
41
|
"zod": "^4.3.6"
|
|
42
42
|
},
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"@types/micromatch": "4.0.10",
|
|
46
46
|
"@types/yargs": "17.0.35"
|
|
47
47
|
},
|
|
48
|
-
"gitSha": "
|
|
48
|
+
"gitSha": "1e04001f0f8f7dda807b8ebf1219dd99f0862f5b",
|
|
49
49
|
"scripts": {
|
|
50
50
|
"build": "tsgo -p tsconfig.build.json",
|
|
51
51
|
"test": "pnpm -w test --project @mui/internal-bundle-size-checker",
|
package/src/configLoader.js
CHANGED
|
@@ -7,6 +7,7 @@ import path from 'node:path';
|
|
|
7
7
|
import envCi from 'env-ci';
|
|
8
8
|
import * as module from 'node:module';
|
|
9
9
|
import * as url from 'node:url';
|
|
10
|
+
import micromatch from 'micromatch';
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
13
|
* @typedef {import('./types.js').BundleSizeCheckerConfigObject} BundleSizeCheckerConfigObject
|
|
@@ -194,8 +195,18 @@ async function normalizeEntries(entries, configPath) {
|
|
|
194
195
|
}
|
|
195
196
|
const exportedPaths = await findExportedPaths(pkgJson);
|
|
196
197
|
|
|
198
|
+
const excludePatterns =
|
|
199
|
+
typeof entry.expand === 'object' && entry.expand.exclude ? entry.expand.exclude : [];
|
|
200
|
+
|
|
197
201
|
const expandedEntries = [];
|
|
198
202
|
for (const exportPath of exportedPaths) {
|
|
203
|
+
if (exportPath === './package.json') {
|
|
204
|
+
continue;
|
|
205
|
+
}
|
|
206
|
+
const subpath = exportPath === '.' ? '.' : exportPath.slice(2);
|
|
207
|
+
if (excludePatterns.length > 0 && micromatch.isMatch(subpath, excludePatterns)) {
|
|
208
|
+
continue;
|
|
209
|
+
}
|
|
199
210
|
const importSrc = entry.import + exportPath.slice(1);
|
|
200
211
|
expandedEntries.push({
|
|
201
212
|
id: importSrc,
|
package/src/types.d.ts
CHANGED
|
@@ -25,7 +25,7 @@ export interface ObjectEntry {
|
|
|
25
25
|
importedNames?: string[]; // Optional array of named imports
|
|
26
26
|
externals?: string[]; // Optional array of packages to exclude from the bundle
|
|
27
27
|
track?: boolean; // Whether this bundle should be tracked in PR comments (defaults to false)
|
|
28
|
-
expand?: boolean; //
|
|
28
|
+
expand?: boolean | { exclude?: string[] }; // Expand the entry to include all exports; pass `{ exclude }` with glob patterns (matched against export subpaths, e.g. `styles/**`) to skip specific paths
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
export type EntryPoint = StringEntry | ObjectEntry;
|