@shuvi/platform-web 1.0.0-rc.1 → 1.0.0-rc.4
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/appTypes.d.ts +2 -2
- 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/app/client.d.ts +2 -0
- package/esm/shuvi-app/app/client.js +2 -1
- package/esm/shuvi-app/dev/eventsource.d.ts +1 -0
- package/esm/shuvi-app/dev/eventsource.js +60 -0
- package/esm/shuvi-app/dev/hotDevClient.d.ts +33 -0
- package/esm/shuvi-app/dev/hotDevClient.js +348 -0
- package/esm/shuvi-app/dev/index.d.ts +3 -0
- package/esm/shuvi-app/dev/index.js +27 -0
- package/esm/shuvi-app/dev/websocket.d.ts +17 -0
- package/esm/shuvi-app/dev/websocket.js +61 -0
- package/esm/shuvi-app/entry/client/app.d.ts +2 -1
- package/esm/shuvi-app/entry/client/app.js +2 -2
- package/esm/shuvi-app/entry/client/run.dev.js +4 -4
- package/esm/shuvi-app/entry/server/index.d.ts +5 -4
- package/esm/shuvi-app/entry/server/index.js +5 -4
- package/esm/shuvi-app/react/getRoutes.d.ts +2 -2
- package/esm/shuvi-app/react/getRoutes.js +6 -7
- 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 +6 -0
- package/{lib/node/targets → esm/shuvi-app}/react/redox-react/runtime.js +6 -6
- package/esm/shuvi-app/shuvi-runtime-index.js +1 -1
- 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 +4 -4
- package/lib/node/features/filesystem-routes/index.js +20 -12
- package/lib/node/features/filesystem-routes/page/index.d.ts +1 -1
- package/lib/node/features/filesystem-routes/page/routes.d.ts +6 -6
- package/lib/node/features/filesystem-routes/page/routes.js +29 -11
- package/lib/node/features/filesystem-routes/page/store.d.ts +3 -3
- package/lib/node/features/html-render/index.d.ts +3 -17
- package/lib/node/features/html-render/index.js +87 -16
- package/lib/node/features/{main → html-render/lib}/buildHtml.d.ts +0 -0
- package/lib/node/features/{main → html-render/lib}/buildHtml.js +0 -0
- package/lib/node/features/html-render/lib/generateFilesByRoutId.d.ts +2 -2
- package/lib/node/features/html-render/lib/generateFilesByRoutId.js +3 -3
- package/lib/node/features/{main → html-render/lib}/generateResource.d.ts +0 -0
- package/lib/node/features/{main → html-render/lib}/generateResource.js +10 -12
- 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 +3 -42
- package/lib/node/features/index.js +9 -8
- 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 +3 -2
- package/lib/node/features/model/runtime.js +11 -17
- package/lib/node/features/model/server.js +2 -3
- package/lib/node/features/model/shuvi-app.d.ts +1 -1
- package/lib/node/features/on-demand-compile-page/index.d.ts +15 -12
- package/lib/node/features/on-demand-compile-page/index.js +4 -1
- package/lib/node/features/on-demand-compile-page/onDemandRouteManager.js +2 -4
- package/lib/node/features/webpack-watch-wait-for-file-builder/index.d.ts +16 -0
- package/lib/node/features/webpack-watch-wait-for-file-builder/index.js +25 -0
- package/lib/node/features/webpack-watch-wait-for-file-builder/webpack-watch-wait-for-file-builder-plugin.d.ts +12 -0
- package/lib/node/features/webpack-watch-wait-for-file-builder/webpack-watch-wait-for-file-builder-plugin.js +32 -0
- package/lib/node/index.d.ts +4 -2
- package/lib/node/index.js +2 -5
- package/lib/node/paths.js +26 -6
- package/lib/node/shuvi-type-extensions-node.d.ts +44 -0
- package/lib/node/{shuvi-node-extensions.js → shuvi-type-extensions-node.js} +1 -0
- package/lib/node/targets/react/bundler/index.d.ts +3 -2
- package/lib/node/targets/react/bundler/index.js +5 -0
- package/lib/node/targets/react/index.d.ts +6 -4
- package/lib/node/targets/react/redox-react/index.d.ts +3 -2
- package/lib/node/targets/react/redox-react/index.js +1 -1
- package/lib/shared/appTypes.d.ts +2 -2
- 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 +40 -25
- package/shuvi-env.d.ts +10 -0
- package/shuvi-image.d.ts +54 -0
- package/shuvi-type-extensions-node.d.ts +2 -0
- package/shuvi-type-extensions-node.js +1 -0
- package/{shuvi-app-extensions.d.ts → shuvi-type-extensions-runtime.d.ts} +7 -7
- package/esm/shuvi-app/dev/webpackHotDevClient.d.ts +0 -5
- package/esm/shuvi-app/dev/webpackHotDevClient.js +0 -33
- package/lib/node/features/filesystem-routes/shuvi-app.d.ts +0 -7
- package/lib/node/features/main/index.d.ts +0 -3
- package/lib/node/features/main/index.js +0 -82
- package/lib/node/shuvi-node-extensions.d.ts +0 -17
- package/lib/node/targets/react/redox-react/RedoxWrapper.js +0 -37
|
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
function generateFilesByRoutId(assetMap, routes) {
|
|
4
4
|
let filesByRoutId = {};
|
|
5
5
|
const loadable = assetMap.loadble;
|
|
6
|
-
routes.forEach(({ id,
|
|
7
|
-
if (
|
|
8
|
-
filesByRoutId[id] = loadable[
|
|
6
|
+
routes.forEach(({ id, __componentRawRequest__ }) => {
|
|
7
|
+
if (__componentRawRequest__) {
|
|
8
|
+
filesByRoutId[id] = loadable[__componentRawRequest__].files;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
11
|
return filesByRoutId;
|
|
File without changes
|
|
@@ -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,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
|
}
|
|
@@ -1,43 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import { IPlatformContext, ResolvedPlugin } from '@shuvi/service/lib/core';
|
|
2
|
+
export { buildHtml } from './html-render/lib/buildHtml';
|
|
2
3
|
export { getMiddlewares, getMiddlewaresBeforeDevMiddlewares } from './middlewares';
|
|
3
|
-
export
|
|
4
|
-
export declare const featurePlugins: (import("@shuvi/hook").IPluginInstance<{
|
|
5
|
-
afterInit: import("@shuvi/hook").AsyncParallelHook<void, void, void>;
|
|
6
|
-
afterBuild: import("@shuvi/hook").AsyncParallelHook<void, void, void>;
|
|
7
|
-
afterDestroy: import("@shuvi/hook").AsyncParallelHook<void, void, void>;
|
|
8
|
-
afterBundlerDone: import("@shuvi/hook").AsyncParallelHook<import("@shuvi/service/lib/core/lifecycleTypes").BundlerDoneExtra, void, void>;
|
|
9
|
-
afterBundlerTargetDone: import("@shuvi/hook").AsyncParallelHook<import("@shuvi/service/lib/core/lifecycleTypes").BundlerTargetDoneExtra, void, void>;
|
|
10
|
-
configWebpack: import("@shuvi/hook").AsyncSeriesWaterfallHook<import("@shuvi/service/lib/core/lifecycleTypes").WebpackChainType, import("@shuvi/service/lib/core/lifecycleTypes").ConfigWebpackAssistant>;
|
|
11
|
-
addExtraTarget: import("@shuvi/hook").AsyncParallelHook<import("@shuvi/service/lib/core/lifecycleTypes").ExtraTargetAssistant, void, import("@shuvi/service/lib/core/lifecycleTypes").TargetChain>;
|
|
12
|
-
addResource: import("@shuvi/hook").AsyncParallelHook<void, void, import("@shuvi/service/lib/core/lifecycleTypes").Resources | import("@shuvi/service/lib/core/lifecycleTypes").Resources[]>;
|
|
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>[]>;
|
|
14
|
-
addRuntimeService: import("@shuvi/hook").AsyncParallelHook<void, void, import("@shuvi/service/lib/core/lifecycleTypes").RuntimeService | import("@shuvi/service/lib/core/lifecycleTypes").RuntimeService[]>;
|
|
15
|
-
} & import("@shuvi/runtime").CustomCorePluginHooks, import("@shuvi/service").IPluginContext> | {
|
|
16
|
-
core: import("@shuvi/hook").IPluginInstance<{
|
|
17
|
-
afterInit: import("@shuvi/hook").AsyncParallelHook<void, void, void>;
|
|
18
|
-
afterBuild: import("@shuvi/hook").AsyncParallelHook<void, void, void>;
|
|
19
|
-
afterDestroy: import("@shuvi/hook").AsyncParallelHook<void, void, void>;
|
|
20
|
-
afterBundlerDone: import("@shuvi/hook").AsyncParallelHook<import("@shuvi/service/lib/core/lifecycleTypes").BundlerDoneExtra, void, void>;
|
|
21
|
-
afterBundlerTargetDone: import("@shuvi/hook").AsyncParallelHook<import("@shuvi/service/lib/core/lifecycleTypes").BundlerTargetDoneExtra, void, void>;
|
|
22
|
-
configWebpack: import("@shuvi/hook").AsyncSeriesWaterfallHook<import("@shuvi/service/lib/core/lifecycleTypes").WebpackChainType, import("@shuvi/service/lib/core/lifecycleTypes").ConfigWebpackAssistant>;
|
|
23
|
-
addExtraTarget: import("@shuvi/hook").AsyncParallelHook<import("@shuvi/service/lib/core/lifecycleTypes").ExtraTargetAssistant, void, import("@shuvi/service/lib/core/lifecycleTypes").TargetChain>;
|
|
24
|
-
addResource: import("@shuvi/hook").AsyncParallelHook<void, void, import("@shuvi/service/lib/core/lifecycleTypes").Resources | import("@shuvi/service/lib/core/lifecycleTypes").Resources[]>;
|
|
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>[]>;
|
|
26
|
-
addRuntimeService: import("@shuvi/hook").AsyncParallelHook<void, void, import("@shuvi/service/lib/core/lifecycleTypes").RuntimeService | import("@shuvi/service/lib/core/lifecycleTypes").RuntimeService[]>;
|
|
27
|
-
} & import("@shuvi/runtime").CustomCorePluginHooks, import("@shuvi/service").IPluginContext>;
|
|
28
|
-
types: string;
|
|
29
|
-
} | {
|
|
30
|
-
core: import("@shuvi/hook").IPluginInstance<{
|
|
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>;
|
|
43
|
-
})[];
|
|
4
|
+
export declare const getPlugins: (platformContext: IPlatformContext) => ResolvedPlugin[];
|
|
@@ -3,23 +3,24 @@ 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
|
-
exports.
|
|
6
|
+
exports.getPlugins = exports.getMiddlewaresBeforeDevMiddlewares = exports.getMiddlewares = exports.buildHtml = void 0;
|
|
7
7
|
const on_demand_compile_page_1 = __importDefault(require("./on-demand-compile-page"));
|
|
8
|
-
const html_render_1 =
|
|
8
|
+
const html_render_1 = require("./html-render");
|
|
9
9
|
const custom_server_1 = __importDefault(require("./custom-server"));
|
|
10
10
|
const model_1 = __importDefault(require("./model"));
|
|
11
11
|
const filesystem_routes_1 = __importDefault(require("./filesystem-routes"));
|
|
12
|
-
|
|
12
|
+
const webpack_watch_wait_for_file_builder_1 = __importDefault(require("./webpack-watch-wait-for-file-builder"));
|
|
13
|
+
var buildHtml_1 = require("./html-render/lib/buildHtml");
|
|
13
14
|
Object.defineProperty(exports, "buildHtml", { enumerable: true, get: function () { return buildHtml_1.buildHtml; } });
|
|
14
15
|
var middlewares_1 = require("./middlewares");
|
|
15
16
|
Object.defineProperty(exports, "getMiddlewares", { enumerable: true, get: function () { return middlewares_1.getMiddlewares; } });
|
|
16
17
|
Object.defineProperty(exports, "getMiddlewaresBeforeDevMiddlewares", { enumerable: true, get: function () { return middlewares_1.getMiddlewaresBeforeDevMiddlewares; } });
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
exports.featurePlugins = [
|
|
18
|
+
const getPlugins = (platformContext) => [
|
|
19
|
+
(0, html_render_1.getPlugin)(platformContext),
|
|
20
20
|
on_demand_compile_page_1.default,
|
|
21
21
|
filesystem_routes_1.default,
|
|
22
|
-
html_render_1.default,
|
|
23
22
|
custom_server_1.default,
|
|
24
|
-
model_1.default
|
|
23
|
+
model_1.default,
|
|
24
|
+
webpack_watch_wait_for_file_builder_1.default
|
|
25
25
|
];
|
|
26
|
+
exports.getPlugins = getPlugins;
|
|
@@ -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>;
|
|
@@ -8,9 +9,9 @@ declare const _default: {
|
|
|
8
9
|
configWebpack: import("@shuvi/hook").AsyncSeriesWaterfallHook<import("@shuvi/service/lib/core/lifecycleTypes").WebpackChainType, import("@shuvi/service/lib/core/lifecycleTypes").ConfigWebpackAssistant>;
|
|
9
10
|
addExtraTarget: import("@shuvi/hook").AsyncParallelHook<import("@shuvi/service/lib/core/lifecycleTypes").ExtraTargetAssistant, void, import("@shuvi/service/lib/core/lifecycleTypes").TargetChain>;
|
|
10
11
|
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").
|
|
12
|
+
addRuntimeFile: import("@shuvi/hook").AsyncParallelHook<void, import("@shuvi/service/lib/core/lifecycleTypes").AddRuntimeFileUtils, import("@shuvi/service/lib/project/index").FileOption<any, any> | import("@shuvi/service/lib/project/index").FileOption<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
|
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const redox_1 = require("@shuvi/redox");
|
|
4
4
|
const shared_1 = require("@shuvi/platform-shared/shared");
|
|
5
|
-
let
|
|
5
|
+
let currentStore;
|
|
6
6
|
const isServer = typeof window === 'undefined';
|
|
7
7
|
// for client, singleton mode
|
|
8
8
|
// for server, return new store
|
|
@@ -21,27 +21,21 @@ const initStore = ({ initialState, ctx }) => {
|
|
|
21
21
|
return createStoreInstance();
|
|
22
22
|
}
|
|
23
23
|
// for client is singleton, just init once
|
|
24
|
-
if (
|
|
25
|
-
|
|
24
|
+
if (!currentStore) {
|
|
25
|
+
currentStore = createStoreInstance();
|
|
26
26
|
}
|
|
27
|
-
|
|
28
|
-
return currentStoreManager;
|
|
27
|
+
return currentStore;
|
|
29
28
|
};
|
|
30
29
|
exports.default = (0, shared_1.createRuntimePlugin)({
|
|
31
30
|
appContext: ctx => {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
initialState = (0, shared_1.getPageData)('redox');
|
|
36
|
-
}
|
|
37
|
-
if (ctx.pageData && ctx.pageData.redox) {
|
|
38
|
-
initialState = ctx.pageData.redox;
|
|
39
|
-
}
|
|
40
|
-
ctx.storeManager = initStore({
|
|
41
|
-
ctx,
|
|
42
|
-
initialState
|
|
43
|
-
});
|
|
31
|
+
let initialState = {};
|
|
32
|
+
if (!isServer) {
|
|
33
|
+
initialState = (0, shared_1.getPageData)('shuviInitialState', {});
|
|
44
34
|
}
|
|
35
|
+
ctx.store = initStore({
|
|
36
|
+
ctx,
|
|
37
|
+
initialState
|
|
38
|
+
});
|
|
45
39
|
return ctx;
|
|
46
40
|
}
|
|
47
41
|
});
|
|
@@ -3,10 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const service_1 = require("@shuvi/service");
|
|
4
4
|
exports.default = (0, service_1.createServerPlugin)({
|
|
5
5
|
getPageData: appContext => {
|
|
6
|
-
const {
|
|
7
|
-
delete appContext.storeManager;
|
|
6
|
+
const { store } = appContext;
|
|
8
7
|
return {
|
|
9
|
-
|
|
8
|
+
shuviInitialState: store.getState()
|
|
10
9
|
};
|
|
11
10
|
}
|
|
12
11
|
});
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
declare const _default:
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
declare const _default: {
|
|
2
|
+
core: import("@shuvi/hook").IPluginInstance<{
|
|
3
|
+
extendConfig: import("@shuvi/hook").SyncWaterfallHook<import("@shuvi/service").Config, void>;
|
|
4
|
+
afterInit: import("@shuvi/hook").AsyncParallelHook<void, void, void>;
|
|
5
|
+
afterBuild: import("@shuvi/hook").AsyncParallelHook<void, void, void>;
|
|
6
|
+
afterDestroy: import("@shuvi/hook").AsyncParallelHook<void, void, void>;
|
|
7
|
+
afterBundlerDone: import("@shuvi/hook").AsyncParallelHook<import("@shuvi/service/lib/core/lifecycleTypes").BundlerDoneExtra, void, void>;
|
|
8
|
+
afterBundlerTargetDone: import("@shuvi/hook").AsyncParallelHook<import("@shuvi/service/lib/core/lifecycleTypes").BundlerTargetDoneExtra, void, void>;
|
|
9
|
+
configWebpack: import("@shuvi/hook").AsyncSeriesWaterfallHook<import("@shuvi/service/lib/core/lifecycleTypes").WebpackChainType, import("@shuvi/service/lib/core/lifecycleTypes").ConfigWebpackAssistant>;
|
|
10
|
+
addExtraTarget: import("@shuvi/hook").AsyncParallelHook<import("@shuvi/service/lib/core/lifecycleTypes").ExtraTargetAssistant, void, import("@shuvi/service/lib/core/lifecycleTypes").TargetChain>;
|
|
11
|
+
addResource: import("@shuvi/hook").AsyncParallelHook<void, void, import("@shuvi/service/lib/core/lifecycleTypes").Resources | import("@shuvi/service/lib/core/lifecycleTypes").Resources[]>;
|
|
12
|
+
addRuntimeFile: import("@shuvi/hook").AsyncParallelHook<void, import("@shuvi/service/lib/core/lifecycleTypes").AddRuntimeFileUtils, import("@shuvi/service/lib/project/index").FileOption<any, any> | import("@shuvi/service/lib/project/index").FileOption<any, any>[]>;
|
|
13
|
+
addRuntimeService: import("@shuvi/hook").AsyncParallelHook<void, void, import("@shuvi/service/lib/core/lifecycleTypes").RuntimeService | import("@shuvi/service/lib/core/lifecycleTypes").RuntimeService[]>;
|
|
14
|
+
} & import("@shuvi/service/lib/core/apiTypes").CustomCorePluginHooks, import("@shuvi/service").IPluginContext>;
|
|
15
|
+
};
|
|
13
16
|
export default _default;
|
|
14
17
|
export { default as OnDemandRouteManager } from './onDemandRouteManager';
|
|
@@ -10,7 +10,7 @@ const module_replace_plugin_1 = __importDefault(require("@shuvi/toolpack/lib/web
|
|
|
10
10
|
const require_cache_hot_reloader_plugin_1 = __importDefault(require("@shuvi/toolpack/lib/webpack/plugins/require-cache-hot-reloader-plugin"));
|
|
11
11
|
const constants_1 = require("@shuvi/shared/lib/constants");
|
|
12
12
|
const dumbRouteComponent = require.resolve('./emptyComponent');
|
|
13
|
-
|
|
13
|
+
const plugin = (0, service_1.createPlugin)({
|
|
14
14
|
configWebpack(config, _, ctx) {
|
|
15
15
|
if (ctx.mode === 'development') {
|
|
16
16
|
config.plugin('private/module-replace-plugin').use(module_replace_plugin_1.default, [
|
|
@@ -32,5 +32,8 @@ exports.default = (0, service_1.createPlugin)({
|
|
|
32
32
|
return config;
|
|
33
33
|
}
|
|
34
34
|
});
|
|
35
|
+
exports.default = {
|
|
36
|
+
core: plugin
|
|
37
|
+
};
|
|
35
38
|
var onDemandRouteManager_1 = require("./onDemandRouteManager");
|
|
36
39
|
Object.defineProperty(exports, "OnDemandRouteManager", { enumerable: true, get: function () { return __importDefault(onDemandRouteManager_1).default; } });
|
|
@@ -13,10 +13,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
const router_1 = require("@shuvi/router");
|
|
16
|
-
const constants_1 = require("@shuvi/shared/lib/constants");
|
|
17
16
|
const resources_1 = require("@shuvi/service/lib/resources");
|
|
18
17
|
const module_replace_plugin_1 = __importDefault(require("@shuvi/toolpack/lib/webpack/plugins/module-replace-plugin"));
|
|
19
|
-
const index_1 = require("../filesystem-routes/index");
|
|
20
18
|
function acceptsHtml(header, { htmlAcceptHeaders = ['text/html', '*/*'] } = {}) {
|
|
21
19
|
for (var i = 0; i < htmlAcceptHeaders.length; i++) {
|
|
22
20
|
if (header.indexOf(htmlAcceptHeaders[i]) !== -1) {
|
|
@@ -79,9 +77,9 @@ class OnDemandRouteManager {
|
|
|
79
77
|
}
|
|
80
78
|
ensureRoutes(pathname) {
|
|
81
79
|
return __awaiter(this, void 0, void 0, function* () {
|
|
82
|
-
const matchedRoutes = (0, router_1.matchRoutes)(
|
|
80
|
+
const matchedRoutes = (0, router_1.matchRoutes)(resources_1.server.pageRoutes, pathname) || [];
|
|
83
81
|
const modulesToActivate = matchedRoutes
|
|
84
|
-
.map(({ route: {
|
|
82
|
+
.map(({ route: { __componentRawRequest__ } }) => __componentRawRequest__)
|
|
85
83
|
.filter(Boolean);
|
|
86
84
|
return this._activateModules(modulesToActivate);
|
|
87
85
|
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
core: import("@shuvi/hook").IPluginInstance<{
|
|
3
|
+
extendConfig: import("@shuvi/hook").SyncWaterfallHook<import("@shuvi/service").Config, void>;
|
|
4
|
+
afterInit: import("@shuvi/hook").AsyncParallelHook<void, void, void>;
|
|
5
|
+
afterBuild: import("@shuvi/hook").AsyncParallelHook<void, void, void>;
|
|
6
|
+
afterDestroy: import("@shuvi/hook").AsyncParallelHook<void, void, void>;
|
|
7
|
+
afterBundlerDone: import("@shuvi/hook").AsyncParallelHook<import("@shuvi/service/lib/core/lifecycleTypes").BundlerDoneExtra, void, void>;
|
|
8
|
+
afterBundlerTargetDone: import("@shuvi/hook").AsyncParallelHook<import("@shuvi/service/lib/core/lifecycleTypes").BundlerTargetDoneExtra, void, void>;
|
|
9
|
+
configWebpack: import("@shuvi/hook").AsyncSeriesWaterfallHook<import("@shuvi/service/lib/core/lifecycleTypes").WebpackChainType, import("@shuvi/service/lib/core/lifecycleTypes").ConfigWebpackAssistant>;
|
|
10
|
+
addExtraTarget: import("@shuvi/hook").AsyncParallelHook<import("@shuvi/service/lib/core/lifecycleTypes").ExtraTargetAssistant, void, import("@shuvi/service/lib/core/lifecycleTypes").TargetChain>;
|
|
11
|
+
addResource: import("@shuvi/hook").AsyncParallelHook<void, void, import("@shuvi/service/lib/core/lifecycleTypes").Resources | import("@shuvi/service/lib/core/lifecycleTypes").Resources[]>;
|
|
12
|
+
addRuntimeFile: import("@shuvi/hook").AsyncParallelHook<void, import("@shuvi/service/lib/core/lifecycleTypes").AddRuntimeFileUtils, import("@shuvi/service/lib/project/index").FileOption<any, any> | import("@shuvi/service/lib/project/index").FileOption<any, any>[]>;
|
|
13
|
+
addRuntimeService: import("@shuvi/hook").AsyncParallelHook<void, void, import("@shuvi/service/lib/core/lifecycleTypes").RuntimeService | import("@shuvi/service/lib/core/lifecycleTypes").RuntimeService[]>;
|
|
14
|
+
} & import("@shuvi/service/lib/core/apiTypes").CustomCorePluginHooks, import("@shuvi/service").IPluginContext>;
|
|
15
|
+
};
|
|
16
|
+
export default _default;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const service_1 = require("@shuvi/service");
|
|
7
|
+
const webpack_watch_wait_for_file_builder_plugin_1 = __importDefault(require("./webpack-watch-wait-for-file-builder-plugin"));
|
|
8
|
+
const plugin = (0, service_1.createPlugin)({
|
|
9
|
+
configWebpack(config, _, ctx) {
|
|
10
|
+
if (ctx.mode === 'development') {
|
|
11
|
+
config
|
|
12
|
+
.plugin('webpack-watch-wait-for-file-builder-plugin')
|
|
13
|
+
.use(webpack_watch_wait_for_file_builder_plugin_1.default, [
|
|
14
|
+
{
|
|
15
|
+
onBuildStart: ctx.onBuildStart,
|
|
16
|
+
onBuildEnd: ctx.onBuildEnd
|
|
17
|
+
}
|
|
18
|
+
]);
|
|
19
|
+
}
|
|
20
|
+
return config;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
exports.default = {
|
|
24
|
+
core: plugin
|
|
25
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IPluginContext } from '@shuvi/service';
|
|
2
|
+
import { Compiler, Plugin } from '@shuvi/toolpack/lib/webpack';
|
|
3
|
+
declare type Options = {
|
|
4
|
+
onBuildStart: IPluginContext['onBuildStart'];
|
|
5
|
+
onBuildEnd: IPluginContext['onBuildEnd'];
|
|
6
|
+
};
|
|
7
|
+
export default class WebpackWatchWaitForFileBuilderPlugin implements Plugin {
|
|
8
|
+
options: Options;
|
|
9
|
+
constructor(options: Options);
|
|
10
|
+
apply(compiler: Compiler): void;
|
|
11
|
+
}
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
class WebpackWatchWaitForFileBuilderPlugin {
|
|
4
|
+
constructor(options) {
|
|
5
|
+
this.options = options;
|
|
6
|
+
}
|
|
7
|
+
apply(compiler) {
|
|
8
|
+
const { onBuildEnd, onBuildStart } = this.options;
|
|
9
|
+
/**
|
|
10
|
+
* watching.suspend will pause the real action in the watcher handler but still collecting changed files.
|
|
11
|
+
* watching.resume will resume its action
|
|
12
|
+
*
|
|
13
|
+
* We make sure onBuildStart is faster than webpack's watcher and make it suspend.
|
|
14
|
+
*
|
|
15
|
+
* And resume when onBuildEnd.
|
|
16
|
+
*
|
|
17
|
+
* In this way, during build of fileBuilder, webpack will not trigger any watchRun event but keep watching changed files.
|
|
18
|
+
*/
|
|
19
|
+
onBuildStart(() => {
|
|
20
|
+
compiler.watching.suspend();
|
|
21
|
+
});
|
|
22
|
+
onBuildEnd(({ buildStatus }) => {
|
|
23
|
+
if (buildStatus === 'fulfilled') {
|
|
24
|
+
setTimeout(() => {
|
|
25
|
+
compiler.watching.resume();
|
|
26
|
+
// FIXME: timeout for resuming need further investigation
|
|
27
|
+
}, 100);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.default = WebpackWatchWaitForFileBuilderPlugin;
|
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,10 +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' } = {}
|
|
17
|
-
const mainPlugin = (0, features_1.getMainPlugin)(platformContext);
|
|
15
|
+
const platform = ({ framework = 'react' } = {}) => (platformContext) => __awaiter(void 0, void 0, void 0, function* () {
|
|
18
16
|
const platformFramework = require(`./targets/${framework}`).default;
|
|
19
17
|
const platformFrameworkContent = yield platformFramework();
|
|
20
18
|
const platformModule = platformFrameworkContent.platformModule;
|
|
@@ -27,8 +25,7 @@ const platform = ({ framework = 'react' } = {}, platformContext) => __awaiter(vo
|
|
|
27
25
|
],
|
|
28
26
|
plugins: [
|
|
29
27
|
...node_1.SharedPlugins,
|
|
30
|
-
|
|
31
|
-
...features_1.featurePlugins,
|
|
28
|
+
...(0, features_1.getPlugins)(platformContext),
|
|
32
29
|
...platformFrameworkContent.plugins
|
|
33
30
|
],
|
|
34
31
|
getPresetRuntimeFiles,
|
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,44 @@
|
|
|
1
|
+
import '@shuvi/platform-shared/shuvi-type-extensions-node';
|
|
2
|
+
import { IPageRouteRecord } from '@shuvi/platform-shared/shared';
|
|
3
|
+
import { IManifest } from '@shuvi/toolpack/lib/webpack/types';
|
|
4
|
+
import { IMiddlewareRoutes, CreateAppServer, IApiRoutes, IServerModule, PlatformWebCustomConfig } from '../shared/index';
|
|
5
|
+
import { IViewServer } from './features/html-render/index';
|
|
6
|
+
import { addRoutes, addMiddlewareRoutes } from './features/filesystem-routes/hooks';
|
|
7
|
+
import { extendedHooks } from './features/html-render/serverHooks';
|
|
8
|
+
export {};
|
|
9
|
+
declare module '@shuvi/service/lib/resources' {
|
|
10
|
+
const server: {
|
|
11
|
+
server: IServerModule;
|
|
12
|
+
pageRoutes: IPageRouteRecord[];
|
|
13
|
+
apiRoutes: IApiRoutes;
|
|
14
|
+
middlewareRoutes: IMiddlewareRoutes;
|
|
15
|
+
application: {
|
|
16
|
+
createApp: CreateAppServer;
|
|
17
|
+
};
|
|
18
|
+
view: IViewServer;
|
|
19
|
+
};
|
|
20
|
+
const documentPath: string;
|
|
21
|
+
const clientManifest: IManifest;
|
|
22
|
+
const serverManifest: IManifest;
|
|
23
|
+
}
|
|
24
|
+
declare global {
|
|
25
|
+
namespace ShuviService {
|
|
26
|
+
interface CustomConfig {
|
|
27
|
+
ssr: PlatformWebCustomConfig['ssr'];
|
|
28
|
+
router: PlatformWebCustomConfig['router'];
|
|
29
|
+
routes?: PlatformWebCustomConfig['routes'];
|
|
30
|
+
middlewareRoutes?: PlatformWebCustomConfig['middlewareRoutes'];
|
|
31
|
+
apiRoutes?: PlatformWebCustomConfig['apiRoutes'];
|
|
32
|
+
conventionRoutes: PlatformWebCustomConfig['conventionRoutes'];
|
|
33
|
+
}
|
|
34
|
+
interface CustomCorePluginHooks {
|
|
35
|
+
addRoutes: typeof addRoutes;
|
|
36
|
+
addMiddlewareRoutes: typeof addMiddlewareRoutes;
|
|
37
|
+
}
|
|
38
|
+
interface CustomServerPluginHooks {
|
|
39
|
+
getPageData: typeof extendedHooks.getPageData;
|
|
40
|
+
handlePageRequest: typeof extendedHooks.handlePageRequest;
|
|
41
|
+
modifyHtml: typeof extendedHooks.modifyHtml;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -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>;
|
|
@@ -8,8 +9,8 @@ declare const _default: {
|
|
|
8
9
|
configWebpack: import("@shuvi/hook").AsyncSeriesWaterfallHook<import("@shuvi/service/lib/core/lifecycleTypes").WebpackChainType, import("@shuvi/service/lib/core/lifecycleTypes").ConfigWebpackAssistant>;
|
|
9
10
|
addExtraTarget: import("@shuvi/hook").AsyncParallelHook<import("@shuvi/service/lib/core/lifecycleTypes").ExtraTargetAssistant, void, import("@shuvi/service/lib/core/lifecycleTypes").TargetChain>;
|
|
10
11
|
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").
|
|
12
|
+
addRuntimeFile: import("@shuvi/hook").AsyncParallelHook<void, import("@shuvi/service/lib/core/lifecycleTypes").AddRuntimeFileUtils, import("@shuvi/service/lib/project/index").FileOption<any, any> | import("@shuvi/service/lib/project/index").FileOption<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;
|