@umijs/mfsu 4.0.0-beta.7 → 4.0.0-beta.8

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 (39) hide show
  1. package/compiled/webpack-virtual-modules/LICENSE +21 -0
  2. package/compiled/webpack-virtual-modules/index.js +1 -0
  3. package/compiled/webpack-virtual-modules/package.json +1 -0
  4. package/dist/babelPlugins/autoExport.d.ts.map +1 -0
  5. package/dist/babelPlugins/awaitImport/awaitImport.d.ts +5 -3
  6. package/dist/babelPlugins/awaitImport/awaitImport.d.ts.map +1 -0
  7. package/dist/babelPlugins/awaitImport/awaitImport.js +21 -89
  8. package/dist/babelPlugins/awaitImport/checkMatch.d.ts.map +1 -0
  9. package/dist/babelPlugins/awaitImport/getAliasedPath.d.ts.map +1 -0
  10. package/dist/babelPlugins/awaitImport/getRealPath.d.ts.map +1 -0
  11. package/dist/babelPlugins/awaitImport/isExternals.d.ts.map +1 -0
  12. package/dist/babelPlugins/awaitImport/parseSpecifiers.d.ts.map +1 -0
  13. package/dist/constants.d.ts.map +1 -0
  14. package/dist/dep/dep.d.ts +1 -0
  15. package/dist/dep/dep.d.ts.map +1 -0
  16. package/dist/dep/getCJSExports.d.ts.map +1 -0
  17. package/dist/dep/getExposeFromContent.d.ts +1 -0
  18. package/dist/dep/getExposeFromContent.d.ts.map +1 -0
  19. package/dist/dep/getModuleExports.d.ts.map +1 -0
  20. package/dist/depBuilder/depBuilder.d.ts +1 -0
  21. package/dist/depBuilder/depBuilder.d.ts.map +1 -0
  22. package/dist/depBuilder/getESBuildEntry.d.ts +1 -0
  23. package/dist/depBuilder/getESBuildEntry.d.ts.map +1 -0
  24. package/dist/depInfo.d.ts +1 -0
  25. package/dist/depInfo.d.ts.map +1 -0
  26. package/dist/index.d.ts +1 -0
  27. package/dist/index.d.ts.map +1 -0
  28. package/dist/mfsu.d.ts +1 -0
  29. package/dist/mfsu.d.ts.map +1 -0
  30. package/dist/mfsu.js +17 -0
  31. package/dist/moduleGraph.d.ts.map +1 -0
  32. package/dist/types.d.ts.map +1 -0
  33. package/dist/utils/makeArray.d.ts.map +1 -0
  34. package/dist/utils/trimFileContent.d.ts.map +1 -0
  35. package/dist/webpackPlugins/buildDepPlugin.d.ts.map +1 -0
  36. package/dist/webpackPlugins/depChunkIdPrefixPlugin.d.ts.map +1 -0
  37. package/dist/webpackPlugins/stripSourceMapUrlPlugin.d.ts.map +1 -0
  38. package/dist/webpackPlugins/writeCachePlugin.d.ts.map +1 -0
  39. package/package.json +12 -7
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2017 SysGears
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ (function(){"use strict";var e={636:function(e,t,r){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const a=i(r(622));const s=r(570);let n=45e6;function checkActivation(e){if(!e._compiler){throw new Error("You must use this plugin only after creating webpack instance!")}}function getModulePath(e,t){return a.default.isAbsolute(e)?e:a.default.join(t.context,e)}function createWebpackData(e){return t=>{if(t._data){const r=t._currentLevel;const i=t._levels[r];return{result:e,level:i}}return[null,e]}}function getData(e,t){if(e._data instanceof Map){return e._data.get(t)}else if(e._data){return e.data[t]}else if(e.data instanceof Map){return e.data.get(t)}else{return e.data[t]}}function setData(e,t,r){const i=r(e);if(e._data instanceof Map){e._data.set(t,i)}else if(e._data){e.data[t]=i}else if(e.data instanceof Map){e.data.set(t,i)}else{e.data[t]=i}}function getStatStorage(e){if(e._statStorage){return e._statStorage}else if(e._statBackend){return e._statBackend}else{throw new Error("Couldn't find a stat storage")}}function getFileStorage(e){if(e._readFileStorage){return e._readFileStorage}else if(e._readFileBackend){return e._readFileBackend}else{throw new Error("Couldn't find a readFileStorage")}}function getReadDirBackend(e){if(e._readdirBackend){return e._readdirBackend}else if(e._readdirStorage){return e._readdirStorage}else{throw new Error("Couldn't find a readDirStorage from Webpack Internals")}}class VirtualModulesPlugin{constructor(e){this._compiler=null;this._watcher=null;this._staticModules=e||null}writeModule(e,t){if(!this._compiler){throw new Error(`Plugin has not been initialized`)}checkActivation(this);const r=t?t.length:0;const i=Date.now();const a=new Date(i);const o=new s.VirtualStats({dev:8675309,nlink:0,uid:1e3,gid:1e3,rdev:0,blksize:4096,ino:n++,mode:33188,size:r,blocks:Math.floor(r/4096),atime:a,mtime:a,ctime:a,birthtime:a});const l=getModulePath(e,this._compiler);if(process.env.WVM_DEBUG)console.log(this._compiler.name,"Write virtual module:",l,t);let c=this._watcher&&this._watcher.watchFileSystem;while(c&&c.wfs){c=c.wfs}let u=this._compiler.inputFileSystem;while(u&&u._inputFileSystem){u=u._inputFileSystem}u._writeVirtualFile(l,o,t);if(c&&(c.watcher.fileWatchers.size||c.watcher.fileWatchers.length)){const t=c.watcher.fileWatchers instanceof Map?Array.from(c.watcher.fileWatchers.values()):c.watcher.fileWatchers;for(const r of t){if(r.path===l){if(process.env.DEBUG)console.log(this._compiler.name,"Emit file change:",l,i);delete r.directoryWatcher._cachedTimeInfoEntries;r.directoryWatcher.setFileTime(e,i,false,false,null);r.emit("change",i,null)}}}}apply(e){this._compiler=e;const afterEnvironmentHook=()=>{let t=e.inputFileSystem;while(t&&t._inputFileSystem){t=t._inputFileSystem}if(!t._writeVirtualFile){const e=t.purge;t.purge=()=>{e.apply(t,[]);if(t._virtualFiles){Object.keys(t._virtualFiles).forEach((e=>{const r=t._virtualFiles[e];t._writeVirtualFile(e,r.stats,r.contents)}))}};t._writeVirtualFile=(e,r,i)=>{const o=getStatStorage(t);const l=getFileStorage(t);const c=getReadDirBackend(t);t._virtualFiles=t._virtualFiles||{};t._virtualFiles[e]={stats:r,contents:i};setData(o,e,createWebpackData(r));setData(l,e,createWebpackData(i));const u=e.split(/[\\/]/);let d=u.length-1;const _=u[0]?1:0;while(d>_){const e=u.slice(0,d).join(a.default.sep)||a.default.sep;try{t.readdirSync(e)}catch(t){const i=Date.now();const a=new s.VirtualStats({dev:8675309,nlink:0,uid:1e3,gid:1e3,rdev:0,blksize:4096,ino:n++,mode:16877,size:r.size,blocks:Math.floor(r.size/4096),atime:i,mtime:i,ctime:i,birthtime:i});setData(c,e,createWebpackData([]));setData(o,e,createWebpackData(a))}let i=getData(getReadDirBackend(t),e);i=i[1]||i.result;const l=u[d];if(i.indexOf(l)<0){const r=i.concat([l]).sort();setData(getReadDirBackend(t),e,createWebpackData(r))}else{break}d--}}}};const afterResolversHook=()=>{if(this._staticModules){for(const[e,t]of Object.entries(this._staticModules)){this.writeModule(e,t)}this._staticModules=null}};const watchRunHook=(t,r)=>{this._watcher=t.compiler||t;const i=e.inputFileSystem._virtualFiles;const a=e.fileTimestamps;if(i&&a&&typeof a.set==="function"){Object.keys(i).forEach((e=>{a.set(e,+i[e].stats.mtime)}))}r()};if(e.hooks){e.hooks.afterEnvironment.tap("VirtualModulesPlugin",afterEnvironmentHook);e.hooks.afterResolvers.tap("VirtualModulesPlugin",afterResolversHook);e.hooks.watchRun.tapAsync("VirtualModulesPlugin",watchRunHook)}else{e.plugin("after-environment",afterEnvironmentHook);e.plugin("after-resolvers",afterResolversHook);e.plugin("watch-run",watchRunHook)}}}e.exports=VirtualModulesPlugin},570:function(e,t,r){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.VirtualStats=void 0;const a=i(r(619));class VirtualStats{constructor(e){for(const t in e){if(!Object.prototype.hasOwnProperty.call(e,t)){continue}this[t]=e[t]}}_checkModeProperty(e){return(this.mode&a.default.S_IFMT)===e}isDirectory(){return this._checkModeProperty(a.default.S_IFDIR)}isFile(){return this._checkModeProperty(a.default.S_IFREG)}isBlockDevice(){return this._checkModeProperty(a.default.S_IFBLK)}isCharacterDevice(){return this._checkModeProperty(a.default.S_IFCHR)}isSymbolicLink(){return this._checkModeProperty(a.default.S_IFLNK)}isFIFO(){return this._checkModeProperty(a.default.S_IFIFO)}isSocket(){return this._checkModeProperty(a.default.S_IFSOCK)}}t.VirtualStats=VirtualStats},619:function(e){e.exports=require("constants")},622:function(e){e.exports=require("path")}};var t={};function __nccwpck_require__(r){var i=t[r];if(i!==undefined){return i.exports}var a=t[r]={exports:{}};var s=true;try{e[r].call(a.exports,a,a.exports,__nccwpck_require__);s=false}finally{if(s)delete t[r]}return a.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var r=__nccwpck_require__(636);module.exports=r})();
@@ -0,0 +1 @@
1
+ {"name":"webpack-virtual-modules","author":"SysGears INC","license":"MIT"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"autoExport.d.ts","sourceRoot":"","sources":["../../src/babelPlugins/autoExport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,0CAA0C,CAAC;AAClE,OAAO,KAAK,CAAC,MAAM,2CAA2C,CAAC;AAE/D,MAAM,CAAC,OAAO;;sBAGM,MAAM,QAAQ,CAAC,EAAE,OAAO,CAAC;;EA2C5C"}
@@ -18,8 +18,10 @@ export default function (): {
18
18
  opts: IOpts;
19
19
  }): void;
20
20
  };
21
- CallExpression(path: Babel.NodePath<t.CallExpression>, { opts }: {
22
- opts: IOpts;
23
- }): void;
21
+ CallExpression: {
22
+ exit(path: Babel.NodePath<t.CallExpression>, { opts }: {
23
+ opts: IOpts;
24
+ }): void;
25
+ };
24
26
  };
25
27
  };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"awaitImport.d.ts","sourceRoot":"","sources":["../../../src/babelPlugins/awaitImport/awaitImport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,0CAA0C,CAAC;AAClE,OAAO,KAAK,CAAC,MAAM,2CAA2C,CAAC;AAG/D,MAAM,WAAW,KAAK;IACpB,eAAe,CAAC,EAAE,QAAQ,CAAC;IAC3B,SAAS,CAAC,EAAE,QAAQ,CAAC;IACrB,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAC5C,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,SAAS,CAAC,EAAE,GAAG,CAAC;CACjB;AAED,MAAM,CAAC,OAAO;;gBAME,GAAG;;;uBAaA,MAAM,QAAQ,CAAC,EAAE,OAAO,CAAC;sBAAoB,KAAK;;;;uBAwDrD,MAAM,QAAQ,CAAC,EAAE,cAAc,CAAC;sBACpB,KAAK;;;;EAuBhC"}
@@ -21,10 +21,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
21
21
  Object.defineProperty(exports, "__esModule", { value: true });
22
22
  const t = __importStar(require("@umijs/bundler-utils/compiled/babel/types"));
23
23
  const checkMatch_1 = require("./checkMatch");
24
- const parseSpecifiers_1 = require("./parseSpecifiers");
25
- function isCSS(val) {
26
- return /\.(css|less|sass|scss|stylus|styl)(\?.+?)?$/.test(val);
27
- }
28
24
  function default_1() {
29
25
  return {
30
26
  pre() {
@@ -46,9 +42,6 @@ function default_1() {
46
42
  visitor: {
47
43
  Program: {
48
44
  exit(path, { opts }) {
49
- var _a;
50
- const topDeclarations = [];
51
- const bottomDeclarations = [];
52
45
  let index = path.node.body.length - 1;
53
46
  while (index >= 0) {
54
47
  const node = path.node.body[index];
@@ -64,25 +57,8 @@ function default_1() {
64
57
  opts,
65
58
  path,
66
59
  });
67
- if (isMatch || isCSS(node.source.value)) {
68
- path.node.body.splice(index, 1);
69
- const { properties, namespaceIdentifier } = (0, parseSpecifiers_1.parseSpecifiers)(node.specifiers);
70
- const id = t.objectPattern(properties);
71
- const init = t.awaitExpression(t.callExpression(t.import(), [
72
- t.stringLiteral(isMatch ? replaceValue : node.source.value),
73
- ]));
74
- if (namespaceIdentifier) {
75
- topDeclarations.unshift(t.variableDeclaration('const', [
76
- t.variableDeclarator(namespaceIdentifier, init),
77
- properties.length &&
78
- t.variableDeclarator(id, namespaceIdentifier),
79
- ].filter(Boolean)));
80
- }
81
- else {
82
- topDeclarations.unshift(t.variableDeclaration('const', [
83
- t.variableDeclarator(id, init),
84
- ]));
85
- }
60
+ if (isMatch) {
61
+ node.source.value = replaceValue;
86
62
  }
87
63
  }
88
64
  // export * from 'x';
@@ -93,28 +69,9 @@ function default_1() {
93
69
  value: node.source.value,
94
70
  opts,
95
71
  path,
96
- isExportAll: true,
97
72
  });
98
73
  if (isMatch) {
99
- const members = ((_a = opts.exportAllMembers) === null || _a === void 0 ? void 0 : _a[node.source.value]) || [];
100
- if (members.length) {
101
- const id = t.identifier(`__all_exports_${node.source.value.replace(/([@\/\-])/g, '_')}`);
102
- const init = t.awaitExpression(t.callExpression(t.import(), [
103
- t.stringLiteral(replaceValue),
104
- ]));
105
- topDeclarations.unshift(t.variableDeclaration('const', [
106
- t.variableDeclarator(id, init),
107
- ]));
108
- // replace node with export const { a, b, c } = __all_exports
109
- // a, b, c was declared from opts.exportAllMembers
110
- path.node.body[index] = t.exportNamedDeclaration(t.variableDeclaration('const', [
111
- t.variableDeclarator(t.objectPattern(members.map((m) => t.objectProperty(t.identifier(m), t.identifier(m)))), id),
112
- ]));
113
- }
114
- // 有些 export * 只是为了类型
115
- else {
116
- path.node.body[index] = t.expressionStatement(t.numericLiteral(1));
117
- }
74
+ node.source.value = replaceValue;
118
75
  }
119
76
  }
120
77
  // export { x } from 'x';
@@ -127,56 +84,31 @@ function default_1() {
127
84
  path,
128
85
  });
129
86
  if (isMatch) {
130
- const { properties, defaultIdentifier } = (0, parseSpecifiers_1.parseSpecifiers)(node.specifiers);
131
- const id = t.objectPattern(properties);
132
- const init = t.awaitExpression(t.callExpression(t.import(), [t.stringLiteral(replaceValue)]));
133
- topDeclarations.unshift(t.variableDeclaration('const', [
134
- t.variableDeclarator(id, init),
135
- ]));
136
- node.source = null;
137
- node.specifiers = node.specifiers.filter((specifier) => {
138
- if (t.isExportSpecifier(specifier) &&
139
- t.isIdentifier(specifier.local) &&
140
- t.isIdentifier(specifier.exported)) {
141
- specifier.local = specifier.exported;
142
- }
143
- return !(t.isExportSpecifier(specifier) &&
144
- t.isIdentifier(specifier.exported) &&
145
- specifier.exported.name === 'default');
146
- });
147
- if (!node.specifiers.length) {
148
- path.node.body.splice(index, 1);
149
- }
150
- if (defaultIdentifier) {
151
- bottomDeclarations.push(t.exportDefaultDeclaration(t.identifier(defaultIdentifier)));
152
- }
87
+ node.source.value = replaceValue;
153
88
  }
154
89
  }
155
90
  index -= 1;
156
91
  }
157
- path.node.body = [
158
- ...topDeclarations,
159
- ...path.node.body,
160
- ...bottomDeclarations,
161
- ];
162
92
  },
163
93
  },
164
- CallExpression(path, { opts }) {
165
- const { node } = path;
166
- if (t.isImport(node.callee) &&
167
- node.arguments.length === 1 &&
168
- node.arguments[0].type === 'StringLiteral') {
169
- const { isMatch, replaceValue } = (0, checkMatch_1.checkMatch)({
170
- // @ts-ignore
171
- cache: this.cache,
172
- value: node.arguments[0].value,
173
- opts,
174
- path,
175
- });
176
- if (isMatch) {
177
- node.arguments[0] = t.stringLiteral(replaceValue);
94
+ CallExpression: {
95
+ exit(path, { opts }) {
96
+ const { node } = path;
97
+ if (t.isImport(node.callee) &&
98
+ node.arguments.length === 1 &&
99
+ node.arguments[0].type === 'StringLiteral') {
100
+ const { isMatch, replaceValue } = (0, checkMatch_1.checkMatch)({
101
+ // @ts-ignore
102
+ cache: this.cache,
103
+ value: node.arguments[0].value,
104
+ opts,
105
+ path,
106
+ });
107
+ if (isMatch) {
108
+ node.arguments[0] = t.stringLiteral(replaceValue);
109
+ }
178
110
  }
179
- }
111
+ },
180
112
  },
181
113
  },
182
114
  };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkMatch.d.ts","sourceRoot":"","sources":["../../../src/babelPlugins/awaitImport/checkMatch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,0CAA0C,CAAC;AAIlE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAQ3C,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,IAAI,EACJ,IAAI,EACJ,WAAW,EACX,KAAK,EACL,KAAK,GACN,EAAE;IACD,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC;IACtB,IAAI,CAAC,EAAE,KAAK,CAAC;IACb,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC1B,GAAG;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,CAoG7C;AAGD,wBAAgB,OAAO,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,KAAK,CAAA;CAAE,UAQtE"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getAliasedPath.d.ts","sourceRoot":"","sources":["../../../src/babelPlugins/awaitImport/getAliasedPath.ts"],"names":[],"mappings":"AAEA,wBAAgB,cAAc,CAAC,EAC7B,KAAK,EACL,KAAK,GACN,EAAE;IACD,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC/B,sBAwBA"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getRealPath.d.ts","sourceRoot":"","sources":["../../../src/babelPlugins/awaitImport/getRealPath.ts"],"names":[],"mappings":"AAKA,wBAAgB,WAAW,CAAC,IAAI,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,iBAe9D"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isExternals.d.ts","sourceRoot":"","sources":["../../../src/babelPlugins/awaitImport/isExternals.ts"],"names":[],"mappings":"AAAA,aAAK,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,QAAQ,CAAC;AACnD,aAAK,UAAU,GAAG,SAAS,EAAE,GAAG,SAAS,CAAC;AAE1C,wBAAgB,WAAW,CAAC,EAC1B,KAAK,EACL,SAAS,GACV,EAAE;IACD,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,UAAU,CAAC;CACvB,WAQA;AAED,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,QAAQ,GACT,EAAE;IACD,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,SAAS,CAAC;CACrB,WAYA"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parseSpecifiers.d.ts","sourceRoot":"","sources":["../../../src/babelPlugins/awaitImport/parseSpecifiers.ts"],"names":[],"mappings":"AAIA,wBAAgB,eAAe,CAAC,UAAU,EAAE,GAAG,EAAE,OAyBhD"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,WAAW,CAAC;AACrC,eAAO,MAAM,aAAa,YAAY,CAAC;AACvC,eAAO,MAAM,gBAAgB,eAAe,CAAC;AAC7C,eAAO,MAAM,eAAe,OAAO,CAAC;AACpC,eAAO,MAAM,oBAAoB,UAAU,CAAC;AAC5C,eAAO,MAAM,WAAW,mBAAmB,CAAC;AAC5C,eAAO,MAAM,gBAAgB,QAAkC,CAAC"}
package/dist/dep/dep.d.ts CHANGED
@@ -24,3 +24,4 @@ export declare class Dep {
24
24
  mfsu: MFSU;
25
25
  }): Dep[];
26
26
  }
27
+ //# sourceMappingURL=dep.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dep.d.ts","sourceRoot":"","sources":["../../src/dep/dep.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAoB/B,qBAAa,GAAG;IACP,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,IAAI,CAAC;gBACN,IAAI,EAAE;QAChB,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,GAAG,EAAE,MAAM,CAAC;QACZ,IAAI,EAAE,IAAI,CAAC;KACZ;IAUK,kBAAkB;IA8BlB,WAAW;IAUjB,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE;QACrB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,OAAO,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;QACxD,GAAG,EAAE,MAAM,CAAC;QACZ,IAAI,EAAE,IAAI,CAAC;KACZ;CASF"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getCJSExports.d.ts","sourceRoot":"","sources":["../../src/dep/getCJSExports.ts"],"names":[],"mappings":"AAAA,wBAAgB,aAAa,CAAC,EAAE,OAAO,EAAE,EAAE;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,YAoE7D"}
@@ -4,3 +4,4 @@ export declare function getExposeFromContent(opts: {
4
4
  filePath: string;
5
5
  content: string;
6
6
  }): Promise<string>;
7
+ //# sourceMappingURL=getExposeFromContent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getExposeFromContent.d.ts","sourceRoot":"","sources":["../../src/dep/getExposeFromContent.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAG5B,wBAAsB,oBAAoB,CAAC,IAAI,EAAE;IAC/C,GAAG,EAAE,GAAG,CAAC;IACT,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB,mBAoEA"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getModuleExports.d.ts","sourceRoot":"","sources":["../../src/dep/getModuleExports.ts"],"names":[],"mappings":"AAKA,wBAAsB,gBAAgB,CAAC,EACrC,OAAO,EACP,QAAQ,GACT,EAAE;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB;;;GA4BA"}
@@ -28,3 +28,4 @@ export declare class DepBuilder {
28
28
  }): import("webpack").Configuration;
29
29
  }
30
30
  export {};
31
+ //# sourceMappingURL=depBuilder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"depBuilder.d.ts","sourceRoot":"","sources":["../../src/depBuilder/depBuilder.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAK/B,UAAU,KAAK;IACb,IAAI,EAAE,IAAI,CAAC;CACZ;AAED,qBAAa,UAAU;IACd,IAAI,EAAE,KAAK,CAAC;IACZ,WAAW,EAAE,QAAQ,EAAE,CAAM;IAC7B,UAAU,UAAS;gBACd,IAAI,EAAE,KAAK;IAIjB,gBAAgB,CAAC,IAAI,EAAE;QAAE,eAAe,EAAE,QAAQ,CAAC;QAAC,IAAI,EAAE,GAAG,EAAE,CAAA;KAAE;IAwBjE,gBAAgB,CAAC,IAAI,EAAE;QAAE,eAAe,EAAE,QAAQ,CAAC;QAAC,IAAI,EAAE,GAAG,EAAE,CAAA;KAAE;IAwBjE,KAAK,CAAC,IAAI,EAAE;QAAE,IAAI,EAAE,GAAG,EAAE,CAAA;KAAE;IAkBjC,eAAe,CAAC,EAAE,EAAE,QAAQ;IAQtB,YAAY,CAAC,IAAI,EAAE;QAAE,IAAI,EAAE,GAAG,EAAE,CAAA;KAAE;IAaxC,gBAAgB,CAAC,IAAI,EAAE;QAAE,IAAI,EAAE,GAAG,EAAE,CAAA;KAAE;CA0DvC"}
@@ -2,3 +2,4 @@ import { Dep } from '../dep/dep';
2
2
  export declare function getESBuildEntry(opts: {
3
3
  deps: Dep[];
4
4
  }): string;
5
+ //# sourceMappingURL=getESBuildEntry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getESBuildEntry.d.ts","sourceRoot":"","sources":["../../src/depBuilder/getESBuildEntry.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAEjC,wBAAgB,eAAe,CAAC,IAAI,EAAE;IAAE,IAAI,EAAE,GAAG,EAAE,CAAA;CAAE,UAuSpD"}
package/dist/depInfo.d.ts CHANGED
@@ -15,3 +15,4 @@ export declare class DepInfo {
15
15
  writeCache(): void;
16
16
  }
17
17
  export {};
18
+ //# sourceMappingURL=depInfo.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"depInfo.d.ts","sourceRoot":"","sources":["../src/depInfo.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,UAAU,KAAK;IACb,IAAI,EAAE,IAAI,CAAC;CACZ;AAED,qBAAa,OAAO;IAClB,OAAO,CAAC,IAAI,CAAQ;IACb,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,WAAW,CAAqB;IAC7C,eAAe,EAAE,MAAM,CAAM;gBACxB,IAAI,EAAE,KAAK;IAKvB,WAAW;IAiBX,QAAQ;IAKR,SAAS;IAUT,UAAU;CAeX"}
package/dist/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export * from './constants';
2
2
  export * from './mfsu';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC"}
package/dist/mfsu.d.ts CHANGED
@@ -52,3 +52,4 @@ export declare class MFSU {
52
52
  })[])[];
53
53
  }
54
54
  export {};
55
+ //# sourceMappingURL=mfsu.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mfsu.d.ts","sourceRoot":"","sources":["../src/mfsu.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAG/D,OAAO,OAAO,EAAE,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAIjD,OAAO,UAAU,MAAM,2BAA2B,CAAC;AACnD,OAAO,WAAW,MAAM,wCAAwC,CAAC;AAYjE,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAK/B,UAAU,KAAK;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAC5C,kBAAkB,CAAC,EAAE,QAAQ,CAAC;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,WAAW,EAAE,OAAO,OAAO,CAAC;IAC5B,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED,qBAAa,IAAI;IACR,IAAI,EAAE,KAAK,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAM;IACnC,SAAS,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAM;IACtD,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,UAAU,CAAC;IACvB,SAAS,EAAE,aAAa,GAAG,IAAI,CAAQ;gBAClC,IAAI,EAAE,KAAK;IAYvB,gBAAgB,CAAC,IAAI,EAAE;QAAE,MAAM,EAAE,aAAa,CAAC;QAAC,SAAS,EAAE,aAAa,CAAA;KAAE;IAyDpE,SAAS;IAaf,cAAc,WAEJ,OAAO,OAAO,QAAQ,QAAQ,YAAY;IAgCpD,eAAe;;;kBAWC,MAAM;kBACN;gBACJ,SAAS,EAAE,IAAI;oBAAE,WAAW,EAAE,MAAM,CAAA;iBAAE,CAAC,CAAC;gBACxC,OAAO,EAAE,IAAI;oBAAE,WAAW,EAAE,MAAM,CAAA;iBAAE,CAAC,CAAC;aACvC;;;;;;;;CA4BZ"}
package/dist/mfsu.js CHANGED
@@ -17,6 +17,8 @@ const utils_1 = require("@umijs/utils");
17
17
  const fs_1 = require("fs");
18
18
  const path_1 = require("path");
19
19
  const mrmime_1 = require("../compiled/mrmime");
20
+ // @ts-ignore
21
+ const webpack_virtual_modules_1 = __importDefault(require("../compiled/webpack-virtual-modules"));
20
22
  const autoExport_1 = __importDefault(require("./babelPlugins/autoExport"));
21
23
  const awaitImport_1 = __importDefault(require("./babelPlugins/awaitImport/awaitImport"));
22
24
  const getRealPath_1 = require("./babelPlugins/awaitImport/getRealPath");
@@ -52,8 +54,23 @@ class MFSU {
52
54
  // set alias and externals with reference for babel plugin
53
55
  Object.assign(this.alias, ((_a = opts.config.resolve) === null || _a === void 0 ? void 0 : _a.alias) || {});
54
56
  this.externals.push(...(0, makeArray_1.makeArray)(opts.config.externals || []));
57
+ // entry
58
+ const entry = {};
59
+ const virtualModules = {};
60
+ Object.keys(opts.config.entry).forEach((key) => {
61
+ const virtualPath = `./mfsu-virtual-entry/${key}.js`;
62
+ virtualModules[virtualPath] =
63
+ // @ts-ignore
64
+ opts.config
65
+ .entry[key].map((entry) => `await import('${entry}')`)
66
+ .join('\n') + `\nexport default 1;`;
67
+ entry[key] = virtualPath;
68
+ });
69
+ opts.config.entry = entry;
70
+ // plugins
55
71
  opts.config.plugins = opts.config.plugins || [];
56
72
  opts.config.plugins.push(...[
73
+ new webpack_virtual_modules_1.default(virtualModules),
57
74
  new this.opts.implementor.container.ModuleFederationPlugin({
58
75
  name: '__',
59
76
  remotes: {
@@ -0,0 +1 @@
1
+ {"version":3,"file":"moduleGraph.d.ts","sourceRoot":"","sources":["../src/moduleGraph.ts"],"names":[],"mappings":"AAEA,cAAM,UAAU;IACd,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,kBAAyB;IAClC,eAAe,kBAAyB;IACxC,YAAY,EAAE,OAAO,CAAS;IAC9B,MAAM,EAAE,OAAO,CAAS;IACxB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAQ;gBAClB,IAAI,EAAE,MAAM;CAGzB;AAED,UAAU,IAAI;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,OAAO,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,qBAAa,WAAW;IACtB,aAAa,0BAAiC;IAC9C,YAAY,0BAAiC;IAC7C,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAM;IAC3E,WAAW,kBAAyB;;IAGpC,OAAO,CAAC,IAAI,EAAE;QACZ,KAAK,EAAE,GAAG,CAAC;QACX,WAAW,EAAE,GAAG,CAAC;QACjB,UAAU,EAAE,GAAG,CAAC;QAChB,kBAAkB,EAAE,GAAG,CAAC;KACzB;IAiCD,MAAM;;;2BAE+C,MAAM,EAAE;;;qBACf,MAAM,GAAG,IAAI;;;;;;;IAwB3D,YAAY;IAIZ,WAAW,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC;cAEd,MAAM;iBAAW,MAAM;;IAOlD,UAAU,CAAC,GAAG,EAAE,UAAU;;;;IAO1B,aAAa;IAKb,YAAY,CAAC,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,IAAI,EAAE,CAAA;KAAE;IAuBjD,YAAY,CAAC,IAAI,EAAE;QAAE,GAAG,EAAE,UAAU,CAAC;QAAC,IAAI,EAAE,IAAI,EAAE,CAAA;KAAE;IA8BpD,OAAO,CAAC,IAAI,EAAE;QACZ,IAAI,EAAE,MAAM,CAAC;QACb,YAAY,EAAE,OAAO,CAAC;QACtB,QAAQ,EAAE,UAAU,CAAC;QACrB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KACzB;IAoBD,UAAU,CAAC,IAAI,EAAE;QAAE,GAAG,EAAE,UAAU,CAAC;QAAC,QAAQ,EAAE,UAAU,CAAA;KAAE;CAiB3D"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,oBAAY,IAAI;IACd,WAAW,gBAAgB;IAC3B,UAAU,eAAe;CAC1B"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"makeArray.d.ts","sourceRoot":"","sources":["../../src/utils/makeArray.ts"],"names":[],"mappings":"AAAA,wBAAgB,SAAS,CAAC,IAAI,EAAE,GAAG,SAElC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trimFileContent.d.ts","sourceRoot":"","sources":["../../src/utils/trimFileContent.ts"],"names":[],"mappings":"AAAA,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,UAE9C"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildDepPlugin.d.ts","sourceRoot":"","sources":["../../src/webpackPlugins/buildDepPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAS,MAAM,SAAS,CAAC;AAE/C,UAAU,KAAK;IACb,aAAa,EAAE,QAAQ,CAAC;CACzB;AAID,qBAAa,cAAc;IACzB,OAAO,CAAC,IAAI,CAAQ;gBACR,IAAI,EAAE,KAAK;IAGvB,KAAK,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;CAOhC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"depChunkIdPrefixPlugin.d.ts","sourceRoot":"","sources":["../../src/webpackPlugins/depChunkIdPrefixPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAKnC,qBAAa,sBAAsB;;IAEjC,KAAK,CAAC,QAAQ,EAAE,QAAQ;CAUzB"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stripSourceMapUrlPlugin.d.ts","sourceRoot":"","sources":["../../src/webpackPlugins/stripSourceMapUrlPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAExC,UAAU,KAAK;IACb,OAAO,EAAE,GAAG,CAAC;CACd;AAED,qBAAa,uBAAuB;IAClC,IAAI,EAAE,KAAK,CAAC;gBACA,IAAI,EAAE,KAAK;IAIvB,KAAK,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;CAyBhC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"writeCachePlugin.d.ts","sourceRoot":"","sources":["../../src/webpackPlugins/writeCachePlugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAExC,UAAU,KAAK;IACb,YAAY,EAAE,QAAQ,CAAC;CACxB;AAID,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,IAAI,CAAQ;gBACR,IAAI,EAAE,KAAK;IAGvB,KAAK,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;CAQhC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umijs/mfsu",
3
- "version": "4.0.0-beta.7",
3
+ "version": "4.0.0-beta.8",
4
4
  "description": "@umijs/mfsu",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -27,22 +27,27 @@
27
27
  "access": "public"
28
28
  },
29
29
  "dependencies": {
30
- "@umijs/bundler-esbuild": "4.0.0-beta.7",
31
- "@umijs/bundler-utils": "4.0.0-beta.7",
32
- "@umijs/utils": "4.0.0-beta.7"
30
+ "@umijs/bundler-esbuild": "4.0.0-beta.8",
31
+ "@umijs/bundler-utils": "4.0.0-beta.8",
32
+ "@umijs/utils": "4.0.0-beta.8"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@types/express": "4.17.13",
36
36
  "enhanced-resolve": "5.8.3",
37
37
  "mrmime": "1.0.0",
38
- "webpack": "5.61.0"
38
+ "webpack": "5.61.0",
39
+ "webpack-virtual-modules": "0.4.3"
39
40
  },
40
41
  "compiledConfig": {
41
42
  "deps": [
42
- "mrmime"
43
+ "mrmime",
44
+ "webpack-virtual-modules"
43
45
  ],
44
46
  "externals": {
45
47
  "mrmime": "$$LOCAL"
46
- }
48
+ },
49
+ "excludeDtsDeps": [
50
+ "webpack-virtual-modules"
51
+ ]
47
52
  }
48
53
  }