@modern-js/runtime 2.0.0-beta.1 → 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.
Files changed (52) hide show
  1. package/CHANGELOG.md +181 -0
  2. package/dist/js/modern/cli/index.js +3 -1
  3. package/dist/js/modern/core/compatible.js +4 -3
  4. package/dist/js/modern/document/cli/index.js +10 -8
  5. package/dist/js/modern/document/constants.js +1 -1
  6. package/dist/js/modern/router/runtime/plugin.js +8 -7
  7. package/dist/js/modern/router/runtime/plugin.node.js +10 -6
  8. package/dist/js/modern/router/runtime/server.js +1 -0
  9. package/dist/js/modern/router/runtime/utils.js +2 -4
  10. package/dist/js/modern/ssr/cli/index.js +14 -0
  11. package/dist/js/modern/ssr/serverRender/renderToStream/bulidTemplate.before.js +5 -1
  12. package/dist/js/modern/state/cli/index.js +0 -1
  13. package/dist/js/modern/state/runtime/plugin.js +10 -3
  14. package/dist/js/node/cli/index.js +3 -1
  15. package/dist/js/node/core/compatible.js +4 -3
  16. package/dist/js/node/document/cli/index.js +10 -8
  17. package/dist/js/node/document/constants.js +1 -1
  18. package/dist/js/node/router/runtime/plugin.js +7 -6
  19. package/dist/js/node/router/runtime/plugin.node.js +9 -5
  20. package/dist/js/node/router/runtime/server.js +16 -0
  21. package/dist/js/node/router/runtime/utils.js +2 -4
  22. package/dist/js/node/ssr/cli/index.js +14 -0
  23. package/dist/js/node/ssr/serverRender/renderToStream/bulidTemplate.before.js +5 -1
  24. package/dist/js/node/state/cli/index.js +0 -1
  25. package/dist/js/node/state/runtime/plugin.js +10 -3
  26. package/dist/js/treeshaking/cli/index.js +3 -1
  27. package/dist/js/treeshaking/core/compatible.js +31 -41
  28. package/dist/js/treeshaking/document/cli/index.js +14 -9
  29. package/dist/js/treeshaking/document/constants.js +1 -1
  30. package/dist/js/treeshaking/router/runtime/plugin.js +9 -7
  31. package/dist/js/treeshaking/router/runtime/plugin.node.js +18 -13
  32. package/dist/js/treeshaking/router/runtime/server.js +1 -0
  33. package/dist/js/treeshaking/router/runtime/utils.js +2 -4
  34. package/dist/js/treeshaking/ssr/cli/index.js +15 -0
  35. package/dist/js/treeshaking/ssr/serverRender/renderToStream/bulidTemplate.before.js +5 -1
  36. package/dist/js/treeshaking/state/cli/index.js +0 -1
  37. package/dist/js/treeshaking/state/runtime/plugin.js +14 -3
  38. package/dist/types/cli/index.d.ts +2 -2
  39. package/dist/types/core/compatible.d.ts +6 -8
  40. package/dist/types/core/plugin.d.ts +15 -15
  41. package/dist/types/document/cli/index.d.ts +2 -2
  42. package/dist/types/document/constants.d.ts +1 -1
  43. package/dist/types/router/cli/index.d.ts +2 -2
  44. package/dist/types/router/runtime/plugin.d.ts +1 -0
  45. package/dist/types/router/runtime/plugin.node.d.ts +1 -0
  46. package/dist/types/router/runtime/server.d.ts +1 -0
  47. package/dist/types/router/runtime/types.d.ts +1 -0
  48. package/dist/types/ssr/cli/index.d.ts +2 -2
  49. package/dist/types/ssr/serverRender/types.d.ts +2 -2
  50. package/dist/types/state/cli/index.d.ts +2 -2
  51. package/dist/types/state/runtime/plugin.d.ts +7 -2
  52. package/package.json +28 -27
@@ -14,8 +14,8 @@ declare const runtimeHooks: {
14
14
  client: import("@modern-js/plugin").AsyncPipeline<{
15
15
  App: React.ComponentType<any>;
16
16
  readonly context?: RuntimeContext | undefined;
17
- ModernRender: (App: React.ReactNode) => void;
18
- ModernHydrate: (App: React.ReactNode, callback?: () => void) => void;
17
+ ModernRender: (App: React.ReactElement) => void;
18
+ ModernHydrate: (App: React.ReactElement, callback?: () => void) => void;
19
19
  }, void>;
20
20
  server: import("@modern-js/plugin").AsyncPipeline<{
21
21
  App: React.ComponentType<any>;
@@ -49,8 +49,8 @@ export declare const createRuntime: () => import("@modern-js/plugin").Manager<{
49
49
  client: import("@modern-js/plugin").AsyncPipeline<{
50
50
  App: React.ComponentType<any>;
51
51
  readonly context?: RuntimeContext | undefined;
52
- ModernRender: (App: React.ReactNode) => void;
53
- ModernHydrate: (App: React.ReactNode, callback?: () => void) => void;
52
+ ModernRender: (App: React.ReactElement) => void;
53
+ ModernHydrate: (App: React.ReactElement, callback?: () => void) => void;
54
54
  }, void>;
55
55
  server: import("@modern-js/plugin").AsyncPipeline<{
56
56
  App: React.ComponentType<any>;
@@ -80,8 +80,8 @@ export declare const runtime: import("@modern-js/plugin").Manager<{
80
80
  client: import("@modern-js/plugin").AsyncPipeline<{
81
81
  App: React.ComponentType<any>;
82
82
  readonly context?: RuntimeContext | undefined;
83
- ModernRender: (App: React.ReactNode) => void;
84
- ModernHydrate: (App: React.ReactNode, callback?: () => void) => void;
83
+ ModernRender: (App: React.ReactElement) => void;
84
+ ModernHydrate: (App: React.ReactElement, callback?: () => void) => void;
85
85
  }, void>;
86
86
  server: import("@modern-js/plugin").AsyncPipeline<{
87
87
  App: React.ComponentType<any>;
@@ -107,8 +107,8 @@ export declare const createPlugin: (setup?: Setup<{
107
107
  client: import("@modern-js/plugin").AsyncPipeline<{
108
108
  App: React.ComponentType<any>;
109
109
  readonly context?: RuntimeContext | undefined;
110
- ModernRender: (App: React.ReactNode) => void;
111
- ModernHydrate: (App: React.ReactNode, callback?: () => void) => void;
110
+ ModernRender: (App: React.ReactElement) => void;
111
+ ModernHydrate: (App: React.ReactElement, callback?: () => void) => void;
112
112
  }, void>;
113
113
  server: import("@modern-js/plugin").AsyncPipeline<{
114
114
  App: React.ComponentType<any>;
@@ -133,8 +133,8 @@ export declare const createPlugin: (setup?: Setup<{
133
133
  client: import("@modern-js/plugin").AsyncPipeline<{
134
134
  App: React.ComponentType<any>;
135
135
  readonly context?: RuntimeContext | undefined;
136
- ModernRender: (App: React.ReactNode) => void;
137
- ModernHydrate: (App: React.ReactNode, callback?: () => void) => void;
136
+ ModernRender: (App: React.ReactElement) => void;
137
+ ModernHydrate: (App: React.ReactElement, callback?: () => void) => void;
138
138
  }, void>;
139
139
  server: import("@modern-js/plugin").AsyncPipeline<{
140
140
  App: React.ComponentType<any>;
@@ -159,8 +159,8 @@ export declare const createPlugin: (setup?: Setup<{
159
159
  client: import("@modern-js/plugin").AsyncPipeline<{
160
160
  App: React.ComponentType<any>;
161
161
  readonly context?: RuntimeContext | undefined;
162
- ModernRender: (App: React.ReactNode) => void;
163
- ModernHydrate: (App: React.ReactNode, callback?: () => void) => void;
162
+ ModernRender: (App: React.ReactElement) => void;
163
+ ModernHydrate: (App: React.ReactElement, callback?: () => void) => void;
164
164
  }, void>;
165
165
  server: import("@modern-js/plugin").AsyncPipeline<{
166
166
  App: React.ComponentType<any>;
@@ -173,7 +173,7 @@ export declare const createPlugin: (setup?: Setup<{
173
173
  context: RuntimeContext;
174
174
  pickedContext: TRuntimeContext;
175
175
  }, TRuntimeContext>;
176
- }, Record<string, never>>, Record<string, unknown>> | undefined) => import("@modern-js/plugin").Plugin<{
176
+ }, Record<string, never>>, Record<string, unknown>, any, any> | undefined) => import("@modern-js/plugin").Plugin<{
177
177
  hoc: import("@modern-js/plugin").Pipeline<{
178
178
  App: React.ComponentType<any>;
179
179
  }, React.ComponentType<any>>;
@@ -185,8 +185,8 @@ export declare const createPlugin: (setup?: Setup<{
185
185
  client: import("@modern-js/plugin").AsyncPipeline<{
186
186
  App: React.ComponentType<any>;
187
187
  readonly context?: RuntimeContext | undefined;
188
- ModernRender: (App: React.ReactNode) => void;
189
- ModernHydrate: (App: React.ReactNode, callback?: () => void) => void;
188
+ ModernRender: (App: React.ReactElement) => void;
189
+ ModernHydrate: (App: React.ReactElement, callback?: () => void) => void;
190
190
  }, void>;
191
191
  server: import("@modern-js/plugin").AsyncPipeline<{
192
192
  App: React.ComponentType<any>;
@@ -1,3 +1,3 @@
1
- import type { CliPlugin } from '@modern-js/core';
2
- declare const _default: () => CliPlugin;
1
+ import type { CliPlugin, AppTools } from '@modern-js/app-tools';
2
+ declare const _default: () => CliPlugin<AppTools>;
3
3
  export default _default;
@@ -6,7 +6,7 @@ export declare const HTML_SSRDATASCRIPT_SEPARATOR = "<!--<?- SSRDataScript ?>-->
6
6
  export declare const DOCUMENT_SSR_PLACEHOLDER: string;
7
7
  export declare const DOCUMENT_CHUNKSMAP_PLACEHOLDER: string;
8
8
  export declare const DOCUMENT_SSRDATASCRIPT_PLACEHOLDER: string;
9
- export declare const DOCUMENT_FILE_NAME = "document";
9
+ export declare const DOCUMENT_FILE_NAME = "Document";
10
10
  export declare const DOCUMENT_SCRIPTS_PLACEHOLDER: string;
11
11
  export declare const DOCUMENT_NO_SCRIPTE_PLACEHOLDER: string;
12
12
  export declare const PLACEHOLDER_REPLACER_MAP: {
@@ -1,3 +1,3 @@
1
- import type { CliPlugin } from '@modern-js/core';
2
- declare const _default: () => CliPlugin;
1
+ import type { CliPlugin, AppTools } from '@modern-js/app-tools';
2
+ declare const _default: () => CliPlugin<AppTools>;
3
3
  export default _default;
@@ -3,6 +3,7 @@ import type { RouterConfig } from './types';
3
3
  export declare const routerPlugin: ({
4
4
  serverBase,
5
5
  supportHtml5History,
6
+ basename,
6
7
  routesConfig,
7
8
  createRoutes
8
9
  }: RouterConfig) => Plugin;
@@ -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';
@@ -32,5 +32,6 @@ export declare type RouterConfig = {
32
32
  };
33
33
  serverBase?: string[];
34
34
  supportHtml5History?: boolean;
35
+ basename?: string;
35
36
  createRoutes?: () => RouteObject[];
36
37
  };
@@ -1,3 +1,3 @@
1
- import type { CliPlugin } from '@modern-js/core';
2
- declare const _default: () => CliPlugin;
1
+ import type { CliPlugin, AppTools } from '@modern-js/app-tools';
2
+ declare const _default: () => CliPlugin<AppTools>;
3
3
  export default _default;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import type { ServerConfig } from '@modern-js/core';
2
+ import { ServerUserConfig } from '@modern-js/app-tools';
3
3
  import type { RuntimeContext } from '../../core';
4
4
  import { RenderLevel } from './renderToString/type';
5
5
  export type { SSRServerContext } from './renderToString/type';
@@ -7,7 +7,7 @@ export declare type ModernSSRReactComponent = React.ComponentType<any>;
7
7
  export { RuntimeContext, RenderLevel };
8
8
  export declare type SSRPluginConfig = {
9
9
  crossorigin?: boolean | 'anonymous' | 'use-credentials';
10
- } & Exclude<ServerConfig['ssr'], boolean>;
10
+ } & Exclude<ServerUserConfig['ssr'], boolean>;
11
11
  export declare type ServerRenderOptions = {
12
12
  App: ModernSSRReactComponent;
13
13
  config: SSRPluginConfig;
@@ -1,3 +1,3 @@
1
- import type { CliPlugin } from '@modern-js/core';
2
- declare const _default: () => CliPlugin;
1
+ import type { CliPlugin, AppTools } from '@modern-js/app-tools';
2
+ declare const _default: () => CliPlugin<AppTools>;
3
3
  export default _default;
@@ -1,6 +1,11 @@
1
+ import { type Model } from '@modern-js-reduck/store';
1
2
  import type { Plugin } from '../../core';
2
- export declare type StatePluginType = 'immer' | 'effects' | 'autoActions' | 'devtools';
3
- export declare type StateConfig = Partial<Record<StatePluginType, boolean>>;
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.1",
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-server": {
76
- "jsnext:source": "./src/router/server/index.ts",
77
- "node": "./dist/js/node/router/server/index.js",
78
- "default": "./dist/js/treeshaking/router/server/index.js"
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-server": [
114
- "./dist/types/router/server/index.d.ts"
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.0.2",
126
- "@modern-js-reduck/plugin-devtools": "^1.0.3",
127
- "@modern-js-reduck/plugin-effects": "^1.0.2",
128
- "@modern-js-reduck/plugin-immutable": "^1.0.1",
129
- "@modern-js-reduck/react": "^1.0.1",
130
- "@modern-js-reduck/store": "^1.0.3",
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.1",
139
+ "@remix-run/router": "^1.0.4",
140
140
  "react-is": "^18",
141
- "react-router-dom": "^6.4.0",
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.1",
147
- "@modern-js/types": "2.0.0-beta.1",
148
- "@modern-js/utils": "2.0.0-beta.1"
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,11 +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.1",
170
- "@modern-js/server-core": "2.0.0-beta.1",
171
- "@modern-js/utils": "2.0.0-beta.1",
172
- "@scripts/build": "2.0.0-beta.1",
173
- "@scripts/jest-config": "2.0.0-beta.1"
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"
174
175
  },
175
176
  "sideEffects": false,
176
177
  "modernConfig": {},
@@ -179,9 +180,9 @@
179
180
  "access": "public"
180
181
  },
181
182
  "scripts": {
182
- "dev": "modern build --watch",
183
- "new": "modern new",
184
- "build": "modern build",
185
- "test": "jest --passWithNoTests"
183
+ "dev": "modern-lib build --watch",
184
+ "new": "modern-lib new",
185
+ "build": "modern-lib build",
186
+ "test": "jest"
186
187
  }
187
188
  }