@module-federation/data-prefetch 2.0.0 → 2.0.1

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 (103) hide show
  1. package/dist/babel.cjs +95 -0
  2. package/dist/babel.d.ts +1 -2
  3. package/dist/babel.js +5 -0
  4. package/dist/cli/babel.cjs +115 -0
  5. package/dist/cli/babel.js +52 -0
  6. package/dist/cli/index.cjs +217 -0
  7. package/dist/{cli.esm.js → cli/index.js} +78 -73
  8. package/dist/cli.cjs +95 -0
  9. package/dist/cli.d.ts +1 -1
  10. package/dist/cli.js +5 -0
  11. package/dist/common/constant.cjs +51 -0
  12. package/dist/common/constant.js +5 -0
  13. package/dist/common/index.cjs +95 -0
  14. package/dist/common/index.js +5 -0
  15. package/dist/common/node-utils.cjs +100 -0
  16. package/dist/common/node-utils.js +35 -0
  17. package/dist/common/runtime-utils.cjs +84 -0
  18. package/dist/common/runtime-utils.js +29 -0
  19. package/dist/constant.cjs +51 -0
  20. package/dist/constant.js +5 -0
  21. package/dist/index.cjs +106 -0
  22. package/dist/index.d.ts +2 -1
  23. package/dist/index.js +7 -0
  24. package/dist/logger/index.cjs +60 -0
  25. package/dist/logger/index.js +10 -0
  26. package/dist/plugin.cjs +234 -0
  27. package/dist/plugin.d.ts +3 -2
  28. package/dist/plugin.js +173 -0
  29. package/dist/prefetch.cjs +197 -0
  30. package/dist/prefetch.js +149 -0
  31. package/dist/react/hooks.cjs +144 -0
  32. package/dist/{react.esm.js → react/hooks.js} +42 -30
  33. package/dist/react/index.cjs +95 -0
  34. package/dist/react/index.js +5 -0
  35. package/dist/react/utils.cjs +65 -0
  36. package/dist/react/utils.js +15 -0
  37. package/dist/react.cjs +95 -0
  38. package/dist/react.d.ts +1 -1
  39. package/dist/react.js +5 -0
  40. package/dist/universal/index.cjs +81 -0
  41. package/dist/{universal.esm.js → universal/index.js} +14 -10
  42. package/dist/universal.cjs +95 -0
  43. package/dist/universal.d.ts +1 -1
  44. package/dist/universal.js +5 -0
  45. package/package.json +47 -21
  46. package/dist/babel.cjs.cjs +0 -54
  47. package/dist/babel.cjs.cjs.map +0 -1
  48. package/dist/babel.cjs.d.ts +0 -2
  49. package/dist/babel.esm.js +0 -52
  50. package/dist/babel.esm.js.map +0 -1
  51. package/dist/cli.cjs.cjs +0 -156
  52. package/dist/cli.cjs.cjs.map +0 -1
  53. package/dist/cli.cjs.d.ts +0 -1
  54. package/dist/cli.esm.js.map +0 -1
  55. package/dist/constant.cjs.cjs +0 -6
  56. package/dist/constant.cjs.cjs.map +0 -1
  57. package/dist/constant.esm.js +0 -4
  58. package/dist/constant.esm.js.map +0 -1
  59. package/dist/index.cjs.cjs +0 -10
  60. package/dist/index.cjs.cjs.map +0 -1
  61. package/dist/index.cjs.d.ts +0 -1
  62. package/dist/index.cjs2.cjs +0 -8
  63. package/dist/index.cjs2.cjs.map +0 -1
  64. package/dist/index.esm.js +0 -3
  65. package/dist/index.esm.js.map +0 -1
  66. package/dist/index.esm2.js +0 -6
  67. package/dist/index.esm2.js.map +0 -1
  68. package/dist/plugin.cjs.cjs +0 -158
  69. package/dist/plugin.cjs.cjs.map +0 -1
  70. package/dist/plugin.cjs.d.ts +0 -2
  71. package/dist/plugin.esm.js +0 -153
  72. package/dist/plugin.esm.js.map +0 -1
  73. package/dist/prefetch.cjs.cjs +0 -182
  74. package/dist/prefetch.cjs.cjs.map +0 -1
  75. package/dist/prefetch.esm.js +0 -179
  76. package/dist/prefetch.esm.js.map +0 -1
  77. package/dist/react.cjs.cjs +0 -76
  78. package/dist/react.cjs.cjs.map +0 -1
  79. package/dist/react.cjs.d.ts +0 -1
  80. package/dist/react.esm.js.map +0 -1
  81. package/dist/runtime-utils.cjs.cjs +0 -29
  82. package/dist/runtime-utils.cjs.cjs.map +0 -1
  83. package/dist/runtime-utils.esm.js +0 -24
  84. package/dist/runtime-utils.esm.js.map +0 -1
  85. package/dist/src/index.d.ts +0 -2
  86. package/dist/src/plugin.d.ts +0 -3
  87. package/dist/universal.cjs.cjs +0 -30
  88. package/dist/universal.cjs.cjs.map +0 -1
  89. package/dist/universal.cjs.d.ts +0 -1
  90. package/dist/universal.esm.js.map +0 -1
  91. /package/dist/{src/cli → cli}/babel.d.ts +0 -0
  92. /package/dist/{src/cli → cli}/index.d.ts +0 -0
  93. /package/dist/{src/common → common}/constant.d.ts +0 -0
  94. /package/dist/{src/common → common}/index.d.ts +0 -0
  95. /package/dist/{src/common → common}/node-utils.d.ts +0 -0
  96. /package/dist/{src/common → common}/runtime-utils.d.ts +0 -0
  97. /package/dist/{src/constant.d.ts → constant.d.ts} +0 -0
  98. /package/dist/{src/logger → logger}/index.d.ts +0 -0
  99. /package/dist/{src/prefetch.d.ts → prefetch.d.ts} +0 -0
  100. /package/dist/{src/react → react}/hooks.d.ts +0 -0
  101. /package/dist/{src/react → react}/index.d.ts +0 -0
  102. /package/dist/{src/react → react}/utils.d.ts +0 -0
  103. /package/dist/{src/universal → universal}/index.d.ts +0 -0
@@ -1,49 +1,47 @@
1
- import path from 'path';
2
- import fs from 'fs-extra';
3
- import { createInfrastructureLogger, createLogger, bindLoggerToCompiler, encodeName, MFPrefetchCommon } from '@module-federation/sdk';
4
- import { normalizeWebpackPath } from '@module-federation/sdk/normalize-webpack-path';
5
- import { b as getPrefetchId } from './runtime-utils.esm.js';
6
- import { S as SHARED_STRATEGY } from './constant.esm.js';
7
-
8
- const TEMP_DIR = '.mf';
9
-
10
- const fileExistsWithCaseSync = (filepath) => {
11
- const dir = path.dirname(filepath);
12
- if (filepath === '/' || filepath === '.') {
13
- return true;
14
- }
15
- const filenames = fs.readdirSync(dir);
16
- if (filenames.indexOf(path.basename(filepath)) === -1) {
17
- return false;
18
- }
19
- return fileExistsWithCaseSync(dir);
20
- };
21
- const fixPrefetchPath = (exposePath) => {
22
- const pathExt = ['.js', '.ts'];
23
- const extReg = /\.(ts|js|tsx|jsx)$/;
24
- if (extReg.test(exposePath)) {
25
- return pathExt.map((ext) => exposePath.replace(extReg, `.prefetch${ext}`));
26
- }
27
- else {
28
- return pathExt.map((ext) => exposePath + `.prefetch${ext}`);
29
- }
30
- };
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
+
31
34
 
32
35
  const { RuntimeGlobals, Template } = require(normalizeWebpackPath('webpack'));
33
- const createBundlerLogger = typeof createInfrastructureLogger === 'function'
34
- ? createInfrastructureLogger
35
- : createLogger;
36
+ const createBundlerLogger = typeof createInfrastructureLogger === 'function' ? createInfrastructureLogger : createLogger;
36
37
  const logger = createBundlerLogger('[ Module Federation Data Prefetch Plugin ]');
37
38
  function getFederationGlobalScope(runtimeGlobals) {
38
39
  return `${runtimeGlobals.require || '__webpack_require__'}.federation`;
39
40
  }
40
41
  class PrefetchPlugin {
41
- constructor(options) {
42
- this.options = options;
43
- this._reWriteExports = '';
44
- }
42
+ // eslint-disable-next-line max-lines-per-function
45
43
  apply(compiler) {
46
- var _a;
44
+ var _this_options_runtimePlugins;
47
45
  bindLoggerToCompiler(logger, compiler, 'PrefetchPlugin');
48
46
  const { name, exposes } = this.options;
49
47
  if (!exposes) {
@@ -57,7 +55,7 @@ class PrefetchPlugin {
57
55
  this.options.runtimePlugins = [];
58
56
  }
59
57
  const runtimePath = path.resolve(__dirname, './plugin.esm.js');
60
- if (!((_a = this.options.runtimePlugins) === null || _a === void 0 ? void 0 : _a.includes(runtimePath))) {
58
+ if (!((_this_options_runtimePlugins = this.options.runtimePlugins) === null || _this_options_runtimePlugins === void 0 ? void 0 : _this_options_runtimePlugins.includes(runtimePath))) {
61
59
  this.options.runtimePlugins.push(runtimePath);
62
60
  }
63
61
  if (this.options.shareStrategy !== SHARED_STRATEGY) {
@@ -66,26 +64,28 @@ class PrefetchPlugin {
66
64
  }
67
65
  const encodedName = encodeName(name);
68
66
  const asyncEntryPath = path.resolve(compiler.options.context, `node_modules/${TEMP_DIR}/${encodedName}/bootstrap.js`);
69
- if (fs.existsSync(asyncEntryPath)) {
70
- fs.unlinkSync(asyncEntryPath);
67
+ if (fs_extra.existsSync(asyncEntryPath)) {
68
+ fs_extra.unlinkSync(asyncEntryPath);
71
69
  }
72
70
  if (!this.options.dataPrefetch) {
73
71
  return;
74
72
  }
73
+ const prefetchs = [];
75
74
  const exposeAlias = Object.keys(exposes);
76
- exposeAlias.forEach((alias) => {
75
+ exposeAlias.forEach((alias)=>{
77
76
  let exposePath;
77
+ // @ts-ignore
78
78
  const exposeValue = exposes[alias];
79
79
  if (typeof exposeValue === 'string') {
80
80
  exposePath = exposeValue;
81
- }
82
- else {
81
+ } else {
83
82
  exposePath = exposeValue.import[0];
84
83
  }
85
84
  const targetPaths = fixPrefetchPath(exposePath);
86
- for (const pathItem of targetPaths) {
85
+ for (const pathItem of targetPaths){
87
86
  const absolutePath = path.resolve(compiler.options.context, pathItem);
88
87
  if (fileExistsWithCaseSync(absolutePath)) {
88
+ prefetchs.push(pathItem);
89
89
  const absoluteAlias = alias.replace('.', '');
90
90
  this._reWriteExports += `export * as ${getPrefetchId(`${name}${absoluteAlias}`)} from '${absolutePath}';\n`;
91
91
  break;
@@ -96,15 +96,15 @@ class PrefetchPlugin {
96
96
  return;
97
97
  }
98
98
  const tempDirRealPath = path.resolve(compiler.options.context, 'node_modules', TEMP_DIR);
99
- if (!fs.existsSync(tempDirRealPath)) {
100
- fs.mkdirSync(tempDirRealPath);
99
+ if (!fs_extra.existsSync(tempDirRealPath)) {
100
+ fs_extra.mkdirSync(tempDirRealPath);
101
101
  }
102
- if (!fs.existsSync(`${tempDirRealPath}/${encodedName}`)) {
103
- fs.mkdirSync(`${tempDirRealPath}/${encodedName}`);
102
+ if (!fs_extra.existsSync(`${tempDirRealPath}/${encodedName}`)) {
103
+ fs_extra.mkdirSync(`${tempDirRealPath}/${encodedName}`);
104
104
  }
105
- fs.writeFileSync(asyncEntryPath, this._reWriteExports);
105
+ fs_extra.writeFileSync(asyncEntryPath, this._reWriteExports);
106
106
  new compiler.webpack.DefinePlugin({
107
- FederationDataPrefetch: JSON.stringify(asyncEntryPath),
107
+ FederationDataPrefetch: JSON.stringify(asyncEntryPath)
108
108
  }).apply(compiler);
109
109
  }
110
110
  static addRuntime(compiler, options) {
@@ -115,39 +115,44 @@ class PrefetchPlugin {
115
115
  const prefetchEntry = path.resolve(compiler.options.context, `node_modules/.mf/${encodedName}/bootstrap.js`);
116
116
  const federationGlobal = getFederationGlobalScope(RuntimeGlobals || {});
117
117
  return Template.asString([
118
- fs.existsSync(prefetchEntry)
119
- ? Template.indent([
120
- 'function injectPrefetch() {',
121
- Template.indent([
122
- `globalThis.__FEDERATION__ = globalThis.__FEDERATION__ || {};`,
123
- `globalThis.__FEDERATION__['${MFPrefetchCommon.globalKey}'] = globalThis.__FEDERATION__['${MFPrefetchCommon.globalKey}'] || {`,
124
- `entryLoading: {},`,
125
- `instance: new Map(),`,
126
- `__PREFETCH_EXPORTS__: {},`,
127
- `};`,
128
- `globalThis.__FEDERATION__['${MFPrefetchCommon.globalKey}']['${MFPrefetchCommon.exportsKey}'] = globalThis.__FEDERATION__['${MFPrefetchCommon.globalKey}']['${MFPrefetchCommon.exportsKey}'] || {};`,
129
- `globalThis.__FEDERATION__['${MFPrefetchCommon.globalKey}']['${MFPrefetchCommon.exportsKey}']['${options.name}'] = function(){ return import('${prefetchEntry}');}`,
130
- ]),
131
- '}',
132
- `${federationGlobal}.prefetch = injectPrefetch`,
133
- ])
134
- : '',
118
+ fs_extra.existsSync(prefetchEntry) ? Template.indent([
119
+ 'function injectPrefetch() {',
120
+ Template.indent([
121
+ `globalThis.__FEDERATION__ = globalThis.__FEDERATION__ || {};`,
122
+ `globalThis.__FEDERATION__['${MFPrefetchCommon.globalKey}'] = globalThis.__FEDERATION__['${MFPrefetchCommon.globalKey}'] || {`,
123
+ `entryLoading: {},`,
124
+ `instance: new Map(),`,
125
+ `__PREFETCH_EXPORTS__: {},`,
126
+ `};`,
127
+ `globalThis.__FEDERATION__['${MFPrefetchCommon.globalKey}']['${MFPrefetchCommon.exportsKey}'] = globalThis.__FEDERATION__['${MFPrefetchCommon.globalKey}']['${MFPrefetchCommon.exportsKey}'] || {};`,
128
+ `globalThis.__FEDERATION__['${MFPrefetchCommon.globalKey}']['${MFPrefetchCommon.exportsKey}']['${options.name}'] = function(){ return import('${prefetchEntry}');}`
129
+ ]),
130
+ '}',
131
+ `${federationGlobal}.prefetch = injectPrefetch`
132
+ ]) : '',
135
133
  Template.indent([
136
134
  `if(!${federationGlobal}.isMFRemote && ${federationGlobal}.prefetch){`,
137
135
  `${federationGlobal}.prefetch()`,
138
- '}',
139
- ]),
136
+ '}'
137
+ ])
140
138
  ]);
141
139
  }
142
140
  static setRemoteIdentifier() {
143
141
  const federationGlobal = getFederationGlobalScope(RuntimeGlobals || {});
144
- return Template.indent([`${federationGlobal}.isMFRemote = true;`]);
142
+ return Template.indent([
143
+ `${federationGlobal}.isMFRemote = true;`
144
+ ]);
145
145
  }
146
146
  static removeRemoteIdentifier() {
147
147
  const federationGlobal = getFederationGlobalScope(RuntimeGlobals || {});
148
- return Template.indent([`${federationGlobal}.isMFRemote = false;`]);
148
+ return Template.indent([
149
+ `${federationGlobal}.isMFRemote = false;`
150
+ ]);
151
+ }
152
+ constructor(options){
153
+ this.options = options;
154
+ this._reWriteExports = '';
149
155
  }
150
156
  }
151
157
 
152
158
  export { PrefetchPlugin, getFederationGlobalScope };
153
- //# sourceMappingURL=cli.esm.js.map
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.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,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,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,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 };