@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.
Files changed (62) hide show
  1. package/dist/adapters/lib/collect-exports.js +153 -0
  2. package/dist/adapters/lib/collect-exports.mjs +80 -0
  3. package/dist/adapters/lib/commonjs.js +258 -0
  4. package/dist/adapters/lib/commonjs.mjs +182 -0
  5. package/dist/adapters/lib/containerPlugin.js +233 -0
  6. package/dist/adapters/lib/containerPlugin.mjs +179 -0
  7. package/dist/adapters/lib/containerReference.js +257 -0
  8. package/dist/adapters/lib/containerReference.mjs +188 -0
  9. package/dist/adapters/lib/lexer.js +187 -0
  10. package/dist/adapters/lib/lexer.mjs +136 -0
  11. package/dist/adapters/lib/linkRemotesPlugin.js +117 -0
  12. package/dist/adapters/lib/linkRemotesPlugin.mjs +48 -0
  13. package/dist/adapters/lib/manifest.js +227 -0
  14. package/dist/adapters/lib/manifest.mjs +159 -0
  15. package/dist/adapters/lib/plugin.js +340 -0
  16. package/dist/adapters/lib/plugin.mjs +247 -0
  17. package/dist/adapters/lib/react-replacements.js +86 -0
  18. package/dist/adapters/lib/react-replacements.mjs +34 -0
  19. package/dist/adapters/lib/transform.js +171 -0
  20. package/dist/adapters/lib/transform.mjs +116 -0
  21. package/dist/adapters/lib/utils.js +87 -0
  22. package/dist/adapters/lib/utils.mjs +31 -0
  23. package/dist/build.js +132 -473
  24. package/dist/build.mjs +12 -380
  25. package/dist/index.js +45 -26
  26. package/dist/index.mjs +3 -2
  27. package/dist/lib/config/configuration-context.js +73 -0
  28. package/dist/lib/config/configuration-context.mjs +18 -0
  29. package/dist/lib/config/federation-config.js +29 -0
  30. package/dist/lib/config/federation-config.mjs +3 -0
  31. package/dist/lib/config/share-utils.js +340 -0
  32. package/dist/lib/config/share-utils.mjs +245 -0
  33. package/dist/lib/config/with-native-federation.js +120 -0
  34. package/dist/lib/config/with-native-federation.mjs +66 -0
  35. package/dist/lib/core/build-adapter.js +72 -0
  36. package/dist/lib/core/build-adapter.mjs +16 -0
  37. package/dist/lib/core/createContainerTemplate.js +235 -0
  38. package/dist/lib/core/createContainerTemplate.mjs +183 -0
  39. package/dist/lib/core/default-skip-list.js +103 -0
  40. package/dist/lib/core/default-skip-list.mjs +45 -0
  41. package/dist/lib/core/federation-options.js +29 -0
  42. package/dist/lib/core/federation-options.mjs +3 -0
  43. package/dist/lib/core/get-externals.js +68 -0
  44. package/dist/lib/core/get-externals.mjs +17 -0
  45. package/dist/lib/core/load-federation-config.js +71 -0
  46. package/dist/lib/core/load-federation-config.mjs +16 -0
  47. package/dist/lib/core/write-federation-info.js +67 -0
  48. package/dist/lib/core/write-federation-info.mjs +12 -0
  49. package/dist/lib/utils/logger.js +113 -0
  50. package/dist/lib/utils/logger.mjs +44 -0
  51. package/dist/lib/utils/mapped-paths.js +95 -0
  52. package/dist/lib/utils/mapped-paths.mjs +40 -0
  53. package/dist/lib/utils/normalize.js +66 -0
  54. package/dist/lib/utils/normalize.mjs +15 -0
  55. package/dist/lib/utils/package-info.js +325 -0
  56. package/dist/lib/utils/package-info.mjs +259 -0
  57. package/dist/plugin.d.ts +1 -0
  58. package/dist/plugin.js +82 -1233
  59. package/dist/plugin.mjs +2 -1188
  60. package/dist/resolve/esm-resolver.mjs +15 -22
  61. package/dist/rslib-runtime.mjs +31 -0
  62. package/package.json +20 -11
@@ -0,0 +1,188 @@
1
+ import fs from "fs";
2
+
3
+
4
+
5
+ // Builds the federation host code
6
+ const buildFederationHost = (config)=>{
7
+ const { name, remotes, shared } = config;
8
+ const remoteConfigs = remotes ? JSON.stringify(Object.entries(remotes).map(([remoteAlias, remote])=>({
9
+ name: remoteAlias,
10
+ entry: remote,
11
+ alias: remoteAlias,
12
+ type: 'esm'
13
+ }))) : '[]';
14
+ const sharedConfig = Object.entries(shared ?? {}).reduce((acc, [pkg, config])=>{
15
+ const version = config.requiredVersion?.replace(/^[^0-9]/, '') || '';
16
+ acc += `${JSON.stringify(pkg)}: {
17
+ "package": "${pkg}",
18
+ "version": "${version}",
19
+ "scope": "default",
20
+ "get": async () => await import('federationShare/${pkg}'),
21
+ "shareConfig": {
22
+ "singleton": ${config.singleton},
23
+ "requiredVersion": "${config.requiredVersion}",
24
+ "eager": ${config.eager},
25
+ "strictVersion": ${config.strictVersion}
26
+ }
27
+ },\n`;
28
+ return acc;
29
+ }, '{') + '}';
30
+ return `
31
+ import { init as initFederationHost } from "@module-federation/runtime";
32
+
33
+ const createVirtualRemoteModule = (name, ref, exports) => {
34
+ const genExports = exports.map(e =>
35
+ e === 'default'
36
+ ? 'export default mfLsZJ92.default;'
37
+ : \`export const \${e} = mfLsZJ92[\${JSON.stringify(e)}];\`
38
+ ).join('');
39
+
40
+ const loadRef = \`const mfLsZJ92 = await container.loadRemote(\${JSON.stringify(ref)});\`;
41
+
42
+ return \`
43
+ const container = __FEDERATION__.__INSTANCES__.find(container => container.name === name) || __FEDERATION__.__INSTANCES__[0];
44
+ \${loadRef}
45
+ \${genExports}
46
+ \`;
47
+ };
48
+
49
+ function encodeInlineESM(code) {
50
+ return 'data:text/javascript;charset=utf-8,' + encodeURIComponent(code);
51
+ }
52
+
53
+ const runtimePlugin = () => ({
54
+ name: 'import-maps-plugin',
55
+ async init(args) {
56
+ // Load all remotes and collect their moduleMaps
57
+ const remotesWithModuleMaps = await Promise.all(
58
+ args.options.remotes.map(async (remote) => {
59
+ console.log('remote', remote);
60
+ if (remote.type === 'esm') {
61
+ const remoteModule = await import(remote.entry);
62
+ return { remote, moduleMap: remoteModule.moduleMap };
63
+ }
64
+ return { remote, moduleMap: null };
65
+ })
66
+ );
67
+
68
+ // Build import map entries for all remote modules
69
+ const allImports = {};
70
+ for (const { remote, moduleMap } of remotesWithModuleMaps) {
71
+ if (moduleMap && typeof moduleMap === 'object') {
72
+ for (const expose of Object.keys(moduleMap)) {
73
+ const currentImportMap = importShim.getImportMap().imports;
74
+ // Use remote name + expose path (e.g., "mfe1/component")
75
+ const key = remote.name + expose.replace('.', '');
76
+ if (!currentImportMap[key] && !allImports[key]) {
77
+ const encodedModule = encodeInlineESM(
78
+ createVirtualRemoteModule(remote.name, key, moduleMap[expose].exports)
79
+ );
80
+ allImports[key] = encodedModule;
81
+ }
82
+ }
83
+ }
84
+ }
85
+
86
+ if (Object.keys(allImports).length > 0) {
87
+ await importShim.addImportMap({ imports: allImports });
88
+ }
89
+
90
+ return args;
91
+ }
92
+ });
93
+
94
+ const mfHoZJ92 = initFederationHost({
95
+ name: ${JSON.stringify(name)},
96
+ remotes: ${remoteConfigs},
97
+ shared: ${sharedConfig},
98
+ plugins: [runtimePlugin()],
99
+ });
100
+
101
+ await Promise.all(mfHoZJ92.initializeSharing('default', 'version-first'));
102
+
103
+ // Ensure import maps are registered before any code that uses remotes runs
104
+ const remotesList = ${remoteConfigs};
105
+ const allImports = {};
106
+ for (const remote of remotesList) {
107
+ if (remote.type === 'esm') {
108
+ try {
109
+ const remoteModule = await import(remote.entry);
110
+ const moduleMap = remoteModule.moduleMap;
111
+ if (moduleMap && typeof moduleMap === 'object') {
112
+ for (const expose of Object.keys(moduleMap)) {
113
+ const key = remote.name + expose.replace('.', '');
114
+ if (!allImports[key]) {
115
+ const encodedModule = encodeInlineESM(
116
+ createVirtualRemoteModule(remote.name, key, moduleMap[expose].exports)
117
+ );
118
+ allImports[key] = encodedModule;
119
+ }
120
+ }
121
+ }
122
+ } catch (e) {
123
+ console.error('Failed to load remote:', remote.name, e);
124
+ }
125
+ }
126
+ }
127
+ if (Object.keys(allImports).length > 0) {
128
+ await importShim.addImportMap({ imports: allImports });
129
+ }
130
+
131
+ `;
132
+ };
133
+ const initializeHostPlugin = (config)=>({
134
+ name: 'host-initialization',
135
+ setup (build) {
136
+ build.onResolve({
137
+ filter: /federation-host/
138
+ }, (args)=>({
139
+ path: args.path,
140
+ namespace: 'federation-host',
141
+ pluginData: {
142
+ kind: args.kind,
143
+ resolveDir: args.resolveDir
144
+ }
145
+ }));
146
+ build.onLoad({
147
+ filter: /.*/,
148
+ namespace: 'federation-host'
149
+ }, async (args)=>({
150
+ contents: buildFederationHost(config),
151
+ resolveDir: args.pluginData.resolveDir
152
+ }));
153
+ // Add custom loaders
154
+ const loaders = build.initialOptions.loader || {};
155
+ // Apply custom loaders
156
+ for (const [ext, loader] of Object.entries(loaders)){
157
+ build.onLoad({
158
+ filter: new RegExp(`\\${ext}$`),
159
+ namespace: 'file'
160
+ }, async (args)=>{
161
+ const contents = await fs.promises.readFile(args.path, 'utf8');
162
+ return {
163
+ contents: buildFederationHost(config) + contents,
164
+ loader
165
+ };
166
+ });
167
+ }
168
+ // Fallback loader for files not matched by custom loaders
169
+ const fallbackFilter = new RegExp(Object.keys(loaders).map((ext)=>`\\${ext}$`).join('|'));
170
+ build.onLoad({
171
+ filter: /.*\.(ts|js|mjs)$/,
172
+ namespace: 'file'
173
+ }, //@ts-ignore
174
+ async (args)=>{
175
+ if (!fallbackFilter.test(args.path)) {
176
+ if (!build.initialOptions.entryPoints.some((e)=>args.path.includes(e))) {
177
+ return;
178
+ }
179
+ const contents = await fs.promises.readFile(args.path, 'utf8');
180
+ return {
181
+ contents: 'import "federation-host"; \n ' + contents
182
+ };
183
+ }
184
+ });
185
+ }
186
+ });
187
+
188
+ export { buildFederationHost, initializeHostPlugin };
@@ -0,0 +1,187 @@
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
+ __webpack_require__.r(__webpack_exports__);
42
+ // simplified from acorn (MIT license)
43
+ function isNewLine(code) {
44
+ return code === 10 || code === 13 || code === 0x2028 || code === 0x2029;
45
+ }
46
+ function codePointToString(ch) {
47
+ if (ch <= 0xffff) return String.fromCharCode(ch);
48
+ ch -= 0x10000;
49
+ return String.fromCharCode((ch >> 10) + 0xd800, (ch & 0x03ff) + 0xdc00);
50
+ }
51
+ class Lexer {
52
+ readString(input, pos) {
53
+ if (pos >= input.length) return null;
54
+ this.input = input;
55
+ this.pos = pos;
56
+ const quote = this.input.charCodeAt(pos);
57
+ if (!(quote === 34 || quote === 39)) return null;
58
+ let out = '';
59
+ let chunkStart = ++this.pos;
60
+ //eslint-disable-next-line no-constant-condition
61
+ while(true){
62
+ if (this.pos >= this.input.length) return null;
63
+ const ch = this.input.charCodeAt(this.pos);
64
+ if (ch === quote) break;
65
+ if (ch === 92) {
66
+ out += this.input.slice(chunkStart, this.pos);
67
+ const escaped = this.readEscapedChar();
68
+ if (escaped === null) return null;
69
+ out += escaped;
70
+ chunkStart = this.pos;
71
+ } else {
72
+ if (isNewLine(ch)) return null;
73
+ ++this.pos;
74
+ }
75
+ }
76
+ out += this.input.slice(chunkStart, this.pos++);
77
+ return out;
78
+ }
79
+ readEscapedChar() {
80
+ const ch = this.input.charCodeAt(++this.pos);
81
+ let code;
82
+ ++this.pos;
83
+ switch(ch){
84
+ case 110:
85
+ return '\n';
86
+ case 114:
87
+ return '\r';
88
+ case 120:
89
+ code = this.readHexChar(2);
90
+ if (code === null) return null;
91
+ return String.fromCharCode(code);
92
+ case 117:
93
+ code = this.readCodePoint();
94
+ if (code === null) return null;
95
+ return codePointToString(code);
96
+ case 116:
97
+ return '\t';
98
+ case 98:
99
+ return '\b';
100
+ case 118:
101
+ return '\u000b';
102
+ case 102:
103
+ return '\f';
104
+ //@ts-ignore
105
+ case 13:
106
+ if (this.input.charCodeAt(this.pos) === 10) {
107
+ ++this.pos;
108
+ }
109
+ // fall through
110
+ case 10:
111
+ return '';
112
+ case 56:
113
+ case 57:
114
+ return null;
115
+ default:
116
+ if (ch >= 48 && ch <= 55) {
117
+ const match = this.input.slice(this.pos - 1, this.pos + 2).match(/^[0-7]+/);
118
+ if (match === null) return null;
119
+ let octalStr = match[0];
120
+ let octal = parseInt(octalStr, 8);
121
+ if (octal > 255) {
122
+ octalStr = octalStr.slice(0, -1);
123
+ octal = parseInt(octalStr, 8);
124
+ }
125
+ this.pos += octalStr.length - 1;
126
+ const nextCh = this.input.charCodeAt(this.pos);
127
+ if (octalStr !== '0' || nextCh === 56 || nextCh === 57) return null;
128
+ return String.fromCharCode(octal);
129
+ }
130
+ if (isNewLine(ch)) return '';
131
+ return String.fromCharCode(ch);
132
+ }
133
+ }
134
+ readInt(radix, len) {
135
+ const start = this.pos;
136
+ let total = 0;
137
+ for(let i = 0; i < len; ++i, ++this.pos){
138
+ const code = this.input.charCodeAt(this.pos);
139
+ let val;
140
+ if (code >= 97) {
141
+ val = code - 97 + 10;
142
+ } else if (code >= 65) {
143
+ val = code - 65 + 10;
144
+ } else if (code >= 48 && code <= 57) {
145
+ val = code - 48;
146
+ } else {
147
+ val = Infinity;
148
+ }
149
+ if (val >= radix) break;
150
+ total = total * radix + val;
151
+ }
152
+ if (this.pos === start || len != null && this.pos - start !== len) return null;
153
+ return total;
154
+ }
155
+ readHexChar(len) {
156
+ return this.readInt(16, len);
157
+ }
158
+ readCodePoint() {
159
+ const ch = this.input.charCodeAt(this.pos);
160
+ let code;
161
+ if (ch === 123) {
162
+ ++this.pos;
163
+ code = this.readHexChar(this.input.indexOf('}', this.pos) - this.pos);
164
+ ++this.pos;
165
+ if (code && code > 0x10ffff) return null;
166
+ } else {
167
+ code = this.readHexChar(4);
168
+ }
169
+ return code;
170
+ }
171
+ constructor(){
172
+ this.input = '';
173
+ this.pos = 0;
174
+ }
175
+ }
176
+
177
+ __webpack_require__.d(__webpack_exports__, {
178
+ Lexer: () => (Lexer)
179
+ });
180
+
181
+ exports.Lexer = __webpack_exports__.Lexer;
182
+ for(var __rspack_i in __webpack_exports__) {
183
+ if(["Lexer"].indexOf(__rspack_i) === -1) {
184
+ exports[__rspack_i] = __webpack_exports__[__rspack_i];
185
+ }
186
+ }
187
+ Object.defineProperty(exports, '__esModule', { value: true });
@@ -0,0 +1,136 @@
1
+ // simplified from acorn (MIT license)
2
+ function isNewLine(code) {
3
+ return code === 10 || code === 13 || code === 0x2028 || code === 0x2029;
4
+ }
5
+ function codePointToString(ch) {
6
+ if (ch <= 0xffff) return String.fromCharCode(ch);
7
+ ch -= 0x10000;
8
+ return String.fromCharCode((ch >> 10) + 0xd800, (ch & 0x03ff) + 0xdc00);
9
+ }
10
+ class Lexer {
11
+ readString(input, pos) {
12
+ if (pos >= input.length) return null;
13
+ this.input = input;
14
+ this.pos = pos;
15
+ const quote = this.input.charCodeAt(pos);
16
+ if (!(quote === 34 || quote === 39)) return null;
17
+ let out = '';
18
+ let chunkStart = ++this.pos;
19
+ //eslint-disable-next-line no-constant-condition
20
+ while(true){
21
+ if (this.pos >= this.input.length) return null;
22
+ const ch = this.input.charCodeAt(this.pos);
23
+ if (ch === quote) break;
24
+ if (ch === 92) {
25
+ out += this.input.slice(chunkStart, this.pos);
26
+ const escaped = this.readEscapedChar();
27
+ if (escaped === null) return null;
28
+ out += escaped;
29
+ chunkStart = this.pos;
30
+ } else {
31
+ if (isNewLine(ch)) return null;
32
+ ++this.pos;
33
+ }
34
+ }
35
+ out += this.input.slice(chunkStart, this.pos++);
36
+ return out;
37
+ }
38
+ readEscapedChar() {
39
+ const ch = this.input.charCodeAt(++this.pos);
40
+ let code;
41
+ ++this.pos;
42
+ switch(ch){
43
+ case 110:
44
+ return '\n';
45
+ case 114:
46
+ return '\r';
47
+ case 120:
48
+ code = this.readHexChar(2);
49
+ if (code === null) return null;
50
+ return String.fromCharCode(code);
51
+ case 117:
52
+ code = this.readCodePoint();
53
+ if (code === null) return null;
54
+ return codePointToString(code);
55
+ case 116:
56
+ return '\t';
57
+ case 98:
58
+ return '\b';
59
+ case 118:
60
+ return '\u000b';
61
+ case 102:
62
+ return '\f';
63
+ //@ts-ignore
64
+ case 13:
65
+ if (this.input.charCodeAt(this.pos) === 10) {
66
+ ++this.pos;
67
+ }
68
+ // fall through
69
+ case 10:
70
+ return '';
71
+ case 56:
72
+ case 57:
73
+ return null;
74
+ default:
75
+ if (ch >= 48 && ch <= 55) {
76
+ const match = this.input.slice(this.pos - 1, this.pos + 2).match(/^[0-7]+/);
77
+ if (match === null) return null;
78
+ let octalStr = match[0];
79
+ let octal = parseInt(octalStr, 8);
80
+ if (octal > 255) {
81
+ octalStr = octalStr.slice(0, -1);
82
+ octal = parseInt(octalStr, 8);
83
+ }
84
+ this.pos += octalStr.length - 1;
85
+ const nextCh = this.input.charCodeAt(this.pos);
86
+ if (octalStr !== '0' || nextCh === 56 || nextCh === 57) return null;
87
+ return String.fromCharCode(octal);
88
+ }
89
+ if (isNewLine(ch)) return '';
90
+ return String.fromCharCode(ch);
91
+ }
92
+ }
93
+ readInt(radix, len) {
94
+ const start = this.pos;
95
+ let total = 0;
96
+ for(let i = 0; i < len; ++i, ++this.pos){
97
+ const code = this.input.charCodeAt(this.pos);
98
+ let val;
99
+ if (code >= 97) {
100
+ val = code - 97 + 10;
101
+ } else if (code >= 65) {
102
+ val = code - 65 + 10;
103
+ } else if (code >= 48 && code <= 57) {
104
+ val = code - 48;
105
+ } else {
106
+ val = Infinity;
107
+ }
108
+ if (val >= radix) break;
109
+ total = total * radix + val;
110
+ }
111
+ if (this.pos === start || len != null && this.pos - start !== len) return null;
112
+ return total;
113
+ }
114
+ readHexChar(len) {
115
+ return this.readInt(16, len);
116
+ }
117
+ readCodePoint() {
118
+ const ch = this.input.charCodeAt(this.pos);
119
+ let code;
120
+ if (ch === 123) {
121
+ ++this.pos;
122
+ code = this.readHexChar(this.input.indexOf('}', this.pos) - this.pos);
123
+ ++this.pos;
124
+ if (code && code > 0x10ffff) return null;
125
+ } else {
126
+ code = this.readHexChar(4);
127
+ }
128
+ return code;
129
+ }
130
+ constructor(){
131
+ this.input = '';
132
+ this.pos = 0;
133
+ }
134
+ }
135
+
136
+ export { Lexer };
@@ -0,0 +1,117 @@
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/compat_get_default_export
13
+ (() => {
14
+ // getDefaultExport function for compatibility with non-ESM modules
15
+ __webpack_require__.n = (module) => {
16
+ var getter = module && module.__esModule ?
17
+ () => (module['default']) :
18
+ () => (module);
19
+ __webpack_require__.d(getter, { a: getter });
20
+ return getter;
21
+ };
22
+
23
+ })();
24
+ // webpack/runtime/define_property_getters
25
+ (() => {
26
+ __webpack_require__.d = (exports, getters, values) => {
27
+ var define = (defs, kind) => {
28
+ for(var key in defs) {
29
+ if(__webpack_require__.o(defs, key) && !__webpack_require__.o(exports, key)) {
30
+ Object.defineProperty(exports, key, { enumerable: true, [kind]: defs[key] });
31
+ }
32
+ }
33
+ };
34
+ define(getters, "get");
35
+ define(values, "value");
36
+ };
37
+ })();
38
+ // webpack/runtime/has_own_property
39
+ (() => {
40
+ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
41
+ })();
42
+ // webpack/runtime/make_namespace_object
43
+ (() => {
44
+ // define __esModule on exports
45
+ __webpack_require__.r = (exports) => {
46
+ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
47
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
48
+ }
49
+ Object.defineProperty(exports, '__esModule', { value: true });
50
+ };
51
+ })();
52
+ var __webpack_exports__ = {};
53
+ // ESM COMPAT FLAG
54
+ __webpack_require__.r(__webpack_exports__);
55
+
56
+ // EXPORTS
57
+ __webpack_require__.d(__webpack_exports__, {
58
+ createVirtualRemoteModule: () => (/* binding */ createVirtualRemoteModule),
59
+ linkRemotesPlugin: () => (/* binding */ linkRemotesPlugin)
60
+ });
61
+
62
+ ;// CONCATENATED MODULE: external "path"
63
+ const external_path_namespaceObject = require("path");
64
+ var external_path_default = /*#__PURE__*/__webpack_require__.n(external_path_namespaceObject);
65
+ ;// CONCATENATED MODULE: ./src/adapters/lib/linkRemotesPlugin.ts
66
+
67
+ // relys on import map since i dont know the named exports of a remote to return.
68
+ const createVirtualRemoteModule = (name, ref)=>`
69
+ export * from ${JSON.stringify('federationRemote/' + ref)}
70
+ `;
71
+ const linkRemotesPlugin = (config)=>({
72
+ name: 'linkRemotes',
73
+ setup (build) {
74
+ const remotes = config.remotes || {};
75
+ const filter = new RegExp(Object.keys(remotes).reduce((acc, key)=>{
76
+ if (!key) return acc;
77
+ acc.push(`^${key}`);
78
+ return acc;
79
+ }, []).join('|'));
80
+ build.onResolve({
81
+ filter: filter
82
+ }, async (args)=>{
83
+ return {
84
+ path: args.path,
85
+ namespace: 'remote-module'
86
+ };
87
+ });
88
+ build.onResolve({
89
+ filter: /^federationRemote/
90
+ }, async (args)=>{
91
+ return {
92
+ path: args.path.replace('federationRemote/', ''),
93
+ external: true,
94
+ namespace: 'externals'
95
+ };
96
+ });
97
+ build.onLoad({
98
+ filter,
99
+ namespace: 'remote-module'
100
+ }, async (args)=>{
101
+ return {
102
+ contents: createVirtualRemoteModule(config.name, args.path),
103
+ loader: 'js',
104
+ resolveDir: external_path_default().dirname(args.path)
105
+ };
106
+ });
107
+ }
108
+ });
109
+
110
+ exports.createVirtualRemoteModule = __webpack_exports__.createVirtualRemoteModule;
111
+ exports.linkRemotesPlugin = __webpack_exports__.linkRemotesPlugin;
112
+ for(var __rspack_i in __webpack_exports__) {
113
+ if(["createVirtualRemoteModule","linkRemotesPlugin"].indexOf(__rspack_i) === -1) {
114
+ exports[__rspack_i] = __webpack_exports__[__rspack_i];
115
+ }
116
+ }
117
+ Object.defineProperty(exports, '__esModule', { value: true });
@@ -0,0 +1,48 @@
1
+ import path from "path";
2
+
3
+
4
+
5
+ // relys on import map since i dont know the named exports of a remote to return.
6
+ const createVirtualRemoteModule = (name, ref)=>`
7
+ export * from ${JSON.stringify('federationRemote/' + ref)}
8
+ `;
9
+ const linkRemotesPlugin = (config)=>({
10
+ name: 'linkRemotes',
11
+ setup (build) {
12
+ const remotes = config.remotes || {};
13
+ const filter = new RegExp(Object.keys(remotes).reduce((acc, key)=>{
14
+ if (!key) return acc;
15
+ acc.push(`^${key}`);
16
+ return acc;
17
+ }, []).join('|'));
18
+ build.onResolve({
19
+ filter: filter
20
+ }, async (args)=>{
21
+ return {
22
+ path: args.path,
23
+ namespace: 'remote-module'
24
+ };
25
+ });
26
+ build.onResolve({
27
+ filter: /^federationRemote/
28
+ }, async (args)=>{
29
+ return {
30
+ path: args.path.replace('federationRemote/', ''),
31
+ external: true,
32
+ namespace: 'externals'
33
+ };
34
+ });
35
+ build.onLoad({
36
+ filter,
37
+ namespace: 'remote-module'
38
+ }, async (args)=>{
39
+ return {
40
+ contents: createVirtualRemoteModule(config.name, args.path),
41
+ loader: 'js',
42
+ resolveDir: path.dirname(args.path)
43
+ };
44
+ });
45
+ }
46
+ });
47
+
48
+ export { createVirtualRemoteModule, linkRemotesPlugin };