@module-federation/esbuild 0.0.0-perf-devtools-20260107043700 → 0.0.0-perf-website-code-usage-20260914033703
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/adapters/lib/collect-exports.js +153 -0
- package/dist/adapters/lib/collect-exports.mjs +80 -0
- package/dist/adapters/lib/commonjs.js +258 -0
- package/dist/adapters/lib/commonjs.mjs +182 -0
- package/dist/adapters/lib/containerPlugin.js +233 -0
- package/dist/adapters/lib/containerPlugin.mjs +179 -0
- package/dist/adapters/lib/containerReference.js +257 -0
- package/dist/adapters/lib/containerReference.mjs +188 -0
- package/dist/adapters/lib/lexer.js +187 -0
- package/dist/adapters/lib/lexer.mjs +136 -0
- package/dist/adapters/lib/linkRemotesPlugin.js +117 -0
- package/dist/adapters/lib/linkRemotesPlugin.mjs +48 -0
- package/dist/adapters/lib/manifest.js +227 -0
- package/dist/adapters/lib/manifest.mjs +159 -0
- package/dist/adapters/lib/plugin.js +340 -0
- package/dist/adapters/lib/plugin.mjs +247 -0
- package/dist/adapters/lib/react-replacements.js +86 -0
- package/dist/adapters/lib/react-replacements.mjs +34 -0
- package/dist/adapters/lib/transform.js +171 -0
- package/dist/adapters/lib/transform.mjs +116 -0
- package/dist/adapters/lib/utils.js +87 -0
- package/dist/adapters/lib/utils.mjs +31 -0
- package/dist/build.js +132 -473
- package/dist/build.mjs +12 -380
- package/dist/index.js +45 -26
- package/dist/index.mjs +3 -2
- package/dist/lib/config/configuration-context.js +73 -0
- package/dist/lib/config/configuration-context.mjs +18 -0
- package/dist/lib/config/federation-config.js +29 -0
- package/dist/lib/config/federation-config.mjs +3 -0
- package/dist/lib/config/share-utils.js +340 -0
- package/dist/lib/config/share-utils.mjs +245 -0
- package/dist/lib/config/with-native-federation.js +120 -0
- package/dist/lib/config/with-native-federation.mjs +66 -0
- package/dist/lib/core/build-adapter.js +72 -0
- package/dist/lib/core/build-adapter.mjs +16 -0
- package/dist/lib/core/createContainerTemplate.js +235 -0
- package/dist/lib/core/createContainerTemplate.mjs +183 -0
- package/dist/lib/core/default-skip-list.js +103 -0
- package/dist/lib/core/default-skip-list.mjs +45 -0
- package/dist/lib/core/federation-options.js +29 -0
- package/dist/lib/core/federation-options.mjs +3 -0
- package/dist/lib/core/get-externals.js +68 -0
- package/dist/lib/core/get-externals.mjs +17 -0
- package/dist/lib/core/load-federation-config.js +71 -0
- package/dist/lib/core/load-federation-config.mjs +16 -0
- package/dist/lib/core/write-federation-info.js +67 -0
- package/dist/lib/core/write-federation-info.mjs +12 -0
- package/dist/lib/utils/logger.js +113 -0
- package/dist/lib/utils/logger.mjs +44 -0
- package/dist/lib/utils/mapped-paths.js +95 -0
- package/dist/lib/utils/mapped-paths.mjs +40 -0
- package/dist/lib/utils/normalize.js +66 -0
- package/dist/lib/utils/normalize.mjs +15 -0
- package/dist/lib/utils/package-info.js +325 -0
- package/dist/lib/utils/package-info.mjs +259 -0
- package/dist/plugin.d.ts +1 -0
- package/dist/plugin.js +82 -1233
- package/dist/plugin.mjs +2 -1188
- package/dist/resolve/esm-resolver.mjs +15 -22
- package/dist/rslib-runtime.mjs +31 -0
- package/package.json +20 -11
package/dist/build.js
CHANGED
|
@@ -1,481 +1,140 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
8
|
+
;
|
|
9
|
+
var __webpack_modules__ = ({
|
|
10
|
+
"./lib/config/share-utils"(module) {
|
|
11
|
+
module.exports = require("./lib/config/share-utils.js");
|
|
12
|
+
|
|
13
|
+
},
|
|
14
|
+
"./lib/config/with-native-federation"(module) {
|
|
15
|
+
module.exports = require("./lib/config/with-native-federation.js");
|
|
16
|
+
|
|
17
|
+
},
|
|
18
|
+
"./lib/core/get-externals"(module) {
|
|
19
|
+
module.exports = require("./lib/core/get-externals.js");
|
|
20
|
+
|
|
21
|
+
},
|
|
22
|
+
"./lib/core/load-federation-config"(module) {
|
|
23
|
+
module.exports = require("./lib/core/load-federation-config.js");
|
|
24
|
+
|
|
25
|
+
},
|
|
26
|
+
"./lib/utils/logger"(module) {
|
|
27
|
+
module.exports = require("./lib/utils/logger.js");
|
|
28
|
+
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
});
|
|
32
|
+
// The module cache
|
|
33
|
+
var __webpack_module_cache__ = {};
|
|
34
|
+
|
|
35
|
+
// The require function
|
|
36
|
+
function __webpack_require__(moduleId) {
|
|
37
|
+
|
|
38
|
+
// Check if module is in cache
|
|
39
|
+
var cachedModule = __webpack_module_cache__[moduleId];
|
|
40
|
+
if (cachedModule !== undefined) {
|
|
41
|
+
return cachedModule.exports;
|
|
42
|
+
}
|
|
43
|
+
// Create a new module (and put it into the cache)
|
|
44
|
+
var module = (__webpack_module_cache__[moduleId] = {
|
|
45
|
+
exports: {}
|
|
46
|
+
});
|
|
47
|
+
// Execute the module function
|
|
48
|
+
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
49
|
+
|
|
50
|
+
// Return the exports of the module
|
|
51
|
+
return module.exports;
|
|
52
|
+
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// webpack/runtime/compat_get_default_export
|
|
56
|
+
(() => {
|
|
57
|
+
// getDefaultExport function for compatibility with non-ESM modules
|
|
58
|
+
__webpack_require__.n = (module) => {
|
|
59
|
+
var getter = module && module.__esModule ?
|
|
60
|
+
() => (module['default']) :
|
|
61
|
+
() => (module);
|
|
62
|
+
__webpack_require__.d(getter, { a: getter });
|
|
63
|
+
return getter;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
})();
|
|
67
|
+
// webpack/runtime/define_property_getters
|
|
68
|
+
(() => {
|
|
69
|
+
__webpack_require__.d = (exports, getters, values) => {
|
|
70
|
+
var define = (defs, kind) => {
|
|
71
|
+
for(var key in defs) {
|
|
72
|
+
if(__webpack_require__.o(defs, key) && !__webpack_require__.o(exports, key)) {
|
|
73
|
+
Object.defineProperty(exports, key, { enumerable: true, [kind]: defs[key] });
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
define(getters, "get");
|
|
78
|
+
define(values, "value");
|
|
79
|
+
};
|
|
19
80
|
})();
|
|
20
|
-
|
|
21
|
-
|
|
81
|
+
// webpack/runtime/has_own_property
|
|
82
|
+
(() => {
|
|
83
|
+
__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
22
84
|
})();
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
85
|
+
// webpack/runtime/make_namespace_object
|
|
86
|
+
(() => {
|
|
87
|
+
// define __esModule on exports
|
|
88
|
+
__webpack_require__.r = (exports) => {
|
|
89
|
+
if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
90
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
91
|
+
}
|
|
92
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
93
|
+
};
|
|
32
94
|
})();
|
|
33
95
|
var __webpack_exports__ = {};
|
|
96
|
+
// This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk.
|
|
97
|
+
(() => {
|
|
34
98
|
__webpack_require__.r(__webpack_exports__);
|
|
35
|
-
__webpack_require__
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
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;
|
|
99
|
+
/* import */ var _lib_core_get_externals__rspack_import_0 = __webpack_require__("./lib/core/get-externals");
|
|
100
|
+
/* import */ var _lib_core_get_externals__rspack_import_0_default = /*#__PURE__*/__webpack_require__.n(_lib_core_get_externals__rspack_import_0);
|
|
101
|
+
|
|
102
|
+
/* reexport */ var __rspack_reexport = {};
|
|
103
|
+
/* reexport */ for( const __rspack_import_key in _lib_core_get_externals__rspack_import_0) if(__rspack_import_key !== "default") __rspack_reexport[__rspack_import_key] =() => _lib_core_get_externals__rspack_import_0[__rspack_import_key]
|
|
104
|
+
/* reexport */ __webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
105
|
+
/* import */ var _lib_core_load_federation_config__rspack_import_1 = __webpack_require__("./lib/core/load-federation-config");
|
|
106
|
+
/* import */ var _lib_core_load_federation_config__rspack_import_1_default = /*#__PURE__*/__webpack_require__.n(_lib_core_load_federation_config__rspack_import_1);
|
|
107
|
+
|
|
108
|
+
/* reexport */ var __rspack_reexport = {};
|
|
109
|
+
/* reexport */ for( const __rspack_import_key in _lib_core_load_federation_config__rspack_import_1) if(__rspack_import_key !== "default") __rspack_reexport[__rspack_import_key] =() => _lib_core_load_federation_config__rspack_import_1[__rspack_import_key]
|
|
110
|
+
/* reexport */ __webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
111
|
+
/* import */ var _lib_config_with_native_federation__rspack_import_2 = __webpack_require__("./lib/config/with-native-federation");
|
|
112
|
+
/* import */ var _lib_config_with_native_federation__rspack_import_2_default = /*#__PURE__*/__webpack_require__.n(_lib_config_with_native_federation__rspack_import_2);
|
|
113
|
+
|
|
114
|
+
/* reexport */ var __rspack_reexport = {};
|
|
115
|
+
/* reexport */ for( const __rspack_import_key in _lib_config_with_native_federation__rspack_import_2) if(__rspack_import_key !== "default") __rspack_reexport[__rspack_import_key] =() => _lib_config_with_native_federation__rspack_import_2[__rspack_import_key]
|
|
116
|
+
/* reexport */ __webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
117
|
+
/* import */ var _lib_config_share_utils__rspack_import_3 = __webpack_require__("./lib/config/share-utils");
|
|
118
|
+
/* import */ var _lib_config_share_utils__rspack_import_3_default = /*#__PURE__*/__webpack_require__.n(_lib_config_share_utils__rspack_import_3);
|
|
119
|
+
|
|
120
|
+
/* reexport */ var __rspack_reexport = {};
|
|
121
|
+
/* reexport */ for( const __rspack_import_key in _lib_config_share_utils__rspack_import_3) if(__rspack_import_key !== "default") __rspack_reexport[__rspack_import_key] =() => _lib_config_share_utils__rspack_import_3[__rspack_import_key]
|
|
122
|
+
/* reexport */ __webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
123
|
+
/* import */ var _lib_utils_logger__rspack_import_4 = __webpack_require__("./lib/utils/logger");
|
|
124
|
+
/* import */ var _lib_utils_logger__rspack_import_4_default = /*#__PURE__*/__webpack_require__.n(_lib_utils_logger__rspack_import_4);
|
|
125
|
+
|
|
126
|
+
/* reexport */ var __rspack_reexport = {};
|
|
127
|
+
/* reexport */ for( const __rspack_import_key in _lib_utils_logger__rspack_import_4) if(__rspack_import_key !== "default") __rspack_reexport[__rspack_import_key] =() => _lib_utils_logger__rspack_import_4[__rspack_import_key]
|
|
128
|
+
/* reexport */ __webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
})();
|
|
136
|
+
|
|
137
|
+
for(var __rspack_i in __webpack_exports__) {
|
|
138
|
+
exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
438
139
|
}
|
|
439
|
-
exports
|
|
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
|
-
});
|
|
140
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|