@quilted/quilt 0.5.117 → 0.5.118
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/CHANGELOG.md +6 -0
- package/build/cjs/AppContext.cjs +0 -2
- package/build/cjs/html.cjs +0 -2
- package/build/cjs/http-handlers/index.cjs +0 -2
- package/build/cjs/http-handlers/node.cjs +0 -2
- package/build/cjs/http.cjs +0 -2
- package/build/cjs/index.cjs +0 -2
- package/build/cjs/server/ServerContext.cjs +0 -2
- package/build/cjs/server/http-handler.cjs +5 -9
- package/build/cjs/server/index.cjs +0 -7
- package/build/cjs/server/render.cjs +1 -6
- package/build/cjs/static/StaticContext.cjs +0 -2
- package/build/cjs/static/index.cjs +11 -55
- package/build/cjs/static/render.cjs +2 -7
- package/build/cjs/testing.cjs +0 -2
- package/build/cjs/threads.cjs +0 -2
- package/build/cjs/utilities/react.cjs +0 -2
- package/build/esm/server/http-handler.mjs +5 -7
- package/build/esm/server/index.mjs +0 -1
- package/build/esm/server/render.mjs +1 -4
- package/build/esm/static/index.mjs +10 -34
- package/build/esm/static/render.mjs +2 -5
- package/build/esnext/server/http-handler.esnext +4 -4
- package/build/esnext/server/index.esnext +0 -1
- package/build/esnext/server/render.esnext +0 -1
- package/build/esnext/static/index.esnext +8 -28
- package/build/esnext/static/render.esnext +1 -2
- package/build/tsconfig.tsbuildinfo +1 -1
- package/build/typescript/server/index.d.ts +0 -1
- package/build/typescript/server/index.d.ts.map +1 -1
- package/package.json +1 -12
- package/source/server/index.ts +0 -1
- package/tsconfig.json +0 -1
- package/build/cjs/email.cjs +0 -32
- package/build/esm/email.mjs +0 -1
- package/build/esnext/email.esnext +0 -1
- package/source/email.ts +0 -9
|
@@ -21,7 +21,6 @@ async function renderStatic(App, {
|
|
|
21
21
|
route
|
|
22
22
|
}) => route));
|
|
23
23
|
let renderableRoute;
|
|
24
|
-
|
|
25
24
|
while (renderableRoute = routesToHandle.shift()) {
|
|
26
25
|
const {
|
|
27
26
|
route,
|
|
@@ -35,7 +34,6 @@ async function renderStatic(App, {
|
|
|
35
34
|
} = await renderUrl(url, {
|
|
36
35
|
fallback
|
|
37
36
|
});
|
|
38
|
-
|
|
39
37
|
if (crawl) {
|
|
40
38
|
for (const {
|
|
41
39
|
routes: routeDefinitions,
|
|
@@ -43,11 +41,8 @@ async function renderStatic(App, {
|
|
|
43
41
|
consumedPath,
|
|
44
42
|
prefix
|
|
45
43
|
} of routes) {
|
|
46
|
-
var _routeDefinitions;
|
|
47
|
-
|
|
48
44
|
const basePathname = joinPath(prefix, consumedPath);
|
|
49
45
|
const baseId = basePathname === '/' ? basePathname : `__QUILT_BASE_${basePathname}__`;
|
|
50
|
-
|
|
51
46
|
for (const routeDefinition of routeDefinitions) {
|
|
52
47
|
await recordRouteDefinition(routeDefinition, {
|
|
53
48
|
baseId,
|
|
@@ -55,8 +50,7 @@ async function renderStatic(App, {
|
|
|
55
50
|
addFallbacks: fallback
|
|
56
51
|
});
|
|
57
52
|
}
|
|
58
|
-
|
|
59
|
-
if (fallback && ((_routeDefinitions = routeDefinitions[routeDefinitions.length - 1]) === null || _routeDefinitions === void 0 ? void 0 : _routeDefinitions.match) != null) {
|
|
53
|
+
if (fallback && routeDefinitions[routeDefinitions.length - 1]?.match != null) {
|
|
60
54
|
await recordRouteDefinition({}, {
|
|
61
55
|
baseId,
|
|
62
56
|
basePathname,
|
|
@@ -65,7 +59,6 @@ async function renderStatic(App, {
|
|
|
65
59
|
}
|
|
66
60
|
}
|
|
67
61
|
}
|
|
68
|
-
|
|
69
62
|
await onRender({
|
|
70
63
|
route,
|
|
71
64
|
content: html,
|
|
@@ -74,7 +67,6 @@ async function renderStatic(App, {
|
|
|
74
67
|
hasChildren: !fallback && seenRoutes.some(otherRoute => otherRoute.route.startsWith(`${route}/`))
|
|
75
68
|
});
|
|
76
69
|
}
|
|
77
|
-
|
|
78
70
|
async function recordRouteDefinition({
|
|
79
71
|
match,
|
|
80
72
|
children,
|
|
@@ -89,7 +81,6 @@ async function renderStatic(App, {
|
|
|
89
81
|
const hasChildren = children && children.length > 0;
|
|
90
82
|
const hasManualMatches = typeof renderStatic === 'function' && typeof match !== 'string';
|
|
91
83
|
const matchedRoutes = [];
|
|
92
|
-
|
|
93
84
|
if (typeof match === 'string') {
|
|
94
85
|
routeId = joinPath(baseId, match);
|
|
95
86
|
matchedRoutes.push({
|
|
@@ -103,7 +94,6 @@ async function renderStatic(App, {
|
|
|
103
94
|
routeId = joinPath(`__QUILT_REGEX_ROUTE_${match.source}__`);
|
|
104
95
|
} else {
|
|
105
96
|
routeId = joinPath(baseId, '__QUILT_FALLBACK_ROUTE__');
|
|
106
|
-
|
|
107
97
|
if (!hasManualMatches) {
|
|
108
98
|
matchedRoutes.push({
|
|
109
99
|
id: routeId,
|
|
@@ -112,13 +102,10 @@ async function renderStatic(App, {
|
|
|
112
102
|
});
|
|
113
103
|
}
|
|
114
104
|
}
|
|
115
|
-
|
|
116
105
|
if (seenRouteIds.has(routeId)) return;
|
|
117
106
|
seenRouteIds.add(routeId);
|
|
118
|
-
|
|
119
107
|
if (typeof renderStatic === 'function' && typeof match !== 'string') {
|
|
120
108
|
const matchedRouteParts = await renderStatic();
|
|
121
|
-
|
|
122
109
|
for (const routePart of matchedRouteParts) {
|
|
123
110
|
const id = joinPath(baseId, `__QUILT_MATCH_${routePart}__`);
|
|
124
111
|
seenRouteIds.add(id);
|
|
@@ -129,14 +116,11 @@ async function renderStatic(App, {
|
|
|
129
116
|
});
|
|
130
117
|
}
|
|
131
118
|
}
|
|
132
|
-
|
|
133
119
|
if (hasChildren) {
|
|
134
120
|
for (const {
|
|
135
121
|
id,
|
|
136
122
|
route
|
|
137
123
|
} of matchedRoutes) {
|
|
138
|
-
var _ref;
|
|
139
|
-
|
|
140
124
|
for (const child of children) {
|
|
141
125
|
await recordRouteDefinition(child, {
|
|
142
126
|
addFallbacks,
|
|
@@ -144,8 +128,7 @@ async function renderStatic(App, {
|
|
|
144
128
|
baseId: id
|
|
145
129
|
});
|
|
146
130
|
}
|
|
147
|
-
|
|
148
|
-
if (addFallbacks && ((_ref = children[children.length - 1]) === null || _ref === void 0 ? void 0 : _ref.match) != null) {
|
|
131
|
+
if (addFallbacks && children[children.length - 1]?.match != null) {
|
|
149
132
|
await recordRouteDefinition({}, {
|
|
150
133
|
addFallbacks,
|
|
151
134
|
basePathname: route,
|
|
@@ -153,10 +136,8 @@ async function renderStatic(App, {
|
|
|
153
136
|
});
|
|
154
137
|
}
|
|
155
138
|
}
|
|
156
|
-
|
|
157
139
|
return;
|
|
158
140
|
}
|
|
159
|
-
|
|
160
141
|
for (const {
|
|
161
142
|
route,
|
|
162
143
|
fallback
|
|
@@ -169,10 +150,9 @@ async function renderStatic(App, {
|
|
|
169
150
|
routesToHandle.push(renderableRoute);
|
|
170
151
|
}
|
|
171
152
|
}
|
|
172
|
-
|
|
173
153
|
async function renderUrl(url, {
|
|
174
154
|
fallback = false
|
|
175
|
-
}) {
|
|
155
|
+
} = {}) {
|
|
176
156
|
const routeRecorder = new StaticRenderer({
|
|
177
157
|
forceFallback: fallback ? url.pathname : undefined
|
|
178
158
|
});
|
|
@@ -183,14 +163,12 @@ async function renderStatic(App, {
|
|
|
183
163
|
asyncAssets
|
|
184
164
|
} = await renderApp( /*#__PURE__*/jsx(App, {}), {
|
|
185
165
|
url,
|
|
186
|
-
|
|
187
166
|
decorate(app) {
|
|
188
167
|
return /*#__PURE__*/jsx(StaticRendererContext.Provider, {
|
|
189
168
|
value: routeRecorder,
|
|
190
169
|
children: app
|
|
191
170
|
});
|
|
192
171
|
}
|
|
193
|
-
|
|
194
172
|
});
|
|
195
173
|
const usedAssets = asyncAssets.used({
|
|
196
174
|
timing: 'load'
|
|
@@ -221,16 +199,19 @@ async function renderStatic(App, {
|
|
|
221
199
|
options: {
|
|
222
200
|
modules: false
|
|
223
201
|
}
|
|
224
|
-
})]);
|
|
202
|
+
})]);
|
|
203
|
+
|
|
204
|
+
// We don’t want to load styles from both bundles, so we only use module styles,
|
|
225
205
|
// since modules are intended to be the default and CSS (usually) doesn’t
|
|
226
206
|
// have features that meaningfully break older user agents.
|
|
207
|
+
const styles = moduleStyles.length > 0 ? moduleStyles : nomoduleStyles;
|
|
227
208
|
|
|
228
|
-
|
|
209
|
+
// If there are nomodule scripts, we can’t really do preloading, because we can’t
|
|
229
210
|
// prevent the nomodule scripts from being preloaded in module browsers. If there
|
|
230
211
|
// are only module scripts, we can preload those.
|
|
231
|
-
|
|
232
212
|
const preload = nomoduleScripts.length > 0 ? [] : modulePreload;
|
|
233
|
-
const scripts = [...moduleScripts, ...nomoduleScripts.map(script => ({
|
|
213
|
+
const scripts = [...moduleScripts, ...nomoduleScripts.map(script => ({
|
|
214
|
+
...script,
|
|
234
215
|
nomodule: true
|
|
235
216
|
}))];
|
|
236
217
|
const minifiedHtml = render( /*#__PURE__*/jsx(Html, {
|
|
@@ -249,7 +230,6 @@ async function renderStatic(App, {
|
|
|
249
230
|
};
|
|
250
231
|
}
|
|
251
232
|
}
|
|
252
|
-
|
|
253
233
|
async function prettifyHtml(html) {
|
|
254
234
|
try {
|
|
255
235
|
const {
|
|
@@ -262,10 +242,8 @@ async function prettifyHtml(html) {
|
|
|
262
242
|
return html;
|
|
263
243
|
}
|
|
264
244
|
}
|
|
265
|
-
|
|
266
245
|
function joinPath(...parts) {
|
|
267
246
|
let path = '/';
|
|
268
|
-
|
|
269
247
|
for (const part of parts) {
|
|
270
248
|
if (typeof part !== 'string') continue;
|
|
271
249
|
const normalizedPart = part.startsWith('/') ? part.slice(1) : part;
|
|
@@ -274,10 +252,8 @@ function joinPath(...parts) {
|
|
|
274
252
|
path += normalizedPart;
|
|
275
253
|
path = removePostfixSlash(path);
|
|
276
254
|
}
|
|
277
|
-
|
|
278
255
|
return path;
|
|
279
256
|
}
|
|
280
|
-
|
|
281
257
|
function removePostfixSlash(value) {
|
|
282
258
|
return value.endsWith('/') && value !== '/' ? value.slice(0, value.length - 1) : value;
|
|
283
259
|
}
|
|
@@ -10,7 +10,7 @@ async function renderApp(app, {
|
|
|
10
10
|
url,
|
|
11
11
|
headers,
|
|
12
12
|
...rest
|
|
13
|
-
}) {
|
|
13
|
+
} = {}) {
|
|
14
14
|
const html = new HtmlManager();
|
|
15
15
|
const asyncAssets = new AsyncAssetManager();
|
|
16
16
|
const http = new HttpManager({
|
|
@@ -18,17 +18,14 @@ async function renderApp(app, {
|
|
|
18
18
|
});
|
|
19
19
|
const markup = await extract(app, {
|
|
20
20
|
decorate(app) {
|
|
21
|
-
var _decorate;
|
|
22
|
-
|
|
23
21
|
return /*#__PURE__*/jsx(StaticContext, {
|
|
24
22
|
asyncAssets: asyncAssets,
|
|
25
23
|
html: html,
|
|
26
24
|
http: http,
|
|
27
25
|
url: url,
|
|
28
|
-
children:
|
|
26
|
+
children: decorate?.(app) ?? app
|
|
29
27
|
});
|
|
30
28
|
},
|
|
31
|
-
|
|
32
29
|
...rest
|
|
33
30
|
});
|
|
34
31
|
return {
|
|
@@ -16,7 +16,8 @@ function createServerRenderingRequestHandler(render, {
|
|
|
16
16
|
} = {}) {
|
|
17
17
|
return async (request, requestContext) => {
|
|
18
18
|
const app = await render(request, requestContext);
|
|
19
|
-
return renderToResponse(app, request, {
|
|
19
|
+
return renderToResponse(app, request, {
|
|
20
|
+
...options,
|
|
20
21
|
context: context?.(request, requestContext) ?? requestContext
|
|
21
22
|
});
|
|
22
23
|
};
|
|
@@ -32,7 +33,8 @@ async function renderToResponse(app, request, {
|
|
|
32
33
|
http,
|
|
33
34
|
markup,
|
|
34
35
|
asyncAssets
|
|
35
|
-
} = await renderApp(app, {
|
|
36
|
+
} = await renderApp(app, {
|
|
37
|
+
...options,
|
|
36
38
|
url: request.url,
|
|
37
39
|
headers: request.headers
|
|
38
40
|
});
|
|
@@ -41,14 +43,12 @@ async function renderToResponse(app, request, {
|
|
|
41
43
|
statusCode = 200,
|
|
42
44
|
redirectUrl
|
|
43
45
|
} = http.state;
|
|
44
|
-
|
|
45
46
|
if (redirectUrl) {
|
|
46
47
|
return redirect(redirectUrl, {
|
|
47
48
|
status: statusCode,
|
|
48
49
|
headers
|
|
49
50
|
});
|
|
50
51
|
}
|
|
51
|
-
|
|
52
52
|
const usedAssets = asyncAssets.used({
|
|
53
53
|
timing: 'load'
|
|
54
54
|
});
|
|
@@ -2,7 +2,6 @@ export { SERVER_ACTION_ID as HTML_SERVER_ACTION_ID, Html, HtmlContext, HtmlManag
|
|
|
2
2
|
export { ServerAction, ServerRenderManager, ServerRenderManagerContext, extract, useServerAction } from '@quilted/react-server-render/server';
|
|
3
3
|
export { createAssetManifest } from '@quilted/async/server';
|
|
4
4
|
export { SERVER_ACTION_ID as ASYNC_ASSETS_SERVER_ACTION_ID, AsyncAssetContext, AsyncAssetManager } from '@quilted/react-async/server';
|
|
5
|
-
export { renderEmail } from '@quilted/react-email/server';
|
|
6
5
|
export { createHttpHandlerLocalization } from '@quilted/react-localize/http-handlers';
|
|
7
6
|
export { EnhancedRequest, EnhancedResponse, Request, Response, createHeaders, createHttpHandler } from '@quilted/http-handlers';
|
|
8
7
|
export { parseAcceptLanguageHeader } from '@quilted/react-localize';
|
|
@@ -21,7 +21,6 @@ async function renderStatic(App, {
|
|
|
21
21
|
route
|
|
22
22
|
}) => route));
|
|
23
23
|
let renderableRoute;
|
|
24
|
-
|
|
25
24
|
while (renderableRoute = routesToHandle.shift()) {
|
|
26
25
|
const {
|
|
27
26
|
route,
|
|
@@ -35,7 +34,6 @@ async function renderStatic(App, {
|
|
|
35
34
|
} = await renderUrl(url, {
|
|
36
35
|
fallback
|
|
37
36
|
});
|
|
38
|
-
|
|
39
37
|
if (crawl) {
|
|
40
38
|
for (const {
|
|
41
39
|
routes: routeDefinitions,
|
|
@@ -45,7 +43,6 @@ async function renderStatic(App, {
|
|
|
45
43
|
} of routes) {
|
|
46
44
|
const basePathname = joinPath(prefix, consumedPath);
|
|
47
45
|
const baseId = basePathname === '/' ? basePathname : `__QUILT_BASE_${basePathname}__`;
|
|
48
|
-
|
|
49
46
|
for (const routeDefinition of routeDefinitions) {
|
|
50
47
|
await recordRouteDefinition(routeDefinition, {
|
|
51
48
|
baseId,
|
|
@@ -53,7 +50,6 @@ async function renderStatic(App, {
|
|
|
53
50
|
addFallbacks: fallback
|
|
54
51
|
});
|
|
55
52
|
}
|
|
56
|
-
|
|
57
53
|
if (fallback && routeDefinitions[routeDefinitions.length - 1]?.match != null) {
|
|
58
54
|
await recordRouteDefinition({}, {
|
|
59
55
|
baseId,
|
|
@@ -63,7 +59,6 @@ async function renderStatic(App, {
|
|
|
63
59
|
}
|
|
64
60
|
}
|
|
65
61
|
}
|
|
66
|
-
|
|
67
62
|
await onRender({
|
|
68
63
|
route,
|
|
69
64
|
content: html,
|
|
@@ -72,7 +67,6 @@ async function renderStatic(App, {
|
|
|
72
67
|
hasChildren: !fallback && seenRoutes.some(otherRoute => otherRoute.route.startsWith(`${route}/`))
|
|
73
68
|
});
|
|
74
69
|
}
|
|
75
|
-
|
|
76
70
|
async function recordRouteDefinition({
|
|
77
71
|
match,
|
|
78
72
|
children,
|
|
@@ -87,7 +81,6 @@ async function renderStatic(App, {
|
|
|
87
81
|
const hasChildren = children && children.length > 0;
|
|
88
82
|
const hasManualMatches = typeof renderStatic === 'function' && typeof match !== 'string';
|
|
89
83
|
const matchedRoutes = [];
|
|
90
|
-
|
|
91
84
|
if (typeof match === 'string') {
|
|
92
85
|
routeId = joinPath(baseId, match);
|
|
93
86
|
matchedRoutes.push({
|
|
@@ -101,7 +94,6 @@ async function renderStatic(App, {
|
|
|
101
94
|
routeId = joinPath(`__QUILT_REGEX_ROUTE_${match.source}__`);
|
|
102
95
|
} else {
|
|
103
96
|
routeId = joinPath(baseId, '__QUILT_FALLBACK_ROUTE__');
|
|
104
|
-
|
|
105
97
|
if (!hasManualMatches) {
|
|
106
98
|
matchedRoutes.push({
|
|
107
99
|
id: routeId,
|
|
@@ -110,13 +102,10 @@ async function renderStatic(App, {
|
|
|
110
102
|
});
|
|
111
103
|
}
|
|
112
104
|
}
|
|
113
|
-
|
|
114
105
|
if (seenRouteIds.has(routeId)) return;
|
|
115
106
|
seenRouteIds.add(routeId);
|
|
116
|
-
|
|
117
107
|
if (typeof renderStatic === 'function' && typeof match !== 'string') {
|
|
118
108
|
const matchedRouteParts = await renderStatic();
|
|
119
|
-
|
|
120
109
|
for (const routePart of matchedRouteParts) {
|
|
121
110
|
const id = joinPath(baseId, `__QUILT_MATCH_${routePart}__`);
|
|
122
111
|
seenRouteIds.add(id);
|
|
@@ -127,7 +116,6 @@ async function renderStatic(App, {
|
|
|
127
116
|
});
|
|
128
117
|
}
|
|
129
118
|
}
|
|
130
|
-
|
|
131
119
|
if (hasChildren) {
|
|
132
120
|
for (const {
|
|
133
121
|
id,
|
|
@@ -140,7 +128,6 @@ async function renderStatic(App, {
|
|
|
140
128
|
baseId: id
|
|
141
129
|
});
|
|
142
130
|
}
|
|
143
|
-
|
|
144
131
|
if (addFallbacks && children[children.length - 1]?.match != null) {
|
|
145
132
|
await recordRouteDefinition({}, {
|
|
146
133
|
addFallbacks,
|
|
@@ -149,10 +136,8 @@ async function renderStatic(App, {
|
|
|
149
136
|
});
|
|
150
137
|
}
|
|
151
138
|
}
|
|
152
|
-
|
|
153
139
|
return;
|
|
154
140
|
}
|
|
155
|
-
|
|
156
141
|
for (const {
|
|
157
142
|
route,
|
|
158
143
|
fallback
|
|
@@ -165,10 +150,9 @@ async function renderStatic(App, {
|
|
|
165
150
|
routesToHandle.push(renderableRoute);
|
|
166
151
|
}
|
|
167
152
|
}
|
|
168
|
-
|
|
169
153
|
async function renderUrl(url, {
|
|
170
154
|
fallback = false
|
|
171
|
-
}) {
|
|
155
|
+
} = {}) {
|
|
172
156
|
const routeRecorder = new StaticRenderer({
|
|
173
157
|
forceFallback: fallback ? url.pathname : undefined
|
|
174
158
|
});
|
|
@@ -179,14 +163,12 @@ async function renderStatic(App, {
|
|
|
179
163
|
asyncAssets
|
|
180
164
|
} = await renderApp( /*#__PURE__*/jsx(App, {}), {
|
|
181
165
|
url,
|
|
182
|
-
|
|
183
166
|
decorate(app) {
|
|
184
167
|
return /*#__PURE__*/jsx(StaticRendererContext.Provider, {
|
|
185
168
|
value: routeRecorder,
|
|
186
169
|
children: app
|
|
187
170
|
});
|
|
188
171
|
}
|
|
189
|
-
|
|
190
172
|
});
|
|
191
173
|
const usedAssets = asyncAssets.used({
|
|
192
174
|
timing: 'load'
|
|
@@ -217,16 +199,19 @@ async function renderStatic(App, {
|
|
|
217
199
|
options: {
|
|
218
200
|
modules: false
|
|
219
201
|
}
|
|
220
|
-
})]);
|
|
202
|
+
})]);
|
|
203
|
+
|
|
204
|
+
// We don’t want to load styles from both bundles, so we only use module styles,
|
|
221
205
|
// since modules are intended to be the default and CSS (usually) doesn’t
|
|
222
206
|
// have features that meaningfully break older user agents.
|
|
207
|
+
const styles = moduleStyles.length > 0 ? moduleStyles : nomoduleStyles;
|
|
223
208
|
|
|
224
|
-
|
|
209
|
+
// If there are nomodule scripts, we can’t really do preloading, because we can’t
|
|
225
210
|
// prevent the nomodule scripts from being preloaded in module browsers. If there
|
|
226
211
|
// are only module scripts, we can preload those.
|
|
227
|
-
|
|
228
212
|
const preload = nomoduleScripts.length > 0 ? [] : modulePreload;
|
|
229
|
-
const scripts = [...moduleScripts, ...nomoduleScripts.map(script => ({
|
|
213
|
+
const scripts = [...moduleScripts, ...nomoduleScripts.map(script => ({
|
|
214
|
+
...script,
|
|
230
215
|
nomodule: true
|
|
231
216
|
}))];
|
|
232
217
|
const minifiedHtml = render( /*#__PURE__*/jsx(Html, {
|
|
@@ -245,7 +230,6 @@ async function renderStatic(App, {
|
|
|
245
230
|
};
|
|
246
231
|
}
|
|
247
232
|
}
|
|
248
|
-
|
|
249
233
|
async function prettifyHtml(html) {
|
|
250
234
|
try {
|
|
251
235
|
const {
|
|
@@ -258,10 +242,8 @@ async function prettifyHtml(html) {
|
|
|
258
242
|
return html;
|
|
259
243
|
}
|
|
260
244
|
}
|
|
261
|
-
|
|
262
245
|
function joinPath(...parts) {
|
|
263
246
|
let path = '/';
|
|
264
|
-
|
|
265
247
|
for (const part of parts) {
|
|
266
248
|
if (typeof part !== 'string') continue;
|
|
267
249
|
const normalizedPart = part.startsWith('/') ? part.slice(1) : part;
|
|
@@ -270,10 +252,8 @@ function joinPath(...parts) {
|
|
|
270
252
|
path += normalizedPart;
|
|
271
253
|
path = removePostfixSlash(path);
|
|
272
254
|
}
|
|
273
|
-
|
|
274
255
|
return path;
|
|
275
256
|
}
|
|
276
|
-
|
|
277
257
|
function removePostfixSlash(value) {
|
|
278
258
|
return value.endsWith('/') && value !== '/' ? value.slice(0, value.length - 1) : value;
|
|
279
259
|
}
|
|
@@ -10,7 +10,7 @@ async function renderApp(app, {
|
|
|
10
10
|
url,
|
|
11
11
|
headers,
|
|
12
12
|
...rest
|
|
13
|
-
}) {
|
|
13
|
+
} = {}) {
|
|
14
14
|
const html = new HtmlManager();
|
|
15
15
|
const asyncAssets = new AsyncAssetManager();
|
|
16
16
|
const http = new HttpManager({
|
|
@@ -26,7 +26,6 @@ async function renderApp(app, {
|
|
|
26
26
|
children: decorate?.(app) ?? app
|
|
27
27
|
});
|
|
28
28
|
},
|
|
29
|
-
|
|
30
29
|
...rest
|
|
31
30
|
});
|
|
32
31
|
return {
|