@silexpert/core 1.3.214-esm-8 → 1.3.214-esm-9
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/ESM-MIGRATION.md +78 -0
- package/package.json +19 -1
package/ESM-MIGRATION.md
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# ESM Migration Guide
|
|
2
|
+
|
|
3
|
+
## ✅ Completed Changes
|
|
4
|
+
|
|
5
|
+
Your core repository is now ESM-friendly for Nuxt4! Here's what was updated:
|
|
6
|
+
|
|
7
|
+
### 1. Package.json Enhancements
|
|
8
|
+
|
|
9
|
+
- **Enhanced exports**: Added development and default conditions for better compatibility
|
|
10
|
+
- **Improved imports**: Added `#types/*` and `#api/*` for cleaner internal imports
|
|
11
|
+
- **ESM metadata**: Added `sideEffects: false` for tree-shaking optimization
|
|
12
|
+
- **Node.js compatibility**: Lowered requirement to >=20 for broader compatibility
|
|
13
|
+
- **Keywords**: Added relevant ESM and framework keywords
|
|
14
|
+
|
|
15
|
+
### 2. TypeScript Configuration Fixes
|
|
16
|
+
|
|
17
|
+
- **Consistent module resolution**: Fixed "NodeNext" capitalization
|
|
18
|
+
- **Better lib targets**: Updated from "esnext" to specific "ES2022" + "DOM"
|
|
19
|
+
- **Fixed syntax**: Removed invalid trailing comma
|
|
20
|
+
- **Type safety improvements**: Fixed several type-only imports for better ESM compliance
|
|
21
|
+
|
|
22
|
+
### 3. ESM Compliance Verification
|
|
23
|
+
|
|
24
|
+
- ✅ All source files already use proper `.js` extensions in imports
|
|
25
|
+
- ✅ No CommonJS patterns detected (module.exports, require(), etc.)
|
|
26
|
+
- ✅ Package marked as ESM with `"type": "module"`
|
|
27
|
+
- ✅ Build compiles successfully
|
|
28
|
+
|
|
29
|
+
## 🚀 Using with Nuxt4
|
|
30
|
+
|
|
31
|
+
Your core package can now be safely used in Nuxt4 projects:
|
|
32
|
+
|
|
33
|
+
```typescript
|
|
34
|
+
// In your Nuxt4 app
|
|
35
|
+
import { Silex } from '@silexpert/core';
|
|
36
|
+
|
|
37
|
+
// Or use specific utilities
|
|
38
|
+
import { brandUtils } from '@silexpert/core';
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## 🔧 Next Steps (Optional Improvements)
|
|
42
|
+
|
|
43
|
+
### Enable Strict ESM Mode
|
|
44
|
+
|
|
45
|
+
For even better ESM compliance, you can progressively enable `verbatimModuleSyntax`:
|
|
46
|
+
|
|
47
|
+
1. **Add to tsconfig-base.json**:
|
|
48
|
+
|
|
49
|
+
```json
|
|
50
|
+
{
|
|
51
|
+
"compilerOptions": {
|
|
52
|
+
"verbatimModuleSyntax": true
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
2. **Fix remaining type imports**: Convert `import { Type }` to `import type { Type }` for interfaces and types that aren't used at runtime.
|
|
58
|
+
|
|
59
|
+
### Performance Optimization
|
|
60
|
+
|
|
61
|
+
- Consider enabling `"isolatedModules": true` for faster builds
|
|
62
|
+
- Add `"noUncheckedIndexedAccess": true` for better type safety
|
|
63
|
+
|
|
64
|
+
## 📦 Build & Publish
|
|
65
|
+
|
|
66
|
+
Your existing build process remains the same:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
npm run tsc # Compile TypeScript
|
|
70
|
+
npm publish # Publish to npm
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
The package is now fully compatible with:
|
|
74
|
+
|
|
75
|
+
- ✅ Nuxt4
|
|
76
|
+
- ✅ Vue 3 with Vite
|
|
77
|
+
- ✅ Modern bundlers (Webpack 5+, Rollup, etc.)
|
|
78
|
+
- ✅ Node.js 20+ ESM environments
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@silexpert/core",
|
|
3
|
-
"version": "1.3.214-esm-
|
|
3
|
+
"version": "1.3.214-esm-9",
|
|
4
4
|
"description": "Silex Core perform HTTP Request and object binding. Silex core helps developers to retrieve and return formatted object",
|
|
5
5
|
"homepage": "https://gitlab.compta-clementine.fr/dev/silex-api",
|
|
6
6
|
"type": "module",
|
|
@@ -9,6 +9,18 @@
|
|
|
9
9
|
"types": "./dist/index.d.ts",
|
|
10
10
|
"exports": {
|
|
11
11
|
".": {
|
|
12
|
+
"browser": {
|
|
13
|
+
"development": "./dist/index.js",
|
|
14
|
+
"import": "./dist/index.js",
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"default": "./dist/index.js"
|
|
17
|
+
},
|
|
18
|
+
"node": {
|
|
19
|
+
"development": "./dist/index.js",
|
|
20
|
+
"import": "./dist/index.js",
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"default": "./dist/index.js"
|
|
23
|
+
},
|
|
12
24
|
"development": "./dist/index.js",
|
|
13
25
|
"import": "./dist/index.js",
|
|
14
26
|
"types": "./dist/index.d.ts",
|
|
@@ -16,6 +28,12 @@
|
|
|
16
28
|
},
|
|
17
29
|
"./package.json": "./package.json"
|
|
18
30
|
},
|
|
31
|
+
"browser": {
|
|
32
|
+
"debug": false
|
|
33
|
+
},
|
|
34
|
+
"resolutions": {
|
|
35
|
+
"debug": "^4.3.7"
|
|
36
|
+
},
|
|
19
37
|
"sideEffects": false,
|
|
20
38
|
"imports": {
|
|
21
39
|
"#utils/*": "./dist/utils/*",
|