@module-federation/esbuild 0.0.81 → 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/build.mjs
ADDED
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
import path_0, { dirname, join } from "path";
|
|
2
|
+
import fs_0, { existsSync, readFileSync } from "fs";
|
|
3
|
+
import process from "process";
|
|
4
|
+
import npmlog from "npmlog";
|
|
5
|
+
import "json5";
|
|
6
|
+
function getExternals(config) {
|
|
7
|
+
const shared = Object.keys(config.shared ?? {});
|
|
8
|
+
const remotes = config.remotes ?? {};
|
|
9
|
+
const remoteKeys = Object.keys(remotes).reduce((acc, key)=>{
|
|
10
|
+
if (!key) return acc;
|
|
11
|
+
acc.push(key);
|
|
12
|
+
acc.push(key + '/*');
|
|
13
|
+
return acc;
|
|
14
|
+
}, []);
|
|
15
|
+
const externals = [
|
|
16
|
+
...shared,
|
|
17
|
+
...remoteKeys
|
|
18
|
+
];
|
|
19
|
+
return externals;
|
|
20
|
+
}
|
|
21
|
+
async function loadFederationConfig(fedOptions) {
|
|
22
|
+
const fullConfigPath = join(fedOptions.workspaceRoot, fedOptions.federationConfig);
|
|
23
|
+
if (!existsSync(fullConfigPath)) throw new Error('Expected ' + fullConfigPath);
|
|
24
|
+
const config = await import(`${fullConfigPath}`);
|
|
25
|
+
return config;
|
|
26
|
+
}
|
|
27
|
+
const DEFAULT_SKIP_LIST = [
|
|
28
|
+
'@module-federation/native-federation-runtime',
|
|
29
|
+
'@module-federation/native-federation',
|
|
30
|
+
'@module-federation/native-federation-core',
|
|
31
|
+
'@module-federation/native-federation-esbuild',
|
|
32
|
+
'@angular-architects/native-federation',
|
|
33
|
+
'@angular-architects/native-federation-runtime',
|
|
34
|
+
'es-module-shims',
|
|
35
|
+
'zone.js',
|
|
36
|
+
'tslib/',
|
|
37
|
+
'@angular/localize',
|
|
38
|
+
'@angular/localize/init',
|
|
39
|
+
'@angular/localize/tools',
|
|
40
|
+
'@angular/platform-server',
|
|
41
|
+
'@angular/platform-server/init',
|
|
42
|
+
'@angular/ssr',
|
|
43
|
+
'express',
|
|
44
|
+
/\/schematics(\/|$)/,
|
|
45
|
+
/^@nx\/angular/,
|
|
46
|
+
(pkg)=>pkg.startsWith('@angular/') && !!pkg.match(/\/testing(\/|$)/),
|
|
47
|
+
(pkg)=>pkg.startsWith('@types/'),
|
|
48
|
+
(pkg)=>pkg.startsWith('@module-federation/')
|
|
49
|
+
];
|
|
50
|
+
const PREPARED_DEFAULT_SKIP_LIST = prepareSkipList(DEFAULT_SKIP_LIST);
|
|
51
|
+
function prepareSkipList(skipList) {
|
|
52
|
+
return {
|
|
53
|
+
strings: new Set(skipList.filter((e)=>'string' == typeof e)),
|
|
54
|
+
functions: skipList.filter((e)=>'function' == typeof e),
|
|
55
|
+
regexps: skipList.filter((e)=>e instanceof RegExp)
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
function default_skip_list_isInSkipList(entry, skipList) {
|
|
59
|
+
if (skipList.strings.has(entry)) return true;
|
|
60
|
+
if (skipList.functions.some((f)=>f(entry))) return true;
|
|
61
|
+
if (skipList.regexps.some((r)=>r.test(entry))) return true;
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
let _context = {};
|
|
65
|
+
function getConfigContext() {
|
|
66
|
+
return _context;
|
|
67
|
+
}
|
|
68
|
+
const levels = npmlog.levels;
|
|
69
|
+
npmlog.addLevel('error', levels.error, {
|
|
70
|
+
fg: 'brightWhite',
|
|
71
|
+
bg: 'red'
|
|
72
|
+
}, ' ERR! ');
|
|
73
|
+
npmlog.addLevel('warn', levels.info, {
|
|
74
|
+
fg: 'brightWhite',
|
|
75
|
+
bg: 'yellow'
|
|
76
|
+
}, ' WARN ');
|
|
77
|
+
npmlog.addLevel('info', levels.warn, {
|
|
78
|
+
fg: 'brightWhite',
|
|
79
|
+
bg: 'green'
|
|
80
|
+
}, ' INFO ');
|
|
81
|
+
npmlog.addLevel('notice', levels.notice, {
|
|
82
|
+
fg: 'black',
|
|
83
|
+
bg: 'brightYellow'
|
|
84
|
+
}, ' NOTE ');
|
|
85
|
+
npmlog.addLevel('verbose', levels.verbose, {
|
|
86
|
+
fg: 'brightWhite',
|
|
87
|
+
bg: 'brightBlue'
|
|
88
|
+
}, ' VRB! ');
|
|
89
|
+
npmlog.addLevel('silly', levels.silly, {
|
|
90
|
+
fg: 'black',
|
|
91
|
+
bg: 'white'
|
|
92
|
+
}, ' DBG! ');
|
|
93
|
+
const logger_logger = {
|
|
94
|
+
error: (msg)=>npmlog.error('', msg),
|
|
95
|
+
warn: (msg)=>npmlog.warn('', msg),
|
|
96
|
+
notice: (msg)=>npmlog.notice('', msg),
|
|
97
|
+
info: (msg)=>npmlog.info('', msg),
|
|
98
|
+
verbose: (msg)=>npmlog.verbose('', msg),
|
|
99
|
+
debug: (msg)=>npmlog.silly('', msg)
|
|
100
|
+
};
|
|
101
|
+
const setLogLevel = (level)=>{
|
|
102
|
+
npmlog.level = 'debug' === level ? 'silly' : level;
|
|
103
|
+
};
|
|
104
|
+
setLogLevel('info');
|
|
105
|
+
function normalize_normalize(path, trailingSlash) {
|
|
106
|
+
let cand = path.replace(/\\/g, '/');
|
|
107
|
+
if (void 0 === trailingSlash) return cand;
|
|
108
|
+
while(cand.endsWith('/'))cand = cand.substring(0, cand.length - 1);
|
|
109
|
+
if (trailingSlash) return cand + '/';
|
|
110
|
+
return cand;
|
|
111
|
+
}
|
|
112
|
+
const packageCache = {};
|
|
113
|
+
function findPackageJsonFiles(project, workspace) {
|
|
114
|
+
return expandFolders(project, workspace).map((f)=>join(f, 'package.json')).filter((f)=>existsSync(f));
|
|
115
|
+
}
|
|
116
|
+
function expandFolders(child, parent) {
|
|
117
|
+
const result = [];
|
|
118
|
+
parent = normalize_normalize(parent, true);
|
|
119
|
+
child = normalize_normalize(child, true);
|
|
120
|
+
if (!child.startsWith(parent)) throw new Error(`Workspace folder ${parent} needs to be a parent of the project folder ${child}`);
|
|
121
|
+
let current = child;
|
|
122
|
+
while(current !== parent){
|
|
123
|
+
result.push(current);
|
|
124
|
+
const cand = normalize_normalize(dirname(current), true);
|
|
125
|
+
if (cand === current) break;
|
|
126
|
+
current = cand;
|
|
127
|
+
}
|
|
128
|
+
result.push(parent);
|
|
129
|
+
return result;
|
|
130
|
+
}
|
|
131
|
+
function getVersionMapCacheKey(project, workspace) {
|
|
132
|
+
return `${project}**${workspace}`;
|
|
133
|
+
}
|
|
134
|
+
function getVersionMaps(project, workspace) {
|
|
135
|
+
return getPackageJsonFiles(project, workspace).map((json)=>({
|
|
136
|
+
...json.content['dependencies']
|
|
137
|
+
}));
|
|
138
|
+
}
|
|
139
|
+
function getPackageJsonFiles(project, workspace) {
|
|
140
|
+
const cacheKey = getVersionMapCacheKey(project, workspace);
|
|
141
|
+
let maps = packageCache[cacheKey];
|
|
142
|
+
if (maps) return maps;
|
|
143
|
+
maps = findPackageJsonFiles(project, workspace).map((f)=>{
|
|
144
|
+
const content = JSON.parse(readFileSync(f, 'utf-8'));
|
|
145
|
+
const directory = normalize_normalize(dirname(f), true);
|
|
146
|
+
const result = {
|
|
147
|
+
content,
|
|
148
|
+
directory
|
|
149
|
+
};
|
|
150
|
+
return result;
|
|
151
|
+
});
|
|
152
|
+
packageCache[cacheKey] = maps;
|
|
153
|
+
return maps;
|
|
154
|
+
}
|
|
155
|
+
function findDepPackageJson(packageName, projectRoot) {
|
|
156
|
+
const mainPkgName = getPkgFolder(packageName);
|
|
157
|
+
let mainPkgPath = join(projectRoot, 'node_modules', mainPkgName);
|
|
158
|
+
let mainPkgJsonPath = join(mainPkgPath, 'package.json');
|
|
159
|
+
let directory = projectRoot;
|
|
160
|
+
while(dirname(directory) !== directory){
|
|
161
|
+
if (existsSync(mainPkgJsonPath)) break;
|
|
162
|
+
directory = normalize_normalize(dirname(directory), true);
|
|
163
|
+
mainPkgPath = join(directory, 'node_modules', mainPkgName);
|
|
164
|
+
mainPkgJsonPath = join(mainPkgPath, 'package.json');
|
|
165
|
+
}
|
|
166
|
+
if (!existsSync(mainPkgJsonPath)) {
|
|
167
|
+
logger_logger.verbose('No package.json found for ' + packageName + ' in ' + mainPkgPath);
|
|
168
|
+
return null;
|
|
169
|
+
}
|
|
170
|
+
return mainPkgJsonPath;
|
|
171
|
+
}
|
|
172
|
+
function getPkgFolder(packageName) {
|
|
173
|
+
const parts = packageName.split('/');
|
|
174
|
+
let folder = parts[0];
|
|
175
|
+
if (folder.startsWith('@')) folder += '/' + parts[1];
|
|
176
|
+
return folder;
|
|
177
|
+
}
|
|
178
|
+
let share_utils_inferVersion = false;
|
|
179
|
+
const DEFAULT_SECONARIES_SKIP_LIST = [
|
|
180
|
+
'@angular/router/upgrade',
|
|
181
|
+
'@angular/common/upgrade'
|
|
182
|
+
];
|
|
183
|
+
function share_utils_findRootTsConfigJson() {
|
|
184
|
+
const packageJson = findPackageJson(process.cwd());
|
|
185
|
+
const projectRoot = path_0.dirname(packageJson);
|
|
186
|
+
const tsConfigBaseJson = path_0.join(projectRoot, 'tsconfig.base.json');
|
|
187
|
+
const tsConfigJson = path_0.join(projectRoot, 'tsconfig.json');
|
|
188
|
+
if (fs_0.existsSync(tsConfigBaseJson)) return tsConfigBaseJson;
|
|
189
|
+
if (fs_0.existsSync(tsConfigJson)) return tsConfigJson;
|
|
190
|
+
throw new Error('Neither a tsconfig.json nor a tsconfig.base.json was found');
|
|
191
|
+
}
|
|
192
|
+
function findPackageJson(folder) {
|
|
193
|
+
while(!fs_0.existsSync(path_0.join(folder, 'package.json')) && path_0.dirname(folder) !== folder)folder = path_0.dirname(folder);
|
|
194
|
+
const filePath = path_0.join(folder, 'package.json');
|
|
195
|
+
if (fs_0.existsSync(filePath)) return filePath;
|
|
196
|
+
throw new Error(`No package.json found. Searched the following folder and all parents: ${folder}`);
|
|
197
|
+
}
|
|
198
|
+
function lookupVersion(key, workspaceRoot) {
|
|
199
|
+
const versionMaps = getVersionMaps(workspaceRoot, workspaceRoot);
|
|
200
|
+
for (const versionMap of versionMaps){
|
|
201
|
+
const version = lookupVersionInMap(key, versionMap);
|
|
202
|
+
if (version) return version;
|
|
203
|
+
}
|
|
204
|
+
throw new Error(`Shared Dependency ${key} has requiredVersion:'auto'. However, this dependency is not found in your package.json`);
|
|
205
|
+
}
|
|
206
|
+
function lookupVersionInMap(key, versions) {
|
|
207
|
+
const parts = key.split('/');
|
|
208
|
+
key = parts.length >= 2 && parts[0].startsWith('@') ? `${parts[0]}/${parts[1]}` : parts[0];
|
|
209
|
+
if ('@angular-architects/module-federation-runtime' === key.toLowerCase()) key = '@angular-architects/module-federation';
|
|
210
|
+
return versions[key] || null;
|
|
211
|
+
}
|
|
212
|
+
function _findSecondaries(libPath, excludes, shareObject, acc) {
|
|
213
|
+
const files = fs_0.readdirSync(libPath);
|
|
214
|
+
const dirs = files.map((f)=>path_0.join(libPath, f)).filter((f)=>fs_0.lstatSync(f).isDirectory() && 'node_modules' !== f);
|
|
215
|
+
const secondaries = dirs.filter((d)=>fs_0.existsSync(path_0.join(d, 'package.json')));
|
|
216
|
+
for (const s of secondaries){
|
|
217
|
+
const secondaryLibName = s.replace(/\\/g, '/').replace(/^.*node_modules[/]/, '');
|
|
218
|
+
if (!excludes.includes(secondaryLibName)) {
|
|
219
|
+
if (!default_skip_list_isInSkipList(secondaryLibName, PREPARED_DEFAULT_SKIP_LIST)) {
|
|
220
|
+
acc[secondaryLibName] = {
|
|
221
|
+
...shareObject
|
|
222
|
+
};
|
|
223
|
+
_findSecondaries(s, excludes, shareObject, acc);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
function findSecondaries(libPath, excludes, shareObject) {
|
|
229
|
+
const acc = {};
|
|
230
|
+
_findSecondaries(libPath, excludes, shareObject, acc);
|
|
231
|
+
return acc;
|
|
232
|
+
}
|
|
233
|
+
function getSecondaries(includeSecondaries, libPath, key, shareObject) {
|
|
234
|
+
let exclude = [
|
|
235
|
+
...DEFAULT_SECONARIES_SKIP_LIST
|
|
236
|
+
];
|
|
237
|
+
if ('object' == typeof includeSecondaries) {
|
|
238
|
+
if (Array.isArray(includeSecondaries.skip)) exclude = includeSecondaries.skip;
|
|
239
|
+
else if ('string' == typeof includeSecondaries.skip) exclude = [
|
|
240
|
+
includeSecondaries.skip
|
|
241
|
+
];
|
|
242
|
+
}
|
|
243
|
+
if (!fs_0.existsSync(libPath)) return {};
|
|
244
|
+
const configured = readConfiguredSecondaries(key, libPath, exclude, shareObject);
|
|
245
|
+
if (configured) return configured;
|
|
246
|
+
return findSecondaries(libPath, exclude, shareObject);
|
|
247
|
+
}
|
|
248
|
+
function readConfiguredSecondaries(parent, libPath, exclude, shareObject) {
|
|
249
|
+
const libPackageJson = path_0.join(libPath, 'package.json');
|
|
250
|
+
if (!fs_0.existsSync(libPackageJson)) return null;
|
|
251
|
+
const packageJson = JSON.parse(fs_0.readFileSync(libPackageJson, 'utf-8'));
|
|
252
|
+
const exports = packageJson['exports'];
|
|
253
|
+
if (!exports) return null;
|
|
254
|
+
const keys = Object.keys(exports).filter((key)=>'.' !== key && './package.json' !== key && !key.endsWith('*') && (exports[key]['default'] || 'string' == typeof exports[key]));
|
|
255
|
+
const result = {};
|
|
256
|
+
for (const key of keys){
|
|
257
|
+
const secondaryName = path_0.join(parent, key).replace(/\\/g, '/');
|
|
258
|
+
if (exclude.includes(secondaryName)) continue;
|
|
259
|
+
if (default_skip_list_isInSkipList(secondaryName, PREPARED_DEFAULT_SKIP_LIST)) continue;
|
|
260
|
+
const entry = getDefaultEntry(exports, key);
|
|
261
|
+
if ('string' != typeof entry) {
|
|
262
|
+
console.log(`No entry point found for ${secondaryName}`);
|
|
263
|
+
continue;
|
|
264
|
+
}
|
|
265
|
+
if (![
|
|
266
|
+
'.css',
|
|
267
|
+
'.scss',
|
|
268
|
+
'.less'
|
|
269
|
+
].some((ext)=>entry.endsWith(ext))) result[secondaryName] = {
|
|
270
|
+
...shareObject
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
return result;
|
|
274
|
+
}
|
|
275
|
+
function getDefaultEntry(exports, key) {
|
|
276
|
+
let entry;
|
|
277
|
+
if ('string' == typeof exports[key]) entry = exports[key];
|
|
278
|
+
else {
|
|
279
|
+
var _exports_key;
|
|
280
|
+
entry = null == (_exports_key = exports[key]) ? void 0 : _exports_key['default'];
|
|
281
|
+
if ('object' == typeof entry) entry = entry['default'];
|
|
282
|
+
}
|
|
283
|
+
return entry;
|
|
284
|
+
}
|
|
285
|
+
function share_utils_shareAll(config, skip = DEFAULT_SKIP_LIST, projectPath = '') {
|
|
286
|
+
projectPath = inferProjectPath(projectPath);
|
|
287
|
+
const versionMaps = getVersionMaps(projectPath, projectPath);
|
|
288
|
+
const shareConfig = {};
|
|
289
|
+
for (const versions of versionMaps){
|
|
290
|
+
const preparedSkipList = prepareSkipList(skip);
|
|
291
|
+
for(const key in versions){
|
|
292
|
+
if (default_skip_list_isInSkipList(key, preparedSkipList)) continue;
|
|
293
|
+
const inferVersion = !config.requiredVersion || 'auto' === config.requiredVersion;
|
|
294
|
+
const requiredVersion = inferVersion ? versions[key] : config.requiredVersion;
|
|
295
|
+
if (!shareConfig[key]) shareConfig[key] = {
|
|
296
|
+
...config,
|
|
297
|
+
requiredVersion
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
return share(share, projectPath);
|
|
302
|
+
}
|
|
303
|
+
function inferProjectPath(projectPath) {
|
|
304
|
+
if (!projectPath) projectPath = path_0.dirname(getConfigContext().packageJson || '');
|
|
305
|
+
if (!projectPath && getConfigContext().workspaceRoot) projectPath = getConfigContext().workspaceRoot || '';
|
|
306
|
+
if (!projectPath) projectPath = process.cwd();
|
|
307
|
+
return projectPath;
|
|
308
|
+
}
|
|
309
|
+
function setInferVersion(infer) {
|
|
310
|
+
share_utils_inferVersion = infer;
|
|
311
|
+
}
|
|
312
|
+
function share(shareObjects, projectPath = '') {
|
|
313
|
+
projectPath = inferProjectPath(projectPath);
|
|
314
|
+
const packagePath = findPackageJson(projectPath);
|
|
315
|
+
const result = {};
|
|
316
|
+
let includeSecondaries;
|
|
317
|
+
for(const key in shareObjects){
|
|
318
|
+
includeSecondaries = false;
|
|
319
|
+
const shareObject = shareObjects[key];
|
|
320
|
+
if ('auto' === shareObject.requiredVersion || share_utils_inferVersion && void 0 === shareObject.requiredVersion) {
|
|
321
|
+
const version = lookupVersion(key, projectPath);
|
|
322
|
+
shareObject.requiredVersion = version;
|
|
323
|
+
shareObject.version = version.replace(/^\D*/, '');
|
|
324
|
+
}
|
|
325
|
+
if (void 0 === shareObject.includeSecondaries) shareObject.includeSecondaries = true;
|
|
326
|
+
if (shareObject.includeSecondaries) {
|
|
327
|
+
includeSecondaries = shareObject.includeSecondaries;
|
|
328
|
+
delete shareObject.includeSecondaries;
|
|
329
|
+
}
|
|
330
|
+
result[key] = shareObject;
|
|
331
|
+
if (includeSecondaries) {
|
|
332
|
+
const libPackageJson = findDepPackageJson(key, path_0.dirname(packagePath));
|
|
333
|
+
if (!libPackageJson) {
|
|
334
|
+
logger_logger.error(`Could not find folder containing dep ${key}`);
|
|
335
|
+
continue;
|
|
336
|
+
}
|
|
337
|
+
const libPath = path_0.dirname(libPackageJson);
|
|
338
|
+
const secondaries = getSecondaries(includeSecondaries, libPath, key, shareObject);
|
|
339
|
+
if (secondaries) addSecondaries(secondaries, result);
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
return result;
|
|
343
|
+
}
|
|
344
|
+
function addSecondaries(secondaries, result) {
|
|
345
|
+
Object.assign(result, secondaries);
|
|
346
|
+
}
|
|
347
|
+
function withFederation(config) {
|
|
348
|
+
const skip = prepareSkipList(config.skip ?? []);
|
|
349
|
+
return {
|
|
350
|
+
name: config.name ?? '',
|
|
351
|
+
filename: config.filename ?? 'remoteEntry',
|
|
352
|
+
exposes: config.exposes ?? {},
|
|
353
|
+
remotes: config.remotes ?? {},
|
|
354
|
+
shared: normalizeShared(config, skip)
|
|
355
|
+
};
|
|
356
|
+
}
|
|
357
|
+
function normalizeShared(config, skip) {
|
|
358
|
+
let result = {};
|
|
359
|
+
const shared = config.shared;
|
|
360
|
+
result = shared ? Object.keys(shared).reduce((acc, cur)=>({
|
|
361
|
+
...acc,
|
|
362
|
+
[cur]: {
|
|
363
|
+
requiredVersion: shared[cur].requiredVersion ?? 'auto',
|
|
364
|
+
singleton: shared[cur].singleton ?? false,
|
|
365
|
+
strictVersion: shared[cur].strictVersion ?? false,
|
|
366
|
+
version: shared[cur].version,
|
|
367
|
+
includeSecondaries: shared[cur].includeSecondaries
|
|
368
|
+
}
|
|
369
|
+
}), {}) : share_utils_shareAll({
|
|
370
|
+
singleton: true,
|
|
371
|
+
strictVersion: true,
|
|
372
|
+
requiredVersion: 'auto'
|
|
373
|
+
});
|
|
374
|
+
result = Object.keys(result).filter((key)=>!default_skip_list_isInSkipList(key, skip)).reduce((acc, cur)=>({
|
|
375
|
+
...acc,
|
|
376
|
+
[cur]: result[cur]
|
|
377
|
+
}), {});
|
|
378
|
+
return result;
|
|
379
|
+
}
|
|
380
|
+
export { DEFAULT_SECONARIES_SKIP_LIST, _findSecondaries, addSecondaries, findPackageJson, share_utils_findRootTsConfigJson as findRootTsConfigJson, findSecondaries, getDefaultEntry, getExternals, getSecondaries, loadFederationConfig, logger_logger as logger, lookupVersion, lookupVersionInMap, readConfiguredSecondaries, setInferVersion, setLogLevel, share, share_utils_shareAll as shareAll, withFederation };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
1
|
+
declare const _default: {};
|
|
2
|
+
export default _default;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
default: ()=>__WEBPACK_DEFAULT_EXPORT__
|
|
28
|
+
});
|
|
29
|
+
const __WEBPACK_DEFAULT_EXPORT__ = {};
|
|
30
|
+
exports["default"] = __webpack_exports__["default"];
|
|
31
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
32
|
+
"default"
|
|
33
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
34
|
+
Object.defineProperty(exports, '__esModule', {
|
|
35
|
+
value: true
|
|
36
|
+
});
|
package/dist/index.mjs
ADDED