@modern-js/runtime 1.15.0 → 1.17.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 +56 -0
- package/dist/js/modern/cli/index.js +5 -12
- package/dist/js/modern/core/compatible.js +31 -8
- package/dist/js/modern/core/index.js +3 -3
- package/dist/js/modern/core/loader/useLoader.js +1 -1
- package/dist/js/modern/{core/runtime-context.js → runtime-context.js} +0 -0
- package/dist/js/modern/ssr/index.js +32 -15
- package/dist/js/modern/ssr/index.node.js +4 -1
- package/dist/js/modern/ssr/react/withCallback/index.js +17 -0
- package/dist/js/modern/ssr/serverRender/helmet.js +2 -2
- package/dist/js/modern/ssr/serverRender/index.js +0 -1
- package/dist/js/node/cli/index.js +4 -12
- package/dist/js/node/core/compatible.js +32 -8
- package/dist/js/node/core/index.js +1 -1
- package/dist/js/node/core/loader/useLoader.js +1 -1
- package/dist/js/node/{core/runtime-context.js → runtime-context.js} +0 -0
- package/dist/js/node/ssr/index.js +35 -17
- package/dist/js/node/ssr/index.node.js +4 -1
- package/dist/js/node/ssr/react/withCallback/index.js +27 -0
- package/dist/js/node/ssr/serverRender/helmet.js +2 -2
- package/dist/js/node/ssr/serverRender/index.js +0 -2
- package/dist/js/treeshaking/cli/index.js +5 -11
- package/dist/js/treeshaking/core/compatible.js +63 -23
- package/dist/js/treeshaking/core/index.js +3 -3
- package/dist/js/treeshaking/core/loader/useLoader.js +1 -1
- package/dist/js/treeshaking/{core/runtime-context.js → runtime-context.js} +0 -0
- package/dist/js/treeshaking/ssr/index.js +42 -34
- package/dist/js/treeshaking/ssr/index.node.js +12 -9
- package/dist/js/treeshaking/ssr/react/withCallback/index.js +16 -0
- package/dist/js/treeshaking/ssr/serverRender/helmet.js +2 -2
- package/dist/js/treeshaking/ssr/serverRender/index.js +0 -1
- package/dist/types/common.d.ts +8 -1
- package/dist/types/core/app-config.d.ts +1 -3
- package/dist/types/core/compatible.d.ts +11 -2
- package/dist/types/core/index.d.ts +2 -3
- package/dist/types/core/loader/useLoader.d.ts +1 -0
- package/dist/types/core/plugin.d.ts +15 -8
- package/dist/types/index.d.ts +4 -8
- package/dist/types/runtime-context.d.ts +24 -0
- package/dist/types/ssr/index.d.ts +0 -7
- package/dist/types/ssr/react/nossr/index.d.ts +1 -1
- package/dist/types/ssr/react/withCallback/index.d.ts +5 -0
- package/dist/types/ssr/serverRender/index.d.ts +0 -5
- package/dist/types/state/runtime/plugin.d.ts +1 -12
- package/package.json +14 -11
- package/dist/types/core/runtime-context.d.ts +0 -13
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Store } from '@modern-js-reduck/store';
|
|
3
|
+
import { createLoaderManager } from './core/loader/loaderManager';
|
|
4
|
+
import { runtime } from './core/plugin';
|
|
5
|
+
import { SSRServerContext } from './ssr/serverRender/type';
|
|
6
|
+
export interface BaseRuntimeContext {
|
|
7
|
+
loaderManager: ReturnType<typeof createLoaderManager>;
|
|
8
|
+
runner: ReturnType<typeof runtime.init>;
|
|
9
|
+
ssrContext?: SSRServerContext;
|
|
10
|
+
store?: Store;
|
|
11
|
+
}
|
|
12
|
+
export interface RuntimeContext extends BaseRuntimeContext {
|
|
13
|
+
[key: string]: any;
|
|
14
|
+
}
|
|
15
|
+
export declare const RuntimeReactContext: import("react").Context<RuntimeContext>;
|
|
16
|
+
export interface BaseTRuntimeContext {
|
|
17
|
+
initialData?: Record<string, unknown>;
|
|
18
|
+
request?: SSRServerContext['request'];
|
|
19
|
+
response?: SSRServerContext['response'];
|
|
20
|
+
store?: Store;
|
|
21
|
+
}
|
|
22
|
+
export interface TRuntimeContext extends BaseTRuntimeContext {
|
|
23
|
+
[key: string]: any;
|
|
24
|
+
}
|
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
import type { Plugin } from '../core';
|
|
2
2
|
import { RenderLevel, SSRServerContext } from './serverRender/type';
|
|
3
3
|
declare module '../core' {
|
|
4
|
-
interface RuntimeContext {
|
|
5
|
-
ssrContext: SSRServerContext;
|
|
6
|
-
}
|
|
7
|
-
interface TRuntimeContext {
|
|
8
|
-
request: SSRServerContext['request'];
|
|
9
|
-
response: SSRServerContext['response'];
|
|
10
|
-
}
|
|
11
4
|
interface SSRContainer {
|
|
12
5
|
renderLevel: RenderLevel;
|
|
13
6
|
context?: SSRServerContext;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
export declare const NoSSR: (props: React.PropsWithChildren<
|
|
2
|
+
export declare const NoSSR: (props: React.PropsWithChildren<unknown>) => React.FunctionComponentElement<{}>;
|
|
@@ -1,8 +1,3 @@
|
|
|
1
1
|
import { RuntimeContext } from '../../core';
|
|
2
2
|
import { ModernSSRReactComponent } from './type';
|
|
3
|
-
declare module '@modern-js/runtime' {
|
|
4
|
-
interface RuntimeContext {
|
|
5
|
-
ssrContext?: any;
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
3
|
export declare const render: (ctx: RuntimeContext, _: string | undefined, App: ModernSSRReactComponent) => Promise<string>;
|
|
@@ -1,16 +1,5 @@
|
|
|
1
|
-
import { createStore
|
|
1
|
+
import { createStore } from '@modern-js-reduck/store';
|
|
2
2
|
import type { Plugin } from '../../core';
|
|
3
|
-
declare module '../../core' {
|
|
4
|
-
interface RuntimeContext {
|
|
5
|
-
store: Store;
|
|
6
|
-
}
|
|
7
|
-
interface TRuntimeContext {
|
|
8
|
-
store: Store;
|
|
9
|
-
}
|
|
10
|
-
interface SSRData {
|
|
11
|
-
storeState: any;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
3
|
export declare type StateConfig = Parameters<typeof createStore>[0];
|
|
15
4
|
declare const state: (config: StateConfig) => Plugin;
|
|
16
5
|
export default state;
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"modern",
|
|
12
12
|
"modern.js"
|
|
13
13
|
],
|
|
14
|
-
"version": "1.
|
|
14
|
+
"version": "1.17.0",
|
|
15
15
|
"jsnext:source": "./src/index.ts",
|
|
16
16
|
"types": "./type.d.ts",
|
|
17
17
|
"main": "./dist/js/node/index.js",
|
|
@@ -140,9 +140,9 @@
|
|
|
140
140
|
"@loadable/babel-plugin": "^5.13.2",
|
|
141
141
|
"@loadable/server": "^5.15.1",
|
|
142
142
|
"@loadable/component": "^5.15.0",
|
|
143
|
-
"@modern-js/plugin": "1.
|
|
144
|
-
"@modern-js/webpack": "1.
|
|
145
|
-
"@modern-js/utils": "1.
|
|
143
|
+
"@modern-js/plugin": "1.17.0",
|
|
144
|
+
"@modern-js/webpack": "1.17.0",
|
|
145
|
+
"@modern-js/utils": "1.17.0",
|
|
146
146
|
"@modern-js-reduck/plugin-auto-actions": "^1.0.2",
|
|
147
147
|
"@modern-js-reduck/plugin-devtools": "^1.0.3",
|
|
148
148
|
"@modern-js-reduck/plugin-effects": "^1.0.2",
|
|
@@ -156,24 +156,26 @@
|
|
|
156
156
|
"@types/loadable__component": "^5.13.4",
|
|
157
157
|
"@types/styled-components": "^5.1.14"
|
|
158
158
|
},
|
|
159
|
+
"peerDependencies": {
|
|
160
|
+
"react": ">=17",
|
|
161
|
+
"react-dom": ">=17"
|
|
162
|
+
},
|
|
159
163
|
"devDependencies": {
|
|
160
164
|
"react": "^17",
|
|
161
165
|
"react-dom": "^17",
|
|
162
166
|
"ts-jest": "^27.0.4",
|
|
163
167
|
"typescript": "^4",
|
|
164
168
|
"jest": "^27",
|
|
165
|
-
"@modern-js/core": "1.
|
|
166
|
-
"@modern-js/types": "1.
|
|
167
|
-
"@modern-js/utils": "1.
|
|
169
|
+
"@modern-js/core": "1.17.0",
|
|
170
|
+
"@modern-js/types": "1.17.0",
|
|
171
|
+
"@modern-js/utils": "1.17.0",
|
|
168
172
|
"@types/jest": "^27",
|
|
169
173
|
"@types/node": "^14",
|
|
170
|
-
"@types/react": "^17",
|
|
171
|
-
"@types/react-dom": "^17",
|
|
172
174
|
"@types/react-side-effect": "^1.1.1",
|
|
173
175
|
"@types/loadable__webpack-plugin": "^5.7.3",
|
|
174
176
|
"@types/serialize-javascript": "^5.0.1",
|
|
175
|
-
"@scripts/build": "1.
|
|
176
|
-
"@scripts/jest-config": "1.
|
|
177
|
+
"@scripts/build": "1.17.0",
|
|
178
|
+
"@scripts/jest-config": "1.17.0",
|
|
177
179
|
"@testing-library/react": "^12.0.0",
|
|
178
180
|
"@testing-library/react-hooks": "^7.0.1",
|
|
179
181
|
"@types/hoist-non-react-statics": "^3.3.1",
|
|
@@ -209,6 +211,7 @@
|
|
|
209
211
|
}
|
|
210
212
|
},
|
|
211
213
|
"scripts": {
|
|
214
|
+
"dev": "modern build --watch",
|
|
212
215
|
"new": "modern new",
|
|
213
216
|
"build": "wireit",
|
|
214
217
|
"test": "wireit"
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { createLoaderManager } from './loader/loaderManager';
|
|
3
|
-
import { runtime } from './plugin';
|
|
4
|
-
export interface RuntimeContext {
|
|
5
|
-
loaderManager: ReturnType<typeof createLoaderManager>;
|
|
6
|
-
runner: ReturnType<typeof runtime.init>;
|
|
7
|
-
[key: string]: any;
|
|
8
|
-
}
|
|
9
|
-
export declare const RuntimeReactContext: import("react").Context<RuntimeContext>;
|
|
10
|
-
export interface TRuntimeContext {
|
|
11
|
-
initialData?: Record<string, unknown>;
|
|
12
|
-
[key: string]: any;
|
|
13
|
-
}
|