@abyss-project/commons-front-core 21.8.0 → 21.8.1
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/CHANGELOG.md +4 -0
- package/dist/index.js +8001 -7891
- package/package.json +2 -2
- package/scripts/check-dist-dir-imports.cjs +42 -0
- package/vite.config.ts +4 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abyss-project/commons-front-core",
|
|
3
|
-
"version": "21.8.
|
|
3
|
+
"version": "21.8.1",
|
|
4
4
|
"description": "Front Core package of AbyssProject",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -175,7 +175,7 @@
|
|
|
175
175
|
"lint": "eslint \"{src,apps,libs,test,core,catalog}/**/*.{ts,tsx}\" --fix",
|
|
176
176
|
"lint:check": "eslint \"{src,apps,libs,test,core,catalog}/**/*.{ts,tsx}\" --max-warnings 0",
|
|
177
177
|
"tsc": "tsc --noEmit && tsc --noEmit -p catalog/tsconfig.json",
|
|
178
|
-
"build": "vite build && node scripts/check-auth-entry-isolation.cjs",
|
|
178
|
+
"build": "vite build && node scripts/check-auth-entry-isolation.cjs && node scripts/check-dist-dir-imports.cjs",
|
|
179
179
|
"dev": "vite build --watch",
|
|
180
180
|
"test": "vitest run --config vitest.config.ts",
|
|
181
181
|
"test:watch": "vitest --config vitest.config.ts",
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/* eslint-disable no-console */
|
|
3
|
+
'use strict';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* check-dist-dir-imports.cjs — build guard against bare DIRECTORY imports left in `dist/`.
|
|
7
|
+
*
|
|
8
|
+
* `@mui/x-date-pickers` v6 ships sub-paths (`AdapterDateFns`, `PickersDay`, `locales`) as
|
|
9
|
+
* directories without an `exports` map entry. A consumer that loads the dist under Node ESM (vitest
|
|
10
|
+
* in every satellite front) fails on such an import with ERR_UNSUPPORTED_DIR_IMPORT, so
|
|
11
|
+
* `vite.config.ts` bundles them. This guard fails the build when a chunk still imports one of them,
|
|
12
|
+
* so the next sub-path added to a date component cannot reach npm unbundled (core 21.8.0 did, #821).
|
|
13
|
+
*
|
|
14
|
+
* Exit 0: no such import. Exit 1: offending files and specifiers printed. Exit 2: dist absent.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
const fs = require('fs');
|
|
18
|
+
const path = require('path');
|
|
19
|
+
|
|
20
|
+
const DIST_DIR = path.resolve(__dirname, '../dist');
|
|
21
|
+
const PATTERN = /from\s*["'](@mui\/x-date-pickers\/[^"']+)["']|import\s*\(\s*["'](@mui\/x-date-pickers\/[^"']+)["']/g;
|
|
22
|
+
|
|
23
|
+
if (!fs.existsSync(DIST_DIR)) {
|
|
24
|
+
console.error('check-dist-dir-imports: dist/ is missing, build the package first.');
|
|
25
|
+
process.exit(2);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const offenders = [];
|
|
29
|
+
for (const name of fs.readdirSync(DIST_DIR)) {
|
|
30
|
+
if (!name.endsWith('.js')) continue;
|
|
31
|
+
const source = fs.readFileSync(path.join(DIST_DIR, name), 'utf8');
|
|
32
|
+
for (const match of source.matchAll(PATTERN)) {
|
|
33
|
+
offenders.push(`${name}: ${match[1] ?? match[2]}`);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (offenders.length > 0) {
|
|
38
|
+
console.error('check-dist-dir-imports: @mui/x-date-pickers sub-path imports left in dist/ (bundle them in vite.config.ts):');
|
|
39
|
+
for (const offender of offenders) console.error(` ${offender}`);
|
|
40
|
+
process.exit(1);
|
|
41
|
+
}
|
|
42
|
+
console.log('check-dist-dir-imports: no @mui/x-date-pickers sub-path import in dist/.');
|
package/vite.config.ts
CHANGED
|
@@ -107,16 +107,17 @@ export default defineConfig({
|
|
|
107
107
|
if (exactNames.includes(id)) return true;
|
|
108
108
|
if (exactNames.some((name) => id.startsWith(name + '/'))) return true;
|
|
109
109
|
// x-date-pickers v6's `exports` map exposes only the bare ROOT and a few
|
|
110
|
-
// named entries — NOT the DIRECTORY sub-paths `AdapterDateFns`
|
|
111
|
-
// `
|
|
110
|
+
// named entries — NOT the DIRECTORY sub-paths `AdapterDateFns`, `PickersDay`
|
|
111
|
+
// and `locales` that the date components import directly. Left
|
|
112
112
|
// externalized, those bare directory imports are unresolvable under Node
|
|
113
113
|
// ESM (ERR_UNSUPPORTED_DIR_IMPORT — breaks vitest in every consumer that
|
|
114
|
-
// pulls the theme/date components). Bundle exactly those
|
|
114
|
+
// pulls the theme/date components). Bundle exactly those sub-paths so
|
|
115
115
|
// the dist carries no such import (the bare root stays external below).
|
|
116
116
|
// (Icon sub-paths like `@mui/icons-material/AddRounded` are `.js` FILES
|
|
117
117
|
// and resolve fine, so they stay externalized.)
|
|
118
118
|
if (id === '@mui/x-date-pickers/AdapterDateFns') return false;
|
|
119
119
|
if (id === '@mui/x-date-pickers/PickersDay') return false;
|
|
120
|
+
if (id === '@mui/x-date-pickers/locales') return false;
|
|
120
121
|
// Bundled on purpose, see `resolve.alias` above.
|
|
121
122
|
if (id === '@abyss-project/main/plan-name') return false;
|
|
122
123
|
if (id === '@abyss-project/main/billing-metric-label') return false;
|