@modern-js/runtime 2.7.0 → 2.8.0

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
@@ -1,5 +1,30 @@
1
1
  # @modern-js/runtime
2
2
 
3
+ ## 2.8.0
4
+
5
+ ### Patch Changes
6
+
7
+ - 3ef832741b: fix: fix types pathname for model field
8
+ fix: 修复 model 字段对应的 types 路径
9
+ - 9330022f4e: fix: add missing react-router type
10
+ fix: 添加丢失的 react-router 导出类型
11
+ - 40747e6fdd: fix: fix the order of runtime plugins
12
+ fix: 修复 runtime plugin 执行顺序
13
+ - 58a1fc64da: fix: pass basename to `matchRoutes`
14
+ fix: 修复 `matchRoutes` 未传入 basename 参数
15
+ - 4cfea8ce49: fix: remove esbuild from bff-core
16
+ fix: 从 bff-core 移除 esbuild
17
+ - 1f6ca2c7fb: fix: nested routes in ssg
18
+ fix: 修复嵌套路由在 SSG 中的问题
19
+ - 9c9ebba6f2: fix: fix duplicate re-exports of reduck
20
+ fix: 修复从 reduck 重复导出的 API
21
+ - Updated dependencies [1104a9f18b]
22
+ - Updated dependencies [70d82e1408]
23
+ - Updated dependencies [1f6ca2c7fb]
24
+ - @modern-js/utils@2.8.0
25
+ - @modern-js/types@2.8.0
26
+ - @modern-js/plugin@2.8.0
27
+
3
28
  ## 2.7.0
4
29
 
5
30
  ### Minor Changes
package/README.md CHANGED
@@ -19,8 +19,8 @@ Please follow [Quick Start](https://modernjs.dev/en/guides/get-started/quick-sta
19
19
 
20
20
  ## Contributing
21
21
 
22
- Please read the [Contributing Guide](https://github.com/modern-js-dev/modern.js/blob/main/CONTRIBUTING.md).
22
+ Please read the [Contributing Guide](https://github.com/web-infra-dev/modern.js/blob/main/CONTRIBUTING.md).
23
23
 
24
24
  ## License
25
25
 
26
- Modern.js is [MIT licensed](https://github.com/modern-js-dev/modern.js/blob/main/LICENSE).
26
+ Modern.js is [MIT licensed](https://github.com/web-infra-dev/modern.js/blob/main/LICENSE).
@@ -39,13 +39,14 @@ var import_cli4 = __toESM(require("../document/cli"));
39
39
  var cli_default = () => ({
40
40
  name: "@modern-js/runtime",
41
41
  post: [
42
- "@modern-js/plugin-router",
43
42
  "@modern-js/plugin-ssr",
44
- "@modern-js/plugin-document",
45
43
  "@modern-js/plugin-state",
44
+ "@modern-js/plugin-router",
45
+ "@modern-js/plugin-document",
46
46
  "@modern-js/plugin-design-token"
47
47
  ],
48
- usePlugins: [(0, import_cli.default)(), (0, import_cli2.default)(), (0, import_cli3.default)(), (0, import_cli4.default)()],
48
+ // the order of runtime plugins is affected by runtime hooks, mainly `init` and `hoc` hooks
49
+ usePlugins: [(0, import_cli2.default)(), (0, import_cli.default)(), (0, import_cli3.default)(), (0, import_cli4.default)()],
49
50
  setup: (api) => {
50
51
  return {
51
52
  config() {
@@ -138,8 +138,7 @@ var cli_default = () => ({
138
138
  );
139
139
  }
140
140
  }
141
- const ssgConfig = userConfig.output.ssg;
142
- const useSSG = (0, import_utils.isSingleEntry)(entrypoints) ? Boolean(ssgConfig) : ssgConfig === true || typeof (ssgConfig == null ? void 0 : ssgConfig[0]) === "function" || Boolean(ssgConfig == null ? void 0 : ssgConfig[entryName]);
141
+ const useSSG = (0, import_utils.isSSGEntry)(userConfig, entryName, entrypoints);
143
142
  ssrConfigMap.set(entryName, ssrConfig || useSSG);
144
143
  if (ssrConfig || useSSG) {
145
144
  imports.push({
@@ -58,7 +58,11 @@ function getHeadTemplate(beforeEntryTemplate, context) {
58
58
  }
59
59
  const { routeAssets } = routeManifest;
60
60
  const cssChunks = [];
61
- const matches = (0, import_react_router_dom.matchRoutes)(routes, routerContext.location);
61
+ const matches = (0, import_react_router_dom.matchRoutes)(
62
+ routes,
63
+ routerContext.location,
64
+ routerContext.basename
65
+ );
62
66
  matches == null ? void 0 : matches.forEach((match, index) => {
63
67
  if (!index) {
64
68
  return;
@@ -28,17 +28,11 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
  var runtime_exports = {};
30
30
  __export(runtime_exports, {
31
- createStore: () => import_store.createStore,
32
- default: () => import_plugin.default,
33
- model: () => import_store.model
31
+ default: () => import_plugin.default
34
32
  });
35
33
  module.exports = __toCommonJS(runtime_exports);
36
34
  __reExport(runtime_exports, require("@modern-js-reduck/react"), module.exports);
37
- var import_store = require("@modern-js-reduck/store");
38
35
  var import_plugin = __toESM(require("./plugin"));
39
36
  __reExport(runtime_exports, require("./plugin"), module.exports);
40
37
  // Annotate the CommonJS export names for ESM import in node:
41
- 0 && (module.exports = {
42
- createStore,
43
- model
44
- });
38
+ 0 && (module.exports = {});
@@ -132,15 +132,16 @@ var cli_default = function() {
132
132
  return {
133
133
  name: "@modern-js/runtime",
134
134
  post: [
135
- "@modern-js/plugin-router",
136
135
  "@modern-js/plugin-ssr",
137
- "@modern-js/plugin-document",
138
136
  "@modern-js/plugin-state",
137
+ "@modern-js/plugin-router",
138
+ "@modern-js/plugin-document",
139
139
  "@modern-js/plugin-design-token"
140
140
  ],
141
+ // the order of runtime plugins is affected by runtime hooks, mainly `init` and `hoc` hooks
141
142
  usePlugins: [
142
- PluginState(),
143
143
  PluginSSR(),
144
+ PluginState(),
144
145
  PluginRouter(),
145
146
  Document()
146
147
  ],
@@ -61,7 +61,7 @@ function _unsupportedIterableToArray(o, minLen) {
61
61
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
62
62
  }
63
63
  import path from "path";
64
- import { getEntryOptions, SERVER_RENDER_FUNCTION_NAME, LOADABLE_STATS_FILE, isUseSSRBundle, createRuntimeExportsUtils, isSingleEntry } from "@modern-js/utils";
64
+ import { getEntryOptions, SERVER_RENDER_FUNCTION_NAME, LOADABLE_STATS_FILE, isUseSSRBundle, createRuntimeExportsUtils, isSSGEntry } from "@modern-js/utils";
65
65
  var PLUGIN_IDENTIFIER = "ssr";
66
66
  var hasStringSSREntry = function(userConfig) {
67
67
  var isStreaming = function(ssr) {
@@ -165,8 +165,7 @@ var cli_default = function() {
165
165
  throw new Error("You should switch to file-system based router to support streaming SSR.");
166
166
  }
167
167
  }
168
- var ssgConfig = userConfig.output.ssg;
169
- var useSSG = isSingleEntry(entrypoints) ? Boolean(ssgConfig) : ssgConfig === true || typeof (ssgConfig === null || ssgConfig === void 0 ? void 0 : ssgConfig[0]) === "function" || Boolean(ssgConfig === null || ssgConfig === void 0 ? void 0 : ssgConfig[entryName]);
168
+ var useSSG = isSSGEntry(userConfig, entryName, entrypoints);
170
169
  ssrConfigMap.set(entryName, ssrConfig || useSSG);
171
170
  if (ssrConfig || useSSG) {
172
171
  imports.push({
@@ -71,7 +71,7 @@ function getHeadTemplate(beforeEntryTemplate, context) {
71
71
  }
72
72
  var routeAssets = routeManifest.routeAssets;
73
73
  var cssChunks = [];
74
- var matches = matchRoutes(routes, routerContext.location);
74
+ var matches = matchRoutes(routes, routerContext.location, routerContext.basename);
75
75
  matches === null || matches === void 0 ? void 0 : matches.forEach(function(match, index) {
76
76
  if (!index) {
77
77
  return;
@@ -1,5 +1,4 @@
1
1
  export * from "@modern-js-reduck/react";
2
- import { model, createStore } from "@modern-js-reduck/store";
3
2
  import { default as default2 } from "./plugin";
4
3
  export * from "./plugin";
5
- export { createStore, default2 as default, model };
4
+ export { default2 as default };
@@ -7,13 +7,14 @@ import Document from "../document/cli";
7
7
  var cli_default = () => ({
8
8
  name: "@modern-js/runtime",
9
9
  post: [
10
- "@modern-js/plugin-router",
11
10
  "@modern-js/plugin-ssr",
12
- "@modern-js/plugin-document",
13
11
  "@modern-js/plugin-state",
12
+ "@modern-js/plugin-router",
13
+ "@modern-js/plugin-document",
14
14
  "@modern-js/plugin-design-token"
15
15
  ],
16
- usePlugins: [PluginState(), PluginSSR(), PluginRouter(), Document()],
16
+ // the order of runtime plugins is affected by runtime hooks, mainly `init` and `hoc` hooks
17
+ usePlugins: [PluginSSR(), PluginState(), PluginRouter(), Document()],
17
18
  setup: (api) => {
18
19
  return {
19
20
  config() {
@@ -5,7 +5,7 @@ import {
5
5
  LOADABLE_STATS_FILE,
6
6
  isUseSSRBundle,
7
7
  createRuntimeExportsUtils,
8
- isSingleEntry
8
+ isSSGEntry
9
9
  } from "@modern-js/utils";
10
10
  const PLUGIN_IDENTIFIER = "ssr";
11
11
  const hasStringSSREntry = (userConfig) => {
@@ -113,8 +113,7 @@ var cli_default = () => ({
113
113
  );
114
114
  }
115
115
  }
116
- const ssgConfig = userConfig.output.ssg;
117
- const useSSG = isSingleEntry(entrypoints) ? Boolean(ssgConfig) : ssgConfig === true || typeof (ssgConfig == null ? void 0 : ssgConfig[0]) === "function" || Boolean(ssgConfig == null ? void 0 : ssgConfig[entryName]);
116
+ const useSSG = isSSGEntry(userConfig, entryName, entrypoints);
118
117
  ssrConfigMap.set(entryName, ssrConfig || useSSG);
119
118
  if (ssrConfig || useSSG) {
120
119
  imports.push({
@@ -29,7 +29,11 @@ function getHeadTemplate(beforeEntryTemplate, context) {
29
29
  }
30
30
  const { routeAssets } = routeManifest;
31
31
  const cssChunks = [];
32
- const matches = matchRoutes(routes, routerContext.location);
32
+ const matches = matchRoutes(
33
+ routes,
34
+ routerContext.location,
35
+ routerContext.basename
36
+ );
33
37
  matches == null ? void 0 : matches.forEach((match, index) => {
34
38
  if (!index) {
35
39
  return;
@@ -1,9 +1,6 @@
1
1
  export * from "@modern-js-reduck/react";
2
- import { model, createStore } from "@modern-js-reduck/store";
3
2
  import { default as default2 } from "./plugin";
4
3
  export * from "./plugin";
5
4
  export {
6
- createStore,
7
- default2 as default,
8
- model
5
+ default2 as default
9
6
  };
@@ -4,6 +4,6 @@ export type { SingleRouteConfig, RouterConfig };
4
4
  export default routerPlugin;
5
5
  export { modifyRoutes } from './plugin';
6
6
  export * from './withRouter';
7
- export type { FormEncType, FormMethod, GetScrollRestorationKeyFunction, ParamKeyValuePair, SubmitOptions, URLSearchParamsInit, FetcherWithComponents, ActionFunction, ActionFunctionArgs, AwaitProps, unstable_Blocker, unstable_BlockerFunction, DataRouteMatch, DataRouteObject, Fetcher, Hash, IndexRouteObject, IndexRouteProps, JsonFunction, LayoutRouteProps, LoaderFunction, LoaderFunctionArgs, Location, MemoryRouterProps, NavigateFunction, NavigateOptions, NavigateProps, Navigation, Navigator, NonIndexRouteObject, OutletProps, Params, ParamParseKey, Path, PathMatch, Pathname, PathPattern, PathRouteProps, RedirectFunction, RelativeRoutingType, RouteMatch, RouteObject, RouteProps, RouterProps, RouterProviderProps, RoutesProps, Search, ShouldRevalidateFunction, To } from 'react-router-dom';
7
+ export type { FormEncType, FormMethod, GetScrollRestorationKeyFunction, ParamKeyValuePair, SubmitOptions, URLSearchParamsInit, FetcherWithComponents, ActionFunction, ActionFunctionArgs, AwaitProps, unstable_Blocker, unstable_BlockerFunction, DataRouteMatch, DataRouteObject, Fetcher, Hash, IndexRouteObject, IndexRouteProps, JsonFunction, LayoutRouteProps, LoaderFunction, LoaderFunctionArgs, Location, MemoryRouterProps, NavigateFunction, NavigateOptions, NavigateProps, Navigation, Navigator, NavLinkProps, NonIndexRouteObject, OutletProps, Params, ParamParseKey, Path, PathMatch, Pathname, PathPattern, PathRouteProps, RedirectFunction, RelativeRoutingType, RouteMatch, RouteObject, RouteProps, RouterProps, RouterProviderProps, RoutesProps, Search, ShouldRevalidateFunction, To } from 'react-router-dom';
8
8
  export { createBrowserRouter, createHashRouter, createMemoryRouter, RouterProvider, BrowserRouter, HashRouter, MemoryRouter, Router, Await, Form, Link, NavLink, Navigate, Outlet, Route, Routes, ScrollRestoration, useActionData, useAsyncError, useAsyncValue, useBeforeUnload, useFetcher, useFetchers, useFormAction, useHref, useInRouterContext, useLinkClickHandler, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes, useSearchParams, useSubmit, createRoutesFromChildren, createRoutesFromElements, createSearchParams, generatePath, isRouteErrorResponse, matchPath, matchRoutes, renderMatches, resolvePath } from 'react-router-dom';
9
9
  export { defer, json, redirect } from '@modern-js/utils/remix-router';
@@ -1,4 +1,3 @@
1
1
  export * from '@modern-js-reduck/react';
2
- export { model, createStore } from '@modern-js-reduck/store';
3
2
  export { default } from './plugin';
4
3
  export * from './plugin';
package/package.json CHANGED
@@ -2,8 +2,8 @@
2
2
  "name": "@modern-js/runtime",
3
3
  "description": "A Progressive React Framework for modern web development.",
4
4
  "homepage": "https://modernjs.dev",
5
- "bugs": "https://github.com/modern-js-dev/modern.js/issues",
6
- "repository": "modern-js-dev/modern.js",
5
+ "bugs": "https://github.com/web-infra-dev/modern.js/issues",
6
+ "repository": "web-infra-dev/modern.js",
7
7
  "license": "MIT",
8
8
  "keywords": [
9
9
  "react",
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "2.7.0",
14
+ "version": "2.8.0",
15
15
  "engines": {
16
16
  "node": ">=14.17.6"
17
17
  },
@@ -67,7 +67,7 @@
67
67
  },
68
68
  "./model": {
69
69
  "jsnext:source": "./src/state/index.ts",
70
- "types": "./dist/types/model.d.ts",
70
+ "types": "./types/model.d.ts",
71
71
  "default": "./dist/esm/state/index.js"
72
72
  },
73
73
  "./cli": {
@@ -158,9 +158,9 @@
158
158
  "react-side-effect": "^2.1.1",
159
159
  "redux-logger": "^3.0.6",
160
160
  "styled-components": "^5.3.1",
161
- "@modern-js/plugin": "2.7.0",
162
- "@modern-js/types": "2.7.0",
163
- "@modern-js/utils": "2.7.0"
161
+ "@modern-js/plugin": "2.8.0",
162
+ "@modern-js/types": "2.8.0",
163
+ "@modern-js/utils": "2.8.0"
164
164
  },
165
165
  "peerDependencies": {
166
166
  "react": ">=17",
@@ -181,11 +181,11 @@
181
181
  "react-dom": "^18",
182
182
  "ts-jest": "^27.0.4",
183
183
  "typescript": "^4",
184
- "@modern-js/core": "2.7.0",
185
- "@modern-js/server-core": "2.7.0",
186
- "@modern-js/app-tools": "2.7.0",
187
- "@scripts/build": "2.7.0",
188
- "@scripts/jest-config": "2.7.0"
184
+ "@modern-js/app-tools": "2.8.0",
185
+ "@modern-js/core": "2.8.0",
186
+ "@modern-js/server-core": "2.8.0",
187
+ "@scripts/jest-config": "2.8.0",
188
+ "@scripts/build": "2.8.0"
189
189
  },
190
190
  "sideEffects": false,
191
191
  "modernConfig": {},
package/types/router.d.ts CHANGED
@@ -3,7 +3,7 @@ import '../dist/types/router';
3
3
 
4
4
  declare module '@modern-js/app-tools' {
5
5
  interface RuntimeUserConfig {
6
- router?: RouterConfig | boolean;
6
+ router?: Partial<RouterConfig> | boolean;
7
7
  }
8
8
  }
9
9