@umijs/bundler-utoopack 4.6.65 → 4.6.67
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/client/client/client.js +7 -0
- package/dist/config.js +20 -5
- package/package.json +4 -4
package/client/client/client.js
CHANGED
|
@@ -11,6 +11,7 @@ console.log('[utoopack] connecting...');
|
|
|
11
11
|
let hasCompileErrors = false;
|
|
12
12
|
let shouldReloadOnRecovery = false;
|
|
13
13
|
let overlayIframe = null;
|
|
14
|
+
let isSocketConnected = false;
|
|
14
15
|
|
|
15
16
|
const enableErrorOverlay =
|
|
16
17
|
typeof process === 'undefined' ||
|
|
@@ -145,6 +146,7 @@ function handleSuccess() {
|
|
|
145
146
|
function handleMessage(payload) {
|
|
146
147
|
switch (payload.action) {
|
|
147
148
|
case ACTIONS.TURBOPACK_CONNECTED:
|
|
149
|
+
isSocketConnected = true;
|
|
148
150
|
console.log('[utoopack] connected.');
|
|
149
151
|
break;
|
|
150
152
|
case ACTIONS.BUILDING:
|
|
@@ -198,6 +200,11 @@ socket.addEventListener('message', ({ data }) => {
|
|
|
198
200
|
});
|
|
199
201
|
|
|
200
202
|
socket.addEventListener('close', async () => {
|
|
203
|
+
if (!isSocketConnected) {
|
|
204
|
+
console.info('[utoopack] Dev server connection failed.');
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
|
|
201
208
|
console.info('[utoopack] Dev server disconnected. Polling for restart...');
|
|
202
209
|
await waitForSuccessfulPing();
|
|
203
210
|
window.location.reload();
|
package/dist/config.js
CHANGED
|
@@ -151,9 +151,18 @@ function isSerializableBabelItem(item) {
|
|
|
151
151
|
return false;
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
|
-
function
|
|
154
|
+
function isReactCompilerEnabled(config) {
|
|
155
|
+
if ("reactCompiler" in config) {
|
|
156
|
+
return config.reactCompiler !== false;
|
|
157
|
+
}
|
|
158
|
+
return "forget" in config;
|
|
159
|
+
}
|
|
160
|
+
function shouldAddBabelLoaderRules(config) {
|
|
155
161
|
var _a;
|
|
156
|
-
|
|
162
|
+
return ((_a = config.utoopack) == null ? void 0 : _a.babelLoader) === true || isReactCompilerEnabled(config);
|
|
163
|
+
}
|
|
164
|
+
function getExtraBabelModuleRules(opts) {
|
|
165
|
+
if (!shouldAddBabelLoaderRules(opts.config)) {
|
|
157
166
|
return {};
|
|
158
167
|
}
|
|
159
168
|
const plugins = getExtraBabelPlugins(opts).filter((plugin) => {
|
|
@@ -197,7 +206,7 @@ function getExtraBabelModuleRules(opts) {
|
|
|
197
206
|
module: {
|
|
198
207
|
rules: Object.fromEntries(
|
|
199
208
|
["js", "mjs", "cjs", "jsx", "ts", "tsx"].map((ext) => [
|
|
200
|
-
|
|
209
|
+
`**/*.${ext}`,
|
|
201
210
|
rule
|
|
202
211
|
])
|
|
203
212
|
)
|
|
@@ -249,6 +258,12 @@ function getOverlayEntryPath(cwd, entryName) {
|
|
|
249
258
|
)
|
|
250
259
|
);
|
|
251
260
|
}
|
|
261
|
+
function createDynamicImportChain(imports) {
|
|
262
|
+
return `void ${imports.map(
|
|
263
|
+
(item, index) => index === 0 ? `import(${JSON.stringify(item)})` : `.then(() => import(${JSON.stringify(item)}))`
|
|
264
|
+
).join("")};
|
|
265
|
+
`;
|
|
266
|
+
}
|
|
252
267
|
function writeUtoopackOverlayEntry(opts) {
|
|
253
268
|
const entryPath = getOverlayEntryPath(opts.cwd, opts.entryName);
|
|
254
269
|
const overlayClientPath = normalizeUtoopackPath(
|
|
@@ -258,12 +273,12 @@ function writeUtoopackOverlayEntry(opts) {
|
|
|
258
273
|
import_fs.default.copyFileSync(UTOOPACK_OVERLAY_CLIENT_ENTRY, overlayClientPath);
|
|
259
274
|
import_fs.default.writeFileSync(
|
|
260
275
|
entryPath,
|
|
261
|
-
[
|
|
276
|
+
createDynamicImportChain([
|
|
262
277
|
getRelativeImportSpecifier(entryPath, overlayClientPath),
|
|
263
278
|
...opts.imports.map(
|
|
264
279
|
(item) => getOverlayEntryImport(item, opts.cwd, entryPath)
|
|
265
280
|
)
|
|
266
|
-
]
|
|
281
|
+
]),
|
|
267
282
|
"utf-8"
|
|
268
283
|
);
|
|
269
284
|
return entryPath;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umijs/bundler-utoopack",
|
|
3
|
-
"version": "4.6.
|
|
3
|
+
"version": "4.6.67",
|
|
4
4
|
"description": "@umijs/bundler-utoopack",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"dist"
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@utoo/pack": "1.4.
|
|
12
|
+
"@utoo/pack": "1.4.17",
|
|
13
13
|
"compression": "^1.7.4",
|
|
14
14
|
"connect-history-api-fallback": "^2.0.0",
|
|
15
15
|
"cors": "^2.8.5",
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"resolve-url-loader": "5.0.0",
|
|
22
22
|
"sass": "1.54.0",
|
|
23
23
|
"sass-loader": "13.2.0",
|
|
24
|
-
"@umijs/bundler-utils": "4.6.
|
|
25
|
-
"@umijs/bundler-webpack": "4.6.
|
|
24
|
+
"@umijs/bundler-utils": "4.6.67",
|
|
25
|
+
"@umijs/bundler-webpack": "4.6.67"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"father": "4.1.5"
|