ssr-plugin-react 6.1.67 → 6.1.70

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/CHANGELOG.md CHANGED
@@ -3,6 +3,37 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [6.1.70](https://github.com/zhangyuang/ssr/compare/v6.1.68...v6.1.70) (2022-03-15)
7
+
8
+
9
+ ### Features
10
+
11
+ * inject prefix to browser ([3f568cc](https://github.com/zhangyuang/ssr/commit/3f568cc6f15182ffe5fc3e58e1bffebcc4eb7a18))
12
+ * upgrade postcss to 8.0 ([70707e8](https://github.com/zhangyuang/ssr/commit/70707e8b297c2c7f77bb3344a907f1421bce0104))
13
+
14
+
15
+
16
+
17
+
18
+ ## [6.1.69](https://github.com/zhangyuang/ssr/compare/v6.1.68...v6.1.69) (2022-03-08)
19
+
20
+
21
+ ### Features
22
+
23
+ * upgrade postcss to 8.0 ([70707e8](https://github.com/zhangyuang/ssr/commit/70707e8b297c2c7f77bb3344a907f1421bce0104))
24
+
25
+
26
+
27
+
28
+
29
+ ## [6.1.68](https://github.com/zhangyuang/ssr/compare/v6.1.67...v6.1.68) (2022-03-04)
30
+
31
+ **Note:** Version bump only for package ssr-plugin-react
32
+
33
+
34
+
35
+
36
+
6
37
  ## [6.1.67](https://github.com/zhangyuang/ssr/compare/v6.1.66...v6.1.67) (2022-02-18)
7
38
 
8
39
 
package/README.md CHANGED
@@ -266,12 +266,13 @@ $ npm run start:vite # 以 vite 模式启动,等价于 npx ssr start --vite
266
266
 
267
267
  ## 答疑群
268
268
 
269
- 虽然我们已经尽力检查了一遍应用,但仍有可能有疏漏的地方,如果你在使用过程中发现任何问题或者建议,欢迎提[issue](https://github.com/zhangyuang/ssr/issues)或者[PR](https://github.com/zhangyuang/ssr/pulls)
270
- 欢迎直接扫码加群
269
+ 虽然我们已经尽力检查了一遍应用,但仍有可能有疏漏的地方,如果你在使用过程中发现任何问题或者建议,欢迎提[issue](https://github.com/zhangyuang/ssr/issues)或者[PR](https://github.com/zhangyuang/ssr/pulls)
270
+
271
+ `注: 由于微信交流群人数限制,进群请添加私人二维码并备注进入 ssr 交流群,由于是私人微信,拉群后将会自行删除好友,敬请谅解。我们更加鼓励通过 issue 和 discussion 来交流问题`
271
272
 
272
273
  <div style="display:flex">
273
274
  <!-- <img src="https://res.wx.qq.com/op_res/7F1t4Z8yCHWilehbcFGjAj0yVn0URMiWBGVJa-TVu_eqw5IwUXA2kPYBnfX6YRHy0FVBB-yC6l0IEL02QTJkLg" width="300"> -->
274
- <img src="https://res.wx.qq.com/op_res/yEMBkta89JhlC9RlNrTqXHshV4a6Wa-tBIBMZe9PjLoOJgtnLYjHQ4TQttfqJ4iYbqhSTEA4YI6TBWkO76-chA" width="300">
275
+ <img src="https://res.wx.qq.com/op_res/Nv12X2und927FEOvJ5iflzX-WBW07GSC22kumTCiShZnudKpG0jMuRs70ecHQb3Hy1QjjaASNzyOuMgHr43Wpw" width="300">
275
276
  </div>
276
277
 
277
278
  ## 前端开发手册
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[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);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -96,7 +96,7 @@ const serverRender = async (ctx, config) => {
96
96
  }
97
97
  const combineData = isCsr ? null : Object.assign(state !== null && state !== void 0 ? state : {}, layoutFetchData !== null && layoutFetchData !== void 0 ? layoutFetchData : {}, fetchData !== null && fetchData !== void 0 ? fetchData : {});
98
98
  const injectState = isCsr ? null : React.createElement("script", { dangerouslySetInnerHTML: {
99
- __html: `window.__USE_SSR__=true; window.__INITIAL_DATA__ =${serialize(combineData)}`
99
+ __html: `window.__USE_SSR__=true; window.__INITIAL_DATA__ =${serialize(combineData)}; ${base && `window.prefix="${base}"`}`
100
100
  } });
101
101
  return (React.createElement(react_router_dom_1.StaticRouter, { location: ctx.request.url },
102
102
  React.createElement(create_context_1.STORE_CONTEXT.Provider, { value: { state: combineData } },
package/cjs/index.js CHANGED
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[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);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
package/cjs/tools/vite.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
2
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.clientConfig = exports.serverConfig = exports.viteStart = exports.viteBuild = void 0;
5
5
  const vite_1 = require("vite");
@@ -51,7 +51,6 @@ const serverConfig = {
51
51
  },
52
52
  define: {
53
53
  __isBrowser__: false,
54
- ...(_j = (_h = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig()) === null || _h === void 0 ? void 0 : _h.server) === null || _j === void 0 ? void 0 : _j.define,
55
54
  ...define === null || define === void 0 ? void 0 : define.server,
56
55
  ...define === null || define === void 0 ? void 0 : define.base
57
56
  }
@@ -64,12 +63,12 @@ const clientConfig = {
64
63
  },
65
64
  plugins: [
66
65
  (0, plugin_react_1.default)({
67
- ...(_l = (_k = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig()) === null || _k === void 0 ? void 0 : _k.client) === null || _l === void 0 ? void 0 : _l.defaultPluginOptions,
66
+ ...(_j = (_h = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig()) === null || _h === void 0 ? void 0 : _h.client) === null || _j === void 0 ? void 0 : _j.defaultPluginOptions,
68
67
  jsxRuntime: 'classic',
69
68
  ...babelOptions
70
69
  }),
71
- (_o = (_m = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig()) === null || _m === void 0 ? void 0 : _m.common) === null || _o === void 0 ? void 0 : _o.extraPlugin,
72
- (_q = (_p = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig()) === null || _p === void 0 ? void 0 : _p.client) === null || _q === void 0 ? void 0 : _q.extraPlugin,
70
+ (_l = (_k = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig()) === null || _k === void 0 ? void 0 : _k.common) === null || _l === void 0 ? void 0 : _l.extraPlugin,
71
+ (_o = (_m = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig()) === null || _m === void 0 ? void 0 : _m.client) === null || _o === void 0 ? void 0 : _o.extraPlugin,
73
72
  (0, vite_plugin_style_import_1.default)(styleImportConfig)
74
73
  ],
75
74
  build: {
@@ -83,7 +82,6 @@ const clientConfig = {
83
82
  },
84
83
  define: {
85
84
  __isBrowser__: true,
86
- ...(_s = (_r = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig()) === null || _r === void 0 ? void 0 : _r.client) === null || _s === void 0 ? void 0 : _s.define,
87
85
  ...define === null || define === void 0 ? void 0 : define.client,
88
86
  ...define === null || define === void 0 ? void 0 : define.base
89
87
  }
@@ -93,7 +93,7 @@ const serverRender = async (ctx, config) => {
93
93
  }
94
94
  const combineData = isCsr ? null : Object.assign(state !== null && state !== void 0 ? state : {}, layoutFetchData !== null && layoutFetchData !== void 0 ? layoutFetchData : {}, fetchData !== null && fetchData !== void 0 ? fetchData : {});
95
95
  const injectState = isCsr ? null : React.createElement("script", { dangerouslySetInnerHTML: {
96
- __html: `window.__USE_SSR__=true; window.__INITIAL_DATA__ =${serialize(combineData)}`
96
+ __html: `window.__USE_SSR__=true; window.__INITIAL_DATA__ =${serialize(combineData)}; ${base && `window.prefix="${base}"`}`
97
97
  } });
98
98
  return (React.createElement(StaticRouter, { location: ctx.request.url },
99
99
  React.createElement(Context.Provider, { value: { state: combineData } },
package/esm/tools/vite.js CHANGED
@@ -1,4 +1,4 @@
1
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
1
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
2
2
  import { build } from 'vite';
3
3
  import { loadConfig, chunkNamePlugin, rollupOutputOptions, manifestPlugin, commonConfig, asyncOptimizeChunkPlugin } from 'ssr-server-utils';
4
4
  import react from '@vitejs/plugin-react';
@@ -48,7 +48,6 @@ const serverConfig = {
48
48
  },
49
49
  define: {
50
50
  __isBrowser__: false,
51
- ...(_j = (_h = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig()) === null || _h === void 0 ? void 0 : _h.server) === null || _j === void 0 ? void 0 : _j.define,
52
51
  ...define === null || define === void 0 ? void 0 : define.server,
53
52
  ...define === null || define === void 0 ? void 0 : define.base
54
53
  }
@@ -60,12 +59,12 @@ const clientConfig = {
60
59
  },
61
60
  plugins: [
62
61
  react({
63
- ...(_l = (_k = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig()) === null || _k === void 0 ? void 0 : _k.client) === null || _l === void 0 ? void 0 : _l.defaultPluginOptions,
62
+ ...(_j = (_h = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig()) === null || _h === void 0 ? void 0 : _h.client) === null || _j === void 0 ? void 0 : _j.defaultPluginOptions,
64
63
  jsxRuntime: 'classic',
65
64
  ...babelOptions
66
65
  }),
67
- (_o = (_m = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig()) === null || _m === void 0 ? void 0 : _m.common) === null || _o === void 0 ? void 0 : _o.extraPlugin,
68
- (_q = (_p = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig()) === null || _p === void 0 ? void 0 : _p.client) === null || _q === void 0 ? void 0 : _q.extraPlugin,
66
+ (_l = (_k = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig()) === null || _k === void 0 ? void 0 : _k.common) === null || _l === void 0 ? void 0 : _l.extraPlugin,
67
+ (_o = (_m = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig()) === null || _m === void 0 ? void 0 : _m.client) === null || _o === void 0 ? void 0 : _o.extraPlugin,
69
68
  styleImport(styleImportConfig)
70
69
  ],
71
70
  build: {
@@ -79,7 +78,6 @@ const clientConfig = {
79
78
  },
80
79
  define: {
81
80
  __isBrowser__: true,
82
- ...(_s = (_r = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig()) === null || _r === void 0 ? void 0 : _r.client) === null || _s === void 0 ? void 0 : _s.define,
83
81
  ...define === null || define === void 0 ? void 0 : define.client,
84
82
  ...define === null || define === void 0 ? void 0 : define.base
85
83
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ssr-plugin-react",
3
- "version": "6.1.67",
3
+ "version": "6.1.70",
4
4
  "description": "plugin-react for ssr",
5
5
  "main": "./cjs/index.js",
6
6
  "module": "./esm/index.js",
@@ -46,19 +46,20 @@
46
46
  "less": "^4.1.1",
47
47
  "less-loader": "^7.3.0",
48
48
  "mini-css-extract-plugin": "^1.0.0",
49
- "optimize-css-assets-webpack-plugin": "5.0.4",
50
- "postcss-discard-comments": "^4.0.2",
51
- "postcss-flexbugs-fixes": "4.1.0",
49
+ "optimize-css-assets-webpack-plugin": "^6.0.0",
50
+ "postcss": "^8.0.0",
51
+ "postcss-discard-comments": "^5.0.0",
52
+ "postcss-flexbugs-fixes": "^5.0.0",
52
53
  "postcss-loader": "^4.0.0",
53
- "postcss-modules": "^3.0.0",
54
- "postcss-preset-env": "^6.0.5",
55
- "postcss-safe-parser": "4.0.1",
54
+ "postcss-modules": "^4.0.0",
55
+ "postcss-preset-env": "^7.0.0",
56
+ "postcss-safe-parser": "^6.0.0",
56
57
  "react-dev-utils": "^11.0.4",
57
58
  "serialize-javascript": "^6.0.0",
58
- "ssr-client-utils": "^6.1.62",
59
- "ssr-hoc-react": "^6.1.65",
60
- "ssr-server-utils": "^6.1.67",
61
- "ssr-webpack": "^6.1.67",
59
+ "ssr-client-utils": "^6.1.70",
60
+ "ssr-hoc-react": "^6.1.70",
61
+ "ssr-server-utils": "^6.1.70",
62
+ "ssr-webpack": "^6.1.70",
62
63
  "terser-webpack-plugin": "^2.3.5",
63
64
  "url-loader": "^4.1.1",
64
65
  "vite": "^2.7.0",
@@ -74,7 +75,7 @@
74
75
  "@types/react-router-dom": "^5.1.3",
75
76
  "@types/webpack": "^4.41.10",
76
77
  "concurrently": "^5.1.0",
77
- "ssr-types-react": "^6.1.62"
78
+ "ssr-types-react": "^6.1.70"
78
79
  },
79
- "gitHead": "ff46d4ed1b0c5bb4b0557d91c564bc360cfa051e"
80
+ "gitHead": "e3c00853c87a11fc5713adb377276e1486e181b8"
80
81
  }
@@ -102,9 +102,8 @@ const serverRender = async (ctx: ISSRContext, config: IConfig): Promise<React.Re
102
102
  }
103
103
  }
104
104
  const combineData = isCsr ? null : Object.assign(state ?? {}, layoutFetchData ?? {}, fetchData ?? {})
105
-
106
105
  const injectState = isCsr ? null : <script dangerouslySetInnerHTML={{
107
- __html: `window.__USE_SSR__=true; window.__INITIAL_DATA__ =${serialize(combineData)}`
106
+ __html: `window.__USE_SSR__=true; window.__INITIAL_DATA__ =${serialize(combineData)}; ${base && `window.prefix="${base}"`}`
108
107
  }} />
109
108
 
110
109
  return (
package/src/tools/vite.ts CHANGED
@@ -49,7 +49,6 @@ const serverConfig: UserConfig = {
49
49
  },
50
50
  define: {
51
51
  __isBrowser__: false,
52
- ...viteConfig?.()?.server?.define,
53
52
  ...define?.server,
54
53
  ...define?.base
55
54
  }
@@ -81,7 +80,6 @@ const clientConfig: UserConfig = {
81
80
  },
82
81
  define: {
83
82
  __isBrowser__: true,
84
- ...viteConfig?.()?.client?.define,
85
83
  ...define?.client,
86
84
  ...define?.base
87
85
  }