@modern-js/runtime 2.0.0-beta.2 → 2.0.0-beta.3
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 +100 -0
- package/dist/js/modern/router/runtime/plugin.js +8 -7
- package/dist/js/modern/router/runtime/plugin.node.js +10 -6
- package/dist/js/modern/router/runtime/server.js +1 -0
- package/dist/js/modern/router/runtime/utils.js +2 -4
- package/dist/js/modern/ssr/cli/index.js +14 -0
- package/dist/js/modern/ssr/serverRender/renderToStream/bulidTemplate.before.js +5 -1
- package/dist/js/modern/state/runtime/plugin.js +10 -3
- package/dist/js/node/router/runtime/plugin.js +7 -6
- package/dist/js/node/router/runtime/plugin.node.js +9 -5
- package/dist/js/node/router/runtime/server.js +16 -0
- package/dist/js/node/router/runtime/utils.js +2 -4
- package/dist/js/node/ssr/cli/index.js +14 -0
- package/dist/js/node/ssr/serverRender/renderToStream/bulidTemplate.before.js +5 -1
- package/dist/js/node/state/runtime/plugin.js +10 -3
- package/dist/js/treeshaking/router/runtime/plugin.js +9 -7
- package/dist/js/treeshaking/router/runtime/plugin.node.js +18 -13
- package/dist/js/treeshaking/router/runtime/server.js +1 -0
- package/dist/js/treeshaking/router/runtime/utils.js +2 -4
- package/dist/js/treeshaking/ssr/cli/index.js +15 -0
- package/dist/js/treeshaking/ssr/serverRender/renderToStream/bulidTemplate.before.js +5 -1
- package/dist/js/treeshaking/state/runtime/plugin.js +14 -3
- package/dist/types/router/runtime/plugin.d.ts +1 -0
- package/dist/types/router/runtime/plugin.node.d.ts +1 -0
- package/dist/types/router/runtime/server.d.ts +1 -0
- package/dist/types/router/runtime/types.d.ts +1 -0
- package/dist/types/state/runtime/plugin.d.ts +7 -2
- package/package.json +24 -24
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,105 @@
|
|
|
1
1
|
# @modern-js/runtime
|
|
2
2
|
|
|
3
|
+
## 2.0.0-beta.3
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- dda38c9c3e: chore: v2
|
|
8
|
+
|
|
9
|
+
### Minor Changes
|
|
10
|
+
|
|
11
|
+
- c9e800d39a: feat: support React18 streaming SSR
|
|
12
|
+
feat: 支持 React18 流式 SSR
|
|
13
|
+
- 543be9558e: feat: compile server loader and support handle loader request
|
|
14
|
+
feat: 编译 server loader 并支持处理 loader 的请求
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- 2344eb26ed: fix: bootstrap function params type define
|
|
19
|
+
|
|
20
|
+
fix: 修复 bootstrap 函数参数类型定义
|
|
21
|
+
|
|
22
|
+
- a11fcf8b50: feat: fallback logic of streaming ssr
|
|
23
|
+
feat: streaming ssr 降级逻辑
|
|
24
|
+
- e7ce063: fix: root layout css chunks should't be loaded
|
|
25
|
+
fix: 不应该加载 root layout 的 css chunks
|
|
26
|
+
- b18fa8f3ed: feat: remove @loadable/component in streaming ssr
|
|
27
|
+
feat: 移除 streaming ssr 中的 @loadable/component 逻辑
|
|
28
|
+
- 6604f1b: feat: support router basename
|
|
29
|
+
feat: router 插件支持设置 basename
|
|
30
|
+
- fda836f: feat: support `models`,`initialState` config for state plugin
|
|
31
|
+
feat: state 插件支持`model`,`initialState` 配置
|
|
32
|
+
- 3e57f2bd58: feat: add document feature with plugin
|
|
33
|
+
|
|
34
|
+
feat: 增加 document 功能插件
|
|
35
|
+
|
|
36
|
+
- 2e60319: fix: some optimizations for router and loader
|
|
37
|
+
fix: 一些 router 和 loader 的优化
|
|
38
|
+
q
|
|
39
|
+
- fbf5eed5aa: fix: fix ssg failure due to lack of Web Response API
|
|
40
|
+
fix: 修复因为缺少 Web Response API 而导致 ssg 失败
|
|
41
|
+
- a2509bfbdb: feat: bump esbuild from 0.14.38 to 0.15.7
|
|
42
|
+
|
|
43
|
+
feat: 将 esbuild 从 0.14.38 版本升级至 0.15.7 版本
|
|
44
|
+
|
|
45
|
+
- 425e570: feat: export react-router-dom/server staticRouter
|
|
46
|
+
feat: 导出 react-router-dom/server 的 staticRouter 组件
|
|
47
|
+
- e4357f1: fix: change default document file and name
|
|
48
|
+
|
|
49
|
+
fix: 重置默认的 document 文件和文件名
|
|
50
|
+
|
|
51
|
+
- 4369648ae2: fix: fix html template of streaming ssr
|
|
52
|
+
fix: 修复流式渲染的 html 模版
|
|
53
|
+
- 92c0994468: chore: remove `registerPrefetch`
|
|
54
|
+
chore: 移除 `registerPrefetch`
|
|
55
|
+
- 6bda14ed71: feat: refactor router with react-router@6.4
|
|
56
|
+
|
|
57
|
+
feat: 使用 react-router@6.4 重构路由模块
|
|
58
|
+
|
|
59
|
+
- 92004d1906: feat: support load chunks parallelly
|
|
60
|
+
feat: 支持并行加载 chunks
|
|
61
|
+
- 40ed5874c6: feat: inject css chunk into html for streaming ssr
|
|
62
|
+
feat: streaming ssr 返回的 html 注入 css chunk
|
|
63
|
+
- 60d5378632: fix: function extname should not return array
|
|
64
|
+
fix: 函数 extname 不应该返回一个数组
|
|
65
|
+
- 8b8e1bb571: feat: support nested routes
|
|
66
|
+
feat: 支持嵌套路由
|
|
67
|
+
- 3bbea92b2a: feat: support Hook、Middleware new API
|
|
68
|
+
feat: 支持 Hook、Middleware 的新 API
|
|
69
|
+
- 18aaf42249: fix: fix server loader redirects
|
|
70
|
+
fix: 修复 server loader 重定向错误
|
|
71
|
+
- 34702d5: feat: support internal env vars: metaName_TARGET
|
|
72
|
+
feat: 支持内置环境变量 metaName_TARGET
|
|
73
|
+
- fcace5b5b9: fix: remove overmuch `@modernjs/utils` dependency import in ssr runtime & SSR hydrate error
|
|
74
|
+
fix: 去除 ssr 运行时过多的 `@modernjs/utils` 依赖引入 & SSR hydrate 错误
|
|
75
|
+
- Updated dependencies [6aca875]
|
|
76
|
+
- Updated dependencies [2e60319]
|
|
77
|
+
- Updated dependencies [92f0eade39]
|
|
78
|
+
- Updated dependencies [edd1cfb1af]
|
|
79
|
+
- Updated dependencies [cc971eabfc]
|
|
80
|
+
- Updated dependencies [5b9049f2e9]
|
|
81
|
+
- Updated dependencies [6bda14ed71]
|
|
82
|
+
- Updated dependencies [92004d1906]
|
|
83
|
+
- Updated dependencies [b8bbe036c7]
|
|
84
|
+
- Updated dependencies [40ed5874c6]
|
|
85
|
+
- Updated dependencies [87c1ff86b9]
|
|
86
|
+
- Updated dependencies [d5a31df781]
|
|
87
|
+
- Updated dependencies [dda38c9c3e]
|
|
88
|
+
- Updated dependencies [102d32e4ba]
|
|
89
|
+
- Updated dependencies [8b8e1bb571]
|
|
90
|
+
- Updated dependencies [3bbea92b2a]
|
|
91
|
+
- Updated dependencies [b710adb]
|
|
92
|
+
- Updated dependencies [f179749375]
|
|
93
|
+
- Updated dependencies [ea7cf06]
|
|
94
|
+
- Updated dependencies [bbe4c4a]
|
|
95
|
+
- Updated dependencies [e4558a0]
|
|
96
|
+
- Updated dependencies [abf3421a75]
|
|
97
|
+
- Updated dependencies [543be9558e]
|
|
98
|
+
- Updated dependencies [14b712da84]
|
|
99
|
+
- @modern-js/utils@2.0.0-beta.3
|
|
100
|
+
- @modern-js/types@2.0.0-beta.3
|
|
101
|
+
- @modern-js/plugin@2.0.0-beta.3
|
|
102
|
+
|
|
3
103
|
## 2.0.0-beta.2
|
|
4
104
|
|
|
5
105
|
### Major Changes
|
|
@@ -4,11 +4,12 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { createBrowserRouter, createHashRouter, RouterProvider, createRoutesFromElements } from 'react-router-dom';
|
|
6
6
|
import hoistNonReactStatics from 'hoist-non-react-statics';
|
|
7
|
-
import { renderRoutes } from "./utils";
|
|
7
|
+
import { renderRoutes, urlJoin } from "./utils";
|
|
8
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
9
|
export const routerPlugin = ({
|
|
10
10
|
serverBase: _serverBase = [],
|
|
11
11
|
supportHtml5History: _supportHtml5History = true,
|
|
12
|
+
basename: _basename2 = '',
|
|
12
13
|
routesConfig,
|
|
13
14
|
createRoutes
|
|
14
15
|
}) => {
|
|
@@ -22,7 +23,7 @@ export const routerPlugin = ({
|
|
|
22
23
|
}, next) => {
|
|
23
24
|
// can not get routes config, skip wrapping React Router.
|
|
24
25
|
// e.g. App.tsx as the entrypoint
|
|
25
|
-
if (!routesConfig) {
|
|
26
|
+
if (!routesConfig && !createRoutes) {
|
|
26
27
|
return next({
|
|
27
28
|
App
|
|
28
29
|
});
|
|
@@ -30,13 +31,13 @@ export const routerPlugin = ({
|
|
|
30
31
|
const getRouteApp = () => {
|
|
31
32
|
return props => {
|
|
32
33
|
var _window$_SERVER_DATA;
|
|
33
|
-
const
|
|
34
|
-
const routes = createRoutes ? createRoutes() : createRoutesFromElements(routeElements);
|
|
34
|
+
const routes = createRoutes ? createRoutes() : createRoutesFromElements(renderRoutes(routesConfig));
|
|
35
35
|
const baseUrl = ((_window$_SERVER_DATA = window._SERVER_DATA) === null || _window$_SERVER_DATA === void 0 ? void 0 : _window$_SERVER_DATA.router.baseUrl) || select(location.pathname);
|
|
36
|
+
const _basename = baseUrl === '/' ? urlJoin(baseUrl, _basename2) : baseUrl;
|
|
36
37
|
const router = _supportHtml5History ? createBrowserRouter(routes, {
|
|
37
|
-
basename:
|
|
38
|
+
basename: _basename
|
|
38
39
|
}) : createHashRouter(routes, {
|
|
39
|
-
basename:
|
|
40
|
+
basename: _basename
|
|
40
41
|
});
|
|
41
42
|
return /*#__PURE__*/_jsx(App, _objectSpread(_objectSpread({}, props), {}, {
|
|
42
43
|
children: /*#__PURE__*/_jsx(RouterProvider, {
|
|
@@ -46,7 +47,7 @@ export const routerPlugin = ({
|
|
|
46
47
|
};
|
|
47
48
|
};
|
|
48
49
|
const RouteApp = getRouteApp();
|
|
49
|
-
if (routesConfig.globalApp) {
|
|
50
|
+
if (routesConfig !== null && routesConfig !== void 0 && routesConfig.globalApp) {
|
|
50
51
|
return next({
|
|
51
52
|
App: hoistNonReactStatics(RouteApp, routesConfig.globalApp)
|
|
52
53
|
});
|
|
@@ -8,7 +8,7 @@ import hoistNonReactStatics from 'hoist-non-react-statics';
|
|
|
8
8
|
import { installGlobals } from '@remix-run/node';
|
|
9
9
|
import { createRoutesFromElements } from 'react-router-dom';
|
|
10
10
|
import { RuntimeReactContext } from "../../core";
|
|
11
|
-
import { renderRoutes } from "./utils";
|
|
11
|
+
import { renderRoutes, urlJoin } from "./utils";
|
|
12
12
|
|
|
13
13
|
// Polyfill Web Fetch API
|
|
14
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -54,6 +54,7 @@ export function createFetchHeaders(requestHeaders) {
|
|
|
54
54
|
return headers;
|
|
55
55
|
}
|
|
56
56
|
export const routerPlugin = ({
|
|
57
|
+
basename: _basename2 = '',
|
|
57
58
|
routesConfig,
|
|
58
59
|
createRoutes
|
|
59
60
|
}) => {
|
|
@@ -66,7 +67,7 @@ export const routerPlugin = ({
|
|
|
66
67
|
}, next) {
|
|
67
68
|
// can not get routes config, skip wrapping React Router.
|
|
68
69
|
// e.g. App.tsx as the entrypoint
|
|
69
|
-
if (!routesConfig) {
|
|
70
|
+
if (!routesConfig && !createRoutes) {
|
|
70
71
|
return next({
|
|
71
72
|
context
|
|
72
73
|
});
|
|
@@ -74,11 +75,14 @@ export const routerPlugin = ({
|
|
|
74
75
|
const {
|
|
75
76
|
request
|
|
76
77
|
} = context.ssrContext;
|
|
77
|
-
const
|
|
78
|
-
const
|
|
78
|
+
const baseUrl = request.baseUrl;
|
|
79
|
+
const _basename = baseUrl === '/' ? urlJoin(baseUrl, _basename2) : baseUrl;
|
|
80
|
+
const routes = createRoutes ? createRoutes() : createRoutesFromElements(renderRoutes(routesConfig));
|
|
79
81
|
const {
|
|
80
82
|
query
|
|
81
|
-
} = createStaticHandler(routes
|
|
83
|
+
} = createStaticHandler(routes, {
|
|
84
|
+
basename: _basename
|
|
85
|
+
});
|
|
82
86
|
const remixRequest = createFetchRequest(request);
|
|
83
87
|
const routerContext = await query(remixRequest);
|
|
84
88
|
if (routerContext instanceof Response) {
|
|
@@ -122,7 +126,7 @@ export const routerPlugin = ({
|
|
|
122
126
|
};
|
|
123
127
|
};
|
|
124
128
|
const RouteApp = getRouteApp();
|
|
125
|
-
if (routesConfig.globalApp) {
|
|
129
|
+
if (routesConfig !== null && routesConfig !== void 0 && routesConfig.globalApp) {
|
|
126
130
|
return next({
|
|
127
131
|
App: hoistNonReactStatics(RouteApp, routesConfig.globalApp)
|
|
128
132
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from 'react-router-dom/server';
|
|
@@ -49,12 +49,10 @@ const renderNestedRoute = (nestedRoute, parent) => {
|
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
-
if (!parent) {
|
|
52
|
+
if (!parent && element) {
|
|
53
53
|
element = /*#__PURE__*/_jsx(RootLayout, {
|
|
54
54
|
routes: [nestedRoute],
|
|
55
|
-
children:
|
|
56
|
-
children: element
|
|
57
|
-
})
|
|
55
|
+
children: element
|
|
58
56
|
});
|
|
59
57
|
}
|
|
60
58
|
routeProps.element = element;
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
3
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
1
4
|
import { getEntryOptions, SERVER_RENDER_FUNCTION_NAME, LOADABLE_STATS_FILE, isUseSSRBundle, createRuntimeExportsUtils, isSingleEntry } from '@modern-js/utils';
|
|
2
5
|
const PLUGIN_IDENTIFIER = 'ssr';
|
|
3
6
|
const hasStringSSREntry = userConfig => {
|
|
@@ -36,6 +39,7 @@ export default (() => ({
|
|
|
36
39
|
tools: {
|
|
37
40
|
webpackChain: (chain, {
|
|
38
41
|
name,
|
|
42
|
+
isServer,
|
|
39
43
|
CHAIN_ID
|
|
40
44
|
}) => {
|
|
41
45
|
const userConfig = api.useResolvedConfigContext();
|
|
@@ -46,6 +50,16 @@ export default (() => ({
|
|
|
46
50
|
filename: LOADABLE_STATS_FILE
|
|
47
51
|
}]);
|
|
48
52
|
}
|
|
53
|
+
|
|
54
|
+
// add environment variables to determine the node/browser
|
|
55
|
+
const prefix = `${appContext.metaName.split(/[-_]/)[0]}_`.toUpperCase();
|
|
56
|
+
const modernVars = {
|
|
57
|
+
[`process.env.${prefix}TARGET`]: JSON.stringify(isServer ? 'node' : 'browser')
|
|
58
|
+
};
|
|
59
|
+
chain.plugin(CHAIN_ID.PLUGIN.DEFINE).tap(args => {
|
|
60
|
+
const [vars, ...rest] = args;
|
|
61
|
+
return [_objectSpread(_objectSpread({}, vars), modernVars), ...rest];
|
|
62
|
+
});
|
|
49
63
|
},
|
|
50
64
|
babel: config => {
|
|
51
65
|
const userConfig = api.useResolvedConfigContext();
|
|
@@ -33,7 +33,11 @@ function getHeadTemplate(beforeEntryTemplate, context) {
|
|
|
33
33
|
} = routeManifest;
|
|
34
34
|
const cssChunks = [];
|
|
35
35
|
const matches = matchRoutes(routes, routerContext.location);
|
|
36
|
-
matches === null || matches === void 0 ? void 0 : matches.forEach(match => {
|
|
36
|
+
matches === null || matches === void 0 ? void 0 : matches.forEach((match, index) => {
|
|
37
|
+
// root layout css chunks should't be loaded
|
|
38
|
+
if (!index) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
37
41
|
const routeId = match.route.id;
|
|
38
42
|
if (routeId) {
|
|
39
43
|
const {
|
|
@@ -19,9 +19,16 @@ const getStoreConfig = config => {
|
|
|
19
19
|
const internalPlugins = ['immer', 'effects', 'autoActions', 'devtools'];
|
|
20
20
|
const plugins = [];
|
|
21
21
|
internalPlugins.filter(plugin => config[plugin] !== false).forEach(plugin => plugins.push(StatePluginHandleMap[plugin](config[plugin])));
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
const storeConfig = {};
|
|
23
|
+
for (const [key, value] of Object.entries(config)) {
|
|
24
|
+
if (internalPlugins.includes(key)) {
|
|
25
|
+
plugins.push(StatePluginHandleMap[key](value));
|
|
26
|
+
} else {
|
|
27
|
+
storeConfig[key] = value;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
storeConfig.plugins = plugins;
|
|
31
|
+
return storeConfig;
|
|
25
32
|
};
|
|
26
33
|
const state = config => ({
|
|
27
34
|
name: '@modern-js/plugin-state',
|
|
@@ -16,6 +16,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
16
16
|
const routerPlugin = ({
|
|
17
17
|
serverBase: _serverBase = [],
|
|
18
18
|
supportHtml5History: _supportHtml5History = true,
|
|
19
|
+
basename: _basename2 = '',
|
|
19
20
|
routesConfig,
|
|
20
21
|
createRoutes
|
|
21
22
|
}) => {
|
|
@@ -29,7 +30,7 @@ const routerPlugin = ({
|
|
|
29
30
|
}, next) => {
|
|
30
31
|
// can not get routes config, skip wrapping React Router.
|
|
31
32
|
// e.g. App.tsx as the entrypoint
|
|
32
|
-
if (!routesConfig) {
|
|
33
|
+
if (!routesConfig && !createRoutes) {
|
|
33
34
|
return next({
|
|
34
35
|
App
|
|
35
36
|
});
|
|
@@ -37,13 +38,13 @@ const routerPlugin = ({
|
|
|
37
38
|
const getRouteApp = () => {
|
|
38
39
|
return props => {
|
|
39
40
|
var _window$_SERVER_DATA;
|
|
40
|
-
const
|
|
41
|
-
const routes = createRoutes ? createRoutes() : (0, _reactRouterDom.createRoutesFromElements)(routeElements);
|
|
41
|
+
const routes = createRoutes ? createRoutes() : (0, _reactRouterDom.createRoutesFromElements)((0, _utils.renderRoutes)(routesConfig));
|
|
42
42
|
const baseUrl = ((_window$_SERVER_DATA = window._SERVER_DATA) === null || _window$_SERVER_DATA === void 0 ? void 0 : _window$_SERVER_DATA.router.baseUrl) || select(location.pathname);
|
|
43
|
+
const _basename = baseUrl === '/' ? (0, _utils.urlJoin)(baseUrl, _basename2) : baseUrl;
|
|
43
44
|
const router = _supportHtml5History ? (0, _reactRouterDom.createBrowserRouter)(routes, {
|
|
44
|
-
basename:
|
|
45
|
+
basename: _basename
|
|
45
46
|
}) : (0, _reactRouterDom.createHashRouter)(routes, {
|
|
46
|
-
basename:
|
|
47
|
+
basename: _basename
|
|
47
48
|
});
|
|
48
49
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(App, _objectSpread(_objectSpread({}, props), {}, {
|
|
49
50
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouterDom.RouterProvider, {
|
|
@@ -53,7 +54,7 @@ const routerPlugin = ({
|
|
|
53
54
|
};
|
|
54
55
|
};
|
|
55
56
|
const RouteApp = getRouteApp();
|
|
56
|
-
if (routesConfig.globalApp) {
|
|
57
|
+
if (routesConfig !== null && routesConfig !== void 0 && routesConfig.globalApp) {
|
|
57
58
|
return next({
|
|
58
59
|
App: (0, _hoistNonReactStatics.default)(RouteApp, routesConfig.globalApp)
|
|
59
60
|
});
|
|
@@ -63,6 +63,7 @@ function createFetchHeaders(requestHeaders) {
|
|
|
63
63
|
return headers;
|
|
64
64
|
}
|
|
65
65
|
const routerPlugin = ({
|
|
66
|
+
basename: _basename2 = '',
|
|
66
67
|
routesConfig,
|
|
67
68
|
createRoutes
|
|
68
69
|
}) => {
|
|
@@ -75,7 +76,7 @@ const routerPlugin = ({
|
|
|
75
76
|
}, next) {
|
|
76
77
|
// can not get routes config, skip wrapping React Router.
|
|
77
78
|
// e.g. App.tsx as the entrypoint
|
|
78
|
-
if (!routesConfig) {
|
|
79
|
+
if (!routesConfig && !createRoutes) {
|
|
79
80
|
return next({
|
|
80
81
|
context
|
|
81
82
|
});
|
|
@@ -83,11 +84,14 @@ const routerPlugin = ({
|
|
|
83
84
|
const {
|
|
84
85
|
request
|
|
85
86
|
} = context.ssrContext;
|
|
86
|
-
const
|
|
87
|
-
const
|
|
87
|
+
const baseUrl = request.baseUrl;
|
|
88
|
+
const _basename = baseUrl === '/' ? (0, _utils.urlJoin)(baseUrl, _basename2) : baseUrl;
|
|
89
|
+
const routes = createRoutes ? createRoutes() : (0, _reactRouterDom.createRoutesFromElements)((0, _utils.renderRoutes)(routesConfig));
|
|
88
90
|
const {
|
|
89
91
|
query
|
|
90
|
-
} = (0, _router.unstable_createStaticHandler)(routes
|
|
92
|
+
} = (0, _router.unstable_createStaticHandler)(routes, {
|
|
93
|
+
basename: _basename
|
|
94
|
+
});
|
|
91
95
|
const remixRequest = createFetchRequest(request);
|
|
92
96
|
const routerContext = await query(remixRequest);
|
|
93
97
|
if (routerContext instanceof Response) {
|
|
@@ -131,7 +135,7 @@ const routerPlugin = ({
|
|
|
131
135
|
};
|
|
132
136
|
};
|
|
133
137
|
const RouteApp = getRouteApp();
|
|
134
|
-
if (routesConfig.globalApp) {
|
|
138
|
+
if (routesConfig !== null && routesConfig !== void 0 && routesConfig.globalApp) {
|
|
135
139
|
return next({
|
|
136
140
|
App: (0, _hoistNonReactStatics.default)(RouteApp, routesConfig.globalApp)
|
|
137
141
|
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _server = require("react-router-dom/server");
|
|
7
|
+
Object.keys(_server).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _server[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _server[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -61,12 +61,10 @@ const renderNestedRoute = (nestedRoute, parent) => {
|
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
|
-
if (!parent) {
|
|
64
|
+
if (!parent && element) {
|
|
65
65
|
element = /*#__PURE__*/(0, _jsxRuntime.jsx)(_root.RootLayout, {
|
|
66
66
|
routes: [nestedRoute],
|
|
67
|
-
children:
|
|
68
|
-
children: element
|
|
69
|
-
})
|
|
67
|
+
children: element
|
|
70
68
|
});
|
|
71
69
|
}
|
|
72
70
|
routeProps.element = element;
|
|
@@ -5,6 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _utils = require("@modern-js/utils");
|
|
8
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
9
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
10
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
8
11
|
const PLUGIN_IDENTIFIER = 'ssr';
|
|
9
12
|
const hasStringSSREntry = userConfig => {
|
|
10
13
|
const isStreaming = ssr => ssr && typeof ssr === 'object' && ssr.mode === 'stream';
|
|
@@ -42,6 +45,7 @@ var _default = () => ({
|
|
|
42
45
|
tools: {
|
|
43
46
|
webpackChain: (chain, {
|
|
44
47
|
name,
|
|
48
|
+
isServer,
|
|
45
49
|
CHAIN_ID
|
|
46
50
|
}) => {
|
|
47
51
|
const userConfig = api.useResolvedConfigContext();
|
|
@@ -52,6 +56,16 @@ var _default = () => ({
|
|
|
52
56
|
filename: _utils.LOADABLE_STATS_FILE
|
|
53
57
|
}]);
|
|
54
58
|
}
|
|
59
|
+
|
|
60
|
+
// add environment variables to determine the node/browser
|
|
61
|
+
const prefix = `${appContext.metaName.split(/[-_]/)[0]}_`.toUpperCase();
|
|
62
|
+
const modernVars = {
|
|
63
|
+
[`process.env.${prefix}TARGET`]: JSON.stringify(isServer ? 'node' : 'browser')
|
|
64
|
+
};
|
|
65
|
+
chain.plugin(CHAIN_ID.PLUGIN.DEFINE).tap(args => {
|
|
66
|
+
const [vars, ...rest] = args;
|
|
67
|
+
return [_objectSpread(_objectSpread({}, vars), modernVars), ...rest];
|
|
68
|
+
});
|
|
55
69
|
},
|
|
56
70
|
babel: config => {
|
|
57
71
|
const userConfig = api.useResolvedConfigContext();
|
|
@@ -40,7 +40,11 @@ function getHeadTemplate(beforeEntryTemplate, context) {
|
|
|
40
40
|
} = routeManifest;
|
|
41
41
|
const cssChunks = [];
|
|
42
42
|
const matches = (0, _reactRouterDom.matchRoutes)(routes, routerContext.location);
|
|
43
|
-
matches === null || matches === void 0 ? void 0 : matches.forEach(match => {
|
|
43
|
+
matches === null || matches === void 0 ? void 0 : matches.forEach((match, index) => {
|
|
44
|
+
// root layout css chunks should't be loaded
|
|
45
|
+
if (!index) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
44
48
|
const routeId = match.route.id;
|
|
45
49
|
if (routeId) {
|
|
46
50
|
const {
|
|
@@ -38,9 +38,16 @@ const getStoreConfig = config => {
|
|
|
38
38
|
const internalPlugins = ['immer', 'effects', 'autoActions', 'devtools'];
|
|
39
39
|
const plugins = [];
|
|
40
40
|
internalPlugins.filter(plugin => config[plugin] !== false).forEach(plugin => plugins.push(StatePluginHandleMap[plugin](config[plugin])));
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
const storeConfig = {};
|
|
42
|
+
for (const [key, value] of Object.entries(config)) {
|
|
43
|
+
if (internalPlugins.includes(key)) {
|
|
44
|
+
plugins.push(StatePluginHandleMap[key](value));
|
|
45
|
+
} else {
|
|
46
|
+
storeConfig[key] = value;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
storeConfig.plugins = plugins;
|
|
50
|
+
return storeConfig;
|
|
44
51
|
};
|
|
45
52
|
const state = config => ({
|
|
46
53
|
name: '@modern-js/plugin-state',
|
|
@@ -2,13 +2,15 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { createBrowserRouter, createHashRouter, RouterProvider, createRoutesFromElements } from 'react-router-dom';
|
|
4
4
|
import hoistNonReactStatics from 'hoist-non-react-statics';
|
|
5
|
-
import { renderRoutes } from "./utils";
|
|
5
|
+
import { renderRoutes, urlJoin } from "./utils";
|
|
6
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
7
|
export var routerPlugin = function routerPlugin(_ref) {
|
|
8
8
|
var _ref$serverBase = _ref.serverBase,
|
|
9
9
|
serverBase = _ref$serverBase === void 0 ? [] : _ref$serverBase,
|
|
10
10
|
_ref$supportHtml5Hist = _ref.supportHtml5History,
|
|
11
11
|
supportHtml5History = _ref$supportHtml5Hist === void 0 ? true : _ref$supportHtml5Hist,
|
|
12
|
+
_ref$basename = _ref.basename,
|
|
13
|
+
basename = _ref$basename === void 0 ? '' : _ref$basename,
|
|
12
14
|
routesConfig = _ref.routesConfig,
|
|
13
15
|
createRoutes = _ref.createRoutes;
|
|
14
16
|
var select = function select(pathname) {
|
|
@@ -24,7 +26,7 @@ export var routerPlugin = function routerPlugin(_ref) {
|
|
|
24
26
|
var App = _ref2.App;
|
|
25
27
|
// can not get routes config, skip wrapping React Router.
|
|
26
28
|
// e.g. App.tsx as the entrypoint
|
|
27
|
-
if (!routesConfig) {
|
|
29
|
+
if (!routesConfig && !createRoutes) {
|
|
28
30
|
return next({
|
|
29
31
|
App: App
|
|
30
32
|
});
|
|
@@ -32,13 +34,13 @@ export var routerPlugin = function routerPlugin(_ref) {
|
|
|
32
34
|
var getRouteApp = function getRouteApp() {
|
|
33
35
|
return function (props) {
|
|
34
36
|
var _window$_SERVER_DATA;
|
|
35
|
-
var
|
|
36
|
-
var routes = createRoutes ? createRoutes() : createRoutesFromElements(routeElements);
|
|
37
|
+
var routes = createRoutes ? createRoutes() : createRoutesFromElements(renderRoutes(routesConfig));
|
|
37
38
|
var baseUrl = ((_window$_SERVER_DATA = window._SERVER_DATA) === null || _window$_SERVER_DATA === void 0 ? void 0 : _window$_SERVER_DATA.router.baseUrl) || select(location.pathname);
|
|
39
|
+
var _basename = baseUrl === '/' ? urlJoin(baseUrl, basename) : baseUrl;
|
|
38
40
|
var router = supportHtml5History ? createBrowserRouter(routes, {
|
|
39
|
-
basename:
|
|
41
|
+
basename: _basename
|
|
40
42
|
}) : createHashRouter(routes, {
|
|
41
|
-
basename:
|
|
43
|
+
basename: _basename
|
|
42
44
|
});
|
|
43
45
|
return /*#__PURE__*/_jsx(App, _objectSpread(_objectSpread({}, props), {}, {
|
|
44
46
|
children: /*#__PURE__*/_jsx(RouterProvider, {
|
|
@@ -48,7 +50,7 @@ export var routerPlugin = function routerPlugin(_ref) {
|
|
|
48
50
|
};
|
|
49
51
|
};
|
|
50
52
|
var RouteApp = getRouteApp();
|
|
51
|
-
if (routesConfig.globalApp) {
|
|
53
|
+
if (routesConfig !== null && routesConfig !== void 0 && routesConfig.globalApp) {
|
|
52
54
|
return next({
|
|
53
55
|
App: hoistNonReactStatics(RouteApp, routesConfig.globalApp)
|
|
54
56
|
});
|
|
@@ -10,7 +10,7 @@ import hoistNonReactStatics from 'hoist-non-react-statics';
|
|
|
10
10
|
import { installGlobals } from '@remix-run/node';
|
|
11
11
|
import { createRoutesFromElements } from 'react-router-dom';
|
|
12
12
|
import { RuntimeReactContext } from "../../core";
|
|
13
|
-
import { renderRoutes } from "./utils";
|
|
13
|
+
import { renderRoutes, urlJoin } from "./utils";
|
|
14
14
|
|
|
15
15
|
// Polyfill Web Fetch API
|
|
16
16
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -68,7 +68,9 @@ export function createFetchHeaders(requestHeaders) {
|
|
|
68
68
|
return headers;
|
|
69
69
|
}
|
|
70
70
|
export var routerPlugin = function routerPlugin(_ref) {
|
|
71
|
-
var
|
|
71
|
+
var _ref$basename = _ref.basename,
|
|
72
|
+
basename = _ref$basename === void 0 ? '' : _ref$basename,
|
|
73
|
+
routesConfig = _ref.routesConfig,
|
|
72
74
|
createRoutes = _ref.createRoutes;
|
|
73
75
|
return {
|
|
74
76
|
name: '@modern-js/plugin-router',
|
|
@@ -76,13 +78,13 @@ export var routerPlugin = function routerPlugin(_ref) {
|
|
|
76
78
|
return {
|
|
77
79
|
init: function init(_ref2, next) {
|
|
78
80
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
79
|
-
var context, _ref3, request,
|
|
81
|
+
var context, _ref3, request, baseUrl, _basename, routes, _createStaticHandler, query, remixRequest, routerContext, router;
|
|
80
82
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
81
83
|
while (1) {
|
|
82
84
|
switch (_context.prev = _context.next) {
|
|
83
85
|
case 0:
|
|
84
86
|
context = _ref2.context;
|
|
85
|
-
if (routesConfig) {
|
|
87
|
+
if (!(!routesConfig && !createRoutes)) {
|
|
86
88
|
_context.next = 3;
|
|
87
89
|
break;
|
|
88
90
|
}
|
|
@@ -91,20 +93,23 @@ export var routerPlugin = function routerPlugin(_ref) {
|
|
|
91
93
|
}));
|
|
92
94
|
case 3:
|
|
93
95
|
_ref3 = context.ssrContext, request = _ref3.request;
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
96
|
+
baseUrl = request.baseUrl;
|
|
97
|
+
_basename = baseUrl === '/' ? urlJoin(baseUrl, basename) : baseUrl;
|
|
98
|
+
routes = createRoutes ? createRoutes() : createRoutesFromElements(renderRoutes(routesConfig));
|
|
99
|
+
_createStaticHandler = createStaticHandler(routes, {
|
|
100
|
+
basename: _basename
|
|
101
|
+
}), query = _createStaticHandler.query;
|
|
97
102
|
remixRequest = createFetchRequest(request);
|
|
98
|
-
_context.next =
|
|
103
|
+
_context.next = 11;
|
|
99
104
|
return query(remixRequest);
|
|
100
|
-
case
|
|
105
|
+
case 11:
|
|
101
106
|
routerContext = _context.sent;
|
|
102
107
|
if (!(routerContext instanceof Response)) {
|
|
103
|
-
_context.next =
|
|
108
|
+
_context.next = 14;
|
|
104
109
|
break;
|
|
105
110
|
}
|
|
106
111
|
return _context.abrupt("return", routerContext);
|
|
107
|
-
case
|
|
112
|
+
case 14:
|
|
108
113
|
router = createStaticRouter(routes, routerContext);
|
|
109
114
|
context.router = router;
|
|
110
115
|
context.routerContext = routerContext;
|
|
@@ -114,7 +119,7 @@ export var routerPlugin = function routerPlugin(_ref) {
|
|
|
114
119
|
return _context.abrupt("return", next({
|
|
115
120
|
context: context
|
|
116
121
|
}));
|
|
117
|
-
case
|
|
122
|
+
case 20:
|
|
118
123
|
case "end":
|
|
119
124
|
return _context.stop();
|
|
120
125
|
}
|
|
@@ -146,7 +151,7 @@ export var routerPlugin = function routerPlugin(_ref) {
|
|
|
146
151
|
};
|
|
147
152
|
};
|
|
148
153
|
var RouteApp = getRouteApp();
|
|
149
|
-
if (routesConfig.globalApp) {
|
|
154
|
+
if (routesConfig !== null && routesConfig !== void 0 && routesConfig.globalApp) {
|
|
150
155
|
return next({
|
|
151
156
|
App: hoistNonReactStatics(RouteApp, routesConfig.globalApp)
|
|
152
157
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from 'react-router-dom/server';
|
|
@@ -45,12 +45,10 @@ var renderNestedRoute = function renderNestedRoute(nestedRoute, parent) {
|
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
if (!parent) {
|
|
48
|
+
if (!parent && element) {
|
|
49
49
|
element = /*#__PURE__*/_jsx(RootLayout, {
|
|
50
50
|
routes: [nestedRoute],
|
|
51
|
-
children:
|
|
52
|
-
children: element
|
|
53
|
-
})
|
|
51
|
+
children: element
|
|
54
52
|
});
|
|
55
53
|
}
|
|
56
54
|
routeProps.element = element;
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
3
|
+
import _toArray from "@babel/runtime/helpers/esm/toArray";
|
|
4
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
1
5
|
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
2
6
|
import { getEntryOptions, SERVER_RENDER_FUNCTION_NAME, LOADABLE_STATS_FILE, isUseSSRBundle, createRuntimeExportsUtils, isSingleEntry } from '@modern-js/utils';
|
|
3
7
|
var PLUGIN_IDENTIFIER = 'ssr';
|
|
@@ -39,6 +43,7 @@ export default (function () {
|
|
|
39
43
|
tools: {
|
|
40
44
|
webpackChain: function webpackChain(chain, _ref) {
|
|
41
45
|
var name = _ref.name,
|
|
46
|
+
isServer = _ref.isServer,
|
|
42
47
|
CHAIN_ID = _ref.CHAIN_ID;
|
|
43
48
|
var userConfig = api.useResolvedConfigContext();
|
|
44
49
|
if (isUseSSRBundle(userConfig) && name !== 'server' && hasStringSSREntry(userConfig)) {
|
|
@@ -48,6 +53,16 @@ export default (function () {
|
|
|
48
53
|
filename: LOADABLE_STATS_FILE
|
|
49
54
|
}]);
|
|
50
55
|
}
|
|
56
|
+
|
|
57
|
+
// add environment variables to determine the node/browser
|
|
58
|
+
var prefix = "".concat(appContext.metaName.split(/[-_]/)[0], "_").toUpperCase();
|
|
59
|
+
var modernVars = _defineProperty({}, "process.env.".concat(prefix, "TARGET"), JSON.stringify(isServer ? 'node' : 'browser'));
|
|
60
|
+
chain.plugin(CHAIN_ID.PLUGIN.DEFINE).tap(function (args) {
|
|
61
|
+
var _args = _toArray(args),
|
|
62
|
+
vars = _args[0],
|
|
63
|
+
rest = _args.slice(1);
|
|
64
|
+
return [_objectSpread(_objectSpread({}, vars), modernVars)].concat(_toConsumableArray(rest));
|
|
65
|
+
});
|
|
51
66
|
},
|
|
52
67
|
babel: function babel(config) {
|
|
53
68
|
var userConfig = api.useResolvedConfigContext();
|
|
@@ -34,7 +34,11 @@ function getHeadTemplate(beforeEntryTemplate, context) {
|
|
|
34
34
|
var routeAssets = routeManifest.routeAssets;
|
|
35
35
|
var cssChunks = [];
|
|
36
36
|
var matches = matchRoutes(routes, routerContext.location);
|
|
37
|
-
matches === null || matches === void 0 ? void 0 : matches.forEach(function (match) {
|
|
37
|
+
matches === null || matches === void 0 ? void 0 : matches.forEach(function (match, index) {
|
|
38
|
+
// root layout css chunks should't be loaded
|
|
39
|
+
if (!index) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
38
42
|
var routeId = match.route.id;
|
|
39
43
|
if (routeId) {
|
|
40
44
|
var _routeAssets$routeId$ = routeAssets[routeId].assets,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
3
|
import { useContext } from 'react';
|
|
3
4
|
import { createStore } from '@modern-js-reduck/store';
|
|
4
5
|
import { Provider } from '@modern-js-reduck/react';
|
|
@@ -21,9 +22,19 @@ var getStoreConfig = function getStoreConfig(config) {
|
|
|
21
22
|
}).forEach(function (plugin) {
|
|
22
23
|
return plugins.push(StatePluginHandleMap[plugin](config[plugin]));
|
|
23
24
|
});
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
var storeConfig = {};
|
|
26
|
+
for (var _i = 0, _Object$entries = Object.entries(config); _i < _Object$entries.length; _i++) {
|
|
27
|
+
var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
|
|
28
|
+
key = _Object$entries$_i[0],
|
|
29
|
+
value = _Object$entries$_i[1];
|
|
30
|
+
if (internalPlugins.includes(key)) {
|
|
31
|
+
plugins.push(StatePluginHandleMap[key](value));
|
|
32
|
+
} else {
|
|
33
|
+
storeConfig[key] = value;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
storeConfig.plugins = plugins;
|
|
37
|
+
return storeConfig;
|
|
27
38
|
};
|
|
28
39
|
var state = function state(config) {
|
|
29
40
|
return {
|
|
@@ -3,6 +3,7 @@ import { SSRServerContext } from '../../ssr/serverRender/types';
|
|
|
3
3
|
import type { RouterConfig } from './types';
|
|
4
4
|
export declare function createFetchHeaders(requestHeaders: SSRServerContext['request']['headers']): Headers;
|
|
5
5
|
export declare const routerPlugin: ({
|
|
6
|
+
basename,
|
|
6
7
|
routesConfig,
|
|
7
8
|
createRoutes
|
|
8
9
|
}: RouterConfig) => Plugin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from 'react-router-dom/server';
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
+
import { type Model } from '@modern-js-reduck/store';
|
|
1
2
|
import type { Plugin } from '../../core';
|
|
2
|
-
|
|
3
|
-
|
|
3
|
+
declare type StatePluginType = 'immer' | 'effects' | 'autoActions' | 'devtools';
|
|
4
|
+
declare type StateExtraType = {
|
|
5
|
+
initialState: any;
|
|
6
|
+
models: Array<Model>;
|
|
7
|
+
};
|
|
8
|
+
export declare type StateConfig = Partial<Record<StatePluginType, boolean> & StateExtraType>;
|
|
4
9
|
declare const state: (config: StateConfig) => Plugin;
|
|
5
10
|
export default state;
|
|
6
11
|
export * from '../plugins';
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"modern",
|
|
12
12
|
"modern.js"
|
|
13
13
|
],
|
|
14
|
-
"version": "2.0.0-beta.
|
|
14
|
+
"version": "2.0.0-beta.3",
|
|
15
15
|
"engines": {
|
|
16
16
|
"node": ">=14.17.6"
|
|
17
17
|
},
|
|
@@ -72,10 +72,10 @@
|
|
|
72
72
|
"node": "./dist/js/node/router/index.js",
|
|
73
73
|
"default": "./dist/js/treeshaking/router/index.js"
|
|
74
74
|
},
|
|
75
|
-
"./router
|
|
76
|
-
"jsnext:source": "./src/router/server
|
|
77
|
-
"node": "./dist/js/node/router/server
|
|
78
|
-
"default": "./dist/js/treeshaking/router/server
|
|
75
|
+
"./router/server": {
|
|
76
|
+
"jsnext:source": "./src/router/server.ts",
|
|
77
|
+
"node": "./dist/js/node/router/server.js",
|
|
78
|
+
"default": "./dist/js/treeshaking/router/server.js"
|
|
79
79
|
}
|
|
80
80
|
},
|
|
81
81
|
"typesVersions": {
|
|
@@ -110,8 +110,8 @@
|
|
|
110
110
|
"router": [
|
|
111
111
|
"./dist/types/router/index.d.ts"
|
|
112
112
|
],
|
|
113
|
-
"router
|
|
114
|
-
"./dist/types/router/server
|
|
113
|
+
"router/server": [
|
|
114
|
+
"./dist/types/router/runtime/server.d.ts"
|
|
115
115
|
]
|
|
116
116
|
}
|
|
117
117
|
},
|
|
@@ -122,12 +122,12 @@
|
|
|
122
122
|
"@loadable/webpack-plugin": "5.15.2",
|
|
123
123
|
"@loadable/component": "^5.15.0",
|
|
124
124
|
"@loadable/server": "^5.15.1",
|
|
125
|
-
"@modern-js-reduck/plugin-auto-actions": "^1.
|
|
126
|
-
"@modern-js-reduck/plugin-devtools": "^1.
|
|
127
|
-
"@modern-js-reduck/plugin-effects": "^1.
|
|
128
|
-
"@modern-js-reduck/plugin-immutable": "^1.
|
|
129
|
-
"@modern-js-reduck/react": "^1.
|
|
130
|
-
"@modern-js-reduck/store": "^1.
|
|
125
|
+
"@modern-js-reduck/plugin-auto-actions": "^1.1.4",
|
|
126
|
+
"@modern-js-reduck/plugin-devtools": "^1.1.4",
|
|
127
|
+
"@modern-js-reduck/plugin-effects": "^1.1.4",
|
|
128
|
+
"@modern-js-reduck/plugin-immutable": "^1.1.4",
|
|
129
|
+
"@modern-js-reduck/react": "^1.1.4",
|
|
130
|
+
"@modern-js-reduck/store": "^1.1.4",
|
|
131
131
|
"@types/loadable__component": "^5.13.4",
|
|
132
132
|
"@types/react-helmet": "^6.1.2",
|
|
133
133
|
"@types/redux-logger": "^3.0.9",
|
|
@@ -136,16 +136,16 @@
|
|
|
136
136
|
"invariant": "^2.2.4",
|
|
137
137
|
"react-helmet": "^6.1.0",
|
|
138
138
|
"@remix-run/node": "^1.7.0",
|
|
139
|
-
"@remix-run/router": "^1.0.
|
|
139
|
+
"@remix-run/router": "^1.0.4",
|
|
140
140
|
"react-is": "^18",
|
|
141
|
-
"react-router-dom": "^6.4.
|
|
141
|
+
"react-router-dom": "^6.4.4",
|
|
142
142
|
"react-side-effect": "^2.1.1",
|
|
143
143
|
"redux-logger": "^3.0.6",
|
|
144
144
|
"serialize-javascript": "^6.0.0",
|
|
145
145
|
"styled-components": "^5.3.1",
|
|
146
|
-
"@modern-js/plugin": "2.0.0-beta.
|
|
147
|
-
"@modern-js/types": "2.0.0-beta.
|
|
148
|
-
"@modern-js/utils": "2.0.0-beta.
|
|
146
|
+
"@modern-js/plugin": "2.0.0-beta.3",
|
|
147
|
+
"@modern-js/types": "2.0.0-beta.3",
|
|
148
|
+
"@modern-js/utils": "2.0.0-beta.3"
|
|
149
149
|
},
|
|
150
150
|
"peerDependencies": {
|
|
151
151
|
"react": ">=17",
|
|
@@ -166,12 +166,12 @@
|
|
|
166
166
|
"react-dom": "^18",
|
|
167
167
|
"ts-jest": "^27.0.4",
|
|
168
168
|
"typescript": "^4",
|
|
169
|
-
"@modern-js/core": "2.0.0-beta.
|
|
170
|
-
"@modern-js/server-core": "2.0.0-beta.
|
|
171
|
-
"@modern-js/utils": "2.0.0-beta.
|
|
172
|
-
"@scripts/build": "2.0.0-beta.
|
|
173
|
-
"@modern-js/app-tools": "2.0.0-beta.
|
|
174
|
-
"@scripts/jest-config": "2.0.0-beta.
|
|
169
|
+
"@modern-js/core": "2.0.0-beta.3",
|
|
170
|
+
"@modern-js/server-core": "2.0.0-beta.3",
|
|
171
|
+
"@modern-js/utils": "2.0.0-beta.3",
|
|
172
|
+
"@scripts/build": "2.0.0-beta.3",
|
|
173
|
+
"@modern-js/app-tools": "2.0.0-beta.3",
|
|
174
|
+
"@scripts/jest-config": "2.0.0-beta.3"
|
|
175
175
|
},
|
|
176
176
|
"sideEffects": false,
|
|
177
177
|
"modernConfig": {},
|