@umijs/preset-umi 4.3.31 → 4.3.33

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.
@@ -104,6 +104,6 @@ ${import_utils.chalk.red(
104
104
  }
105
105
  });
106
106
  function isAbsolutePath(path) {
107
- return path.startsWith("/") || path.startsWith("@fs/");
107
+ return path.startsWith("/") || path.startsWith("@fs/") || /^[A-Za-z]:\//.test(path);
108
108
  }
109
109
  };
@@ -69,19 +69,24 @@ var clickToComponent_default = (api) => {
69
69
  content: `
70
70
  import { ClickToComponent } from 'click-to-react-component';
71
71
  import React from 'react';
72
+
73
+ const pathModifier = (path) => {
74
+ return path.startsWith('${api.paths.cwd}') ? path : '${api.paths.cwd}/' + path;
75
+ }
76
+
72
77
  export function rootContainer(container, opts) {
73
- return React.createElement(
74
- (props) => {
75
- return (
76
- <>
77
- <ClickToComponent editor="${api.config.clickToComponent.editor || "vscode"}"/>
78
- {props.children}
79
- </>
80
- );
81
- },
82
- opts,
83
- container,
84
- );
78
+ return React.createElement(
79
+ (props) => {
80
+ return (
81
+ <>
82
+ <ClickToComponent editor="${api.config.clickToComponent.editor || "vscode"}" pathModifier={pathModifier} />
83
+ {props.children}
84
+ </>
85
+ );
86
+ },
87
+ opts,
88
+ container,
89
+ );
85
90
  }
86
91
  `
87
92
  });
@@ -62,7 +62,8 @@ var ssr_default = (api) => {
62
62
  __INTERNAL_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: zod.object({
63
63
  pureApp: zod.boolean(),
64
64
  pureHtml: zod.boolean()
65
- })
65
+ }),
66
+ useStream: zod.boolean().default(true)
66
67
  }).deepPartial();
67
68
  }
68
69
  },
@@ -302,6 +302,7 @@ declare module '*.txt' {
302
302
  initialValue: []
303
303
  })
304
304
  ).join("\n");
305
+ const ssrConfig = api.config.ssr;
305
306
  const __INTERNAL_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ((_b = api.config.ssr) == null ? void 0 : _b.__INTERNAL_DO_NOT_USE_OR_YOU_WILL_BE_FIRED) ?? {
306
307
  pureApp: false,
307
308
  pureHtml: false
@@ -330,7 +331,8 @@ declare module '*.txt' {
330
331
  __INTERNAL_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: JSON.stringify(
331
332
  __INTERNAL_DO_NOT_USE_OR_YOU_WILL_BE_FIRED
332
333
  ),
333
- hydrate: !!api.config.ssr,
334
+ hydrate: !!ssrConfig,
335
+ useStream: (ssrConfig == null ? void 0 : ssrConfig.useStream) ?? true,
334
336
  reactRouter5Compat: !!api.config.reactRouter5Compat,
335
337
  loadingComponent: api.appData.globalLoading
336
338
  }
@@ -474,7 +476,7 @@ if (process.env.NODE_ENV === 'development') {
474
476
  isViteMode: !!api.config.vite
475
477
  }
476
478
  });
477
- if (api.config.ssr) {
479
+ if (ssrConfig) {
478
480
  const umiPluginPath = (0, import_utils.winPath)((0, import_path.join)(umiDir, "client/client/plugin.js"));
479
481
  const umiServerPath = (0, import_utils.winPath)(require.resolve("@umijs/server/dist/ssr"));
480
482
  const mountElementId = api.config.mountElementId;
@@ -525,7 +527,8 @@ if (process.env.NODE_ENV === 'development') {
525
527
  __INTERNAL_DO_NOT_USE_OR_YOU_WILL_BE_FIRED
526
528
  ),
527
529
  mountElementId,
528
- basename: api.config.base
530
+ basename: api.config.base,
531
+ useStream: (ssrConfig == null ? void 0 : ssrConfig.useStream) ?? true
529
532
  }
530
533
  });
531
534
  }
@@ -53,9 +53,9 @@ function babelPlugin_default() {
53
53
  if (cache.has(filename) && !filename.includes("bundler-webpack/client") && !filename.startsWith((0, import_utils.winPath)((0, import_path.join)(opts.cwd, "node_modules")))) {
54
54
  opts.onCheckCode({
55
55
  args: {
56
- ...cache.get(state.opts.filename),
57
- file: state.opts.filename,
58
- isFromTmp: state.opts.filename.startsWith(opts.absTmpPath)
56
+ ...cache.get(filename),
57
+ file: filename,
58
+ isFromTmp: filename.startsWith(opts.absTmpPath)
59
59
  }
60
60
  });
61
61
  }
@@ -64,7 +64,7 @@ function babelPlugin_default() {
64
64
  Program: {
65
65
  enter(path, state) {
66
66
  opts = state.opts;
67
- const file = path == null ? void 0 : path.hub.file.opts.filename;
67
+ const file = (0, import_utils.winPath)(path == null ? void 0 : path.hub.file.opts.filename);
68
68
  const cache = this.cache;
69
69
  cache.set(file, {
70
70
  code: path.hub.getCode(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umijs/preset-umi",
3
- "version": "4.3.31",
3
+ "version": "4.3.33",
4
4
  "description": "@umijs/preset-umi",
5
5
  "homepage": "https://github.com/umijs/umi/tree/master/packages/preset-umi#readme",
6
6
  "bugs": "https://github.com/umijs/umi/issues",
@@ -21,7 +21,7 @@
21
21
  "dependencies": {
22
22
  "@iconify/utils": "2.1.1",
23
23
  "@svgr/core": "6.5.1",
24
- "@umijs/bundler-mako": "0.9.5",
24
+ "@umijs/bundler-mako": "0.9.6",
25
25
  "@umijs/es-module-parser": "0.0.7",
26
26
  "@umijs/history": "5.3.1",
27
27
  "babel-plugin-dynamic-import-node": "2.3.3",
@@ -41,21 +41,21 @@
41
41
  "react-router": "6.3.0",
42
42
  "react-router-dom": "6.3.0",
43
43
  "regenerator-runtime": "0.13.11",
44
- "@umijs/bundler-esbuild": "4.3.31",
45
- "@umijs/bundler-vite": "4.3.31",
46
- "@umijs/ast": "4.3.31",
47
- "@umijs/babel-preset-umi": "4.3.31",
48
- "@umijs/core": "4.3.31",
49
- "@umijs/bundler-webpack": "4.3.31",
50
- "@umijs/bundler-utils": "4.3.31",
51
- "@umijs/plugin-run": "4.3.31",
52
- "@umijs/mfsu": "4.3.31",
53
- "@umijs/renderer-react": "4.3.31",
54
- "@umijs/server": "4.3.31",
44
+ "@umijs/bundler-esbuild": "4.3.33",
45
+ "@umijs/babel-preset-umi": "4.3.33",
46
+ "@umijs/ast": "4.3.33",
47
+ "@umijs/bundler-utils": "4.3.33",
48
+ "@umijs/bundler-vite": "4.3.33",
49
+ "@umijs/core": "4.3.33",
50
+ "@umijs/server": "4.3.33",
51
+ "@umijs/bundler-webpack": "4.3.33",
52
+ "@umijs/plugin-run": "4.3.33",
55
53
  "@umijs/did-you-know": "1.0.3",
54
+ "@umijs/mfsu": "4.3.33",
55
+ "@umijs/renderer-react": "4.3.33",
56
+ "@umijs/utils": "4.3.33",
56
57
  "@umijs/ui": "3.0.1",
57
- "@umijs/utils": "4.3.31",
58
- "@umijs/zod2ts": "4.3.31"
58
+ "@umijs/zod2ts": "4.3.33"
59
59
  },
60
60
  "devDependencies": {
61
61
  "@manypkg/get-packages": "1.1.3",
@@ -62,7 +62,8 @@ const createOpts = {
62
62
  htmlPageOpts: {{{htmlPageOpts}}},
63
63
  __INTERNAL_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: {{{__INTERNAL_DO_NOT_USE_OR_YOU_WILL_BE_FIRED}}},
64
64
  mountElementId: '{{{mountElementId}}}',
65
- basename: '{{{basename}}}'
65
+ basename: '{{{basename}}}',
66
+ useStream: {{{useStream}}}
66
67
  };
67
68
  const requestHandler = createRequestHandler(createOpts);
68
69
  /**
package/templates/umi.tpl CHANGED
@@ -50,6 +50,7 @@ async function render() {
50
50
  {{#hydrate}}
51
51
  hydrate: true,
52
52
  {{/hydrate}}
53
+ useStream: {{{useStream}}},
53
54
  {{#reactRouter5Compat}}
54
55
  reactRouter5Compat: true,
55
56
  {{/reactRouter5Compat}}