@shuvi/platform-web 1.0.0-rc.1 → 1.0.0-rc.2
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/esm/shared/configTypes.d.ts +14 -0
- package/esm/shared/configTypes.js +1 -0
- package/esm/shared/index.d.ts +1 -0
- package/esm/shared/index.js +1 -0
- package/esm/shared/routeTypes.d.ts +1 -1
- package/esm/shuvi-app/dev/webpackHotDevClient.js +2 -1
- package/esm/shuvi-app/entry/server/index.d.ts +1 -1
- package/esm/shuvi-app/entry/server/index.js +1 -1
- package/{lib/node/targets → esm/shuvi-app}/react/redox-react/RedoxWrapper.d.ts +0 -0
- package/esm/shuvi-app/react/redox-react/RedoxWrapper.jsx +11 -0
- package/{lib/node/targets → esm/shuvi-app}/react/redox-react/runtime.d.ts +1 -1
- package/{lib/node/targets → esm/shuvi-app}/react/redox-react/runtime.js +4 -6
- package/lib/node/features/custom-server/index.d.ts +1 -13
- package/lib/node/features/custom-server/index.js +0 -17
- package/lib/node/features/custom-server/server.d.ts +1 -1
- package/lib/node/features/filesystem-routes/api/apiRouteHandler.d.ts +1 -0
- package/lib/node/features/filesystem-routes/api/middleware.d.ts +1 -1
- package/lib/node/features/filesystem-routes/api/middleware.js +3 -5
- package/lib/node/features/filesystem-routes/hooks.d.ts +2 -2
- package/lib/node/features/filesystem-routes/index.d.ts +3 -3
- package/lib/node/features/filesystem-routes/index.js +6 -8
- package/lib/node/features/filesystem-routes/page/index.d.ts +1 -1
- package/lib/node/features/filesystem-routes/page/routes.d.ts +5 -5
- package/lib/node/features/filesystem-routes/page/store.d.ts +3 -3
- package/lib/node/features/html-render/index.d.ts +3 -2
- package/lib/node/features/html-render/server.d.ts +1 -1
- package/lib/node/features/html-render/serverHooks.d.ts +1 -0
- package/lib/node/features/html-render/shuvi-app.d.ts +1 -6
- package/lib/node/features/index.d.ts +5 -16
- package/lib/node/features/main/generateResource.js +10 -12
- package/lib/node/features/middlewares.d.ts +1 -1
- package/lib/node/features/middlewares.js +5 -4
- package/lib/node/features/model/index.d.ts +2 -1
- package/lib/node/features/model/runtime.d.ts +5 -0
- package/lib/node/features/model/runtime.js +1 -1
- package/lib/node/features/on-demand-compile-page/index.d.ts +2 -1
- package/lib/node/index.d.ts +4 -2
- package/lib/node/index.js +1 -2
- package/lib/node/paths.js +26 -6
- package/lib/node/shuvi-type-extensions-node.d.ts +42 -0
- package/lib/node/{shuvi-node-extensions.js → shuvi-type-extensions-node.js} +1 -0
- package/lib/node/targets/react/bundler/index.d.ts +2 -1
- package/lib/node/targets/react/index.d.ts +4 -2
- package/lib/node/targets/react/redox-react/index.d.ts +2 -1
- package/lib/node/targets/react/redox-react/index.js +1 -1
- package/lib/shared/configTypes.d.ts +14 -0
- package/lib/{node/features/filesystem-routes/shuvi-app.js → shared/configTypes.js} +0 -0
- package/lib/shared/index.d.ts +1 -0
- package/lib/shared/index.js +1 -0
- package/lib/shared/routeTypes.d.ts +1 -1
- package/package.json +34 -24
- package/shuvi-type-extensions-node.d.ts +2 -0
- package/{shuvi-app-extensions.d.ts → shuvi-type-extensions-runtime.d.ts} +5 -5
- package/lib/node/features/filesystem-routes/shuvi-app.d.ts +0 -7
- package/lib/node/shuvi-node-extensions.d.ts +0 -17
- package/lib/node/targets/react/redox-react/RedoxWrapper.js +0 -37
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { IRouterHistoryMode, IPageRouteConfig, IMiddlewareRouteConfig, IApiRouteConfig } from '@shuvi/platform-shared/shared';
|
|
2
|
+
export interface IRouterConfig {
|
|
3
|
+
history: IRouterHistoryMode | 'auto';
|
|
4
|
+
}
|
|
5
|
+
export interface PlatformWebCustomConfig {
|
|
6
|
+
ssr: boolean;
|
|
7
|
+
router: IRouterConfig;
|
|
8
|
+
routes?: IPageRouteConfig[];
|
|
9
|
+
middlewareRoutes?: IMiddlewareRouteConfig[];
|
|
10
|
+
apiRoutes?: IApiRouteConfig[];
|
|
11
|
+
conventionRoutes: {
|
|
12
|
+
exclude?: string[];
|
|
13
|
+
};
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/esm/shared/index.d.ts
CHANGED
package/esm/shared/index.js
CHANGED
|
@@ -24,7 +24,7 @@ export declare type IApiRes<T = any> = {
|
|
|
24
24
|
export declare type IApiResponse<T = any> = IResponse & IApiRes<T>;
|
|
25
25
|
export declare type IApiRequestHandler<T = any> = (req: IApiRequest, res: IApiResponse<T>) => void | Promise<void>;
|
|
26
26
|
export interface IApiConfig {
|
|
27
|
-
|
|
27
|
+
api?: {
|
|
28
28
|
bodyParser?: {
|
|
29
29
|
sizeLimit: number | string;
|
|
30
30
|
} | boolean;
|
|
@@ -5,7 +5,8 @@ export default (options = {}) => {
|
|
|
5
5
|
if (devClient) {
|
|
6
6
|
return devClient;
|
|
7
7
|
}
|
|
8
|
-
devClient = connect(Object.assign(Object.assign({}, options), { launchEditorEndpoint: DEV_HOT_LAUNCH_EDITOR_ENDPOINT, path: DEV_HOT_MIDDLEWARE_PATH
|
|
8
|
+
devClient = connect(Object.assign(Object.assign({}, options), { launchEditorEndpoint: DEV_HOT_LAUNCH_EDITOR_ENDPOINT, path: DEV_HOT_MIDDLEWARE_PATH, location,
|
|
9
|
+
WebSocket }));
|
|
9
10
|
devClient.subscribeToHmrEvent((event) => {
|
|
10
11
|
// if (obj.action === "reloadPage") {
|
|
11
12
|
// return window.location.reload();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as application from '../../app/server';
|
|
2
|
-
import * as server from '@shuvi/app/
|
|
2
|
+
import * as server from '@shuvi/app/user/server';
|
|
3
3
|
import { default as apiRoutes } from '@shuvi/app/files/apiRoutes';
|
|
4
4
|
import { default as middlewareRoutes } from '@shuvi/app/files/middlewareRoutes';
|
|
5
5
|
export { server, application, apiRoutes, middlewareRoutes };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// This is the shuvi server-side main module exports collection
|
|
2
2
|
import * as application from '../../app/server';
|
|
3
|
-
import * as server from '@shuvi/app/
|
|
3
|
+
import * as server from '@shuvi/app/user/server';
|
|
4
4
|
import { default as apiRoutes } from '@shuvi/app/files/apiRoutes';
|
|
5
5
|
import { default as middlewareRoutes } from '@shuvi/app/files/middlewareRoutes';
|
|
6
6
|
export { server, application, apiRoutes, middlewareRoutes };
|
|
File without changes
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { RedoxRoot } from '@shuvi/redox-react';
|
|
3
|
+
export const RedoxWrapper = (App, appContext) => {
|
|
4
|
+
function RedoxAppWrapper(appProps) {
|
|
5
|
+
return (<RedoxRoot storeManager={appContext.storeManager}>
|
|
6
|
+
<App {...appProps}/>
|
|
7
|
+
</RedoxRoot>);
|
|
8
|
+
}
|
|
9
|
+
RedoxAppWrapper.displayName = 'RedoxAppWrapper';
|
|
10
|
+
return RedoxAppWrapper;
|
|
11
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: import("@shuvi/platform-shared/shared").IPluginInstance<import("@shuvi/platform-shared/shared").BuiltInRuntimePluginHooks & import("@shuvi/
|
|
1
|
+
declare const _default: import("@shuvi/platform-shared/shared").IPluginInstance<import("@shuvi/platform-shared/shared").BuiltInRuntimePluginHooks & import("@shuvi/platform-shared/shared").CustomRuntimePluginHooks, void>;
|
|
2
2
|
export default _default;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -8,11 +7,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
8
|
});
|
|
10
9
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
exports.default = (0, shared_1.createRuntimePlugin)({
|
|
10
|
+
import { createRuntimePlugin } from '@shuvi/platform-shared/shared';
|
|
11
|
+
import { RedoxWrapper } from './RedoxWrapper';
|
|
12
|
+
export default createRuntimePlugin({
|
|
15
13
|
appComponent: (App, appContext) => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
|
-
return
|
|
14
|
+
return RedoxWrapper(App, appContext);
|
|
17
15
|
})
|
|
18
16
|
});
|
|
@@ -1,16 +1,4 @@
|
|
|
1
1
|
declare const _default: {
|
|
2
|
-
|
|
3
|
-
afterInit: import("@shuvi/hook").AsyncParallelHook<void, void, void>;
|
|
4
|
-
afterBuild: import("@shuvi/hook").AsyncParallelHook<void, void, void>;
|
|
5
|
-
afterDestroy: import("@shuvi/hook").AsyncParallelHook<void, void, void>;
|
|
6
|
-
afterBundlerDone: import("@shuvi/hook").AsyncParallelHook<import("@shuvi/service/lib/core/lifecycleTypes").BundlerDoneExtra, void, void>;
|
|
7
|
-
afterBundlerTargetDone: import("@shuvi/hook").AsyncParallelHook<import("@shuvi/service/lib/core/lifecycleTypes").BundlerTargetDoneExtra, void, void>;
|
|
8
|
-
configWebpack: import("@shuvi/hook").AsyncSeriesWaterfallHook<import("@shuvi/service/lib/core/lifecycleTypes").WebpackChainType, import("@shuvi/service/lib/core/lifecycleTypes").ConfigWebpackAssistant>;
|
|
9
|
-
addExtraTarget: import("@shuvi/hook").AsyncParallelHook<import("@shuvi/service/lib/core/lifecycleTypes").ExtraTargetAssistant, void, import("@shuvi/service/lib/core/lifecycleTypes").TargetChain>;
|
|
10
|
-
addResource: import("@shuvi/hook").AsyncParallelHook<void, void, import("@shuvi/service/lib/core/lifecycleTypes").Resources | import("@shuvi/service/lib/core/lifecycleTypes").Resources[]>;
|
|
11
|
-
addRuntimeFile: import("@shuvi/hook").AsyncParallelHook<void, import("@shuvi/service/lib/core/lifecycleTypes").AddRuntimeFileUtils, import("@shuvi/service/lib/project/index").FileOptions<any, any> | import("@shuvi/service/lib/project/index").FileOptions<any, any>[]>;
|
|
12
|
-
addRuntimeService: import("@shuvi/hook").AsyncParallelHook<void, void, import("@shuvi/service/lib/core/lifecycleTypes").RuntimeService | import("@shuvi/service/lib/core/lifecycleTypes").RuntimeService[]>;
|
|
13
|
-
} & import("@shuvi/runtime").CustomCorePluginHooks, import("@shuvi/service").IPluginContext>;
|
|
14
|
-
server: import("@shuvi/hook").IPluginInstance<import("@shuvi/service/lib/server/plugin").BuiltInServerPluginHooks & import("@shuvi/runtime").CustomServerPluginHooks, import("@shuvi/service").IServerPluginContext>;
|
|
2
|
+
server: import("@shuvi/hook").IPluginInstance<import("@shuvi/service/lib/server/plugin").BuiltInServerPluginHooks & import("@shuvi/service/lib/server/pluginTypes").CustomServerPluginHooks, import("@shuvi/service").IServerPluginContext>;
|
|
15
3
|
};
|
|
16
4
|
export default _default;
|
|
@@ -3,24 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const service_1 = require("@shuvi/service");
|
|
7
|
-
const file_utils_1 = require("@shuvi/service/lib/project/file-utils");
|
|
8
6
|
const server_1 = __importDefault(require("./server"));
|
|
9
|
-
const core = (0, service_1.createPlugin)({
|
|
10
|
-
addRuntimeFile: ({ defineFile }, context) => {
|
|
11
|
-
const { paths } = context;
|
|
12
|
-
const serverCandidates = (0, file_utils_1.getUserCustomFileCandidates)(paths.rootDir, 'server', 'noop');
|
|
13
|
-
const userServerFile = defineFile({
|
|
14
|
-
name: 'user/server.js',
|
|
15
|
-
content: () => {
|
|
16
|
-
return (0, file_utils_1.getFirstModuleExport)((0, file_utils_1.getAllFiles)(serverCandidates), serverCandidates);
|
|
17
|
-
},
|
|
18
|
-
dependencies: serverCandidates
|
|
19
|
-
});
|
|
20
|
-
return [userServerFile];
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
7
|
exports.default = {
|
|
24
|
-
core,
|
|
25
8
|
server: server_1.default
|
|
26
9
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: import("@shuvi/hook").IPluginInstance<import("@shuvi/service/lib/server/plugin").BuiltInServerPluginHooks & import("@shuvi/
|
|
1
|
+
declare const _default: import("@shuvi/hook").IPluginInstance<import("@shuvi/service/lib/server/plugin").BuiltInServerPluginHooks & import("@shuvi/service/lib/server/pluginTypes").CustomServerPluginHooks, import("@shuvi/service").IServerPluginContext>;
|
|
2
2
|
export default _default;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { IServerPluginContext, IRequestHandlerWithNext } from '@shuvi/service';
|
|
2
|
-
export declare function middleware(
|
|
2
|
+
export declare function middleware(_ctx: IServerPluginContext): IRequestHandlerWithNext;
|
|
@@ -13,11 +13,10 @@ exports.middleware = void 0;
|
|
|
13
13
|
const router_1 = require("@shuvi/router");
|
|
14
14
|
const resources_1 = require("@shuvi/service/lib/resources");
|
|
15
15
|
const apiRouteHandler_1 = require("./apiRouteHandler");
|
|
16
|
-
function middleware(
|
|
16
|
+
function middleware(_ctx) {
|
|
17
17
|
return function (req, res, next) {
|
|
18
18
|
return __awaiter(this, void 0, void 0, function* () {
|
|
19
19
|
const { apiRoutes } = resources_1.server;
|
|
20
|
-
const commonApiConfig = ctx.config.apiConfig || {};
|
|
21
20
|
let tempApiModule;
|
|
22
21
|
for (const { path, api } of apiRoutes) {
|
|
23
22
|
const match = (0, router_1.matchPathname)(path, req.pathname);
|
|
@@ -29,9 +28,8 @@ function middleware(ctx) {
|
|
|
29
28
|
}
|
|
30
29
|
if (tempApiModule) {
|
|
31
30
|
try {
|
|
32
|
-
const { config
|
|
33
|
-
|
|
34
|
-
yield (0, apiRouteHandler_1.apiRouteHandler)(req, res, resolver, overridesConfig);
|
|
31
|
+
const { config, default: resolver } = tempApiModule;
|
|
32
|
+
yield (0, apiRouteHandler_1.apiRouteHandler)(req, res, resolver, (config === null || config === void 0 ? void 0 : config.api) || { bodyParser: true });
|
|
35
33
|
}
|
|
36
34
|
catch (error) {
|
|
37
35
|
next(error);
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const addRoutes: import("@shuvi/hook").AsyncParallelHook<void, void,
|
|
1
|
+
import { IPageRouteConfig, IMiddlewareRouteConfig } from '@shuvi/platform-shared/shared';
|
|
2
|
+
export declare const addRoutes: import("@shuvi/hook").AsyncParallelHook<void, void, IPageRouteConfig[]>;
|
|
3
3
|
export declare const addMiddlewareRoutes: import("@shuvi/hook").AsyncParallelHook<void, void, IMiddlewareRouteConfig[]>;
|
|
@@ -3,7 +3,8 @@ import { middleware as getMiddlewareMiddleware } from './middleware';
|
|
|
3
3
|
import { IApiRequestHandler, middleware as getApiMiddleware } from './api';
|
|
4
4
|
export { IApiRequestHandler, getRoutes, getMiddlewareMiddleware, getApiMiddleware };
|
|
5
5
|
declare const _default: {
|
|
6
|
-
core: import("@shuvi/
|
|
6
|
+
core: import("@shuvi/platform-shared/shared").IPluginInstance<{
|
|
7
|
+
extendConfig: import("@shuvi/hook").SyncWaterfallHook<import("@shuvi/service").Config, void>;
|
|
7
8
|
afterInit: import("@shuvi/hook").AsyncParallelHook<void, void, void>;
|
|
8
9
|
afterBuild: import("@shuvi/hook").AsyncParallelHook<void, void, void>;
|
|
9
10
|
afterDestroy: import("@shuvi/hook").AsyncParallelHook<void, void, void>;
|
|
@@ -14,7 +15,6 @@ declare const _default: {
|
|
|
14
15
|
addResource: import("@shuvi/hook").AsyncParallelHook<void, void, import("@shuvi/service/lib/core/lifecycleTypes").Resources | import("@shuvi/service/lib/core/lifecycleTypes").Resources[]>;
|
|
15
16
|
addRuntimeFile: import("@shuvi/hook").AsyncParallelHook<void, import("@shuvi/service/lib/core/lifecycleTypes").AddRuntimeFileUtils, import("@shuvi/service/lib/project/index").FileOptions<any, any> | import("@shuvi/service/lib/project/index").FileOptions<any, any>[]>;
|
|
16
17
|
addRuntimeService: import("@shuvi/hook").AsyncParallelHook<void, void, import("@shuvi/service/lib/core/lifecycleTypes").RuntimeService | import("@shuvi/service/lib/core/lifecycleTypes").RuntimeService[]>;
|
|
17
|
-
} & import("@shuvi/
|
|
18
|
-
types: string;
|
|
18
|
+
} & import("@shuvi/service/lib/core/apiTypes").CustomCorePluginHooks, import("@shuvi/service").IPluginContext>;
|
|
19
19
|
};
|
|
20
20
|
export default _default;
|
|
@@ -38,7 +38,6 @@ const path = __importStar(require("path"));
|
|
|
38
38
|
const build_loaders_1 = require("@shuvi/toolpack/lib/utils/build-loaders");
|
|
39
39
|
const service_1 = require("@shuvi/service");
|
|
40
40
|
const node_1 = require("@shuvi/platform-shared/node");
|
|
41
|
-
const paths_1 = require("../../paths");
|
|
42
41
|
const lib_1 = require("../html-render/lib");
|
|
43
42
|
const hooks_1 = require("./hooks");
|
|
44
43
|
const page_1 = require("./page");
|
|
@@ -52,7 +51,7 @@ const plugin = (0, service_1.createPlugin)({
|
|
|
52
51
|
addHooks({ addRoutes: hooks_1.addRoutes, addMiddlewareRoutes: hooks_1.addMiddlewareRoutes });
|
|
53
52
|
},
|
|
54
53
|
addRuntimeFile: ({ defineFile }, context) => __awaiter(void 0, void 0, void 0, function* () {
|
|
55
|
-
const { config: { routes: pageRoutes, middlewareRoutes, apiRoutes }, paths, pluginRunner, phase } = context;
|
|
54
|
+
const { config: { routes: pageRoutes, middlewareRoutes, apiRoutes, conventionRoutes }, paths, pluginRunner, phase } = context;
|
|
56
55
|
const isBuildPhase = phase === 'PHASE_PRODUCTION_BUILD';
|
|
57
56
|
const pageRoutesFile = defineFile({
|
|
58
57
|
name: 'routes.js',
|
|
@@ -63,7 +62,7 @@ const plugin = (0, service_1.createPlugin)({
|
|
|
63
62
|
routes = pageRoutes;
|
|
64
63
|
}
|
|
65
64
|
else {
|
|
66
|
-
const { routes: _routes, warnings } = yield (0, node_1.getPageRoutes)(paths.routesDir);
|
|
65
|
+
const { routes: _routes, warnings } = yield (0, node_1.getPageRoutes)(paths.routesDir, conventionRoutes.exclude);
|
|
67
66
|
if (isBuildPhase) {
|
|
68
67
|
warnings.forEach(warning => {
|
|
69
68
|
console.warn(warning.msg);
|
|
@@ -83,13 +82,13 @@ const plugin = (0, service_1.createPlugin)({
|
|
|
83
82
|
const apiRoutesFile = defineFile({
|
|
84
83
|
name: 'apiRoutes.js',
|
|
85
84
|
content: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
86
|
-
let routes
|
|
85
|
+
let routes;
|
|
87
86
|
const hasConfigRoutes = Array.isArray(apiRoutes);
|
|
88
87
|
if (hasConfigRoutes) {
|
|
89
88
|
routes = apiRoutes;
|
|
90
89
|
}
|
|
91
90
|
else {
|
|
92
|
-
const { routes: _routes, warnings } = yield (0, node_1.getApiRoutes)(paths.routesDir);
|
|
91
|
+
const { routes: _routes, warnings } = yield (0, node_1.getApiRoutes)(paths.routesDir, conventionRoutes.exclude);
|
|
93
92
|
if (isBuildPhase) {
|
|
94
93
|
warnings.forEach(warning => {
|
|
95
94
|
console.warn(warning);
|
|
@@ -110,7 +109,7 @@ const plugin = (0, service_1.createPlugin)({
|
|
|
110
109
|
routes = middlewareRoutes;
|
|
111
110
|
}
|
|
112
111
|
else {
|
|
113
|
-
const { routes: _routes, warnings } = yield (0, node_1.getMiddlewareRoutes)(paths.routesDir);
|
|
112
|
+
const { routes: _routes, warnings } = yield (0, node_1.getMiddlewareRoutes)(paths.routesDir, conventionRoutes.exclude);
|
|
114
113
|
if (isBuildPhase) {
|
|
115
114
|
warnings.forEach(warning => {
|
|
116
115
|
console.warn(warning);
|
|
@@ -177,6 +176,5 @@ const plugin = (0, service_1.createPlugin)({
|
|
|
177
176
|
})
|
|
178
177
|
});
|
|
179
178
|
exports.default = {
|
|
180
|
-
core: plugin
|
|
181
|
-
types: (0, paths_1.resolvePkgFile)('lib/node/features/filesystem-routes/shuvi-app.d.ts')
|
|
179
|
+
core: plugin
|
|
182
180
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { normalizeRoutes, generateRoutesContent,
|
|
1
|
+
export { normalizeRoutes, generateRoutesContent, IPageRouteConfig } from './routes';
|
|
2
2
|
export * from './store';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { IPageRouteConfig, IPageRouteConfigWithId } from '@shuvi/platform-shared/shared';
|
|
2
|
+
export { IPageRouteConfig };
|
|
3
3
|
/**
|
|
4
4
|
* returns JSON string of IRawPageRouteRecord
|
|
5
5
|
*/
|
|
6
|
-
export declare function serializeRoutes(routes:
|
|
7
|
-
export declare function normalizeRoutes(routes:
|
|
8
|
-
export declare const generateRoutesContent: (routes:
|
|
6
|
+
export declare function serializeRoutes(routes: IPageRouteConfigWithId[]): string;
|
|
7
|
+
export declare function normalizeRoutes(routes: IPageRouteConfig[], componentDir: string, parentPath?: string): IPageRouteConfigWithId[];
|
|
8
|
+
export declare const generateRoutesContent: (routes: IPageRouteConfigWithId[]) => string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const setRoutes: (newRoutes:
|
|
3
|
-
export declare const getRoutes: () =>
|
|
1
|
+
import { IPageRouteConfigWithId } from '@shuvi/platform-shared/shared';
|
|
2
|
+
export declare const setRoutes: (newRoutes: IPageRouteConfigWithId[]) => void;
|
|
3
|
+
export declare const getRoutes: () => IPageRouteConfigWithId[];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { getPageMiddleware, IHtmlDocument, ITemplateData, IViewServer, IViewClient } from './lib';
|
|
2
2
|
declare const _default: {
|
|
3
3
|
core: import("@shuvi/hook").IPluginInstance<{
|
|
4
|
+
extendConfig: import("@shuvi/hook").SyncWaterfallHook<import("@shuvi/service").Config, void>;
|
|
4
5
|
afterInit: import("@shuvi/hook").AsyncParallelHook<void, void, void>;
|
|
5
6
|
afterBuild: import("@shuvi/hook").AsyncParallelHook<void, void, void>;
|
|
6
7
|
afterDestroy: import("@shuvi/hook").AsyncParallelHook<void, void, void>;
|
|
@@ -11,8 +12,8 @@ declare const _default: {
|
|
|
11
12
|
addResource: import("@shuvi/hook").AsyncParallelHook<void, void, import("@shuvi/service/lib/core/lifecycleTypes").Resources | import("@shuvi/service/lib/core/lifecycleTypes").Resources[]>;
|
|
12
13
|
addRuntimeFile: import("@shuvi/hook").AsyncParallelHook<void, import("@shuvi/service/lib/core/lifecycleTypes").AddRuntimeFileUtils, import("@shuvi/service/lib/project/index").FileOptions<any, any> | import("@shuvi/service/lib/project/index").FileOptions<any, any>[]>;
|
|
13
14
|
addRuntimeService: import("@shuvi/hook").AsyncParallelHook<void, void, import("@shuvi/service/lib/core/lifecycleTypes").RuntimeService | import("@shuvi/service/lib/core/lifecycleTypes").RuntimeService[]>;
|
|
14
|
-
} & import("@shuvi/
|
|
15
|
-
server: import("@shuvi/hook").IPluginInstance<import("@shuvi/service/lib/server/plugin").BuiltInServerPluginHooks & import("@shuvi/
|
|
15
|
+
} & import("@shuvi/service/lib/core/apiTypes").CustomCorePluginHooks, import("@shuvi/service").IPluginContext>;
|
|
16
|
+
server: import("@shuvi/hook").IPluginInstance<import("@shuvi/service/lib/server/plugin").BuiltInServerPluginHooks & import("@shuvi/service/lib/server/pluginTypes").CustomServerPluginHooks, import("@shuvi/service").IServerPluginContext>;
|
|
16
17
|
types: string;
|
|
17
18
|
};
|
|
18
19
|
export default _default;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: import("@shuvi/hook").IPluginInstance<import("@shuvi/service/lib/server/plugin").BuiltInServerPluginHooks & import("@shuvi/
|
|
1
|
+
declare const _default: import("@shuvi/hook").IPluginInstance<import("@shuvi/service/lib/server/plugin").BuiltInServerPluginHooks & import("@shuvi/service/lib/server/pluginTypes").CustomServerPluginHooks, import("@shuvi/service").IServerPluginContext>;
|
|
2
2
|
export default _default;
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
export {};
|
|
2
2
|
declare module '@shuvi/runtime' {
|
|
3
3
|
interface CustomAppContext {
|
|
4
4
|
pageData?: any;
|
|
5
5
|
}
|
|
6
|
-
interface CustomServerPluginHooks {
|
|
7
|
-
getPageData: typeof extendedHooks.getPageData;
|
|
8
|
-
handlePageRequest: typeof extendedHooks.handlePageRequest;
|
|
9
|
-
modifyHtml: typeof extendedHooks.modifyHtml;
|
|
10
|
-
}
|
|
11
6
|
}
|
|
@@ -2,6 +2,7 @@ export { buildHtml } from './main/buildHtml';
|
|
|
2
2
|
export { getMiddlewares, getMiddlewaresBeforeDevMiddlewares } from './middlewares';
|
|
3
3
|
export { getPlugin as getMainPlugin } from './main';
|
|
4
4
|
export declare const featurePlugins: (import("@shuvi/hook").IPluginInstance<{
|
|
5
|
+
extendConfig: import("@shuvi/hook").SyncWaterfallHook<import("@shuvi/service").Config, void>;
|
|
5
6
|
afterInit: import("@shuvi/hook").AsyncParallelHook<void, void, void>;
|
|
6
7
|
afterBuild: import("@shuvi/hook").AsyncParallelHook<void, void, void>;
|
|
7
8
|
afterDestroy: import("@shuvi/hook").AsyncParallelHook<void, void, void>;
|
|
@@ -12,8 +13,9 @@ export declare const featurePlugins: (import("@shuvi/hook").IPluginInstance<{
|
|
|
12
13
|
addResource: import("@shuvi/hook").AsyncParallelHook<void, void, import("@shuvi/service/lib/core/lifecycleTypes").Resources | import("@shuvi/service/lib/core/lifecycleTypes").Resources[]>;
|
|
13
14
|
addRuntimeFile: import("@shuvi/hook").AsyncParallelHook<void, import("@shuvi/service/lib/core/lifecycleTypes").AddRuntimeFileUtils, import("@shuvi/service/lib/project/index").FileOptions<any, any> | import("@shuvi/service/lib/project/index").FileOptions<any, any>[]>;
|
|
14
15
|
addRuntimeService: import("@shuvi/hook").AsyncParallelHook<void, void, import("@shuvi/service/lib/core/lifecycleTypes").RuntimeService | import("@shuvi/service/lib/core/lifecycleTypes").RuntimeService[]>;
|
|
15
|
-
} & import("@shuvi/
|
|
16
|
+
} & import("@shuvi/service/lib/core/apiTypes").CustomCorePluginHooks, import("@shuvi/service").IPluginContext> | {
|
|
16
17
|
core: import("@shuvi/hook").IPluginInstance<{
|
|
18
|
+
extendConfig: import("@shuvi/hook").SyncWaterfallHook<import("@shuvi/service").Config, void>;
|
|
17
19
|
afterInit: import("@shuvi/hook").AsyncParallelHook<void, void, void>;
|
|
18
20
|
afterBuild: import("@shuvi/hook").AsyncParallelHook<void, void, void>;
|
|
19
21
|
afterDestroy: import("@shuvi/hook").AsyncParallelHook<void, void, void>;
|
|
@@ -24,20 +26,7 @@ export declare const featurePlugins: (import("@shuvi/hook").IPluginInstance<{
|
|
|
24
26
|
addResource: import("@shuvi/hook").AsyncParallelHook<void, void, import("@shuvi/service/lib/core/lifecycleTypes").Resources | import("@shuvi/service/lib/core/lifecycleTypes").Resources[]>;
|
|
25
27
|
addRuntimeFile: import("@shuvi/hook").AsyncParallelHook<void, import("@shuvi/service/lib/core/lifecycleTypes").AddRuntimeFileUtils, import("@shuvi/service/lib/project/index").FileOptions<any, any> | import("@shuvi/service/lib/project/index").FileOptions<any, any>[]>;
|
|
26
28
|
addRuntimeService: import("@shuvi/hook").AsyncParallelHook<void, void, import("@shuvi/service/lib/core/lifecycleTypes").RuntimeService | import("@shuvi/service/lib/core/lifecycleTypes").RuntimeService[]>;
|
|
27
|
-
} & import("@shuvi/
|
|
28
|
-
types: string;
|
|
29
|
+
} & import("@shuvi/service/lib/core/apiTypes").CustomCorePluginHooks, import("@shuvi/service").IPluginContext>;
|
|
29
30
|
} | {
|
|
30
|
-
|
|
31
|
-
afterInit: import("@shuvi/hook").AsyncParallelHook<void, void, void>;
|
|
32
|
-
afterBuild: import("@shuvi/hook").AsyncParallelHook<void, void, void>;
|
|
33
|
-
afterDestroy: import("@shuvi/hook").AsyncParallelHook<void, void, void>;
|
|
34
|
-
afterBundlerDone: import("@shuvi/hook").AsyncParallelHook<import("@shuvi/service/lib/core/lifecycleTypes").BundlerDoneExtra, void, void>;
|
|
35
|
-
afterBundlerTargetDone: import("@shuvi/hook").AsyncParallelHook<import("@shuvi/service/lib/core/lifecycleTypes").BundlerTargetDoneExtra, void, void>;
|
|
36
|
-
configWebpack: import("@shuvi/hook").AsyncSeriesWaterfallHook<import("@shuvi/service/lib/core/lifecycleTypes").WebpackChainType, import("@shuvi/service/lib/core/lifecycleTypes").ConfigWebpackAssistant>;
|
|
37
|
-
addExtraTarget: import("@shuvi/hook").AsyncParallelHook<import("@shuvi/service/lib/core/lifecycleTypes").ExtraTargetAssistant, void, import("@shuvi/service/lib/core/lifecycleTypes").TargetChain>;
|
|
38
|
-
addResource: import("@shuvi/hook").AsyncParallelHook<void, void, import("@shuvi/service/lib/core/lifecycleTypes").Resources | import("@shuvi/service/lib/core/lifecycleTypes").Resources[]>;
|
|
39
|
-
addRuntimeFile: import("@shuvi/hook").AsyncParallelHook<void, import("@shuvi/service/lib/core/lifecycleTypes").AddRuntimeFileUtils, import("@shuvi/service/lib/project/index").FileOptions<any, any> | import("@shuvi/service/lib/project/index").FileOptions<any, any>[]>;
|
|
40
|
-
addRuntimeService: import("@shuvi/hook").AsyncParallelHook<void, void, import("@shuvi/service/lib/core/lifecycleTypes").RuntimeService | import("@shuvi/service/lib/core/lifecycleTypes").RuntimeService[]>;
|
|
41
|
-
} & import("@shuvi/runtime").CustomCorePluginHooks, import("@shuvi/service").IPluginContext>;
|
|
42
|
-
server: import("@shuvi/hook").IPluginInstance<import("@shuvi/service/lib/server/plugin").BuiltInServerPluginHooks & import("@shuvi/runtime").CustomServerPluginHooks, import("@shuvi/service").IServerPluginContext>;
|
|
31
|
+
server: import("@shuvi/hook").IPluginInstance<import("@shuvi/service/lib/server/plugin").BuiltInServerPluginHooks & import("@shuvi/service/lib/server/pluginTypes").CustomServerPluginHooks, import("@shuvi/service").IServerPluginContext>;
|
|
43
32
|
})[];
|
|
@@ -26,24 +26,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
26
26
|
const path = __importStar(require("path"));
|
|
27
27
|
const fse = __importStar(require("fs-extra"));
|
|
28
28
|
const service_1 = require("@shuvi/service");
|
|
29
|
+
const file_utils_1 = require("@shuvi/service/lib/project/file-utils");
|
|
29
30
|
const generateResources = (context) => {
|
|
30
31
|
const { resolveUserFile } = context;
|
|
31
32
|
const { buildDir } = context.paths;
|
|
32
|
-
const
|
|
33
|
+
const clientManifestRequest = (0, file_utils_1.urlToRequest)(path.join(buildDir, service_1.BUILD_DEFAULT_DIR, service_1.CLIENT_BUILD_MANIFEST_PATH));
|
|
34
|
+
const serverManifestRequest = (0, file_utils_1.urlToRequest)(path.join(buildDir, service_1.BUILD_SERVER_DIR, service_1.SERVER_BUILD_MANIFEST_PATH));
|
|
35
|
+
const serverModuleDir = path.join(buildDir, service_1.BUILD_SERVER_DIR);
|
|
33
36
|
const result = [];
|
|
34
|
-
result.push([
|
|
35
|
-
|
|
36
|
-
path.join(buildDir, service_1.BUILD_DEFAULT_DIR, service_1.CLIENT_BUILD_MANIFEST_PATH)
|
|
37
|
-
]);
|
|
38
|
-
result.push(['serverManifest', serverManifestPath]);
|
|
37
|
+
result.push(['clientManifest', clientManifestRequest]);
|
|
38
|
+
result.push(['serverManifest', serverManifestRequest]);
|
|
39
39
|
result.push([
|
|
40
40
|
`server = function() {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
require('${serverManifestPath}')['bundles']['${service_1.BUILD_SERVER_FILE_SERVER}']
|
|
46
|
-
))
|
|
41
|
+
const path = require('path');
|
|
42
|
+
const relativeModulePath = require('${serverManifestRequest}')['bundles']['${service_1.BUILD_SERVER_FILE_SERVER}'];
|
|
43
|
+
const modulePath = require.resolve(path.join("${serverModuleDir}", relativeModulePath));
|
|
44
|
+
return require(modulePath)
|
|
47
45
|
}`,
|
|
48
46
|
undefined
|
|
49
47
|
]);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { IServerPluginContext, IServerMiddleware } from '@shuvi/service';
|
|
2
2
|
import { DevMiddleware } from '@shuvi/service/lib/server/middlewares/dev/devMiddleware';
|
|
3
3
|
export declare const getMiddlewares: (context: IServerPluginContext) => IServerMiddleware[];
|
|
4
|
-
export declare const getMiddlewaresBeforeDevMiddlewares: (devMiddleware: DevMiddleware, context: IServerPluginContext) => IServerMiddleware;
|
|
4
|
+
export declare const getMiddlewaresBeforeDevMiddlewares: (devMiddleware: DevMiddleware, context: IServerPluginContext) => IServerMiddleware[];
|
|
@@ -4,10 +4,8 @@ exports.getMiddlewaresBeforeDevMiddlewares = exports.getMiddlewares = void 0;
|
|
|
4
4
|
const on_demand_compile_page_1 = require("./on-demand-compile-page");
|
|
5
5
|
const filesystem_routes_1 = require("./filesystem-routes");
|
|
6
6
|
const html_render_1 = require("./html-render");
|
|
7
|
-
let onDemandRouteManager;
|
|
8
7
|
const getMiddlewares = (context) => {
|
|
9
8
|
return [
|
|
10
|
-
onDemandRouteManager && onDemandRouteManager.ensureRoutesMiddleware(),
|
|
11
9
|
(0, filesystem_routes_1.getMiddlewareMiddleware)(context),
|
|
12
10
|
(0, filesystem_routes_1.getApiMiddleware)(context),
|
|
13
11
|
(0, html_render_1.getPageMiddleware)(context)
|
|
@@ -15,8 +13,11 @@ const getMiddlewares = (context) => {
|
|
|
15
13
|
};
|
|
16
14
|
exports.getMiddlewares = getMiddlewares;
|
|
17
15
|
const getMiddlewaresBeforeDevMiddlewares = (devMiddleware, context) => {
|
|
18
|
-
onDemandRouteManager = new on_demand_compile_page_1.OnDemandRouteManager(context);
|
|
16
|
+
const onDemandRouteManager = new on_demand_compile_page_1.OnDemandRouteManager(context);
|
|
19
17
|
onDemandRouteManager.devMiddleware = devMiddleware;
|
|
20
|
-
return
|
|
18
|
+
return [
|
|
19
|
+
onDemandRouteManager.getServerMiddleware(),
|
|
20
|
+
onDemandRouteManager.ensureRoutesMiddleware() // check page request
|
|
21
|
+
];
|
|
21
22
|
};
|
|
22
23
|
exports.getMiddlewaresBeforeDevMiddlewares = getMiddlewaresBeforeDevMiddlewares;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
declare const _default: {
|
|
2
2
|
core: import("@shuvi/hook").IPluginInstance<{
|
|
3
|
+
extendConfig: import("@shuvi/hook").SyncWaterfallHook<import("@shuvi/service").Config, void>;
|
|
3
4
|
afterInit: import("@shuvi/hook").AsyncParallelHook<void, void, void>;
|
|
4
5
|
afterBuild: import("@shuvi/hook").AsyncParallelHook<void, void, void>;
|
|
5
6
|
afterDestroy: import("@shuvi/hook").AsyncParallelHook<void, void, void>;
|
|
@@ -10,7 +11,7 @@ declare const _default: {
|
|
|
10
11
|
addResource: import("@shuvi/hook").AsyncParallelHook<void, void, import("@shuvi/service/lib/core/lifecycleTypes").Resources | import("@shuvi/service/lib/core/lifecycleTypes").Resources[]>;
|
|
11
12
|
addRuntimeFile: import("@shuvi/hook").AsyncParallelHook<void, import("@shuvi/service/lib/core/lifecycleTypes").AddRuntimeFileUtils, import("@shuvi/service/lib/project/index").FileOptions<any, any> | import("@shuvi/service/lib/project/index").FileOptions<any, any>[]>;
|
|
12
13
|
addRuntimeService: import("@shuvi/hook").AsyncParallelHook<void, void, import("@shuvi/service/lib/core/lifecycleTypes").RuntimeService | import("@shuvi/service/lib/core/lifecycleTypes").RuntimeService[]>;
|
|
13
|
-
} & import("@shuvi/
|
|
14
|
+
} & import("@shuvi/service/lib/core/apiTypes").CustomCorePluginHooks, import("@shuvi/service").IPluginContext>;
|
|
14
15
|
runtime: {
|
|
15
16
|
plugin: string;
|
|
16
17
|
};
|
|
@@ -4,5 +4,10 @@ export declare type InitRedox = (params: {
|
|
|
4
4
|
initialState: any;
|
|
5
5
|
ctx: IAppContext;
|
|
6
6
|
}) => IStoreManager;
|
|
7
|
+
declare module '@shuvi/runtime' {
|
|
8
|
+
interface CustomAppContext {
|
|
9
|
+
storeManager?: IStoreManager;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
7
12
|
declare const _default: import("@shuvi/platform-shared/shared").IPluginInstance<import("@shuvi/platform-shared/shared").BuiltInRuntimePluginHooks & import("@shuvi/runtime").CustomRuntimePluginHooks, void>;
|
|
8
13
|
export default _default;
|
|
@@ -22,7 +22,7 @@ const initStore = ({ initialState, ctx }) => {
|
|
|
22
22
|
}
|
|
23
23
|
// for client is singleton, just init once
|
|
24
24
|
if (currentStoreManager) {
|
|
25
|
-
return
|
|
25
|
+
return currentStoreManager;
|
|
26
26
|
}
|
|
27
27
|
currentStoreManager = createStoreInstance();
|
|
28
28
|
return currentStoreManager;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
declare const _default: import("@shuvi/hook").IPluginInstance<{
|
|
2
|
+
extendConfig: import("@shuvi/hook").SyncWaterfallHook<import("@shuvi/service").Config, void>;
|
|
2
3
|
afterInit: import("@shuvi/hook").AsyncParallelHook<void, void, void>;
|
|
3
4
|
afterBuild: import("@shuvi/hook").AsyncParallelHook<void, void, void>;
|
|
4
5
|
afterDestroy: import("@shuvi/hook").AsyncParallelHook<void, void, void>;
|
|
@@ -9,6 +10,6 @@ declare const _default: import("@shuvi/hook").IPluginInstance<{
|
|
|
9
10
|
addResource: import("@shuvi/hook").AsyncParallelHook<void, void, import("@shuvi/service/lib/core/lifecycleTypes").Resources | import("@shuvi/service/lib/core/lifecycleTypes").Resources[]>;
|
|
10
11
|
addRuntimeFile: import("@shuvi/hook").AsyncParallelHook<void, import("@shuvi/service/lib/core/lifecycleTypes").AddRuntimeFileUtils, import("@shuvi/service/lib/project/index").FileOptions<any, any> | import("@shuvi/service/lib/project/index").FileOptions<any, any>[]>;
|
|
11
12
|
addRuntimeService: import("@shuvi/hook").AsyncParallelHook<void, void, import("@shuvi/service/lib/core/lifecycleTypes").RuntimeService | import("@shuvi/service/lib/core/lifecycleTypes").RuntimeService[]>;
|
|
12
|
-
} & import("@shuvi/
|
|
13
|
+
} & import("@shuvi/service/lib/core/apiTypes").CustomCorePluginHooks, import("@shuvi/service").IPluginContext>;
|
|
13
14
|
export default _default;
|
|
14
15
|
export { default as OnDemandRouteManager } from './onDemandRouteManager';
|
package/lib/node/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { IPlatform } from '@shuvi/service';
|
|
2
|
-
|
|
3
|
-
declare const platform:
|
|
2
|
+
export { PlatformWebCustomConfig } from '../shared/configTypes';
|
|
3
|
+
declare const platform: ({ framework }?: {
|
|
4
|
+
framework?: string | undefined;
|
|
5
|
+
}) => IPlatform;
|
|
4
6
|
export default platform;
|
package/lib/node/index.js
CHANGED
|
@@ -11,9 +11,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
const node_1 = require("@shuvi/platform-shared/node");
|
|
13
13
|
const features_1 = require("./features");
|
|
14
|
-
require("./shuvi-node-extensions");
|
|
15
14
|
const paths_1 = require("./paths");
|
|
16
|
-
const platform = ({ framework = 'react' } = {}
|
|
15
|
+
const platform = ({ framework = 'react' } = {}) => (platformContext) => __awaiter(void 0, void 0, void 0, function* () {
|
|
17
16
|
const mainPlugin = (0, features_1.getMainPlugin)(platformContext);
|
|
18
17
|
const platformFramework = require(`./targets/${framework}`).default;
|
|
19
18
|
const platformFrameworkContent = yield platformFramework();
|
package/lib/node/paths.js
CHANGED
|
@@ -1,16 +1,36 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
4
24
|
};
|
|
5
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
26
|
exports.resolvePkgFile = exports.resolveLib = exports.resolveDep = void 0;
|
|
7
|
-
const
|
|
8
|
-
const PACKAGE_DIR =
|
|
27
|
+
const path = __importStar(require("path"));
|
|
28
|
+
const PACKAGE_DIR = path.resolve(__dirname, '..', '..');
|
|
9
29
|
// export const resolveToModulePath = (...paths: string[]) =>
|
|
10
30
|
// `@shuvi/platform-web/${paths.join('/')}`;
|
|
11
31
|
const resolveDep = (module) => require.resolve(module);
|
|
12
32
|
exports.resolveDep = resolveDep;
|
|
13
|
-
const resolveLib = (module) =>
|
|
33
|
+
const resolveLib = (module) => path.dirname((0, exports.resolveDep)(path.join(module, 'package.json')));
|
|
14
34
|
exports.resolveLib = resolveLib;
|
|
15
|
-
const resolvePkgFile = (...paths) =>
|
|
35
|
+
const resolvePkgFile = (...paths) => path.join(PACKAGE_DIR, ...paths);
|
|
16
36
|
exports.resolvePkgFile = resolvePkgFile;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import '@shuvi/platform-shared/shuvi-type-extensions-node';
|
|
2
|
+
import { IManifest } from '@shuvi/toolpack/lib/webpack/types';
|
|
3
|
+
import { IMiddlewareRoutes, CreateAppServer, IApiRoutes, IServerModule, PlatformWebCustomConfig } from '../shared/index';
|
|
4
|
+
import { IViewServer } from './features/html-render/index';
|
|
5
|
+
import { addRoutes, addMiddlewareRoutes } from './features/filesystem-routes/hooks';
|
|
6
|
+
import { extendedHooks } from './features/html-render/serverHooks';
|
|
7
|
+
export {};
|
|
8
|
+
declare module '@shuvi/service/lib/resources' {
|
|
9
|
+
const server: {
|
|
10
|
+
server: IServerModule;
|
|
11
|
+
apiRoutes: IApiRoutes;
|
|
12
|
+
middlewareRoutes: IMiddlewareRoutes;
|
|
13
|
+
application: {
|
|
14
|
+
createApp: CreateAppServer;
|
|
15
|
+
};
|
|
16
|
+
view: IViewServer;
|
|
17
|
+
};
|
|
18
|
+
const documentPath: string;
|
|
19
|
+
const clientManifest: IManifest;
|
|
20
|
+
const serverManifest: IManifest;
|
|
21
|
+
}
|
|
22
|
+
declare global {
|
|
23
|
+
namespace ShuviService {
|
|
24
|
+
interface CustomConfig {
|
|
25
|
+
ssr: PlatformWebCustomConfig['ssr'];
|
|
26
|
+
router: PlatformWebCustomConfig['router'];
|
|
27
|
+
routes?: PlatformWebCustomConfig['routes'];
|
|
28
|
+
middlewareRoutes?: PlatformWebCustomConfig['middlewareRoutes'];
|
|
29
|
+
apiRoutes?: PlatformWebCustomConfig['apiRoutes'];
|
|
30
|
+
conventionRoutes: PlatformWebCustomConfig['conventionRoutes'];
|
|
31
|
+
}
|
|
32
|
+
interface CustomCorePluginHooks {
|
|
33
|
+
addRoutes: typeof addRoutes;
|
|
34
|
+
addMiddlewareRoutes: typeof addMiddlewareRoutes;
|
|
35
|
+
}
|
|
36
|
+
interface CustomServerPluginHooks {
|
|
37
|
+
getPageData: typeof extendedHooks.getPageData;
|
|
38
|
+
handlePageRequest: typeof extendedHooks.handlePageRequest;
|
|
39
|
+
modifyHtml: typeof extendedHooks.modifyHtml;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
declare const _default: {
|
|
2
2
|
core: import("@shuvi/hook").IPluginInstance<{
|
|
3
|
+
extendConfig: import("@shuvi/hook").SyncWaterfallHook<import("@shuvi/service").Config, void>;
|
|
3
4
|
afterInit: import("@shuvi/hook").AsyncParallelHook<void, void, void>;
|
|
4
5
|
afterBuild: import("@shuvi/hook").AsyncParallelHook<void, void, void>;
|
|
5
6
|
afterDestroy: import("@shuvi/hook").AsyncParallelHook<void, void, void>;
|
|
@@ -10,6 +11,6 @@ declare const _default: {
|
|
|
10
11
|
addResource: import("@shuvi/hook").AsyncParallelHook<void, void, import("@shuvi/service/lib/core/lifecycleTypes").Resources | import("@shuvi/service/lib/core/lifecycleTypes").Resources[]>;
|
|
11
12
|
addRuntimeFile: import("@shuvi/hook").AsyncParallelHook<void, import("@shuvi/service/lib/core/lifecycleTypes").AddRuntimeFileUtils, import("@shuvi/service/lib/project/index").FileOptions<any, any> | import("@shuvi/service/lib/project/index").FileOptions<any, any>[]>;
|
|
12
13
|
addRuntimeService: import("@shuvi/hook").AsyncParallelHook<void, void, import("@shuvi/service/lib/core/lifecycleTypes").RuntimeService | import("@shuvi/service/lib/core/lifecycleTypes").RuntimeService[]>;
|
|
13
|
-
} & import("@shuvi/
|
|
14
|
+
} & import("@shuvi/service/lib/core/apiTypes").CustomCorePluginHooks, import("@shuvi/service").IPluginContext>;
|
|
14
15
|
};
|
|
15
16
|
export default _default;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
declare const platformWebReact: () => {
|
|
2
2
|
plugins: (import("@shuvi/hook").IPluginInstance<{
|
|
3
|
+
extendConfig: import("@shuvi/hook").SyncWaterfallHook<import("@shuvi/service").Config, void>;
|
|
3
4
|
afterInit: import("@shuvi/hook").AsyncParallelHook<void, void, void>;
|
|
4
5
|
afterBuild: import("@shuvi/hook").AsyncParallelHook<void, void, void>;
|
|
5
6
|
afterDestroy: import("@shuvi/hook").AsyncParallelHook<void, void, void>;
|
|
@@ -10,8 +11,9 @@ declare const platformWebReact: () => {
|
|
|
10
11
|
addResource: import("@shuvi/hook").AsyncParallelHook<void, void, import("@shuvi/service/lib/core/lifecycleTypes").Resources | import("@shuvi/service/lib/core/lifecycleTypes").Resources[]>;
|
|
11
12
|
addRuntimeFile: import("@shuvi/hook").AsyncParallelHook<void, import("@shuvi/service/lib/core/lifecycleTypes").AddRuntimeFileUtils, import("@shuvi/service/lib/project/index").FileOptions<any, any> | import("@shuvi/service/lib/project/index").FileOptions<any, any>[]>;
|
|
12
13
|
addRuntimeService: import("@shuvi/hook").AsyncParallelHook<void, void, import("@shuvi/service/lib/core/lifecycleTypes").RuntimeService | import("@shuvi/service/lib/core/lifecycleTypes").RuntimeService[]>;
|
|
13
|
-
} & import("@shuvi/
|
|
14
|
+
} & import("@shuvi/service/lib/core/apiTypes").CustomCorePluginHooks, import("@shuvi/service").IPluginContext> | {
|
|
14
15
|
core: import("@shuvi/hook").IPluginInstance<{
|
|
16
|
+
extendConfig: import("@shuvi/hook").SyncWaterfallHook<import("@shuvi/service").Config, void>;
|
|
15
17
|
afterInit: import("@shuvi/hook").AsyncParallelHook<void, void, void>;
|
|
16
18
|
afterBuild: import("@shuvi/hook").AsyncParallelHook<void, void, void>;
|
|
17
19
|
afterDestroy: import("@shuvi/hook").AsyncParallelHook<void, void, void>;
|
|
@@ -22,7 +24,7 @@ declare const platformWebReact: () => {
|
|
|
22
24
|
addResource: import("@shuvi/hook").AsyncParallelHook<void, void, import("@shuvi/service/lib/core/lifecycleTypes").Resources | import("@shuvi/service/lib/core/lifecycleTypes").Resources[]>;
|
|
23
25
|
addRuntimeFile: import("@shuvi/hook").AsyncParallelHook<void, import("@shuvi/service/lib/core/lifecycleTypes").AddRuntimeFileUtils, import("@shuvi/service/lib/project/index").FileOptions<any, any> | import("@shuvi/service/lib/project/index").FileOptions<any, any>[]>;
|
|
24
26
|
addRuntimeService: import("@shuvi/hook").AsyncParallelHook<void, void, import("@shuvi/service/lib/core/lifecycleTypes").RuntimeService | import("@shuvi/service/lib/core/lifecycleTypes").RuntimeService[]>;
|
|
25
|
-
} & import("@shuvi/
|
|
27
|
+
} & import("@shuvi/service/lib/core/apiTypes").CustomCorePluginHooks, import("@shuvi/service").IPluginContext>;
|
|
26
28
|
})[];
|
|
27
29
|
platformModule: string;
|
|
28
30
|
polyfills: string[];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export declare const RedoxReactPlugin: {
|
|
2
2
|
core: import("@shuvi/hook").IPluginInstance<{
|
|
3
|
+
extendConfig: import("@shuvi/hook").SyncWaterfallHook<import("@shuvi/service").Config, void>;
|
|
3
4
|
afterInit: import("@shuvi/hook").AsyncParallelHook<void, void, void>;
|
|
4
5
|
afterBuild: import("@shuvi/hook").AsyncParallelHook<void, void, void>;
|
|
5
6
|
afterDestroy: import("@shuvi/hook").AsyncParallelHook<void, void, void>;
|
|
@@ -10,7 +11,7 @@ export declare const RedoxReactPlugin: {
|
|
|
10
11
|
addResource: import("@shuvi/hook").AsyncParallelHook<void, void, import("@shuvi/service/lib/core/lifecycleTypes").Resources | import("@shuvi/service/lib/core/lifecycleTypes").Resources[]>;
|
|
11
12
|
addRuntimeFile: import("@shuvi/hook").AsyncParallelHook<void, import("@shuvi/service/lib/core/lifecycleTypes").AddRuntimeFileUtils, import("@shuvi/service/lib/project/index").FileOptions<any, any> | import("@shuvi/service/lib/project/index").FileOptions<any, any>[]>;
|
|
12
13
|
addRuntimeService: import("@shuvi/hook").AsyncParallelHook<void, void, import("@shuvi/service/lib/core/lifecycleTypes").RuntimeService | import("@shuvi/service/lib/core/lifecycleTypes").RuntimeService[]>;
|
|
13
|
-
} & import("@shuvi/
|
|
14
|
+
} & import("@shuvi/service/lib/core/apiTypes").CustomCorePluginHooks, import("@shuvi/service").IPluginContext>;
|
|
14
15
|
runtime: {
|
|
15
16
|
plugin: string;
|
|
16
17
|
};
|
|
@@ -28,7 +28,7 @@ const path = __importStar(require("path"));
|
|
|
28
28
|
const service_1 = require("@shuvi/service");
|
|
29
29
|
const paths_1 = require("../../../paths");
|
|
30
30
|
// todo: optimize this
|
|
31
|
-
const runtimePath = require.resolve(path.join(__dirname, '../../../../../
|
|
31
|
+
const runtimePath = require.resolve(path.join(__dirname, '../../../../../esm/shuvi-app/react/redox-react/runtime'));
|
|
32
32
|
const core = (0, service_1.createPlugin)({
|
|
33
33
|
addRuntimeService: () => [
|
|
34
34
|
{
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { IRouterHistoryMode, IPageRouteConfig, IMiddlewareRouteConfig, IApiRouteConfig } from '@shuvi/platform-shared/shared';
|
|
2
|
+
export interface IRouterConfig {
|
|
3
|
+
history: IRouterHistoryMode | 'auto';
|
|
4
|
+
}
|
|
5
|
+
export interface PlatformWebCustomConfig {
|
|
6
|
+
ssr: boolean;
|
|
7
|
+
router: IRouterConfig;
|
|
8
|
+
routes?: IPageRouteConfig[];
|
|
9
|
+
middlewareRoutes?: IMiddlewareRouteConfig[];
|
|
10
|
+
apiRoutes?: IApiRouteConfig[];
|
|
11
|
+
conventionRoutes: {
|
|
12
|
+
exclude?: string[];
|
|
13
|
+
};
|
|
14
|
+
}
|
|
File without changes
|
package/lib/shared/index.d.ts
CHANGED
package/lib/shared/index.js
CHANGED
|
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./appTypes"), exports);
|
|
18
|
+
__exportStar(require("./configTypes"), exports);
|
|
18
19
|
__exportStar(require("./renderTypes"), exports);
|
|
19
20
|
__exportStar(require("./routeTypes"), exports);
|
|
20
21
|
__exportStar(require("./serverTypes"), exports);
|
|
@@ -24,7 +24,7 @@ export declare type IApiRes<T = any> = {
|
|
|
24
24
|
export declare type IApiResponse<T = any> = IResponse & IApiRes<T>;
|
|
25
25
|
export declare type IApiRequestHandler<T = any> = (req: IApiRequest, res: IApiResponse<T>) => void | Promise<void>;
|
|
26
26
|
export interface IApiConfig {
|
|
27
|
-
|
|
27
|
+
api?: {
|
|
28
28
|
bodyParser?: {
|
|
29
29
|
sizeLimit: number | string;
|
|
30
30
|
} | boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shuvi/platform-web",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.2",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/shuvijs/shuvi.git",
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
"files": [
|
|
15
15
|
"lib",
|
|
16
16
|
"esm",
|
|
17
|
-
"
|
|
18
|
-
"shuvi-
|
|
17
|
+
"shuvi-type-extensions-node.d.ts",
|
|
18
|
+
"shuvi-type-extensions-runtime.d.ts"
|
|
19
19
|
],
|
|
20
20
|
"exports": {
|
|
21
21
|
".": {
|
|
@@ -42,24 +42,37 @@
|
|
|
42
42
|
"./esm/shuvi-app/*.jsx"
|
|
43
43
|
]
|
|
44
44
|
},
|
|
45
|
-
"./shuvi-
|
|
45
|
+
"./shuvi-type-extensions-node": {
|
|
46
|
+
"types": "./shuvi-type-extensions-node.d.js",
|
|
47
|
+
"default": "./shuvi-type-extensions-node.js"
|
|
48
|
+
},
|
|
49
|
+
"./shuvi-type-extensions-runtime": "./shuvi-type-extensions-runtime.d.ts"
|
|
50
|
+
},
|
|
51
|
+
"scripts": {
|
|
52
|
+
"dev": "run-p watch:*",
|
|
53
|
+
"watch:esm": "tsc -p tsconfig.build.browser.json -w",
|
|
54
|
+
"watch:cjs": "tsc -p tsconfig.build.node.json -w",
|
|
55
|
+
"prebuild": "rimraf lib esm types",
|
|
56
|
+
"build": "run-p build:*",
|
|
57
|
+
"build:esm": "tsc -p tsconfig.build.browser.json",
|
|
58
|
+
"build:cjs": "tsc -p tsconfig.build.node.json"
|
|
46
59
|
},
|
|
47
60
|
"engines": {
|
|
48
61
|
"node": ">= 12.0.0"
|
|
49
62
|
},
|
|
50
63
|
"dependencies": {
|
|
51
64
|
"@next/react-refresh-utils": "12.1.6",
|
|
52
|
-
"@shuvi/hook": "1.0.0-rc.
|
|
53
|
-
"@shuvi/platform-shared": "1.0.0-rc.
|
|
65
|
+
"@shuvi/hook": "1.0.0-rc.2",
|
|
66
|
+
"@shuvi/platform-shared": "1.0.0-rc.2",
|
|
54
67
|
"@shuvi/redox": "0.0.3",
|
|
55
68
|
"@shuvi/redox-react": "0.0.3",
|
|
56
|
-
"@shuvi/router": "1.0.0-rc.
|
|
57
|
-
"@shuvi/router-react": "1.0.0-rc.
|
|
58
|
-
"@shuvi/runtime": "1.0.0-rc.
|
|
59
|
-
"@shuvi/service": "1.0.0-rc.
|
|
60
|
-
"@shuvi/shared": "1.0.0-rc.
|
|
61
|
-
"@shuvi/toolpack": "1.0.0-rc.
|
|
62
|
-
"@shuvi/utils": "1.0.0-rc.
|
|
69
|
+
"@shuvi/router": "1.0.0-rc.2",
|
|
70
|
+
"@shuvi/router-react": "1.0.0-rc.2",
|
|
71
|
+
"@shuvi/runtime": "1.0.0-rc.2",
|
|
72
|
+
"@shuvi/service": "1.0.0-rc.2",
|
|
73
|
+
"@shuvi/shared": "1.0.0-rc.2",
|
|
74
|
+
"@shuvi/toolpack": "1.0.0-rc.2",
|
|
75
|
+
"@shuvi/utils": "1.0.0-rc.2",
|
|
63
76
|
"content-type": "1.0.4",
|
|
64
77
|
"cookie": "0.4.1",
|
|
65
78
|
"ejs": "3.1.5",
|
|
@@ -72,22 +85,19 @@
|
|
|
72
85
|
"react-refresh": "0.12.0",
|
|
73
86
|
"use-sync-external-store": "1.1.0"
|
|
74
87
|
},
|
|
88
|
+
"peerDependencies": {
|
|
89
|
+
"@shuvi/service": "1.0.0-rc.2"
|
|
90
|
+
},
|
|
75
91
|
"devDependencies": {
|
|
92
|
+
"@types/react": "18.0.9",
|
|
93
|
+
"@types/react-dom": "18.0.6",
|
|
94
|
+
"@types/react-test-renderer": "18.0.0",
|
|
76
95
|
"@shuvi/redox": "0.0.3",
|
|
77
|
-
"@testing-library/react": "^
|
|
96
|
+
"@testing-library/react": "^13.2.0",
|
|
78
97
|
"@types/content-type": "^1.1.5",
|
|
79
98
|
"@types/cookie": "^0.4.1",
|
|
80
99
|
"@types/ejs": "^3.1.0",
|
|
81
100
|
"@types/raw-body": "^2.3.0",
|
|
82
101
|
"webpack": "5.73.0"
|
|
83
|
-
},
|
|
84
|
-
"scripts": {
|
|
85
|
-
"dev": "run-p watch:*",
|
|
86
|
-
"watch:esm": "tsc -p tsconfig.build.browser.json -w",
|
|
87
|
-
"watch:cjs": "tsc -p tsconfig.build.node.json -w",
|
|
88
|
-
"prebuild": "rimraf lib esm types",
|
|
89
|
-
"build": "run-p build:*",
|
|
90
|
-
"build:esm": "tsc -p tsconfig.build.browser.json",
|
|
91
|
-
"build:cjs": "tsc -p tsconfig.build.node.json"
|
|
92
102
|
}
|
|
93
|
-
}
|
|
103
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/// <reference types="@shuvi/platform-shared/shuvi-
|
|
1
|
+
/// <reference types="@shuvi/platform-shared/shuvi-type-extensions-runtime" />
|
|
2
2
|
|
|
3
3
|
declare module '@shuvi/app/files/routes' {
|
|
4
4
|
import { IRawPageRouteRecord } from '@shuvi/platform-shared/shared';
|
|
@@ -7,13 +7,11 @@ declare module '@shuvi/app/files/routes' {
|
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
declare module '@shuvi/app/files/routerConfig' {
|
|
10
|
-
import { ILoaderOptions } from '@shuvi/platform-shared/shared/loader';
|
|
11
10
|
export const historyMode: 'browser' | 'hash';
|
|
12
11
|
}
|
|
13
12
|
|
|
14
13
|
declare module '@shuvi/app/files/page-loaders' {
|
|
15
|
-
import { IRouteLoaderContext } from '@shuvi/platform-shared/shared';
|
|
16
|
-
import { Loader } from '@shuvi/platform-shared/shared';
|
|
14
|
+
import { IRouteLoaderContext, Loader } from '@shuvi/platform-shared/shared';
|
|
17
15
|
|
|
18
16
|
const loaders: Record<string, Loader>;
|
|
19
17
|
export default loaders;
|
|
@@ -21,16 +19,18 @@ declare module '@shuvi/app/files/page-loaders' {
|
|
|
21
19
|
|
|
22
20
|
declare module '@shuvi/app/files/apiRoutes' {
|
|
23
21
|
import { IApiRoutes } from '@shuvi/platform-web/shared';
|
|
22
|
+
|
|
24
23
|
declare const apiRoutes: IApiRoutes[];
|
|
25
24
|
export default apiRoutes;
|
|
26
25
|
}
|
|
27
26
|
|
|
28
27
|
declare module '@shuvi/app/files/middlewareRoutes' {
|
|
29
28
|
import { IMiddlewareRoutes } from '@shuvi/platform-web/shared';
|
|
29
|
+
|
|
30
30
|
declare const middlewareRoutes: IMiddlewareRoutes[];
|
|
31
31
|
export default middlewareRoutes;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
declare module '@shuvi/app/
|
|
34
|
+
declare module '@shuvi/app/user/server' {
|
|
35
35
|
export {};
|
|
36
36
|
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { CreateAppServer, IServerModule, IApiRoutes, IMiddlewareRoutes } from '../shared';
|
|
2
|
-
import { IManifest } from '@shuvi/toolpack/lib/webpack/types';
|
|
3
|
-
import { IViewServer } from './features/html-render';
|
|
4
|
-
declare module '@shuvi/service/lib/resources' {
|
|
5
|
-
const server: {
|
|
6
|
-
server: IServerModule;
|
|
7
|
-
apiRoutes: IApiRoutes;
|
|
8
|
-
middlewareRoutes: IMiddlewareRoutes;
|
|
9
|
-
application: {
|
|
10
|
-
createApp: CreateAppServer;
|
|
11
|
-
};
|
|
12
|
-
view: IViewServer;
|
|
13
|
-
};
|
|
14
|
-
const documentPath: string;
|
|
15
|
-
const clientManifest: IManifest;
|
|
16
|
-
const serverManifest: IManifest;
|
|
17
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.RedoxWrapper = void 0;
|
|
27
|
-
const React = __importStar(require("react"));
|
|
28
|
-
const redox_react_1 = require("@shuvi/redox-react");
|
|
29
|
-
const RedoxWrapper = (App, appContext) => {
|
|
30
|
-
function RedoxAppWrapper(appProps) {
|
|
31
|
-
return (React.createElement(redox_react_1.RedoxRoot, { storeManager: appContext.storeManager },
|
|
32
|
-
React.createElement(App, Object.assign({}, appProps))));
|
|
33
|
-
}
|
|
34
|
-
RedoxAppWrapper.displayName = 'RedoxAppWrapper';
|
|
35
|
-
return RedoxAppWrapper;
|
|
36
|
-
};
|
|
37
|
-
exports.RedoxWrapper = RedoxWrapper;
|