polen 0.10.0-next.13 → 0.10.0-next.14
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/build/api/vite/plugins/build.d.ts.map +1 -1
- package/build/api/vite/plugins/build.js +11 -3
- package/build/api/vite/plugins/build.js.map +1 -1
- package/build/api/vite/plugins/core.d.ts.map +1 -1
- package/build/api/vite/plugins/core.js +12 -10
- package/build/api/vite/plugins/core.js.map +1 -1
- package/build/api/vite/plugins/pages.d.ts.map +1 -1
- package/build/api/vite/plugins/pages.js +6 -7
- package/build/api/vite/plugins/pages.js.map +1 -1
- package/build/api/vite/plugins/serve.d.ts.map +1 -1
- package/build/api/vite/plugins/serve.js +47 -7
- package/build/api/vite/plugins/serve.js.map +1 -1
- package/build/lib/file-router/diagnostic-reporter.js +2 -2
- package/build/lib/file-router/diagnostic-reporter.js.map +1 -1
- package/build/lib/graphql-document/components/GraphQLDocument.d.ts.map +1 -1
- package/build/lib/graphql-document/components/GraphQLDocument.js +23 -11
- package/build/lib/graphql-document/components/GraphQLDocument.js.map +1 -1
- package/build/lib/graphql-document/positioning-simple.d.ts +0 -5
- package/build/lib/graphql-document/positioning-simple.d.ts.map +1 -1
- package/build/lib/graphql-document/positioning-simple.js +78 -90
- package/build/lib/graphql-document/positioning-simple.js.map +1 -1
- package/build/lib/kit-temp.d.ts +103 -0
- package/build/lib/kit-temp.d.ts.map +1 -1
- package/build/lib/kit-temp.js +236 -2
- package/build/lib/kit-temp.js.map +1 -1
- package/build/lib/vite-plugin-reactive-data/vite-plugin-reactive-data.d.ts +1 -8
- package/build/lib/vite-plugin-reactive-data/vite-plugin-reactive-data.d.ts.map +1 -1
- package/build/lib/vite-plugin-reactive-data/vite-plugin-reactive-data.js +48 -53
- package/build/lib/vite-plugin-reactive-data/vite-plugin-reactive-data.js.map +1 -1
- package/build/package-paths.js +3 -3
- package/build/package-paths.js.map +1 -1
- package/build/template/components/Link.d.ts +1 -1
- package/build/template/components/Link.d.ts.map +1 -1
- package/build/template/components/Link.js +14 -5
- package/build/template/components/Link.js.map +1 -1
- package/build/template/components/content/GraphQLDocumentWithSchema.d.ts.map +1 -1
- package/build/template/components/content/GraphQLDocumentWithSchema.js +0 -3
- package/build/template/components/content/GraphQLDocumentWithSchema.js.map +1 -1
- package/build/template/components/content/GraphQLDocumentWrapper.d.ts.map +1 -1
- package/build/template/components/content/GraphQLDocumentWrapper.js +8 -7
- package/build/template/components/content/GraphQLDocumentWrapper.js.map +1 -1
- package/build/template/components/sidebar/SidebarItem.js +2 -2
- package/build/template/entry.client.d.ts.map +1 -1
- package/build/template/entry.client.js +0 -3
- package/build/template/entry.client.js.map +1 -1
- package/build/template/hooks/useClientOnly.d.ts +9 -0
- package/build/template/hooks/useClientOnly.d.ts.map +1 -0
- package/build/template/hooks/useClientOnly.js +16 -0
- package/build/template/hooks/useClientOnly.js.map +1 -0
- package/build/template/routes/root.d.ts.map +1 -1
- package/build/template/routes/root.js +2 -150
- package/build/template/routes/root.js.map +1 -1
- package/build/template/server/app.d.ts +8 -1
- package/build/template/server/app.d.ts.map +1 -1
- package/build/template/server/app.js +21 -21
- package/build/template/server/app.js.map +1 -1
- package/build/template/server/create-page-html-response.d.ts +7 -0
- package/build/template/server/create-page-html-response.d.ts.map +1 -0
- package/build/template/server/{render-page.js → create-page-html-response.js} +11 -16
- package/build/template/server/create-page-html-response.js.map +1 -0
- package/build/template/server/main.js +2 -1
- package/build/template/server/main.js.map +1 -1
- package/build/template/server/middleware/page.d.ts +4 -0
- package/build/template/server/middleware/page.d.ts.map +1 -0
- package/build/template/server/middleware/page.js +15 -0
- package/build/template/server/middleware/page.js.map +1 -0
- package/build/template/server/middleware/unsupported-assets.d.ts +10 -0
- package/build/template/server/middleware/unsupported-assets.d.ts.map +1 -0
- package/build/template/server/middleware/unsupported-assets.js +21 -0
- package/build/template/server/middleware/unsupported-assets.js.map +1 -0
- package/build/template/server/ssg/generate.d.ts.map +1 -1
- package/build/template/server/ssg/generate.js +33 -34
- package/build/template/server/ssg/generate.js.map +1 -1
- package/build/template/styles/code-block.css +218 -0
- package/package.json +3 -2
- package/src/api/singletons/markdown/markdown.test.ts +1 -1
- package/src/api/vite/plugins/build.ts +97 -89
- package/src/api/vite/plugins/core.ts +15 -10
- package/src/api/vite/plugins/pages.ts +9 -7
- package/src/api/vite/plugins/serve.ts +62 -9
- package/src/lib/file-router/diagnostic-reporter.ts +2 -2
- package/src/lib/graphql-document/components/GraphQLDocument.tsx +23 -11
- package/src/lib/graphql-document/positioning-simple.test.ts +18 -22
- package/src/lib/graphql-document/positioning-simple.ts +97 -108
- package/src/lib/kit-temp.test.ts +15 -3
- package/src/lib/kit-temp.ts +304 -4
- package/src/lib/vite-plugin-reactive-data/vite-plugin-reactive-data.ts +52 -58
- package/src/package-paths.ts +3 -3
- package/src/template/components/Link.tsx +20 -12
- package/src/template/components/content/GraphQLDocumentWithSchema.tsx +0 -5
- package/src/template/components/content/GraphQLDocumentWrapper.tsx +14 -7
- package/src/template/components/sidebar/SidebarItem.tsx +2 -2
- package/src/template/entry.client.tsx +0 -3
- package/src/template/hooks/useClientOnly.ts +21 -0
- package/src/template/routes/root.tsx +0 -159
- package/src/template/server/app.ts +33 -23
- package/src/template/server/{render-page.tsx → create-page-html-response.ts} +19 -16
- package/src/template/server/main.ts +2 -1
- package/src/template/server/middleware/page.ts +19 -0
- package/src/template/server/middleware/unsupported-assets.ts +25 -0
- package/src/template/server/ssg/generate.ts +68 -72
- package/build/template/server/render-page.d.ts +0 -3
- package/build/template/server/render-page.d.ts.map +0 -1
- package/build/template/server/render-page.js.map +0 -1
@@ -3,7 +3,6 @@ import { GrafaidOld } from '#lib/grafaid-old/index';
|
|
3
3
|
import { createRoute } from '#lib/react-router-aid/react-router-aid';
|
4
4
|
import { Box, Grid } from '@radix-ui/themes';
|
5
5
|
import { Flex, Theme } from '@radix-ui/themes';
|
6
|
-
import radixStylesUrl from '@radix-ui/themes/styles.css?url';
|
7
6
|
import { Arr } from '@wollybeard/kit';
|
8
7
|
import { useEffect, useState } from 'react';
|
9
8
|
import { Link as LinkReactRouter } from 'react-router';
|
@@ -23,27 +22,17 @@ import { NotFound } from "../components/NotFound.js";
|
|
23
22
|
import { Sidebar } from "../components/sidebar/Sidebar.js";
|
24
23
|
import { ThemeToggle } from "../components/ThemeToggle.js";
|
25
24
|
import { ThemeProvider, useTheme } from "../contexts/ThemeContext.js";
|
26
|
-
import entryClientUrl from '../entry.client.jsx?url';
|
27
25
|
import { changelog } from "./changelog.js";
|
28
26
|
import { index } from "./index.js";
|
29
27
|
import { reference } from "./reference.js";
|
30
|
-
// todo: not needed anymore because not using hono dev vite plugin right?
|
31
|
-
const reactRefreshPreamble = `
|
32
|
-
import RefreshRuntime from "/@react-refresh";
|
33
|
-
RefreshRuntime.injectIntoGlobalHook(window);
|
34
|
-
window.$RefreshReg$ = () => {};
|
35
|
-
window.$RefreshSig$ = () => (type) => type;
|
36
|
-
window.__vite_plugin_react_preamble_installed__ = true;
|
37
|
-
`;
|
38
28
|
export const Component = () => {
|
39
29
|
const schema = PROJECT_DATA.schema?.versions[0]?.after || null;
|
40
|
-
console.log('Root component - schema:', schema ? 'EXISTS' : 'NULL');
|
41
30
|
// Make schema available globally for MDX components
|
42
31
|
if (typeof window !== 'undefined' && schema) {
|
43
32
|
;
|
44
33
|
window.__POLEN_GRAPHQL_SCHEMA__ = schema;
|
45
34
|
}
|
46
|
-
return (_jsxs("html", { lang: 'en', children: [_jsxs("head", { children: [
|
35
|
+
return (_jsxs("html", { lang: 'en', children: [_jsxs("head", { children: [_jsx("meta", { charSet: 'utf-8' }), _jsx("meta", { name: 'viewport', content: 'width=device-width, initial-scale=1' }), _jsx("title", { children: templateVariables.title })] }), _jsxs("body", { style: { margin: 0 }, children: [_jsx(ThemeProvider, { children: _jsxs(GraphQLSchemaProvider, { schema: schema, children: [_jsx(Layout, {}), _jsx(CodeBlockEnhancer, {})] }) }), _jsx(ScrollRestoration, {})] })] }));
|
47
36
|
};
|
48
37
|
const Layout = () => {
|
49
38
|
const location = useLocation();
|
@@ -100,144 +89,7 @@ const Layout = () => {
|
|
100
89
|
initial: "'header' 'content'",
|
101
90
|
sm: "'header' 'content'",
|
102
91
|
md: "'header header header header header header header header' 'sidebar sidebar . content content content content content'",
|
103
|
-
}, rows: 'min-content auto', columns: { initial: '1fr', sm: '1fr', md: 'repeat(8, 1fr)' }, gapX: { initial: '0', sm: '0', md: '2' }, my: { initial: '0', sm: '0', md: '8' }, mx: 'auto', px: { initial: '4', sm: '4', md: '0' }, py: { initial: '4', sm: '4', md: '0' }, children: [_jsx(
|
104
|
-
/* Import Inter font */
|
105
|
-
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
|
106
|
-
|
107
|
-
/* Typography improvements */
|
108
|
-
body {
|
109
|
-
font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
|
110
|
-
-webkit-font-smoothing: antialiased;
|
111
|
-
-moz-osx-font-smoothing: grayscale;
|
112
|
-
text-rendering: optimizeLegibility;
|
113
|
-
font-feature-settings: 'kern', 'liga', 'calt', 'ss01', 'ss02';
|
114
|
-
}
|
115
|
-
|
116
|
-
/* Improved paragraph spacing */
|
117
|
-
.prose p {
|
118
|
-
line-height: 1.7;
|
119
|
-
margin-bottom: 1.25rem;
|
120
|
-
}
|
121
|
-
|
122
|
-
.prose h1, .prose h2, .prose h3, .prose h4, .prose h5, .prose h6 {
|
123
|
-
font-weight: 600;
|
124
|
-
letter-spacing: -0.02em;
|
125
|
-
margin-top: 2rem;
|
126
|
-
margin-bottom: 1rem;
|
127
|
-
}
|
128
|
-
|
129
|
-
.prose h1 { font-size: 2.25rem; line-height: 1.2; }
|
130
|
-
.prose h2 { font-size: 1.875rem; line-height: 1.3; }
|
131
|
-
.prose h3 { font-size: 1.5rem; line-height: 1.4; }
|
132
|
-
.prose h4 { font-size: 1.25rem; line-height: 1.5; }
|
133
|
-
|
134
|
-
.prose ul, .prose ol {
|
135
|
-
margin-bottom: 1.25rem;
|
136
|
-
padding-left: 1.5rem;
|
137
|
-
}
|
138
|
-
|
139
|
-
.prose li {
|
140
|
-
margin-bottom: 0.5rem;
|
141
|
-
line-height: 1.7;
|
142
|
-
}
|
143
|
-
|
144
|
-
.prose a {
|
145
|
-
color: var(--accent-9);
|
146
|
-
text-decoration: none;
|
147
|
-
border-bottom: 1px solid transparent;
|
148
|
-
transition: border-color 0.2s;
|
149
|
-
}
|
150
|
-
|
151
|
-
.prose a:hover {
|
152
|
-
border-bottom-color: var(--accent-9);
|
153
|
-
}
|
154
|
-
|
155
|
-
.prose blockquote {
|
156
|
-
border-left: 4px solid var(--accent-6);
|
157
|
-
padding-left: 1rem;
|
158
|
-
margin-left: 0;
|
159
|
-
font-style: italic;
|
160
|
-
color: var(--gray-11);
|
161
|
-
}
|
162
|
-
|
163
|
-
/* Responsive container fixes */
|
164
|
-
@media (max-width: 768px) {
|
165
|
-
body {
|
166
|
-
overflow-x: hidden;
|
167
|
-
}
|
168
|
-
}
|
169
|
-
|
170
|
-
/* Ensure proper centering on all screen sizes */
|
171
|
-
.rt-Grid {
|
172
|
-
box-sizing: border-box;
|
173
|
-
}
|
174
|
-
|
175
|
-
/* Shiki code blocks */
|
176
|
-
pre.shiki {
|
177
|
-
margin: 0;
|
178
|
-
padding: 1rem;
|
179
|
-
border-radius: 8px;
|
180
|
-
overflow-x: auto;
|
181
|
-
font-size: 14px;
|
182
|
-
line-height: 1.6;
|
183
|
-
background-color: #f6f8fa;
|
184
|
-
border: 1px solid var(--gray-4);
|
185
|
-
}
|
186
|
-
|
187
|
-
/* Light mode: use --shiki-light CSS variables from inline styles */
|
188
|
-
pre.shiki span {
|
189
|
-
color: var(--shiki-light);
|
190
|
-
}
|
191
|
-
|
192
|
-
/* Dark mode - Radix Themes uses [data-is-root-theme="dark"] */
|
193
|
-
[data-is-root-theme="dark"] pre.shiki {
|
194
|
-
background-color: #1a1b26;
|
195
|
-
border-color: var(--gray-7);
|
196
|
-
}
|
197
|
-
|
198
|
-
[data-is-root-theme="dark"] pre.shiki span {
|
199
|
-
color: var(--shiki-dark);
|
200
|
-
}
|
201
|
-
|
202
|
-
pre.shiki code {
|
203
|
-
font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', Consolas, 'Liberation Mono', Menlo, monospace;
|
204
|
-
background: transparent;
|
205
|
-
display: block;
|
206
|
-
}
|
207
|
-
|
208
|
-
/* Inline code */
|
209
|
-
.prose code:not(pre code) {
|
210
|
-
background-color: var(--gray-3);
|
211
|
-
padding: 0.125rem 0.25rem;
|
212
|
-
border-radius: 0.25rem;
|
213
|
-
font-size: 0.875em;
|
214
|
-
font-family: 'JetBrains Mono', 'Fira Code', monospace;
|
215
|
-
}
|
216
|
-
|
217
|
-
/* Tables */
|
218
|
-
.prose table {
|
219
|
-
width: 100%;
|
220
|
-
border-collapse: collapse;
|
221
|
-
margin-bottom: 1.5rem;
|
222
|
-
}
|
223
|
-
|
224
|
-
.prose th {
|
225
|
-
background-color: var(--gray-3);
|
226
|
-
font-weight: 600;
|
227
|
-
text-align: left;
|
228
|
-
padding: 0.75rem;
|
229
|
-
border-bottom: 2px solid var(--gray-5);
|
230
|
-
}
|
231
|
-
|
232
|
-
.prose td {
|
233
|
-
padding: 0.75rem;
|
234
|
-
border-bottom: 1px solid var(--gray-4);
|
235
|
-
}
|
236
|
-
|
237
|
-
.prose tbody tr:last-child td {
|
238
|
-
border-bottom: none;
|
239
|
-
}
|
240
|
-
` }), header, isShowSidebar && (_jsx(Box, { display: { initial: 'none', xs: 'none', sm: 'none', md: 'block' }, gridColumn: '1 / 3', gridRow: '2 / auto', children: _jsx(Sidebar, { data: sidebar.items }) })), _jsx(Box, { gridArea: 'content / content / auto / 8', className: 'prose', children: _jsx(Outlet, {}) })] }) }));
|
92
|
+
}, rows: 'min-content auto', columns: { initial: '1fr', sm: '1fr', md: 'repeat(8, 1fr)' }, gapX: { initial: '0', sm: '0', md: '2' }, my: { initial: '0', sm: '0', md: '8' }, mx: 'auto', px: { initial: '4', sm: '4', md: '0' }, py: { initial: '4', sm: '4', md: '0' }, children: [header, isShowSidebar && (_jsx(Box, { display: { initial: 'none', xs: 'none', sm: 'none', md: 'block' }, gridColumn: '1 / 3', gridRow: '2 / auto', children: _jsx(Sidebar, { data: sidebar.items }) })), _jsx(Box, { gridArea: 'content / content / auto / 8', className: 'prose', children: _jsx(Outlet, {}) })] }) }));
|
241
93
|
};
|
242
94
|
const children = [
|
243
95
|
index,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"root.js","sourceRoot":"","sources":["../../../src/template/routes/root.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAA;AACpE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAC5C,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,
|
1
|
+
{"version":3,"file":"root.js","sourceRoot":"","sources":["../../../src/template/routes/root.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAA;AACpE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAC5C,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAA;AACrC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAC3C,OAAO,EAAE,IAAI,IAAI,eAAe,EAAE,MAAM,cAAc,CAAA;AACtD,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AACrE,O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IAAC,QAAQ,EAAC,8BAA8B,EAAC,SAAS,EAAC,OAAO,YAC5D,KAAC,MAAM,KAAG,GACN,IACD,GACD,CACT,CAAA;AACH,CAAC,CAAA;AAED,MAAM,QAAQ,GAA8B;IAC1C,KAAK;IACL,GAAG,MAAM;CACV,CAAA;AAED,EAAE;AACF,EAAE;AACF,EAAE;AACF,EAAE;AACF,8DAA8D;AAC9D,EAAE;AACF,EAAE;AACF,EAAE;AAEF,IAAI,YAAY,CAAC,MAAM,EAAE,CAAC;IACxB,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;IACxB,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;AAC1B,CAAC;AAED,EAAE;AACF,EAAE;AACF,EAAE;AACF,EAAE;AACF,mCAAmC;AACnC,EAAE;AACF,EAAE;AACF,EAAE;AAEF,MAAM,aAAa,GAAG,WAAW,CAAC;IAChC,EAAE,EAAE,aAAa;IACjB,IAAI,EAAE,GAAG;IACT,SAAS,EAAE,QAAQ;IACnB,MAAM,EAAE;QACN,UAAU,EAAE,GAAG;KAChB;CACF,CAAC,CAAA;AACF,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;AAE5B,EAAE;AACF,EAAE;AACF,EAAE;AACF,8BAA8B;AAC9B,EAAE;AACF,EAAE;AAEF,MAAM,CAAC,MAAM,IAAI,GAAG,WAAW,CAAC;IAC9B,IAAI,EAAE,GAAG;IACT,SAAS;IACT,QAAQ;CACT,CAAC,CAAA"}
|
@@ -1,3 +1,10 @@
|
|
1
1
|
import { Hono } from '#dep/hono/index';
|
2
|
-
export
|
2
|
+
export type HtmlTransformer = (html: string, ctx: Hono.Context) => Promise<string> | string;
|
3
|
+
export interface AppHooks {
|
4
|
+
transformHtml?: HtmlTransformer[];
|
5
|
+
}
|
6
|
+
export interface AppOptions {
|
7
|
+
hooks?: AppHooks;
|
8
|
+
}
|
9
|
+
export declare const createApp: (options?: AppOptions) => Hono.Hono<import("hono/types").BlankEnv, import("hono/types").BlankSchema, "/">;
|
3
10
|
//# sourceMappingURL=app.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../../src/template/server/app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;
|
1
|
+
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../../src/template/server/app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAQtC,MAAM,MAAM,eAAe,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,CAAC,OAAO,KAAK,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM,CAAA;AAE3F,MAAM,WAAW,QAAQ;IACvB,aAAa,CAAC,EAAE,eAAe,EAAE,CAAA;CAClC;AAED,MAAM,WAAW,UAAU;IACzB,KAAK,CAAC,EAAE,QAAQ,CAAA;CACjB;AAED,eAAO,MAAM,SAAS,GAAI,UAAS,UAAe,oFA0BjD,CAAA"}
|
@@ -1,26 +1,26 @@
|
|
1
1
|
import { Hono } from '#dep/hono/index';
|
2
|
-
import { AppleTouchIcon } from '#lib/apple-touch-icon/index';
|
3
|
-
import { Favicon } from '#lib/favicon/index';
|
4
2
|
import { serveStatic } from '@hono/node-server/serve-static';
|
5
|
-
import { Http } from '@wollybeard/kit';
|
6
3
|
import PROJECT_DATA from 'virtual:polen/project/data.jsonsuper';
|
7
|
-
import
|
8
|
-
import {
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
const
|
15
|
-
|
16
|
-
|
4
|
+
import viteClientAssetManifest from 'virtual:polen/vite/client/manifest';
|
5
|
+
import { injectManifestIntoHtml } from "./manifest.js";
|
6
|
+
import { PageMiddleware } from "./middleware/page.js";
|
7
|
+
import { UnsupportedAssetsMiddleware } from "./middleware/unsupported-assets.js";
|
8
|
+
export const createApp = (options = {}) => {
|
9
|
+
const app = new Hono.Hono();
|
10
|
+
// Collect all HTML transformers
|
11
|
+
const htmlTransformers = [...(options.hooks?.transformHtml || [])];
|
12
|
+
// Core middleware
|
13
|
+
app.use('*', UnsupportedAssetsMiddleware());
|
14
|
+
// Production-specific setup
|
15
|
+
if (__BUILDING__) {
|
16
|
+
// Add manifest transformer
|
17
|
+
htmlTransformers.push((html, _ctx) => {
|
18
|
+
return injectManifestIntoHtml(html, viteClientAssetManifest, PROJECT_DATA.basePath);
|
19
|
+
});
|
20
|
+
// Static file serving
|
21
|
+
app.use(PROJECT_DATA.server.static.route, serveStatic({ root: PROJECT_DATA.server.static.directory }));
|
17
22
|
}
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
if (AppleTouchIcon.fileNamePattern.test(ctx.req.path)) {
|
22
|
-
return Http.Response.notFound;
|
23
|
-
}
|
24
|
-
return renderPage(staticHandlerContext);
|
25
|
-
});
|
23
|
+
app.all('*', PageMiddleware(htmlTransformers));
|
24
|
+
return app;
|
25
|
+
};
|
26
26
|
//# sourceMappingURL=app.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../../src/template/server/app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AACtC,OAAO,EAAE,
|
1
|
+
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../../src/template/server/app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAA;AAC5D,OAAO,YAAY,MAAM,sCAAsC,CAAA;AAC/D,OAAO,uBAAuB,MAAM,oCAAoC,CAAA;AACxE,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,2BAA2B,EAAE,MAAM,oCAAoC,CAAA;AAYhF,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,UAAsB,EAAE,EAAE,EAAE;IACpD,MAAM,GAAG,GAAG,IAAI,IAAI,CAAC,IAAI,EAAE,CAAA;IAE3B,gCAAgC;IAChC,MAAM,gBAAgB,GAAsB,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,aAAa,IAAI,EAAE,CAAC,CAAC,CAAA;IAErF,kBAAkB;IAClB,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,2BAA2B,EAAE,CAAC,CAAA;IAE3C,4BAA4B;IAC5B,IAAI,YAAY,EAAE,CAAC;QACjB,2BAA2B;QAC3B,gBAAgB,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE;YACnC,OAAO,sBAAsB,CAAC,IAAI,EAAE,uBAAuB,EAAE,YAAY,CAAC,QAAQ,CAAC,CAAA;QACrF,CAAC,CAAC,CAAA;QAEF,sBAAsB;QACtB,GAAG,CAAC,GAAG,CACL,YAAY,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,EAChC,WAAW,CAAC,EAAE,IAAI,EAAE,YAAY,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC,CAC5D,CAAA;IACH,CAAC;IAED,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,cAAc,CAAC,gBAAgB,CAAC,CAAC,CAAA;IAE9C,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA"}
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import type { ReactRouter } from '#dep/react-router/index';
|
2
|
+
interface RenderHooks {
|
3
|
+
transformHtml?: (html: string) => Promise<string> | string;
|
4
|
+
}
|
5
|
+
export declare const createPageHtmlResponse: (staticHandlerContext: ReactRouter.StaticHandlerContext, hooks?: RenderHooks) => Promise<Response>;
|
6
|
+
export {};
|
7
|
+
//# sourceMappingURL=create-page-html-response.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"create-page-html-response.d.ts","sourceRoot":"","sources":["../../../src/template/server/create-page-html-response.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAS1D,UAAU,WAAW;IACnB,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM,CAAA;CAC3D;AAED,eAAO,MAAM,sBAAsB,GACjC,sBAAsB,WAAW,CAAC,oBAAoB,EACtD,QAAQ,WAAW,sBAuCpB,CAAA"}
|
@@ -1,32 +1,27 @@
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
2
1
|
import { reportError } from '#api/server/report-error';
|
2
|
+
import { React } from '#dep/react/index';
|
3
3
|
import { ResponseInternalServerError } from '#lib/kit-temp';
|
4
4
|
import { Arr } from '@wollybeard/kit';
|
5
|
-
import { StrictMode } from 'react';
|
6
5
|
import * as ReactDomServer from 'react-dom/server';
|
7
6
|
import { createStaticRouter, StaticRouterProvider } from 'react-router';
|
8
|
-
import PROJECT_DATA from 'virtual:polen/project/data.jsonsuper';
|
9
|
-
import viteClientAssetManifest from 'virtual:polen/vite/client/manifest';
|
10
|
-
import { injectManifestIntoHtml } from "./manifest.js";
|
11
7
|
import { view } from "./view.js";
|
12
|
-
export const
|
8
|
+
export const createPageHtmlResponse = async (staticHandlerContext, hooks) => {
|
13
9
|
const router = createStaticRouter(view.dataRoutes, staticHandlerContext);
|
14
10
|
let html = ``;
|
15
11
|
try {
|
16
|
-
html = ReactDomServer.renderToString(
|
12
|
+
html = ReactDomServer.renderToString(React.createElement(React.StrictMode, null, React.createElement(StaticRouterProvider, {
|
13
|
+
router,
|
14
|
+
context: staticHandlerContext,
|
15
|
+
})));
|
17
16
|
}
|
18
17
|
catch (cause) {
|
19
18
|
reportError(new Error(`Failed to server side render the HTML`, { cause }));
|
20
19
|
return ResponseInternalServerError();
|
21
20
|
}
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
if (import.meta.env.DEV) {
|
27
|
-
// const env = ctx.env as { viteDevServer: Vite.ViteDevServer }
|
28
|
-
// html = await env.viteDevServer.transformIndexHtml(ctx.req.url, html)
|
29
|
-
// await env.viteDevServer.transformIndexHtml(ctx.req.url, html)
|
21
|
+
// Create the full HTML document
|
22
|
+
// Apply HTML transformation hook to the full document
|
23
|
+
if (hooks?.transformHtml) {
|
24
|
+
html = await hooks.transformHtml(html);
|
30
25
|
}
|
31
26
|
const headers = getRouteHeaders(staticHandlerContext);
|
32
27
|
headers.set(`Content-Type`, `text/html; charset=utf-8`);
|
@@ -63,4 +58,4 @@ const getRouteHeaders = (context) => {
|
|
63
58
|
}
|
64
59
|
return headers;
|
65
60
|
};
|
66
|
-
//# sourceMappingURL=
|
61
|
+
//# sourceMappingURL=create-page-html-response.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"create-page-html-response.js","sourceRoot":"","sources":["../../../src/template/server/create-page-html-response.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AAEtD,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AACxC,OAAO,EAAE,2BAA2B,EAAE,MAAM,eAAe,CAAA;AAE3D,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAA;AACrC,OAAO,KAAK,cAAc,MAAM,kBAAkB,CAAA;AAClD,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AACvE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAMhC,MAAM,CAAC,MAAM,sBAAsB,GAAG,KAAK,EACzC,oBAAsD,EACtD,KAAmB,EACnB,EAAE;IACF,MAAM,MAAM,GAAG,kBAAkB,CAAC,IAAI,CAAC,UAAU,EAAE,oBAAoB,CAAC,CAAA;IAExE,IAAI,IAAI,GAAG,EAAE,CAAA;IAEb,IAAI,CAAC;QACH,IAAI,GAAG,cAAc,CAA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GAAG,CAAA;AACZ,CAAC,CAAA;AAED,MAAM,eAAe,GAAG,CACtB,OAAyC,EAChC,EAAE;IACX,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;IACxD,IAAI,CAAC,IAAI;QAAE,OAAO,IAAI,OAAO,EAAE,CAAA;IAE/B,MAAM,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;IAC1D,MAAM,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;IAC1D,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,aAAa,CAAC,CAAA;IAC1C,IAAI,aAAa,EAAE,CAAC;QAClB,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,aAAa,CAAC,OAAO,EAAE,EAAE,CAAC;YACnD,OAAO,CAAC,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;QAC5B,CAAC;IACH,CAAC;IACD,OAAO,OAAO,CAAA;AAChB,CAAC,CAAA"}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { serve } from '@hono/node-server'; // TODO: support non-node platforms.
|
2
2
|
import { neverCase } from '@wollybeard/kit/language';
|
3
|
-
import {
|
3
|
+
import { createApp } from "./app.js";
|
4
4
|
import { generate } from "./ssg/generate.js";
|
5
5
|
import { view } from "./view.js";
|
6
6
|
if (__BUILDING__) {
|
@@ -10,6 +10,7 @@ if (__BUILDING__) {
|
|
10
10
|
break;
|
11
11
|
case `ssr`:
|
12
12
|
const port = process.env[`PORT`] ? parseInt(process.env[`PORT`]) : 3001; // todo viteConfigResolved.server.port + 1
|
13
|
+
const app = createApp();
|
13
14
|
serve({ fetch: app.fetch, port });
|
14
15
|
break;
|
15
16
|
case `spa`:
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../../src/template/server/main.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA,CAAC,oCAAoC;AAC9E,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AACpD,OAAO,EAAE,
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../../src/template/server/main.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA,CAAC,oCAAoC;AAC9E,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC,IAAI,YAAY,EAAE,CAAC;IACjB,QAAQ,sBAAsB,EAAE,CAAC;QAC/B,KAAK,KAAK;YACR,MAAM,QAAQ,CAAC,IAAI,CAAC,CAAA;YACpB,MAAK;QACP,KAAK,KAAK;YACR,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA,CAAC,0CAA0C;YAClH,MAAM,GAAG,GAAG,SAAS,EAAE,CAAA;YACvB,KAAK,CAAC,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAA;YACjC,MAAK;QACP,KAAK,KAAK;YACR,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAA;QACxD;YACE,SAAS,CAAC,sBAAsB,CAAC,CAAA;IACrC,CAAC;AACH,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../../../../src/template/server/middleware/page.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAE3C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAIhD,eAAO,MAAM,cAAc,GAAI,cAAc,eAAe,EAAE,MAC9C,KAAK,IAAI,CAAC,OAAO,sBAWhC,CAAA"}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import { asyncReduceWith } from '#lib/kit-temp';
|
2
|
+
import { createPageHtmlResponse } from "../create-page-html-response.js";
|
3
|
+
import { view } from "../view.js";
|
4
|
+
export const PageMiddleware = (transformers) => {
|
5
|
+
return async (ctx) => {
|
6
|
+
const staticHandlerContext = await view.query(ctx.req.raw);
|
7
|
+
if (staticHandlerContext instanceof Response) {
|
8
|
+
return staticHandlerContext;
|
9
|
+
}
|
10
|
+
return createPageHtmlResponse(staticHandlerContext, {
|
11
|
+
transformHtml: asyncReduceWith(transformers, ctx),
|
12
|
+
});
|
13
|
+
};
|
14
|
+
};
|
15
|
+
//# sourceMappingURL=page.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"page.js","sourceRoot":"","sources":["../../../../src/template/server/middleware/page.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAE/C,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAA;AACxE,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAEjC,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,YAA+B,EAAE,EAAE;IAChE,OAAO,KAAK,EAAE,GAAiB,EAAE,EAAE;QACjC,MAAM,oBAAoB,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;QAE1D,IAAI,oBAAoB,YAAY,QAAQ,EAAE,CAAC;YAC7C,OAAO,oBAAoB,CAAA;QAC7B,CAAC;QAED,OAAO,sBAAsB,CAAC,oBAAoB,EAAE;YAClD,aAAa,EAAE,eAAe,CAAC,YAAY,EAAE,GAAG,CAAC;SAClD,CAAC,CAAA;IACJ,CAAC,CAAA;AACH,CAAC,CAAA"}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import type { Hono } from '#dep/hono/index';
|
2
|
+
/**
|
3
|
+
* Temporary middleware to block unsupported asset requests
|
4
|
+
*
|
5
|
+
* TODO: Polen should eventually support favicon and apple-touch-icon generation
|
6
|
+
* For now, we return 404 immediately to prevent these requests from reaching
|
7
|
+
* React Router and causing unnecessary processing or errors.
|
8
|
+
*/
|
9
|
+
export declare const UnsupportedAssetsMiddleware: () => Hono.MiddlewareHandler;
|
10
|
+
//# sourceMappingURL=unsupported-assets.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"unsupported-assets.d.ts","sourceRoot":"","sources":["../../../../src/template/server/middleware/unsupported-assets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAK3C;;;;;;GAMG;AACH,eAAO,MAAM,2BAA2B,QAAO,IAAI,CAAC,iBAYnD,CAAA"}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import { AppleTouchIcon } from '#lib/apple-touch-icon/index';
|
2
|
+
import { Favicon } from '#lib/favicon/index';
|
3
|
+
import { Http } from '@wollybeard/kit';
|
4
|
+
/**
|
5
|
+
* Temporary middleware to block unsupported asset requests
|
6
|
+
*
|
7
|
+
* TODO: Polen should eventually support favicon and apple-touch-icon generation
|
8
|
+
* For now, we return 404 immediately to prevent these requests from reaching
|
9
|
+
* React Router and causing unnecessary processing or errors.
|
10
|
+
*/
|
11
|
+
export const UnsupportedAssetsMiddleware = () => {
|
12
|
+
return async (ctx, next) => {
|
13
|
+
// Block these asset requests until Polen supports them
|
14
|
+
if (Favicon.fileNamePattern.test(ctx.req.path)
|
15
|
+
|| AppleTouchIcon.fileNamePattern.test(ctx.req.path)) {
|
16
|
+
return Http.Response.notFound;
|
17
|
+
}
|
18
|
+
await next();
|
19
|
+
};
|
20
|
+
};
|
21
|
+
//# sourceMappingURL=unsupported-assets.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"unsupported-assets.js","sourceRoot":"","sources":["../../../../src/template/server/middleware/unsupported-assets.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAEtC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,GAA2B,EAAE;IACtE,OAAO,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;QACzB,uDAAuD;QACvD,IACE,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC;eACvC,cAAc,CAAC,eAAe,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,EACpD,CAAC;YACD,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAA;QAC/B,CAAC;QAED,MAAM,IAAI,EAAE,CAAA;IACd,CAAC,CAAA;AACH,CAAC,CAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../../../src/template/server/ssg/generate.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;
|
1
|
+
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../../../src/template/server/ssg/generate.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAU1D,eAAO,MAAM,QAAQ,GAAU,MAAM,WAAW,CAAC,aAAa,kBA+E7D,CAAA"}
|
@@ -1,37 +1,21 @@
|
|
1
1
|
import { Hono } from '#dep/hono/index';
|
2
|
-
import {
|
2
|
+
import { asyncParallel, chunk } from '#lib/kit-temp';
|
3
|
+
import { debugPolen } from '#singletons/debug';
|
3
4
|
import * as NodeFs from 'node:fs/promises';
|
4
5
|
import PROJECT_DATA from 'virtual:polen/project/data.jsonsuper';
|
5
|
-
import
|
6
|
+
import viteClientAssetManifest from 'virtual:polen/vite/client/manifest';
|
7
|
+
import { createPageHtmlResponse } from "../create-page-html-response.js";
|
8
|
+
import { injectManifestIntoHtml } from "../manifest.js";
|
6
9
|
import { getRoutesPaths } from "./get-route-paths.js";
|
7
10
|
export const generate = async (view) => {
|
8
|
-
const
|
9
|
-
// For SSG, we need to create a request with the base path prepended
|
10
|
-
// so React Router can match it correctly
|
11
|
-
const url = new URL(ctx.req.raw.url);
|
12
|
-
const basePath = PROJECT_DATA.basePath === '/' ? '' : PROJECT_DATA.basePath.slice(0, -1);
|
13
|
-
// Create a new request with the base path prepended to the pathname
|
14
|
-
const modifiedRequest = new Request(`${url.protocol}//${url.host}${basePath}${url.pathname}${url.search}`, {
|
15
|
-
method: ctx.req.raw.method,
|
16
|
-
headers: ctx.req.raw.headers,
|
17
|
-
body: ctx.req.raw.body,
|
18
|
-
});
|
19
|
-
const staticHandlerContext = await view.query(modifiedRequest);
|
20
|
-
if (staticHandlerContext instanceof Response) {
|
21
|
-
return staticHandlerContext;
|
22
|
-
}
|
23
|
-
return renderPage(staticHandlerContext);
|
24
|
-
};
|
11
|
+
const debug = debugPolen.sub(`ssg`);
|
25
12
|
const routePaths = getRoutesPaths();
|
26
|
-
for (const routePath of routePaths) {
|
27
|
-
app.get(routePath, handler);
|
28
|
-
}
|
29
|
-
// For large schemas, we need to process in smaller batches to avoid memory issues
|
30
|
-
const BATCH_SIZE = 50;
|
31
13
|
const totalPaths = routePaths.length;
|
32
|
-
|
33
|
-
|
34
|
-
|
14
|
+
debug(`start`, { totalPaths });
|
15
|
+
// Process routes in batches using the new utilities
|
16
|
+
const batchSize = 50;
|
17
|
+
const batches = chunk(routePaths, batchSize);
|
18
|
+
const result = await asyncParallel(batches, async (batchPaths, batchIndex) => {
|
35
19
|
const batchApp = new Hono.Hono();
|
36
20
|
// Create a custom handler for batch processing that includes base path handling
|
37
21
|
const batchHandler = async (ctx) => {
|
@@ -48,23 +32,38 @@ export const generate = async (view) => {
|
|
48
32
|
if (staticHandlerContext instanceof Response) {
|
49
33
|
return staticHandlerContext;
|
50
34
|
}
|
51
|
-
|
35
|
+
// SSG uses manifest-based transformation directly
|
36
|
+
const transformHtml = (html) => {
|
37
|
+
return injectManifestIntoHtml(html, viteClientAssetManifest, PROJECT_DATA.basePath);
|
38
|
+
};
|
39
|
+
return createPageHtmlResponse(staticHandlerContext, { transformHtml });
|
52
40
|
};
|
53
41
|
// Register only the routes for this batch
|
54
42
|
for (const routePath of batchPaths) {
|
55
43
|
batchApp.get(routePath, batchHandler);
|
56
44
|
}
|
57
|
-
|
58
|
-
|
45
|
+
debug(`batch:start`, {
|
46
|
+
batchIndex: batchIndex + 1,
|
47
|
+
totalBatches: batches.length,
|
48
|
+
pagesInBatch: batchPaths.length,
|
49
|
+
});
|
50
|
+
const ssgResult = await Hono.SSG.toSSG(batchApp, NodeFs, {
|
59
51
|
concurrency: 5, // Reduced concurrency for memory efficiency
|
60
52
|
dir: PROJECT_DATA.paths.relative.build.root,
|
61
53
|
});
|
62
|
-
if (!
|
63
|
-
throw new Error(`Failed to generate static site at batch ${
|
64
|
-
cause:
|
54
|
+
if (!ssgResult.success) {
|
55
|
+
throw new Error(`Failed to generate static site at batch ${batchIndex + 1}`, {
|
56
|
+
cause: ssgResult.error,
|
65
57
|
});
|
66
58
|
}
|
59
|
+
return ssgResult;
|
60
|
+
}, {
|
61
|
+
concurrency: 1, // Process batches sequentially to avoid memory issues
|
62
|
+
failFast: true, // Stop on first batch failure
|
63
|
+
});
|
64
|
+
if (!result.success) {
|
65
|
+
throw new Error(`SSG generation failed`, { cause: result.errors[0] });
|
67
66
|
}
|
68
|
-
|
67
|
+
debug(`complete`, { totalPaths });
|
69
68
|
};
|
70
69
|
//# sourceMappingURL=generate.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"generate.js","sourceRoot":"","sources":["../../../../src/template/server/ssg/generate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAEtC,OAAO,EAAE,
|
1
|
+
{"version":3,"file":"generate.js","sourceRoot":"","sources":["../../../../src/template/server/ssg/generate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAEtC,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAC9C,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAA;AAC1C,OAAO,YAAY,MAAM,sCAAsC,CAAA;AAC/D,OAAO,uBAAuB,MAAM,oCAAoC,CAAA;AACxE,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAkC,CAAA;AACzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAA;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAErD,MAAM,CAAC,MAAM,QAAQ,GAAG,KAAK,EAAE,IAA+B,EAAE,EAAE;IAChE,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;IAEnC,MAAM,UAAU,GAAG,cAAc,EAAE,CAAA;IACnC,MAAM,UAAU,GAAG,UAAU,CAAC,MAAM,CAAA;IACpC,KAAK,CAAC,OAAO,EAAE,EAAE,UAAU,EAAE,CAAC,CAAA;IAE9B,oDAAoD;IACpD,MAAM,SAAS,GAAG,EAAE,CAAA;IACpB,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,EAAE,SAAS,CAAC,CAAA;IAE5C,MAAM,MAAM,GAAG,MAAM,aAAa,CAChC,OAAO,EACP,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,EAAE;Q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