@module-federation/esbuild 0.0.95 → 0.0.97

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