@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.
Files changed (93) 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/collect-exports.js +153 -0
  5. package/dist/adapters/lib/collect-exports.mjs +80 -0
  6. package/dist/adapters/lib/commonjs.d.ts +101 -0
  7. package/dist/adapters/lib/commonjs.js +258 -0
  8. package/dist/adapters/lib/commonjs.mjs +182 -0
  9. package/dist/adapters/lib/containerPlugin.d.ts +6 -0
  10. package/dist/adapters/lib/containerPlugin.js +233 -0
  11. package/dist/adapters/lib/containerPlugin.mjs +179 -0
  12. package/dist/adapters/lib/containerReference.d.ts +6 -0
  13. package/dist/adapters/lib/containerReference.js +257 -0
  14. package/dist/adapters/lib/containerReference.mjs +188 -0
  15. package/dist/adapters/lib/lexer.d.ts +9 -0
  16. package/dist/adapters/lib/lexer.js +187 -0
  17. package/dist/adapters/lib/lexer.mjs +136 -0
  18. package/dist/adapters/lib/linkRemotesPlugin.d.ts +6 -0
  19. package/dist/adapters/lib/linkRemotesPlugin.js +117 -0
  20. package/dist/adapters/lib/linkRemotesPlugin.mjs +48 -0
  21. package/dist/adapters/lib/manifest.d.ts +2 -0
  22. package/dist/adapters/lib/manifest.js +227 -0
  23. package/dist/adapters/lib/manifest.mjs +159 -0
  24. package/dist/adapters/lib/plugin.d.ts +8 -0
  25. package/dist/adapters/lib/plugin.js +340 -0
  26. package/dist/adapters/lib/plugin.mjs +247 -0
  27. package/dist/adapters/lib/react-replacements.d.ts +9 -0
  28. package/dist/adapters/lib/react-replacements.js +86 -0
  29. package/dist/adapters/lib/react-replacements.mjs +34 -0
  30. package/dist/adapters/lib/transform.d.ts +8 -0
  31. package/dist/adapters/lib/transform.js +171 -0
  32. package/dist/adapters/lib/transform.mjs +116 -0
  33. package/dist/adapters/lib/utils.d.ts +3 -0
  34. package/dist/adapters/lib/utils.js +87 -0
  35. package/dist/adapters/lib/utils.mjs +31 -0
  36. package/dist/build.d.ts +5 -0
  37. package/dist/build.js +140 -0
  38. package/dist/build.mjs +12 -0
  39. package/dist/index.d.ts +2 -0
  40. package/dist/index.js +55 -0
  41. package/dist/index.mjs +3 -0
  42. package/dist/lib/config/configuration-context.d.ts +7 -0
  43. package/dist/lib/config/configuration-context.js +73 -0
  44. package/dist/lib/config/configuration-context.mjs +18 -0
  45. package/dist/lib/config/federation-config.d.ts +30 -0
  46. package/dist/lib/config/federation-config.js +29 -0
  47. package/dist/lib/config/federation-config.mjs +3 -0
  48. package/dist/lib/config/share-utils.d.ts +29 -0
  49. package/dist/lib/config/share-utils.js +340 -0
  50. package/dist/lib/config/share-utils.mjs +245 -0
  51. package/dist/lib/config/with-native-federation.d.ts +23 -0
  52. package/dist/lib/config/with-native-federation.js +120 -0
  53. package/dist/lib/config/with-native-federation.mjs +66 -0
  54. package/dist/lib/core/build-adapter.d.ts +4 -0
  55. package/dist/lib/core/build-adapter.js +72 -0
  56. package/dist/lib/core/build-adapter.mjs +16 -0
  57. package/dist/lib/core/createContainerTemplate.d.ts +1 -0
  58. package/dist/lib/core/createContainerTemplate.js +235 -0
  59. package/dist/lib/core/createContainerTemplate.mjs +183 -0
  60. package/dist/lib/core/default-skip-list.d.ts +12 -0
  61. package/dist/lib/core/default-skip-list.js +103 -0
  62. package/dist/lib/core/default-skip-list.mjs +45 -0
  63. package/dist/lib/core/federation-options.d.ts +10 -0
  64. package/dist/lib/core/federation-options.js +29 -0
  65. package/dist/lib/core/federation-options.mjs +3 -0
  66. package/dist/lib/core/get-externals.d.ts +2 -0
  67. package/dist/lib/core/get-externals.js +68 -0
  68. package/dist/lib/core/get-externals.mjs +17 -0
  69. package/dist/lib/core/load-federation-config.d.ts +6 -0
  70. package/dist/lib/core/load-federation-config.js +71 -0
  71. package/dist/lib/core/load-federation-config.mjs +16 -0
  72. package/dist/lib/core/write-federation-info.d.ts +9 -0
  73. package/dist/lib/core/write-federation-info.js +67 -0
  74. package/dist/lib/core/write-federation-info.mjs +12 -0
  75. package/dist/lib/utils/logger.d.ts +11 -0
  76. package/dist/lib/utils/logger.js +113 -0
  77. package/dist/lib/utils/logger.mjs +44 -0
  78. package/dist/lib/utils/mapped-paths.d.ts +10 -0
  79. package/dist/lib/utils/mapped-paths.js +95 -0
  80. package/dist/lib/utils/mapped-paths.mjs +40 -0
  81. package/dist/lib/utils/normalize.d.ts +1 -0
  82. package/dist/lib/utils/normalize.js +66 -0
  83. package/dist/lib/utils/normalize.mjs +15 -0
  84. package/dist/lib/utils/package-info.d.ts +18 -0
  85. package/dist/lib/utils/package-info.js +325 -0
  86. package/dist/lib/utils/package-info.mjs +259 -0
  87. package/dist/plugin.d.ts +1 -0
  88. package/dist/plugin.js +96 -0
  89. package/dist/plugin.mjs +4 -0
  90. package/dist/resolve/esm-resolver.mjs +19 -0
  91. package/dist/resolve/package.json +3 -0
  92. package/dist/rslib-runtime.mjs +31 -0
  93. package/package.json +75 -0
@@ -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 {};
@@ -0,0 +1,325 @@
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
+ _getPackageInfo: () => (/* binding */ _getPackageInfo),
47
+ expandFolders: () => (/* binding */ expandFolders),
48
+ findDepPackageJson: () => (/* binding */ findDepPackageJson),
49
+ findPackageJsonFiles: () => (/* binding */ findPackageJsonFiles),
50
+ getPackageInfo: () => (/* binding */ getPackageInfo),
51
+ getPackageJsonFiles: () => (/* binding */ getPackageJsonFiles),
52
+ getVersionMaps: () => (/* binding */ getVersionMaps)
53
+ });
54
+
55
+ ;// CONCATENATED MODULE: external "fs"
56
+ const external_fs_namespaceObject = require("fs");
57
+ ;// CONCATENATED MODULE: external "path"
58
+ const external_path_namespaceObject = require("path");
59
+ ;// CONCATENATED MODULE: external "./logger.js"
60
+ const external_logger_js_namespaceObject = require("./logger.js");
61
+ ;// CONCATENATED MODULE: external "./normalize.js"
62
+ const external_normalize_js_namespaceObject = require("./normalize.js");
63
+ ;// CONCATENATED MODULE: ./src/lib/utils/package-info.ts
64
+
65
+
66
+
67
+
68
+ const packageCache = {};
69
+ function findPackageJsonFiles(project, workspace) {
70
+ return expandFolders(project, workspace).map((f)=>external_path_namespaceObject.join(f, 'package.json')).filter((f)=>external_fs_namespaceObject.existsSync(f));
71
+ }
72
+ function expandFolders(child, parent) {
73
+ const result = [];
74
+ parent = (0,external_normalize_js_namespaceObject.normalize)(parent, true);
75
+ child = (0,external_normalize_js_namespaceObject.normalize)(child, true);
76
+ if (!child.startsWith(parent)) {
77
+ throw new Error(`Workspace folder ${parent} needs to be a parent of the project folder ${child}`);
78
+ }
79
+ let current = child;
80
+ while(current !== parent){
81
+ result.push(current);
82
+ const cand = (0,external_normalize_js_namespaceObject.normalize)(external_path_namespaceObject.dirname(current), true);
83
+ if (cand === current) {
84
+ break;
85
+ }
86
+ current = cand;
87
+ }
88
+ result.push(parent);
89
+ return result;
90
+ }
91
+ function getPackageInfo(packageName, workspaceRoot) {
92
+ workspaceRoot = (0,external_normalize_js_namespaceObject.normalize)(workspaceRoot, true);
93
+ const packageJsonInfos = getPackageJsonFiles(workspaceRoot, workspaceRoot);
94
+ for (const info of packageJsonInfos){
95
+ const cand = _getPackageInfo(packageName, info.directory);
96
+ if (cand) {
97
+ return cand;
98
+ }
99
+ }
100
+ external_logger_js_namespaceObject.logger.warn('No meta data found for shared lib ' + packageName);
101
+ return null;
102
+ }
103
+ function getVersionMapCacheKey(project, workspace) {
104
+ return `${project}**${workspace}`;
105
+ }
106
+ function getVersionMaps(project, workspace) {
107
+ return getPackageJsonFiles(project, workspace).map((json)=>({
108
+ ...json.content['dependencies']
109
+ }));
110
+ }
111
+ function getPackageJsonFiles(project, workspace) {
112
+ const cacheKey = getVersionMapCacheKey(project, workspace);
113
+ let maps = packageCache[cacheKey];
114
+ if (maps) {
115
+ return maps;
116
+ }
117
+ maps = findPackageJsonFiles(project, workspace).map((f)=>{
118
+ const content = JSON.parse(external_fs_namespaceObject.readFileSync(f, 'utf-8'));
119
+ const directory = (0,external_normalize_js_namespaceObject.normalize)(external_path_namespaceObject.dirname(f), true);
120
+ const result = {
121
+ content,
122
+ directory
123
+ };
124
+ return result;
125
+ });
126
+ packageCache[cacheKey] = maps;
127
+ return maps;
128
+ }
129
+ function findDepPackageJson(packageName, projectRoot) {
130
+ const mainPkgName = getPkgFolder(packageName);
131
+ let mainPkgPath = external_path_namespaceObject.join(projectRoot, 'node_modules', mainPkgName);
132
+ let mainPkgJsonPath = external_path_namespaceObject.join(mainPkgPath, 'package.json');
133
+ let directory = projectRoot;
134
+ while(external_path_namespaceObject.dirname(directory) !== directory){
135
+ if (external_fs_namespaceObject.existsSync(mainPkgJsonPath)) {
136
+ break;
137
+ }
138
+ directory = (0,external_normalize_js_namespaceObject.normalize)(external_path_namespaceObject.dirname(directory), true);
139
+ mainPkgPath = external_path_namespaceObject.join(directory, 'node_modules', mainPkgName);
140
+ mainPkgJsonPath = external_path_namespaceObject.join(mainPkgPath, 'package.json');
141
+ }
142
+ if (!external_fs_namespaceObject.existsSync(mainPkgJsonPath)) {
143
+ external_logger_js_namespaceObject.logger.verbose('No package.json found for ' + packageName + ' in ' + mainPkgPath);
144
+ return null;
145
+ }
146
+ return mainPkgJsonPath;
147
+ }
148
+ function _getPackageInfo(packageName, directory) {
149
+ const mainPkgName = getPkgFolder(packageName);
150
+ const mainPkgJsonPath = findDepPackageJson(packageName, directory);
151
+ if (!mainPkgJsonPath) {
152
+ return null;
153
+ }
154
+ const mainPkgPath = external_path_namespaceObject.dirname(mainPkgJsonPath);
155
+ const mainPkgJson = readJson(mainPkgJsonPath);
156
+ const version = mainPkgJson['version'];
157
+ const esm = mainPkgJson['type'] === 'module';
158
+ if (!version) {
159
+ external_logger_js_namespaceObject.logger.warn('No version found for ' + packageName);
160
+ return null;
161
+ }
162
+ let relSecondaryPath = external_path_namespaceObject.relative(mainPkgName, packageName);
163
+ if (!relSecondaryPath) {
164
+ relSecondaryPath = '.';
165
+ } else {
166
+ relSecondaryPath = './' + relSecondaryPath.replace(/\\/g, '/');
167
+ }
168
+ let cand = mainPkgJson?.exports?.[relSecondaryPath];
169
+ if (typeof cand === 'string') {
170
+ return {
171
+ entryPoint: external_path_namespaceObject.join(mainPkgPath, cand),
172
+ packageName,
173
+ version,
174
+ esm
175
+ };
176
+ }
177
+ cand = mainPkgJson?.exports?.[relSecondaryPath]?.import;
178
+ if (typeof cand === 'object') {
179
+ if (cand.module) {
180
+ cand = cand.module;
181
+ } else if (cand.import) {
182
+ cand = cand.import;
183
+ } else if (cand.default) {
184
+ cand = cand.default;
185
+ } else {
186
+ cand = null;
187
+ }
188
+ }
189
+ if (cand) {
190
+ if (typeof cand === 'object') {
191
+ if (cand.module) {
192
+ cand = cand.module;
193
+ } else if (cand.import) {
194
+ cand = cand.import;
195
+ } else if (cand.default) {
196
+ cand = cand.default;
197
+ } else {
198
+ cand = null;
199
+ }
200
+ }
201
+ return {
202
+ entryPoint: external_path_namespaceObject.join(mainPkgPath, cand),
203
+ packageName,
204
+ version,
205
+ esm
206
+ };
207
+ }
208
+ cand = mainPkgJson?.exports?.[relSecondaryPath]?.module;
209
+ if (typeof cand === 'object') {
210
+ if (cand.module) {
211
+ cand = cand.module;
212
+ } else if (cand.import) {
213
+ cand = cand.import;
214
+ } else if (cand.default) {
215
+ cand = cand.default;
216
+ } else {
217
+ cand = null;
218
+ }
219
+ }
220
+ if (cand) {
221
+ return {
222
+ entryPoint: external_path_namespaceObject.join(mainPkgPath, cand),
223
+ packageName,
224
+ version,
225
+ esm
226
+ };
227
+ }
228
+ cand = mainPkgJson?.exports?.[relSecondaryPath]?.default;
229
+ if (cand) {
230
+ if (typeof cand === 'object') {
231
+ if (cand.module) {
232
+ cand = cand.module;
233
+ } else if (cand.import) {
234
+ cand = cand.import;
235
+ } else if (cand.default) {
236
+ cand = cand.default;
237
+ } else {
238
+ cand = null;
239
+ }
240
+ }
241
+ return {
242
+ entryPoint: external_path_namespaceObject.join(mainPkgPath, cand),
243
+ packageName,
244
+ version,
245
+ esm
246
+ };
247
+ }
248
+ cand = mainPkgJson['module'];
249
+ if (cand && relSecondaryPath === '.') {
250
+ return {
251
+ entryPoint: external_path_namespaceObject.join(mainPkgPath, cand),
252
+ packageName,
253
+ version,
254
+ esm: true
255
+ };
256
+ }
257
+ const secondaryPgkPath = external_path_namespaceObject.join(mainPkgPath, relSecondaryPath);
258
+ const secondaryPgkJsonPath = external_path_namespaceObject.join(secondaryPgkPath, 'package.json');
259
+ let secondaryPgkJson = null;
260
+ if (external_fs_namespaceObject.existsSync(secondaryPgkJsonPath)) {
261
+ secondaryPgkJson = readJson(secondaryPgkJsonPath);
262
+ }
263
+ if (secondaryPgkJson && secondaryPgkJson.module) {
264
+ return {
265
+ entryPoint: external_path_namespaceObject.join(secondaryPgkPath, secondaryPgkJson.module),
266
+ packageName,
267
+ version,
268
+ esm: true
269
+ };
270
+ }
271
+ cand = external_path_namespaceObject.join(secondaryPgkPath, 'index.mjs');
272
+ if (external_fs_namespaceObject.existsSync(cand)) {
273
+ return {
274
+ entryPoint: cand,
275
+ packageName,
276
+ version,
277
+ esm: true
278
+ };
279
+ }
280
+ if (secondaryPgkJson && secondaryPgkJson.main) {
281
+ return {
282
+ entryPoint: external_path_namespaceObject.join(secondaryPgkPath, secondaryPgkJson.main),
283
+ packageName,
284
+ version,
285
+ esm
286
+ };
287
+ }
288
+ cand = external_path_namespaceObject.join(secondaryPgkPath, 'index.js');
289
+ if (external_fs_namespaceObject.existsSync(cand)) {
290
+ return {
291
+ entryPoint: cand,
292
+ packageName,
293
+ version,
294
+ esm
295
+ };
296
+ }
297
+ external_logger_js_namespaceObject.logger.warn('No entry point found for ' + packageName);
298
+ external_logger_js_namespaceObject.logger.warn("If you don't need this package, skip it in your federation.config.js or consider moving it into depDependencies in your package.json");
299
+ return null;
300
+ }
301
+ function readJson(mainPkgJsonPath) {
302
+ return JSON.parse(external_fs_namespaceObject.readFileSync(mainPkgJsonPath, 'utf-8'));
303
+ }
304
+ function getPkgFolder(packageName) {
305
+ const parts = packageName.split('/');
306
+ let folder = parts[0];
307
+ if (folder.startsWith('@')) {
308
+ folder += '/' + parts[1];
309
+ }
310
+ return folder;
311
+ }
312
+
313
+ exports._getPackageInfo = __webpack_exports__._getPackageInfo;
314
+ exports.expandFolders = __webpack_exports__.expandFolders;
315
+ exports.findDepPackageJson = __webpack_exports__.findDepPackageJson;
316
+ exports.findPackageJsonFiles = __webpack_exports__.findPackageJsonFiles;
317
+ exports.getPackageInfo = __webpack_exports__.getPackageInfo;
318
+ exports.getPackageJsonFiles = __webpack_exports__.getPackageJsonFiles;
319
+ exports.getVersionMaps = __webpack_exports__.getVersionMaps;
320
+ for(var __rspack_i in __webpack_exports__) {
321
+ if(["_getPackageInfo","expandFolders","findDepPackageJson","findPackageJsonFiles","getPackageInfo","getPackageJsonFiles","getVersionMaps"].indexOf(__rspack_i) === -1) {
322
+ exports[__rspack_i] = __webpack_exports__[__rspack_i];
323
+ }
324
+ }
325
+ Object.defineProperty(exports, '__esModule', { value: true });
@@ -0,0 +1,259 @@
1
+ import { logger } from "./logger.mjs";
2
+ import { normalize } from "./normalize.mjs";
3
+
4
+ import * as __rspack_external_fs from "fs";
5
+ import * as __rspack_external_path from "path";
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+ const packageCache = {};
15
+ function findPackageJsonFiles(project, workspace) {
16
+ return expandFolders(project, workspace).map((f)=>__rspack_external_path.join(f, 'package.json')).filter((f)=>__rspack_external_fs.existsSync(f));
17
+ }
18
+ function expandFolders(child, parent) {
19
+ const result = [];
20
+ parent = normalize(parent, true);
21
+ child = normalize(child, true);
22
+ if (!child.startsWith(parent)) {
23
+ throw new Error(`Workspace folder ${parent} needs to be a parent of the project folder ${child}`);
24
+ }
25
+ let current = child;
26
+ while(current !== parent){
27
+ result.push(current);
28
+ const cand = normalize(__rspack_external_path.dirname(current), true);
29
+ if (cand === current) {
30
+ break;
31
+ }
32
+ current = cand;
33
+ }
34
+ result.push(parent);
35
+ return result;
36
+ }
37
+ function getPackageInfo(packageName, workspaceRoot) {
38
+ workspaceRoot = normalize(workspaceRoot, true);
39
+ const packageJsonInfos = getPackageJsonFiles(workspaceRoot, workspaceRoot);
40
+ for (const info of packageJsonInfos){
41
+ const cand = _getPackageInfo(packageName, info.directory);
42
+ if (cand) {
43
+ return cand;
44
+ }
45
+ }
46
+ logger.warn('No meta data found for shared lib ' + packageName);
47
+ return null;
48
+ }
49
+ function getVersionMapCacheKey(project, workspace) {
50
+ return `${project}**${workspace}`;
51
+ }
52
+ function getVersionMaps(project, workspace) {
53
+ return getPackageJsonFiles(project, workspace).map((json)=>({
54
+ ...json.content['dependencies']
55
+ }));
56
+ }
57
+ function getPackageJsonFiles(project, workspace) {
58
+ const cacheKey = getVersionMapCacheKey(project, workspace);
59
+ let maps = packageCache[cacheKey];
60
+ if (maps) {
61
+ return maps;
62
+ }
63
+ maps = findPackageJsonFiles(project, workspace).map((f)=>{
64
+ const content = JSON.parse(__rspack_external_fs.readFileSync(f, 'utf-8'));
65
+ const directory = normalize(__rspack_external_path.dirname(f), true);
66
+ const result = {
67
+ content,
68
+ directory
69
+ };
70
+ return result;
71
+ });
72
+ packageCache[cacheKey] = maps;
73
+ return maps;
74
+ }
75
+ function findDepPackageJson(packageName, projectRoot) {
76
+ const mainPkgName = getPkgFolder(packageName);
77
+ let mainPkgPath = __rspack_external_path.join(projectRoot, 'node_modules', mainPkgName);
78
+ let mainPkgJsonPath = __rspack_external_path.join(mainPkgPath, 'package.json');
79
+ let directory = projectRoot;
80
+ while(__rspack_external_path.dirname(directory) !== directory){
81
+ if (__rspack_external_fs.existsSync(mainPkgJsonPath)) {
82
+ break;
83
+ }
84
+ directory = normalize(__rspack_external_path.dirname(directory), true);
85
+ mainPkgPath = __rspack_external_path.join(directory, 'node_modules', mainPkgName);
86
+ mainPkgJsonPath = __rspack_external_path.join(mainPkgPath, 'package.json');
87
+ }
88
+ if (!__rspack_external_fs.existsSync(mainPkgJsonPath)) {
89
+ logger.verbose('No package.json found for ' + packageName + ' in ' + mainPkgPath);
90
+ return null;
91
+ }
92
+ return mainPkgJsonPath;
93
+ }
94
+ function _getPackageInfo(packageName, directory) {
95
+ const mainPkgName = getPkgFolder(packageName);
96
+ const mainPkgJsonPath = findDepPackageJson(packageName, directory);
97
+ if (!mainPkgJsonPath) {
98
+ return null;
99
+ }
100
+ const mainPkgPath = __rspack_external_path.dirname(mainPkgJsonPath);
101
+ const mainPkgJson = readJson(mainPkgJsonPath);
102
+ const version = mainPkgJson['version'];
103
+ const esm = mainPkgJson['type'] === 'module';
104
+ if (!version) {
105
+ logger.warn('No version found for ' + packageName);
106
+ return null;
107
+ }
108
+ let relSecondaryPath = __rspack_external_path.relative(mainPkgName, packageName);
109
+ if (!relSecondaryPath) {
110
+ relSecondaryPath = '.';
111
+ } else {
112
+ relSecondaryPath = './' + relSecondaryPath.replace(/\\/g, '/');
113
+ }
114
+ let cand = mainPkgJson?.exports?.[relSecondaryPath];
115
+ if (typeof cand === 'string') {
116
+ return {
117
+ entryPoint: __rspack_external_path.join(mainPkgPath, cand),
118
+ packageName,
119
+ version,
120
+ esm
121
+ };
122
+ }
123
+ cand = mainPkgJson?.exports?.[relSecondaryPath]?.import;
124
+ if (typeof cand === 'object') {
125
+ if (cand.module) {
126
+ cand = cand.module;
127
+ } else if (cand.import) {
128
+ cand = cand.import;
129
+ } else if (cand.default) {
130
+ cand = cand.default;
131
+ } else {
132
+ cand = null;
133
+ }
134
+ }
135
+ if (cand) {
136
+ if (typeof cand === 'object') {
137
+ if (cand.module) {
138
+ cand = cand.module;
139
+ } else if (cand.import) {
140
+ cand = cand.import;
141
+ } else if (cand.default) {
142
+ cand = cand.default;
143
+ } else {
144
+ cand = null;
145
+ }
146
+ }
147
+ return {
148
+ entryPoint: __rspack_external_path.join(mainPkgPath, cand),
149
+ packageName,
150
+ version,
151
+ esm
152
+ };
153
+ }
154
+ cand = mainPkgJson?.exports?.[relSecondaryPath]?.module;
155
+ if (typeof cand === 'object') {
156
+ if (cand.module) {
157
+ cand = cand.module;
158
+ } else if (cand.import) {
159
+ cand = cand.import;
160
+ } else if (cand.default) {
161
+ cand = cand.default;
162
+ } else {
163
+ cand = null;
164
+ }
165
+ }
166
+ if (cand) {
167
+ return {
168
+ entryPoint: __rspack_external_path.join(mainPkgPath, cand),
169
+ packageName,
170
+ version,
171
+ esm
172
+ };
173
+ }
174
+ cand = mainPkgJson?.exports?.[relSecondaryPath]?.default;
175
+ if (cand) {
176
+ if (typeof cand === 'object') {
177
+ if (cand.module) {
178
+ cand = cand.module;
179
+ } else if (cand.import) {
180
+ cand = cand.import;
181
+ } else if (cand.default) {
182
+ cand = cand.default;
183
+ } else {
184
+ cand = null;
185
+ }
186
+ }
187
+ return {
188
+ entryPoint: __rspack_external_path.join(mainPkgPath, cand),
189
+ packageName,
190
+ version,
191
+ esm
192
+ };
193
+ }
194
+ cand = mainPkgJson['module'];
195
+ if (cand && relSecondaryPath === '.') {
196
+ return {
197
+ entryPoint: __rspack_external_path.join(mainPkgPath, cand),
198
+ packageName,
199
+ version,
200
+ esm: true
201
+ };
202
+ }
203
+ const secondaryPgkPath = __rspack_external_path.join(mainPkgPath, relSecondaryPath);
204
+ const secondaryPgkJsonPath = __rspack_external_path.join(secondaryPgkPath, 'package.json');
205
+ let secondaryPgkJson = null;
206
+ if (__rspack_external_fs.existsSync(secondaryPgkJsonPath)) {
207
+ secondaryPgkJson = readJson(secondaryPgkJsonPath);
208
+ }
209
+ if (secondaryPgkJson && secondaryPgkJson.module) {
210
+ return {
211
+ entryPoint: __rspack_external_path.join(secondaryPgkPath, secondaryPgkJson.module),
212
+ packageName,
213
+ version,
214
+ esm: true
215
+ };
216
+ }
217
+ cand = __rspack_external_path.join(secondaryPgkPath, 'index.mjs');
218
+ if (__rspack_external_fs.existsSync(cand)) {
219
+ return {
220
+ entryPoint: cand,
221
+ packageName,
222
+ version,
223
+ esm: true
224
+ };
225
+ }
226
+ if (secondaryPgkJson && secondaryPgkJson.main) {
227
+ return {
228
+ entryPoint: __rspack_external_path.join(secondaryPgkPath, secondaryPgkJson.main),
229
+ packageName,
230
+ version,
231
+ esm
232
+ };
233
+ }
234
+ cand = __rspack_external_path.join(secondaryPgkPath, 'index.js');
235
+ if (__rspack_external_fs.existsSync(cand)) {
236
+ return {
237
+ entryPoint: cand,
238
+ packageName,
239
+ version,
240
+ esm
241
+ };
242
+ }
243
+ logger.warn('No entry point found for ' + packageName);
244
+ logger.warn("If you don't need this package, skip it in your federation.config.js or consider moving it into depDependencies in your package.json");
245
+ return null;
246
+ }
247
+ function readJson(mainPkgJsonPath) {
248
+ return JSON.parse(__rspack_external_fs.readFileSync(mainPkgJsonPath, 'utf-8'));
249
+ }
250
+ function getPkgFolder(packageName) {
251
+ const parts = packageName.split('/');
252
+ let folder = parts[0];
253
+ if (folder.startsWith('@')) {
254
+ folder += '/' + parts[1];
255
+ }
256
+ return folder;
257
+ }
258
+
259
+ export { _getPackageInfo, expandFolders, findDepPackageJson, findPackageJsonFiles, getPackageInfo, getPackageJsonFiles, getVersionMaps };
@@ -0,0 +1 @@
1
+ export * from './adapters/lib/plugin';
package/dist/plugin.js ADDED
@@ -0,0 +1,96 @@
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
+ var __webpack_modules__ = ({
10
+ "./adapters/lib/plugin"(module) {
11
+ module.exports = require("./adapters/lib/plugin.js");
12
+
13
+ },
14
+
15
+ });
16
+ // The module cache
17
+ var __webpack_module_cache__ = {};
18
+
19
+ // The require function
20
+ function __webpack_require__(moduleId) {
21
+
22
+ // Check if module is in cache
23
+ var cachedModule = __webpack_module_cache__[moduleId];
24
+ if (cachedModule !== undefined) {
25
+ return cachedModule.exports;
26
+ }
27
+ // Create a new module (and put it into the cache)
28
+ var module = (__webpack_module_cache__[moduleId] = {
29
+ exports: {}
30
+ });
31
+ // Execute the module function
32
+ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
33
+
34
+ // Return the exports of the module
35
+ return module.exports;
36
+
37
+ }
38
+
39
+ // webpack/runtime/compat_get_default_export
40
+ (() => {
41
+ // getDefaultExport function for compatibility with non-ESM modules
42
+ __webpack_require__.n = (module) => {
43
+ var getter = module && module.__esModule ?
44
+ () => (module['default']) :
45
+ () => (module);
46
+ __webpack_require__.d(getter, { a: getter });
47
+ return getter;
48
+ };
49
+
50
+ })();
51
+ // webpack/runtime/define_property_getters
52
+ (() => {
53
+ __webpack_require__.d = (exports, getters, values) => {
54
+ var define = (defs, kind) => {
55
+ for(var key in defs) {
56
+ if(__webpack_require__.o(defs, key) && !__webpack_require__.o(exports, key)) {
57
+ Object.defineProperty(exports, key, { enumerable: true, [kind]: defs[key] });
58
+ }
59
+ }
60
+ };
61
+ define(getters, "get");
62
+ define(values, "value");
63
+ };
64
+ })();
65
+ // webpack/runtime/has_own_property
66
+ (() => {
67
+ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
68
+ })();
69
+ // webpack/runtime/make_namespace_object
70
+ (() => {
71
+ // define __esModule on exports
72
+ __webpack_require__.r = (exports) => {
73
+ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
74
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
75
+ }
76
+ Object.defineProperty(exports, '__esModule', { value: true });
77
+ };
78
+ })();
79
+ var __webpack_exports__ = {};
80
+ // This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk.
81
+ (() => {
82
+ __webpack_require__.r(__webpack_exports__);
83
+ /* import */ var _adapters_lib_plugin__rspack_import_0 = __webpack_require__("./adapters/lib/plugin");
84
+ /* import */ var _adapters_lib_plugin__rspack_import_0_default = /*#__PURE__*/__webpack_require__.n(_adapters_lib_plugin__rspack_import_0);
85
+
86
+ /* reexport */ var __rspack_reexport = {};
87
+ /* reexport */ for( const __rspack_import_key in _adapters_lib_plugin__rspack_import_0) if(__rspack_import_key !== "default") __rspack_reexport[__rspack_import_key] =() => _adapters_lib_plugin__rspack_import_0[__rspack_import_key]
88
+ /* reexport */ __webpack_require__.d(__webpack_exports__, __rspack_reexport);
89
+
90
+
91
+ })();
92
+
93
+ for(var __rspack_i in __webpack_exports__) {
94
+ exports[__rspack_i] = __webpack_exports__[__rspack_i];
95
+ }
96
+ Object.defineProperty(exports, '__esModule', { value: true });