@module-federation/esbuild 0.0.0-chore-bump-node-22-20260710161714
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/LICENSE +21 -0
- package/README.md +113 -0
- package/dist/adapters/lib/collect-exports.d.ts +3 -0
- package/dist/adapters/lib/collect-exports.js +153 -0
- package/dist/adapters/lib/collect-exports.mjs +80 -0
- package/dist/adapters/lib/commonjs.d.ts +101 -0
- package/dist/adapters/lib/commonjs.js +258 -0
- package/dist/adapters/lib/commonjs.mjs +182 -0
- package/dist/adapters/lib/containerPlugin.d.ts +6 -0
- package/dist/adapters/lib/containerPlugin.js +233 -0
- package/dist/adapters/lib/containerPlugin.mjs +179 -0
- package/dist/adapters/lib/containerReference.d.ts +6 -0
- package/dist/adapters/lib/containerReference.js +257 -0
- package/dist/adapters/lib/containerReference.mjs +188 -0
- package/dist/adapters/lib/lexer.d.ts +9 -0
- package/dist/adapters/lib/lexer.js +187 -0
- package/dist/adapters/lib/lexer.mjs +136 -0
- package/dist/adapters/lib/linkRemotesPlugin.d.ts +6 -0
- package/dist/adapters/lib/linkRemotesPlugin.js +117 -0
- package/dist/adapters/lib/linkRemotesPlugin.mjs +48 -0
- package/dist/adapters/lib/manifest.d.ts +2 -0
- package/dist/adapters/lib/manifest.js +227 -0
- package/dist/adapters/lib/manifest.mjs +159 -0
- package/dist/adapters/lib/plugin.d.ts +8 -0
- package/dist/adapters/lib/plugin.js +340 -0
- package/dist/adapters/lib/plugin.mjs +247 -0
- package/dist/adapters/lib/react-replacements.d.ts +9 -0
- package/dist/adapters/lib/react-replacements.js +86 -0
- package/dist/adapters/lib/react-replacements.mjs +34 -0
- package/dist/adapters/lib/transform.d.ts +8 -0
- package/dist/adapters/lib/transform.js +171 -0
- package/dist/adapters/lib/transform.mjs +116 -0
- package/dist/adapters/lib/utils.d.ts +3 -0
- package/dist/adapters/lib/utils.js +87 -0
- package/dist/adapters/lib/utils.mjs +31 -0
- package/dist/build.d.ts +5 -0
- package/dist/build.js +140 -0
- package/dist/build.mjs +12 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +55 -0
- package/dist/index.mjs +3 -0
- package/dist/lib/config/configuration-context.d.ts +7 -0
- package/dist/lib/config/configuration-context.js +73 -0
- package/dist/lib/config/configuration-context.mjs +18 -0
- package/dist/lib/config/federation-config.d.ts +30 -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.d.ts +29 -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.d.ts +23 -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.d.ts +4 -0
- package/dist/lib/core/build-adapter.js +72 -0
- package/dist/lib/core/build-adapter.mjs +16 -0
- package/dist/lib/core/createContainerTemplate.d.ts +1 -0
- package/dist/lib/core/createContainerTemplate.js +235 -0
- package/dist/lib/core/createContainerTemplate.mjs +183 -0
- package/dist/lib/core/default-skip-list.d.ts +12 -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.d.ts +10 -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.d.ts +2 -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.d.ts +6 -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.d.ts +9 -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.d.ts +11 -0
- package/dist/lib/utils/logger.js +113 -0
- package/dist/lib/utils/logger.mjs +44 -0
- package/dist/lib/utils/mapped-paths.d.ts +10 -0
- package/dist/lib/utils/mapped-paths.js +95 -0
- package/dist/lib/utils/mapped-paths.mjs +40 -0
- package/dist/lib/utils/normalize.d.ts +1 -0
- package/dist/lib/utils/normalize.js +66 -0
- package/dist/lib/utils/normalize.mjs +15 -0
- package/dist/lib/utils/package-info.d.ts +18 -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 +96 -0
- package/dist/plugin.mjs +4 -0
- package/dist/resolve/esm-resolver.mjs +19 -0
- package/dist/resolve/package.json +3 -0
- package/dist/rslib-runtime.mjs +31 -0
- package/package.json +75 -0
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import process from "process";
|
|
4
|
+
import { getConfigContext } from "./configuration-context.mjs";
|
|
5
|
+
import { findDepPackageJson, getVersionMaps } from "../utils/package-info.mjs";
|
|
6
|
+
import { logger } from "../utils/logger.mjs";
|
|
7
|
+
import { DEFAULT_SKIP_LIST, PREPARED_DEFAULT_SKIP_LIST, isInSkipList, prepareSkipList } from "../core/default-skip-list.mjs";
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
let share_utils_inferVersion = false;
|
|
24
|
+
const DEFAULT_SECONARIES_SKIP_LIST = [
|
|
25
|
+
'@angular/router/upgrade',
|
|
26
|
+
'@angular/common/upgrade'
|
|
27
|
+
];
|
|
28
|
+
function findRootTsConfigJson() {
|
|
29
|
+
const packageJson = findPackageJson(process.cwd());
|
|
30
|
+
const projectRoot = path.dirname(packageJson);
|
|
31
|
+
const tsConfigBaseJson = path.join(projectRoot, 'tsconfig.base.json');
|
|
32
|
+
const tsConfigJson = path.join(projectRoot, 'tsconfig.json');
|
|
33
|
+
if (fs.existsSync(tsConfigBaseJson)) {
|
|
34
|
+
return tsConfigBaseJson;
|
|
35
|
+
} else if (fs.existsSync(tsConfigJson)) {
|
|
36
|
+
return tsConfigJson;
|
|
37
|
+
}
|
|
38
|
+
throw new Error('Neither a tsconfig.json nor a tsconfig.base.json was found');
|
|
39
|
+
}
|
|
40
|
+
function findPackageJson(folder) {
|
|
41
|
+
while(!fs.existsSync(path.join(folder, 'package.json')) && path.dirname(folder) !== folder){
|
|
42
|
+
folder = path.dirname(folder);
|
|
43
|
+
}
|
|
44
|
+
const filePath = path.join(folder, 'package.json');
|
|
45
|
+
if (fs.existsSync(filePath)) {
|
|
46
|
+
return filePath;
|
|
47
|
+
}
|
|
48
|
+
throw new Error(`No package.json found. Searched the following folder and all parents: ${folder}`);
|
|
49
|
+
}
|
|
50
|
+
function lookupVersion(key, workspaceRoot) {
|
|
51
|
+
const versionMaps = getVersionMaps(workspaceRoot, workspaceRoot);
|
|
52
|
+
for (const versionMap of versionMaps){
|
|
53
|
+
const version = lookupVersionInMap(key, versionMap);
|
|
54
|
+
if (version) {
|
|
55
|
+
return version;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
throw new Error(`Shared Dependency ${key} has requiredVersion:'auto'. However, this dependency is not found in your package.json`);
|
|
59
|
+
}
|
|
60
|
+
function lookupVersionInMap(key, versions) {
|
|
61
|
+
const parts = key.split('/');
|
|
62
|
+
if (parts.length >= 2 && parts[0].startsWith('@')) {
|
|
63
|
+
key = `${parts[0]}/${parts[1]}`;
|
|
64
|
+
} else {
|
|
65
|
+
key = parts[0];
|
|
66
|
+
}
|
|
67
|
+
if (key.toLowerCase() === '@angular-architects/module-federation-runtime') {
|
|
68
|
+
key = '@angular-architects/module-federation';
|
|
69
|
+
}
|
|
70
|
+
return versions[key] || null;
|
|
71
|
+
}
|
|
72
|
+
function _findSecondaries(libPath, excludes, shareObject, acc) {
|
|
73
|
+
const files = fs.readdirSync(libPath);
|
|
74
|
+
const dirs = files.map((f)=>path.join(libPath, f)).filter((f)=>fs.lstatSync(f).isDirectory() && f !== 'node_modules');
|
|
75
|
+
const secondaries = dirs.filter((d)=>fs.existsSync(path.join(d, 'package.json')));
|
|
76
|
+
for (const s of secondaries){
|
|
77
|
+
const secondaryLibName = s.replace(/\\/g, '/').replace(/^.*node_modules[/]/, '');
|
|
78
|
+
if (excludes.includes(secondaryLibName)) {
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
if (isInSkipList(secondaryLibName, PREPARED_DEFAULT_SKIP_LIST)) {
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
acc[secondaryLibName] = {
|
|
85
|
+
...shareObject
|
|
86
|
+
};
|
|
87
|
+
_findSecondaries(s, excludes, shareObject, acc);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
function findSecondaries(libPath, excludes, shareObject) {
|
|
91
|
+
const acc = {};
|
|
92
|
+
_findSecondaries(libPath, excludes, shareObject, acc);
|
|
93
|
+
return acc;
|
|
94
|
+
}
|
|
95
|
+
function getSecondaries(includeSecondaries, libPath, key, shareObject) {
|
|
96
|
+
let exclude = [
|
|
97
|
+
...DEFAULT_SECONARIES_SKIP_LIST
|
|
98
|
+
];
|
|
99
|
+
if (typeof includeSecondaries === 'object') {
|
|
100
|
+
if (Array.isArray(includeSecondaries.skip)) {
|
|
101
|
+
exclude = includeSecondaries.skip;
|
|
102
|
+
} else if (typeof includeSecondaries.skip === 'string') {
|
|
103
|
+
exclude = [
|
|
104
|
+
includeSecondaries.skip
|
|
105
|
+
];
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
if (!fs.existsSync(libPath)) {
|
|
109
|
+
return {};
|
|
110
|
+
}
|
|
111
|
+
const configured = readConfiguredSecondaries(key, libPath, exclude, shareObject);
|
|
112
|
+
if (configured) {
|
|
113
|
+
return configured;
|
|
114
|
+
}
|
|
115
|
+
// Fallback: Search folders
|
|
116
|
+
return findSecondaries(libPath, exclude, shareObject);
|
|
117
|
+
}
|
|
118
|
+
function readConfiguredSecondaries(parent, libPath, exclude, shareObject) {
|
|
119
|
+
const libPackageJson = path.join(libPath, 'package.json');
|
|
120
|
+
if (!fs.existsSync(libPackageJson)) {
|
|
121
|
+
return null;
|
|
122
|
+
}
|
|
123
|
+
const packageJson = JSON.parse(fs.readFileSync(libPackageJson, 'utf-8'));
|
|
124
|
+
const exports = packageJson['exports'];
|
|
125
|
+
if (!exports) {
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
128
|
+
const keys = Object.keys(exports).filter((key)=>key !== '.' && key !== './package.json' && !key.endsWith('*') && (exports[key]['default'] || typeof exports[key] === 'string'));
|
|
129
|
+
const result = {};
|
|
130
|
+
for (const key of keys){
|
|
131
|
+
const secondaryName = path.join(parent, key).replace(/\\/g, '/');
|
|
132
|
+
if (exclude.includes(secondaryName)) {
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
135
|
+
if (isInSkipList(secondaryName, PREPARED_DEFAULT_SKIP_LIST)) {
|
|
136
|
+
continue;
|
|
137
|
+
}
|
|
138
|
+
const entry = getDefaultEntry(exports, key);
|
|
139
|
+
if (typeof entry !== 'string') {
|
|
140
|
+
console.log(`No entry point found for ${secondaryName}`);
|
|
141
|
+
continue;
|
|
142
|
+
}
|
|
143
|
+
if ([
|
|
144
|
+
'.css',
|
|
145
|
+
'.scss',
|
|
146
|
+
'.less'
|
|
147
|
+
].some((ext)=>entry.endsWith(ext))) {
|
|
148
|
+
continue;
|
|
149
|
+
}
|
|
150
|
+
result[secondaryName] = {
|
|
151
|
+
...shareObject
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
return result;
|
|
155
|
+
}
|
|
156
|
+
function getDefaultEntry(exports, key) {
|
|
157
|
+
let entry;
|
|
158
|
+
if (typeof exports[key] === 'string') {
|
|
159
|
+
entry = exports[key];
|
|
160
|
+
} else {
|
|
161
|
+
entry = exports[key]?.['default'];
|
|
162
|
+
if (typeof entry === 'object') {
|
|
163
|
+
entry = entry['default'];
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
return entry;
|
|
167
|
+
}
|
|
168
|
+
function shareAll(config, skip = DEFAULT_SKIP_LIST, projectPath = '') {
|
|
169
|
+
projectPath = inferProjectPath(projectPath);
|
|
170
|
+
const versionMaps = getVersionMaps(projectPath, projectPath);
|
|
171
|
+
const shareConfig = {};
|
|
172
|
+
for (const versions of versionMaps){
|
|
173
|
+
const preparedSkipList = prepareSkipList(skip);
|
|
174
|
+
for(const key in versions){
|
|
175
|
+
if (isInSkipList(key, preparedSkipList)) {
|
|
176
|
+
continue;
|
|
177
|
+
}
|
|
178
|
+
const inferVersion = !config.requiredVersion || config.requiredVersion === 'auto';
|
|
179
|
+
const requiredVersion = inferVersion ? versions[key] : config.requiredVersion;
|
|
180
|
+
if (!shareConfig[key]) {
|
|
181
|
+
shareConfig[key] = {
|
|
182
|
+
...config,
|
|
183
|
+
requiredVersion
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
return share(share, projectPath);
|
|
189
|
+
}
|
|
190
|
+
function inferProjectPath(projectPath) {
|
|
191
|
+
if (!projectPath) {
|
|
192
|
+
projectPath = path.dirname(getConfigContext().packageJson || '');
|
|
193
|
+
}
|
|
194
|
+
if (!projectPath && getConfigContext().workspaceRoot) {
|
|
195
|
+
projectPath = getConfigContext().workspaceRoot || '';
|
|
196
|
+
}
|
|
197
|
+
if (!projectPath) {
|
|
198
|
+
projectPath = process.cwd();
|
|
199
|
+
}
|
|
200
|
+
return projectPath;
|
|
201
|
+
}
|
|
202
|
+
function setInferVersion(infer) {
|
|
203
|
+
share_utils_inferVersion = infer;
|
|
204
|
+
}
|
|
205
|
+
function share(shareObjects, projectPath = '') {
|
|
206
|
+
projectPath = inferProjectPath(projectPath);
|
|
207
|
+
const packagePath = findPackageJson(projectPath);
|
|
208
|
+
const result = {};
|
|
209
|
+
let includeSecondaries;
|
|
210
|
+
for(const key in shareObjects){
|
|
211
|
+
includeSecondaries = false;
|
|
212
|
+
const shareObject = shareObjects[key];
|
|
213
|
+
if (shareObject.requiredVersion === 'auto' || share_utils_inferVersion && typeof shareObject.requiredVersion === 'undefined') {
|
|
214
|
+
const version = lookupVersion(key, projectPath);
|
|
215
|
+
shareObject.requiredVersion = version;
|
|
216
|
+
shareObject.version = version.replace(/^\D*/, '');
|
|
217
|
+
}
|
|
218
|
+
if (typeof shareObject.includeSecondaries === 'undefined') {
|
|
219
|
+
shareObject.includeSecondaries = true;
|
|
220
|
+
}
|
|
221
|
+
if (shareObject.includeSecondaries) {
|
|
222
|
+
includeSecondaries = shareObject.includeSecondaries;
|
|
223
|
+
delete shareObject.includeSecondaries;
|
|
224
|
+
}
|
|
225
|
+
result[key] = shareObject;
|
|
226
|
+
if (includeSecondaries) {
|
|
227
|
+
const libPackageJson = findDepPackageJson(key, path.dirname(packagePath));
|
|
228
|
+
if (!libPackageJson) {
|
|
229
|
+
logger.error(`Could not find folder containing dep ${key}`);
|
|
230
|
+
continue;
|
|
231
|
+
}
|
|
232
|
+
const libPath = path.dirname(libPackageJson);
|
|
233
|
+
const secondaries = getSecondaries(includeSecondaries, libPath, key, shareObject);
|
|
234
|
+
if (secondaries) {
|
|
235
|
+
addSecondaries(secondaries, result);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
return result;
|
|
240
|
+
}
|
|
241
|
+
function addSecondaries(secondaries, result) {
|
|
242
|
+
Object.assign(result, secondaries);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
export { DEFAULT_SECONARIES_SKIP_LIST, _findSecondaries, addSecondaries, findPackageJson, findRootTsConfigJson, findSecondaries, getDefaultEntry, getSecondaries, lookupVersion, lookupVersionInMap, readConfiguredSecondaries, setInferVersion, share, shareAll };
|
|
@@ -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,120 @@
|
|
|
1
|
+
"use strict";
|
|
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;
|
|
7
|
+
})();
|
|
8
|
+
;
|
|
9
|
+
// The require scope
|
|
10
|
+
var __webpack_require__ = {};
|
|
11
|
+
|
|
12
|
+
// webpack/runtime/define_property_getters
|
|
13
|
+
(() => {
|
|
14
|
+
__webpack_require__.d = (exports, getters, values) => {
|
|
15
|
+
var define = (defs, kind) => {
|
|
16
|
+
for(var key in defs) {
|
|
17
|
+
if(__webpack_require__.o(defs, key) && !__webpack_require__.o(exports, key)) {
|
|
18
|
+
Object.defineProperty(exports, key, { enumerable: true, [kind]: defs[key] });
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
define(getters, "get");
|
|
23
|
+
define(values, "value");
|
|
24
|
+
};
|
|
25
|
+
})();
|
|
26
|
+
// webpack/runtime/has_own_property
|
|
27
|
+
(() => {
|
|
28
|
+
__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
29
|
+
})();
|
|
30
|
+
// webpack/runtime/make_namespace_object
|
|
31
|
+
(() => {
|
|
32
|
+
// define __esModule on exports
|
|
33
|
+
__webpack_require__.r = (exports) => {
|
|
34
|
+
if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
35
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
36
|
+
}
|
|
37
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
38
|
+
};
|
|
39
|
+
})();
|
|
40
|
+
var __webpack_exports__ = {};
|
|
41
|
+
// ESM COMPAT FLAG
|
|
42
|
+
__webpack_require__.r(__webpack_exports__);
|
|
43
|
+
|
|
44
|
+
// EXPORTS
|
|
45
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
46
|
+
withFederation: () => (/* binding */ withFederation)
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
;// CONCATENATED MODULE: external "../core/default-skip-list.js"
|
|
50
|
+
const default_skip_list_js_namespaceObject = require("../core/default-skip-list.js");
|
|
51
|
+
;// CONCATENATED MODULE: external "./share-utils.js"
|
|
52
|
+
const external_share_utils_js_namespaceObject = require("./share-utils.js");
|
|
53
|
+
;// CONCATENATED MODULE: external "../utils/mapped-paths.js"
|
|
54
|
+
const mapped_paths_js_namespaceObject = require("../utils/mapped-paths.js");
|
|
55
|
+
;// CONCATENATED MODULE: external "../utils/logger.js"
|
|
56
|
+
const logger_js_namespaceObject = require("../utils/logger.js");
|
|
57
|
+
;// CONCATENATED MODULE: ./src/lib/config/with-native-federation.ts
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
function withFederation(config) {
|
|
64
|
+
const skip = (0,default_skip_list_js_namespaceObject.prepareSkipList)(config.skip ?? []);
|
|
65
|
+
return {
|
|
66
|
+
name: config.name ?? '',
|
|
67
|
+
filename: config.filename ?? 'remoteEntry',
|
|
68
|
+
exposes: config.exposes ?? {},
|
|
69
|
+
remotes: config.remotes ?? {},
|
|
70
|
+
shared: normalizeShared(config, skip)
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
function normalizeShared(config, skip) {
|
|
74
|
+
let result = {};
|
|
75
|
+
const shared = config.shared;
|
|
76
|
+
if (!shared) {
|
|
77
|
+
result = (0,external_share_utils_js_namespaceObject.shareAll)({
|
|
78
|
+
singleton: true,
|
|
79
|
+
strictVersion: true,
|
|
80
|
+
requiredVersion: 'auto'
|
|
81
|
+
});
|
|
82
|
+
} else {
|
|
83
|
+
result = Object.keys(shared).reduce((acc, cur)=>{
|
|
84
|
+
return {
|
|
85
|
+
...acc,
|
|
86
|
+
[cur]: {
|
|
87
|
+
requiredVersion: shared[cur].requiredVersion ?? 'auto',
|
|
88
|
+
singleton: shared[cur].singleton ?? false,
|
|
89
|
+
strictVersion: shared[cur].strictVersion ?? false,
|
|
90
|
+
version: shared[cur].version,
|
|
91
|
+
includeSecondaries: shared[cur].includeSecondaries
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
}, {});
|
|
95
|
+
}
|
|
96
|
+
result = Object.keys(result).filter((key)=>!(0,default_skip_list_js_namespaceObject.isInSkipList)(key, skip)).reduce((acc, cur)=>({
|
|
97
|
+
...acc,
|
|
98
|
+
[cur]: result[cur]
|
|
99
|
+
}), {});
|
|
100
|
+
return result;
|
|
101
|
+
}
|
|
102
|
+
function normalizeSharedMappings(config, skip) {
|
|
103
|
+
const rootTsConfigPath = findRootTsConfigJson();
|
|
104
|
+
const paths = getMappedPaths({
|
|
105
|
+
rootTsConfigPath
|
|
106
|
+
});
|
|
107
|
+
const result = paths.filter((p)=>!isInSkipList(p.key, skip) && !p.key.includes('*'));
|
|
108
|
+
if (paths.find((p)=>p.key.includes('*'))) {
|
|
109
|
+
logger.warn('Sharing mapped paths with wildcards (*) not supported');
|
|
110
|
+
}
|
|
111
|
+
return result;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
exports.withFederation = __webpack_exports__.withFederation;
|
|
115
|
+
for(var __rspack_i in __webpack_exports__) {
|
|
116
|
+
if(["withFederation"].indexOf(__rspack_i) === -1) {
|
|
117
|
+
exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { isInSkipList as default_skip_list_mjs_isInSkipList, prepareSkipList } from "../core/default-skip-list.mjs";
|
|
2
|
+
import { shareAll } from "./share-utils.mjs";
|
|
3
|
+
import "../utils/mapped-paths.mjs";
|
|
4
|
+
import "../utils/logger.mjs";
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
function withFederation(config) {
|
|
16
|
+
const skip = prepareSkipList(config.skip ?? []);
|
|
17
|
+
return {
|
|
18
|
+
name: config.name ?? '',
|
|
19
|
+
filename: config.filename ?? 'remoteEntry',
|
|
20
|
+
exposes: config.exposes ?? {},
|
|
21
|
+
remotes: config.remotes ?? {},
|
|
22
|
+
shared: normalizeShared(config, skip)
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function normalizeShared(config, skip) {
|
|
26
|
+
let result = {};
|
|
27
|
+
const shared = config.shared;
|
|
28
|
+
if (!shared) {
|
|
29
|
+
result = shareAll({
|
|
30
|
+
singleton: true,
|
|
31
|
+
strictVersion: true,
|
|
32
|
+
requiredVersion: 'auto'
|
|
33
|
+
});
|
|
34
|
+
} else {
|
|
35
|
+
result = Object.keys(shared).reduce((acc, cur)=>{
|
|
36
|
+
return {
|
|
37
|
+
...acc,
|
|
38
|
+
[cur]: {
|
|
39
|
+
requiredVersion: shared[cur].requiredVersion ?? 'auto',
|
|
40
|
+
singleton: shared[cur].singleton ?? false,
|
|
41
|
+
strictVersion: shared[cur].strictVersion ?? false,
|
|
42
|
+
version: shared[cur].version,
|
|
43
|
+
includeSecondaries: shared[cur].includeSecondaries
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
}, {});
|
|
47
|
+
}
|
|
48
|
+
result = Object.keys(result).filter((key)=>!default_skip_list_mjs_isInSkipList(key, skip)).reduce((acc, cur)=>({
|
|
49
|
+
...acc,
|
|
50
|
+
[cur]: result[cur]
|
|
51
|
+
}), {});
|
|
52
|
+
return result;
|
|
53
|
+
}
|
|
54
|
+
function normalizeSharedMappings(config, skip) {
|
|
55
|
+
const rootTsConfigPath = findRootTsConfigJson();
|
|
56
|
+
const paths = getMappedPaths({
|
|
57
|
+
rootTsConfigPath
|
|
58
|
+
});
|
|
59
|
+
const result = paths.filter((p)=>!isInSkipList(p.key, skip) && !p.key.includes('*'));
|
|
60
|
+
if (paths.find((p)=>p.key.includes('*'))) {
|
|
61
|
+
logger.warn('Sharing mapped paths with wildcards (*) not supported');
|
|
62
|
+
}
|
|
63
|
+
return result;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export { withFederation };
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
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;
|
|
7
|
+
})();
|
|
8
|
+
;
|
|
9
|
+
// The require scope
|
|
10
|
+
var __webpack_require__ = {};
|
|
11
|
+
|
|
12
|
+
// webpack/runtime/define_property_getters
|
|
13
|
+
(() => {
|
|
14
|
+
__webpack_require__.d = (exports, getters, values) => {
|
|
15
|
+
var define = (defs, kind) => {
|
|
16
|
+
for(var key in defs) {
|
|
17
|
+
if(__webpack_require__.o(defs, key) && !__webpack_require__.o(exports, key)) {
|
|
18
|
+
Object.defineProperty(exports, key, { enumerable: true, [kind]: defs[key] });
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
define(getters, "get");
|
|
23
|
+
define(values, "value");
|
|
24
|
+
};
|
|
25
|
+
})();
|
|
26
|
+
// webpack/runtime/has_own_property
|
|
27
|
+
(() => {
|
|
28
|
+
__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
29
|
+
})();
|
|
30
|
+
// webpack/runtime/make_namespace_object
|
|
31
|
+
(() => {
|
|
32
|
+
// define __esModule on exports
|
|
33
|
+
__webpack_require__.r = (exports) => {
|
|
34
|
+
if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
35
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
36
|
+
}
|
|
37
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
38
|
+
};
|
|
39
|
+
})();
|
|
40
|
+
var __webpack_exports__ = {};
|
|
41
|
+
// ESM COMPAT FLAG
|
|
42
|
+
__webpack_require__.r(__webpack_exports__);
|
|
43
|
+
|
|
44
|
+
// EXPORTS
|
|
45
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
46
|
+
getBuildAdapter: () => (/* binding */ getBuildAdapter),
|
|
47
|
+
setBuildAdapter: () => (/* binding */ setBuildAdapter)
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
;// CONCATENATED MODULE: external "../utils/logger.js"
|
|
51
|
+
const logger_js_namespaceObject = require("../utils/logger.js");
|
|
52
|
+
;// CONCATENATED MODULE: ./src/lib/core/build-adapter.ts
|
|
53
|
+
|
|
54
|
+
let _buildAdapter = async ()=>{
|
|
55
|
+
logger_js_namespaceObject.logger.error('Please set a BuildAdapter!');
|
|
56
|
+
return [];
|
|
57
|
+
};
|
|
58
|
+
function setBuildAdapter(buildAdapter) {
|
|
59
|
+
_buildAdapter = buildAdapter;
|
|
60
|
+
}
|
|
61
|
+
function getBuildAdapter() {
|
|
62
|
+
return _buildAdapter;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
exports.getBuildAdapter = __webpack_exports__.getBuildAdapter;
|
|
66
|
+
exports.setBuildAdapter = __webpack_exports__.setBuildAdapter;
|
|
67
|
+
for(var __rspack_i in __webpack_exports__) {
|
|
68
|
+
if(["getBuildAdapter","setBuildAdapter"].indexOf(__rspack_i) === -1) {
|
|
69
|
+
exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { logger } from "../utils/logger.mjs";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
let _buildAdapter = async ()=>{
|
|
6
|
+
logger.error('Please set a BuildAdapter!');
|
|
7
|
+
return [];
|
|
8
|
+
};
|
|
9
|
+
function setBuildAdapter(buildAdapter) {
|
|
10
|
+
_buildAdapter = buildAdapter;
|
|
11
|
+
}
|
|
12
|
+
function getBuildAdapter() {
|
|
13
|
+
return _buildAdapter;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export { getBuildAdapter, setBuildAdapter };
|
|
@@ -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}";
|