@modern-js/runtime 2.41.0 → 2.42.1
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/dist/cjs/document/DocumentStructureContext.js +2 -1
- package/dist/cjs/document/Head.js +7 -5
- package/dist/cjs/document/Html.js +2 -0
- package/dist/cjs/document/Title.js +34 -0
- package/dist/cjs/document/cli/index.js +5 -1
- package/dist/cjs/document/constants.js +3 -0
- package/dist/cjs/router/runtime/index.js +6 -2
- package/dist/cjs/router/runtime/plugin.js +2 -2
- package/dist/cjs/router/runtime/{shouldRevalidate.js → routeModule.js} +19 -5
- package/dist/cjs/ssr/index.js +3 -3
- package/dist/cjs/ssr/serverRender/tracker.js +9 -6
- package/dist/esm/document/DocumentStructureContext.js +2 -1
- package/dist/esm/document/Head.js +7 -5
- package/dist/esm/document/Html.js +2 -0
- package/dist/esm/document/Title.js +10 -0
- package/dist/esm/document/cli/index.js +9 -3
- package/dist/esm/document/constants.js +2 -0
- package/dist/esm/router/runtime/index.js +3 -1
- package/dist/esm/router/runtime/plugin.js +1 -1
- package/dist/esm/router/runtime/{shouldRevalidate.js → routeModule.js} +13 -1
- package/dist/esm/ssr/index.js +1 -1
- package/dist/esm/ssr/serverRender/tracker.js +9 -6
- package/dist/esm-node/document/DocumentStructureContext.js +2 -1
- package/dist/esm-node/document/Head.js +7 -5
- package/dist/esm-node/document/Html.js +2 -0
- package/dist/esm-node/document/Title.js +10 -0
- package/dist/esm-node/document/cli/index.js +6 -2
- package/dist/esm-node/document/constants.js +2 -0
- package/dist/esm-node/router/runtime/index.js +3 -1
- package/dist/esm-node/router/runtime/plugin.js +1 -1
- package/dist/esm-node/router/runtime/{shouldRevalidate.js → routeModule.js} +13 -1
- package/dist/esm-node/ssr/index.js +1 -1
- package/dist/esm-node/ssr/serverRender/tracker.js +9 -6
- package/dist/types/cli/index.d.ts +1 -1
- package/dist/types/common.d.ts +3 -3
- package/dist/types/config.d.ts +5 -5
- package/dist/types/core/appConfig.d.ts +1 -1
- package/dist/types/core/compatible.d.ts +8 -11
- package/dist/types/core/index.d.ts +1 -1
- package/dist/types/core/loader/index.d.ts +1 -1
- package/dist/types/core/loader/loaderManager.d.ts +38 -38
- package/dist/types/core/loader/useLoader.d.ts +31 -31
- package/dist/types/core/plugin.d.ts +178 -177
- package/dist/types/core/types.d.ts +12 -12
- package/dist/types/document/Body.d.ts +2 -2
- package/dist/types/document/Comment.d.ts +3 -3
- package/dist/types/document/DocumentContext.d.ts +9 -9
- package/dist/types/document/DocumentStructureContext.d.ts +8 -7
- package/dist/types/document/Head.d.ts +2 -2
- package/dist/types/document/Html.d.ts +2 -2
- package/dist/types/document/Links.d.ts +1 -1
- package/dist/types/document/Root.d.ts +4 -4
- package/dist/types/document/Script.d.ts +2 -2
- package/dist/types/document/Scripts.d.ts +1 -1
- package/dist/types/document/Style.d.ts +3 -3
- package/dist/types/document/Title.d.ts +2 -0
- package/dist/types/document/cli/index.d.ts +1 -1
- package/dist/types/document/constants.d.ts +3 -2
- package/dist/types/document/index.d.ts +1 -1
- package/dist/types/exports/head.d.ts +1 -1
- package/dist/types/exports/loadable.d.ts +1 -1
- package/dist/types/exports/server.d.ts +9 -17
- package/dist/types/exports/styled.d.ts +1 -1
- package/dist/types/index.d.ts +3 -3
- package/dist/types/router/cli/index.d.ts +1 -1
- package/dist/types/router/index.d.ts +1 -1
- package/dist/types/router/runtime/DefaultNotFound.d.ts +1 -1
- package/dist/types/router/runtime/DeferredDataScripts.d.ts +1 -1
- package/dist/types/router/runtime/DeferredDataScripts.node.d.ts +2 -2
- package/dist/types/router/runtime/PrefetchLink.d.ts +3 -3
- package/dist/types/router/runtime/fetch.d.ts +1 -1
- package/dist/types/router/runtime/fetch.node.d.ts +1 -1
- package/dist/types/router/runtime/fetch.worker.d.ts +1 -1
- package/dist/types/router/runtime/hooks.d.ts +1 -1
- package/dist/types/router/runtime/index.d.ts +3 -3
- package/dist/types/router/runtime/plugin.d.ts +1 -7
- package/dist/types/router/runtime/plugin.node.d.ts +2 -6
- package/dist/types/router/runtime/routeModule.d.ts +6 -0
- package/dist/types/router/runtime/server.d.ts +1 -1
- package/dist/types/router/runtime/types.d.ts +41 -41
- package/dist/types/router/runtime/utils.d.ts +11 -21
- package/dist/types/router/runtime/withRouter.d.ts +4 -4
- package/dist/types/runtimeContext.d.ts +26 -26
- package/dist/types/ssr/cli/babel-plugin-ssr-loader-id.d.ts +1 -1
- package/dist/types/ssr/cli/index.d.ts +1 -1
- package/dist/types/ssr/cli/loadable-bundler-plugin.d.ts +1 -1
- package/dist/types/ssr/index.d.ts +5 -5
- package/dist/types/ssr/index.node.d.ts +1 -1
- package/dist/types/ssr/prefetch.d.ts +9 -9
- package/dist/types/ssr/react/index.d.ts +1 -1
- package/dist/types/ssr/react/nossr/index.d.ts +3 -3
- package/dist/types/ssr/react/prerender/index.d.ts +1 -1
- package/dist/types/ssr/react/prerender/type.d.ts +17 -17
- package/dist/types/ssr/react/prerender/util.d.ts +1 -1
- package/dist/types/ssr/react/withCallback/index.d.ts +3 -3
- package/dist/types/ssr/serverRender/helmet.d.ts +1 -1
- package/dist/types/ssr/serverRender/index.d.ts +1 -1
- package/dist/types/ssr/serverRender/renderToStream/buildTemplate.after.d.ts +3 -3
- package/dist/types/ssr/serverRender/renderToStream/buildTemplate.share.d.ts +1 -1
- package/dist/types/ssr/serverRender/renderToStream/bulidTemplate.before.d.ts +1 -1
- package/dist/types/ssr/serverRender/renderToStream/index.d.ts +1 -4
- package/dist/types/ssr/serverRender/renderToStream/renderToPipe.d.ts +1 -1
- package/dist/types/ssr/serverRender/renderToStream/renderToPipe.worker.d.ts +1 -1
- package/dist/types/ssr/serverRender/renderToStream/template.d.ts +3 -3
- package/dist/types/ssr/serverRender/renderToString/buildHtml.d.ts +1 -1
- package/dist/types/ssr/serverRender/renderToString/entry.d.ts +19 -19
- package/dist/types/ssr/serverRender/renderToString/index.d.ts +1 -5
- package/dist/types/ssr/serverRender/renderToString/loadable.d.ts +18 -18
- package/dist/types/ssr/serverRender/renderToString/render.d.ts +8 -8
- package/dist/types/ssr/serverRender/renderToString/styledComponent.d.ts +7 -7
- package/dist/types/ssr/serverRender/renderToString/type.d.ts +10 -10
- package/dist/types/ssr/serverRender/tracker.d.ts +14 -19
- package/dist/types/ssr/serverRender/types.d.ts +17 -17
- package/dist/types/ssr/serverRender/utils.d.ts +1 -1
- package/dist/types/ssr/utils.d.ts +4 -4
- package/dist/types/state/cli/index.d.ts +1 -1
- package/dist/types/state/index.d.ts +1 -1
- package/dist/types/state/plugins.d.ts +1 -1
- package/dist/types/state/runtime/index.d.ts +1 -1
- package/dist/types/state/runtime/plugin.d.ts +3 -3
- package/package.json +10 -10
- package/dist/types/router/runtime/shouldRevalidate.d.ts +0 -2
|
@@ -1,33 +1,34 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
import { Setup, ToThreads, CommonAPI, PluginOptions } from '@modern-js/plugin';
|
|
3
3
|
import type { RuntimeContext, TRuntimeContext } from '../runtimeContext';
|
|
4
|
-
export interface AppProps {
|
|
4
|
+
export interface AppProps {
|
|
5
|
+
}
|
|
5
6
|
declare const runtimeHooks: {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
7
|
+
hoc: import("@modern-js/plugin").Pipeline<{
|
|
8
|
+
App: React.ComponentType<any>;
|
|
9
|
+
}, React.ComponentType<any>>;
|
|
10
|
+
provide: import("@modern-js/plugin").Pipeline<{
|
|
11
|
+
element: JSX.Element;
|
|
12
|
+
readonly props: AppProps;
|
|
13
|
+
readonly context: RuntimeContext;
|
|
14
|
+
}, JSX.Element>;
|
|
15
|
+
client: import("@modern-js/plugin").AsyncPipeline<{
|
|
16
|
+
App: React.ComponentType<any>;
|
|
17
|
+
readonly context: RuntimeContext;
|
|
18
|
+
ModernRender: (App: React.ReactElement) => void;
|
|
19
|
+
ModernHydrate: (App: React.ReactElement, callback?: () => void) => void;
|
|
20
|
+
}, void>;
|
|
21
|
+
server: import("@modern-js/plugin").AsyncPipeline<{
|
|
22
|
+
App: React.ComponentType<any>;
|
|
23
|
+
readonly context: RuntimeContext;
|
|
24
|
+
}, string>;
|
|
25
|
+
init: import("@modern-js/plugin").AsyncPipeline<{
|
|
26
|
+
context: RuntimeContext;
|
|
27
|
+
}, unknown>;
|
|
28
|
+
pickContext: import("@modern-js/plugin").Pipeline<{
|
|
29
|
+
context: RuntimeContext;
|
|
30
|
+
pickedContext: TRuntimeContext;
|
|
31
|
+
}, TRuntimeContext>;
|
|
31
32
|
};
|
|
32
33
|
/** All hooks of runtime plugin. */
|
|
33
34
|
export type RuntimeHooks = typeof runtimeHooks;
|
|
@@ -38,166 +39,166 @@ export type PluginAPI = CommonAPI<RuntimeHooks>;
|
|
|
38
39
|
/** Plugin options of a runtime plugin. */
|
|
39
40
|
export type Plugin = PluginOptions<RuntimeHooks, Setup<RuntimeHooks>>;
|
|
40
41
|
export declare const createRuntime: () => import("@modern-js/plugin").Manager<{
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
42
|
+
hoc: import("@modern-js/plugin").Pipeline<{
|
|
43
|
+
App: React.ComponentType<any>;
|
|
44
|
+
}, React.ComponentType<any>>;
|
|
45
|
+
provide: import("@modern-js/plugin").Pipeline<{
|
|
46
|
+
element: JSX.Element;
|
|
47
|
+
readonly props: AppProps;
|
|
48
|
+
readonly context: RuntimeContext;
|
|
49
|
+
}, JSX.Element>;
|
|
50
|
+
client: import("@modern-js/plugin").AsyncPipeline<{
|
|
51
|
+
App: React.ComponentType<any>;
|
|
52
|
+
readonly context: RuntimeContext;
|
|
53
|
+
ModernRender: (App: React.ReactElement) => void;
|
|
54
|
+
ModernHydrate: (App: React.ReactElement, callback?: () => void) => void;
|
|
55
|
+
}, void>;
|
|
56
|
+
server: import("@modern-js/plugin").AsyncPipeline<{
|
|
57
|
+
App: React.ComponentType<any>;
|
|
58
|
+
readonly context: RuntimeContext;
|
|
59
|
+
}, string>;
|
|
60
|
+
init: import("@modern-js/plugin").AsyncPipeline<{
|
|
61
|
+
context: RuntimeContext;
|
|
62
|
+
}, unknown>;
|
|
63
|
+
pickContext: import("@modern-js/plugin").Pipeline<{
|
|
64
|
+
context: RuntimeContext;
|
|
65
|
+
pickedContext: TRuntimeContext;
|
|
66
|
+
}, TRuntimeContext>;
|
|
66
67
|
}, Record<string, never>>;
|
|
67
68
|
/**
|
|
68
69
|
* register init hook. It would be revoked both ssr and csr.
|
|
69
70
|
*/
|
|
70
71
|
declare const registerInit: (App: React.ComponentType, _init: (context: RuntimeContext) => any | Promise<any>) => void;
|
|
71
72
|
export declare const runtime: import("@modern-js/plugin").Manager<{
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
73
|
+
hoc: import("@modern-js/plugin").Pipeline<{
|
|
74
|
+
App: React.ComponentType<any>;
|
|
75
|
+
}, React.ComponentType<any>>;
|
|
76
|
+
provide: import("@modern-js/plugin").Pipeline<{
|
|
77
|
+
element: JSX.Element;
|
|
78
|
+
readonly props: AppProps;
|
|
79
|
+
readonly context: RuntimeContext;
|
|
80
|
+
}, JSX.Element>;
|
|
81
|
+
client: import("@modern-js/plugin").AsyncPipeline<{
|
|
82
|
+
App: React.ComponentType<any>;
|
|
83
|
+
readonly context: RuntimeContext;
|
|
84
|
+
ModernRender: (App: React.ReactElement) => void;
|
|
85
|
+
ModernHydrate: (App: React.ReactElement, callback?: () => void) => void;
|
|
86
|
+
}, void>;
|
|
87
|
+
server: import("@modern-js/plugin").AsyncPipeline<{
|
|
88
|
+
App: React.ComponentType<any>;
|
|
89
|
+
readonly context: RuntimeContext;
|
|
90
|
+
}, string>;
|
|
91
|
+
init: import("@modern-js/plugin").AsyncPipeline<{
|
|
92
|
+
context: RuntimeContext;
|
|
93
|
+
}, unknown>;
|
|
94
|
+
pickContext: import("@modern-js/plugin").Pipeline<{
|
|
95
|
+
context: RuntimeContext;
|
|
96
|
+
pickedContext: TRuntimeContext;
|
|
97
|
+
}, TRuntimeContext>;
|
|
97
98
|
}, Record<string, never>>;
|
|
98
99
|
export declare const createPlugin: (setup?: Setup<{
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
100
|
+
hoc: import("@modern-js/plugin").Pipeline<{
|
|
101
|
+
App: React.ComponentType<any>;
|
|
102
|
+
}, React.ComponentType<any>>;
|
|
103
|
+
provide: import("@modern-js/plugin").Pipeline<{
|
|
104
|
+
element: JSX.Element;
|
|
105
|
+
readonly props: AppProps;
|
|
106
|
+
readonly context: RuntimeContext;
|
|
107
|
+
}, JSX.Element>;
|
|
108
|
+
client: import("@modern-js/plugin").AsyncPipeline<{
|
|
109
|
+
App: React.ComponentType<any>;
|
|
110
|
+
readonly context: RuntimeContext;
|
|
111
|
+
ModernRender: (App: React.ReactElement) => void;
|
|
112
|
+
ModernHydrate: (App: React.ReactElement, callback?: () => void) => void;
|
|
113
|
+
}, void>;
|
|
114
|
+
server: import("@modern-js/plugin").AsyncPipeline<{
|
|
115
|
+
App: React.ComponentType<any>;
|
|
116
|
+
readonly context: RuntimeContext;
|
|
117
|
+
}, string>;
|
|
118
|
+
init: import("@modern-js/plugin").AsyncPipeline<{
|
|
119
|
+
context: RuntimeContext;
|
|
120
|
+
}, unknown>;
|
|
121
|
+
pickContext: import("@modern-js/plugin").Pipeline<{
|
|
122
|
+
context: RuntimeContext;
|
|
123
|
+
pickedContext: TRuntimeContext;
|
|
124
|
+
}, TRuntimeContext>;
|
|
124
125
|
}, Record<string, never>> | undefined, options?: PluginOptions<{
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
126
|
+
hoc: import("@modern-js/plugin").Pipeline<{
|
|
127
|
+
App: React.ComponentType<any>;
|
|
128
|
+
}, React.ComponentType<any>>;
|
|
129
|
+
provide: import("@modern-js/plugin").Pipeline<{
|
|
130
|
+
element: JSX.Element;
|
|
131
|
+
readonly props: AppProps;
|
|
132
|
+
readonly context: RuntimeContext;
|
|
133
|
+
}, JSX.Element>;
|
|
134
|
+
client: import("@modern-js/plugin").AsyncPipeline<{
|
|
135
|
+
App: React.ComponentType<any>;
|
|
136
|
+
readonly context: RuntimeContext;
|
|
137
|
+
ModernRender: (App: React.ReactElement) => void;
|
|
138
|
+
ModernHydrate: (App: React.ReactElement, callback?: () => void) => void;
|
|
139
|
+
}, void>;
|
|
140
|
+
server: import("@modern-js/plugin").AsyncPipeline<{
|
|
141
|
+
App: React.ComponentType<any>;
|
|
142
|
+
readonly context: RuntimeContext;
|
|
143
|
+
}, string>;
|
|
144
|
+
init: import("@modern-js/plugin").AsyncPipeline<{
|
|
145
|
+
context: RuntimeContext;
|
|
146
|
+
}, unknown>;
|
|
147
|
+
pickContext: import("@modern-js/plugin").Pipeline<{
|
|
148
|
+
context: RuntimeContext;
|
|
149
|
+
pickedContext: TRuntimeContext;
|
|
150
|
+
}, TRuntimeContext>;
|
|
150
151
|
}, Setup<{
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
152
|
+
hoc: import("@modern-js/plugin").Pipeline<{
|
|
153
|
+
App: React.ComponentType<any>;
|
|
154
|
+
}, React.ComponentType<any>>;
|
|
155
|
+
provide: import("@modern-js/plugin").Pipeline<{
|
|
156
|
+
element: JSX.Element;
|
|
157
|
+
readonly props: AppProps;
|
|
158
|
+
readonly context: RuntimeContext;
|
|
159
|
+
}, JSX.Element>;
|
|
160
|
+
client: import("@modern-js/plugin").AsyncPipeline<{
|
|
161
|
+
App: React.ComponentType<any>;
|
|
162
|
+
readonly context: RuntimeContext;
|
|
163
|
+
ModernRender: (App: React.ReactElement) => void;
|
|
164
|
+
ModernHydrate: (App: React.ReactElement, callback?: () => void) => void;
|
|
165
|
+
}, void>;
|
|
166
|
+
server: import("@modern-js/plugin").AsyncPipeline<{
|
|
167
|
+
App: React.ComponentType<any>;
|
|
168
|
+
readonly context: RuntimeContext;
|
|
169
|
+
}, string>;
|
|
170
|
+
init: import("@modern-js/plugin").AsyncPipeline<{
|
|
171
|
+
context: RuntimeContext;
|
|
172
|
+
}, unknown>;
|
|
173
|
+
pickContext: import("@modern-js/plugin").Pipeline<{
|
|
174
|
+
context: RuntimeContext;
|
|
175
|
+
pickedContext: TRuntimeContext;
|
|
176
|
+
}, TRuntimeContext>;
|
|
176
177
|
}, Record<string, never>>> | undefined) => import("@modern-js/plugin").Plugin<{
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
178
|
+
hoc: import("@modern-js/plugin").Pipeline<{
|
|
179
|
+
App: React.ComponentType<any>;
|
|
180
|
+
}, React.ComponentType<any>>;
|
|
181
|
+
provide: import("@modern-js/plugin").Pipeline<{
|
|
182
|
+
element: JSX.Element;
|
|
183
|
+
readonly props: AppProps;
|
|
184
|
+
readonly context: RuntimeContext;
|
|
185
|
+
}, JSX.Element>;
|
|
186
|
+
client: import("@modern-js/plugin").AsyncPipeline<{
|
|
187
|
+
App: React.ComponentType<any>;
|
|
188
|
+
readonly context: RuntimeContext;
|
|
189
|
+
ModernRender: (App: React.ReactElement) => void;
|
|
190
|
+
ModernHydrate: (App: React.ReactElement, callback?: () => void) => void;
|
|
191
|
+
}, void>;
|
|
192
|
+
server: import("@modern-js/plugin").AsyncPipeline<{
|
|
193
|
+
App: React.ComponentType<any>;
|
|
194
|
+
readonly context: RuntimeContext;
|
|
195
|
+
}, string>;
|
|
196
|
+
init: import("@modern-js/plugin").AsyncPipeline<{
|
|
197
|
+
context: RuntimeContext;
|
|
198
|
+
}, unknown>;
|
|
199
|
+
pickContext: import("@modern-js/plugin").Pipeline<{
|
|
200
|
+
context: RuntimeContext;
|
|
201
|
+
pickedContext: TRuntimeContext;
|
|
202
|
+
}, TRuntimeContext>;
|
|
202
203
|
}, Record<string, never>>;
|
|
203
|
-
export { registerInit };
|
|
204
|
+
export { registerInit };
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import type { LoaderResult } from './loader/loaderManager';
|
|
2
2
|
declare global {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
interface Window {
|
|
4
|
+
_SSR_DATA?: SSRContainer;
|
|
5
|
+
_ROUTER_DATA?: RouterSSRData;
|
|
6
|
+
}
|
|
7
7
|
}
|
|
8
8
|
export interface SSRData {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
loadersData: Record<string, LoaderResult | undefined>;
|
|
10
|
+
initialData?: Record<string, unknown>;
|
|
11
|
+
storeState?: any;
|
|
12
12
|
}
|
|
13
13
|
export interface RouteData {
|
|
14
|
-
|
|
14
|
+
[routeId: string]: any;
|
|
15
15
|
}
|
|
16
16
|
export interface RouterSSRData {
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
loaderData: RouteData;
|
|
18
|
+
errors: RouteData | null;
|
|
19
19
|
}
|
|
20
20
|
export interface SSRContainer {
|
|
21
|
-
|
|
22
|
-
}
|
|
21
|
+
data?: SSRData;
|
|
22
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
type DocumentProps = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
[x: string]: any;
|
|
4
|
+
config?: any;
|
|
5
|
+
templateParams: {
|
|
6
|
+
[y: string]: any;
|
|
7
|
+
mountId?: string;
|
|
8
|
+
};
|
|
9
|
+
processEnv?: Record<string, string | undefined>;
|
|
10
|
+
children?: JSX.Element;
|
|
11
11
|
};
|
|
12
12
|
export declare const DocumentContext: React.Context<DocumentProps>;
|
|
13
|
-
export {};
|
|
13
|
+
export {};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
2
|
type DocumentStructureContextProps = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
hasSetHead?: boolean;
|
|
4
|
+
hasSetScripts?: boolean;
|
|
5
|
+
hasSetLinks?: boolean;
|
|
6
|
+
hasSetBody?: boolean;
|
|
7
|
+
hasSetRoot?: boolean;
|
|
8
|
+
hasSetTitle?: boolean;
|
|
9
|
+
docChild?: ReactNode;
|
|
9
10
|
};
|
|
10
11
|
export declare const DocumentStructureContext: React.Context<DocumentStructureContextProps>;
|
|
11
|
-
export {};
|
|
12
|
+
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export declare function Links(): JSX.Element;
|
|
2
|
+
export declare function Links(): JSX.Element;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
export declare function Root(props: {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
children?: any;
|
|
4
|
+
rootId?: string;
|
|
5
5
|
}): JSX.Element;
|
|
6
6
|
export declare function DefaultRoot(props: {
|
|
7
|
-
|
|
8
|
-
}): JSX.Element;
|
|
7
|
+
children?: any;
|
|
8
|
+
}): JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export declare function Scripts(): JSX.Element;
|
|
2
|
+
export declare function Scripts(): JSX.Element;
|
|
@@ -2,4 +2,4 @@ import type { CliPlugin, AppTools } from '@modern-js/app-tools';
|
|
|
2
2
|
import { Entrypoint } from '@modern-js/types/cli';
|
|
3
3
|
export declare const getDocumenByEntryName: (entrypoints: Entrypoint[], entryName: string, fallbackDir?: string) => string | undefined;
|
|
4
4
|
export declare const documentPlugin: () => CliPlugin<AppTools>;
|
|
5
|
-
export default documentPlugin;
|
|
5
|
+
export default documentPlugin;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export declare const DOC_EXT: string[];
|
|
2
2
|
export declare const DOCUMENT_META_PLACEHOLDER: string;
|
|
3
|
+
export declare const DOCUMENT_TITLE_PLACEHOLDER: string;
|
|
3
4
|
export declare const HTML_SEPARATOR = "<!--<?- html ?>-->";
|
|
4
5
|
export declare const HEAD_PARTICALS_SEPARATOR: string;
|
|
5
6
|
export declare const BODY_PARTICALS_SEPARATOR: string;
|
|
@@ -18,5 +19,5 @@ export declare const DOCUMENT_STYLE_PLACEHOLDER_END: string;
|
|
|
18
19
|
export declare const DOCUMENT_COMMENT_PLACEHOLDER_START: string;
|
|
19
20
|
export declare const DOCUMENT_COMMENT_PLACEHOLDER_END: string;
|
|
20
21
|
export declare const PLACEHOLDER_REPLACER_MAP: {
|
|
21
|
-
|
|
22
|
-
};
|
|
22
|
+
[x: string]: string;
|
|
23
|
+
};
|
|
@@ -1,21 +1,13 @@
|
|
|
1
1
|
import { AfterMatchContext, AfterRenderContext, MiddlewareContext, NextFunction } from '@modern-js/types';
|
|
2
|
-
export declare const hook: (attacher: ({
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}: {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}) => void) => ({
|
|
11
|
-
addMiddleware,
|
|
12
|
-
afterMatch,
|
|
13
|
-
afterRender
|
|
14
|
-
}: {
|
|
15
|
-
addMiddleware: (mid: Middleware) => void;
|
|
16
|
-
afterRender: (hook: AfterRenderHook) => void;
|
|
17
|
-
afterMatch: (hook: AfterMatchHook) => void;
|
|
2
|
+
export declare const hook: (attacher: ({ addMiddleware, afterMatch, afterRender, }: {
|
|
3
|
+
addMiddleware: (mid: Middleware) => void;
|
|
4
|
+
afterRender: (hook: AfterRenderHook) => void;
|
|
5
|
+
afterMatch: (hook: AfterMatchHook) => void;
|
|
6
|
+
}) => void) => ({ addMiddleware, afterMatch, afterRender, }: {
|
|
7
|
+
addMiddleware: (mid: Middleware) => void;
|
|
8
|
+
afterRender: (hook: AfterRenderHook) => void;
|
|
9
|
+
afterMatch: (hook: AfterMatchHook) => void;
|
|
18
10
|
}) => void;
|
|
19
11
|
export type AfterRenderHook = (context: AfterRenderContext, next: NextFunction) => void;
|
|
20
12
|
export type AfterMatchHook = (context: AfterMatchContext, next: NextFunction) => void;
|
|
21
|
-
export type Middleware = (context: MiddlewareContext, next: NextFunction) => Promise<void> | void;
|
|
13
|
+
export type Middleware = (context: MiddlewareContext, next: NextFunction) => Promise<void> | void;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { RouterConfig } from './router';
|
|
|
3
3
|
export type { Plugin } from './core';
|
|
4
4
|
export type { AppConfig } from './common';
|
|
5
5
|
export { isBrowser } from './common';
|
|
6
|
-
export type { BaseRuntimeContext, RuntimeContext, BaseTRuntimeContext, TRuntimeContext } from './runtimeContext';
|
|
6
|
+
export type { BaseRuntimeContext, RuntimeContext, BaseTRuntimeContext, TRuntimeContext, } from './runtimeContext';
|
|
7
7
|
export type { RuntimeUserConfig } from './config';
|
|
8
|
-
export { createApp, createPlugin, useLoader, bootstrap, RuntimeReactContext, defineConfig, registerInit, useRuntimeContext } from './core';
|
|
9
|
-
export { StateConfig, RouterConfig };
|
|
8
|
+
export { createApp, createPlugin, useLoader, bootstrap, RuntimeReactContext, defineConfig, registerInit, useRuntimeContext, } from './core';
|
|
9
|
+
export { StateConfig, RouterConfig };
|