@modern-js/runtime 2.52.0 → 2.54.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/dist/cjs/{runtimeContext.js → cli/constants.js} +6 -10
- package/dist/cjs/cli/entry.js +42 -0
- package/dist/cjs/cli/index.js +10 -0
- package/dist/cjs/core/compatible.js +13 -29
- package/dist/cjs/core/{appConfig.js → config.js} +6 -4
- package/dist/cjs/core/context/index.js +28 -0
- package/dist/cjs/core/context/runtime.js +42 -0
- package/dist/cjs/core/index.js +8 -12
- package/dist/cjs/core/loader/useLoader.js +2 -2
- package/dist/cjs/core/{plugin.js → plugin/base.js} +5 -25
- package/dist/cjs/core/plugin/index.js +39 -0
- package/dist/cjs/core/plugin/runner.js +42 -0
- package/dist/cjs/index.js +2 -4
- package/dist/cjs/router/cli/code/getClientRoutes/getRoutes.js +197 -0
- package/dist/cjs/router/cli/code/getClientRoutes/getRoutesLegacy.js +195 -0
- package/dist/cjs/router/cli/code/getClientRoutes/index.js +31 -0
- package/dist/cjs/router/cli/code/getClientRoutes/utils.js +59 -0
- package/dist/cjs/router/cli/code/index.js +134 -0
- package/dist/cjs/router/cli/code/makeLegalIdentifier.js +37 -0
- package/dist/cjs/router/cli/code/nestedRoutes.js +294 -0
- package/dist/cjs/router/cli/code/templates.js +371 -0
- package/dist/cjs/router/cli/code/utils.js +143 -0
- package/dist/cjs/router/cli/constants.js +83 -0
- package/dist/cjs/router/cli/entry.js +87 -0
- package/dist/cjs/router/cli/handler.js +71 -0
- package/dist/cjs/router/cli/index.js +25 -0
- package/dist/cjs/router/runtime/plugin.js +7 -4
- package/dist/cjs/router/runtime/plugin.node.js +12 -5
- package/dist/cjs/ssr/index.node.js +1 -0
- package/dist/cjs/state/runtime/plugin.js +3 -2
- package/dist/esm/cli/constants.js +4 -0
- package/dist/esm/cli/entry.js +14 -0
- package/dist/esm/cli/index.js +10 -0
- package/dist/esm/core/compatible.js +11 -30
- package/dist/esm/core/{appConfig.js → config.js} +4 -1
- package/dist/esm/core/context/index.js +4 -0
- package/dist/esm/core/context/runtime.js +18 -0
- package/dist/esm/core/index.js +4 -6
- package/dist/esm/core/loader/useLoader.js +1 -1
- package/dist/esm/core/plugin/base.js +21 -0
- package/dist/esm/core/plugin/index.js +15 -0
- package/dist/esm/core/plugin/runner.js +17 -0
- package/dist/esm/index.js +2 -3
- package/dist/esm/router/cli/code/getClientRoutes/getRoutes.js +185 -0
- package/dist/esm/router/cli/code/getClientRoutes/getRoutesLegacy.js +183 -0
- package/dist/esm/router/cli/code/getClientRoutes/index.js +6 -0
- package/dist/esm/router/cli/code/getClientRoutes/utils.js +28 -0
- package/dist/esm/router/cli/code/index.js +214 -0
- package/dist/esm/router/cli/code/makeLegalIdentifier.js +15 -0
- package/dist/esm/router/cli/code/nestedRoutes.js +397 -0
- package/dist/esm/router/cli/code/templates.js +417 -0
- package/dist/esm/router/cli/code/utils.js +212 -0
- package/dist/esm/router/cli/constants.js +47 -0
- package/dist/esm/router/cli/entry.js +57 -0
- package/dist/esm/router/cli/handler.js +103 -0
- package/dist/esm/router/cli/index.js +57 -0
- package/dist/esm/router/runtime/plugin.js +7 -4
- package/dist/esm/router/runtime/plugin.node.js +13 -6
- package/dist/esm/ssr/index.node.js +1 -0
- package/dist/esm/state/runtime/plugin.js +3 -2
- package/dist/esm-node/cli/constants.js +4 -0
- package/dist/esm-node/cli/entry.js +8 -0
- package/dist/esm-node/cli/index.js +9 -0
- package/dist/esm-node/core/compatible.js +12 -28
- package/dist/esm-node/core/{appConfig.js → config.js} +2 -1
- package/dist/esm-node/core/context/index.js +4 -0
- package/dist/esm-node/core/context/runtime.js +16 -0
- package/dist/esm-node/core/index.js +4 -6
- package/dist/esm-node/core/loader/useLoader.js +1 -1
- package/dist/esm-node/core/plugin/base.js +19 -0
- package/dist/esm-node/core/plugin/index.js +13 -0
- package/dist/esm-node/core/plugin/runner.js +17 -0
- package/dist/esm-node/index.js +2 -3
- package/dist/esm-node/router/cli/code/getClientRoutes/getRoutes.js +163 -0
- package/dist/esm-node/router/cli/code/getClientRoutes/getRoutesLegacy.js +161 -0
- package/dist/esm-node/router/cli/code/getClientRoutes/index.js +6 -0
- package/dist/esm-node/router/cli/code/getClientRoutes/utils.js +22 -0
- package/dist/esm-node/router/cli/code/index.js +100 -0
- package/dist/esm-node/router/cli/code/makeLegalIdentifier.js +13 -0
- package/dist/esm-node/router/cli/code/nestedRoutes.js +258 -0
- package/dist/esm-node/router/cli/code/templates.js +335 -0
- package/dist/esm-node/router/cli/code/utils.js +101 -0
- package/dist/esm-node/router/cli/constants.js +47 -0
- package/dist/esm-node/router/cli/entry.js +50 -0
- package/dist/esm-node/router/cli/handler.js +36 -0
- package/dist/esm-node/router/cli/index.js +22 -0
- package/dist/esm-node/router/runtime/plugin.js +7 -4
- package/dist/esm-node/router/runtime/plugin.node.js +12 -5
- package/dist/esm-node/ssr/index.node.js +1 -0
- package/dist/esm-node/state/runtime/plugin.js +3 -2
- package/dist/types/cli/constants.d.ts +1 -0
- package/dist/types/cli/entry.d.ts +1 -0
- package/dist/types/cli/index.d.ts +1 -0
- package/dist/types/core/compatible.d.ts +7 -3
- package/dist/types/core/config.d.ts +14 -0
- package/dist/types/core/context/index.d.ts +1 -0
- package/dist/types/{runtimeContext.d.ts → core/context/runtime.d.ts} +5 -4
- package/dist/types/core/index.d.ts +4 -4
- package/dist/types/core/plugin/base.d.ts +80 -0
- package/dist/types/core/plugin/index.d.ts +29 -0
- package/dist/types/core/plugin/runner.d.ts +26 -0
- package/dist/types/index.d.ts +2 -2
- package/dist/types/router/cli/code/getClientRoutes/getRoutes.d.ts +8 -0
- package/dist/types/router/cli/code/getClientRoutes/getRoutesLegacy.d.ts +9 -0
- package/dist/types/router/cli/code/getClientRoutes/index.d.ts +2 -0
- package/dist/types/router/cli/code/getClientRoutes/utils.d.ts +5 -0
- package/dist/types/router/cli/code/index.d.ts +6 -0
- package/dist/types/router/cli/code/makeLegalIdentifier.d.ts +1 -0
- package/dist/types/router/cli/code/nestedRoutes.d.ts +7 -0
- package/dist/types/router/cli/code/templates.d.ts +14 -0
- package/dist/types/router/cli/code/utils.d.ts +12 -0
- package/dist/types/router/cli/constants.d.ts +32 -0
- package/dist/types/router/cli/entry.d.ts +5 -0
- package/dist/types/router/cli/handler.d.ts +5 -0
- package/dist/types/router/cli/index.d.ts +3 -1
- package/dist/types/ssr/serverRender/types.d.ts +3 -0
- package/package.json +37 -11
- package/dist/esm/core/plugin.js +0 -59
- package/dist/esm/runtimeContext.js +0 -7
- package/dist/esm-node/core/plugin.js +0 -37
- package/dist/esm-node/runtimeContext.js +0 -7
- package/dist/types/core/appConfig.d.ts +0 -4
- package/dist/types/core/plugin.d.ts +0 -204
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export declare const PAGES_DIR_NAME = "pages";
|
|
2
|
+
export declare const NESTED_ROUTES_DIR = "routes";
|
|
3
|
+
export declare const FILE_SYSTEM_ROUTES_FILE_NAME = "routes.js";
|
|
4
|
+
export declare const LOADER_EXPORT_NAME = "loader";
|
|
5
|
+
export declare const ACTION_EXPORT_NAME = "action";
|
|
6
|
+
export declare const TEMP_LOADERS_DIR = "__loaders__";
|
|
7
|
+
export declare const FILE_SYSTEM_ROUTES_LAYOUT = "_layout";
|
|
8
|
+
export declare const FILE_SYSTEM_ROUTES_GLOBAL_LAYOUT = "_app";
|
|
9
|
+
export declare const FILE_SYSTEM_ROUTES_INDEX = "index";
|
|
10
|
+
export declare const FILE_SYSTEM_ROUTES_IGNORED_REGEX: RegExp;
|
|
11
|
+
export declare const FILE_SYSTEM_ROUTES_DYNAMIC_REGEXP: RegExp;
|
|
12
|
+
export declare const FILE_SYSTEM_ROUTES_COMPONENTS_DIR = "internal_components";
|
|
13
|
+
export declare const NESTED_ROUTE: {
|
|
14
|
+
LAYOUT_FILE: string;
|
|
15
|
+
LAYOUT_CONFIG_FILE: string;
|
|
16
|
+
LAYOUT_LOADER_FILE: string;
|
|
17
|
+
LAYOUT_DATA_FILE: string;
|
|
18
|
+
LAYOUT_CLIENT_LOADER: string;
|
|
19
|
+
PAGE_FILE: string;
|
|
20
|
+
PAGE_CONFIG_FILE: string;
|
|
21
|
+
PAGE_LOADER_FILE: string;
|
|
22
|
+
PAGE_DATA_FILE: string;
|
|
23
|
+
PAGE_CLIENT_LOADER: string;
|
|
24
|
+
SPLATE_FILE: string;
|
|
25
|
+
SPLATE_CONFIG_FILE: string;
|
|
26
|
+
SPLATE_LOADER_FILE: string;
|
|
27
|
+
SPLATE_DATA_FILE: string;
|
|
28
|
+
SPLATE_CLIENT_DATA: string;
|
|
29
|
+
LOADING_FILE: string;
|
|
30
|
+
ERROR_FILE: string;
|
|
31
|
+
LOADER_FILE: string;
|
|
32
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Entrypoint } from '@modern-js/types';
|
|
2
|
+
export declare const hasPages: (dir: string) => boolean;
|
|
3
|
+
export declare const hasNestedRoutes: (dir: string) => boolean;
|
|
4
|
+
export declare const isRouteEntry: (dir: string) => string | false;
|
|
5
|
+
export declare const modifyEntrypoints: (entrypoints: Entrypoint[], config?: Record<string, any>) => Entrypoint[];
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Entrypoint } from '@modern-js/types';
|
|
2
|
+
import { PluginAPI } from '@modern-js/core';
|
|
3
|
+
import { AppTools } from '@modern-js/app-tools';
|
|
4
|
+
export declare function handleModifyEntrypoints(api: PluginAPI<AppTools<'shared'>>, entrypoints: Entrypoint[]): Promise<Entrypoint[]>;
|
|
5
|
+
export declare function handleFileChange(api: PluginAPI<AppTools<'shared'>>, e: any): Promise<void>;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import type { CliPlugin, AppTools } from '@modern-js/app-tools';
|
|
2
|
-
export
|
|
2
|
+
export { isRouteEntry } from './entry';
|
|
3
|
+
export { handleFileChange, handleModifyEntrypoints } from './handler';
|
|
4
|
+
export declare const routerPlugin: () => CliPlugin<AppTools<'shared'>>;
|
|
3
5
|
export default routerPlugin;
|
|
@@ -19,6 +19,7 @@ export type RenderResult = {
|
|
|
19
19
|
css: string;
|
|
20
20
|
};
|
|
21
21
|
};
|
|
22
|
+
type LoaderFailureMode = 'clientRender' | 'errorBoundary';
|
|
22
23
|
export type SSRServerContext = BaseSSRServerContext & {
|
|
23
24
|
request: BaseSSRServerContext['request'] & {
|
|
24
25
|
userAgent: string;
|
|
@@ -27,6 +28,7 @@ export type SSRServerContext = BaseSSRServerContext & {
|
|
|
27
28
|
};
|
|
28
29
|
htmlModifiers: BuildHtmlCb[];
|
|
29
30
|
tracker: SSRTracker;
|
|
31
|
+
loaderFailureMode?: 'clientRender' | 'errorBoundary';
|
|
30
32
|
};
|
|
31
33
|
export type ModernSSRReactComponent = React.ComponentType<any>;
|
|
32
34
|
export { RuntimeContext };
|
|
@@ -36,6 +38,7 @@ export type SSRPluginConfig = {
|
|
|
36
38
|
enableInlineStyles?: boolean | RegExp;
|
|
37
39
|
enableInlineScripts?: boolean | RegExp;
|
|
38
40
|
disablePrerender?: boolean;
|
|
41
|
+
loaderFailureMode?: LoaderFailureMode;
|
|
39
42
|
chunkLoadingGlobal?: string;
|
|
40
43
|
unsafeHeaders?: string[];
|
|
41
44
|
} & Exclude<ServerUserConfig['ssr'], boolean>;
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "2.
|
|
18
|
+
"version": "2.54.0",
|
|
19
19
|
"engines": {
|
|
20
20
|
"node": ">=14.17.6"
|
|
21
21
|
},
|
|
@@ -33,6 +33,16 @@
|
|
|
33
33
|
"./types/index": "./types/index.d.ts",
|
|
34
34
|
"./types/router": "./types/router.d.ts",
|
|
35
35
|
"./types/model": "./types/model.d.ts",
|
|
36
|
+
"./context": {
|
|
37
|
+
"types": "./dist/types/core/context/index.d.ts",
|
|
38
|
+
"jsnext:source": "./src/core/context/index.ts",
|
|
39
|
+
"default": "./dist/cjs/core/context/index.js"
|
|
40
|
+
},
|
|
41
|
+
"./plugin": {
|
|
42
|
+
"types": "./dist/types/core/plugin/index.d.ts",
|
|
43
|
+
"jsnext:source": "./src/core/plugin/index.ts",
|
|
44
|
+
"default": "./dist/cjs/core/plugin/index.js"
|
|
45
|
+
},
|
|
36
46
|
"./loadable": {
|
|
37
47
|
"types": "./dist/types/exports/loadable.d.ts",
|
|
38
48
|
"jsnext:source": "./src/exports/loadable.ts",
|
|
@@ -93,6 +103,11 @@
|
|
|
93
103
|
"jsnext:source": "./src/router/runtime/server.ts",
|
|
94
104
|
"default": "./dist/esm/router/runtime/server.js"
|
|
95
105
|
},
|
|
106
|
+
"./router/cli": {
|
|
107
|
+
"types": "./dist/types/router/cli/index.d.ts",
|
|
108
|
+
"jsnext:source": "./src/router/cli/index.ts",
|
|
109
|
+
"default": "./dist/cjs/router/cli/index.js"
|
|
110
|
+
},
|
|
96
111
|
"./loadable-bundler-plugin": {
|
|
97
112
|
"types": "./dist/types/ssr/cli/loadable-bundler-plugin.d.ts",
|
|
98
113
|
"jsnext:source": "./src/ssr/cli/loadable-bundler-plugin.ts",
|
|
@@ -113,6 +128,12 @@
|
|
|
113
128
|
"cli": [
|
|
114
129
|
"./dist/types/cli/index.d.ts"
|
|
115
130
|
],
|
|
131
|
+
"context": [
|
|
132
|
+
"./dist/types/core/context/index.d.ts"
|
|
133
|
+
],
|
|
134
|
+
"plugin": [
|
|
135
|
+
"./dist/types/core/plugin/index.d.ts"
|
|
136
|
+
],
|
|
116
137
|
"head": [
|
|
117
138
|
"./dist/types/exports/head.d.ts"
|
|
118
139
|
],
|
|
@@ -140,6 +161,9 @@
|
|
|
140
161
|
"router/server": [
|
|
141
162
|
"./dist/types/router/runtime/server.d.ts"
|
|
142
163
|
],
|
|
164
|
+
"router/cli": [
|
|
165
|
+
"./dist/types/router/cli/index.d.ts"
|
|
166
|
+
],
|
|
143
167
|
"loadable-bundler-plugin": [
|
|
144
168
|
"./dist/types/ssr/cli/loadable-bundler-plugin.d.ts"
|
|
145
169
|
]
|
|
@@ -163,6 +187,7 @@
|
|
|
163
187
|
"@types/react-helmet": "^6.1.2",
|
|
164
188
|
"@types/styled-components": "^5.1.14",
|
|
165
189
|
"esbuild": "0.17.19",
|
|
190
|
+
"es-module-lexer": "^1.1.0",
|
|
166
191
|
"hoist-non-react-statics": "^3.3.2",
|
|
167
192
|
"invariant": "^2.2.4",
|
|
168
193
|
"react-helmet": "^6.1.0",
|
|
@@ -170,10 +195,11 @@
|
|
|
170
195
|
"react-side-effect": "^2.1.1",
|
|
171
196
|
"styled-components": "^5.3.1",
|
|
172
197
|
"@swc/helpers": "0.5.3",
|
|
173
|
-
"@modern-js/plugin": "2.
|
|
174
|
-
"@modern-js/types": "2.
|
|
175
|
-
"@modern-js/runtime-utils": "2.
|
|
176
|
-
"@modern-js/
|
|
198
|
+
"@modern-js/plugin": "2.54.0",
|
|
199
|
+
"@modern-js/types": "2.54.0",
|
|
200
|
+
"@modern-js/runtime-utils": "2.54.0",
|
|
201
|
+
"@modern-js/plugin-data-loader": "2.54.0",
|
|
202
|
+
"@modern-js/utils": "2.54.0"
|
|
177
203
|
},
|
|
178
204
|
"peerDependencies": {
|
|
179
205
|
"react": ">=17",
|
|
@@ -193,12 +219,12 @@
|
|
|
193
219
|
"react-dom": "^18",
|
|
194
220
|
"ts-jest": "^29.1.0",
|
|
195
221
|
"typescript": "^5",
|
|
196
|
-
"webpack": "^5.
|
|
197
|
-
"@
|
|
198
|
-
"@modern-js/core": "2.
|
|
199
|
-
"@modern-js/
|
|
200
|
-
"@
|
|
201
|
-
"@scripts/jest-config": "2.
|
|
222
|
+
"webpack": "^5.92.0",
|
|
223
|
+
"@modern-js/app-tools": "2.54.0",
|
|
224
|
+
"@modern-js/core": "2.54.0",
|
|
225
|
+
"@modern-js/server-core": "2.54.0",
|
|
226
|
+
"@scripts/build": "2.54.0",
|
|
227
|
+
"@scripts/jest-config": "2.54.0"
|
|
202
228
|
},
|
|
203
229
|
"sideEffects": false,
|
|
204
230
|
"publishConfig": {
|
package/dist/esm/core/plugin.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
|
|
2
|
-
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
|
3
|
-
import { createManager, createPipeline, createAsyncPipeline } from "@modern-js/plugin";
|
|
4
|
-
import { createLoaderManager } from "./loader/loaderManager";
|
|
5
|
-
var hoc = createPipeline();
|
|
6
|
-
var provide = createPipeline();
|
|
7
|
-
var client = createAsyncPipeline();
|
|
8
|
-
var server = createAsyncPipeline();
|
|
9
|
-
var init = createAsyncPipeline();
|
|
10
|
-
var pickContext = createPipeline();
|
|
11
|
-
var runtimeHooks = {
|
|
12
|
-
hoc,
|
|
13
|
-
provide,
|
|
14
|
-
client,
|
|
15
|
-
server,
|
|
16
|
-
init,
|
|
17
|
-
pickContext
|
|
18
|
-
};
|
|
19
|
-
var createRuntime = function() {
|
|
20
|
-
return createManager(runtimeHooks);
|
|
21
|
-
};
|
|
22
|
-
var registerInit = function(App, _init) {
|
|
23
|
-
var originalInit = App.init;
|
|
24
|
-
App.init = function() {
|
|
25
|
-
var _ref = _async_to_generator(function(context) {
|
|
26
|
-
return _ts_generator(this, function(_state) {
|
|
27
|
-
switch (_state.label) {
|
|
28
|
-
case 0:
|
|
29
|
-
if (!context.loaderManager) {
|
|
30
|
-
context.loaderManager = createLoaderManager({});
|
|
31
|
-
}
|
|
32
|
-
return [
|
|
33
|
-
4,
|
|
34
|
-
Promise.all([
|
|
35
|
-
originalInit === null || originalInit === void 0 ? void 0 : originalInit(context),
|
|
36
|
-
_init === null || _init === void 0 ? void 0 : _init(context)
|
|
37
|
-
])
|
|
38
|
-
];
|
|
39
|
-
case 1:
|
|
40
|
-
_state.sent();
|
|
41
|
-
return [
|
|
42
|
-
2
|
|
43
|
-
];
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
});
|
|
47
|
-
return function(context) {
|
|
48
|
-
return _ref.apply(this, arguments);
|
|
49
|
-
};
|
|
50
|
-
}();
|
|
51
|
-
};
|
|
52
|
-
var runtime = createRuntime();
|
|
53
|
-
var createPlugin = runtime.createPlugin;
|
|
54
|
-
export {
|
|
55
|
-
createPlugin,
|
|
56
|
-
createRuntime,
|
|
57
|
-
registerInit,
|
|
58
|
-
runtime
|
|
59
|
-
};
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { createManager, createPipeline, createAsyncPipeline } from "@modern-js/plugin";
|
|
2
|
-
import { createLoaderManager } from "./loader/loaderManager";
|
|
3
|
-
const hoc = createPipeline();
|
|
4
|
-
const provide = createPipeline();
|
|
5
|
-
const client = createAsyncPipeline();
|
|
6
|
-
const server = createAsyncPipeline();
|
|
7
|
-
const init = createAsyncPipeline();
|
|
8
|
-
const pickContext = createPipeline();
|
|
9
|
-
const runtimeHooks = {
|
|
10
|
-
hoc,
|
|
11
|
-
provide,
|
|
12
|
-
client,
|
|
13
|
-
server,
|
|
14
|
-
init,
|
|
15
|
-
pickContext
|
|
16
|
-
};
|
|
17
|
-
const createRuntime = () => createManager(runtimeHooks);
|
|
18
|
-
const registerInit = (App, _init) => {
|
|
19
|
-
const originalInit = App.init;
|
|
20
|
-
App.init = async (context) => {
|
|
21
|
-
if (!context.loaderManager) {
|
|
22
|
-
context.loaderManager = createLoaderManager({});
|
|
23
|
-
}
|
|
24
|
-
await Promise.all([
|
|
25
|
-
originalInit === null || originalInit === void 0 ? void 0 : originalInit(context),
|
|
26
|
-
_init === null || _init === void 0 ? void 0 : _init(context)
|
|
27
|
-
]);
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
const runtime = createRuntime();
|
|
31
|
-
const { createPlugin } = runtime;
|
|
32
|
-
export {
|
|
33
|
-
createPlugin,
|
|
34
|
-
createRuntime,
|
|
35
|
-
registerInit,
|
|
36
|
-
runtime
|
|
37
|
-
};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type React from 'react';
|
|
2
|
-
import { AppConfig } from '../common';
|
|
3
|
-
export declare const getConfig: (Component: React.ComponentType<any>) => AppConfig | undefined;
|
|
4
|
-
export declare const defineConfig: (Component: React.ComponentType<any>, config: AppConfig) => React.ComponentType<any>;
|
|
@@ -1,204 +0,0 @@
|
|
|
1
|
-
import type React from 'react';
|
|
2
|
-
import { Setup, ToThreads, CommonAPI, PluginOptions } from '@modern-js/plugin';
|
|
3
|
-
import type { RuntimeContext, TRuntimeContext } from '../runtimeContext';
|
|
4
|
-
export interface AppProps {
|
|
5
|
-
}
|
|
6
|
-
declare const runtimeHooks: {
|
|
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>;
|
|
32
|
-
};
|
|
33
|
-
/** All hooks of runtime plugin. */
|
|
34
|
-
export type RuntimeHooks = typeof runtimeHooks;
|
|
35
|
-
/** All hook callbacks of runtime plugin. */
|
|
36
|
-
export type RuntimeHookCallbacks = ToThreads<RuntimeHooks>;
|
|
37
|
-
/** All apis for runtime plugin. */
|
|
38
|
-
export type PluginAPI = CommonAPI<RuntimeHooks>;
|
|
39
|
-
/** Plugin options of a runtime plugin. */
|
|
40
|
-
export type Plugin = PluginOptions<RuntimeHooks, Setup<RuntimeHooks>>;
|
|
41
|
-
export declare const createRuntime: () => import("@modern-js/plugin").Manager<{
|
|
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>;
|
|
67
|
-
}, Record<string, never>>;
|
|
68
|
-
/**
|
|
69
|
-
* register init hook. It would be revoked both ssr and csr.
|
|
70
|
-
*/
|
|
71
|
-
declare const registerInit: (App: React.ComponentType, _init: (context: RuntimeContext) => any | Promise<any>) => void;
|
|
72
|
-
export declare const runtime: import("@modern-js/plugin").Manager<{
|
|
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>;
|
|
98
|
-
}, Record<string, never>>;
|
|
99
|
-
export declare const createPlugin: (setup?: Setup<{
|
|
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>;
|
|
125
|
-
}, Record<string, never>> | undefined, options?: PluginOptions<{
|
|
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>;
|
|
151
|
-
}, Setup<{
|
|
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>;
|
|
177
|
-
}, Record<string, never>>> | undefined) => import("@modern-js/plugin").Plugin<{
|
|
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>;
|
|
203
|
-
}, Record<string, never>>;
|
|
204
|
-
export { registerInit };
|