@umijs/mfsu 4.0.0-canary.20220429.3 → 4.0.0-canary.20220506.2

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 (55) hide show
  1. package/dist/babelPlugins/awaitImport/awaitImport.d.ts +27 -0
  2. package/dist/babelPlugins/awaitImport/awaitImport.js +120 -0
  3. package/dist/babelPlugins/awaitImport/checkMatch.d.ts +18 -0
  4. package/dist/babelPlugins/awaitImport/checkMatch.js +127 -0
  5. package/dist/babelPlugins/awaitImport/getAliasedPath.d.ts +4 -0
  6. package/dist/babelPlugins/awaitImport/getAliasedPath.js +30 -0
  7. package/dist/babelPlugins/awaitImport/getRealPath.d.ts +4 -0
  8. package/dist/babelPlugins/awaitImport/getRealPath.js +24 -0
  9. package/dist/babelPlugins/awaitImport/isExternals.d.ts +11 -0
  10. package/dist/babelPlugins/awaitImport/isExternals.js +29 -0
  11. package/dist/babelPlugins/awaitImport/parseSpecifiers.d.ts +1 -0
  12. package/dist/babelPlugins/awaitImport/parseSpecifiers.js +55 -0
  13. package/dist/constants.d.ts +7 -0
  14. package/dist/constants.js +10 -0
  15. package/dist/dep/dep.d.ts +30 -0
  16. package/dist/dep/dep.js +96 -0
  17. package/dist/dep/getCJSExports.d.ts +3 -0
  18. package/dist/dep/getCJSExports.js +58 -0
  19. package/dist/dep/getExposeFromContent.d.ts +6 -0
  20. package/dist/dep/getExposeFromContent.js +69 -0
  21. package/dist/dep/getModuleExports.d.ts +7 -0
  22. package/dist/dep/getModuleExports.js +34 -0
  23. package/dist/depBuilder/depBuilder.d.ts +30 -0
  24. package/dist/depBuilder/depBuilder.js +164 -0
  25. package/dist/depBuilder/getESBuildEntry.d.ts +4 -0
  26. package/dist/depBuilder/getESBuildEntry.js +328 -0
  27. package/dist/depInfo.d.ts +17 -0
  28. package/dist/depInfo.js +50 -0
  29. package/dist/esbuildHandlers/autoCssModules.d.ts +2 -0
  30. package/dist/esbuildHandlers/autoCssModules.js +24 -0
  31. package/dist/esbuildHandlers/awaitImport/index.d.ts +12 -0
  32. package/dist/esbuildHandlers/awaitImport/index.js +44 -0
  33. package/dist/index.d.ts +4 -0
  34. package/dist/index.js +23 -0
  35. package/dist/loader/esbuild.d.ts +5 -0
  36. package/dist/loader/esbuild.js +38 -0
  37. package/dist/mfsu.d.ts +63 -0
  38. package/dist/mfsu.js +294 -0
  39. package/dist/moduleGraph.d.ts +73 -0
  40. package/dist/moduleGraph.js +197 -0
  41. package/dist/types.d.ts +16 -0
  42. package/dist/types.js +8 -0
  43. package/dist/utils/makeArray.d.ts +1 -0
  44. package/dist/utils/makeArray.js +7 -0
  45. package/dist/utils/trimFileContent.d.ts +1 -0
  46. package/dist/utils/trimFileContent.js +7 -0
  47. package/dist/webpackPlugins/buildDepPlugin.d.ts +10 -0
  48. package/dist/webpackPlugins/buildDepPlugin.js +17 -0
  49. package/dist/webpackPlugins/depChunkIdPrefixPlugin.d.ts +5 -0
  50. package/dist/webpackPlugins/depChunkIdPrefixPlugin.js +19 -0
  51. package/dist/webpackPlugins/stripSourceMapUrlPlugin.d.ts +10 -0
  52. package/dist/webpackPlugins/stripSourceMapUrlPlugin.js +28 -0
  53. package/dist/webpackPlugins/writeCachePlugin.d.ts +10 -0
  54. package/dist/webpackPlugins/writeCachePlugin.js +15 -0
  55. package/package.json +4 -4
@@ -0,0 +1,6 @@
1
+ import { Dep } from './dep';
2
+ export declare function getExposeFromContent(opts: {
3
+ dep: Dep;
4
+ filePath: string;
5
+ content: string;
6
+ }): Promise<string>;
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getExposeFromContent = void 0;
7
+ const assert_1 = __importDefault(require("assert"));
8
+ const path_1 = require("path");
9
+ const getModuleExports_1 = require("./getModuleExports");
10
+ async function getExposeFromContent(opts) {
11
+ // Support CSS
12
+ if (opts.filePath &&
13
+ /\.(css|less|scss|sass|stylus|styl)$/.test(opts.filePath)) {
14
+ return `import '${opts.dep.file}';`;
15
+ }
16
+ // Support Assets Files
17
+ if (opts.filePath &&
18
+ /\.(json|svg|png|jpe?g|avif|gif|webp|ico|eot|woff|woff2|ttf|txt|text|mdx?)$/.test(opts.filePath)) {
19
+ return `
20
+ import _ from '${opts.dep.file}';
21
+ export default _;`.trim();
22
+ }
23
+ (0, assert_1.default)(/(js|jsx|mjs|ts|tsx)$/.test(opts.filePath), `file type not supported for ${(0, path_1.basename)(opts.filePath)}.`);
24
+ const { exports, isCJS } = await (0, getModuleExports_1.getModuleExports)({
25
+ content: opts.content,
26
+ filePath: opts.filePath,
27
+ });
28
+ // cjs
29
+ if (isCJS) {
30
+ return [
31
+ `import _ from '${opts.dep.file}';`,
32
+ `export default _;`,
33
+ `export * from '${opts.dep.file}';`,
34
+ ].join('\n');
35
+ }
36
+ // esm
37
+ else {
38
+ const ret = [];
39
+ let hasExports = false;
40
+ if (exports.includes('default')) {
41
+ ret.push(`import _ from '${opts.dep.file}';`);
42
+ ret.push(`export default _;`);
43
+ hasExports = true;
44
+ }
45
+ if (hasNonDefaultExports(exports) ||
46
+ // export * from 不会有 exports,只会有 imports
47
+ /export\s+\*\s+from/.test(opts.content)) {
48
+ ret.push(`export * from '${opts.dep.file}';`);
49
+ hasExports = true;
50
+ }
51
+ if (!hasExports) {
52
+ // 只有 __esModule 的全量导出
53
+ if (exports.includes('__esModule')) {
54
+ ret.push(`import _ from '${opts.dep.file}';`);
55
+ ret.push(`export default _;`);
56
+ ret.push(`export * from '${opts.dep.file}';`);
57
+ }
58
+ else {
59
+ ret.push(`import '${opts.dep.file}';`);
60
+ }
61
+ }
62
+ return ret.join('\n');
63
+ }
64
+ }
65
+ exports.getExposeFromContent = getExposeFromContent;
66
+ function hasNonDefaultExports(exports) {
67
+ return (exports.filter((exp) => !['__esModule', 'default'].includes(exp))
68
+ .length > 0);
69
+ }
@@ -0,0 +1,7 @@
1
+ export declare function getModuleExports({ content, filePath, }: {
2
+ filePath: string;
3
+ content: string;
4
+ }): Promise<{
5
+ exports: readonly string[];
6
+ isCJS: boolean;
7
+ }>;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getModuleExports = void 0;
4
+ const es_module_lexer_1 = require("@umijs/bundler-utils/compiled/es-module-lexer");
5
+ const esbuild_1 = require("@umijs/bundler-utils/compiled/esbuild");
6
+ const path_1 = require("path");
7
+ const getCJSExports_1 = require("./getCJSExports");
8
+ async function getModuleExports({ content, filePath, }) {
9
+ // Support tsx and jsx
10
+ if (filePath && /\.(tsx|jsx)$/.test(filePath)) {
11
+ content = (await (0, esbuild_1.transform)(content, {
12
+ sourcemap: false,
13
+ sourcefile: filePath,
14
+ format: 'esm',
15
+ target: 'es6',
16
+ loader: (0, path_1.extname)(filePath).slice(1),
17
+ })).code;
18
+ }
19
+ await es_module_lexer_1.init;
20
+ const [imports, exports] = (0, es_module_lexer_1.parse)(content);
21
+ let isCJS = !imports.length && !exports.length;
22
+ let cjsEsmExports = null;
23
+ if (isCJS) {
24
+ cjsEsmExports = (0, getCJSExports_1.getCJSExports)({ content });
25
+ if (cjsEsmExports.includes('__esModule')) {
26
+ isCJS = false;
27
+ }
28
+ }
29
+ return {
30
+ exports: cjsEsmExports || exports,
31
+ isCJS,
32
+ };
33
+ }
34
+ exports.getModuleExports = getModuleExports;
@@ -0,0 +1,30 @@
1
+ import { Dep } from '../dep/dep';
2
+ import { MFSU } from '../mfsu';
3
+ interface IOpts {
4
+ mfsu: MFSU;
5
+ }
6
+ export declare class DepBuilder {
7
+ opts: IOpts;
8
+ completeFns: Function[];
9
+ isBuilding: boolean;
10
+ constructor(opts: IOpts);
11
+ buildWithWebpack(opts: {
12
+ onBuildComplete: Function;
13
+ deps: Dep[];
14
+ }): Promise<unknown>;
15
+ buildWithESBuild(opts: {
16
+ onBuildComplete: Function;
17
+ deps: Dep[];
18
+ }): Promise<void>;
19
+ build(opts: {
20
+ deps: Dep[];
21
+ }): Promise<void>;
22
+ onBuildComplete(fn: Function): void;
23
+ writeMFFiles(opts: {
24
+ deps: Dep[];
25
+ }): Promise<void>;
26
+ getWebpackConfig(opts: {
27
+ deps: Dep[];
28
+ }): import("webpack").Configuration;
29
+ }
30
+ export {};
@@ -0,0 +1,164 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DepBuilder = void 0;
4
+ const bundler_esbuild_1 = require("@umijs/bundler-esbuild");
5
+ const utils_1 = require("@umijs/utils");
6
+ const fs_1 = require("fs");
7
+ const path_1 = require("path");
8
+ const constants_1 = require("../constants");
9
+ const depChunkIdPrefixPlugin_1 = require("../webpackPlugins/depChunkIdPrefixPlugin");
10
+ const stripSourceMapUrlPlugin_1 = require("../webpackPlugins/stripSourceMapUrlPlugin");
11
+ const getESBuildEntry_1 = require("./getESBuildEntry");
12
+ class DepBuilder {
13
+ constructor(opts) {
14
+ this.completeFns = [];
15
+ this.isBuilding = false;
16
+ this.opts = opts;
17
+ }
18
+ async buildWithWebpack(opts) {
19
+ const config = this.getWebpackConfig({ deps: opts.deps });
20
+ return new Promise((resolve, reject) => {
21
+ const compiler = this.opts.mfsu.opts.implementor(config);
22
+ compiler.run((err, stats) => {
23
+ opts.onBuildComplete();
24
+ if (err || (stats === null || stats === void 0 ? void 0 : stats.hasErrors())) {
25
+ if (err) {
26
+ reject(err);
27
+ }
28
+ if (stats) {
29
+ const errorMsg = stats.toString('errors-only');
30
+ // console.error(errorMsg);
31
+ reject(new Error(errorMsg));
32
+ }
33
+ }
34
+ else {
35
+ resolve(stats);
36
+ }
37
+ compiler.close(() => { });
38
+ });
39
+ });
40
+ }
41
+ // TODO: support watch and rebuild
42
+ async buildWithESBuild(opts) {
43
+ const entryContent = (0, getESBuildEntry_1.getESBuildEntry)({ deps: opts.deps });
44
+ const ENTRY_FILE = 'esbuild-entry.js';
45
+ const tmpDir = this.opts.mfsu.opts.tmpBase;
46
+ const entryPath = (0, path_1.join)(tmpDir, ENTRY_FILE);
47
+ (0, fs_1.writeFileSync)(entryPath, entryContent, 'utf-8');
48
+ const date = new Date().getTime();
49
+ await (0, bundler_esbuild_1.build)({
50
+ cwd: this.opts.mfsu.opts.cwd,
51
+ entry: {
52
+ [`${constants_1.MF_VA_PREFIX}remoteEntry`]: entryPath,
53
+ },
54
+ config: {
55
+ ...this.opts.mfsu.opts.depBuildConfig,
56
+ outputPath: tmpDir,
57
+ alias: this.opts.mfsu.alias,
58
+ externals: this.opts.mfsu.externals,
59
+ },
60
+ inlineStyle: true,
61
+ });
62
+ utils_1.logger.event(`[mfsu] compiled with esbuild successfully in ${+new Date() - date} ms`);
63
+ opts.onBuildComplete();
64
+ }
65
+ async build(opts) {
66
+ this.isBuilding = true;
67
+ const onBuildComplete = () => {
68
+ this.isBuilding = false;
69
+ this.completeFns.forEach((fn) => fn());
70
+ this.completeFns = [];
71
+ };
72
+ try {
73
+ await this.writeMFFiles({ deps: opts.deps });
74
+ const newOpts = {
75
+ ...opts,
76
+ onBuildComplete,
77
+ };
78
+ if (this.opts.mfsu.opts.buildDepWithESBuild) {
79
+ await this.buildWithESBuild(newOpts);
80
+ }
81
+ else {
82
+ await this.buildWithWebpack(newOpts);
83
+ }
84
+ }
85
+ catch (e) {
86
+ onBuildComplete();
87
+ throw e;
88
+ }
89
+ }
90
+ onBuildComplete(fn) {
91
+ if (this.isBuilding) {
92
+ this.completeFns.push(fn);
93
+ }
94
+ else {
95
+ fn();
96
+ }
97
+ }
98
+ async writeMFFiles(opts) {
99
+ const tmpBase = this.opts.mfsu.opts.tmpBase;
100
+ utils_1.fsExtra.mkdirpSync(tmpBase);
101
+ // expose files
102
+ for (const dep of opts.deps) {
103
+ const content = await dep.buildExposeContent();
104
+ (0, fs_1.writeFileSync)((0, path_1.join)(tmpBase, dep.filePath), content, 'utf-8');
105
+ }
106
+ // index file
107
+ (0, fs_1.writeFileSync)((0, path_1.join)(tmpBase, 'index.js'), '"😛"', 'utf-8');
108
+ }
109
+ getWebpackConfig(opts) {
110
+ var _a, _b;
111
+ const mfName = this.opts.mfsu.opts.mfName;
112
+ const depConfig = utils_1.lodash.cloneDeep(this.opts.mfsu.depConfig);
113
+ // depConfig.stats = 'none';
114
+ depConfig.entry = (0, path_1.join)(this.opts.mfsu.opts.tmpBase, 'index.js');
115
+ depConfig.output.path = this.opts.mfsu.opts.tmpBase;
116
+ // disable devtool
117
+ depConfig.devtool = false;
118
+ // disable library
119
+ // library 会影响 external 的语法,导致报错
120
+ // ref: https://github.com/umijs/plugins/blob/6d3fc2d/packages/plugin-qiankun/src/slave/index.ts#L83
121
+ if ((_a = depConfig.output) === null || _a === void 0 ? void 0 : _a.library)
122
+ delete depConfig.output.library;
123
+ if ((_b = depConfig.output) === null || _b === void 0 ? void 0 : _b.libraryTarget)
124
+ delete depConfig.output.libraryTarget;
125
+ // merge all deps to vendor
126
+ depConfig.optimization || (depConfig.optimization = {});
127
+ depConfig.optimization.splitChunks = {
128
+ chunks: 'all',
129
+ maxInitialRequests: Infinity,
130
+ minSize: 0,
131
+ cacheGroups: {
132
+ vendor: {
133
+ test: /.+/,
134
+ name(_module, _chunks, cacheGroupKey) {
135
+ return `${constants_1.MF_DEP_PREFIX}___${cacheGroupKey}`;
136
+ },
137
+ },
138
+ },
139
+ };
140
+ depConfig.plugins = depConfig.plugins || [];
141
+ depConfig.plugins.push(new depChunkIdPrefixPlugin_1.DepChunkIdPrefixPlugin());
142
+ depConfig.plugins.push(new stripSourceMapUrlPlugin_1.StripSourceMapUrlPlugin({
143
+ webpack: this.opts.mfsu.opts.implementor,
144
+ }));
145
+ depConfig.plugins.push(new this.opts.mfsu.opts.implementor.ProgressPlugin((percent, msg) => {
146
+ this.opts.mfsu.onProgress({ percent, status: msg });
147
+ }));
148
+ const exposes = opts.deps.reduce((memo, dep) => {
149
+ memo[`./${dep.file}`] = (0, path_1.join)(this.opts.mfsu.opts.tmpBase, dep.filePath);
150
+ return memo;
151
+ }, {});
152
+ depConfig.plugins.push(new this.opts.mfsu.opts.implementor.container.ModuleFederationPlugin({
153
+ library: {
154
+ type: 'global',
155
+ name: mfName,
156
+ },
157
+ name: mfName,
158
+ filename: constants_1.REMOTE_FILE_FULL,
159
+ exposes,
160
+ }));
161
+ return depConfig;
162
+ }
163
+ }
164
+ exports.DepBuilder = DepBuilder;
@@ -0,0 +1,4 @@
1
+ import { Dep } from '../dep/dep';
2
+ export declare function getESBuildEntry(opts: {
3
+ deps: Dep[];
4
+ }): string;
@@ -0,0 +1,328 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getESBuildEntry = void 0;
4
+ const constants_1 = require("../constants");
5
+ // from typescript `esModuleInterop`
6
+ const ES_INTEROP_FUNC = `__exportStar`;
7
+ const ES_INTEROP_HELPER = `
8
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9
+ if (k2 === undefined) k2 = k;
10
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
11
+ }) : (function(o, m, k, k2) {
12
+ if (k2 === undefined) k2 = k;
13
+ o[k2] = m[k];
14
+ }));
15
+ var ${ES_INTEROP_FUNC} = (this && this.__exportStar) || function(m, exports) {
16
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
17
+ };
18
+ `;
19
+ function getESBuildEntry(opts) {
20
+ return `
21
+ (function() {
22
+ /******/ "use strict";
23
+ /******/ var __webpack_modules__ = ({});
24
+ /************************************************************************/
25
+ /******/ // The module cache
26
+ /******/ var __webpack_module_cache__ = {};
27
+ /******/
28
+ /******/ // The require function
29
+ /******/ function __webpack_require__(moduleId) {
30
+ /******/ // Check if module is in cache
31
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
32
+ /******/ if (cachedModule !== undefined) {
33
+ /******/ return cachedModule.exports;
34
+ /******/ }
35
+ /******/ // Create a new module (and put it into the cache)
36
+ /******/ var module = __webpack_module_cache__[moduleId] = {
37
+ /******/ id: moduleId,
38
+ /******/ loaded: false,
39
+ /******/ exports: {}
40
+ /******/ };
41
+ /******/
42
+ /******/ // Execute the module function
43
+ /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
44
+ /******/
45
+ /******/ // Flag the module as loaded
46
+ /******/ module.loaded = true;
47
+ /******/
48
+ /******/ // Return the exports of the module
49
+ /******/ return module.exports;
50
+ /******/ }
51
+ /******/
52
+ /******/ // expose the modules object (__webpack_modules__)
53
+ /******/ __webpack_require__.m = __webpack_modules__;
54
+ /******/
55
+ /************************************************************************/
56
+ /******/ /* webpack/runtime/compat get default export */
57
+ /******/ !function() {
58
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
59
+ /******/ __webpack_require__.n = function(module) {
60
+ /******/ var getter = module && module.__esModule ?
61
+ /******/ function() { return module['default']; } :
62
+ /******/ function() { return module; };
63
+ /******/ __webpack_require__.d(getter, { a: getter });
64
+ /******/ return getter;
65
+ /******/ };
66
+ /******/ }();
67
+ /******/
68
+ /******/ /* webpack/runtime/define property getters */
69
+ /******/ !function() {
70
+ /******/ // define getter functions for harmony exports
71
+ /******/ __webpack_require__.d = function(exports, definition) {
72
+ /******/ for(var key in definition) {
73
+ /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
74
+ /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
75
+ /******/ }
76
+ /******/ }
77
+ /******/ };
78
+ /******/ }();
79
+ /******/
80
+ /******/ /* webpack/runtime/ensure chunk */
81
+ /******/ !function() {
82
+ /******/ __webpack_require__.f = {};
83
+ /******/ // This file contains only the entry chunk.
84
+ /******/ // The chunk loading function for additional chunks
85
+ /******/ __webpack_require__.e = function(chunkId) {
86
+ /******/ return Promise.all(Object.keys(__webpack_require__.f).reduce(function(promises, key) {
87
+ /******/ __webpack_require__.f[key](chunkId, promises);
88
+ /******/ return promises;
89
+ /******/ }, []));
90
+ /******/ };
91
+ /******/ }();
92
+ /******/
93
+ /******/ /* webpack/runtime/get javascript chunk filename */
94
+ /******/ !function() {
95
+ /******/ // This function allow to reference async chunks
96
+ /******/ __webpack_require__.u = function(chunkId) {
97
+ /******/ // return url for filenames based on template
98
+ /******/ return "" + "mf-dep____vendor" + "." + "8b5e340b" + ".js";
99
+ /******/ };
100
+ /******/ }();
101
+ /******/
102
+ /******/ /* webpack/runtime/get mini-css chunk filename */
103
+ /******/ !function() {
104
+ /******/ // This function allow to reference all chunks
105
+ /******/ __webpack_require__.miniCssF = function(chunkId) {
106
+ /******/ // return url for filenames based on template
107
+ /******/ return undefined;
108
+ /******/ };
109
+ /******/ }();
110
+ /******/
111
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
112
+ /******/ !function() {
113
+ /******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
114
+ /******/ }();
115
+ /******/
116
+ /******/ /* webpack/runtime/load script */
117
+ /******/ !function() {
118
+ /******/ var inProgress = {};
119
+ /******/ // data-webpack is not used as build has no uniqueName
120
+ /******/ // loadScript function to load a script via script tag
121
+ /******/ __webpack_require__.l = function(url, done, key, chunkId) {
122
+ /******/ if(inProgress[url]) { inProgress[url].push(done); return; }
123
+ /******/ var script, needAttach;
124
+ /******/ if(key !== undefined) {
125
+ /******/ var scripts = document.getElementsByTagName("script");
126
+ /******/ for(var i = 0; i < scripts.length; i++) {
127
+ /******/ var s = scripts[i];
128
+ /******/ if(s.getAttribute("src") == url) { script = s; break; }
129
+ /******/ }
130
+ /******/ }
131
+ /******/ if(!script) {
132
+ /******/ needAttach = true;
133
+ /******/ script = document.createElement('script');
134
+ /******/
135
+ /******/ script.charset = 'utf-8';
136
+ /******/ script.timeout = 120;
137
+ /******/ if (__webpack_require__.nc) {
138
+ /******/ script.setAttribute("nonce", __webpack_require__.nc);
139
+ /******/ }
140
+ /******/
141
+ /******/ script.src = url;
142
+ /******/ }
143
+ /******/ inProgress[url] = [done];
144
+ /******/ var onScriptComplete = function(prev, event) {
145
+ /******/ // avoid mem leaks in IE.
146
+ /******/ script.onerror = script.onload = null;
147
+ /******/ clearTimeout(timeout);
148
+ /******/ var doneFns = inProgress[url];
149
+ /******/ delete inProgress[url];
150
+ /******/ script.parentNode && script.parentNode.removeChild(script);
151
+ /******/ doneFns && doneFns.forEach(function(fn) { return fn(event); });
152
+ /******/ if(prev) return prev(event);
153
+ /******/ }
154
+ /******/ ;
155
+ /******/ var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);
156
+ /******/ script.onerror = onScriptComplete.bind(null, script.onerror);
157
+ /******/ script.onload = onScriptComplete.bind(null, script.onload);
158
+ /******/ needAttach && document.head.appendChild(script);
159
+ /******/ };
160
+ /******/ }();
161
+ /******/
162
+ /******/ /* webpack/runtime/make namespace object */
163
+ /******/ !function() {
164
+ /******/ // define __esModule on exports
165
+ /******/ __webpack_require__.r = function(exports) {
166
+ /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
167
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
168
+ /******/ }
169
+ /******/ Object.defineProperty(exports, '__esModule', { value: true });
170
+ /******/ };
171
+ /******/ }();
172
+ /******/
173
+ /******/ /* webpack/runtime/node module decorator */
174
+ /******/ !function() {
175
+ /******/ __webpack_require__.nmd = function(module) {
176
+ /******/ module.paths = [];
177
+ /******/ if (!module.children) module.children = [];
178
+ /******/ return module;
179
+ /******/ };
180
+ /******/ }();
181
+ /******/
182
+ /******/ /* webpack/runtime/publicPath */
183
+ /******/ !function() {
184
+ /******/ __webpack_require__.p = "/";
185
+ /******/ }();
186
+ /******/
187
+ /******/ /* webpack/runtime/jsonp chunk loading */
188
+ /******/ !function() {
189
+ /******/ // no baseURI
190
+ /******/
191
+ /******/ // object to store loaded and loading chunks
192
+ /******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
193
+ /******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
194
+ /******/ var installedChunks = {
195
+ /******/ "mf-dep_mf": 0
196
+ /******/ };
197
+ /******/
198
+ /******/ __webpack_require__.f.j = function(chunkId, promises) {
199
+ /******/ // JSONP chunk loading for javascript
200
+ /******/ var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;
201
+ /******/ if(installedChunkData !== 0) { // 0 means "already installed".
202
+ /******/
203
+ /******/ // a Promise means "currently loading".
204
+ /******/ if(installedChunkData) {
205
+ /******/ promises.push(installedChunkData[2]);
206
+ /******/ } else {
207
+ /******/ if(true) { // all chunks have JS
208
+ /******/ // setup Promise in chunk cache
209
+ /******/ var promise = new Promise(function(resolve, reject) { installedChunkData = installedChunks[chunkId] = [resolve, reject]; });
210
+ /******/ promises.push(installedChunkData[2] = promise);
211
+ /******/
212
+ /******/ // start chunk loading
213
+ /******/ var url = __webpack_require__.p + __webpack_require__.u(chunkId);
214
+ /******/ // create error before stack unwound to get useful stacktrace later
215
+ /******/ var error = new Error();
216
+ /******/ var loadingEnded = function(event) {
217
+ /******/ if(__webpack_require__.o(installedChunks, chunkId)) {
218
+ /******/ installedChunkData = installedChunks[chunkId];
219
+ /******/ if(installedChunkData !== 0) installedChunks[chunkId] = undefined;
220
+ /******/ if(installedChunkData) {
221
+ /******/ var errorType = event && (event.type === 'load' ? 'missing' : event.type);
222
+ /******/ var realSrc = event && event.target && event.target.src;
223
+ /******/ error.message = 'Loading chunk ' + chunkId + ' failed.\\n(' + errorType + ': ' + realSrc + ')';
224
+ /******/ error.name = 'ChunkLoadError';
225
+ /******/ error.type = errorType;
226
+ /******/ error.request = realSrc;
227
+ /******/ installedChunkData[1](error);
228
+ /******/ }
229
+ /******/ }
230
+ /******/ };
231
+ /******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId, chunkId);
232
+ /******/ } else installedChunks[chunkId] = 0;
233
+ /******/ }
234
+ /******/ }
235
+ /******/ };
236
+ /******/
237
+ /******/ // no prefetching
238
+ /******/
239
+ /******/ // no preloaded
240
+ /******/
241
+ /******/ // no HMR
242
+ /******/
243
+ /******/ // no HMR manifest
244
+ /******/
245
+ /******/ // no on chunks loaded
246
+ /******/
247
+ /******/ // install a JSONP callback for chunk loading
248
+ /******/ var webpackJsonpCallback = function(parentChunkLoadingFunction, data) {
249
+ /******/ var chunkIds = data[0];
250
+ /******/ var moreModules = data[1];
251
+ /******/ var runtime = data[2];
252
+ /******/ // add "moreModules" to the modules object,
253
+ /******/ // then flag all "chunkIds" as loaded and fire callback
254
+ /******/ var moduleId, chunkId, i = 0;
255
+ /******/ if(chunkIds.some(function(id) { return installedChunks[id] !== 0; })) {
256
+ /******/ for(moduleId in moreModules) {
257
+ /******/ if(__webpack_require__.o(moreModules, moduleId)) {
258
+ /******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
259
+ /******/ }
260
+ /******/ }
261
+ /******/ if(runtime) var result = runtime(__webpack_require__);
262
+ /******/ }
263
+ /******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
264
+ /******/ for(;i < chunkIds.length; i++) {
265
+ /******/ chunkId = chunkIds[i];
266
+ /******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
267
+ /******/ installedChunks[chunkId][0]();
268
+ /******/ }
269
+ /******/ installedChunks[chunkIds[i]] = 0;
270
+ /******/ }
271
+ /******/
272
+ /******/ }
273
+ /******/
274
+ /******/ var chunkLoadingGlobal = self["webpackChunk"] = self["webpackChunk"] || [];
275
+ /******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
276
+ /******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
277
+ /******/ }();
278
+ /******/
279
+ /************************************************************************/
280
+ var __webpack_exports__ = {};
281
+ (function() {
282
+ var exports = __webpack_exports__;
283
+ ${ES_INTEROP_HELPER}
284
+ var moduleMap = {
285
+ ${opts.deps.map(getDepModuleStr).join(',\n')}
286
+ };
287
+ var get = function(module, getScope) {
288
+ __webpack_require__.R = getScope;
289
+ getScope = (
290
+ __webpack_require__.o(moduleMap, module)
291
+ ? moduleMap[module]()
292
+ : Promise.resolve().then(function() {
293
+ throw new Error('Module "' + module + '" does not exist in container.');
294
+ })
295
+ );
296
+ __webpack_require__.R = undefined;
297
+ return getScope;
298
+ };
299
+ var init = function(shareScope, initScope) {
300
+ if (!__webpack_require__.S) return;
301
+ var oldScope = __webpack_require__.S["default"];
302
+ var name = "default"
303
+ if(oldScope && oldScope !== shareScope) throw new Error("Container initialization failed as it has already been initialized with a different share scope");
304
+ __webpack_require__.S[name] = shareScope;
305
+ return __webpack_require__.I(name, initScope);
306
+ };
307
+ __webpack_require__.d(exports, {
308
+ get: function() { return get; },
309
+ init: function() { return init; }
310
+ });
311
+ self.mf = __webpack_exports__;
312
+ })();
313
+ })();
314
+ `;
315
+ }
316
+ exports.getESBuildEntry = getESBuildEntry;
317
+ function getDepModuleStr(dep) {
318
+ return `
319
+ "./${dep.file}": function() {
320
+ return new Promise(resolve => {
321
+ import('./${constants_1.MF_VA_PREFIX}${dep.normalizedFile}.js').then(module => {
322
+ module.default && ${ES_INTEROP_FUNC}(module, module.default);
323
+ resolve(() => module.default || module);
324
+ });
325
+ })
326
+ }
327
+ `.trim();
328
+ }
@@ -0,0 +1,17 @@
1
+ import { MFSU } from './mfsu';
2
+ import { ModuleGraph } from './moduleGraph';
3
+ interface IOpts {
4
+ mfsu: MFSU;
5
+ }
6
+ export declare class DepInfo {
7
+ private opts;
8
+ cacheFilePath: string;
9
+ moduleGraph: ModuleGraph;
10
+ cacheDependency: object;
11
+ constructor(opts: IOpts);
12
+ shouldBuild(): false | "cacheDependency has changed" | "moduleGraph has changed";
13
+ snapshot(): void;
14
+ loadCache(): void;
15
+ writeCache(): void;
16
+ }
17
+ export {};