@umijs/mfsu 4.0.0-canary.20220429.1 → 4.0.0-canary.20220429.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.
- package/package.json +4 -4
- package/dist/babelPlugins/awaitImport/awaitImport.d.ts +0 -27
- package/dist/babelPlugins/awaitImport/awaitImport.js +0 -120
- package/dist/babelPlugins/awaitImport/checkMatch.d.ts +0 -18
- package/dist/babelPlugins/awaitImport/checkMatch.js +0 -127
- package/dist/babelPlugins/awaitImport/getAliasedPath.d.ts +0 -4
- package/dist/babelPlugins/awaitImport/getAliasedPath.js +0 -30
- package/dist/babelPlugins/awaitImport/getRealPath.d.ts +0 -4
- package/dist/babelPlugins/awaitImport/getRealPath.js +0 -24
- package/dist/babelPlugins/awaitImport/isExternals.d.ts +0 -11
- package/dist/babelPlugins/awaitImport/isExternals.js +0 -29
- package/dist/babelPlugins/awaitImport/parseSpecifiers.d.ts +0 -1
- package/dist/babelPlugins/awaitImport/parseSpecifiers.js +0 -55
- package/dist/constants.d.ts +0 -7
- package/dist/constants.js +0 -10
- package/dist/dep/dep.d.ts +0 -30
- package/dist/dep/dep.js +0 -107
- package/dist/dep/getCJSExports.d.ts +0 -3
- package/dist/dep/getCJSExports.js +0 -58
- package/dist/dep/getExposeFromContent.d.ts +0 -6
- package/dist/dep/getExposeFromContent.js +0 -80
- package/dist/dep/getModuleExports.d.ts +0 -7
- package/dist/dep/getModuleExports.js +0 -45
- package/dist/depBuilder/depBuilder.d.ts +0 -30
- package/dist/depBuilder/depBuilder.js +0 -173
- package/dist/depBuilder/getESBuildEntry.d.ts +0 -4
- package/dist/depBuilder/getESBuildEntry.js +0 -328
- package/dist/depInfo.d.ts +0 -17
- package/dist/depInfo.js +0 -50
- package/dist/esbuildHandlers/autoCssModules.d.ts +0 -2
- package/dist/esbuildHandlers/autoCssModules.js +0 -24
- package/dist/esbuildHandlers/awaitImport/index.d.ts +0 -12
- package/dist/esbuildHandlers/awaitImport/index.js +0 -44
- package/dist/index.d.ts +0 -4
- package/dist/index.js +0 -23
- package/dist/loader/esbuild.d.ts +0 -5
- package/dist/loader/esbuild.js +0 -54
- package/dist/mfsu.d.ts +0 -63
- package/dist/mfsu.js +0 -304
- package/dist/moduleGraph.d.ts +0 -73
- package/dist/moduleGraph.js +0 -197
- package/dist/types.d.ts +0 -16
- package/dist/types.js +0 -8
- package/dist/utils/makeArray.d.ts +0 -1
- package/dist/utils/makeArray.js +0 -7
- package/dist/utils/trimFileContent.d.ts +0 -1
- package/dist/utils/trimFileContent.js +0 -7
- package/dist/webpackPlugins/buildDepPlugin.d.ts +0 -10
- package/dist/webpackPlugins/buildDepPlugin.js +0 -17
- package/dist/webpackPlugins/depChunkIdPrefixPlugin.d.ts +0 -5
- package/dist/webpackPlugins/depChunkIdPrefixPlugin.js +0 -19
- package/dist/webpackPlugins/stripSourceMapUrlPlugin.d.ts +0 -10
- package/dist/webpackPlugins/stripSourceMapUrlPlugin.js +0 -28
- package/dist/webpackPlugins/writeCachePlugin.d.ts +0 -10
- package/dist/webpackPlugins/writeCachePlugin.js +0 -15
|
@@ -1,328 +0,0 @@
|
|
|
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
|
-
}
|
package/dist/depInfo.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
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 {};
|
package/dist/depInfo.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DepInfo = void 0;
|
|
4
|
-
const utils_1 = require("@umijs/utils");
|
|
5
|
-
const fs_1 = require("fs");
|
|
6
|
-
const path_1 = require("path");
|
|
7
|
-
const moduleGraph_1 = require("./moduleGraph");
|
|
8
|
-
class DepInfo {
|
|
9
|
-
constructor(opts) {
|
|
10
|
-
this.moduleGraph = new moduleGraph_1.ModuleGraph();
|
|
11
|
-
this.cacheDependency = {};
|
|
12
|
-
this.opts = opts;
|
|
13
|
-
this.cacheFilePath = (0, path_1.join)(this.opts.mfsu.opts.tmpBase, 'MFSU_CACHE.json');
|
|
14
|
-
}
|
|
15
|
-
shouldBuild() {
|
|
16
|
-
if (!utils_1.lodash.isEqual(this.cacheDependency, this.opts.mfsu.opts.getCacheDependency())) {
|
|
17
|
-
return 'cacheDependency has changed';
|
|
18
|
-
}
|
|
19
|
-
if (this.moduleGraph.hasDepChanged()) {
|
|
20
|
-
return 'moduleGraph has changed';
|
|
21
|
-
}
|
|
22
|
-
return false;
|
|
23
|
-
}
|
|
24
|
-
snapshot() {
|
|
25
|
-
this.cacheDependency = this.opts.mfsu.opts.getCacheDependency();
|
|
26
|
-
this.moduleGraph.snapshotDeps();
|
|
27
|
-
}
|
|
28
|
-
loadCache() {
|
|
29
|
-
if ((0, fs_1.existsSync)(this.cacheFilePath)) {
|
|
30
|
-
utils_1.logger.info('MFSU restore cache');
|
|
31
|
-
const { cacheDependency, moduleGraph } = JSON.parse((0, fs_1.readFileSync)(this.cacheFilePath, 'utf-8'));
|
|
32
|
-
this.cacheDependency = cacheDependency;
|
|
33
|
-
this.moduleGraph.restore(moduleGraph);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
writeCache() {
|
|
37
|
-
utils_1.fsExtra.mkdirpSync((0, path_1.dirname)(this.cacheFilePath));
|
|
38
|
-
const newContent = JSON.stringify({
|
|
39
|
-
cacheDependency: this.cacheDependency,
|
|
40
|
-
moduleGraph: this.moduleGraph.toJSON(),
|
|
41
|
-
}, null, 2);
|
|
42
|
-
if ((0, fs_1.existsSync)(this.cacheFilePath) &&
|
|
43
|
-
(0, fs_1.readFileSync)(this.cacheFilePath, 'utf-8') === newContent) {
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
utils_1.logger.info('MFSU write cache');
|
|
47
|
-
(0, fs_1.writeFileSync)(this.cacheFilePath, newContent, 'utf-8');
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
exports.DepInfo = DepInfo;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.autoCssModulesHandler = void 0;
|
|
4
|
-
const utils_1 = require("@umijs/utils");
|
|
5
|
-
const CSS_MODULES_QUERY = '?modules';
|
|
6
|
-
const QUERY_LENGTH = CSS_MODULES_QUERY.length;
|
|
7
|
-
function autoCssModulesHandler(opts) {
|
|
8
|
-
let { code } = opts;
|
|
9
|
-
let offset = 0;
|
|
10
|
-
opts.imports.forEach((i) => {
|
|
11
|
-
if (i.d < 0 && (0, utils_1.isStyleFile)({ filename: i.n })) {
|
|
12
|
-
// import x from './index.less'
|
|
13
|
-
// => import x from '
|
|
14
|
-
const importSegment = code.substring(i.ss + offset, i.s + offset);
|
|
15
|
-
// is css module
|
|
16
|
-
if (~importSegment.indexOf(' from')) {
|
|
17
|
-
code = `${code.substring(0, i.e + offset)}${CSS_MODULES_QUERY}${code.substring(i.e + offset)}`;
|
|
18
|
-
offset += QUERY_LENGTH;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
return code;
|
|
23
|
-
}
|
|
24
|
-
exports.autoCssModulesHandler = autoCssModulesHandler;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { ImportSpecifier } from '@umijs/bundler-utils/compiled/es-module-lexer';
|
|
2
|
-
interface IParams {
|
|
3
|
-
cache: Map<string, any>;
|
|
4
|
-
opts: any;
|
|
5
|
-
}
|
|
6
|
-
interface IOpts {
|
|
7
|
-
code: string;
|
|
8
|
-
imports: ImportSpecifier[];
|
|
9
|
-
filePath: string;
|
|
10
|
-
}
|
|
11
|
-
export default function getAwaitImportHandler(params: IParams): (opts: IOpts) => string;
|
|
12
|
-
export {};
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const checkMatch_1 = require("../../babelPlugins/awaitImport/checkMatch");
|
|
4
|
-
function getAwaitImportHandler(params) {
|
|
5
|
-
return function awaitImportHandler(opts) {
|
|
6
|
-
var _a, _b;
|
|
7
|
-
let offset = 0;
|
|
8
|
-
let { code } = opts;
|
|
9
|
-
const { filePath, imports } = opts;
|
|
10
|
-
imports.forEach((i) => {
|
|
11
|
-
if (!i.n)
|
|
12
|
-
return;
|
|
13
|
-
const isLazyImport = i.d > 0;
|
|
14
|
-
const from = i.n;
|
|
15
|
-
const { isMatch, replaceValue } = (0, checkMatch_1.checkMatch)({
|
|
16
|
-
cache: params.cache,
|
|
17
|
-
value: from,
|
|
18
|
-
opts: params.opts,
|
|
19
|
-
filename: filePath,
|
|
20
|
-
});
|
|
21
|
-
if (isMatch) {
|
|
22
|
-
// case: import x from './index.ts';
|
|
23
|
-
// import('./index.ts');
|
|
24
|
-
// import x from '
|
|
25
|
-
// import(
|
|
26
|
-
const preSeg = code.substring(0, i.s + offset);
|
|
27
|
-
// ';
|
|
28
|
-
// );
|
|
29
|
-
const tailSeg = code.substring(i.e + offset);
|
|
30
|
-
const quote = isLazyImport ? '"' : '';
|
|
31
|
-
code = `${preSeg}${quote}${replaceValue}${quote}${tailSeg}`;
|
|
32
|
-
offset += replaceValue.length - from.length;
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
if (params.cache.has(filePath)) {
|
|
36
|
-
(_b = (_a = params.opts).onCollect) === null || _b === void 0 ? void 0 : _b.call(_a, {
|
|
37
|
-
file: filePath,
|
|
38
|
-
data: params.cache.get(filePath),
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
return code;
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
exports.default = getAwaitImportHandler;
|
package/dist/index.d.ts
DELETED
package/dist/index.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.esbuildLoader = void 0;
|
|
18
|
-
__exportStar(require("./constants"), exports);
|
|
19
|
-
__exportStar(require("./esbuildHandlers/autoCssModules"), exports);
|
|
20
|
-
// for independent use `esbuild-loader`
|
|
21
|
-
var esbuild_1 = require("./loader/esbuild");
|
|
22
|
-
Object.defineProperty(exports, "esbuildLoader", { enumerable: true, get: function () { return esbuild_1.esbuildLoader; } });
|
|
23
|
-
__exportStar(require("./mfsu"), exports);
|
package/dist/loader/esbuild.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { LoaderContext } from 'webpack';
|
|
2
|
-
import type { IEsbuildLoaderOpts } from '../types';
|
|
3
|
-
declare function esbuildTranspiler(this: LoaderContext<IEsbuildLoaderOpts>, source: string): Promise<void>;
|
|
4
|
-
export default esbuildTranspiler;
|
|
5
|
-
export declare const esbuildLoader: string;
|
package/dist/loader/esbuild.js
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
12
|
-
var t = {};
|
|
13
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
14
|
-
t[p] = s[p];
|
|
15
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
16
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
17
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
18
|
-
t[p[i]] = s[p[i]];
|
|
19
|
-
}
|
|
20
|
-
return t;
|
|
21
|
-
};
|
|
22
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
-
exports.esbuildLoader = void 0;
|
|
24
|
-
const es_module_lexer_1 = require("@umijs/bundler-utils/compiled/es-module-lexer");
|
|
25
|
-
const esbuild_1 = require("@umijs/bundler-utils/compiled/esbuild");
|
|
26
|
-
const path_1 = require("path");
|
|
27
|
-
function esbuildTranspiler(source) {
|
|
28
|
-
var _a;
|
|
29
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
-
const done = this.async();
|
|
31
|
-
const options = this.getOptions();
|
|
32
|
-
const { handler = [], implementation } = options, otherOptions = __rest(options, ["handler", "implementation"]);
|
|
33
|
-
const transform = (implementation === null || implementation === void 0 ? void 0 : implementation.transform) || esbuild_1.transform;
|
|
34
|
-
const filePath = this.resourcePath;
|
|
35
|
-
const ext = (0, path_1.extname)(filePath).slice(1);
|
|
36
|
-
const transformOptions = Object.assign(Object.assign({}, otherOptions), { target: (_a = options.target) !== null && _a !== void 0 ? _a : 'es2015', loader: ext !== null && ext !== void 0 ? ext : 'js', sourcemap: this.sourceMap, sourcefile: filePath });
|
|
37
|
-
try {
|
|
38
|
-
let { code, map } = yield transform(source, transformOptions);
|
|
39
|
-
if (handler.length) {
|
|
40
|
-
yield es_module_lexer_1.init;
|
|
41
|
-
handler.forEach((handle) => {
|
|
42
|
-
const [imports, exports] = (0, es_module_lexer_1.parse)(code);
|
|
43
|
-
code = handle({ code, imports, exports, filePath });
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
done(null, code, map && JSON.parse(map));
|
|
47
|
-
}
|
|
48
|
-
catch (error) {
|
|
49
|
-
done(error);
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
exports.default = esbuildTranspiler;
|
|
54
|
-
exports.esbuildLoader = __filename;
|
package/dist/mfsu.d.ts
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import type { NextFunction, Request, Response } from '@umijs/bundler-utils/compiled/express';
|
|
2
|
-
import webpack, { Configuration } from 'webpack';
|
|
3
|
-
import awaitImport from './babelPlugins/awaitImport/awaitImport';
|
|
4
|
-
import { DepBuilder } from './depBuilder/depBuilder';
|
|
5
|
-
import { DepInfo } from './depInfo';
|
|
6
|
-
import { Mode } from './types';
|
|
7
|
-
interface IOpts {
|
|
8
|
-
cwd?: string;
|
|
9
|
-
excludeNodeNatives?: boolean;
|
|
10
|
-
exportAllMembers?: Record<string, string[]>;
|
|
11
|
-
getCacheDependency?: Function;
|
|
12
|
-
onMFSUProgress?: Function;
|
|
13
|
-
mfName?: string;
|
|
14
|
-
mode?: Mode;
|
|
15
|
-
tmpBase?: string;
|
|
16
|
-
unMatchLibs?: string[];
|
|
17
|
-
runtimePublicPath?: boolean | string;
|
|
18
|
-
implementor: typeof webpack;
|
|
19
|
-
buildDepWithESBuild?: boolean;
|
|
20
|
-
depBuildConfig: any;
|
|
21
|
-
}
|
|
22
|
-
export declare class MFSU {
|
|
23
|
-
opts: IOpts;
|
|
24
|
-
alias: Record<string, string>;
|
|
25
|
-
externals: (Record<string, string> | Function)[];
|
|
26
|
-
depInfo: DepInfo;
|
|
27
|
-
depBuilder: DepBuilder;
|
|
28
|
-
depConfig: Configuration | null;
|
|
29
|
-
buildDepsAgain: boolean;
|
|
30
|
-
progress: any;
|
|
31
|
-
onProgress: Function;
|
|
32
|
-
publicPath: string;
|
|
33
|
-
constructor(opts: IOpts);
|
|
34
|
-
asyncImport(content: string): string;
|
|
35
|
-
setWebpackConfig(opts: {
|
|
36
|
-
config: Configuration;
|
|
37
|
-
depConfig: Configuration;
|
|
38
|
-
}): Promise<void>;
|
|
39
|
-
buildDeps(): Promise<void>;
|
|
40
|
-
getMiddlewares(): ((req: Request, res: Response, next: NextFunction) => void)[];
|
|
41
|
-
private getAwaitImportCollectOpts;
|
|
42
|
-
getBabelPlugins(): ({
|
|
43
|
-
onTransformDeps: () => void;
|
|
44
|
-
onCollect: ({ file, data, }: {
|
|
45
|
-
file: string;
|
|
46
|
-
data: {
|
|
47
|
-
unMatched: Set<{
|
|
48
|
-
sourceValue: string;
|
|
49
|
-
}>;
|
|
50
|
-
matched: Set<{
|
|
51
|
-
sourceValue: string;
|
|
52
|
-
}>;
|
|
53
|
-
};
|
|
54
|
-
}) => void;
|
|
55
|
-
exportAllMembers: Record<string, string[]> | undefined;
|
|
56
|
-
unMatchLibs: string[] | undefined;
|
|
57
|
-
remoteName: string | undefined;
|
|
58
|
-
alias: Record<string, string>;
|
|
59
|
-
externals: (Function | Record<string, string>)[];
|
|
60
|
-
} | typeof awaitImport)[][];
|
|
61
|
-
getEsbuildLoaderHandler(): any[];
|
|
62
|
-
}
|
|
63
|
-
export {};
|