@module-federation/data-prefetch 2.0.0 → 2.1.0

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 (121) hide show
  1. package/dist/babel.cjs +95 -0
  2. package/dist/babel.d.cts +1 -0
  3. package/dist/babel.d.ts +1 -2
  4. package/dist/babel.js +5 -0
  5. package/dist/cli/babel.cjs +115 -0
  6. package/dist/cli/babel.d.ts +37 -0
  7. package/dist/cli/babel.js +52 -0
  8. package/dist/cli/index.cjs +230 -0
  9. package/dist/cli/index.d.ts +16 -0
  10. package/dist/cli/index.js +171 -0
  11. package/dist/cli.cjs +95 -0
  12. package/dist/cli.d.cts +1 -0
  13. package/dist/cli.d.ts +1 -1
  14. package/dist/cli.js +5 -0
  15. package/dist/common/constant.cjs +51 -0
  16. package/dist/common/constant.d.ts +1 -0
  17. package/dist/common/constant.js +5 -0
  18. package/dist/common/index.cjs +95 -0
  19. package/dist/common/index.d.ts +1 -0
  20. package/dist/common/index.js +5 -0
  21. package/dist/common/node-utils.cjs +100 -0
  22. package/dist/common/node-utils.d.ts +2 -0
  23. package/dist/common/node-utils.js +35 -0
  24. package/dist/common/runtime-utils.cjs +84 -0
  25. package/dist/common/runtime-utils.d.ts +5 -0
  26. package/dist/common/runtime-utils.js +29 -0
  27. package/dist/constant.cjs +51 -0
  28. package/dist/constant.d.ts +1 -0
  29. package/dist/constant.js +5 -0
  30. package/dist/index.cjs +106 -0
  31. package/dist/index.d.ts +2 -1
  32. package/dist/index.js +7 -0
  33. package/dist/logger/index.cjs +60 -0
  34. package/dist/logger/index.d.ts +2 -0
  35. package/dist/logger/index.js +10 -0
  36. package/dist/plugin.cjs +234 -0
  37. package/dist/{src/plugin.d.ts → plugin.d.cts} +1 -1
  38. package/dist/plugin.d.ts +3 -2
  39. package/dist/plugin.js +173 -0
  40. package/dist/prefetch.cjs +197 -0
  41. package/dist/prefetch.d.ts +42 -0
  42. package/dist/prefetch.js +149 -0
  43. package/dist/react/hooks.cjs +144 -0
  44. package/dist/react/hooks.d.ts +11 -0
  45. package/dist/{react.esm.js → react/hooks.js} +42 -30
  46. package/dist/react/index.cjs +95 -0
  47. package/dist/react/index.d.ts +1 -0
  48. package/dist/react/index.js +5 -0
  49. package/dist/react/utils.cjs +65 -0
  50. package/dist/react/utils.d.ts +1 -0
  51. package/dist/react/utils.js +15 -0
  52. package/dist/react.cjs +95 -0
  53. package/dist/react.d.cts +1 -0
  54. package/dist/react.d.ts +1 -1
  55. package/dist/react.js +5 -0
  56. package/dist/universal/index.cjs +81 -0
  57. package/dist/universal/index.d.ts +2 -0
  58. package/dist/{universal.esm.js → universal/index.js} +14 -10
  59. package/dist/universal.cjs +95 -0
  60. package/dist/universal.d.cts +1 -0
  61. package/dist/universal.d.ts +1 -1
  62. package/dist/universal.js +5 -0
  63. package/package.json +47 -21
  64. package/dist/babel.cjs.cjs +0 -54
  65. package/dist/babel.cjs.cjs.map +0 -1
  66. package/dist/babel.cjs.d.ts +0 -2
  67. package/dist/babel.esm.js +0 -52
  68. package/dist/babel.esm.js.map +0 -1
  69. package/dist/cli.cjs.cjs +0 -156
  70. package/dist/cli.cjs.cjs.map +0 -1
  71. package/dist/cli.cjs.d.ts +0 -1
  72. package/dist/cli.esm.js +0 -153
  73. package/dist/cli.esm.js.map +0 -1
  74. package/dist/constant.cjs.cjs +0 -6
  75. package/dist/constant.cjs.cjs.map +0 -1
  76. package/dist/constant.esm.js +0 -4
  77. package/dist/constant.esm.js.map +0 -1
  78. package/dist/index.cjs.cjs +0 -10
  79. package/dist/index.cjs.cjs.map +0 -1
  80. package/dist/index.cjs.d.ts +0 -1
  81. package/dist/index.cjs2.cjs +0 -8
  82. package/dist/index.cjs2.cjs.map +0 -1
  83. package/dist/index.esm.js +0 -3
  84. package/dist/index.esm.js.map +0 -1
  85. package/dist/index.esm2.js +0 -6
  86. package/dist/index.esm2.js.map +0 -1
  87. package/dist/plugin.cjs.cjs +0 -158
  88. package/dist/plugin.cjs.cjs.map +0 -1
  89. package/dist/plugin.cjs.d.ts +0 -2
  90. package/dist/plugin.esm.js +0 -153
  91. package/dist/plugin.esm.js.map +0 -1
  92. package/dist/prefetch.cjs.cjs +0 -182
  93. package/dist/prefetch.cjs.cjs.map +0 -1
  94. package/dist/prefetch.esm.js +0 -179
  95. package/dist/prefetch.esm.js.map +0 -1
  96. package/dist/react.cjs.cjs +0 -76
  97. package/dist/react.cjs.cjs.map +0 -1
  98. package/dist/react.cjs.d.ts +0 -1
  99. package/dist/react.esm.js.map +0 -1
  100. package/dist/runtime-utils.cjs.cjs +0 -29
  101. package/dist/runtime-utils.cjs.cjs.map +0 -1
  102. package/dist/runtime-utils.esm.js +0 -24
  103. package/dist/runtime-utils.esm.js.map +0 -1
  104. package/dist/universal.cjs.cjs +0 -30
  105. package/dist/universal.cjs.cjs.map +0 -1
  106. package/dist/universal.cjs.d.ts +0 -1
  107. package/dist/universal.esm.js.map +0 -1
  108. /package/dist/{src/cli/babel.d.ts → cli/babel.d.cts} +0 -0
  109. /package/dist/{src/cli/index.d.ts → cli/index.d.cts} +0 -0
  110. /package/dist/{src/common/constant.d.ts → common/constant.d.cts} +0 -0
  111. /package/dist/{src/common/index.d.ts → common/index.d.cts} +0 -0
  112. /package/dist/{src/common/node-utils.d.ts → common/node-utils.d.cts} +0 -0
  113. /package/dist/{src/common/runtime-utils.d.ts → common/runtime-utils.d.cts} +0 -0
  114. /package/dist/{src/constant.d.ts → constant.d.cts} +0 -0
  115. /package/dist/{src/index.d.ts → index.d.cts} +0 -0
  116. /package/dist/{src/logger/index.d.ts → logger/index.d.cts} +0 -0
  117. /package/dist/{src/prefetch.d.ts → prefetch.d.cts} +0 -0
  118. /package/dist/{src/react/hooks.d.ts → react/hooks.d.cts} +0 -0
  119. /package/dist/{src/react/index.d.ts → react/index.d.cts} +0 -0
  120. /package/dist/{src/react/utils.d.ts → react/utils.d.cts} +0 -0
  121. /package/dist/{src/universal/index.d.ts → universal/index.d.cts} +0 -0
@@ -0,0 +1,171 @@
1
+ import path from "path";
2
+ import fs_extra from "fs-extra";
3
+ import { MFPrefetchCommon, bindLoggerToCompiler, createInfrastructureLogger, createLogger, encodeName } from "@module-federation/sdk";
4
+ import { normalizeWebpackPath } from "@module-federation/sdk/normalize-webpack-path";
5
+ import { TEMP_DIR } from "../common/constant.js";
6
+ import { fileExistsWithCaseSync, fixPrefetchPath } from "../common/node-utils.js";
7
+ import { getPrefetchId } from "../common/runtime-utils.js";
8
+ import { SHARED_STRATEGY } from "../constant.js";
9
+
10
+ ;// CONCATENATED MODULE: external "path"
11
+
12
+ ;// CONCATENATED MODULE: external "fs-extra"
13
+
14
+ ;// CONCATENATED MODULE: external "@module-federation/sdk"
15
+
16
+ ;// CONCATENATED MODULE: external "@module-federation/sdk/normalize-webpack-path"
17
+
18
+ ;// CONCATENATED MODULE: external "../common/constant.js"
19
+
20
+ ;// CONCATENATED MODULE: external "../common/node-utils.js"
21
+
22
+ ;// CONCATENATED MODULE: external "../common/runtime-utils.js"
23
+
24
+ ;// CONCATENATED MODULE: external "../constant.js"
25
+
26
+ ;// CONCATENATED MODULE: ./src/cli/index.ts
27
+
28
+
29
+
30
+
31
+
32
+
33
+
34
+
35
+ const { RuntimeGlobals, Template } = require(normalizeWebpackPath('webpack'));
36
+ const createBundlerLogger = typeof createInfrastructureLogger === 'function' ? createInfrastructureLogger : createLogger;
37
+ const logger = createBundlerLogger('[ Module Federation Data Prefetch Plugin ]');
38
+ function getFederationGlobalScope(runtimeGlobals) {
39
+ return `${runtimeGlobals.require || '__webpack_require__'}.federation`;
40
+ }
41
+ class PrefetchPlugin {
42
+ // eslint-disable-next-line max-lines-per-function
43
+ apply(compiler) {
44
+ var _this_options_runtimePlugins;
45
+ bindLoggerToCompiler(logger, compiler, 'PrefetchPlugin');
46
+ const { name, exposes } = this.options;
47
+ if (!exposes) {
48
+ return;
49
+ }
50
+ if (!compiler.options.context) {
51
+ throw new Error('compiler.options.context is not defined');
52
+ }
53
+ const { runtimePlugins } = this.options;
54
+ if (!Array.isArray(runtimePlugins)) {
55
+ this.options.runtimePlugins = [];
56
+ }
57
+ const runtimePluginCandidates = process.env.IS_ESM_BUILD === 'true' ? [
58
+ '../plugin.js',
59
+ '../plugin.cjs'
60
+ ] : [
61
+ '../plugin.cjs',
62
+ '../plugin.js'
63
+ ];
64
+ const runtimePath = runtimePluginCandidates.map((candidate)=>path.resolve(__dirname, candidate)).find((candidatePath)=>fs_extra.existsSync(candidatePath));
65
+ if (!runtimePath) {
66
+ throw new Error([
67
+ '[Module Federation Data Prefetch]: Unable to resolve runtime plugin file.',
68
+ `Checked paths: ${runtimePluginCandidates.map((candidate)=>path.resolve(__dirname, candidate)).join(', ')}`
69
+ ].join('\n'));
70
+ }
71
+ if (!((_this_options_runtimePlugins = this.options.runtimePlugins) === null || _this_options_runtimePlugins === void 0 ? void 0 : _this_options_runtimePlugins.includes(runtimePath))) {
72
+ this.options.runtimePlugins.push(runtimePath);
73
+ }
74
+ if (this.options.shareStrategy !== SHARED_STRATEGY) {
75
+ this.options.shareStrategy = SHARED_STRATEGY;
76
+ logger.warn(`[Module Federation Data Prefetch]: Your shared strategy is set to '${SHARED_STRATEGY}', this is a necessary condition for data prefetch`);
77
+ }
78
+ const encodedName = encodeName(name);
79
+ const asyncEntryPath = path.resolve(compiler.options.context, `node_modules/${TEMP_DIR}/${encodedName}/bootstrap.js`);
80
+ if (fs_extra.existsSync(asyncEntryPath)) {
81
+ fs_extra.unlinkSync(asyncEntryPath);
82
+ }
83
+ if (!this.options.dataPrefetch) {
84
+ return;
85
+ }
86
+ const prefetchs = [];
87
+ const exposeAlias = Object.keys(exposes);
88
+ exposeAlias.forEach((alias)=>{
89
+ let exposePath;
90
+ // @ts-ignore
91
+ const exposeValue = exposes[alias];
92
+ if (typeof exposeValue === 'string') {
93
+ exposePath = exposeValue;
94
+ } else {
95
+ exposePath = exposeValue.import[0];
96
+ }
97
+ const targetPaths = fixPrefetchPath(exposePath);
98
+ for (const pathItem of targetPaths){
99
+ const absolutePath = path.resolve(compiler.options.context, pathItem);
100
+ if (fileExistsWithCaseSync(absolutePath)) {
101
+ prefetchs.push(pathItem);
102
+ const absoluteAlias = alias.replace('.', '');
103
+ this._reWriteExports += `export * as ${getPrefetchId(`${name}${absoluteAlias}`)} from '${absolutePath}';\n`;
104
+ break;
105
+ }
106
+ }
107
+ });
108
+ if (!this._reWriteExports) {
109
+ return;
110
+ }
111
+ const tempDirRealPath = path.resolve(compiler.options.context, 'node_modules', TEMP_DIR);
112
+ if (!fs_extra.existsSync(tempDirRealPath)) {
113
+ fs_extra.mkdirSync(tempDirRealPath);
114
+ }
115
+ if (!fs_extra.existsSync(`${tempDirRealPath}/${encodedName}`)) {
116
+ fs_extra.mkdirSync(`${tempDirRealPath}/${encodedName}`);
117
+ }
118
+ fs_extra.writeFileSync(asyncEntryPath, this._reWriteExports);
119
+ new compiler.webpack.DefinePlugin({
120
+ FederationDataPrefetch: JSON.stringify(asyncEntryPath)
121
+ }).apply(compiler);
122
+ }
123
+ static addRuntime(compiler, options) {
124
+ const encodedName = encodeName(options.name);
125
+ if (!compiler.options.context) {
126
+ throw new Error('compiler.options.context is not defined');
127
+ }
128
+ const prefetchEntry = path.resolve(compiler.options.context, `node_modules/.mf/${encodedName}/bootstrap.js`);
129
+ const federationGlobal = getFederationGlobalScope(RuntimeGlobals || {});
130
+ return Template.asString([
131
+ fs_extra.existsSync(prefetchEntry) ? Template.indent([
132
+ 'function injectPrefetch() {',
133
+ Template.indent([
134
+ `globalThis.__FEDERATION__ = globalThis.__FEDERATION__ || {};`,
135
+ `globalThis.__FEDERATION__['${MFPrefetchCommon.globalKey}'] = globalThis.__FEDERATION__['${MFPrefetchCommon.globalKey}'] || {`,
136
+ `entryLoading: {},`,
137
+ `instance: new Map(),`,
138
+ `__PREFETCH_EXPORTS__: {},`,
139
+ `};`,
140
+ `globalThis.__FEDERATION__['${MFPrefetchCommon.globalKey}']['${MFPrefetchCommon.exportsKey}'] = globalThis.__FEDERATION__['${MFPrefetchCommon.globalKey}']['${MFPrefetchCommon.exportsKey}'] || {};`,
141
+ `globalThis.__FEDERATION__['${MFPrefetchCommon.globalKey}']['${MFPrefetchCommon.exportsKey}']['${options.name}'] = function(){ return import('${prefetchEntry}');}`
142
+ ]),
143
+ '}',
144
+ `${federationGlobal}.prefetch = injectPrefetch`
145
+ ]) : '',
146
+ Template.indent([
147
+ `if(!${federationGlobal}.isMFRemote && ${federationGlobal}.prefetch){`,
148
+ `${federationGlobal}.prefetch()`,
149
+ '}'
150
+ ])
151
+ ]);
152
+ }
153
+ static setRemoteIdentifier() {
154
+ const federationGlobal = getFederationGlobalScope(RuntimeGlobals || {});
155
+ return Template.indent([
156
+ `${federationGlobal}.isMFRemote = true;`
157
+ ]);
158
+ }
159
+ static removeRemoteIdentifier() {
160
+ const federationGlobal = getFederationGlobalScope(RuntimeGlobals || {});
161
+ return Template.indent([
162
+ `${federationGlobal}.isMFRemote = false;`
163
+ ]);
164
+ }
165
+ constructor(options){
166
+ this.options = options;
167
+ this._reWriteExports = '';
168
+ }
169
+ }
170
+
171
+ export { PrefetchPlugin, getFederationGlobalScope };
package/dist/cli.cjs ADDED
@@ -0,0 +1,95 @@
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
+ "./cli/index": (function (module) {
11
+ module.exports = require("./cli/index.cjs");
12
+
13
+ }),
14
+
15
+ });
16
+ /************************************************************************/
17
+ // The module cache
18
+ var __webpack_module_cache__ = {};
19
+
20
+ // The require function
21
+ function __webpack_require__(moduleId) {
22
+
23
+ // Check if module is in cache
24
+ var cachedModule = __webpack_module_cache__[moduleId];
25
+ if (cachedModule !== undefined) {
26
+ return cachedModule.exports;
27
+ }
28
+ // Create a new module (and put it into the cache)
29
+ var module = (__webpack_module_cache__[moduleId] = {
30
+ exports: {}
31
+ });
32
+ // Execute the module function
33
+ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
34
+
35
+ // Return the exports of the module
36
+ return module.exports;
37
+
38
+ }
39
+
40
+ /************************************************************************/
41
+ // webpack/runtime/compat_get_default_export
42
+ (() => {
43
+ // getDefaultExport function for compatibility with non-ESM modules
44
+ __webpack_require__.n = (module) => {
45
+ var getter = module && module.__esModule ?
46
+ () => (module['default']) :
47
+ () => (module);
48
+ __webpack_require__.d(getter, { a: getter });
49
+ return getter;
50
+ };
51
+
52
+ })();
53
+ // webpack/runtime/define_property_getters
54
+ (() => {
55
+ __webpack_require__.d = (exports, definition) => {
56
+ for(var key in definition) {
57
+ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
58
+ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
59
+ }
60
+ }
61
+ };
62
+ })();
63
+ // webpack/runtime/has_own_property
64
+ (() => {
65
+ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
66
+ })();
67
+ // webpack/runtime/make_namespace_object
68
+ (() => {
69
+ // define __esModule on exports
70
+ __webpack_require__.r = (exports) => {
71
+ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
72
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
73
+ }
74
+ Object.defineProperty(exports, '__esModule', { value: true });
75
+ };
76
+ })();
77
+ /************************************************************************/
78
+ var __webpack_exports__ = {};
79
+ // This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk.
80
+ (() => {
81
+ __webpack_require__.r(__webpack_exports__);
82
+ /* ESM import */var _cli_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./cli/index");
83
+ /* ESM import */var _cli_index__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_cli_index__WEBPACK_IMPORTED_MODULE_0__);
84
+
85
+ /* ESM reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {};
86
+ /* ESM reexport (unknown) */ for( var __WEBPACK_IMPORT_KEY__ in _cli_index__WEBPACK_IMPORTED_MODULE_0__) if(__WEBPACK_IMPORT_KEY__ !== "default") __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] =function(key) { return _cli_index__WEBPACK_IMPORTED_MODULE_0__[key]; }.bind(0, __WEBPACK_IMPORT_KEY__)
87
+ /* ESM reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
88
+
89
+
90
+ })();
91
+
92
+ for(var __webpack_i__ in __webpack_exports__) {
93
+ exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
94
+ }
95
+ Object.defineProperty(exports, '__esModule', { value: true });
package/dist/cli.d.cts ADDED
@@ -0,0 +1 @@
1
+ export * from './cli/index';
package/dist/cli.d.ts CHANGED
@@ -1 +1 @@
1
- export * from "./src/cli/index";
1
+ export * from './cli/index';
package/dist/cli.js ADDED
@@ -0,0 +1,5 @@
1
+ export * from "./cli/index.js";
2
+
3
+ ;// CONCATENATED MODULE: ./src/cli.ts
4
+
5
+
@@ -0,0 +1,51 @@
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
+ TEMP_DIR: () => (TEMP_DIR)
42
+ });
43
+ const TEMP_DIR = '.mf';
44
+
45
+ exports.TEMP_DIR = __webpack_exports__.TEMP_DIR;
46
+ for(var __webpack_i__ in __webpack_exports__) {
47
+ if(["TEMP_DIR"].indexOf(__webpack_i__) === -1) {
48
+ exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
49
+ }
50
+ }
51
+ Object.defineProperty(exports, '__esModule', { value: true });
@@ -0,0 +1 @@
1
+ export declare const TEMP_DIR = ".mf";
@@ -0,0 +1,5 @@
1
+
2
+ ;// CONCATENATED MODULE: ./src/common/constant.ts
3
+ const TEMP_DIR = '.mf';
4
+
5
+ export { TEMP_DIR };
@@ -0,0 +1,95 @@
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
+ "./constant": (function (module) {
11
+ module.exports = require("./constant.cjs");
12
+
13
+ }),
14
+
15
+ });
16
+ /************************************************************************/
17
+ // The module cache
18
+ var __webpack_module_cache__ = {};
19
+
20
+ // The require function
21
+ function __webpack_require__(moduleId) {
22
+
23
+ // Check if module is in cache
24
+ var cachedModule = __webpack_module_cache__[moduleId];
25
+ if (cachedModule !== undefined) {
26
+ return cachedModule.exports;
27
+ }
28
+ // Create a new module (and put it into the cache)
29
+ var module = (__webpack_module_cache__[moduleId] = {
30
+ exports: {}
31
+ });
32
+ // Execute the module function
33
+ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
34
+
35
+ // Return the exports of the module
36
+ return module.exports;
37
+
38
+ }
39
+
40
+ /************************************************************************/
41
+ // webpack/runtime/compat_get_default_export
42
+ (() => {
43
+ // getDefaultExport function for compatibility with non-ESM modules
44
+ __webpack_require__.n = (module) => {
45
+ var getter = module && module.__esModule ?
46
+ () => (module['default']) :
47
+ () => (module);
48
+ __webpack_require__.d(getter, { a: getter });
49
+ return getter;
50
+ };
51
+
52
+ })();
53
+ // webpack/runtime/define_property_getters
54
+ (() => {
55
+ __webpack_require__.d = (exports, definition) => {
56
+ for(var key in definition) {
57
+ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
58
+ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
59
+ }
60
+ }
61
+ };
62
+ })();
63
+ // webpack/runtime/has_own_property
64
+ (() => {
65
+ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
66
+ })();
67
+ // webpack/runtime/make_namespace_object
68
+ (() => {
69
+ // define __esModule on exports
70
+ __webpack_require__.r = (exports) => {
71
+ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
72
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
73
+ }
74
+ Object.defineProperty(exports, '__esModule', { value: true });
75
+ };
76
+ })();
77
+ /************************************************************************/
78
+ var __webpack_exports__ = {};
79
+ // This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk.
80
+ (() => {
81
+ __webpack_require__.r(__webpack_exports__);
82
+ /* ESM import */var _constant__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./constant");
83
+ /* ESM import */var _constant__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_constant__WEBPACK_IMPORTED_MODULE_0__);
84
+
85
+ /* ESM reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {};
86
+ /* ESM reexport (unknown) */ for( var __WEBPACK_IMPORT_KEY__ in _constant__WEBPACK_IMPORTED_MODULE_0__) if(__WEBPACK_IMPORT_KEY__ !== "default") __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] =function(key) { return _constant__WEBPACK_IMPORTED_MODULE_0__[key]; }.bind(0, __WEBPACK_IMPORT_KEY__)
87
+ /* ESM reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
88
+
89
+
90
+ })();
91
+
92
+ for(var __webpack_i__ in __webpack_exports__) {
93
+ exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
94
+ }
95
+ Object.defineProperty(exports, '__esModule', { value: true });
@@ -0,0 +1 @@
1
+ export * from './constant';
@@ -0,0 +1,5 @@
1
+ export * from "./constant.js";
2
+
3
+ ;// CONCATENATED MODULE: ./src/common/index.ts
4
+
5
+
@@ -0,0 +1,100 @@
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/compat_get_default_export
14
+ (() => {
15
+ // getDefaultExport function for compatibility with non-ESM modules
16
+ __webpack_require__.n = (module) => {
17
+ var getter = module && module.__esModule ?
18
+ () => (module['default']) :
19
+ () => (module);
20
+ __webpack_require__.d(getter, { a: getter });
21
+ return getter;
22
+ };
23
+
24
+ })();
25
+ // webpack/runtime/define_property_getters
26
+ (() => {
27
+ __webpack_require__.d = (exports, definition) => {
28
+ for(var key in definition) {
29
+ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
30
+ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
31
+ }
32
+ }
33
+ };
34
+ })();
35
+ // webpack/runtime/has_own_property
36
+ (() => {
37
+ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
38
+ })();
39
+ // webpack/runtime/make_namespace_object
40
+ (() => {
41
+ // define __esModule on exports
42
+ __webpack_require__.r = (exports) => {
43
+ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
44
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
45
+ }
46
+ Object.defineProperty(exports, '__esModule', { value: true });
47
+ };
48
+ })();
49
+ /************************************************************************/
50
+ var __webpack_exports__ = {};
51
+ // ESM COMPAT FLAG
52
+ __webpack_require__.r(__webpack_exports__);
53
+
54
+ // EXPORTS
55
+ __webpack_require__.d(__webpack_exports__, {
56
+ fileExistsWithCaseSync: () => (/* binding */ fileExistsWithCaseSync),
57
+ fixPrefetchPath: () => (/* binding */ fixPrefetchPath)
58
+ });
59
+
60
+ ;// CONCATENATED MODULE: external "path"
61
+ const external_path_namespaceObject = require("path");
62
+ var external_path_default = /*#__PURE__*/__webpack_require__.n(external_path_namespaceObject);
63
+ ;// CONCATENATED MODULE: external "fs-extra"
64
+ const external_fs_extra_namespaceObject = require("fs-extra");
65
+ var external_fs_extra_default = /*#__PURE__*/__webpack_require__.n(external_fs_extra_namespaceObject);
66
+ ;// CONCATENATED MODULE: ./src/common/node-utils.ts
67
+
68
+
69
+ const fileExistsWithCaseSync = (filepath)=>{
70
+ const dir = external_path_default().dirname(filepath);
71
+ if (filepath === '/' || filepath === '.') {
72
+ return true;
73
+ }
74
+ const filenames = external_fs_extra_default().readdirSync(dir);
75
+ if (filenames.indexOf(external_path_default().basename(filepath)) === -1) {
76
+ return false;
77
+ }
78
+ return fileExistsWithCaseSync(dir);
79
+ };
80
+ const fixPrefetchPath = (exposePath)=>{
81
+ const pathExt = [
82
+ '.js',
83
+ '.ts'
84
+ ];
85
+ const extReg = /\.(ts|js|tsx|jsx)$/;
86
+ if (extReg.test(exposePath)) {
87
+ return pathExt.map((ext)=>exposePath.replace(extReg, `.prefetch${ext}`));
88
+ } else {
89
+ return pathExt.map((ext)=>exposePath + `.prefetch${ext}`);
90
+ }
91
+ };
92
+
93
+ exports.fileExistsWithCaseSync = __webpack_exports__.fileExistsWithCaseSync;
94
+ exports.fixPrefetchPath = __webpack_exports__.fixPrefetchPath;
95
+ for(var __webpack_i__ in __webpack_exports__) {
96
+ if(["fileExistsWithCaseSync","fixPrefetchPath"].indexOf(__webpack_i__) === -1) {
97
+ exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
98
+ }
99
+ }
100
+ Object.defineProperty(exports, '__esModule', { value: true });
@@ -0,0 +1,2 @@
1
+ export declare const fileExistsWithCaseSync: (filepath: string) => boolean;
2
+ export declare const fixPrefetchPath: (exposePath: string) => Array<string>;
@@ -0,0 +1,35 @@
1
+ import path from "path";
2
+ import fs_extra from "fs-extra";
3
+
4
+ ;// CONCATENATED MODULE: external "path"
5
+
6
+ ;// CONCATENATED MODULE: external "fs-extra"
7
+
8
+ ;// CONCATENATED MODULE: ./src/common/node-utils.ts
9
+
10
+
11
+ const fileExistsWithCaseSync = (filepath)=>{
12
+ const dir = path.dirname(filepath);
13
+ if (filepath === '/' || filepath === '.') {
14
+ return true;
15
+ }
16
+ const filenames = fs_extra.readdirSync(dir);
17
+ if (filenames.indexOf(path.basename(filepath)) === -1) {
18
+ return false;
19
+ }
20
+ return fileExistsWithCaseSync(dir);
21
+ };
22
+ const fixPrefetchPath = (exposePath)=>{
23
+ const pathExt = [
24
+ '.js',
25
+ '.ts'
26
+ ];
27
+ const extReg = /\.(ts|js|tsx|jsx)$/;
28
+ if (extReg.test(exposePath)) {
29
+ return pathExt.map((ext)=>exposePath.replace(extReg, `.prefetch${ext}`));
30
+ } else {
31
+ return pathExt.map((ext)=>exposePath + `.prefetch${ext}`);
32
+ }
33
+ };
34
+
35
+ export { fileExistsWithCaseSync, fixPrefetchPath };
@@ -0,0 +1,84 @@
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
+ compatGetPrefetchId: () => (/* binding */ compatGetPrefetchId),
45
+ getPrefetchId: () => (/* binding */ getPrefetchId),
46
+ getSignalFromManifest: () => (/* binding */ getSignalFromManifest),
47
+ getScope: () => (/* binding */ getScope)
48
+ });
49
+
50
+ ;// CONCATENATED MODULE: external "@module-federation/runtime"
51
+ const runtime_namespaceObject = require("@module-federation/runtime");
52
+ ;// CONCATENATED MODULE: external "@module-federation/sdk"
53
+ const sdk_namespaceObject = require("@module-federation/sdk");
54
+ ;// CONCATENATED MODULE: ./src/common/runtime-utils.ts
55
+
56
+
57
+ const getScope = ()=>{
58
+ return (0,runtime_namespaceObject.getInstance)().options.name;
59
+ };
60
+ const getPrefetchId = (id)=>(0,sdk_namespaceObject.encodeName)(`${id}/${sdk_namespaceObject.MFPrefetchCommon.identifier}`);
61
+ const compatGetPrefetchId = (id)=>(0,sdk_namespaceObject.encodeName)(`${id}/VmokPrefetch`);
62
+ const getSignalFromManifest = (remoteSnapshot)=>{
63
+ if (!remoteSnapshot) {
64
+ return false;
65
+ }
66
+ if (!('prefetchEntry' in remoteSnapshot) && !('prefetchInterface' in remoteSnapshot)) {
67
+ return false;
68
+ }
69
+ if (!remoteSnapshot.prefetchEntry && !remoteSnapshot.prefetchInterface) {
70
+ return false;
71
+ }
72
+ return true;
73
+ };
74
+
75
+ exports.compatGetPrefetchId = __webpack_exports__.compatGetPrefetchId;
76
+ exports.getPrefetchId = __webpack_exports__.getPrefetchId;
77
+ exports.getScope = __webpack_exports__.getScope;
78
+ exports.getSignalFromManifest = __webpack_exports__.getSignalFromManifest;
79
+ for(var __webpack_i__ in __webpack_exports__) {
80
+ if(["compatGetPrefetchId","getPrefetchId","getScope","getSignalFromManifest"].indexOf(__webpack_i__) === -1) {
81
+ exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
82
+ }
83
+ }
84
+ Object.defineProperty(exports, '__esModule', { value: true });
@@ -0,0 +1,5 @@
1
+ import { ModuleInfo } from '@module-federation/sdk';
2
+ export declare const getScope: () => string;
3
+ export declare const getPrefetchId: (id: string) => string;
4
+ export declare const compatGetPrefetchId: (id: string) => string;
5
+ export declare const getSignalFromManifest: (remoteSnapshot: ModuleInfo) => boolean;