@module-federation/esbuild 0.0.95 → 0.0.97

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.
Files changed (61) hide show
  1. package/dist/adapters/lib/collect-exports.js +151 -0
  2. package/dist/adapters/lib/collect-exports.mjs +87 -0
  3. package/dist/adapters/lib/commonjs.js +260 -0
  4. package/dist/adapters/lib/commonjs.mjs +209 -0
  5. package/dist/adapters/lib/containerPlugin.js +232 -0
  6. package/dist/adapters/lib/containerPlugin.mjs +182 -0
  7. package/dist/adapters/lib/containerReference.js +219 -0
  8. package/dist/adapters/lib/containerReference.mjs +154 -0
  9. package/dist/adapters/lib/lexer.js +184 -0
  10. package/dist/adapters/lib/lexer.mjs +138 -0
  11. package/dist/adapters/lib/linkRemotesPlugin.js +115 -0
  12. package/dist/adapters/lib/linkRemotesPlugin.mjs +50 -0
  13. package/dist/adapters/lib/manifest.js +229 -0
  14. package/dist/adapters/lib/manifest.mjs +168 -0
  15. package/dist/adapters/lib/plugin.js +339 -0
  16. package/dist/adapters/lib/plugin.mjs +282 -0
  17. package/dist/adapters/lib/react-replacements.js +81 -0
  18. package/dist/adapters/lib/react-replacements.mjs +35 -0
  19. package/dist/adapters/lib/transform.js +169 -0
  20. package/dist/adapters/lib/transform.mjs +120 -0
  21. package/dist/adapters/lib/utils.js +83 -0
  22. package/dist/adapters/lib/utils.mjs +33 -0
  23. package/dist/build.js +131 -473
  24. package/dist/build.mjs +13 -380
  25. package/dist/index.js +41 -26
  26. package/dist/index.mjs +4 -1
  27. package/dist/lib/config/configuration-context.js +70 -0
  28. package/dist/lib/config/configuration-context.mjs +20 -0
  29. package/dist/lib/config/federation-config.js +31 -0
  30. package/dist/lib/config/federation-config.mjs +4 -0
  31. package/dist/lib/config/share-utils.js +339 -0
  32. package/dist/lib/config/share-utils.mjs +254 -0
  33. package/dist/lib/config/with-native-federation.js +118 -0
  34. package/dist/lib/config/with-native-federation.mjs +71 -0
  35. package/dist/lib/core/build-adapter.js +70 -0
  36. package/dist/lib/core/build-adapter.mjs +18 -0
  37. package/dist/lib/core/createContainerTemplate.js +231 -0
  38. package/dist/lib/core/createContainerTemplate.mjs +185 -0
  39. package/dist/lib/core/default-skip-list.js +99 -0
  40. package/dist/lib/core/default-skip-list.mjs +47 -0
  41. package/dist/lib/core/federation-options.js +31 -0
  42. package/dist/lib/core/federation-options.mjs +4 -0
  43. package/dist/lib/core/get-externals.js +65 -0
  44. package/dist/lib/core/get-externals.mjs +19 -0
  45. package/dist/lib/core/load-federation-config.js +69 -0
  46. package/dist/lib/core/load-federation-config.mjs +20 -0
  47. package/dist/lib/core/write-federation-info.js +65 -0
  48. package/dist/lib/core/write-federation-info.mjs +16 -0
  49. package/dist/lib/utils/logger.js +111 -0
  50. package/dist/lib/utils/logger.mjs +46 -0
  51. package/dist/lib/utils/mapped-paths.js +94 -0
  52. package/dist/lib/utils/mapped-paths.mjs +46 -0
  53. package/dist/lib/utils/normalize.js +63 -0
  54. package/dist/lib/utils/normalize.mjs +17 -0
  55. package/dist/lib/utils/package-info.js +324 -0
  56. package/dist/lib/utils/package-info.mjs +265 -0
  57. package/dist/plugin.d.ts +1 -0
  58. package/dist/plugin.js +79 -1231
  59. package/dist/plugin.mjs +2 -1187
  60. package/dist/resolve/esm-resolver.mjs +15 -22
  61. package/package.json +2 -2
package/dist/build.js CHANGED
@@ -1,481 +1,139 @@
1
1
  "use strict";
2
- var __webpack_require__ = {};
3
- (()=>{
4
- __webpack_require__.n = (module)=>{
5
- var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
6
- __webpack_require__.d(getter, {
7
- a: getter
8
- });
9
- return getter;
10
- };
2
+ const __rslib_import_meta_url__ = /*#__PURE__*/ (function () {
3
+ return typeof document === 'undefined'
4
+ ? new (require('url'.replace('', '')).URL)('file:' + __filename).href
5
+ : (document.currentScript && document.currentScript.src) ||
6
+ new URL('main.js', document.baseURI).href;
11
7
  })();
12
- (()=>{
13
- __webpack_require__.d = (exports1, definition)=>{
14
- for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
15
- enumerable: true,
16
- get: definition[key]
17
- });
18
- };
8
+ ;
9
+ var __webpack_modules__ = ({
10
+ "./lib/config/share-utils": (function (module) {
11
+ module.exports = require("./lib/config/share-utils.js");
12
+
13
+ }),
14
+ "./lib/config/with-native-federation": (function (module) {
15
+ module.exports = require("./lib/config/with-native-federation.js");
16
+
17
+ }),
18
+ "./lib/core/get-externals": (function (module) {
19
+ module.exports = require("./lib/core/get-externals.js");
20
+
21
+ }),
22
+ "./lib/core/load-federation-config": (function (module) {
23
+ module.exports = require("./lib/core/load-federation-config.js");
24
+
25
+ }),
26
+ "./lib/utils/logger": (function (module) {
27
+ module.exports = require("./lib/utils/logger.js");
28
+
29
+ }),
30
+
31
+ });
32
+ /************************************************************************/
33
+ // The module cache
34
+ var __webpack_module_cache__ = {};
35
+
36
+ // The require function
37
+ function __webpack_require__(moduleId) {
38
+
39
+ // Check if module is in cache
40
+ var cachedModule = __webpack_module_cache__[moduleId];
41
+ if (cachedModule !== undefined) {
42
+ return cachedModule.exports;
43
+ }
44
+ // Create a new module (and put it into the cache)
45
+ var module = (__webpack_module_cache__[moduleId] = {
46
+ exports: {}
47
+ });
48
+ // Execute the module function
49
+ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
50
+
51
+ // Return the exports of the module
52
+ return module.exports;
53
+
54
+ }
55
+
56
+ /************************************************************************/
57
+ // webpack/runtime/compat_get_default_export
58
+ (() => {
59
+ // getDefaultExport function for compatibility with non-ESM modules
60
+ __webpack_require__.n = (module) => {
61
+ var getter = module && module.__esModule ?
62
+ () => (module['default']) :
63
+ () => (module);
64
+ __webpack_require__.d(getter, { a: getter });
65
+ return getter;
66
+ };
67
+
68
+ })();
69
+ // webpack/runtime/define_property_getters
70
+ (() => {
71
+ __webpack_require__.d = (exports, definition) => {
72
+ for(var key in definition) {
73
+ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
74
+ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
75
+ }
76
+ }
77
+ };
19
78
  })();
20
- (()=>{
21
- __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
79
+ // webpack/runtime/has_own_property
80
+ (() => {
81
+ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
22
82
  })();
23
- (()=>{
24
- __webpack_require__.r = (exports1)=>{
25
- if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
26
- value: 'Module'
27
- });
28
- Object.defineProperty(exports1, '__esModule', {
29
- value: true
30
- });
31
- };
83
+ // webpack/runtime/make_namespace_object
84
+ (() => {
85
+ // define __esModule on exports
86
+ __webpack_require__.r = (exports) => {
87
+ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
88
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
89
+ }
90
+ Object.defineProperty(exports, '__esModule', { value: true });
91
+ };
32
92
  })();
93
+ /************************************************************************/
33
94
  var __webpack_exports__ = {};
95
+ // This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk.
96
+ (() => {
34
97
  __webpack_require__.r(__webpack_exports__);
35
- __webpack_require__.d(__webpack_exports__, {
36
- shareAll: ()=>share_utils_shareAll,
37
- setLogLevel: ()=>setLogLevel,
38
- getExternals: ()=>getExternals,
39
- addSecondaries: ()=>addSecondaries,
40
- _findSecondaries: ()=>_findSecondaries,
41
- findSecondaries: ()=>findSecondaries,
42
- findPackageJson: ()=>findPackageJson,
43
- getSecondaries: ()=>getSecondaries,
44
- setInferVersion: ()=>setInferVersion,
45
- share: ()=>share,
46
- getDefaultEntry: ()=>getDefaultEntry,
47
- logger: ()=>logger_logger,
48
- DEFAULT_SECONARIES_SKIP_LIST: ()=>DEFAULT_SECONARIES_SKIP_LIST,
49
- findRootTsConfigJson: ()=>share_utils_findRootTsConfigJson,
50
- lookupVersionInMap: ()=>lookupVersionInMap,
51
- lookupVersion: ()=>lookupVersion,
52
- loadFederationConfig: ()=>loadFederationConfig,
53
- readConfiguredSecondaries: ()=>readConfiguredSecondaries,
54
- withFederation: ()=>withFederation
55
- });
56
- function getExternals(config) {
57
- const shared = Object.keys(config.shared ?? {});
58
- const remotes = config.remotes ?? {};
59
- const remoteKeys = Object.keys(remotes).reduce((acc, key)=>{
60
- if (!key) return acc;
61
- acc.push(key);
62
- acc.push(key + '/*');
63
- return acc;
64
- }, []);
65
- const externals = [
66
- ...shared,
67
- ...remoteKeys
68
- ];
69
- return externals;
70
- }
71
- const external_path_namespaceObject = require("path");
72
- var external_path_default = /*#__PURE__*/ __webpack_require__.n(external_path_namespaceObject);
73
- const external_fs_namespaceObject = require("fs");
74
- var external_fs_default = /*#__PURE__*/ __webpack_require__.n(external_fs_namespaceObject);
75
- async function loadFederationConfig(fedOptions) {
76
- const fullConfigPath = external_path_namespaceObject.join(fedOptions.workspaceRoot, fedOptions.federationConfig);
77
- if (!external_fs_namespaceObject.existsSync(fullConfigPath)) throw new Error('Expected ' + fullConfigPath);
78
- const config = await import(`${fullConfigPath}`);
79
- return config;
80
- }
81
- const DEFAULT_SKIP_LIST = [
82
- '@module-federation/native-federation-runtime',
83
- '@module-federation/native-federation',
84
- '@module-federation/native-federation-core',
85
- '@module-federation/native-federation-esbuild',
86
- '@angular-architects/native-federation',
87
- '@angular-architects/native-federation-runtime',
88
- 'es-module-shims',
89
- 'zone.js',
90
- 'tslib/',
91
- '@angular/localize',
92
- '@angular/localize/init',
93
- '@angular/localize/tools',
94
- '@angular/platform-server',
95
- '@angular/platform-server/init',
96
- '@angular/ssr',
97
- 'express',
98
- /\/schematics(\/|$)/,
99
- /^@nx\/angular/,
100
- (pkg)=>pkg.startsWith('@angular/') && !!pkg.match(/\/testing(\/|$)/),
101
- (pkg)=>pkg.startsWith('@types/'),
102
- (pkg)=>pkg.startsWith('@module-federation/')
103
- ];
104
- const PREPARED_DEFAULT_SKIP_LIST = prepareSkipList(DEFAULT_SKIP_LIST);
105
- function prepareSkipList(skipList) {
106
- return {
107
- strings: new Set(skipList.filter((e)=>'string' == typeof e)),
108
- functions: skipList.filter((e)=>'function' == typeof e),
109
- regexps: skipList.filter((e)=>e instanceof RegExp)
110
- };
111
- }
112
- function default_skip_list_isInSkipList(entry, skipList) {
113
- if (skipList.strings.has(entry)) return true;
114
- if (skipList.functions.some((f)=>f(entry))) return true;
115
- if (skipList.regexps.some((r)=>r.test(entry))) return true;
116
- return false;
117
- }
118
- const external_process_namespaceObject = require("process");
119
- var external_process_default = /*#__PURE__*/ __webpack_require__.n(external_process_namespaceObject);
120
- let _context = {};
121
- function getConfigContext() {
122
- return _context;
123
- }
124
- const external_npmlog_namespaceObject = require("npmlog");
125
- var external_npmlog_default = /*#__PURE__*/ __webpack_require__.n(external_npmlog_namespaceObject);
126
- const levels = external_npmlog_default().levels;
127
- external_npmlog_default().addLevel('error', levels.error, {
128
- fg: 'brightWhite',
129
- bg: 'red'
130
- }, ' ERR! ');
131
- external_npmlog_default().addLevel('warn', levels.info, {
132
- fg: 'brightWhite',
133
- bg: 'yellow'
134
- }, ' WARN ');
135
- external_npmlog_default().addLevel('info', levels.warn, {
136
- fg: 'brightWhite',
137
- bg: 'green'
138
- }, ' INFO ');
139
- external_npmlog_default().addLevel('notice', levels.notice, {
140
- fg: 'black',
141
- bg: 'brightYellow'
142
- }, ' NOTE ');
143
- external_npmlog_default().addLevel('verbose', levels.verbose, {
144
- fg: 'brightWhite',
145
- bg: 'brightBlue'
146
- }, ' VRB! ');
147
- external_npmlog_default().addLevel('silly', levels.silly, {
148
- fg: 'black',
149
- bg: 'white'
150
- }, ' DBG! ');
151
- const logger_logger = {
152
- error: (msg)=>external_npmlog_default().error('', msg),
153
- warn: (msg)=>external_npmlog_default().warn('', msg),
154
- notice: (msg)=>external_npmlog_default().notice('', msg),
155
- info: (msg)=>external_npmlog_default().info('', msg),
156
- verbose: (msg)=>external_npmlog_default().verbose('', msg),
157
- debug: (msg)=>external_npmlog_default().silly('', msg)
158
- };
159
- const setLogLevel = (level)=>{
160
- external_npmlog_default().level = 'debug' === level ? 'silly' : level;
161
- };
162
- setLogLevel('info');
163
- function normalize_normalize(path, trailingSlash) {
164
- let cand = path.replace(/\\/g, '/');
165
- if (void 0 === trailingSlash) return cand;
166
- while(cand.endsWith('/'))cand = cand.substring(0, cand.length - 1);
167
- if (trailingSlash) return cand + '/';
168
- return cand;
169
- }
170
- const packageCache = {};
171
- function findPackageJsonFiles(project, workspace) {
172
- return expandFolders(project, workspace).map((f)=>external_path_namespaceObject.join(f, 'package.json')).filter((f)=>external_fs_namespaceObject.existsSync(f));
173
- }
174
- function expandFolders(child, parent) {
175
- const result = [];
176
- parent = normalize_normalize(parent, true);
177
- child = normalize_normalize(child, true);
178
- if (!child.startsWith(parent)) throw new Error(`Workspace folder ${parent} needs to be a parent of the project folder ${child}`);
179
- let current = child;
180
- while(current !== parent){
181
- result.push(current);
182
- const cand = normalize_normalize(external_path_namespaceObject.dirname(current), true);
183
- if (cand === current) break;
184
- current = cand;
185
- }
186
- result.push(parent);
187
- return result;
188
- }
189
- function getVersionMapCacheKey(project, workspace) {
190
- return `${project}**${workspace}`;
191
- }
192
- function getVersionMaps(project, workspace) {
193
- return getPackageJsonFiles(project, workspace).map((json)=>({
194
- ...json.content['dependencies']
195
- }));
196
- }
197
- function getPackageJsonFiles(project, workspace) {
198
- const cacheKey = getVersionMapCacheKey(project, workspace);
199
- let maps = packageCache[cacheKey];
200
- if (maps) return maps;
201
- maps = findPackageJsonFiles(project, workspace).map((f)=>{
202
- const content = JSON.parse(external_fs_namespaceObject.readFileSync(f, 'utf-8'));
203
- const directory = normalize_normalize(external_path_namespaceObject.dirname(f), true);
204
- const result = {
205
- content,
206
- directory
207
- };
208
- return result;
209
- });
210
- packageCache[cacheKey] = maps;
211
- return maps;
212
- }
213
- function findDepPackageJson(packageName, projectRoot) {
214
- const mainPkgName = getPkgFolder(packageName);
215
- let mainPkgPath = external_path_namespaceObject.join(projectRoot, 'node_modules', mainPkgName);
216
- let mainPkgJsonPath = external_path_namespaceObject.join(mainPkgPath, 'package.json');
217
- let directory = projectRoot;
218
- while(external_path_namespaceObject.dirname(directory) !== directory){
219
- if (external_fs_namespaceObject.existsSync(mainPkgJsonPath)) break;
220
- directory = normalize_normalize(external_path_namespaceObject.dirname(directory), true);
221
- mainPkgPath = external_path_namespaceObject.join(directory, 'node_modules', mainPkgName);
222
- mainPkgJsonPath = external_path_namespaceObject.join(mainPkgPath, 'package.json');
223
- }
224
- if (!external_fs_namespaceObject.existsSync(mainPkgJsonPath)) {
225
- logger_logger.verbose('No package.json found for ' + packageName + ' in ' + mainPkgPath);
226
- return null;
227
- }
228
- return mainPkgJsonPath;
229
- }
230
- function getPkgFolder(packageName) {
231
- const parts = packageName.split('/');
232
- let folder = parts[0];
233
- if (folder.startsWith('@')) folder += '/' + parts[1];
234
- return folder;
235
- }
236
- let share_utils_inferVersion = false;
237
- const DEFAULT_SECONARIES_SKIP_LIST = [
238
- '@angular/router/upgrade',
239
- '@angular/common/upgrade'
240
- ];
241
- function share_utils_findRootTsConfigJson() {
242
- const packageJson = findPackageJson(external_process_default().cwd());
243
- const projectRoot = external_path_default().dirname(packageJson);
244
- const tsConfigBaseJson = external_path_default().join(projectRoot, 'tsconfig.base.json');
245
- const tsConfigJson = external_path_default().join(projectRoot, 'tsconfig.json');
246
- if (external_fs_default().existsSync(tsConfigBaseJson)) return tsConfigBaseJson;
247
- if (external_fs_default().existsSync(tsConfigJson)) return tsConfigJson;
248
- throw new Error('Neither a tsconfig.json nor a tsconfig.base.json was found');
249
- }
250
- function findPackageJson(folder) {
251
- while(!external_fs_default().existsSync(external_path_default().join(folder, 'package.json')) && external_path_default().dirname(folder) !== folder)folder = external_path_default().dirname(folder);
252
- const filePath = external_path_default().join(folder, 'package.json');
253
- if (external_fs_default().existsSync(filePath)) return filePath;
254
- throw new Error(`No package.json found. Searched the following folder and all parents: ${folder}`);
255
- }
256
- function lookupVersion(key, workspaceRoot) {
257
- const versionMaps = getVersionMaps(workspaceRoot, workspaceRoot);
258
- for (const versionMap of versionMaps){
259
- const version = lookupVersionInMap(key, versionMap);
260
- if (version) return version;
261
- }
262
- throw new Error(`Shared Dependency ${key} has requiredVersion:'auto'. However, this dependency is not found in your package.json`);
263
- }
264
- function lookupVersionInMap(key, versions) {
265
- const parts = key.split('/');
266
- key = parts.length >= 2 && parts[0].startsWith('@') ? `${parts[0]}/${parts[1]}` : parts[0];
267
- if ('@angular-architects/module-federation-runtime' === key.toLowerCase()) key = '@angular-architects/module-federation';
268
- return versions[key] || null;
269
- }
270
- function _findSecondaries(libPath, excludes, shareObject, acc) {
271
- const files = external_fs_default().readdirSync(libPath);
272
- const dirs = files.map((f)=>external_path_default().join(libPath, f)).filter((f)=>external_fs_default().lstatSync(f).isDirectory() && 'node_modules' !== f);
273
- const secondaries = dirs.filter((d)=>external_fs_default().existsSync(external_path_default().join(d, 'package.json')));
274
- for (const s of secondaries){
275
- const secondaryLibName = s.replace(/\\/g, '/').replace(/^.*node_modules[/]/, '');
276
- if (!excludes.includes(secondaryLibName)) {
277
- if (!default_skip_list_isInSkipList(secondaryLibName, PREPARED_DEFAULT_SKIP_LIST)) {
278
- acc[secondaryLibName] = {
279
- ...shareObject
280
- };
281
- _findSecondaries(s, excludes, shareObject, acc);
282
- }
283
- }
284
- }
285
- }
286
- function findSecondaries(libPath, excludes, shareObject) {
287
- const acc = {};
288
- _findSecondaries(libPath, excludes, shareObject, acc);
289
- return acc;
290
- }
291
- function getSecondaries(includeSecondaries, libPath, key, shareObject) {
292
- let exclude = [
293
- ...DEFAULT_SECONARIES_SKIP_LIST
294
- ];
295
- if ('object' == typeof includeSecondaries) {
296
- if (Array.isArray(includeSecondaries.skip)) exclude = includeSecondaries.skip;
297
- else if ('string' == typeof includeSecondaries.skip) exclude = [
298
- includeSecondaries.skip
299
- ];
300
- }
301
- if (!external_fs_default().existsSync(libPath)) return {};
302
- const configured = readConfiguredSecondaries(key, libPath, exclude, shareObject);
303
- if (configured) return configured;
304
- return findSecondaries(libPath, exclude, shareObject);
305
- }
306
- function readConfiguredSecondaries(parent, libPath, exclude, shareObject) {
307
- const libPackageJson = external_path_default().join(libPath, 'package.json');
308
- if (!external_fs_default().existsSync(libPackageJson)) return null;
309
- const packageJson = JSON.parse(external_fs_default().readFileSync(libPackageJson, 'utf-8'));
310
- const exports1 = packageJson['exports'];
311
- if (!exports1) return null;
312
- const keys = Object.keys(exports1).filter((key)=>'.' !== key && './package.json' !== key && !key.endsWith('*') && (exports1[key]['default'] || 'string' == typeof exports1[key]));
313
- const result = {};
314
- for (const key of keys){
315
- const secondaryName = external_path_default().join(parent, key).replace(/\\/g, '/');
316
- if (exclude.includes(secondaryName)) continue;
317
- if (default_skip_list_isInSkipList(secondaryName, PREPARED_DEFAULT_SKIP_LIST)) continue;
318
- const entry = getDefaultEntry(exports1, key);
319
- if ('string' != typeof entry) {
320
- console.log(`No entry point found for ${secondaryName}`);
321
- continue;
322
- }
323
- if (![
324
- '.css',
325
- '.scss',
326
- '.less'
327
- ].some((ext)=>entry.endsWith(ext))) result[secondaryName] = {
328
- ...shareObject
329
- };
330
- }
331
- return result;
332
- }
333
- function getDefaultEntry(exports1, key) {
334
- let entry;
335
- if ('string' == typeof exports1[key]) entry = exports1[key];
336
- else {
337
- var _exports_key;
338
- entry = null == (_exports_key = exports1[key]) ? void 0 : _exports_key['default'];
339
- if ('object' == typeof entry) entry = entry['default'];
340
- }
341
- return entry;
342
- }
343
- function share_utils_shareAll(config, skip = DEFAULT_SKIP_LIST, projectPath = '') {
344
- projectPath = inferProjectPath(projectPath);
345
- const versionMaps = getVersionMaps(projectPath, projectPath);
346
- const shareConfig = {};
347
- for (const versions of versionMaps){
348
- const preparedSkipList = prepareSkipList(skip);
349
- for(const key in versions){
350
- if (default_skip_list_isInSkipList(key, preparedSkipList)) continue;
351
- const inferVersion = !config.requiredVersion || 'auto' === config.requiredVersion;
352
- const requiredVersion = inferVersion ? versions[key] : config.requiredVersion;
353
- if (!shareConfig[key]) shareConfig[key] = {
354
- ...config,
355
- requiredVersion
356
- };
357
- }
358
- }
359
- return share(share, projectPath);
360
- }
361
- function inferProjectPath(projectPath) {
362
- if (!projectPath) projectPath = external_path_default().dirname(getConfigContext().packageJson || '');
363
- if (!projectPath && getConfigContext().workspaceRoot) projectPath = getConfigContext().workspaceRoot || '';
364
- if (!projectPath) projectPath = external_process_default().cwd();
365
- return projectPath;
366
- }
367
- function setInferVersion(infer) {
368
- share_utils_inferVersion = infer;
369
- }
370
- function share(shareObjects, projectPath = '') {
371
- projectPath = inferProjectPath(projectPath);
372
- const packagePath = findPackageJson(projectPath);
373
- const result = {};
374
- let includeSecondaries;
375
- for(const key in shareObjects){
376
- includeSecondaries = false;
377
- const shareObject = shareObjects[key];
378
- if ('auto' === shareObject.requiredVersion || share_utils_inferVersion && void 0 === shareObject.requiredVersion) {
379
- const version = lookupVersion(key, projectPath);
380
- shareObject.requiredVersion = version;
381
- shareObject.version = version.replace(/^\D*/, '');
382
- }
383
- if (void 0 === shareObject.includeSecondaries) shareObject.includeSecondaries = true;
384
- if (shareObject.includeSecondaries) {
385
- includeSecondaries = shareObject.includeSecondaries;
386
- delete shareObject.includeSecondaries;
387
- }
388
- result[key] = shareObject;
389
- if (includeSecondaries) {
390
- const libPackageJson = findDepPackageJson(key, external_path_default().dirname(packagePath));
391
- if (!libPackageJson) {
392
- logger_logger.error(`Could not find folder containing dep ${key}`);
393
- continue;
394
- }
395
- const libPath = external_path_default().dirname(libPackageJson);
396
- const secondaries = getSecondaries(includeSecondaries, libPath, key, shareObject);
397
- if (secondaries) addSecondaries(secondaries, result);
398
- }
399
- }
400
- return result;
401
- }
402
- function addSecondaries(secondaries, result) {
403
- Object.assign(result, secondaries);
404
- }
405
- require("json5");
406
- function withFederation(config) {
407
- const skip = prepareSkipList(config.skip ?? []);
408
- return {
409
- name: config.name ?? '',
410
- filename: config.filename ?? 'remoteEntry',
411
- exposes: config.exposes ?? {},
412
- remotes: config.remotes ?? {},
413
- shared: normalizeShared(config, skip)
414
- };
415
- }
416
- function normalizeShared(config, skip) {
417
- let result = {};
418
- const shared = config.shared;
419
- result = shared ? Object.keys(shared).reduce((acc, cur)=>({
420
- ...acc,
421
- [cur]: {
422
- requiredVersion: shared[cur].requiredVersion ?? 'auto',
423
- singleton: shared[cur].singleton ?? false,
424
- strictVersion: shared[cur].strictVersion ?? false,
425
- version: shared[cur].version,
426
- includeSecondaries: shared[cur].includeSecondaries
427
- }
428
- }), {}) : share_utils_shareAll({
429
- singleton: true,
430
- strictVersion: true,
431
- requiredVersion: 'auto'
432
- });
433
- result = Object.keys(result).filter((key)=>!default_skip_list_isInSkipList(key, skip)).reduce((acc, cur)=>({
434
- ...acc,
435
- [cur]: result[cur]
436
- }), {});
437
- return result;
98
+ /* ESM import */var _lib_core_get_externals__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./lib/core/get-externals");
99
+ /* ESM import */var _lib_core_get_externals__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_lib_core_get_externals__WEBPACK_IMPORTED_MODULE_0__);
100
+
101
+ /* ESM reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {};
102
+ /* ESM reexport (unknown) */ for( var __WEBPACK_IMPORT_KEY__ in _lib_core_get_externals__WEBPACK_IMPORTED_MODULE_0__) if(__WEBPACK_IMPORT_KEY__ !== "default") __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] =function(key) { return _lib_core_get_externals__WEBPACK_IMPORTED_MODULE_0__[key]; }.bind(0, __WEBPACK_IMPORT_KEY__)
103
+ /* ESM reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
104
+ /* ESM import */var _lib_core_load_federation_config__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("./lib/core/load-federation-config");
105
+ /* ESM import */var _lib_core_load_federation_config__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_lib_core_load_federation_config__WEBPACK_IMPORTED_MODULE_1__);
106
+
107
+ /* ESM reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {};
108
+ /* ESM reexport (unknown) */ for( var __WEBPACK_IMPORT_KEY__ in _lib_core_load_federation_config__WEBPACK_IMPORTED_MODULE_1__) if(__WEBPACK_IMPORT_KEY__ !== "default") __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] =function(key) { return _lib_core_load_federation_config__WEBPACK_IMPORTED_MODULE_1__[key]; }.bind(0, __WEBPACK_IMPORT_KEY__)
109
+ /* ESM reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
110
+ /* ESM import */var _lib_config_with_native_federation__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("./lib/config/with-native-federation");
111
+ /* ESM import */var _lib_config_with_native_federation__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_lib_config_with_native_federation__WEBPACK_IMPORTED_MODULE_2__);
112
+
113
+ /* ESM reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {};
114
+ /* ESM reexport (unknown) */ for( var __WEBPACK_IMPORT_KEY__ in _lib_config_with_native_federation__WEBPACK_IMPORTED_MODULE_2__) if(__WEBPACK_IMPORT_KEY__ !== "default") __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] =function(key) { return _lib_config_with_native_federation__WEBPACK_IMPORTED_MODULE_2__[key]; }.bind(0, __WEBPACK_IMPORT_KEY__)
115
+ /* ESM reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
116
+ /* ESM import */var _lib_config_share_utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("./lib/config/share-utils");
117
+ /* ESM import */var _lib_config_share_utils__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_lib_config_share_utils__WEBPACK_IMPORTED_MODULE_3__);
118
+
119
+ /* ESM reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {};
120
+ /* ESM reexport (unknown) */ for( var __WEBPACK_IMPORT_KEY__ in _lib_config_share_utils__WEBPACK_IMPORTED_MODULE_3__) if(__WEBPACK_IMPORT_KEY__ !== "default") __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] =function(key) { return _lib_config_share_utils__WEBPACK_IMPORTED_MODULE_3__[key]; }.bind(0, __WEBPACK_IMPORT_KEY__)
121
+ /* ESM reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
122
+ /* ESM import */var _lib_utils_logger__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("./lib/utils/logger");
123
+ /* ESM import */var _lib_utils_logger__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_lib_utils_logger__WEBPACK_IMPORTED_MODULE_4__);
124
+
125
+ /* ESM reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {};
126
+ /* ESM reexport (unknown) */ for( var __WEBPACK_IMPORT_KEY__ in _lib_utils_logger__WEBPACK_IMPORTED_MODULE_4__) if(__WEBPACK_IMPORT_KEY__ !== "default") __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] =function(key) { return _lib_utils_logger__WEBPACK_IMPORTED_MODULE_4__[key]; }.bind(0, __WEBPACK_IMPORT_KEY__)
127
+ /* ESM reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
128
+
129
+
130
+
131
+
132
+
133
+
134
+ })();
135
+
136
+ for(var __webpack_i__ in __webpack_exports__) {
137
+ exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
438
138
  }
439
- exports.DEFAULT_SECONARIES_SKIP_LIST = __webpack_exports__.DEFAULT_SECONARIES_SKIP_LIST;
440
- exports._findSecondaries = __webpack_exports__._findSecondaries;
441
- exports.addSecondaries = __webpack_exports__.addSecondaries;
442
- exports.findPackageJson = __webpack_exports__.findPackageJson;
443
- exports.findRootTsConfigJson = __webpack_exports__.findRootTsConfigJson;
444
- exports.findSecondaries = __webpack_exports__.findSecondaries;
445
- exports.getDefaultEntry = __webpack_exports__.getDefaultEntry;
446
- exports.getExternals = __webpack_exports__.getExternals;
447
- exports.getSecondaries = __webpack_exports__.getSecondaries;
448
- exports.loadFederationConfig = __webpack_exports__.loadFederationConfig;
449
- exports.logger = __webpack_exports__.logger;
450
- exports.lookupVersion = __webpack_exports__.lookupVersion;
451
- exports.lookupVersionInMap = __webpack_exports__.lookupVersionInMap;
452
- exports.readConfiguredSecondaries = __webpack_exports__.readConfiguredSecondaries;
453
- exports.setInferVersion = __webpack_exports__.setInferVersion;
454
- exports.setLogLevel = __webpack_exports__.setLogLevel;
455
- exports.share = __webpack_exports__.share;
456
- exports.shareAll = __webpack_exports__.shareAll;
457
- exports.withFederation = __webpack_exports__.withFederation;
458
- for(var __webpack_i__ in __webpack_exports__)if (-1 === [
459
- "DEFAULT_SECONARIES_SKIP_LIST",
460
- "_findSecondaries",
461
- "addSecondaries",
462
- "findPackageJson",
463
- "findRootTsConfigJson",
464
- "findSecondaries",
465
- "getDefaultEntry",
466
- "getExternals",
467
- "getSecondaries",
468
- "loadFederationConfig",
469
- "logger",
470
- "lookupVersion",
471
- "lookupVersionInMap",
472
- "readConfiguredSecondaries",
473
- "setInferVersion",
474
- "setLogLevel",
475
- "share",
476
- "shareAll",
477
- "withFederation"
478
- ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
479
- Object.defineProperty(exports, '__esModule', {
480
- value: true
481
- });
139
+ Object.defineProperty(exports, '__esModule', { value: true });