@shuvi/platform-web 1.0.0-rc.3 → 1.0.0-rc.6
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 +5 -3
- package/esm/shared/renderTypes.d.ts +6 -5
- package/esm/shared/routeTypes.d.ts +4 -9
- package/esm/shuvi-app/app/client.d.ts +2 -0
- package/esm/shuvi-app/app/client.js +13 -17
- package/esm/shuvi-app/app/server.js +10 -9
- 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 +32 -0
- package/esm/shuvi-app/dev/hotDevClient.js +327 -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 +16 -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/helper/serializeServerError.d.ts +2 -0
- package/esm/shuvi-app/helper/serializeServerError.js +21 -0
- package/esm/shuvi-app/react/AppContainer.d.ts +2 -3
- package/esm/shuvi-app/react/AppContainer.jsx +3 -4
- package/esm/shuvi-app/react/getRoutes.d.ts +2 -2
- package/esm/shuvi-app/react/getRoutes.js +9 -8
- package/esm/shuvi-app/react/{redox-react → model}/RedoxWrapper.d.ts +3 -3
- package/esm/shuvi-app/react/{redox-react → model}/RedoxWrapper.jsx +3 -3
- package/esm/shuvi-app/react/model/runtime.d.ts +8 -0
- package/esm/shuvi-app/react/{redox-react → model}/runtime.js +8 -3
- package/esm/shuvi-app/react/store.d.ts +5 -0
- package/esm/shuvi-app/react/store.js +3 -0
- package/esm/shuvi-app/react/types.d.ts +0 -7
- package/esm/shuvi-app/react/useLoaderData.js +9 -20
- package/esm/shuvi-app/react/view/ReactView.client.jsx +25 -4
- package/esm/shuvi-app/react/view/ReactView.server.jsx +17 -14
- package/esm/shuvi-app/shuvi-runtime-index.d.ts +3 -3
- package/esm/shuvi-app/shuvi-runtime-index.js +1 -1
- package/lib/node/features/custom-server/index.d.ts +1 -1
- package/lib/node/features/custom-server/server.d.ts +1 -1
- package/lib/node/features/filesystem-routes/api/apiRouteHandler.d.ts +7 -7
- package/lib/node/features/filesystem-routes/api/apiRouteHandler.js +0 -4
- package/lib/node/features/filesystem-routes/api/middleware.d.ts +2 -2
- package/lib/node/features/filesystem-routes/index.d.ts +1 -13
- package/lib/node/features/filesystem-routes/index.js +20 -48
- package/lib/node/features/filesystem-routes/middleware/middleware.d.ts +2 -2
- package/lib/node/features/filesystem-routes/page/routes.d.ts +2 -2
- package/lib/node/features/filesystem-routes/page/routes.js +29 -11
- package/lib/node/features/html-render/index.d.ts +3 -18
- 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 +0 -0
- package/lib/node/features/html-render/lib/getPageMiddleware.d.ts +2 -2
- package/lib/node/features/html-render/lib/index.d.ts +0 -1
- package/lib/node/features/html-render/lib/index.js +1 -3
- package/lib/node/features/html-render/lib/renderToHTML.d.ts +2 -2
- package/lib/node/features/html-render/lib/renderToHTML.js +7 -48
- package/lib/node/features/html-render/lib/renderer/base.d.ts +6 -6
- package/lib/node/features/html-render/lib/renderer/base.js +5 -5
- package/lib/node/features/html-render/lib/renderer/index.d.ts +5 -4
- package/lib/node/features/html-render/lib/renderer/index.js +69 -6
- package/lib/node/features/html-render/lib/renderer/spa.d.ts +2 -2
- package/lib/node/features/html-render/lib/renderer/spa.js +4 -6
- package/lib/node/features/html-render/lib/renderer/ssr.d.ts +2 -2
- package/lib/node/features/html-render/lib/renderer/ssr.js +5 -6
- package/lib/node/features/html-render/lib/renderer/types.d.ts +8 -5
- package/lib/node/features/html-render/server.d.ts +1 -1
- package/lib/node/features/index.d.ts +3 -31
- package/lib/node/features/index.js +6 -7
- package/lib/node/features/model/index.d.ts +1 -13
- package/lib/node/features/model/runtime.d.ts +3 -8
- package/lib/node/features/model/runtime.js +13 -17
- package/lib/node/features/model/server.js +2 -3
- package/lib/node/features/model/shuvi-app.d.ts +2 -2
- package/lib/node/features/on-demand-compile-page/index.d.ts +3 -13
- package/lib/node/features/on-demand-compile-page/index.js +4 -1
- package/lib/node/features/on-demand-compile-page/onDemandRouteManager.d.ts +3 -3
- package/lib/node/features/on-demand-compile-page/onDemandRouteManager.js +2 -4
- package/lib/node/index.js +1 -3
- package/lib/node/paths.js +0 -2
- package/lib/node/shuvi-runtime-server.d.ts +18 -0
- package/lib/node/shuvi-runtime-server.js +2 -0
- package/lib/node/shuvi-type-extensions-node.d.ts +2 -6
- package/lib/node/targets/react/bundler/index.d.ts +1 -13
- package/lib/node/targets/react/bundler/index.js +5 -0
- package/lib/node/targets/react/index.d.ts +2 -26
- package/lib/node/targets/react/index.js +2 -2
- package/lib/node/targets/react/model/index.d.ts +6 -0
- package/lib/node/targets/react/{redox-react → model}/index.js +7 -6
- package/lib/shared/appTypes.d.ts +5 -3
- package/lib/shared/renderTypes.d.ts +6 -5
- package/lib/shared/routeTypes.d.ts +4 -9
- package/package.json +20 -15
- package/shuvi-env.d.ts +10 -0
- package/shuvi-image.d.ts +54 -0
- package/shuvi-type-extensions-node.js +1 -0
- package/shuvi-type-extensions-runtime.d.ts +2 -2
- package/esm/shuvi-app/dev/webpackHotDevClient.d.ts +0 -5
- package/esm/shuvi-app/dev/webpackHotDevClient.js +0 -34
- package/esm/shuvi-app/react/redox-react/runtime.d.ts +0 -2
- package/esm/shuvi-app/shuvi-runtime-server.d.ts +0 -6
- package/esm/shuvi-app/shuvi-runtime-server.js +0 -1
- package/lib/node/features/main/index.d.ts +0 -3
- package/lib/node/features/main/index.js +0 -82
- package/lib/node/targets/react/redox-react/index.d.ts +0 -18
|
@@ -13,14 +13,54 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
13
13
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
17
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
18
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
19
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
20
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
21
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
22
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
23
|
+
});
|
|
24
|
+
};
|
|
16
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
26
|
exports.Renderer = void 0;
|
|
18
27
|
const resources_1 = require("@shuvi/service/lib/resources");
|
|
28
|
+
const shared_1 = require("@shuvi/platform-shared/shared");
|
|
19
29
|
const htmlTag_1 = require("./htmlTag");
|
|
20
30
|
const viewTemplate_1 = require("../viewTemplate");
|
|
21
31
|
const spa_1 = require("./spa");
|
|
22
32
|
const ssr_1 = require("./ssr");
|
|
33
|
+
const htmlTag_2 = require("./htmlTag");
|
|
23
34
|
__exportStar(require("./types"), exports);
|
|
35
|
+
function addEssentialTagsIfMissing(document) {
|
|
36
|
+
let hasMetaCharset = false;
|
|
37
|
+
let hasMetaViewport = false;
|
|
38
|
+
for (const { tagName, attrs } of document.headTags) {
|
|
39
|
+
if (hasMetaCharset && hasMetaViewport) {
|
|
40
|
+
break;
|
|
41
|
+
}
|
|
42
|
+
if (tagName === 'meta') {
|
|
43
|
+
if (attrs.charset) {
|
|
44
|
+
hasMetaCharset = true;
|
|
45
|
+
}
|
|
46
|
+
else if (attrs.name === 'viewport') {
|
|
47
|
+
hasMetaViewport = true;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
if (!hasMetaCharset) {
|
|
52
|
+
document.headTags.unshift((0, htmlTag_2.tag)('meta', {
|
|
53
|
+
charset: 'utf-8'
|
|
54
|
+
}));
|
|
55
|
+
}
|
|
56
|
+
if (!hasMetaViewport) {
|
|
57
|
+
document.headTags.unshift((0, htmlTag_2.tag)('meta', {
|
|
58
|
+
name: 'viewport',
|
|
59
|
+
content: 'width=device-width,minimum-scale=1,initial-scale=1'
|
|
60
|
+
}));
|
|
61
|
+
}
|
|
62
|
+
return document;
|
|
63
|
+
}
|
|
24
64
|
class Renderer {
|
|
25
65
|
constructor(options) {
|
|
26
66
|
this._serverPluginContext = options.serverPluginContext;
|
|
@@ -28,13 +68,36 @@ class Renderer {
|
|
|
28
68
|
this._ssrRenderer = new ssr_1.SsrRenderer(options);
|
|
29
69
|
this._spaRenderer = new spa_1.SpaRenderer(options);
|
|
30
70
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
71
|
+
renderView(options) {
|
|
72
|
+
var _a, _b;
|
|
73
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
74
|
+
let result;
|
|
75
|
+
const { app } = options;
|
|
76
|
+
const doc = yield this._renderDocument(options);
|
|
77
|
+
if ((0, shared_1.isResponse)(doc)) {
|
|
78
|
+
result = doc;
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
addEssentialTagsIfMissing(doc);
|
|
82
|
+
yield this._serverPluginContext.serverPluginRunner.modifyHtml(doc, app.context);
|
|
83
|
+
const htmlStr = this._renderDocumentToString(doc);
|
|
84
|
+
result = (0, shared_1.text)(htmlStr, {
|
|
85
|
+
status: (_b = (_a = app.error) === null || _a === void 0 ? void 0 : _a.code) !== null && _b !== void 0 ? _b : 200
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
return result;
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
_renderDocument(options) {
|
|
92
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
93
|
+
// todo: fallback to spa
|
|
94
|
+
if (options.ssr) {
|
|
95
|
+
return yield this._ssrRenderer.renderDocument(options);
|
|
96
|
+
}
|
|
97
|
+
return yield this._spaRenderer.renderDocument(options);
|
|
98
|
+
});
|
|
36
99
|
}
|
|
37
|
-
|
|
100
|
+
_renderDocumentToString(document, templateData = {}) {
|
|
38
101
|
const htmlAttrs = (0, htmlTag_1.stringifyAttrs)(document.htmlAttrs);
|
|
39
102
|
const head = document.headTags.map(tag => (0, htmlTag_1.stringifyTag)(tag)).join('');
|
|
40
103
|
const main = document.mainTags.map(tag => (0, htmlTag_1.stringifyTag)(tag)).join('');
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseRenderer } from './base';
|
|
2
|
-
import {
|
|
2
|
+
import { IRenderViewOptions, IHtmlDocument } from './types';
|
|
3
3
|
export declare class SpaRenderer extends BaseRenderer {
|
|
4
|
-
renderDocument({ app }:
|
|
4
|
+
renderDocument({ req, app }: IRenderViewOptions): IHtmlDocument;
|
|
5
5
|
}
|
|
@@ -3,13 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.SpaRenderer = void 0;
|
|
4
4
|
const base_1 = require("./base");
|
|
5
5
|
class SpaRenderer extends base_1.BaseRenderer {
|
|
6
|
-
renderDocument({ app }) {
|
|
7
|
-
const assets = this._getMainAssetTags();
|
|
8
|
-
const serverPluginContext = this._serverPluginContext;
|
|
6
|
+
renderDocument({ req, app }) {
|
|
7
|
+
const assets = this._getMainAssetTags(req);
|
|
9
8
|
const appData = {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
loadersData: {}
|
|
9
|
+
ssr: false,
|
|
10
|
+
pageData: {}
|
|
13
11
|
};
|
|
14
12
|
const document = {
|
|
15
13
|
htmlAttrs: {},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseRenderer } from './base';
|
|
2
|
-
import { IHtmlDocument,
|
|
2
|
+
import { IHtmlDocument, IRenderViewOptions } from './types';
|
|
3
3
|
export declare class SsrRenderer extends BaseRenderer {
|
|
4
|
-
renderDocument({ app, req }:
|
|
4
|
+
renderDocument({ app, req, isDev }: IRenderViewOptions): Promise<import("@shuvi/platform-shared/shared").Response | IHtmlDocument>;
|
|
5
5
|
}
|
|
@@ -17,12 +17,11 @@ const resources_1 = require("@shuvi/service/lib/resources");
|
|
|
17
17
|
const base_1 = require("./base");
|
|
18
18
|
const htmlTag_1 = require("./htmlTag");
|
|
19
19
|
class SsrRenderer extends base_1.BaseRenderer {
|
|
20
|
-
renderDocument({ app, req }) {
|
|
20
|
+
renderDocument({ app, req, isDev }) {
|
|
21
21
|
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
-
const { router, context } = app;
|
|
22
|
+
const { store, router, context } = app;
|
|
23
23
|
const serverPluginContext = this._serverPluginContext;
|
|
24
24
|
const { view } = resources_1.server;
|
|
25
|
-
const { getAssetPublicUrl } = serverPluginContext;
|
|
26
25
|
if (!router) {
|
|
27
26
|
throw new Error('router is null');
|
|
28
27
|
}
|
|
@@ -30,18 +29,18 @@ class SsrRenderer extends base_1.BaseRenderer {
|
|
|
30
29
|
app,
|
|
31
30
|
req,
|
|
32
31
|
manifest: resources_1.clientManifest,
|
|
33
|
-
|
|
32
|
+
isDev
|
|
34
33
|
});
|
|
35
34
|
if ((0, shared_1.isResponse)(result)) {
|
|
36
35
|
return result;
|
|
37
36
|
}
|
|
38
|
-
const mainAssetsTags = this._getMainAssetTags();
|
|
37
|
+
const mainAssetsTags = this._getMainAssetTags(req);
|
|
39
38
|
const pageDataList = yield serverPluginContext.serverPluginRunner.getPageData(context);
|
|
40
39
|
const pageData = pageDataList.reduce((acc, data) => {
|
|
41
40
|
Object.assign(acc, data);
|
|
42
41
|
return acc;
|
|
43
42
|
}, {});
|
|
44
|
-
const appData = Object.assign(Object.assign({}, result.appData), {
|
|
43
|
+
const appData = Object.assign(Object.assign({}, result.appData), { ssr: true, appState: store.getState(), pageData });
|
|
45
44
|
appData.runtimeConfig = (0, shuvi_singleton_runtimeConfig_1.getPublicRuntimeConfig)() || {};
|
|
46
45
|
const document = {
|
|
47
46
|
htmlAttrs: Object.assign({}, result.htmlAttrs),
|
|
@@ -1,20 +1,23 @@
|
|
|
1
|
-
import { IApplication,
|
|
1
|
+
import { IApplication, Response } from '@shuvi/platform-shared/shared';
|
|
2
|
+
import { ShuviRequest, IServerPluginContext } from '@shuvi/service';
|
|
2
3
|
import { IHtmlAttrs, IHtmlTag, IClientRendererOptions, IServerRendererOptions, IViewClient, IViewServer, IRenderAppServerResult } from '../../../../../shared';
|
|
3
|
-
import { IServerPluginContext } from '@shuvi/service';
|
|
4
4
|
export { IHtmlAttrs, IHtmlTag, IApplication };
|
|
5
5
|
export interface IRendererConstructorOptions {
|
|
6
6
|
serverPluginContext: IServerPluginContext;
|
|
7
7
|
}
|
|
8
|
-
export declare type
|
|
8
|
+
export declare type IRenderViewOptions = {
|
|
9
9
|
app: IApplication;
|
|
10
|
-
req:
|
|
10
|
+
req: ShuviRequest;
|
|
11
|
+
ssr: boolean;
|
|
12
|
+
isDev: boolean;
|
|
11
13
|
};
|
|
14
|
+
export declare type IRenderDocumentResult = Promise<IHtmlDocument | Response> | IHtmlDocument | Response;
|
|
12
15
|
export interface IHtmlDocument {
|
|
13
16
|
htmlAttrs: IHtmlAttrs;
|
|
14
17
|
headTags: IHtmlTag<'meta' | 'link' | 'style' | 'script' | 'noscript' | 'title'>[];
|
|
15
18
|
mainTags: IHtmlTag[];
|
|
16
19
|
scriptTags: IHtmlTag<'script'>[];
|
|
17
20
|
}
|
|
18
|
-
export interface IRenderOptions extends
|
|
21
|
+
export interface IRenderOptions extends IRenderViewOptions {
|
|
19
22
|
}
|
|
20
23
|
export { IRenderAppServerResult, IClientRendererOptions, IServerRendererOptions, IViewClient, IViewServer };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: import("@shuvi/hook").IPluginInstance<import("@shuvi/service/lib/server/plugin").
|
|
1
|
+
declare const _default: import("@shuvi/hook").IPluginInstance<import("@shuvi/service/lib/server/plugin").ServerPluginHooks, import("@shuvi/service").IServerPluginContext>;
|
|
2
2
|
export default _default;
|
|
@@ -1,32 +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
|
-
extendConfig: import("@shuvi/hook").SyncWaterfallHook<import("@shuvi/service").Config, void>;
|
|
6
|
-
afterInit: import("@shuvi/hook").AsyncParallelHook<void, void, void>;
|
|
7
|
-
afterBuild: import("@shuvi/hook").AsyncParallelHook<void, void, void>;
|
|
8
|
-
afterDestroy: import("@shuvi/hook").AsyncParallelHook<void, void, void>;
|
|
9
|
-
afterBundlerDone: import("@shuvi/hook").AsyncParallelHook<import("@shuvi/service/lib/core/lifecycleTypes").BundlerDoneExtra, void, void>;
|
|
10
|
-
afterBundlerTargetDone: import("@shuvi/hook").AsyncParallelHook<import("@shuvi/service/lib/core/lifecycleTypes").BundlerTargetDoneExtra, void, void>;
|
|
11
|
-
configWebpack: import("@shuvi/hook").AsyncSeriesWaterfallHook<import("@shuvi/service/lib/core/lifecycleTypes").WebpackChainType, import("@shuvi/service/lib/core/lifecycleTypes").ConfigWebpackAssistant>;
|
|
12
|
-
addExtraTarget: import("@shuvi/hook").AsyncParallelHook<import("@shuvi/service/lib/core/lifecycleTypes").ExtraTargetAssistant, void, import("@shuvi/service/lib/core/lifecycleTypes").TargetChain>;
|
|
13
|
-
addResource: import("@shuvi/hook").AsyncParallelHook<void, void, import("@shuvi/service/lib/core/lifecycleTypes").Resources | import("@shuvi/service/lib/core/lifecycleTypes").Resources[]>;
|
|
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>[]>;
|
|
15
|
-
addRuntimeService: import("@shuvi/hook").AsyncParallelHook<void, void, import("@shuvi/service/lib/core/lifecycleTypes").RuntimeService | import("@shuvi/service/lib/core/lifecycleTypes").RuntimeService[]>;
|
|
16
|
-
} & import("@shuvi/service/lib/core/apiTypes").CustomCorePluginHooks, import("@shuvi/service").IPluginContext> | {
|
|
17
|
-
core: import("@shuvi/hook").IPluginInstance<{
|
|
18
|
-
extendConfig: import("@shuvi/hook").SyncWaterfallHook<import("@shuvi/service").Config, void>;
|
|
19
|
-
afterInit: import("@shuvi/hook").AsyncParallelHook<void, void, void>;
|
|
20
|
-
afterBuild: import("@shuvi/hook").AsyncParallelHook<void, void, void>;
|
|
21
|
-
afterDestroy: import("@shuvi/hook").AsyncParallelHook<void, void, void>;
|
|
22
|
-
afterBundlerDone: import("@shuvi/hook").AsyncParallelHook<import("@shuvi/service/lib/core/lifecycleTypes").BundlerDoneExtra, void, void>;
|
|
23
|
-
afterBundlerTargetDone: import("@shuvi/hook").AsyncParallelHook<import("@shuvi/service/lib/core/lifecycleTypes").BundlerTargetDoneExtra, void, void>;
|
|
24
|
-
configWebpack: import("@shuvi/hook").AsyncSeriesWaterfallHook<import("@shuvi/service/lib/core/lifecycleTypes").WebpackChainType, import("@shuvi/service/lib/core/lifecycleTypes").ConfigWebpackAssistant>;
|
|
25
|
-
addExtraTarget: import("@shuvi/hook").AsyncParallelHook<import("@shuvi/service/lib/core/lifecycleTypes").ExtraTargetAssistant, void, import("@shuvi/service/lib/core/lifecycleTypes").TargetChain>;
|
|
26
|
-
addResource: import("@shuvi/hook").AsyncParallelHook<void, void, import("@shuvi/service/lib/core/lifecycleTypes").Resources | import("@shuvi/service/lib/core/lifecycleTypes").Resources[]>;
|
|
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>[]>;
|
|
28
|
-
addRuntimeService: import("@shuvi/hook").AsyncParallelHook<void, void, import("@shuvi/service/lib/core/lifecycleTypes").RuntimeService | import("@shuvi/service/lib/core/lifecycleTypes").RuntimeService[]>;
|
|
29
|
-
} & import("@shuvi/service/lib/core/apiTypes").CustomCorePluginHooks, import("@shuvi/service").IPluginContext>;
|
|
30
|
-
} | {
|
|
31
|
-
server: import("@shuvi/hook").IPluginInstance<import("@shuvi/service/lib/server/plugin").BuiltInServerPluginHooks & import("@shuvi/service/lib/server/pluginTypes").CustomServerPluginHooks, import("@shuvi/service").IServerPluginContext>;
|
|
32
|
-
})[];
|
|
4
|
+
export declare const getPlugins: (platformContext: IPlatformContext) => ResolvedPlugin[];
|
|
@@ -3,23 +3,22 @@ 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
|
-
var buildHtml_1 = require("./
|
|
12
|
+
var buildHtml_1 = require("./html-render/lib/buildHtml");
|
|
13
13
|
Object.defineProperty(exports, "buildHtml", { enumerable: true, get: function () { return buildHtml_1.buildHtml; } });
|
|
14
14
|
var middlewares_1 = require("./middlewares");
|
|
15
15
|
Object.defineProperty(exports, "getMiddlewares", { enumerable: true, get: function () { return middlewares_1.getMiddlewares; } });
|
|
16
16
|
Object.defineProperty(exports, "getMiddlewaresBeforeDevMiddlewares", { enumerable: true, get: function () { return middlewares_1.getMiddlewaresBeforeDevMiddlewares; } });
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
exports.featurePlugins = [
|
|
17
|
+
const getPlugins = (platformContext) => [
|
|
18
|
+
(0, html_render_1.getPlugin)(platformContext),
|
|
20
19
|
on_demand_compile_page_1.default,
|
|
21
20
|
filesystem_routes_1.default,
|
|
22
|
-
html_render_1.default,
|
|
23
21
|
custom_server_1.default,
|
|
24
22
|
model_1.default
|
|
25
23
|
];
|
|
24
|
+
exports.getPlugins = getPlugins;
|
|
@@ -1,17 +1,5 @@
|
|
|
1
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").FileOptions<any, any> | import("@shuvi/service/lib/project/index").FileOptions<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>;
|
|
2
|
+
core: import("@shuvi/hook").IPluginInstance<import("@shuvi/service/lib/core/plugin").PluginHooks, import("@shuvi/service").IPluginContext>;
|
|
15
3
|
runtime: {
|
|
16
4
|
plugin: string;
|
|
17
5
|
};
|
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RedoxStore } from '@shuvi/redox';
|
|
2
2
|
import { IAppContext } from '@shuvi/platform-shared/shared';
|
|
3
3
|
export declare type InitRedox = (params: {
|
|
4
4
|
initialState: any;
|
|
5
5
|
ctx: IAppContext;
|
|
6
|
-
}) =>
|
|
7
|
-
declare
|
|
8
|
-
interface CustomAppContext {
|
|
9
|
-
storeManager?: IStoreManager;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
declare const _default: import("@shuvi/platform-shared/shared").IPluginInstance<import("@shuvi/platform-shared/shared").BuiltInRuntimePluginHooks & import("@shuvi/runtime").CustomRuntimePluginHooks, void>;
|
|
6
|
+
}) => RedoxStore;
|
|
7
|
+
declare const _default: import("@shuvi/platform-shared/shared").IPluginInstance<import("@shuvi/platform-shared/shared").RuntimePluginHooks, void>;
|
|
13
8
|
export default _default;
|
|
@@ -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,23 @@ 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
|
}
|
|
41
|
+
}, {
|
|
42
|
+
name: 'model'
|
|
47
43
|
});
|
|
@@ -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,15 +1,5 @@
|
|
|
1
|
-
declare const _default:
|
|
2
|
-
|
|
3
|
-
|
|
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/service/lib/core/apiTypes").CustomCorePluginHooks, import("@shuvi/service").IPluginContext>;
|
|
1
|
+
declare const _default: {
|
|
2
|
+
core: import("@shuvi/hook").IPluginInstance<import("@shuvi/service/lib/core/plugin").PluginHooks, import("@shuvi/service").IPluginContext>;
|
|
3
|
+
};
|
|
14
4
|
export default _default;
|
|
15
5
|
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; } });
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ShuviRequestHandler, IServerPluginContext } from '@shuvi/service';
|
|
2
2
|
import { DevMiddleware } from '@shuvi/service/lib/server/middlewares/dev';
|
|
3
3
|
export default class OnDemandRouteManager {
|
|
4
4
|
devMiddleware: DevMiddleware | null;
|
|
5
5
|
_serverPluginContext: IServerPluginContext;
|
|
6
6
|
constructor(serverPluginContext: IServerPluginContext);
|
|
7
|
-
getServerMiddleware():
|
|
8
|
-
ensureRoutesMiddleware():
|
|
7
|
+
getServerMiddleware(): ShuviRequestHandler;
|
|
8
|
+
ensureRoutesMiddleware(): ShuviRequestHandler;
|
|
9
9
|
ensureRoutes(pathname: string): Promise<void>;
|
|
10
10
|
private _activateModules;
|
|
11
11
|
}
|
|
@@ -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
|
});
|
package/lib/node/index.js
CHANGED
|
@@ -13,7 +13,6 @@ const node_1 = require("@shuvi/platform-shared/node");
|
|
|
13
13
|
const features_1 = require("./features");
|
|
14
14
|
const paths_1 = require("./paths");
|
|
15
15
|
const platform = ({ framework = 'react' } = {}) => (platformContext) => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
|
-
const mainPlugin = (0, features_1.getMainPlugin)(platformContext);
|
|
17
16
|
const platformFramework = require(`./targets/${framework}`).default;
|
|
18
17
|
const platformFrameworkContent = yield platformFramework();
|
|
19
18
|
const platformModule = platformFrameworkContent.platformModule;
|
|
@@ -26,8 +25,7 @@ const platform = ({ framework = 'react' } = {}) => (platformContext) => __awaite
|
|
|
26
25
|
],
|
|
27
26
|
plugins: [
|
|
28
27
|
...node_1.SharedPlugins,
|
|
29
|
-
|
|
30
|
-
...features_1.featurePlugins,
|
|
28
|
+
...(0, features_1.getPlugins)(platformContext),
|
|
31
29
|
...platformFrameworkContent.plugins
|
|
32
30
|
],
|
|
33
31
|
getPresetRuntimeFiles,
|
package/lib/node/paths.js
CHANGED
|
@@ -26,8 +26,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
26
26
|
exports.resolvePkgFile = exports.resolveLib = exports.resolveDep = void 0;
|
|
27
27
|
const path = __importStar(require("path"));
|
|
28
28
|
const PACKAGE_DIR = path.resolve(__dirname, '..', '..');
|
|
29
|
-
// export const resolveToModulePath = (...paths: string[]) =>
|
|
30
|
-
// `@shuvi/platform-web/${paths.join('/')}`;
|
|
31
29
|
const resolveDep = (module) => require.resolve(module);
|
|
32
30
|
exports.resolveDep = resolveDep;
|
|
33
31
|
const resolveLib = (module) => path.dirname((0, exports.resolveDep)(path.join(module, 'package.json')));
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { IServerModule as _IServerModule } from '../shared/index';
|
|
2
|
+
import { extendedHooks } from './features/html-render/serverHooks';
|
|
3
|
+
declare type Head<T extends any[]> = T extends [...infer Head, any] ? Head : never;
|
|
4
|
+
declare type RemoveLast<T extends (...args: any) => any> = (...args: Head<Parameters<T>>) => ReturnType<T>;
|
|
5
|
+
declare global {
|
|
6
|
+
namespace ShuviService {
|
|
7
|
+
interface CustomServerPluginHooks {
|
|
8
|
+
getPageData: typeof extendedHooks.getPageData;
|
|
9
|
+
handlePageRequest: typeof extendedHooks.handlePageRequest;
|
|
10
|
+
modifyHtml: typeof extendedHooks.modifyHtml;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
declare type ServerModule = Required<_IServerModule>;
|
|
15
|
+
export declare type GetPageDataFunction = RemoveLast<ServerModule['getPageData']>;
|
|
16
|
+
export declare type HandlePageRequestFunction = RemoveLast<ServerModule['handlePageRequest']>;
|
|
17
|
+
export declare type ModifyHtmlFunction = RemoveLast<ServerModule['modifyHtml']>;
|
|
18
|
+
export {};
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import '@shuvi/platform-shared/shuvi-type-extensions-node';
|
|
2
|
+
import { IPageRouteRecord } from '@shuvi/platform-shared/shared';
|
|
2
3
|
import { IManifest } from '@shuvi/toolpack/lib/webpack/types';
|
|
3
4
|
import { IMiddlewareRoutes, CreateAppServer, IApiRoutes, IServerModule, PlatformWebCustomConfig } from '../shared/index';
|
|
4
5
|
import { IViewServer } from './features/html-render/index';
|
|
5
6
|
import { addRoutes, addMiddlewareRoutes } from './features/filesystem-routes/hooks';
|
|
6
|
-
import { extendedHooks } from './features/html-render/serverHooks';
|
|
7
7
|
export {};
|
|
8
8
|
declare module '@shuvi/service/lib/resources' {
|
|
9
9
|
const server: {
|
|
10
10
|
server: IServerModule;
|
|
11
|
+
pageRoutes: IPageRouteRecord[];
|
|
11
12
|
apiRoutes: IApiRoutes;
|
|
12
13
|
middlewareRoutes: IMiddlewareRoutes;
|
|
13
14
|
application: {
|
|
@@ -33,10 +34,5 @@ declare global {
|
|
|
33
34
|
addRoutes: typeof addRoutes;
|
|
34
35
|
addMiddlewareRoutes: typeof addMiddlewareRoutes;
|
|
35
36
|
}
|
|
36
|
-
interface CustomServerPluginHooks {
|
|
37
|
-
getPageData: typeof extendedHooks.getPageData;
|
|
38
|
-
handlePageRequest: typeof extendedHooks.handlePageRequest;
|
|
39
|
-
modifyHtml: typeof extendedHooks.modifyHtml;
|
|
40
|
-
}
|
|
41
37
|
}
|
|
42
38
|
}
|
|
@@ -1,16 +1,4 @@
|
|
|
1
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").FileOptions<any, any> | import("@shuvi/service/lib/project/index").FileOptions<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>;
|
|
2
|
+
core: import("@shuvi/hook").IPluginInstance<import("@shuvi/service/lib/core/plugin").PluginHooks, import("@shuvi/service").IPluginContext>;
|
|
15
3
|
};
|
|
16
4
|
export default _default;
|
|
@@ -64,6 +64,11 @@ const configWebpack = (config, { name, webpack }, context) => {
|
|
|
64
64
|
resolveLocal('react', 'jsx-runtime')
|
|
65
65
|
]);
|
|
66
66
|
// @ts-ignore
|
|
67
|
+
config.resolve.alias.set('react/jsx-dev-runtime$', [
|
|
68
|
+
resolveUser('react/jsx-dev-runtime'),
|
|
69
|
+
resolveLocal('react', 'jsx-dev-runtime')
|
|
70
|
+
]);
|
|
71
|
+
// @ts-ignore
|
|
67
72
|
config.resolve.alias.set('react-dom$', [
|
|
68
73
|
resolveUser('react-dom'),
|
|
69
74
|
resolveLocal('react-dom')
|