@shuvi/platform-web 1.0.34 → 1.0.35
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/shuvi-app/app/server.js +1 -1
- package/esm/shuvi-app/react/view/ReactView.server.jsx +1 -1
- package/lib/node/features/filesystem-routes/api/middleware.js +3 -1
- package/lib/node/features/filesystem-routes/middleware/middleware.js +3 -1
- package/lib/node/features/html-render/lib/getPageMiddleware.js +6 -4
- package/lib/node/features/html-render/lib/renderToHTML.js +2 -2
- package/package.json +11 -11
|
@@ -30,7 +30,7 @@ export const createApp = options => {
|
|
|
30
30
|
if (ssr) {
|
|
31
31
|
router.beforeResolve((to, from, next) => __awaiter(void 0, void 0, void 0, function* () {
|
|
32
32
|
const { serverCreateAppTrace } = req._traces;
|
|
33
|
-
const runLoadersTrace = serverCreateAppTrace.traceChild(SHUVI_SERVER_RUN_LOADERS.name, { [SHUVI_SERVER_RUN_LOADERS.attrs.requestId]: req._requestId });
|
|
33
|
+
const runLoadersTrace = serverCreateAppTrace.traceChild(SHUVI_SERVER_RUN_LOADERS.name, { [SHUVI_SERVER_RUN_LOADERS.attrs.requestId.name]: req._requestId });
|
|
34
34
|
const pageLoaders = yield app.getLoaders();
|
|
35
35
|
const matches = getRouteMatchesWithInvalidLoader(to, from, pageLoaders);
|
|
36
36
|
try {
|
|
@@ -55,7 +55,7 @@ export class ReactServerView {
|
|
|
55
55
|
</AppContainer>
|
|
56
56
|
</Router>);
|
|
57
57
|
const { serverRequestTrace } = req._traces;
|
|
58
|
-
const renderToStringTrace = serverRequestTrace.traceChild(SHUVI_SERVER_RENDER_TO_STRING.name, { [SHUVI_SERVER_RENDER_TO_STRING.attrs.requestId]: req._requestId });
|
|
58
|
+
const renderToStringTrace = serverRequestTrace.traceChild(SHUVI_SERVER_RENDER_TO_STRING.name, { [SHUVI_SERVER_RENDER_TO_STRING.attrs.requestId.name]: req._requestId });
|
|
59
59
|
try {
|
|
60
60
|
htmlContent = renderToString(RootApp);
|
|
61
61
|
renderToStringTrace.setAttribute(SHUVI_SERVER_RENDER_TO_STRING.attrs.error.name, false);
|
|
@@ -33,7 +33,9 @@ function middleware(_ctx) {
|
|
|
33
33
|
}
|
|
34
34
|
if (tempApiModule) {
|
|
35
35
|
const { serverRequestTrace } = req._traces;
|
|
36
|
-
const runApiMiddlewareTrace = serverRequestTrace.traceChild(SHUVI_SERVER_RUN_API_MIDDLEWARE.name, {
|
|
36
|
+
const runApiMiddlewareTrace = serverRequestTrace.traceChild(SHUVI_SERVER_RUN_API_MIDDLEWARE.name, {
|
|
37
|
+
[SHUVI_SERVER_RUN_API_MIDDLEWARE.attrs.requestId.name]: req._requestId
|
|
38
|
+
});
|
|
37
39
|
try {
|
|
38
40
|
const { config, default: resolver } = tempApiModule;
|
|
39
41
|
yield (0, apiRouteHandler_1.apiRouteHandler)(req, res, resolver, (config === null || config === void 0 ? void 0 : config.api) || { bodyParser: true });
|
|
@@ -21,7 +21,9 @@ function middleware(_api) {
|
|
|
21
21
|
return function (req, res, next) {
|
|
22
22
|
return __awaiter(this, void 0, void 0, function* () {
|
|
23
23
|
const { serverCreateAppTrace } = req._traces;
|
|
24
|
-
const middlewareRoutesTrace = serverCreateAppTrace.traceChild(SHUVI_SERVER_RUN_MIDDLEWARE_ROUTES.name, {
|
|
24
|
+
const middlewareRoutesTrace = serverCreateAppTrace.traceChild(SHUVI_SERVER_RUN_MIDDLEWARE_ROUTES.name, {
|
|
25
|
+
[SHUVI_SERVER_RUN_MIDDLEWARE_ROUTES.attrs.requestId.name]: req._requestId
|
|
26
|
+
});
|
|
25
27
|
try {
|
|
26
28
|
const { middlewareRoutes = [] } = resources_1.default.server;
|
|
27
29
|
// match path for get middlewares
|
|
@@ -18,7 +18,7 @@ const { SHUVI_SERVER_SEND_HTML_ORIGINAL, SHUVI_SERVER_SEND_HTML_HOOK, SHUVI_SERV
|
|
|
18
18
|
function createPageHandler(serverPluginContext) {
|
|
19
19
|
const wrappedSendHtml = (html, { req, res }) => __awaiter(this, void 0, void 0, function* () {
|
|
20
20
|
const { serverRequestTrace } = req._traces;
|
|
21
|
-
const sendHtmlOriginalTrace = serverRequestTrace.traceChild(SHUVI_SERVER_SEND_HTML_ORIGINAL.name, { [SHUVI_SERVER_SEND_HTML_ORIGINAL.attrs.requestId]: req._requestId });
|
|
21
|
+
const sendHtmlOriginalTrace = serverRequestTrace.traceChild(SHUVI_SERVER_SEND_HTML_ORIGINAL.name, { [SHUVI_SERVER_SEND_HTML_ORIGINAL.attrs.requestId.name]: req._requestId });
|
|
22
22
|
(0, utils_1.sendHTML)(req, res, html);
|
|
23
23
|
sendHtmlOriginalTrace.stop();
|
|
24
24
|
});
|
|
@@ -29,7 +29,7 @@ function createPageHandler(serverPluginContext) {
|
|
|
29
29
|
const { serverRequestTrace } = req._traces;
|
|
30
30
|
const result = yield serverRequestTrace
|
|
31
31
|
.traceChild(SHUVI_SERVER_RENDER_TO_HTML.name, {
|
|
32
|
-
[SHUVI_SERVER_RENDER_TO_HTML.attrs.requestId]: req._requestId
|
|
32
|
+
[SHUVI_SERVER_RENDER_TO_HTML.attrs.requestId.name]: req._requestId
|
|
33
33
|
})
|
|
34
34
|
.traceAsyncFn(() => (0, renderToHTML_1.renderToHTML)({
|
|
35
35
|
req: req,
|
|
@@ -52,7 +52,7 @@ function createPageHandler(serverPluginContext) {
|
|
|
52
52
|
}
|
|
53
53
|
sendHtml = yield pendingSendHtml;
|
|
54
54
|
}
|
|
55
|
-
const sendHtmlHookTrace = serverRequestTrace.traceChild(SHUVI_SERVER_SEND_HTML_HOOK.name, { [SHUVI_SERVER_SEND_HTML_HOOK.attrs.requestId]: req._requestId });
|
|
55
|
+
const sendHtmlHookTrace = serverRequestTrace.traceChild(SHUVI_SERVER_SEND_HTML_HOOK.name, { [SHUVI_SERVER_SEND_HTML_HOOK.attrs.requestId.name]: req._requestId });
|
|
56
56
|
yield sendHtml(textResp.data, { req, res });
|
|
57
57
|
sendHtmlHookTrace.stop();
|
|
58
58
|
}
|
|
@@ -71,7 +71,9 @@ function getPageMiddleware(api) {
|
|
|
71
71
|
return function (req, res, next) {
|
|
72
72
|
return __awaiter(this, void 0, void 0, function* () {
|
|
73
73
|
const { serverRequestTrace } = req._traces;
|
|
74
|
-
const runPageMiddlewareTrace = serverRequestTrace.traceChild(SHUVI_SERVER_RUN_PAGE_MIDDLEWARE.name, {
|
|
74
|
+
const runPageMiddlewareTrace = serverRequestTrace.traceChild(SHUVI_SERVER_RUN_PAGE_MIDDLEWARE.name, {
|
|
75
|
+
[SHUVI_SERVER_RUN_PAGE_MIDDLEWARE.attrs.requestId.name]: req._requestId
|
|
76
|
+
});
|
|
75
77
|
if (!pageHandler) {
|
|
76
78
|
if (!pendingPageHandler) {
|
|
77
79
|
pendingPageHandler =
|
|
@@ -24,7 +24,7 @@ function renderToHTML({ req, serverPluginContext }) {
|
|
|
24
24
|
const { application } = resources_1.default.server;
|
|
25
25
|
const app = serverCreateAppTrace
|
|
26
26
|
.traceChild(trace_1.SERVER_CREATE_APP.events.SHUVI_SERVER_CREATE_APP.name, {
|
|
27
|
-
[trace_1.SERVER_CREATE_APP.events.SHUVI_SERVER_CREATE_APP.attrs.requestId]: req._requestId
|
|
27
|
+
[trace_1.SERVER_CREATE_APP.events.SHUVI_SERVER_CREATE_APP.attrs.requestId.name]: req._requestId
|
|
28
28
|
})
|
|
29
29
|
.traceFn(() => application.createApp({
|
|
30
30
|
req,
|
|
@@ -33,7 +33,7 @@ function renderToHTML({ req, serverPluginContext }) {
|
|
|
33
33
|
try {
|
|
34
34
|
yield serverCreateAppTrace
|
|
35
35
|
.traceChild(trace_1.SERVER_CREATE_APP.events.SHUVI_SERVER_APP_INIT.name, {
|
|
36
|
-
[trace_1.SERVER_CREATE_APP.events.SHUVI_SERVER_APP_INIT.attrs.requestId]: req._requestId
|
|
36
|
+
[trace_1.SERVER_CREATE_APP.events.SHUVI_SERVER_APP_INIT.attrs.requestId.name]: req._requestId
|
|
37
37
|
})
|
|
38
38
|
.traceAsyncFn(() => app.init());
|
|
39
39
|
result = yield renderer.renderView({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shuvi/platform-web",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.35",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/shuvijs/shuvi.git",
|
|
@@ -72,15 +72,15 @@
|
|
|
72
72
|
},
|
|
73
73
|
"dependencies": {
|
|
74
74
|
"@next/react-refresh-utils": "12.1.6",
|
|
75
|
-
"@shuvi/error-overlay": "1.0.
|
|
76
|
-
"@shuvi/hook": "1.0.
|
|
77
|
-
"@shuvi/platform-shared": "1.0.
|
|
78
|
-
"@shuvi/router": "1.0.
|
|
79
|
-
"@shuvi/router-react": "1.0.
|
|
80
|
-
"@shuvi/runtime": "1.0.
|
|
81
|
-
"@shuvi/shared": "1.0.
|
|
82
|
-
"@shuvi/toolpack": "1.0.
|
|
83
|
-
"@shuvi/utils": "1.0.
|
|
75
|
+
"@shuvi/error-overlay": "1.0.35",
|
|
76
|
+
"@shuvi/hook": "1.0.35",
|
|
77
|
+
"@shuvi/platform-shared": "1.0.35",
|
|
78
|
+
"@shuvi/router": "1.0.35",
|
|
79
|
+
"@shuvi/router-react": "1.0.35",
|
|
80
|
+
"@shuvi/runtime": "1.0.35",
|
|
81
|
+
"@shuvi/shared": "1.0.35",
|
|
82
|
+
"@shuvi/toolpack": "1.0.35",
|
|
83
|
+
"@shuvi/utils": "1.0.35",
|
|
84
84
|
"content-type": "1.0.4",
|
|
85
85
|
"core-js": "3.6.5",
|
|
86
86
|
"doura": "0.0.11",
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
"whatwg-fetch": "3.0.0"
|
|
99
99
|
},
|
|
100
100
|
"peerDependencies": {
|
|
101
|
-
"@shuvi/service": "1.0.
|
|
101
|
+
"@shuvi/service": "1.0.35"
|
|
102
102
|
},
|
|
103
103
|
"devDependencies": {
|
|
104
104
|
"@shuvi/service": "workspace:*",
|