@jiayouzuo/vite-module-federation-core 0.6.1 → 0.6.2
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/index.d.ts.map +1 -1
- package/dist/index.js +6 -0
- package/dist/prod/shared.d.ts.map +1 -1
- package/dist/prod/shared.js +2 -1
- package/package.json +1 -1
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,MAAM,EAAiC,MAAM,MAAM,CAAA;AACjE,OAAO,KAAK,EAAE,2BAA2B,EAAuB,MAAM,YAAY,CAAA;AAUlF,YAAY,EAAE,2BAA2B,EAAE,MAAM,YAAY,CAAA;AA8B7D;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,OAAO,EAAE,2BAA2B,GAAG,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,MAAM,EAAiC,MAAM,MAAM,CAAA;AACjE,OAAO,KAAK,EAAE,2BAA2B,EAAuB,MAAM,YAAY,CAAA;AAUlF,YAAY,EAAE,2BAA2B,EAAE,MAAM,YAAY,CAAA;AA8B7D;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,OAAO,EAAE,2BAA2B,GAAG,MAAM,EAAE,CAuKjF"}
|
package/dist/index.js
CHANGED
|
@@ -132,12 +132,14 @@ export default function federation(options) {
|
|
|
132
132
|
}
|
|
133
133
|
},
|
|
134
134
|
async transform(code, id) {
|
|
135
|
+
let modified = false;
|
|
135
136
|
for (const plugin of subPlugins) {
|
|
136
137
|
if (plugin.transform) {
|
|
137
138
|
const result = await plugin.transform.call(this, code, id);
|
|
138
139
|
if (result) {
|
|
139
140
|
if (typeof result === 'string') {
|
|
140
141
|
code = result;
|
|
142
|
+
modified = true;
|
|
141
143
|
}
|
|
142
144
|
else if (result.code) {
|
|
143
145
|
return result;
|
|
@@ -145,6 +147,10 @@ export default function federation(options) {
|
|
|
145
147
|
}
|
|
146
148
|
}
|
|
147
149
|
}
|
|
150
|
+
// 如果有修改,返回修改后的代码
|
|
151
|
+
if (modified) {
|
|
152
|
+
return code;
|
|
153
|
+
}
|
|
148
154
|
},
|
|
149
155
|
outputOptions(outputOptions) {
|
|
150
156
|
for (const plugin of subPlugins) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/prod/shared.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,mBAAmB,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAA;AAWnF,eAAO,MAAM,oBAAoB,ssGA0FhC,CAAA;AAID,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,2BAA2B,GAAG,mBAAmB,
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/prod/shared.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,mBAAmB,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAA;AAWnF,eAAO,MAAM,oBAAoB,ssGA0FhC,CAAA;AAID,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,2BAA2B,GAAG,mBAAmB,CAsK1F"}
|
package/dist/prod/shared.js
CHANGED
|
@@ -122,7 +122,8 @@ export function prodSharedPlugin(options) {
|
|
|
122
122
|
return inputOptions;
|
|
123
123
|
},
|
|
124
124
|
async buildStart() {
|
|
125
|
-
|
|
125
|
+
// Host 和 Remote 都需要 __federation_fn_import 来处理共享依赖
|
|
126
|
+
if (parsedOptions.prodShared.length && (isRemote || isHost)) {
|
|
126
127
|
this.emitFile({
|
|
127
128
|
name: '__federation_fn_import',
|
|
128
129
|
type: 'chunk',
|