@module-federation/esbuild 0.0.0-docs-remove-invalid-lark-link-20251205062649

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 (39) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +113 -0
  3. package/dist/adapters/lib/collect-exports.d.ts +3 -0
  4. package/dist/adapters/lib/commonjs.d.ts +101 -0
  5. package/dist/adapters/lib/containerPlugin.d.ts +6 -0
  6. package/dist/adapters/lib/containerReference.d.ts +6 -0
  7. package/dist/adapters/lib/lexer.d.ts +9 -0
  8. package/dist/adapters/lib/linkRemotesPlugin.d.ts +6 -0
  9. package/dist/adapters/lib/manifest.d.ts +2 -0
  10. package/dist/adapters/lib/plugin.d.ts +8 -0
  11. package/dist/adapters/lib/react-replacements.d.ts +9 -0
  12. package/dist/adapters/lib/transform.d.ts +8 -0
  13. package/dist/adapters/lib/utils.d.ts +3 -0
  14. package/dist/build.d.ts +5 -0
  15. package/dist/build.js +481 -0
  16. package/dist/build.mjs +380 -0
  17. package/dist/index.d.ts +2 -0
  18. package/dist/index.js +36 -0
  19. package/dist/index.mjs +2 -0
  20. package/dist/lib/config/configuration-context.d.ts +7 -0
  21. package/dist/lib/config/federation-config.d.ts +30 -0
  22. package/dist/lib/config/share-utils.d.ts +29 -0
  23. package/dist/lib/config/with-native-federation.d.ts +23 -0
  24. package/dist/lib/core/build-adapter.d.ts +4 -0
  25. package/dist/lib/core/createContainerTemplate.d.ts +1 -0
  26. package/dist/lib/core/default-skip-list.d.ts +12 -0
  27. package/dist/lib/core/federation-options.d.ts +10 -0
  28. package/dist/lib/core/get-externals.d.ts +2 -0
  29. package/dist/lib/core/load-federation-config.d.ts +6 -0
  30. package/dist/lib/core/write-federation-info.d.ts +9 -0
  31. package/dist/lib/utils/logger.d.ts +11 -0
  32. package/dist/lib/utils/mapped-paths.d.ts +10 -0
  33. package/dist/lib/utils/normalize.d.ts +1 -0
  34. package/dist/lib/utils/package-info.d.ts +18 -0
  35. package/dist/plugin.js +1247 -0
  36. package/dist/plugin.mjs +1190 -0
  37. package/dist/resolve/esm-resolver.mjs +26 -0
  38. package/dist/resolve/package.json +3 -0
  39. package/package.json +66 -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 };
@@ -0,0 +1,2 @@
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
@@ -0,0 +1,2 @@
1
+ const src = {};
2
+ export { src as default };
@@ -0,0 +1,7 @@
1
+ export interface ConfigurationContext {
2
+ workspaceRoot?: string;
3
+ packageJson?: string;
4
+ }
5
+ export declare function useWorkspace(workspaceRoot: string): void;
6
+ export declare function usePackageJson(packageJson: string): void;
7
+ export declare function getConfigContext(): ConfigurationContext;
@@ -0,0 +1,30 @@
1
+ import { SkipList } from '../core/default-skip-list';
2
+ export interface SharedConfig {
3
+ singleton?: boolean;
4
+ strictVersion?: boolean;
5
+ requiredVersion?: string;
6
+ version?: string;
7
+ includeSecondaries?: boolean;
8
+ }
9
+ export interface FederationConfig {
10
+ name?: string;
11
+ exposes?: Record<string, string>;
12
+ shared?: Record<string, SharedConfig>;
13
+ sharedMappings?: Array<string>;
14
+ skip?: SkipList;
15
+ }
16
+ export interface NormalizedSharedConfig {
17
+ singleton: boolean;
18
+ strictVersion: boolean;
19
+ requiredVersion: string;
20
+ version?: string;
21
+ eager?: boolean;
22
+ includeSecondaries?: boolean;
23
+ }
24
+ export interface NormalizedFederationConfig {
25
+ name: string;
26
+ filename?: string;
27
+ exposes?: Record<string, string>;
28
+ shared?: Record<string, NormalizedSharedConfig>;
29
+ remotes?: Record<string, string>;
30
+ }
@@ -0,0 +1,29 @@
1
+ import { SharedConfig } from './federation-config';
2
+ import { SkipListEntry } from '../core/default-skip-list';
3
+ type IncludeSecondariesOptions = {
4
+ skip: string | string[];
5
+ } | boolean;
6
+ type CustomSharedConfig = SharedConfig & {
7
+ includeSecondaries?: IncludeSecondariesOptions;
8
+ };
9
+ type ConfigObject = Record<string, CustomSharedConfig>;
10
+ type Config = (string | ConfigObject)[] | ConfigObject;
11
+ export declare const DEFAULT_SECONARIES_SKIP_LIST: string[];
12
+ export declare function findRootTsConfigJson(): string;
13
+ export declare function findPackageJson(folder: string): string;
14
+ export declare function lookupVersion(key: string, workspaceRoot: string): string;
15
+ export declare function lookupVersionInMap(key: string, versions: Record<string, string>): string | null;
16
+ export declare function _findSecondaries(libPath: string, excludes: string[], shareObject: Record<string, any>, acc: Record<string, any>): void;
17
+ export declare function findSecondaries(libPath: string, excludes: string[], shareObject: Record<string, any>): Record<string, any>;
18
+ export declare function getSecondaries(includeSecondaries: boolean | {
19
+ skip?: string | string[];
20
+ }, libPath: string, key: string, shareObject: Record<string, any>): Record<string, any>;
21
+ export declare function readConfiguredSecondaries(parent: string, libPath: string, exclude: string[], shareObject: Record<string, any>): Record<string, any> | null;
22
+ export declare function getDefaultEntry(exports: {
23
+ [key: string]: any;
24
+ }, key: string): string;
25
+ export declare function shareAll(config: CustomSharedConfig, skip?: SkipListEntry[], projectPath?: string): Config;
26
+ export declare function setInferVersion(infer: boolean): void;
27
+ export declare function share(shareObjects: Record<string, any>, projectPath?: string): Record<string, any>;
28
+ export declare function addSecondaries(secondaries: Record<string, any>, result: Record<string, any>): void;
29
+ export {};
@@ -0,0 +1,23 @@
1
+ interface FederationConfig {
2
+ name?: string;
3
+ filename?: string;
4
+ exposes?: Record<string, string>;
5
+ remotes?: Record<string, string>;
6
+ shared?: Record<string, SharedConfig>;
7
+ skip?: string[];
8
+ }
9
+ interface SharedConfig {
10
+ requiredVersion?: string;
11
+ singleton?: boolean;
12
+ strictVersion?: boolean;
13
+ version?: string;
14
+ includeSecondaries?: boolean;
15
+ }
16
+ export declare function withFederation(config: FederationConfig): {
17
+ name: string;
18
+ filename: string;
19
+ exposes: Record<string, string>;
20
+ remotes: Record<string, string>;
21
+ shared: Record<string, SharedConfig>;
22
+ };
23
+ export {};
@@ -0,0 +1,4 @@
1
+ type BuildAdapter = () => Promise<any[]>;
2
+ export declare function setBuildAdapter(buildAdapter: BuildAdapter): void;
3
+ export declare function getBuildAdapter(): BuildAdapter;
4
+ export {};
@@ -0,0 +1 @@
1
+ export declare const createContainerCode = "\nimport bundler_runtime_base from '@module-federation/webpack-bundler-runtime';\n// import instantiatePatch from \"./federation.js\";\n\nconst createContainer = (federationOptions) => {\n // await instantiatePatch(federationOptions, true);\n const {exposes, name, remotes = [], shared, plugins} = federationOptions;\n\n const __webpack_modules__ = {\n \"./node_modules/.federation/entry.1f2288102e035e2ed66b2efaf60ad043.js\": (module, __webpack_exports__, __webpack_require__) => {\n __webpack_require__.r(__webpack_exports__);\n const bundler_runtime = __webpack_require__.n(bundler_runtime_base);\n const prevFederation = __webpack_require__.federation;\n __webpack_require__.federation = {};\n for (const key in bundler_runtime()) {\n __webpack_require__.federation[key] = bundler_runtime()[key];\n }\n for (const key in prevFederation) {\n __webpack_require__.federation[key] = prevFederation[key];\n }\n if (!__webpack_require__.federation.instance) {\n const pluginsToAdd = plugins || [];\n __webpack_require__.federation.initOptions.plugins = __webpack_require__.federation.initOptions.plugins ?\n __webpack_require__.federation.initOptions.plugins.concat(pluginsToAdd) : pluginsToAdd;\n __webpack_require__.federation.instance = __webpack_require__.federation.runtime.init(__webpack_require__.federation.initOptions);\n if (__webpack_require__.federation.attachShareScopeMap) {\n __webpack_require__.federation.attachShareScopeMap(__webpack_require__);\n }\n if (__webpack_require__.federation.installInitialConsumes) {\n __webpack_require__.federation.installInitialConsumes();\n }\n }\n },\n\n \"webpack/container/entry/createContainer\": (module, exports, __webpack_require__) => {\n const moduleMap = {};\n for (const key in exposes) {\n if (Object.prototype.hasOwnProperty.call(exposes, key)) {\n moduleMap[key] = () => Promise.resolve(exposes[key]()).then(m => () => m);\n }\n }\n\n const get = (module, getScope) => {\n __webpack_require__.R = getScope;\n getScope = (\n __webpack_require__.o(moduleMap, module)\n ? moduleMap[module]()\n : Promise.resolve().then(() => {\n throw new Error(\"Module '\" + module + \"' does not exist in container.\");\n })\n );\n __webpack_require__.R = undefined;\n return getScope;\n };\n const init = (shareScope, initScope, remoteEntryInitOptions) => {\n return __webpack_require__.federation.bundlerRuntime.initContainerEntry({\n webpackRequire: __webpack_require__,\n shareScope: shareScope,\n initScope: initScope,\n remoteEntryInitOptions: remoteEntryInitOptions,\n shareScopeKey: \"default\"\n });\n };\n __webpack_require__(\"./node_modules/.federation/entry.1f2288102e035e2ed66b2efaf60ad043.js\");\n\n // This exports getters to disallow modifications\n __webpack_require__.d(exports, {\n get: () => get,\n init: () => init,\n moduleMap: () => moduleMap,\n });\n }\n };\n\n const __webpack_module_cache__ = {};\n\n const __webpack_require__ = (moduleId) => {\n let cachedModule = __webpack_module_cache__[moduleId];\n if (cachedModule !== undefined) {\n return cachedModule.exports;\n }\n let module = __webpack_module_cache__[moduleId] = {\n id: moduleId,\n loaded: false,\n exports: {}\n };\n\n const execOptions = {\n id: moduleId,\n module: module,\n factory: __webpack_modules__[moduleId],\n require: __webpack_require__\n };\n __webpack_require__.i.forEach(handler => {\n handler(execOptions);\n });\n module = execOptions.module;\n execOptions.factory.call(module.exports, module, module.exports, execOptions.require);\n\n module.loaded = true;\n\n return module.exports;\n };\n\n __webpack_require__.m = __webpack_modules__;\n __webpack_require__.c = __webpack_module_cache__;\n __webpack_require__.i = [];\n\n if (!__webpack_require__.federation) {\n __webpack_require__.federation = {\n initOptions: {\n \"name\": name,\n \"remotes\": remotes.map(remote => ({\n \"type\": remote.type,\n \"alias\": remote.alias,\n \"name\": remote.name,\n \"entry\": remote.entry,\n \"shareScope\": remote.shareScope || \"default\"\n }))\n },\n chunkMatcher: () => true,\n rootOutputDir: \"\",\n initialConsumes: undefined,\n bundlerRuntimeOptions: {}\n };\n }\n\n __webpack_require__.n = (module) => {\n const getter = module && module.__esModule ? () => module['default'] : () => module;\n __webpack_require__.d(getter, {a: getter});\n return getter;\n };\n\n __webpack_require__.d = (exports, definition) => {\n for (const key in definition) {\n if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n Object.defineProperty(exports, key, {enumerable: true, get: definition[key]});\n }\n }\n };\n\n __webpack_require__.f = {};\n\n __webpack_require__.g = (() => {\n if (typeof globalThis === 'object') return globalThis;\n try {\n return this || new Function('return this')();\n } catch (e) {\n if (typeof window === 'object') return window;\n }\n })();\n\n __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);\n\n __webpack_require__.r = (exports) => {\n if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n Object.defineProperty(exports, Symbol.toStringTag, {value: 'Module'});\n }\n Object.defineProperty(exports, '__esModule', {value: true});\n };\n\n __webpack_require__.federation.initOptions.shared = shared;\n __webpack_require__.S = {};\n const initPromises = {};\n const initTokens = {};\n __webpack_require__.I = (name, initScope) => {\n return __webpack_require__.federation.bundlerRuntime.I({\n shareScopeName: name,\n webpackRequire: __webpack_require__,\n initPromises: initPromises,\n initTokens: initTokens,\n initScope: initScope,\n });\n };\n\n const __webpack_exports__ = __webpack_require__(\"webpack/container/entry/createContainer\");\n const __webpack_exports__get = __webpack_exports__.get;\n const __webpack_exports__init = __webpack_exports__.init;\n const __webpack_exports__moduleMap = __webpack_exports__.moduleMap;\n return __webpack_exports__;\n}";
@@ -0,0 +1,12 @@
1
+ export type SkipFn = (name: string) => boolean;
2
+ export type SkipListEntry = string | RegExp | SkipFn;
3
+ export type SkipList = SkipListEntry[];
4
+ export type PreparedSkipList = {
5
+ strings: Set<string>;
6
+ functions: SkipFn[];
7
+ regexps: RegExp[];
8
+ };
9
+ export declare const DEFAULT_SKIP_LIST: SkipListEntry[];
10
+ export declare const PREPARED_DEFAULT_SKIP_LIST: PreparedSkipList;
11
+ export declare function prepareSkipList(skipList: SkipListEntry[]): PreparedSkipList;
12
+ export declare function isInSkipList(entry: string, skipList: PreparedSkipList): boolean;
@@ -0,0 +1,10 @@
1
+ export interface FederationOptions {
2
+ workspaceRoot: string;
3
+ outputPath: string;
4
+ federationConfig: string;
5
+ tsConfig?: string;
6
+ verbose?: boolean;
7
+ dev?: boolean;
8
+ watch?: boolean;
9
+ packageJson?: string;
10
+ }
@@ -0,0 +1,2 @@
1
+ import { NormalizedFederationConfig } from '../config/federation-config';
2
+ export declare function getExternals(config: NormalizedFederationConfig): string[];
@@ -0,0 +1,6 @@
1
+ interface FederationOptions {
2
+ workspaceRoot: string;
3
+ federationConfig: string;
4
+ }
5
+ export declare function loadFederationConfig(fedOptions: FederationOptions): Promise<any>;
6
+ export {};
@@ -0,0 +1,9 @@
1
+ interface FederationInfo {
2
+ [key: string]: any;
3
+ }
4
+ interface FedOptions {
5
+ workspaceRoot: string;
6
+ outputPath: string;
7
+ }
8
+ export declare function writeFederationInfo(federationInfo: FederationInfo, fedOptions: FedOptions): void;
9
+ export {};
@@ -0,0 +1,11 @@
1
+ interface Logger {
2
+ error: (msg: string) => void;
3
+ warn: (msg: string) => void;
4
+ notice: (msg: string) => void;
5
+ info: (msg: string) => void;
6
+ verbose: (msg: string) => void;
7
+ debug: (msg: string) => void;
8
+ }
9
+ export declare const logger: Logger;
10
+ export declare const setLogLevel: (level: string) => void;
11
+ export {};
@@ -0,0 +1,10 @@
1
+ export interface MappedPath {
2
+ key: string;
3
+ path: string;
4
+ }
5
+ export interface GetMappedPathsParams {
6
+ rootTsConfigPath: string;
7
+ sharedMappings?: string[];
8
+ rootPath?: string;
9
+ }
10
+ export declare function getMappedPaths({ rootTsConfigPath, sharedMappings, rootPath, }: GetMappedPathsParams): MappedPath[];
@@ -0,0 +1 @@
1
+ export declare function normalize(path: string, trailingSlash?: boolean): string;
@@ -0,0 +1,18 @@
1
+ interface PackageJsonInfo {
2
+ content: any;
3
+ directory: string;
4
+ }
5
+ interface PackageInfo {
6
+ entryPoint: string;
7
+ packageName: string;
8
+ version: string;
9
+ esm: boolean;
10
+ }
11
+ export declare function findPackageJsonFiles(project: string, workspace: string): string[];
12
+ export declare function expandFolders(child: string, parent: string): string[];
13
+ export declare function getPackageInfo(packageName: string, workspaceRoot: string): PackageInfo | null;
14
+ export declare function getVersionMaps(project: string, workspace: string): Record<string, string>[];
15
+ export declare function getPackageJsonFiles(project: string, workspace: string): PackageJsonInfo[];
16
+ export declare function findDepPackageJson(packageName: string, projectRoot: string): string | null;
17
+ export declare function _getPackageInfo(packageName: string, directory: string): PackageInfo | null;
18
+ export {};