@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.
- package/dist/babel.cjs +95 -0
- package/dist/babel.d.ts +1 -2
- package/dist/babel.js +5 -0
- package/dist/cli/babel.cjs +115 -0
- package/dist/cli/babel.js +52 -0
- package/dist/cli/index.cjs +217 -0
- package/dist/{cli.esm.js → cli/index.js} +78 -73
- package/dist/cli.cjs +95 -0
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +5 -0
- package/dist/common/constant.cjs +51 -0
- package/dist/common/constant.js +5 -0
- package/dist/common/index.cjs +95 -0
- package/dist/common/index.js +5 -0
- package/dist/common/node-utils.cjs +100 -0
- package/dist/common/node-utils.js +35 -0
- package/dist/common/runtime-utils.cjs +84 -0
- package/dist/common/runtime-utils.js +29 -0
- package/dist/constant.cjs +51 -0
- package/dist/constant.js +5 -0
- package/dist/index.cjs +106 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +7 -0
- package/dist/logger/index.cjs +60 -0
- package/dist/logger/index.js +10 -0
- package/dist/plugin.cjs +234 -0
- package/dist/plugin.d.ts +3 -2
- package/dist/plugin.js +173 -0
- package/dist/prefetch.cjs +197 -0
- package/dist/prefetch.js +149 -0
- package/dist/react/hooks.cjs +144 -0
- package/dist/{react.esm.js → react/hooks.js} +42 -30
- package/dist/react/index.cjs +95 -0
- package/dist/react/index.js +5 -0
- package/dist/react/utils.cjs +65 -0
- package/dist/react/utils.js +15 -0
- package/dist/react.cjs +95 -0
- package/dist/react.d.ts +1 -1
- package/dist/react.js +5 -0
- package/dist/universal/index.cjs +81 -0
- package/dist/{universal.esm.js → universal/index.js} +14 -10
- package/dist/universal.cjs +95 -0
- package/dist/universal.d.ts +1 -1
- package/dist/universal.js +5 -0
- package/package.json +47 -21
- package/dist/babel.cjs.cjs +0 -54
- package/dist/babel.cjs.cjs.map +0 -1
- package/dist/babel.cjs.d.ts +0 -2
- package/dist/babel.esm.js +0 -52
- package/dist/babel.esm.js.map +0 -1
- package/dist/cli.cjs.cjs +0 -156
- package/dist/cli.cjs.cjs.map +0 -1
- package/dist/cli.cjs.d.ts +0 -1
- package/dist/cli.esm.js.map +0 -1
- package/dist/constant.cjs.cjs +0 -6
- package/dist/constant.cjs.cjs.map +0 -1
- package/dist/constant.esm.js +0 -4
- package/dist/constant.esm.js.map +0 -1
- package/dist/index.cjs.cjs +0 -10
- package/dist/index.cjs.cjs.map +0 -1
- package/dist/index.cjs.d.ts +0 -1
- package/dist/index.cjs2.cjs +0 -8
- package/dist/index.cjs2.cjs.map +0 -1
- package/dist/index.esm.js +0 -3
- package/dist/index.esm.js.map +0 -1
- package/dist/index.esm2.js +0 -6
- package/dist/index.esm2.js.map +0 -1
- package/dist/plugin.cjs.cjs +0 -158
- package/dist/plugin.cjs.cjs.map +0 -1
- package/dist/plugin.cjs.d.ts +0 -2
- package/dist/plugin.esm.js +0 -153
- package/dist/plugin.esm.js.map +0 -1
- package/dist/prefetch.cjs.cjs +0 -182
- package/dist/prefetch.cjs.cjs.map +0 -1
- package/dist/prefetch.esm.js +0 -179
- package/dist/prefetch.esm.js.map +0 -1
- package/dist/react.cjs.cjs +0 -76
- package/dist/react.cjs.cjs.map +0 -1
- package/dist/react.cjs.d.ts +0 -1
- package/dist/react.esm.js.map +0 -1
- package/dist/runtime-utils.cjs.cjs +0 -29
- package/dist/runtime-utils.cjs.cjs.map +0 -1
- package/dist/runtime-utils.esm.js +0 -24
- package/dist/runtime-utils.esm.js.map +0 -1
- package/dist/src/index.d.ts +0 -2
- package/dist/src/plugin.d.ts +0 -3
- package/dist/universal.cjs.cjs +0 -30
- package/dist/universal.cjs.cjs.map +0 -1
- package/dist/universal.cjs.d.ts +0 -1
- package/dist/universal.esm.js.map +0 -1
- /package/dist/{src/cli → cli}/babel.d.ts +0 -0
- /package/dist/{src/cli → cli}/index.d.ts +0 -0
- /package/dist/{src/common → common}/constant.d.ts +0 -0
- /package/dist/{src/common → common}/index.d.ts +0 -0
- /package/dist/{src/common → common}/node-utils.d.ts +0 -0
- /package/dist/{src/common → common}/runtime-utils.d.ts +0 -0
- /package/dist/{src/constant.d.ts → constant.d.ts} +0 -0
- /package/dist/{src/logger → logger}/index.d.ts +0 -0
- /package/dist/{src/prefetch.d.ts → prefetch.d.ts} +0 -0
- /package/dist/{src/react → react}/hooks.d.ts +0 -0
- /package/dist/{src/react → react}/index.d.ts +0 -0
- /package/dist/{src/react → react}/utils.d.ts +0 -0
- /package/dist/{src/universal → universal}/index.d.ts +0 -0
|
@@ -1,49 +1,47 @@
|
|
|
1
|
-
import path from
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import { normalizeWebpackPath } from
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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
|
-
|
|
42
|
-
this.options = options;
|
|
43
|
-
this._reWriteExports = '';
|
|
44
|
-
}
|
|
42
|
+
// eslint-disable-next-line max-lines-per-function
|
|
45
43
|
apply(compiler) {
|
|
46
|
-
var
|
|
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 (!((
|
|
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 (
|
|
70
|
-
|
|
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 (!
|
|
100
|
-
|
|
99
|
+
if (!fs_extra.existsSync(tempDirRealPath)) {
|
|
100
|
+
fs_extra.mkdirSync(tempDirRealPath);
|
|
101
101
|
}
|
|
102
|
-
if (!
|
|
103
|
-
|
|
102
|
+
if (!fs_extra.existsSync(`${tempDirRealPath}/${encodedName}`)) {
|
|
103
|
+
fs_extra.mkdirSync(`${tempDirRealPath}/${encodedName}`);
|
|
104
104
|
}
|
|
105
|
-
|
|
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
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
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([
|
|
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([
|
|
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
|
|
1
|
+
export * from './cli/index';
|
package/dist/cli.js
ADDED
|
@@ -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,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,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 };
|