@esmx/core 3.0.0-rc.59 → 3.0.0-rc.60
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/dist/core.mjs +4 -4
- package/dist/index.d.ts +3 -3
- package/dist/index.mjs +0 -6
- package/dist/manifest-json.d.ts +8 -21
- package/dist/module-config.d.ts +39 -144
- package/dist/module-config.mjs +145 -57
- package/dist/module-config.test.mjs +620 -509
- package/dist/pack-config.d.ts +2 -2
- package/dist/utils/import-map.d.ts +9 -5
- package/dist/utils/import-map.mjs +36 -23
- package/dist/utils/import-map.test.mjs +1139 -103
- package/package.json +3 -3
- package/src/core.ts +5 -4
- package/src/index.ts +14 -9
- package/src/manifest-json.ts +8 -22
- package/src/module-config.test.ts +636 -637
- package/src/module-config.ts +242 -257
- package/src/pack-config.ts +2 -2
- package/src/utils/import-map.test.ts +1207 -110
- package/src/utils/import-map.ts +63 -29
package/package.json
CHANGED
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"build": "unbuild"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@esmx/import": "3.0.0-rc.
|
|
62
|
+
"@esmx/import": "3.0.0-rc.60",
|
|
63
63
|
"@types/serialize-javascript": "^5.0.4",
|
|
64
64
|
"es-module-lexer": "^1.7.0",
|
|
65
65
|
"find": "^0.3.0",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"unbuild": "3.6.0",
|
|
78
78
|
"vitest": "3.2.4"
|
|
79
79
|
},
|
|
80
|
-
"version": "3.0.0-rc.
|
|
80
|
+
"version": "3.0.0-rc.60",
|
|
81
81
|
"type": "module",
|
|
82
82
|
"private": false,
|
|
83
83
|
"exports": {
|
|
@@ -100,5 +100,5 @@
|
|
|
100
100
|
"template",
|
|
101
101
|
"public"
|
|
102
102
|
],
|
|
103
|
-
"gitHead": "
|
|
103
|
+
"gitHead": "615e91c617e0a58796c591643c6a2e1d2a1f0a76"
|
|
104
104
|
}
|
package/src/core.ts
CHANGED
|
@@ -854,8 +854,8 @@ export class Esmx {
|
|
|
854
854
|
case 'client':
|
|
855
855
|
json = getImportMap({
|
|
856
856
|
manifests,
|
|
857
|
-
getScope(name) {
|
|
858
|
-
return `/${name}
|
|
857
|
+
getScope(name, scope) {
|
|
858
|
+
return `/${name}${scope}`;
|
|
859
859
|
},
|
|
860
860
|
getFile(name, file) {
|
|
861
861
|
return `/${name}/${file}`;
|
|
@@ -865,7 +865,7 @@ export class Esmx {
|
|
|
865
865
|
case 'server':
|
|
866
866
|
json = getImportMap({
|
|
867
867
|
manifests,
|
|
868
|
-
getScope: (name: string) => {
|
|
868
|
+
getScope: (name: string, scope: string) => {
|
|
869
869
|
const linkPath = moduleConfig.links[name].server;
|
|
870
870
|
// Get the real physical path instead of symbolic link
|
|
871
871
|
// This is crucial when generating import maps on the server side.
|
|
@@ -873,7 +873,8 @@ export class Esmx {
|
|
|
873
873
|
// because the actual accessed paths are real physical paths, not the symbolic links.
|
|
874
874
|
// Using realpathSync ensures path consistency between import map generation and runtime resolution.
|
|
875
875
|
const realPath = fs.realpathSync(linkPath);
|
|
876
|
-
return pathToFileURL(path.join(realPath,
|
|
876
|
+
return pathToFileURL(path.join(realPath, scope))
|
|
877
|
+
.href;
|
|
877
878
|
},
|
|
878
879
|
getFile: (name: string, file: string) => {
|
|
879
880
|
const linkPath = moduleConfig.links[name].server;
|
package/src/index.ts
CHANGED
|
@@ -7,15 +7,21 @@ export {
|
|
|
7
7
|
type ScopesMap,
|
|
8
8
|
Esmx
|
|
9
9
|
} from './core';
|
|
10
|
-
export {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
export type {
|
|
11
|
+
ModuleConfig,
|
|
12
|
+
ModuleConfigImportMapping,
|
|
13
|
+
ModuleConfigExportExports,
|
|
14
|
+
ModuleConfigExportExport,
|
|
15
|
+
ModuleConfigExportObject,
|
|
16
|
+
ParsedModuleConfig,
|
|
17
|
+
ParsedModuleConfigExports,
|
|
18
|
+
ParsedModuleConfigExport,
|
|
19
|
+
ParsedModuleConfigEnvironment,
|
|
20
|
+
ParsedModuleConfigLink
|
|
14
21
|
} from './module-config';
|
|
15
|
-
export {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
parsePackConfig
|
|
22
|
+
export type {
|
|
23
|
+
PackConfig,
|
|
24
|
+
ParsedPackConfig
|
|
19
25
|
} from './pack-config';
|
|
20
26
|
export { type App, createApp } from './app';
|
|
21
27
|
export {
|
|
@@ -33,7 +39,6 @@ export {
|
|
|
33
39
|
export type {
|
|
34
40
|
ManifestJson,
|
|
35
41
|
ManifestJsonChunk,
|
|
36
|
-
ManifestJsonChunkSizes,
|
|
37
42
|
ManifestJsonChunks,
|
|
38
43
|
ManifestJsonExport,
|
|
39
44
|
ManifestJsonExports
|
package/src/manifest-json.ts
CHANGED
|
@@ -13,15 +13,20 @@ export interface ManifestJson {
|
|
|
13
13
|
* Import mappings
|
|
14
14
|
*/
|
|
15
15
|
imports: Record<string, string>;
|
|
16
|
+
/**
|
|
17
|
+
* Scope-specific import mappings
|
|
18
|
+
* Type: Record<scope name, import mappings within that scope>
|
|
19
|
+
*/
|
|
20
|
+
scopes: Record<string, Record<string, string>>;
|
|
16
21
|
/**
|
|
17
22
|
* Export item configuration
|
|
18
23
|
* Type: Record<export path, export item information>
|
|
19
24
|
*/
|
|
20
25
|
exports: ManifestJsonExports;
|
|
21
26
|
/**
|
|
22
|
-
* Build output
|
|
27
|
+
* Build output files
|
|
23
28
|
*/
|
|
24
|
-
|
|
29
|
+
files: string[];
|
|
25
30
|
/**
|
|
26
31
|
* Compiled file information
|
|
27
32
|
* Type: Record<source file, compilation information>
|
|
@@ -48,7 +53,7 @@ export interface ManifestJsonExport {
|
|
|
48
53
|
* - true: Rewrite to '{serviceName}/{exportName}' format
|
|
49
54
|
* - false: Maintain original import paths
|
|
50
55
|
*/
|
|
51
|
-
|
|
56
|
+
pkg: boolean;
|
|
52
57
|
/**
|
|
53
58
|
* File path corresponding to the export item
|
|
54
59
|
*/
|
|
@@ -75,25 +80,6 @@ export interface ManifestJsonChunk {
|
|
|
75
80
|
* Other resource files.
|
|
76
81
|
*/
|
|
77
82
|
resources: string[];
|
|
78
|
-
/**
|
|
79
|
-
* Build output sizes.
|
|
80
|
-
*/
|
|
81
|
-
sizes: ManifestJsonChunkSizes;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export interface ManifestJsonChunkSizes {
|
|
85
|
-
/**
|
|
86
|
-
* JavaScript file size in bytes
|
|
87
|
-
*/
|
|
88
|
-
js: number;
|
|
89
|
-
/**
|
|
90
|
-
* CSS file size in bytes
|
|
91
|
-
*/
|
|
92
|
-
css: number;
|
|
93
|
-
/**
|
|
94
|
-
* Resource file size in bytes
|
|
95
|
-
*/
|
|
96
|
-
resource: number;
|
|
97
83
|
}
|
|
98
84
|
|
|
99
85
|
/**
|