@rollipop/plugin-module-federation 1.0.0-alpha.21 → 1.0.0-alpha.23
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 +22 -0
- package/dist/index.js +11 -27
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @rollipop/plugin-module-federation
|
|
2
2
|
|
|
3
|
+
## 1.0.0-alpha.23
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 146b656: refactor: use native magic string instead
|
|
8
|
+
- Updated dependencies [812db55]
|
|
9
|
+
- Updated dependencies [790697e]
|
|
10
|
+
- Updated dependencies [b52246e]
|
|
11
|
+
- rollipop@1.0.0-alpha.23
|
|
12
|
+
|
|
13
|
+
## 1.0.0-alpha.22
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Updated dependencies [3c67f3a]
|
|
18
|
+
- Updated dependencies [53630e0]
|
|
19
|
+
- Updated dependencies [6c2ae0d]
|
|
20
|
+
- Updated dependencies [1c059a4]
|
|
21
|
+
- Updated dependencies [758fe67]
|
|
22
|
+
- Updated dependencies [6c97ee3]
|
|
23
|
+
- rollipop@1.0.0-alpha.22
|
|
24
|
+
|
|
3
25
|
## 1.0.0-alpha.21
|
|
4
26
|
|
|
5
27
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
import
|
|
4
|
-
import { id, include, prefixRegex } from "rollipop/
|
|
3
|
+
import { invariant } from "es-toolkit";
|
|
4
|
+
import { id, include, prefixRegex } from "rollipop/filter";
|
|
5
5
|
import baseDedent from "dedent";
|
|
6
6
|
import fs from "node:fs";
|
|
7
7
|
//#region src/constants.ts
|
|
@@ -10,7 +10,6 @@ const VIRTUAL_PREFIX = "\0rollipop:module-federation:";
|
|
|
10
10
|
const VIRTUAL_HOST_INIT_ID = `${VIRTUAL_PREFIX}host-init`;
|
|
11
11
|
const VIRTUAL_RUNTIME_ADAPTER_ID = `${VIRTUAL_PREFIX}runtime-adapter`;
|
|
12
12
|
const VIRTUAL_SHARE_SCOPE_ID = `${VIRTUAL_PREFIX}share-scope`;
|
|
13
|
-
`${VIRTUAL_PREFIX}`;
|
|
14
13
|
const VIRTUAL_SHARED_SHIM_PREFIX = `${VIRTUAL_PREFIX}shared:`;
|
|
15
14
|
const VIRTUAL_REMOTE_PROXY_PREFIX = `${VIRTUAL_PREFIX}remote:`;
|
|
16
15
|
const SCRIPT_LOADER_GLOBAL = "__rollipop_script_loader__";
|
|
@@ -260,19 +259,6 @@ function resolveVirtualId(source) {
|
|
|
260
259
|
return null;
|
|
261
260
|
}
|
|
262
261
|
//#endregion
|
|
263
|
-
//#region src/host/transform.ts
|
|
264
|
-
function transformHostEntry(code, id) {
|
|
265
|
-
const magicString = new MagicString(code);
|
|
266
|
-
magicString.prepend(`import ${JSON.stringify(VIRTUAL_HOST_INIT_ID)};\n`);
|
|
267
|
-
return {
|
|
268
|
-
code: magicString.toString(),
|
|
269
|
-
map: magicString.generateMap({
|
|
270
|
-
hires: true,
|
|
271
|
-
source: id
|
|
272
|
-
})
|
|
273
|
-
};
|
|
274
|
-
}
|
|
275
|
-
//#endregion
|
|
276
262
|
//#region src/shared/resolve-version.ts
|
|
277
263
|
function resolveSharedVersion(packageName, projectRoot) {
|
|
278
264
|
try {
|
|
@@ -559,7 +545,9 @@ function moduleFederationPlugin(config) {
|
|
|
559
545
|
return null;
|
|
560
546
|
}
|
|
561
547
|
},
|
|
562
|
-
transform: { handler(code, id) {
|
|
548
|
+
transform: { handler(code, id, meta) {
|
|
549
|
+
const { magicString } = meta;
|
|
550
|
+
invariant(magicString, "magicString not found");
|
|
563
551
|
if (normalized == null || resolvedConfig == null) return null;
|
|
564
552
|
if (id.startsWith("\0rollipop:module-federation:")) return null;
|
|
565
553
|
const isEntry = this.getModuleInfo(id)?.isEntry ?? false;
|
|
@@ -569,17 +557,13 @@ function moduleFederationPlugin(config) {
|
|
|
569
557
|
name: normalized.name,
|
|
570
558
|
exposes: exposesAbsolute
|
|
571
559
|
});
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
source: id
|
|
579
|
-
})
|
|
580
|
-
};
|
|
560
|
+
magicString.append("\n" + containerCode);
|
|
561
|
+
return { code: magicString };
|
|
562
|
+
}
|
|
563
|
+
if (hasRemotes && isEntry) {
|
|
564
|
+
magicString.prepend(`import ${JSON.stringify(VIRTUAL_HOST_INIT_ID)};\n`);
|
|
565
|
+
return { code: magicString };
|
|
581
566
|
}
|
|
582
|
-
if (hasRemotes && isEntry) return transformHostEntry(code, id);
|
|
583
567
|
return null;
|
|
584
568
|
} },
|
|
585
569
|
watchChange() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rollipop/plugin-module-federation",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.23",
|
|
4
4
|
"homepage": "https://github.com/leegeunhyeok/rollipop#readme",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/leegeunhyeok/rollipop/issues"
|
|
@@ -36,17 +36,17 @@
|
|
|
36
36
|
"build": "vp pack"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@module-federation/runtime": "
|
|
40
|
-
"@module-federation/sdk": "
|
|
41
|
-
"dedent": "
|
|
42
|
-
"
|
|
39
|
+
"@module-federation/runtime": "2.5.1",
|
|
40
|
+
"@module-federation/sdk": "2.5.1",
|
|
41
|
+
"dedent": "1.7.2",
|
|
42
|
+
"es-toolkit": "1.47.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"rollipop": "1.0.0-alpha.
|
|
45
|
+
"rollipop": "1.0.0-alpha.23",
|
|
46
46
|
"typescript": "6.0.3",
|
|
47
|
-
"vite-plus": "
|
|
47
|
+
"vite-plus": "0.1.24"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"rollipop": "1.0.0-alpha.
|
|
50
|
+
"rollipop": "1.0.0-alpha.23"
|
|
51
51
|
}
|
|
52
52
|
}
|