@module-federation/esbuild 0.0.80 → 0.0.82
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/build.d.ts +5 -1
- package/dist/build.js +481 -0
- package/dist/build.mjs +380 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +36 -0
- package/dist/index.mjs +2 -0
- package/dist/plugin.js +1247 -0
- package/dist/{plugin.esm.js → plugin.mjs} +198 -317
- package/dist/resolve/esm-resolver.mjs +22 -15
- package/package.json +18 -25
- package/dist/build.cjs.js +0 -532
- package/dist/build.cjs.js.map +0 -1
- package/dist/build.esm.js +0 -494
- package/dist/build.esm.js.map +0 -1
- package/dist/get-externals.cjs.js +0 -22
- package/dist/get-externals.cjs.js.map +0 -1
- package/dist/get-externals.esm.js +0 -20
- package/dist/get-externals.esm.js.map +0 -1
- package/dist/index.cjs.js +0 -6
- package/dist/index.cjs.js.map +0 -1
- package/dist/index.esm.js +0 -4
- package/dist/index.esm.js.map +0 -1
- package/dist/plugin.cjs.js +0 -1313
- package/dist/plugin.cjs.js.map +0 -1
- package/dist/plugin.d.ts +0 -1
- package/dist/plugin.esm.js.map +0 -1
- package/dist/src/build.d.ts +0 -5
- package/dist/src/index.d.ts +0 -2
- /package/dist/{src/adapters → adapters}/lib/collect-exports.d.ts +0 -0
- /package/dist/{src/adapters → adapters}/lib/commonjs.d.ts +0 -0
- /package/dist/{src/adapters → adapters}/lib/containerPlugin.d.ts +0 -0
- /package/dist/{src/adapters → adapters}/lib/containerReference.d.ts +0 -0
- /package/dist/{src/adapters → adapters}/lib/lexer.d.ts +0 -0
- /package/dist/{src/adapters → adapters}/lib/linkRemotesPlugin.d.ts +0 -0
- /package/dist/{src/adapters → adapters}/lib/manifest.d.ts +0 -0
- /package/dist/{src/adapters → adapters}/lib/plugin.d.ts +0 -0
- /package/dist/{src/adapters → adapters}/lib/react-replacements.d.ts +0 -0
- /package/dist/{src/adapters → adapters}/lib/transform.d.ts +0 -0
- /package/dist/{src/adapters → adapters}/lib/utils.d.ts +0 -0
- /package/dist/{src/lib → lib}/config/configuration-context.d.ts +0 -0
- /package/dist/{src/lib → lib}/config/federation-config.d.ts +0 -0
- /package/dist/{src/lib → lib}/config/share-utils.d.ts +0 -0
- /package/dist/{src/lib → lib}/config/with-native-federation.d.ts +0 -0
- /package/dist/{src/lib → lib}/core/build-adapter.d.ts +0 -0
- /package/dist/{src/lib → lib}/core/createContainerTemplate.d.ts +0 -0
- /package/dist/{src/lib → lib}/core/default-skip-list.d.ts +0 -0
- /package/dist/{src/lib → lib}/core/federation-options.d.ts +0 -0
- /package/dist/{src/lib → lib}/core/get-externals.d.ts +0 -0
- /package/dist/{src/lib → lib}/core/load-federation-config.d.ts +0 -0
- /package/dist/{src/lib → lib}/core/write-federation-info.d.ts +0 -0
- /package/dist/{src/lib → lib}/utils/logger.d.ts +0 -0
- /package/dist/{src/lib → lib}/utils/mapped-paths.d.ts +0 -0
- /package/dist/{src/lib → lib}/utils/normalize.d.ts +0 -0
- /package/dist/{src/lib → lib}/utils/package-info.d.ts +0 -0
package/dist/plugin.js
ADDED
|
@@ -0,0 +1,1247 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_modules__ = {
|
|
3
|
+
esbuild: function(module) {
|
|
4
|
+
module.exports = require("esbuild");
|
|
5
|
+
},
|
|
6
|
+
"cjs-module-lexer": function(module) {
|
|
7
|
+
module.exports = import("cjs-module-lexer").then(function(module) {
|
|
8
|
+
return module;
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
var __webpack_module_cache__ = {};
|
|
13
|
+
function __webpack_require__(moduleId) {
|
|
14
|
+
var cachedModule = __webpack_module_cache__[moduleId];
|
|
15
|
+
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
16
|
+
var module = __webpack_module_cache__[moduleId] = {
|
|
17
|
+
exports: {}
|
|
18
|
+
};
|
|
19
|
+
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
20
|
+
return module.exports;
|
|
21
|
+
}
|
|
22
|
+
(()=>{
|
|
23
|
+
__webpack_require__.n = (module)=>{
|
|
24
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
25
|
+
__webpack_require__.d(getter, {
|
|
26
|
+
a: getter
|
|
27
|
+
});
|
|
28
|
+
return getter;
|
|
29
|
+
};
|
|
30
|
+
})();
|
|
31
|
+
(()=>{
|
|
32
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
33
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
34
|
+
enumerable: true,
|
|
35
|
+
get: definition[key]
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
})();
|
|
39
|
+
(()=>{
|
|
40
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
41
|
+
})();
|
|
42
|
+
(()=>{
|
|
43
|
+
__webpack_require__.r = (exports1)=>{
|
|
44
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
45
|
+
value: 'Module'
|
|
46
|
+
});
|
|
47
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
48
|
+
value: true
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
})();
|
|
52
|
+
var __webpack_exports__ = {};
|
|
53
|
+
(()=>{
|
|
54
|
+
__webpack_require__.r(__webpack_exports__);
|
|
55
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
56
|
+
createVirtualRemoteModule: ()=>plugin_createVirtualRemoteModule,
|
|
57
|
+
createVirtualShareModule: ()=>createVirtualShareModule,
|
|
58
|
+
moduleFederationPlugin: ()=>moduleFederationPlugin
|
|
59
|
+
});
|
|
60
|
+
const external_fs_namespaceObject = require("fs");
|
|
61
|
+
var external_fs_default = /*#__PURE__*/ __webpack_require__.n(external_fs_namespaceObject);
|
|
62
|
+
const external_es_module_lexer_namespaceObject = require("es-module-lexer");
|
|
63
|
+
const external_cjs_module_lexer_namespaceObject = require("cjs-module-lexer");
|
|
64
|
+
const external_util_namespaceObject = require("util");
|
|
65
|
+
const external_enhanced_resolve_namespaceObject = require("enhanced-resolve");
|
|
66
|
+
var external_enhanced_resolve_default = /*#__PURE__*/ __webpack_require__.n(external_enhanced_resolve_namespaceObject);
|
|
67
|
+
const external_path_namespaceObject = require("path");
|
|
68
|
+
var external_path_default = /*#__PURE__*/ __webpack_require__.n(external_path_namespaceObject);
|
|
69
|
+
const resolve = (0, external_util_namespaceObject.promisify)(external_enhanced_resolve_default().create({
|
|
70
|
+
mainFields: [
|
|
71
|
+
'browser',
|
|
72
|
+
'module',
|
|
73
|
+
'main'
|
|
74
|
+
]
|
|
75
|
+
}));
|
|
76
|
+
async function getExports(modulePath) {
|
|
77
|
+
await external_es_module_lexer_namespaceObject.init;
|
|
78
|
+
await external_cjs_module_lexer_namespaceObject.init;
|
|
79
|
+
try {
|
|
80
|
+
const exports1 = [];
|
|
81
|
+
const paths = [];
|
|
82
|
+
const resolvedPath = await resolve(process.cwd(), modulePath);
|
|
83
|
+
if ('string' == typeof resolvedPath) paths.push(resolvedPath);
|
|
84
|
+
while(paths.length > 0){
|
|
85
|
+
const currentPath = paths.pop();
|
|
86
|
+
if (currentPath) {
|
|
87
|
+
const content = await external_fs_default().promises.readFile(currentPath, 'utf8');
|
|
88
|
+
try {
|
|
89
|
+
const { exports: cjsExports } = (0, external_cjs_module_lexer_namespaceObject.parse)(content);
|
|
90
|
+
exports1.push(...cjsExports);
|
|
91
|
+
} catch {
|
|
92
|
+
const [, esExports] = (0, external_es_module_lexer_namespaceObject.parse)(content);
|
|
93
|
+
exports1.push(...esExports.map((exp)=>exp.n));
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
if (!exports1.includes('default')) exports1.push('default');
|
|
98
|
+
return exports1;
|
|
99
|
+
} catch (e) {
|
|
100
|
+
console.log(e);
|
|
101
|
+
return [
|
|
102
|
+
'default'
|
|
103
|
+
];
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
const package_json_namespaceObject = require("@module-federation/esbuild/package.json");
|
|
107
|
+
const writeRemoteManifest = async (config, result)=>{
|
|
108
|
+
var _result_metafile, _result_metafile1;
|
|
109
|
+
if (result.errors && result.errors.length > 0) return void console.warn('Build errors detected, skipping writeRemoteManifest.');
|
|
110
|
+
let packageJson;
|
|
111
|
+
try {
|
|
112
|
+
const packageJsonPath = await resolve(process.cwd(), '/package.json') || '';
|
|
113
|
+
packageJson = require(packageJsonPath);
|
|
114
|
+
} catch (e) {
|
|
115
|
+
packageJson = {
|
|
116
|
+
name: config.name
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
const envType = 'development' === process.env['NODE_ENV'] ? 'local' : process.env['NODE_ENV'] ?? '';
|
|
120
|
+
const publicPath = config.publicPath || 'auto';
|
|
121
|
+
let containerName = '';
|
|
122
|
+
const outputMap = Object.entries((null == (_result_metafile = result.metafile) ? void 0 : _result_metafile.outputs) || {}).reduce((acc, [chunkKey, chunkValue])=>{
|
|
123
|
+
const { entryPoint } = chunkValue;
|
|
124
|
+
const key = entryPoint || chunkKey;
|
|
125
|
+
if (key.startsWith('container:') && key.endsWith(config.filename)) containerName = key;
|
|
126
|
+
acc[key] = {
|
|
127
|
+
...chunkValue,
|
|
128
|
+
chunk: chunkKey
|
|
129
|
+
};
|
|
130
|
+
return acc;
|
|
131
|
+
}, {});
|
|
132
|
+
if (!outputMap[containerName]) return;
|
|
133
|
+
const outputMapWithoutExt = Object.entries((null == (_result_metafile1 = result.metafile) ? void 0 : _result_metafile1.outputs) || {}).reduce((acc, [chunkKey, chunkValue])=>{
|
|
134
|
+
const { entryPoint } = chunkValue;
|
|
135
|
+
const key = entryPoint || chunkKey;
|
|
136
|
+
const trimKey = key.substring(0, key.lastIndexOf('.')) || key;
|
|
137
|
+
acc[trimKey] = {
|
|
138
|
+
...chunkValue,
|
|
139
|
+
chunk: chunkKey
|
|
140
|
+
};
|
|
141
|
+
return acc;
|
|
142
|
+
}, {});
|
|
143
|
+
const getChunks = (meta, outputMap)=>{
|
|
144
|
+
const assets = {
|
|
145
|
+
js: {
|
|
146
|
+
async: [],
|
|
147
|
+
sync: []
|
|
148
|
+
},
|
|
149
|
+
css: {
|
|
150
|
+
async: [],
|
|
151
|
+
sync: []
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
if (null == meta ? void 0 : meta.imports) {
|
|
155
|
+
meta.imports.forEach((imp)=>{
|
|
156
|
+
const importMeta = outputMap[imp.path];
|
|
157
|
+
if (importMeta && 'dynamic-import' !== importMeta.kind) {
|
|
158
|
+
const childAssets = getChunks(importMeta, outputMap);
|
|
159
|
+
assets.js.async.push(...childAssets.js.async);
|
|
160
|
+
assets.js.sync.push(...childAssets.js.sync);
|
|
161
|
+
assets.css.async.push(...childAssets.css.async);
|
|
162
|
+
assets.css.sync.push(...childAssets.css.sync);
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
const assetType = meta.chunk.endsWith('.js') ? 'js' : 'css';
|
|
166
|
+
const syncOrAsync = 'dynamic-import' === meta.kind ? 'async' : 'sync';
|
|
167
|
+
assets[assetType][syncOrAsync].push(meta.chunk);
|
|
168
|
+
}
|
|
169
|
+
return assets;
|
|
170
|
+
};
|
|
171
|
+
const shared = config.shared ? await Promise.all(Object.entries(config.shared).map(async ([pkg, config])=>{
|
|
172
|
+
const meta = outputMap['esm-shares:' + pkg];
|
|
173
|
+
const chunks = getChunks(meta, outputMap);
|
|
174
|
+
let { version } = config;
|
|
175
|
+
if (!version) try {
|
|
176
|
+
const packageJsonPath = await resolve(process.cwd(), `${pkg}/package.json`);
|
|
177
|
+
if (packageJsonPath) version = JSON.parse(external_fs_default().readFileSync(packageJsonPath, 'utf-8')).version;
|
|
178
|
+
} catch (e) {
|
|
179
|
+
console.warn(`Can't resolve ${pkg} version automatically, consider setting "version" manually`);
|
|
180
|
+
}
|
|
181
|
+
return {
|
|
182
|
+
id: `${config.name}:${pkg}`,
|
|
183
|
+
name: pkg,
|
|
184
|
+
version: version || config.version,
|
|
185
|
+
singleton: config.singleton || false,
|
|
186
|
+
requiredVersion: config.requiredVersion || '*',
|
|
187
|
+
assets: chunks
|
|
188
|
+
};
|
|
189
|
+
})) : [];
|
|
190
|
+
const remotes = config.remotes ? Object.entries(config.remotes).map(([alias, remote])=>{
|
|
191
|
+
const [federationContainerName, entry] = remote.includes('@') ? remote.split('@') : [
|
|
192
|
+
alias,
|
|
193
|
+
remote
|
|
194
|
+
];
|
|
195
|
+
return {
|
|
196
|
+
federationContainerName,
|
|
197
|
+
moduleName: '',
|
|
198
|
+
alias,
|
|
199
|
+
entry
|
|
200
|
+
};
|
|
201
|
+
}) : [];
|
|
202
|
+
const exposes = config.exposes ? await Promise.all(Object.entries(config.exposes).map(async ([expose, value])=>{
|
|
203
|
+
const exposedFound = outputMapWithoutExt[value.replace('./', '')];
|
|
204
|
+
const chunks = getChunks(exposedFound, outputMap);
|
|
205
|
+
return {
|
|
206
|
+
id: `${config.name}:${expose.replace(/^\.\//, '')}`,
|
|
207
|
+
name: expose.replace(/^\.\//, ''),
|
|
208
|
+
assets: chunks,
|
|
209
|
+
path: expose
|
|
210
|
+
};
|
|
211
|
+
})) : [];
|
|
212
|
+
const types = {
|
|
213
|
+
path: '',
|
|
214
|
+
name: '',
|
|
215
|
+
zip: '@mf-types.zip',
|
|
216
|
+
api: '@mf-types.d.ts'
|
|
217
|
+
};
|
|
218
|
+
const manifest = {
|
|
219
|
+
id: config.name,
|
|
220
|
+
name: config.name,
|
|
221
|
+
metaData: {
|
|
222
|
+
name: config.name,
|
|
223
|
+
type: 'app',
|
|
224
|
+
buildInfo: {
|
|
225
|
+
buildVersion: envType,
|
|
226
|
+
buildName: (packageJson.name ?? 'default').replace(/[^a-zA-Z0-9]/g, '_')
|
|
227
|
+
},
|
|
228
|
+
remoteEntry: {
|
|
229
|
+
name: config.filename,
|
|
230
|
+
path: outputMap[containerName] ? external_path_default().dirname(outputMap[containerName].chunk) : '',
|
|
231
|
+
type: 'esm'
|
|
232
|
+
},
|
|
233
|
+
types,
|
|
234
|
+
globalName: config.name,
|
|
235
|
+
pluginVersion: package_json_namespaceObject.version,
|
|
236
|
+
publicPath
|
|
237
|
+
},
|
|
238
|
+
shared,
|
|
239
|
+
remotes,
|
|
240
|
+
exposes
|
|
241
|
+
};
|
|
242
|
+
const manifestPath = external_path_default().join(external_path_default().dirname(outputMap[containerName].chunk), 'mf-manifest.json');
|
|
243
|
+
external_fs_default().writeFileSync(manifestPath, JSON.stringify(manifest, null, 2), 'utf-8');
|
|
244
|
+
};
|
|
245
|
+
const createContainerCode = `
|
|
246
|
+
import bundler_runtime_base from '@module-federation/webpack-bundler-runtime';
|
|
247
|
+
// import instantiatePatch from "./federation.js";
|
|
248
|
+
|
|
249
|
+
const createContainer = (federationOptions) => {
|
|
250
|
+
// await instantiatePatch(federationOptions, true);
|
|
251
|
+
const {exposes, name, remotes = [], shared, plugins} = federationOptions;
|
|
252
|
+
|
|
253
|
+
const __webpack_modules__ = {
|
|
254
|
+
"./node_modules/.federation/entry.1f2288102e035e2ed66b2efaf60ad043.js": (module, __webpack_exports__, __webpack_require__) => {
|
|
255
|
+
__webpack_require__.r(__webpack_exports__);
|
|
256
|
+
const bundler_runtime = __webpack_require__.n(bundler_runtime_base);
|
|
257
|
+
const prevFederation = __webpack_require__.federation;
|
|
258
|
+
__webpack_require__.federation = {};
|
|
259
|
+
for (const key in bundler_runtime()) {
|
|
260
|
+
__webpack_require__.federation[key] = bundler_runtime()[key];
|
|
261
|
+
}
|
|
262
|
+
for (const key in prevFederation) {
|
|
263
|
+
__webpack_require__.federation[key] = prevFederation[key];
|
|
264
|
+
}
|
|
265
|
+
if (!__webpack_require__.federation.instance) {
|
|
266
|
+
const pluginsToAdd = plugins || [];
|
|
267
|
+
__webpack_require__.federation.initOptions.plugins = __webpack_require__.federation.initOptions.plugins ?
|
|
268
|
+
__webpack_require__.federation.initOptions.plugins.concat(pluginsToAdd) : pluginsToAdd;
|
|
269
|
+
__webpack_require__.federation.instance = __webpack_require__.federation.runtime.init(__webpack_require__.federation.initOptions);
|
|
270
|
+
if (__webpack_require__.federation.attachShareScopeMap) {
|
|
271
|
+
__webpack_require__.federation.attachShareScopeMap(__webpack_require__);
|
|
272
|
+
}
|
|
273
|
+
if (__webpack_require__.federation.installInitialConsumes) {
|
|
274
|
+
__webpack_require__.federation.installInitialConsumes();
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
},
|
|
278
|
+
|
|
279
|
+
"webpack/container/entry/createContainer": (module, exports, __webpack_require__) => {
|
|
280
|
+
const moduleMap = {};
|
|
281
|
+
for (const key in exposes) {
|
|
282
|
+
if (Object.prototype.hasOwnProperty.call(exposes, key)) {
|
|
283
|
+
moduleMap[key] = () => Promise.resolve(exposes[key]()).then(m => () => m);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
const get = (module, getScope) => {
|
|
288
|
+
__webpack_require__.R = getScope;
|
|
289
|
+
getScope = (
|
|
290
|
+
__webpack_require__.o(moduleMap, module)
|
|
291
|
+
? moduleMap[module]()
|
|
292
|
+
: Promise.resolve().then(() => {
|
|
293
|
+
throw new Error("Module '" + module + "' does not exist in container.");
|
|
294
|
+
})
|
|
295
|
+
);
|
|
296
|
+
__webpack_require__.R = undefined;
|
|
297
|
+
return getScope;
|
|
298
|
+
};
|
|
299
|
+
const init = (shareScope, initScope, remoteEntryInitOptions) => {
|
|
300
|
+
return __webpack_require__.federation.bundlerRuntime.initContainerEntry({
|
|
301
|
+
webpackRequire: __webpack_require__,
|
|
302
|
+
shareScope: shareScope,
|
|
303
|
+
initScope: initScope,
|
|
304
|
+
remoteEntryInitOptions: remoteEntryInitOptions,
|
|
305
|
+
shareScopeKey: "default"
|
|
306
|
+
});
|
|
307
|
+
};
|
|
308
|
+
__webpack_require__("./node_modules/.federation/entry.1f2288102e035e2ed66b2efaf60ad043.js");
|
|
309
|
+
|
|
310
|
+
// This exports getters to disallow modifications
|
|
311
|
+
__webpack_require__.d(exports, {
|
|
312
|
+
get: () => get,
|
|
313
|
+
init: () => init,
|
|
314
|
+
moduleMap: () => moduleMap,
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
};
|
|
318
|
+
|
|
319
|
+
const __webpack_module_cache__ = {};
|
|
320
|
+
|
|
321
|
+
const __webpack_require__ = (moduleId) => {
|
|
322
|
+
let cachedModule = __webpack_module_cache__[moduleId];
|
|
323
|
+
if (cachedModule !== undefined) {
|
|
324
|
+
return cachedModule.exports;
|
|
325
|
+
}
|
|
326
|
+
let module = __webpack_module_cache__[moduleId] = {
|
|
327
|
+
id: moduleId,
|
|
328
|
+
loaded: false,
|
|
329
|
+
exports: {}
|
|
330
|
+
};
|
|
331
|
+
|
|
332
|
+
const execOptions = {
|
|
333
|
+
id: moduleId,
|
|
334
|
+
module: module,
|
|
335
|
+
factory: __webpack_modules__[moduleId],
|
|
336
|
+
require: __webpack_require__
|
|
337
|
+
};
|
|
338
|
+
__webpack_require__.i.forEach(handler => {
|
|
339
|
+
handler(execOptions);
|
|
340
|
+
});
|
|
341
|
+
module = execOptions.module;
|
|
342
|
+
execOptions.factory.call(module.exports, module, module.exports, execOptions.require);
|
|
343
|
+
|
|
344
|
+
module.loaded = true;
|
|
345
|
+
|
|
346
|
+
return module.exports;
|
|
347
|
+
};
|
|
348
|
+
|
|
349
|
+
__webpack_require__.m = __webpack_modules__;
|
|
350
|
+
__webpack_require__.c = __webpack_module_cache__;
|
|
351
|
+
__webpack_require__.i = [];
|
|
352
|
+
|
|
353
|
+
if (!__webpack_require__.federation) {
|
|
354
|
+
__webpack_require__.federation = {
|
|
355
|
+
initOptions: {
|
|
356
|
+
"name": name,
|
|
357
|
+
"remotes": remotes.map(remote => ({
|
|
358
|
+
"type": remote.type,
|
|
359
|
+
"alias": remote.alias,
|
|
360
|
+
"name": remote.name,
|
|
361
|
+
"entry": remote.entry,
|
|
362
|
+
"shareScope": remote.shareScope || "default"
|
|
363
|
+
}))
|
|
364
|
+
},
|
|
365
|
+
chunkMatcher: () => true,
|
|
366
|
+
rootOutputDir: "",
|
|
367
|
+
initialConsumes: undefined,
|
|
368
|
+
bundlerRuntimeOptions: {}
|
|
369
|
+
};
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
__webpack_require__.n = (module) => {
|
|
373
|
+
const getter = module && module.__esModule ? () => module['default'] : () => module;
|
|
374
|
+
__webpack_require__.d(getter, {a: getter});
|
|
375
|
+
return getter;
|
|
376
|
+
};
|
|
377
|
+
|
|
378
|
+
__webpack_require__.d = (exports, definition) => {
|
|
379
|
+
for (const key in definition) {
|
|
380
|
+
if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
|
381
|
+
Object.defineProperty(exports, key, {enumerable: true, get: definition[key]});
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
};
|
|
385
|
+
|
|
386
|
+
__webpack_require__.f = {};
|
|
387
|
+
|
|
388
|
+
__webpack_require__.g = (() => {
|
|
389
|
+
if (typeof globalThis === 'object') return globalThis;
|
|
390
|
+
try {
|
|
391
|
+
return this || new Function('return this')();
|
|
392
|
+
} catch (e) {
|
|
393
|
+
if (typeof window === 'object') return window;
|
|
394
|
+
}
|
|
395
|
+
})();
|
|
396
|
+
|
|
397
|
+
__webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
|
|
398
|
+
|
|
399
|
+
__webpack_require__.r = (exports) => {
|
|
400
|
+
if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
401
|
+
Object.defineProperty(exports, Symbol.toStringTag, {value: 'Module'});
|
|
402
|
+
}
|
|
403
|
+
Object.defineProperty(exports, '__esModule', {value: true});
|
|
404
|
+
};
|
|
405
|
+
|
|
406
|
+
__webpack_require__.federation.initOptions.shared = shared;
|
|
407
|
+
__webpack_require__.S = {};
|
|
408
|
+
const initPromises = {};
|
|
409
|
+
const initTokens = {};
|
|
410
|
+
__webpack_require__.I = (name, initScope) => {
|
|
411
|
+
return __webpack_require__.federation.bundlerRuntime.I({
|
|
412
|
+
shareScopeName: name,
|
|
413
|
+
webpackRequire: __webpack_require__,
|
|
414
|
+
initPromises: initPromises,
|
|
415
|
+
initTokens: initTokens,
|
|
416
|
+
initScope: initScope,
|
|
417
|
+
});
|
|
418
|
+
};
|
|
419
|
+
|
|
420
|
+
const __webpack_exports__ = __webpack_require__("webpack/container/entry/createContainer");
|
|
421
|
+
const __webpack_exports__get = __webpack_exports__.get;
|
|
422
|
+
const __webpack_exports__init = __webpack_exports__.init;
|
|
423
|
+
const __webpack_exports__moduleMap = __webpack_exports__.moduleMap;
|
|
424
|
+
return __webpack_exports__;
|
|
425
|
+
}`;
|
|
426
|
+
const buildContainerHost = (config)=>{
|
|
427
|
+
const { name, remotes = {}, shared = {}, exposes = {} } = config;
|
|
428
|
+
const remoteConfigs = Object.entries(remotes).map(([remoteAlias, remote])=>({
|
|
429
|
+
type: 'esm',
|
|
430
|
+
name: remoteAlias,
|
|
431
|
+
entry: remote.entry,
|
|
432
|
+
alias: remoteAlias
|
|
433
|
+
}));
|
|
434
|
+
const sharedConfig = Object.entries(shared).reduce((acc, [pkg, config])=>{
|
|
435
|
+
var _config_requiredVersion;
|
|
436
|
+
const version = (null == (_config_requiredVersion = config.requiredVersion) ? void 0 : _config_requiredVersion.replace(/^[^0-9]/, '')) || '';
|
|
437
|
+
acc += `${JSON.stringify(pkg)}: {
|
|
438
|
+
"package": "${pkg}",
|
|
439
|
+
"version": "${version}",
|
|
440
|
+
"scope": "default",
|
|
441
|
+
"get": async () => import('federationShare/${pkg}'),
|
|
442
|
+
"shareConfig": {
|
|
443
|
+
"singleton": ${config.singleton},
|
|
444
|
+
"requiredVersion": "${config.requiredVersion}",
|
|
445
|
+
"eager": ${config.eager},
|
|
446
|
+
"strictVersion": ${config.strictVersion}
|
|
447
|
+
}
|
|
448
|
+
},\n`;
|
|
449
|
+
return acc;
|
|
450
|
+
}, '{') + '}';
|
|
451
|
+
let exposesConfig = Object.entries(exposes).map(([exposeName, exposePath])=>`${JSON.stringify(exposeName)}: async () => await import('${exposePath}')`).join(',\n');
|
|
452
|
+
exposesConfig = `{${exposesConfig}}`;
|
|
453
|
+
const injectedContent = `
|
|
454
|
+
export const moduleMap = '__MODULE_MAP__';
|
|
455
|
+
|
|
456
|
+
function appendImportMap(importMap) {
|
|
457
|
+
const script = document.createElement('script');
|
|
458
|
+
script.type = 'importmap-shim';
|
|
459
|
+
script.innerHTML = JSON.stringify(importMap);
|
|
460
|
+
document.head.appendChild(script);
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
export const createVirtualRemoteModule = (name, ref, exports) => {
|
|
464
|
+
const genExports = exports.map(e =>
|
|
465
|
+
e === 'default' ? 'export default mfLsZJ92.default' : \`export const \${e} = mfLsZJ92[\${JSON.stringify(e)}];\`
|
|
466
|
+
).join('');
|
|
467
|
+
|
|
468
|
+
const loadRef = \`const mfLsZJ92 = await container.loadRemote(\${JSON.stringify(ref)});\`;
|
|
469
|
+
|
|
470
|
+
return \`
|
|
471
|
+
const container = __FEDERATION__.__INSTANCES__.find(container => container.name === name) || __FEDERATION__.__INSTANCES__[0];
|
|
472
|
+
\${loadRef}
|
|
473
|
+
\${genExports}
|
|
474
|
+
\`;
|
|
475
|
+
};
|
|
476
|
+
|
|
477
|
+
function encodeInlineESM(code) {
|
|
478
|
+
const encodedCode = encodeURIComponent(code);
|
|
479
|
+
return \`data:text/javascript;charset=utf-8,\${encodedCode}\`;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
const runtimePlugin = () => ({
|
|
483
|
+
name: 'import-maps-plugin',
|
|
484
|
+
async init(args) {
|
|
485
|
+
|
|
486
|
+
const remotePrefetch = args.options.remotes.map(async (remote) => {
|
|
487
|
+
if (remote.type === 'esm') {
|
|
488
|
+
await import(remote.entry);
|
|
489
|
+
}
|
|
490
|
+
});
|
|
491
|
+
|
|
492
|
+
|
|
493
|
+
await Promise.all(remotePrefetch);
|
|
494
|
+
|
|
495
|
+
const map = Object.keys(moduleMap).reduce((acc, expose) => {
|
|
496
|
+
const importMap = importShim.getImportMap().imports;
|
|
497
|
+
const key = args.origin.name + expose.replace('.', '');
|
|
498
|
+
if (!importMap[key]) {
|
|
499
|
+
const encodedModule = encodeInlineESM(
|
|
500
|
+
createVirtualRemoteModule(args.origin.name, key, moduleMap[expose].exports)
|
|
501
|
+
);
|
|
502
|
+
acc[key] = encodedModule;
|
|
503
|
+
}
|
|
504
|
+
return acc;
|
|
505
|
+
}, {});
|
|
506
|
+
await importShim.addImportMap({ imports: map });
|
|
507
|
+
|
|
508
|
+
return args;
|
|
509
|
+
}
|
|
510
|
+
});
|
|
511
|
+
|
|
512
|
+
const createdContainer = await createContainer({
|
|
513
|
+
name: ${JSON.stringify(name)},
|
|
514
|
+
exposes: ${exposesConfig},
|
|
515
|
+
remotes: ${JSON.stringify(remoteConfigs)},
|
|
516
|
+
shared: ${sharedConfig},
|
|
517
|
+
plugins: [runtimePlugin()],
|
|
518
|
+
});
|
|
519
|
+
|
|
520
|
+
export const get = createdContainer.get;
|
|
521
|
+
export const init = createdContainer.init;
|
|
522
|
+
`;
|
|
523
|
+
return [
|
|
524
|
+
createContainerCode,
|
|
525
|
+
injectedContent
|
|
526
|
+
].join('\n');
|
|
527
|
+
};
|
|
528
|
+
const createContainerPlugin = (config)=>({
|
|
529
|
+
name: 'createContainer',
|
|
530
|
+
setup (build) {
|
|
531
|
+
const { filename } = config;
|
|
532
|
+
const filter = new RegExp([
|
|
533
|
+
filename
|
|
534
|
+
].map((name)=>`${name}$`).join('|'));
|
|
535
|
+
const hasShared = Object.keys(config.shared || {}).length;
|
|
536
|
+
const shared = Object.keys(config.shared || {}).map((name)=>`${name}$`).join('|');
|
|
537
|
+
const sharedExternals = new RegExp(shared);
|
|
538
|
+
build.onResolve({
|
|
539
|
+
filter
|
|
540
|
+
}, async (args)=>({
|
|
541
|
+
path: args.path,
|
|
542
|
+
namespace: 'container',
|
|
543
|
+
pluginData: {
|
|
544
|
+
kind: args.kind,
|
|
545
|
+
resolveDir: args.resolveDir
|
|
546
|
+
}
|
|
547
|
+
}));
|
|
548
|
+
build.onResolve({
|
|
549
|
+
filter: /^federationShare/
|
|
550
|
+
}, async (args)=>({
|
|
551
|
+
path: args.path.replace('federationShare/', ''),
|
|
552
|
+
namespace: 'esm-shares',
|
|
553
|
+
pluginData: {
|
|
554
|
+
kind: args.kind,
|
|
555
|
+
resolveDir: args.resolveDir
|
|
556
|
+
}
|
|
557
|
+
}));
|
|
558
|
+
if (hasShared) {
|
|
559
|
+
build.onResolve({
|
|
560
|
+
filter: sharedExternals
|
|
561
|
+
}, (args)=>{
|
|
562
|
+
if ('esm-shares' === args.namespace) return null;
|
|
563
|
+
return {
|
|
564
|
+
path: args.path,
|
|
565
|
+
namespace: 'virtual-share-module',
|
|
566
|
+
pluginData: {
|
|
567
|
+
kind: args.kind,
|
|
568
|
+
resolveDir: args.resolveDir
|
|
569
|
+
}
|
|
570
|
+
};
|
|
571
|
+
});
|
|
572
|
+
build.onResolve({
|
|
573
|
+
filter: /.*/,
|
|
574
|
+
namespace: 'esm-shares'
|
|
575
|
+
}, async (args)=>{
|
|
576
|
+
if (sharedExternals.test(args.path)) return {
|
|
577
|
+
path: args.path,
|
|
578
|
+
namespace: 'virtual-share-module',
|
|
579
|
+
pluginData: {
|
|
580
|
+
kind: args.kind,
|
|
581
|
+
resolveDir: args.resolveDir
|
|
582
|
+
}
|
|
583
|
+
};
|
|
584
|
+
});
|
|
585
|
+
}
|
|
586
|
+
build.onLoad({
|
|
587
|
+
filter,
|
|
588
|
+
namespace: 'container'
|
|
589
|
+
}, async (args)=>({
|
|
590
|
+
contents: buildContainerHost(config),
|
|
591
|
+
loader: 'js',
|
|
592
|
+
resolveDir: args.pluginData.resolveDir
|
|
593
|
+
}));
|
|
594
|
+
}
|
|
595
|
+
});
|
|
596
|
+
const buildFederationHost = (config)=>{
|
|
597
|
+
const { name, remotes, shared } = config;
|
|
598
|
+
const remoteConfigs = remotes ? JSON.stringify(Object.entries(remotes).map(([remoteAlias, remote])=>({
|
|
599
|
+
name: remoteAlias,
|
|
600
|
+
entry: remote,
|
|
601
|
+
alias: remoteAlias,
|
|
602
|
+
type: 'esm'
|
|
603
|
+
}))) : '[]';
|
|
604
|
+
const sharedConfig = Object.entries(shared ?? {}).reduce((acc, [pkg, config])=>{
|
|
605
|
+
var _config_requiredVersion;
|
|
606
|
+
const version = (null == (_config_requiredVersion = config.requiredVersion) ? void 0 : _config_requiredVersion.replace(/^[^0-9]/, '')) || '';
|
|
607
|
+
acc += `${JSON.stringify(pkg)}: {
|
|
608
|
+
"package": "${pkg}",
|
|
609
|
+
"version": "${version}",
|
|
610
|
+
"scope": "default",
|
|
611
|
+
"get": async () => await import('federationShare/${pkg}'),
|
|
612
|
+
"shareConfig": {
|
|
613
|
+
"singleton": ${config.singleton},
|
|
614
|
+
"requiredVersion": "${config.requiredVersion}",
|
|
615
|
+
"eager": ${config.eager},
|
|
616
|
+
"strictVersion": ${config.strictVersion}
|
|
617
|
+
}
|
|
618
|
+
},\n`;
|
|
619
|
+
return acc;
|
|
620
|
+
}, '{') + '}';
|
|
621
|
+
return `
|
|
622
|
+
import { init as initFederationHost } from "@module-federation/runtime";
|
|
623
|
+
|
|
624
|
+
const createVirtualRemoteModule = (name, ref, exports) => {
|
|
625
|
+
const genExports = exports.map(e =>
|
|
626
|
+
e === 'default'
|
|
627
|
+
? 'export default mfLsZJ92.default;'
|
|
628
|
+
: \`export const \${e} = mfLsZJ92[\${JSON.stringify(e)}];\`
|
|
629
|
+
).join('');
|
|
630
|
+
|
|
631
|
+
const loadRef = \`const mfLsZJ92 = await container.loadRemote(\${JSON.stringify(ref)});\`;
|
|
632
|
+
|
|
633
|
+
return \`
|
|
634
|
+
const container = __FEDERATION__.__INSTANCES__.find(container => container.name === name) || __FEDERATION__.__INSTANCES__[0];
|
|
635
|
+
\${loadRef}
|
|
636
|
+
\${genExports}
|
|
637
|
+
\`;
|
|
638
|
+
};
|
|
639
|
+
|
|
640
|
+
function encodeInlineESM(code) {
|
|
641
|
+
return 'data:text/javascript;charset=utf-8,' + encodeURIComponent(code);
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
const runtimePlugin = () => ({
|
|
645
|
+
name: 'import-maps-plugin',
|
|
646
|
+
async init(args) {
|
|
647
|
+
const remotePrefetch = args.options.remotes.map(async (remote) => {
|
|
648
|
+
console.log('remote', remote);
|
|
649
|
+
if (remote.type === 'esm') {
|
|
650
|
+
await import(remote.entry);
|
|
651
|
+
}
|
|
652
|
+
});
|
|
653
|
+
|
|
654
|
+
await Promise.all(remotePrefetch);
|
|
655
|
+
if (typeof moduleMap !== 'undefined') {
|
|
656
|
+
const map = Object.keys(moduleMap).reduce((acc, expose) => {
|
|
657
|
+
const importMap = importShim.getImportMap().imports;
|
|
658
|
+
const key = args.origin.name + expose.replace('.', '');
|
|
659
|
+
if (!importMap[key]) {
|
|
660
|
+
const encodedModule = encodeInlineESM(
|
|
661
|
+
createVirtualRemoteModule(args.origin.name, key, moduleMap[expose].exports)
|
|
662
|
+
);
|
|
663
|
+
acc[key] = encodedModule;
|
|
664
|
+
}
|
|
665
|
+
return acc;
|
|
666
|
+
}, {});
|
|
667
|
+
|
|
668
|
+
await importShim.addImportMap({ imports: map });
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
return args;
|
|
672
|
+
}
|
|
673
|
+
});
|
|
674
|
+
|
|
675
|
+
const mfHoZJ92 = initFederationHost({
|
|
676
|
+
name: ${JSON.stringify(name)},
|
|
677
|
+
remotes: ${remoteConfigs},
|
|
678
|
+
shared: ${sharedConfig},
|
|
679
|
+
plugins: [runtimePlugin()],
|
|
680
|
+
});
|
|
681
|
+
|
|
682
|
+
await Promise.all(mfHoZJ92.initializeSharing('default', 'version-first'));
|
|
683
|
+
|
|
684
|
+
|
|
685
|
+
`;
|
|
686
|
+
};
|
|
687
|
+
const initializeHostPlugin = (config)=>({
|
|
688
|
+
name: 'host-initialization',
|
|
689
|
+
setup (build) {
|
|
690
|
+
build.onResolve({
|
|
691
|
+
filter: /federation-host/
|
|
692
|
+
}, (args)=>({
|
|
693
|
+
path: args.path,
|
|
694
|
+
namespace: 'federation-host',
|
|
695
|
+
pluginData: {
|
|
696
|
+
kind: args.kind,
|
|
697
|
+
resolveDir: args.resolveDir
|
|
698
|
+
}
|
|
699
|
+
}));
|
|
700
|
+
build.onLoad({
|
|
701
|
+
filter: /.*/,
|
|
702
|
+
namespace: 'federation-host'
|
|
703
|
+
}, async (args)=>({
|
|
704
|
+
contents: buildFederationHost(config),
|
|
705
|
+
resolveDir: args.pluginData.resolveDir
|
|
706
|
+
}));
|
|
707
|
+
const loaders = build.initialOptions.loader || {};
|
|
708
|
+
for (const [ext, loader] of Object.entries(loaders))build.onLoad({
|
|
709
|
+
filter: new RegExp(`\\${ext}$`),
|
|
710
|
+
namespace: 'file'
|
|
711
|
+
}, async (args)=>{
|
|
712
|
+
const contents = await external_fs_default().promises.readFile(args.path, 'utf8');
|
|
713
|
+
return {
|
|
714
|
+
contents: buildFederationHost(config) + contents,
|
|
715
|
+
loader
|
|
716
|
+
};
|
|
717
|
+
});
|
|
718
|
+
const fallbackFilter = new RegExp(Object.keys(loaders).map((ext)=>`\\${ext}$`).join('|'));
|
|
719
|
+
build.onLoad({
|
|
720
|
+
filter: /.*\.(ts|js|mjs)$/,
|
|
721
|
+
namespace: 'file'
|
|
722
|
+
}, async (args)=>{
|
|
723
|
+
if (!fallbackFilter.test(args.path)) {
|
|
724
|
+
if (!build.initialOptions.entryPoints.some((e)=>args.path.includes(e))) return;
|
|
725
|
+
const contents = await external_fs_default().promises.readFile(args.path, 'utf8');
|
|
726
|
+
return {
|
|
727
|
+
contents: 'import "federation-host"; \n ' + contents
|
|
728
|
+
};
|
|
729
|
+
}
|
|
730
|
+
});
|
|
731
|
+
}
|
|
732
|
+
});
|
|
733
|
+
const createVirtualRemoteModule = (name, ref)=>`
|
|
734
|
+
export * from ${JSON.stringify('federationRemote/' + ref)}
|
|
735
|
+
`;
|
|
736
|
+
const linkRemotesPlugin = (config)=>({
|
|
737
|
+
name: 'linkRemotes',
|
|
738
|
+
setup (build) {
|
|
739
|
+
const remotes = config.remotes || {};
|
|
740
|
+
const filter = new RegExp(Object.keys(remotes).reduce((acc, key)=>{
|
|
741
|
+
if (!key) return acc;
|
|
742
|
+
acc.push(`^${key}`);
|
|
743
|
+
return acc;
|
|
744
|
+
}, []).join('|'));
|
|
745
|
+
build.onResolve({
|
|
746
|
+
filter: filter
|
|
747
|
+
}, async (args)=>({
|
|
748
|
+
path: args.path,
|
|
749
|
+
namespace: 'remote-module'
|
|
750
|
+
}));
|
|
751
|
+
build.onResolve({
|
|
752
|
+
filter: /^federationRemote/
|
|
753
|
+
}, async (args)=>({
|
|
754
|
+
path: args.path.replace('federationRemote/', ''),
|
|
755
|
+
external: true,
|
|
756
|
+
namespace: 'externals'
|
|
757
|
+
}));
|
|
758
|
+
build.onLoad({
|
|
759
|
+
filter,
|
|
760
|
+
namespace: 'remote-module'
|
|
761
|
+
}, async (args)=>({
|
|
762
|
+
contents: createVirtualRemoteModule(config.name, args.path),
|
|
763
|
+
loader: 'js',
|
|
764
|
+
resolveDir: external_path_default().dirname(args.path)
|
|
765
|
+
}));
|
|
766
|
+
}
|
|
767
|
+
});
|
|
768
|
+
function isNewLine(code) {
|
|
769
|
+
return 10 === code || 13 === code || 0x2028 === code || 0x2029 === code;
|
|
770
|
+
}
|
|
771
|
+
function codePointToString(ch) {
|
|
772
|
+
if (ch <= 0xffff) return String.fromCharCode(ch);
|
|
773
|
+
ch -= 0x10000;
|
|
774
|
+
return String.fromCharCode((ch >> 10) + 0xd800, (0x03ff & ch) + 0xdc00);
|
|
775
|
+
}
|
|
776
|
+
class Lexer {
|
|
777
|
+
readString(input, pos) {
|
|
778
|
+
if (pos >= input.length) return null;
|
|
779
|
+
this.input = input;
|
|
780
|
+
this.pos = pos;
|
|
781
|
+
const quote = this.input.charCodeAt(pos);
|
|
782
|
+
if (!(34 === quote || 39 === quote)) return null;
|
|
783
|
+
let out = '';
|
|
784
|
+
let chunkStart = ++this.pos;
|
|
785
|
+
while(true){
|
|
786
|
+
if (this.pos >= this.input.length) return null;
|
|
787
|
+
const ch = this.input.charCodeAt(this.pos);
|
|
788
|
+
if (ch === quote) break;
|
|
789
|
+
if (92 === ch) {
|
|
790
|
+
out += this.input.slice(chunkStart, this.pos);
|
|
791
|
+
const escaped = this.readEscapedChar();
|
|
792
|
+
if (null === escaped) return null;
|
|
793
|
+
out += escaped;
|
|
794
|
+
chunkStart = this.pos;
|
|
795
|
+
} else {
|
|
796
|
+
if (isNewLine(ch)) return null;
|
|
797
|
+
++this.pos;
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
out += this.input.slice(chunkStart, this.pos++);
|
|
801
|
+
return out;
|
|
802
|
+
}
|
|
803
|
+
readEscapedChar() {
|
|
804
|
+
const ch = this.input.charCodeAt(++this.pos);
|
|
805
|
+
let code;
|
|
806
|
+
++this.pos;
|
|
807
|
+
switch(ch){
|
|
808
|
+
case 110:
|
|
809
|
+
return '\n';
|
|
810
|
+
case 114:
|
|
811
|
+
return '\r';
|
|
812
|
+
case 120:
|
|
813
|
+
code = this.readHexChar(2);
|
|
814
|
+
if (null === code) return null;
|
|
815
|
+
return String.fromCharCode(code);
|
|
816
|
+
case 117:
|
|
817
|
+
code = this.readCodePoint();
|
|
818
|
+
if (null === code) return null;
|
|
819
|
+
return codePointToString(code);
|
|
820
|
+
case 116:
|
|
821
|
+
return '\t';
|
|
822
|
+
case 98:
|
|
823
|
+
return '\b';
|
|
824
|
+
case 118:
|
|
825
|
+
return '\u000b';
|
|
826
|
+
case 102:
|
|
827
|
+
return '\f';
|
|
828
|
+
case 13:
|
|
829
|
+
if (10 === this.input.charCodeAt(this.pos)) ++this.pos;
|
|
830
|
+
case 10:
|
|
831
|
+
return '';
|
|
832
|
+
case 56:
|
|
833
|
+
case 57:
|
|
834
|
+
return null;
|
|
835
|
+
default:
|
|
836
|
+
if (ch >= 48 && ch <= 55) {
|
|
837
|
+
const match = this.input.slice(this.pos - 1, this.pos + 2).match(/^[0-7]+/);
|
|
838
|
+
if (null === match) return null;
|
|
839
|
+
let octalStr = match[0];
|
|
840
|
+
let octal = parseInt(octalStr, 8);
|
|
841
|
+
if (octal > 255) {
|
|
842
|
+
octalStr = octalStr.slice(0, -1);
|
|
843
|
+
octal = parseInt(octalStr, 8);
|
|
844
|
+
}
|
|
845
|
+
this.pos += octalStr.length - 1;
|
|
846
|
+
const nextCh = this.input.charCodeAt(this.pos);
|
|
847
|
+
if ('0' !== octalStr || 56 === nextCh || 57 === nextCh) return null;
|
|
848
|
+
return String.fromCharCode(octal);
|
|
849
|
+
}
|
|
850
|
+
if (isNewLine(ch)) return '';
|
|
851
|
+
return String.fromCharCode(ch);
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
readInt(radix, len) {
|
|
855
|
+
const start = this.pos;
|
|
856
|
+
let total = 0;
|
|
857
|
+
for(let i = 0; i < len; ++i, ++this.pos){
|
|
858
|
+
const code = this.input.charCodeAt(this.pos);
|
|
859
|
+
let val;
|
|
860
|
+
val = code >= 97 ? code - 97 + 10 : code >= 65 ? code - 65 + 10 : code >= 48 && code <= 57 ? code - 48 : 1 / 0;
|
|
861
|
+
if (val >= radix) break;
|
|
862
|
+
total = total * radix + val;
|
|
863
|
+
}
|
|
864
|
+
if (this.pos === start || null != len && this.pos - start !== len) return null;
|
|
865
|
+
return total;
|
|
866
|
+
}
|
|
867
|
+
readHexChar(len) {
|
|
868
|
+
return this.readInt(16, len);
|
|
869
|
+
}
|
|
870
|
+
readCodePoint() {
|
|
871
|
+
const ch = this.input.charCodeAt(this.pos);
|
|
872
|
+
let code;
|
|
873
|
+
if (123 === ch) {
|
|
874
|
+
++this.pos;
|
|
875
|
+
code = this.readHexChar(this.input.indexOf('}', this.pos) - this.pos);
|
|
876
|
+
++this.pos;
|
|
877
|
+
if (code && code > 0x10ffff) return null;
|
|
878
|
+
} else code = this.readHexChar(4);
|
|
879
|
+
return code;
|
|
880
|
+
}
|
|
881
|
+
constructor(){
|
|
882
|
+
this.input = '';
|
|
883
|
+
this.pos = 0;
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
function orderedUniq(array) {
|
|
887
|
+
const ret = [], visited = new Set();
|
|
888
|
+
for (const val of array)if (!visited.has(val)) visited.add(val), ret.push(val);
|
|
889
|
+
return ret;
|
|
890
|
+
}
|
|
891
|
+
function cachedReduce(array, reducer, s) {
|
|
892
|
+
const cache = [
|
|
893
|
+
s
|
|
894
|
+
];
|
|
895
|
+
let cacheLen = 1, last = s;
|
|
896
|
+
return (len)=>{
|
|
897
|
+
while(cacheLen <= len)cacheLen = cache.push(last = reducer(last, array[cacheLen - 1]));
|
|
898
|
+
return cache[len];
|
|
899
|
+
};
|
|
900
|
+
}
|
|
901
|
+
const reservedWords = 'break case class catch const continue debugger default delete do else export extends finally for function if import in instanceof let new return super switch this throw try typeof var void while with yield enum await implements package protected static interface private public';
|
|
902
|
+
const builtin = 'arguments Infinity NaN undefined null true false eval uneval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Symbol Error EvalError InternalError RangeError ReferenceError SyntaxError TypeError URIError Number Math Date String RegExp Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array Map Set WeakMap WeakSet SIMD ArrayBuffer DataView JSON Promise Generator GeneratorFunction Reflect Proxy Intl';
|
|
903
|
+
const forbiddenIdentifiers = new Set(`${reservedWords} ${builtin}`.split(' '));
|
|
904
|
+
forbiddenIdentifiers.add('');
|
|
905
|
+
const utils_makeLegalIdentifier = function(str) {
|
|
906
|
+
let identifier = str.replace(/-(\w)/g, (_, letter)=>letter.toUpperCase()).replace(/[^$_a-zA-Z0-9]/g, '_');
|
|
907
|
+
if (/\d/.test(identifier[0]) || forbiddenIdentifiers.has(identifier)) identifier = `_${identifier}`;
|
|
908
|
+
return identifier || '_';
|
|
909
|
+
};
|
|
910
|
+
function commonjs_commonjs({ filter = /\.c?js$/, transform = true, transformConfig, requireReturnsDefault = true, ignore } = {}) {
|
|
911
|
+
const init_cjs_module_lexer = transform ? Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "cjs-module-lexer")) : void 0;
|
|
912
|
+
const use_default_export = 'function' == typeof requireReturnsDefault ? requireReturnsDefault : (_path)=>requireReturnsDefault;
|
|
913
|
+
const is_ignored = 'function' == typeof ignore ? ignore : Array.isArray(ignore) ? (path)=>ignore.includes(path) : ()=>false;
|
|
914
|
+
return {
|
|
915
|
+
name: 'commonjs',
|
|
916
|
+
setup ({ onLoad, esbuild, initialOptions }) {
|
|
917
|
+
let esbuild_shim;
|
|
918
|
+
const require_esbuild = ()=>esbuild || (esbuild_shim ||= __webpack_require__("esbuild"));
|
|
919
|
+
const read = external_fs_namespaceObject.promises.readFile;
|
|
920
|
+
const lexer = new Lexer();
|
|
921
|
+
onLoad({
|
|
922
|
+
filter: filter
|
|
923
|
+
}, async (args)=>{
|
|
924
|
+
let parseCJS;
|
|
925
|
+
if (init_cjs_module_lexer) {
|
|
926
|
+
const { init, parse } = await init_cjs_module_lexer;
|
|
927
|
+
await init();
|
|
928
|
+
parseCJS = parse;
|
|
929
|
+
}
|
|
930
|
+
let contents;
|
|
931
|
+
try {
|
|
932
|
+
contents = await read(args.path, 'utf8');
|
|
933
|
+
} catch {
|
|
934
|
+
return null;
|
|
935
|
+
}
|
|
936
|
+
const willTransform = true === transform || 'function' == typeof transform && transform(args.path);
|
|
937
|
+
let cjsExports;
|
|
938
|
+
try {
|
|
939
|
+
if (parseCJS && willTransform) {
|
|
940
|
+
const sourcemapIndex = contents.lastIndexOf('//# sourceMappingURL=');
|
|
941
|
+
let sourcemap;
|
|
942
|
+
if (-1 !== sourcemapIndex) {
|
|
943
|
+
sourcemap = contents.slice(sourcemapIndex);
|
|
944
|
+
const sourcemapEnd = sourcemap.indexOf('\n');
|
|
945
|
+
if (-1 !== sourcemapEnd && sourcemap.slice(sourcemapEnd + 1).trimStart().length > 0) sourcemap = void 0;
|
|
946
|
+
else contents = contents.slice(0, sourcemapIndex);
|
|
947
|
+
}
|
|
948
|
+
cjsExports = parseCJS(contents);
|
|
949
|
+
let { behavior, exports: exports1, sideEffects } = 'object' == typeof willTransform ? willTransform : {};
|
|
950
|
+
behavior ??= (null == transformConfig ? void 0 : transformConfig.behavior) ?? 'node';
|
|
951
|
+
exports1 = orderedUniq(cjsExports.exports.concat(exports1 ?? []));
|
|
952
|
+
sideEffects ??= (null == transformConfig ? void 0 : transformConfig.sideEffects) ?? true;
|
|
953
|
+
let exportDefault = 'node' === behavior ? 'export default exports;' : 'export default exports.__esModule ? exports.default : exports;';
|
|
954
|
+
let exportsMap = exports1.map((e)=>[
|
|
955
|
+
e,
|
|
956
|
+
utils_makeLegalIdentifier(e)
|
|
957
|
+
]);
|
|
958
|
+
if (exportsMap.some(([e])=>'default' === e)) if ('node' === behavior) exportsMap = exportsMap.filter(([e])=>'default' !== e);
|
|
959
|
+
else exportDefault = '';
|
|
960
|
+
const reexports = cjsExports.reexports.map((e)=>`export * from ${JSON.stringify(e)};`).join('');
|
|
961
|
+
let transformed;
|
|
962
|
+
if (false === sideEffects) {
|
|
963
|
+
transformed = [
|
|
964
|
+
reexports + 'var mod, exports = /* @__PURE__ */ ((exports, module) => {' + contents,
|
|
965
|
+
'return module.exports})((mod = { exports: {} }).exports, mod); ' + exportDefault
|
|
966
|
+
];
|
|
967
|
+
if (exportsMap.length > 0) {
|
|
968
|
+
for (const [e, name] of exportsMap)transformed.push(`var ${name} = /* @__PURE__ */ (() => exports[${JSON.stringify(e)}])();`);
|
|
969
|
+
transformed.push(`export { ${exportsMap.map(([e, name])=>e === name ? e : `${name} as ${JSON.stringify(e)}`).join(', ')} };`);
|
|
970
|
+
}
|
|
971
|
+
} else {
|
|
972
|
+
transformed = [
|
|
973
|
+
reexports + 'var exports = {}, module = { exports }; {' + contents,
|
|
974
|
+
'}; exports = module.exports; ' + exportDefault
|
|
975
|
+
];
|
|
976
|
+
if (exportsMap.length > 0) transformed.push(`var { ${exportsMap.map(([e, name])=>e === name ? e : `${JSON.stringify(e)}: ${name}`).join(', ')} } = exports;`, `export { ${exportsMap.map(([e, name])=>e === name ? e : `${name} as ${JSON.stringify(e)}`).join(', ')} };`);
|
|
977
|
+
}
|
|
978
|
+
contents = transformed.join('\n') + (sourcemap ? '\n' + sourcemap : '');
|
|
979
|
+
}
|
|
980
|
+
} catch (e) {
|
|
981
|
+
return null;
|
|
982
|
+
}
|
|
983
|
+
function makeName(path) {
|
|
984
|
+
let name = `__import_${utils_makeLegalIdentifier(path)}`;
|
|
985
|
+
if (contents.includes(name)) {
|
|
986
|
+
let suffix = 2;
|
|
987
|
+
while(contents.includes(`${name}${suffix}`))suffix++;
|
|
988
|
+
name = `${name}${suffix}`;
|
|
989
|
+
}
|
|
990
|
+
return name;
|
|
991
|
+
}
|
|
992
|
+
let warnings;
|
|
993
|
+
try {
|
|
994
|
+
({ warnings } = await require_esbuild().transform(contents, {
|
|
995
|
+
format: 'esm',
|
|
996
|
+
logLevel: 'silent'
|
|
997
|
+
}));
|
|
998
|
+
} catch (err) {
|
|
999
|
+
({ warnings } = err);
|
|
1000
|
+
}
|
|
1001
|
+
const lines = contents.split('\n');
|
|
1002
|
+
const getOffset = cachedReduce(lines, (a, b)=>a + 1 + b.length, 0);
|
|
1003
|
+
if (warnings && (warnings = warnings.filter((e)=>e.text.includes('"require" to "esm"'))).length) {
|
|
1004
|
+
const edits = [];
|
|
1005
|
+
let imports = [];
|
|
1006
|
+
for (const { location } of warnings){
|
|
1007
|
+
if (null === location) continue;
|
|
1008
|
+
const { line, lineText, column, length } = location;
|
|
1009
|
+
const leftBrace = column + length + 1;
|
|
1010
|
+
const path = lexer.readString(lineText, leftBrace);
|
|
1011
|
+
if (null === path || is_ignored(path)) continue;
|
|
1012
|
+
const rightBrace = lineText.indexOf(')', leftBrace + 2 + path.length) + 1;
|
|
1013
|
+
const name = makeName(path);
|
|
1014
|
+
let import_statement;
|
|
1015
|
+
import_statement = use_default_export(path) ? `import ${name} from ${JSON.stringify(path)};` : `import * as ${name} from ${JSON.stringify(path)};`;
|
|
1016
|
+
const offset = getOffset(line - 1);
|
|
1017
|
+
edits.push([
|
|
1018
|
+
offset + column,
|
|
1019
|
+
offset + rightBrace,
|
|
1020
|
+
name
|
|
1021
|
+
]);
|
|
1022
|
+
imports.push(import_statement);
|
|
1023
|
+
}
|
|
1024
|
+
if (0 === imports.length) return null;
|
|
1025
|
+
imports = orderedUniq(imports);
|
|
1026
|
+
let offset = 0;
|
|
1027
|
+
for (const [start, end, name] of edits){
|
|
1028
|
+
contents = contents.slice(0, start + offset) + name + contents.slice(end + offset);
|
|
1029
|
+
offset += name.length - (end - start);
|
|
1030
|
+
}
|
|
1031
|
+
contents = [
|
|
1032
|
+
...imports,
|
|
1033
|
+
cjsExports ? 'exports;' : '',
|
|
1034
|
+
contents
|
|
1035
|
+
].join('');
|
|
1036
|
+
return {
|
|
1037
|
+
contents
|
|
1038
|
+
};
|
|
1039
|
+
}
|
|
1040
|
+
});
|
|
1041
|
+
}
|
|
1042
|
+
};
|
|
1043
|
+
}
|
|
1044
|
+
function getExternals(config) {
|
|
1045
|
+
const shared = Object.keys(config.shared ?? {});
|
|
1046
|
+
const remotes = config.remotes ?? {};
|
|
1047
|
+
const remoteKeys = Object.keys(remotes).reduce((acc, key)=>{
|
|
1048
|
+
if (!key) return acc;
|
|
1049
|
+
acc.push(key);
|
|
1050
|
+
acc.push(key + '/*');
|
|
1051
|
+
return acc;
|
|
1052
|
+
}, []);
|
|
1053
|
+
const externals = [
|
|
1054
|
+
...shared,
|
|
1055
|
+
...remoteKeys
|
|
1056
|
+
];
|
|
1057
|
+
return externals;
|
|
1058
|
+
}
|
|
1059
|
+
const createVirtualShareModule = (name, ref, exports1)=>`
|
|
1060
|
+
const container = __FEDERATION__.__INSTANCES__.find(container => container.name === ${JSON.stringify(name)}) || __FEDERATION__.__INSTANCES__[0]
|
|
1061
|
+
|
|
1062
|
+
const mfLsZJ92 = await container.loadShare(${JSON.stringify(ref)})
|
|
1063
|
+
|
|
1064
|
+
${exports1.map((e)=>'default' === e ? "export default mfLsZJ92.default" : `export const ${e} = mfLsZJ92[${JSON.stringify(e)}];`).join('\n')}
|
|
1065
|
+
`;
|
|
1066
|
+
const plugin_createVirtualRemoteModule = (name, ref)=>`
|
|
1067
|
+
export * from ${JSON.stringify('federationRemote/' + ref)}
|
|
1068
|
+
`;
|
|
1069
|
+
const cjsToEsmPlugin = {
|
|
1070
|
+
name: 'cjs-to-esm',
|
|
1071
|
+
setup (build) {
|
|
1072
|
+
build.onLoad({
|
|
1073
|
+
filter: /.*/,
|
|
1074
|
+
namespace: 'esm-shares'
|
|
1075
|
+
}, async (args)=>{
|
|
1076
|
+
var _build_initialOptions_external;
|
|
1077
|
+
let esbuild_shim;
|
|
1078
|
+
const require_esbuild = ()=>build.esbuild || (esbuild_shim ||= __webpack_require__("esbuild"));
|
|
1079
|
+
const packageBuilder = await require_esbuild().build({
|
|
1080
|
+
...build.initialOptions,
|
|
1081
|
+
external: null == (_build_initialOptions_external = build.initialOptions.external) ? void 0 : _build_initialOptions_external.filter((e)=>{
|
|
1082
|
+
if (e.includes('*')) {
|
|
1083
|
+
const prefix = e.split('*')[0];
|
|
1084
|
+
return !args.path.startsWith(prefix);
|
|
1085
|
+
}
|
|
1086
|
+
return e !== args.path;
|
|
1087
|
+
}),
|
|
1088
|
+
entryPoints: [
|
|
1089
|
+
args.path
|
|
1090
|
+
],
|
|
1091
|
+
plugins: [
|
|
1092
|
+
commonjs_commonjs({
|
|
1093
|
+
filter: /.*/
|
|
1094
|
+
})
|
|
1095
|
+
],
|
|
1096
|
+
write: false
|
|
1097
|
+
});
|
|
1098
|
+
return {
|
|
1099
|
+
contents: packageBuilder.outputFiles[0].text,
|
|
1100
|
+
loader: 'js',
|
|
1101
|
+
resolveDir: args.pluginData.resolveDir
|
|
1102
|
+
};
|
|
1103
|
+
});
|
|
1104
|
+
}
|
|
1105
|
+
};
|
|
1106
|
+
const linkSharedPlugin = (config)=>({
|
|
1107
|
+
name: 'linkShared',
|
|
1108
|
+
setup (build) {
|
|
1109
|
+
const filter = new RegExp(Object.keys(config.shared || {}).map((name)=>`${name}$`).join('|'));
|
|
1110
|
+
build.onResolve({
|
|
1111
|
+
filter
|
|
1112
|
+
}, (args)=>{
|
|
1113
|
+
if ('esm-shares' === args.namespace) return null;
|
|
1114
|
+
return {
|
|
1115
|
+
path: args.path,
|
|
1116
|
+
namespace: 'virtual-share-module',
|
|
1117
|
+
pluginData: {
|
|
1118
|
+
kind: args.kind,
|
|
1119
|
+
resolveDir: args.resolveDir
|
|
1120
|
+
}
|
|
1121
|
+
};
|
|
1122
|
+
});
|
|
1123
|
+
build.onResolve({
|
|
1124
|
+
filter: /.*/,
|
|
1125
|
+
namespace: 'esm-shares'
|
|
1126
|
+
}, (args)=>{
|
|
1127
|
+
if (filter.test(args.path)) return {
|
|
1128
|
+
path: args.path,
|
|
1129
|
+
namespace: 'virtual-share-module',
|
|
1130
|
+
pluginData: {
|
|
1131
|
+
kind: args.kind,
|
|
1132
|
+
resolveDir: args.resolveDir
|
|
1133
|
+
}
|
|
1134
|
+
};
|
|
1135
|
+
if (filter.test(args.importer)) return {
|
|
1136
|
+
path: args.path,
|
|
1137
|
+
namespace: 'esm-shares',
|
|
1138
|
+
pluginData: {
|
|
1139
|
+
kind: args.kind,
|
|
1140
|
+
resolveDir: args.resolveDir
|
|
1141
|
+
}
|
|
1142
|
+
};
|
|
1143
|
+
});
|
|
1144
|
+
build.onResolve({
|
|
1145
|
+
filter: /^federationShare/
|
|
1146
|
+
}, async (args)=>({
|
|
1147
|
+
path: args.path.replace('federationShare/', ''),
|
|
1148
|
+
namespace: 'esm-shares',
|
|
1149
|
+
pluginData: {
|
|
1150
|
+
kind: args.kind,
|
|
1151
|
+
resolveDir: args.resolveDir
|
|
1152
|
+
}
|
|
1153
|
+
}));
|
|
1154
|
+
build.onLoad({
|
|
1155
|
+
filter,
|
|
1156
|
+
namespace: 'virtual-share-module'
|
|
1157
|
+
}, async (args)=>{
|
|
1158
|
+
const exp = await getExports(args.path);
|
|
1159
|
+
return {
|
|
1160
|
+
contents: createVirtualShareModule(config.name, args.path, exp),
|
|
1161
|
+
loader: 'js',
|
|
1162
|
+
resolveDir: external_path_default().dirname(args.path)
|
|
1163
|
+
};
|
|
1164
|
+
});
|
|
1165
|
+
}
|
|
1166
|
+
});
|
|
1167
|
+
const moduleFederationPlugin = (config)=>({
|
|
1168
|
+
name: 'module-federation',
|
|
1169
|
+
setup (build) {
|
|
1170
|
+
build.initialOptions.metafile = true;
|
|
1171
|
+
const externals = getExternals(config);
|
|
1172
|
+
if (build.initialOptions.external) build.initialOptions.external = [
|
|
1173
|
+
...new Set([
|
|
1174
|
+
...build.initialOptions.external,
|
|
1175
|
+
...externals
|
|
1176
|
+
])
|
|
1177
|
+
];
|
|
1178
|
+
else build.initialOptions.external = externals;
|
|
1179
|
+
const pluginStack = [];
|
|
1180
|
+
const remotes = Object.keys(config.remotes || {}).length;
|
|
1181
|
+
const shared = Object.keys(config.shared || {}).length;
|
|
1182
|
+
const exposes = Object.keys(config.exposes || {}).length;
|
|
1183
|
+
const entryPoints = build.initialOptions.entryPoints;
|
|
1184
|
+
const filename = config.filename || 'remoteEntry.js';
|
|
1185
|
+
if (remotes) pluginStack.push(linkRemotesPlugin(config));
|
|
1186
|
+
if (shared) pluginStack.push(linkSharedPlugin(config));
|
|
1187
|
+
if (!entryPoints) build.initialOptions.entryPoints = [];
|
|
1188
|
+
if (exposes) if (Array.isArray(entryPoints)) entryPoints.push(filename);
|
|
1189
|
+
else if (entryPoints && 'object' == typeof entryPoints) entryPoints[filename] = filename;
|
|
1190
|
+
else build.initialOptions.entryPoints = [
|
|
1191
|
+
filename
|
|
1192
|
+
];
|
|
1193
|
+
[
|
|
1194
|
+
initializeHostPlugin(config),
|
|
1195
|
+
createContainerPlugin(config),
|
|
1196
|
+
cjsToEsmPlugin,
|
|
1197
|
+
...pluginStack
|
|
1198
|
+
].forEach((plugin)=>plugin.setup(build));
|
|
1199
|
+
build.onEnd(async (result)=>{
|
|
1200
|
+
if (!result.metafile) return;
|
|
1201
|
+
if (exposes) {
|
|
1202
|
+
const exposedConfig = config.exposes || {};
|
|
1203
|
+
const remoteFile = config.filename;
|
|
1204
|
+
const exposedEntries = {};
|
|
1205
|
+
const outputMapWithoutExt = Object.entries(result.metafile.outputs).reduce((acc, [chunkKey, chunkValue])=>{
|
|
1206
|
+
const { entryPoint } = chunkValue;
|
|
1207
|
+
const key = entryPoint || chunkKey;
|
|
1208
|
+
const trimKey = key.substring(0, key.lastIndexOf('.')) || key;
|
|
1209
|
+
acc[trimKey] = {
|
|
1210
|
+
...chunkValue,
|
|
1211
|
+
chunk: chunkKey
|
|
1212
|
+
};
|
|
1213
|
+
return acc;
|
|
1214
|
+
}, {});
|
|
1215
|
+
for (const [expose, value] of Object.entries(exposedConfig)){
|
|
1216
|
+
const exposedFound = outputMapWithoutExt[value.replace('./', '')] || outputMapWithoutExt[expose.replace('./', '')];
|
|
1217
|
+
if (exposedFound) exposedEntries[expose] = {
|
|
1218
|
+
entryPoint: exposedFound.entryPoint,
|
|
1219
|
+
exports: exposedFound.exports
|
|
1220
|
+
};
|
|
1221
|
+
}
|
|
1222
|
+
for (const [outputPath, value] of Object.entries(result.metafile.outputs)){
|
|
1223
|
+
if (!value.entryPoint) continue;
|
|
1224
|
+
if (!value.entryPoint.startsWith('container:')) continue;
|
|
1225
|
+
if (!value.entryPoint.endsWith(remoteFile)) continue;
|
|
1226
|
+
const container = external_fs_default().readFileSync(outputPath, 'utf-8');
|
|
1227
|
+
const withExports = container.replace('"__MODULE_MAP__"', `${JSON.stringify(exposedEntries)}`).replace("'__MODULE_MAP__'", `${JSON.stringify(exposedEntries)}`);
|
|
1228
|
+
external_fs_default().writeFileSync(outputPath, withExports, 'utf-8');
|
|
1229
|
+
}
|
|
1230
|
+
}
|
|
1231
|
+
await writeRemoteManifest(config, result);
|
|
1232
|
+
console.log(`build ended with ${result.errors.length} errors`);
|
|
1233
|
+
});
|
|
1234
|
+
}
|
|
1235
|
+
});
|
|
1236
|
+
})();
|
|
1237
|
+
exports.createVirtualRemoteModule = __webpack_exports__.createVirtualRemoteModule;
|
|
1238
|
+
exports.createVirtualShareModule = __webpack_exports__.createVirtualShareModule;
|
|
1239
|
+
exports.moduleFederationPlugin = __webpack_exports__.moduleFederationPlugin;
|
|
1240
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
1241
|
+
"createVirtualRemoteModule",
|
|
1242
|
+
"createVirtualShareModule",
|
|
1243
|
+
"moduleFederationPlugin"
|
|
1244
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
1245
|
+
Object.defineProperty(exports, '__esModule', {
|
|
1246
|
+
value: true
|
|
1247
|
+
});
|