@umijs/mfsu 4.0.24 → 4.0.25
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.
|
@@ -48,9 +48,9 @@ function MFImport_default() {
|
|
|
48
48
|
CallExpression: {
|
|
49
49
|
exit(path, { opts }) {
|
|
50
50
|
const { node } = path;
|
|
51
|
-
if (t.isImport(node.callee) && node.arguments.length === 1 && node.arguments[0]
|
|
51
|
+
if (t.isImport(node.callee) && node.arguments.length === 1 && t.isStringLiteral(node.arguments[0])) {
|
|
52
52
|
const newValue = opts.resolveImportSource(node.arguments[0].value);
|
|
53
|
-
node.arguments[0] =
|
|
53
|
+
node.arguments[0].value = newValue;
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
}
|
|
@@ -122,16 +122,20 @@ var StaticAnalyzeStrategy = class {
|
|
|
122
122
|
if (!c.modifiedFiles || c.modifiedFiles.size === 0) {
|
|
123
123
|
return;
|
|
124
124
|
}
|
|
125
|
+
if (!hasJSCodeFiles(c.modifiedFiles) && !hasJSCodeFiles(c.removedFiles)) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
125
128
|
const start = Date.now();
|
|
126
129
|
let event = this.staticDepInfo.getProducedEvent();
|
|
127
130
|
while (event.length === 0) {
|
|
128
|
-
await sleep(
|
|
131
|
+
await sleep(100);
|
|
129
132
|
event = this.staticDepInfo.getProducedEvent();
|
|
130
133
|
if (Date.now() - start > 5e3) {
|
|
131
134
|
import_utils.logger.warn("webpack wait mfsu deps too long");
|
|
132
135
|
break;
|
|
133
136
|
}
|
|
134
137
|
}
|
|
138
|
+
import_utils.logger.debug(`webpack waited ${Date.now() - start} ms`);
|
|
135
139
|
},
|
|
136
140
|
onCompileDone: () => {
|
|
137
141
|
}
|
|
@@ -151,6 +155,15 @@ function sleep(ms) {
|
|
|
151
155
|
}, ms);
|
|
152
156
|
});
|
|
153
157
|
}
|
|
158
|
+
var REG_CODE_EXT = /\.(jsx|js|ts|tsx)$/;
|
|
159
|
+
function hasJSCodeFiles(files) {
|
|
160
|
+
for (let file of files.values()) {
|
|
161
|
+
if (REG_CODE_EXT.test(file)) {
|
|
162
|
+
return true;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
return false;
|
|
166
|
+
}
|
|
154
167
|
// Annotate the CommonJS export names for ESM import in node:
|
|
155
168
|
0 && (module.exports = {
|
|
156
169
|
StaticAnalyzeStrategy
|
|
@@ -46,7 +46,7 @@ function createHandle(importOptions) {
|
|
|
46
46
|
retMatched.push({
|
|
47
47
|
isMatch: true,
|
|
48
48
|
value: unAliasedModulePath,
|
|
49
|
-
replaceValue: `${mfName}/${unAliasedModulePath}`,
|
|
49
|
+
replaceValue: `${mfName}/${(0, import_utils.winPath)(unAliasedModulePath)}`,
|
|
50
50
|
version
|
|
51
51
|
});
|
|
52
52
|
const unAliasedStylePath = (0, import_getAliasedPath.getAliasedPathWithLoopDetect)({
|
|
@@ -56,7 +56,7 @@ function createHandle(importOptions) {
|
|
|
56
56
|
retMatched.push({
|
|
57
57
|
isMatch: true,
|
|
58
58
|
value: unAliasedStylePath,
|
|
59
|
-
replaceValue: `${mfName}/${unAliasedStylePath}`,
|
|
59
|
+
replaceValue: `${mfName}/${(0, import_utils.winPath)(unAliasedStylePath)}`,
|
|
60
60
|
version
|
|
61
61
|
});
|
|
62
62
|
};
|
|
@@ -150,6 +150,9 @@ var StaticDepInfo = class {
|
|
|
150
150
|
const pkgNames = this.runtimeSimulations.map(({ packageName }) => packageName);
|
|
151
151
|
const groupedMockImports = {};
|
|
152
152
|
for (const imp of imports) {
|
|
153
|
+
if (!imp.n) {
|
|
154
|
+
continue;
|
|
155
|
+
}
|
|
153
156
|
if (pkgNames.indexOf(imp.n) >= 0) {
|
|
154
157
|
const name = imp.n;
|
|
155
158
|
if (groupedMockImports[name]) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umijs/mfsu",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.25",
|
|
4
4
|
"description": "@umijs/mfsu",
|
|
5
5
|
"homepage": "https://github.com/umijs/umi/tree/master/packages/mfsu#readme",
|
|
6
6
|
"bugs": "https://github.com/umijs/umi/issues",
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
"test": "umi-scripts jest-turbo"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@umijs/bundler-esbuild": "4.0.
|
|
27
|
-
"@umijs/bundler-utils": "4.0.
|
|
28
|
-
"@umijs/utils": "4.0.
|
|
26
|
+
"@umijs/bundler-esbuild": "4.0.25",
|
|
27
|
+
"@umijs/bundler-utils": "4.0.25",
|
|
28
|
+
"@umijs/utils": "4.0.25",
|
|
29
29
|
"enhanced-resolve": "5.9.3",
|
|
30
30
|
"is-equal": "^1.6.4"
|
|
31
31
|
},
|