@umijs/plugins 4.0.0-canary.20230417.1 → 4.0.0-canary.20230420.1

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/dist/antd.js CHANGED
@@ -223,13 +223,17 @@ export type IRuntimeConfig = {
223
223
  return [];
224
224
  });
225
225
  api.addEntryImportsAhead(() => {
226
+ const isAntd5 = antdVersion.startsWith("5");
226
227
  const style = api.config.antd.style || "less";
227
- const doNotImportLess = api.config.antd.import && !api.appData.vite || antdVersion.startsWith("5");
228
- return doNotImportLess ? [] : [
229
- {
228
+ const imports = [];
229
+ if (isAntd5) {
230
+ imports.push({ source: "antd/dist/reset.css" });
231
+ } else if (!api.config.antd.import || api.appData.vite) {
232
+ imports.push({
230
233
  source: style === "less" ? "antd/dist/antd.less" : "antd/dist/antd.css"
231
- }
232
- ];
234
+ });
235
+ }
236
+ return imports;
233
237
  });
234
238
  };
235
239
  // Annotate the CommonJS export names for ESM import in node:
@@ -263,15 +263,24 @@ export { MicroAppLink } from './MicroAppLink';
263
263
  key: "onLocalProxyStart",
264
264
  type: api.ApplyPluginsType.event
265
265
  });
266
+ const modifyLocalProxyOpts = await api.applyPlugins({
267
+ key: "modifyLocalProxyOpts",
268
+ type: api.ApplyPluginsType.modify,
269
+ initialValue: {}
270
+ }) ?? {};
271
+ const localProxyOpts = {
272
+ target: masterEntry,
273
+ secure: false,
274
+ ignorePath: false,
275
+ followRedirects: false,
276
+ changeOrigin: true,
277
+ selfHandleResponse: true,
278
+ ...modifyLocalProxyOpts
279
+ };
266
280
  return (0, import_http_proxy_middleware.createProxyMiddleware)(
267
281
  (pathname) => pathname !== "/local-dev-server",
268
282
  {
269
- target: masterEntry,
270
- secure: false,
271
- ignorePath: false,
272
- followRedirects: false,
273
- changeOrigin: true,
274
- selfHandleResponse: true,
283
+ ...localProxyOpts,
275
284
  onProxyReq(proxyReq) {
276
285
  api.applyPlugins({
277
286
  key: "onLocalProxyReq",
@@ -284,13 +293,18 @@ export { MicroAppLink } from './MicroAppLink';
284
293
  async (responseBuffer, proxyRes, req2, res2) => {
285
294
  var _a2;
286
295
  if (proxyRes.statusCode === 302) {
287
- const hostname = req2.hostname;
296
+ const { ignorePath = false } = localProxyOpts;
297
+ const { hostname, url, protocol } = req2;
288
298
  const port = process.env.PORT || ((_a2 = api.appData) == null ? void 0 : _a2.port);
289
- const goto = `${hostname}:${port}`;
290
- const redirectUrl = proxyRes.headers.location.replace(
291
- encodeURIComponent(new URL(masterEntry).hostname),
292
- encodeURIComponent(goto)
293
- ) || masterEntry;
299
+ const gotoBasePart = `${protocol}://${hostname}:${port}${ignorePath && url ? url : "/"}`;
300
+ const fromBasePart = masterEntry;
301
+ const locationUrl = proxyRes.headers.location || "";
302
+ const [originAndPath, searchParams] = locationUrl.split("?");
303
+ const searchHandled = searchParams ? `?${searchParams.replace(
304
+ encodeURIComponent(fromBasePart),
305
+ encodeURIComponent(gotoBasePart)
306
+ )}` : "";
307
+ const redirectUrl = `${originAndPath}${searchHandled}`;
294
308
  const redirectMessage = `[@umijs/plugin-qiankun]: redirect to ${redirectUrl}`;
295
309
  api.logger.info(redirectMessage);
296
310
  res2.statusCode = 302;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umijs/plugins",
3
- "version": "4.0.0-canary.20230417.1",
3
+ "version": "4.0.0-canary.20230420.1",
4
4
  "description": "@umijs/plugins",
5
5
  "homepage": "https://github.com/umijs/umi/tree/master/packages/plugins#readme",
6
6
  "bugs": "https://github.com/umijs/umi/issues",
@@ -42,12 +42,12 @@
42
42
  "styled-components": "6.0.0-beta.9",
43
43
  "tslib": "^2",
44
44
  "warning": "^4.0.3",
45
- "@umijs/bundler-utils": "4.0.0-canary.20230417.1",
45
+ "@umijs/bundler-utils": "4.0.0-canary.20230420.1",
46
46
  "@umijs/valtio": "1.0.3"
47
47
  },
48
48
  "devDependencies": {
49
49
  "antd": "^4.24.1",
50
- "umi": "4.0.0-canary.20230417.1"
50
+ "umi": "4.0.0-canary.20230420.1"
51
51
  },
52
52
  "publishConfig": {
53
53
  "access": "public"