@jasonshimmy/vite-plugin-cer-app 0.28.3 → 0.29.0
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/README.md +2 -0
- package/dist/cli/adapters/cloudflare.d.ts +2 -2
- package/dist/cli/adapters/cloudflare.d.ts.map +1 -1
- package/dist/cli/adapters/cloudflare.js +83 -159
- package/dist/cli/adapters/cloudflare.js.map +1 -1
- package/dist/cli/adapters/deployment-mode.d.ts +10 -0
- package/dist/cli/adapters/deployment-mode.d.ts.map +1 -0
- package/dist/cli/adapters/deployment-mode.js +59 -0
- package/dist/cli/adapters/deployment-mode.js.map +1 -0
- package/dist/cli/adapters/netlify.d.ts +5 -4
- package/dist/cli/adapters/netlify.d.ts.map +1 -1
- package/dist/cli/adapters/netlify.js +26 -150
- package/dist/cli/adapters/netlify.js.map +1 -1
- package/dist/cli/adapters/vercel.d.ts +2 -3
- package/dist/cli/adapters/vercel.d.ts.map +1 -1
- package/dist/cli/adapters/vercel.js +36 -111
- package/dist/cli/adapters/vercel.js.map +1 -1
- package/dist/cli/adapters/web-bridge.d.ts +3 -0
- package/dist/cli/adapters/web-bridge.d.ts.map +1 -0
- package/dist/cli/adapters/web-bridge.js +110 -0
- package/dist/cli/adapters/web-bridge.js.map +1 -0
- package/dist/cli/checks/lighthouse.d.ts +6 -0
- package/dist/cli/checks/lighthouse.d.ts.map +1 -1
- package/dist/cli/checks/lighthouse.js +49 -44
- package/dist/cli/checks/lighthouse.js.map +1 -1
- package/dist/cli/checks/performance.d.ts +3 -0
- package/dist/cli/checks/performance.d.ts.map +1 -1
- package/dist/cli/checks/performance.js +56 -15
- package/dist/cli/checks/performance.js.map +1 -1
- package/dist/cli/checks/quality.d.ts +35 -0
- package/dist/cli/checks/quality.d.ts.map +1 -0
- package/dist/cli/checks/quality.js +72 -0
- package/dist/cli/checks/quality.js.map +1 -0
- package/dist/cli/checks/seo.d.ts +9 -0
- package/dist/cli/checks/seo.d.ts.map +1 -0
- package/dist/cli/checks/seo.js +40 -0
- package/dist/cli/checks/seo.js.map +1 -0
- package/dist/cli/commands/build.d.ts.map +1 -1
- package/dist/cli/commands/build.js +2 -51
- package/dist/cli/commands/build.js.map +1 -1
- package/dist/cli/commands/check.d.ts.map +1 -1
- package/dist/cli/commands/check.js +12 -0
- package/dist/cli/commands/check.js.map +1 -1
- package/dist/cli/commands/dev.d.ts +4 -0
- package/dist/cli/commands/dev.d.ts.map +1 -1
- package/dist/cli/commands/dev.js +1 -72
- package/dist/cli/commands/dev.js.map +1 -1
- package/dist/cli/commands/generate.d.ts +1 -4
- package/dist/cli/commands/generate.d.ts.map +1 -1
- package/dist/cli/commands/generate.js +4 -73
- package/dist/cli/commands/generate.js.map +1 -1
- package/dist/cli/commands/preview-paths.d.ts +3 -0
- package/dist/cli/commands/preview-paths.d.ts.map +1 -0
- package/dist/cli/commands/preview-paths.js +8 -0
- package/dist/cli/commands/preview-paths.js.map +1 -0
- package/dist/cli/commands/preview.d.ts +11 -0
- package/dist/cli/commands/preview.d.ts.map +1 -1
- package/dist/cli/commands/preview.js +124 -458
- package/dist/cli/commands/preview.js.map +1 -1
- package/dist/cli/config.d.ts +3 -0
- package/dist/cli/config.d.ts.map +1 -0
- package/dist/cli/config.js +68 -0
- package/dist/cli/config.js.map +1 -0
- package/dist/cli/create/templates/spa/package.json.tpl +1 -1
- package/dist/cli/create/templates/ssg/package.json.tpl +1 -1
- package/dist/cli/create/templates/ssr/package.json.tpl +1 -1
- package/dist/plugin/build-ssg.d.ts.map +1 -1
- package/dist/plugin/build-ssg.js +79 -9
- package/dist/plugin/build-ssg.js.map +1 -1
- package/dist/plugin/build-ssr.d.ts.map +1 -1
- package/dist/plugin/build-ssr.js +3 -1
- package/dist/plugin/build-ssr.js.map +1 -1
- package/dist/plugin/dev-server.d.ts +8 -0
- package/dist/plugin/dev-server.d.ts.map +1 -1
- package/dist/plugin/dev-server.js.map +1 -1
- package/dist/plugin/dts-generator.d.ts.map +1 -1
- package/dist/plugin/dts-generator.js +3 -0
- package/dist/plugin/dts-generator.js.map +1 -1
- package/dist/plugin/html-post-process.d.ts +1 -1
- package/dist/plugin/html-post-process.d.ts.map +1 -1
- package/dist/plugin/html-post-process.js +7 -5
- package/dist/plugin/html-post-process.js.map +1 -1
- package/dist/plugin/index.d.ts +1 -4
- package/dist/plugin/index.d.ts.map +1 -1
- package/dist/plugin/index.js +26 -8
- package/dist/plugin/index.js.map +1 -1
- package/dist/plugin/server-content.d.ts +3 -0
- package/dist/plugin/server-content.d.ts.map +1 -0
- package/dist/plugin/server-content.js +25 -0
- package/dist/plugin/server-content.js.map +1 -0
- package/dist/plugin/transforms/auto-import.d.ts.map +1 -1
- package/dist/plugin/transforms/auto-import.js +6 -5
- package/dist/plugin/transforms/auto-import.js.map +1 -1
- package/dist/plugin/virtual/content-components.d.ts +3 -1
- package/dist/plugin/virtual/content-components.d.ts.map +1 -1
- package/dist/plugin/virtual/content-components.js +104 -21
- package/dist/plugin/virtual/content-components.js.map +1 -1
- package/dist/runtime/app-template.d.ts.map +1 -1
- package/dist/runtime/app-template.js +18 -8
- package/dist/runtime/app-template.js.map +1 -1
- package/dist/runtime/composables/index.d.ts +2 -0
- package/dist/runtime/composables/index.d.ts.map +1 -1
- package/dist/runtime/composables/index.js +1 -0
- package/dist/runtime/composables/index.js.map +1 -1
- package/dist/runtime/composables/render-content.d.ts +10 -0
- package/dist/runtime/composables/render-content.d.ts.map +1 -0
- package/dist/runtime/composables/render-content.js +21 -0
- package/dist/runtime/composables/render-content.js.map +1 -0
- package/dist/runtime/composables/use-auth.d.ts.map +1 -1
- package/dist/runtime/composables/use-auth.js +14 -6
- package/dist/runtime/composables/use-auth.js.map +1 -1
- package/dist/runtime/composables/use-content-page.d.ts +2 -0
- package/dist/runtime/composables/use-content-page.d.ts.map +1 -1
- package/dist/runtime/composables/use-content-page.js +1 -1
- package/dist/runtime/composables/use-content-page.js.map +1 -1
- package/dist/runtime/content/client.d.ts +2 -3
- package/dist/runtime/content/client.d.ts.map +1 -1
- package/dist/runtime/content/client.js +4 -5
- package/dist/runtime/content/client.js.map +1 -1
- package/dist/runtime/entry-server-template.d.ts.map +1 -1
- package/dist/runtime/entry-server-template.js +45 -15
- package/dist/runtime/entry-server-template.js.map +1 -1
- package/dist/runtime/isr-handler.d.ts +4 -15
- package/dist/runtime/isr-handler.d.ts.map +1 -1
- package/dist/runtime/isr-handler.js +64 -45
- package/dist/runtime/isr-handler.js.map +1 -1
- package/dist/runtime/request-dispatcher.d.ts +31 -0
- package/dist/runtime/request-dispatcher.d.ts.map +1 -0
- package/dist/runtime/request-dispatcher.js +152 -0
- package/dist/runtime/request-dispatcher.js.map +1 -0
- package/dist/runtime/route-matching.d.ts +20 -0
- package/dist/runtime/route-matching.d.ts.map +1 -0
- package/dist/runtime/route-matching.js +45 -0
- package/dist/runtime/route-matching.js.map +1 -0
- package/dist/types/api.d.ts +3 -0
- package/dist/types/api.d.ts.map +1 -1
- package/dist/types/config.d.ts +27 -0
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/config.js.map +1 -1
- package/dist/types/content.d.ts +2 -0
- package/dist/types/content.d.ts.map +1 -1
- package/dist/types/page.d.ts +11 -7
- package/dist/types/page.d.ts.map +1 -1
- package/package.json +23 -9
- package/dist/cli/commands/preview-isr.d.ts +0 -66
- package/dist/cli/commands/preview-isr.d.ts.map +0 -1
- package/dist/cli/commands/preview-isr.js +0 -132
- package/dist/cli/commands/preview-isr.js.map +0 -1
|
@@ -7,15 +7,16 @@
|
|
|
7
7
|
* SSR mode:
|
|
8
8
|
* - Writes a `netlify/functions/ssr.mjs` bridge that converts Netlify
|
|
9
9
|
* Functions v2 Web API (Request/Response) to the Node.js-style handler
|
|
10
|
-
* used by the cer-app server bundle.
|
|
11
|
-
* - Creates `.netlify/publish/` with
|
|
10
|
+
* used by the cer-app server bundle. Delegates routing to dispatchRequest.
|
|
11
|
+
* - Creates `.netlify/publish/` with public assets and generated metadata
|
|
12
|
+
* (including form registration HTML, but excluding routed documents),
|
|
12
13
|
* so Netlify's CDN serves static files and everything else falls through
|
|
13
14
|
* to the SSR function.
|
|
14
15
|
* - Writes `netlify.toml` with the publish directory and catch-all redirect.
|
|
15
16
|
*
|
|
16
17
|
* SPA/SSG mode:
|
|
17
|
-
* - Writes `netlify.toml`
|
|
18
|
-
*
|
|
18
|
+
* - Writes `netlify.toml` with a filtered SSG publish directory and 404
|
|
19
|
+
* fallback, or a SPA publish directory and app-shell fallback.
|
|
19
20
|
*
|
|
20
21
|
* Responses are streamed via the Web Streams TransformStream API — chunks written
|
|
21
22
|
* by the SSR handler are forwarded to the client as they arrive rather than being
|
|
@@ -23,6 +24,8 @@
|
|
|
23
24
|
* All other behaviour (cookies, headers, API routes, ISR) is fully supported.
|
|
24
25
|
*/
|
|
25
26
|
import { join } from 'pathe';
|
|
27
|
+
import { requiresServer, isPublicBuildFile, nodeDispatcherSource, copyGeneratedPublicFiles } from './deployment-mode.js';
|
|
28
|
+
import { WEB_BRIDGE } from './web-bridge.js';
|
|
26
29
|
import { existsSync, mkdirSync, writeFileSync, copyFileSync, cpSync, readdirSync, statSync, rmSync, } from 'node:fs';
|
|
27
30
|
// ─── SSR function bridge template ────────────────────────────────────────────
|
|
28
31
|
/**
|
|
@@ -32,160 +35,32 @@ import { existsSync, mkdirSync, writeFileSync, copyFileSync, cpSync, readdirSync
|
|
|
32
35
|
* 1. Converts the incoming Web API Request to a mock Node.js IncomingMessage.
|
|
33
36
|
* 2. Creates a streaming mock ServerResponse backed by a TransformStream.
|
|
34
37
|
* Chunks written via res.write() are enqueued into the stream immediately;
|
|
35
|
-
*
|
|
36
|
-
*
|
|
38
|
+
* The first header/body write resolves the streaming Web API Response;
|
|
39
|
+
* res.end() closes its body. The platform receives a ReadableStream
|
|
37
40
|
* so bytes flow to the client as they are written — no full-page buffering.
|
|
38
|
-
* 3.
|
|
41
|
+
* 3. Calls the shared dispatcher for middleware, API, SPA and SSR/ISR routing.
|
|
39
42
|
*
|
|
40
43
|
* The server bundle is imported using a path relative to the function file
|
|
41
44
|
* location: netlify/functions/ssr.mjs → ../../dist/server/server.js.
|
|
42
45
|
*/
|
|
43
|
-
|
|
44
|
-
|
|
46
|
+
function netlifyBridge(distDir) {
|
|
47
|
+
return `// Auto-generated by @jasonshimmy/vite-plugin-cer-app — do not edit.
|
|
45
48
|
import { Readable } from 'node:stream'
|
|
46
|
-
import {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
const params = {}
|
|
53
|
-
for (let i = 0; i < pp.length; i++) {
|
|
54
|
-
if (pp[i].startsWith(':')) params[pp[i].slice(1)] = decodeURIComponent(up[i])
|
|
55
|
-
else if (pp[i] !== up[i]) return null
|
|
56
|
-
}
|
|
57
|
-
return params
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
function parseQuery(search) {
|
|
61
|
-
if (!search) return {}
|
|
62
|
-
const qs = search.startsWith('?') ? search.slice(1) : search
|
|
63
|
-
const result = {}
|
|
64
|
-
for (const part of qs.split('&')) {
|
|
65
|
-
if (!part) continue
|
|
66
|
-
const eqIdx = part.indexOf('=')
|
|
67
|
-
if (eqIdx === -1) result[decodeURIComponent(part)] = ''
|
|
68
|
-
else result[decodeURIComponent(part.slice(0, eqIdx))] = decodeURIComponent(part.slice(eqIdx + 1))
|
|
69
|
-
}
|
|
70
|
-
return result
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
async function toNodeRequest(webReq) {
|
|
74
|
-
const url = new URL(webReq.url)
|
|
75
|
-
const hasBody = webReq.body !== null
|
|
76
|
-
&& webReq.method !== 'GET'
|
|
77
|
-
&& webReq.method !== 'HEAD'
|
|
78
|
-
const body = hasBody ? Buffer.from(await webReq.arrayBuffer()) : null
|
|
79
|
-
const req = Object.assign(
|
|
80
|
-
body ? Readable.from([body]) : Readable.from([]),
|
|
81
|
-
{
|
|
82
|
-
url: url.pathname + url.search,
|
|
83
|
-
method: webReq.method,
|
|
84
|
-
headers: Object.fromEntries(webReq.headers.entries()),
|
|
85
|
-
},
|
|
86
|
-
)
|
|
87
|
-
req.query = parseQuery(url.search)
|
|
88
|
-
if (body !== null) {
|
|
89
|
-
const ct = webReq.headers.get('content-type') ?? ''
|
|
90
|
-
if (ct.includes('application/json')) {
|
|
91
|
-
try { req.body = JSON.parse(body.toString('utf-8')) } catch { req.body = undefined }
|
|
92
|
-
} else {
|
|
93
|
-
req.body = body
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
return req
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
function createNodeResponse() {
|
|
100
|
-
const { readable, writable } = new TransformStream()
|
|
101
|
-
const writer = writable.getWriter()
|
|
102
|
-
const encoder = new TextEncoder()
|
|
103
|
-
const headers = {}
|
|
104
|
-
let _resolve
|
|
105
|
-
let _ended = false
|
|
106
|
-
const promise = new Promise((res) => { _resolve = res })
|
|
107
|
-
const res = {
|
|
108
|
-
statusCode: 200,
|
|
109
|
-
setHeader(name, value) { headers[name.toLowerCase()] = String(value) },
|
|
110
|
-
getHeader(name) { return headers[name.toLowerCase()] },
|
|
111
|
-
removeHeader(name) { delete headers[name.toLowerCase()] },
|
|
112
|
-
write(chunk) {
|
|
113
|
-
if (_ended) return
|
|
114
|
-
void writer.write(typeof chunk === 'string' ? encoder.encode(chunk) : chunk).catch(() => {})
|
|
115
|
-
},
|
|
116
|
-
end(chunk) {
|
|
117
|
-
if (_ended) return
|
|
118
|
-
_ended = true
|
|
119
|
-
if (chunk) void writer.write(typeof chunk === 'string' ? encoder.encode(chunk) : chunk).catch(() => {})
|
|
120
|
-
void writer.close().catch(() => {})
|
|
121
|
-
_resolve(new Response(readable, { status: res.statusCode, headers }))
|
|
122
|
-
},
|
|
123
|
-
// Helpers expected by API route handlers.
|
|
124
|
-
json(data) {
|
|
125
|
-
this.setHeader('Content-Type', 'application/json; charset=utf-8')
|
|
126
|
-
this.end(JSON.stringify(data))
|
|
127
|
-
},
|
|
128
|
-
status(code) { this.statusCode = code; return this },
|
|
129
|
-
get writableEnded() { return _ended },
|
|
130
|
-
}
|
|
131
|
-
return { res, promise }
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
export default async (webReq) => {
|
|
135
|
-
const url = new URL(webReq.url)
|
|
136
|
-
const urlPath = url.pathname
|
|
137
|
-
const method = webReq.method ?? 'GET'
|
|
138
|
-
|
|
139
|
-
// Convert to Node.js-style req/res upfront so server middleware can run.
|
|
140
|
-
const nodeReq = await toNodeRequest(webReq)
|
|
141
|
-
const { res, promise } = createNodeResponse()
|
|
142
|
-
|
|
143
|
-
// Run server middleware chain (auth, logging, CORS, etc.).
|
|
144
|
-
if (!(await runServerMiddleware(nodeReq, res))) return promise
|
|
145
|
-
|
|
146
|
-
// Route /api/* requests to the API handlers exported by the server bundle.
|
|
147
|
-
if (urlPath.startsWith('/api/')) {
|
|
148
|
-
for (const route of (apiRoutes ?? [])) {
|
|
149
|
-
const params = matchApiPattern(route.path, urlPath)
|
|
150
|
-
if (params !== null) {
|
|
151
|
-
nodeReq.params = params
|
|
152
|
-
const fn = route.handlers[method.toLowerCase()]
|
|
153
|
-
?? route.handlers[method.toUpperCase()]
|
|
154
|
-
?? route.handlers['default']
|
|
155
|
-
if (typeof fn === 'function') {
|
|
156
|
-
// Wrap in request context so useCookie / useSession work in API handlers.
|
|
157
|
-
runWithRequestContext(nodeReq, res, () => Promise.resolve(fn(nodeReq, res))).catch(() => {
|
|
158
|
-
if (!res.writableEnded) {
|
|
159
|
-
res.statusCode = 500
|
|
160
|
-
res.end(JSON.stringify({ error: 'Internal Server Error' }))
|
|
161
|
-
}
|
|
162
|
-
})
|
|
163
|
-
return promise
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
return new Response('Not Found', { status: 404 })
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
// All other requests: SSR (with ISR for routes that declare meta.ssg.revalidate).
|
|
171
|
-
isrHandler(nodeReq, res).catch(() => {
|
|
172
|
-
if (!res.writableEnded) {
|
|
173
|
-
res.statusCode = 500
|
|
174
|
-
res.end('Internal Server Error')
|
|
175
|
-
}
|
|
176
|
-
})
|
|
177
|
-
return promise
|
|
178
|
-
}
|
|
49
|
+
import { EventEmitter } from 'node:events'
|
|
50
|
+
import { readFileSync } from 'node:fs'
|
|
51
|
+
import * as app from '../../dist/server/server.js'
|
|
52
|
+
${nodeDispatcherSource(distDir, '../../dist/')}
|
|
53
|
+
${WEB_BRIDGE}
|
|
54
|
+
export default async (webReq) => handleRequest(webReq, dispatchRequest)
|
|
179
55
|
`;
|
|
56
|
+
}
|
|
180
57
|
// ─── Public API ───────────────────────────────────────────────────────────────
|
|
181
58
|
export async function runNetlifyAdapter(root) {
|
|
182
59
|
const distDir = join(root, 'dist');
|
|
183
60
|
if (!existsSync(distDir)) {
|
|
184
61
|
throw new Error(`[cer-app] No dist/ directory found at ${distDir}. Run 'cer-app build' first.`);
|
|
185
62
|
}
|
|
186
|
-
const
|
|
187
|
-
const ssgManifest = join(distDir, 'ssg-manifest.json');
|
|
188
|
-
const isSSR = existsSync(serverBundle) && !existsSync(ssgManifest);
|
|
63
|
+
const isSSR = requiresServer(distDir);
|
|
189
64
|
if (isSSR) {
|
|
190
65
|
_buildSSR(root, distDir);
|
|
191
66
|
}
|
|
@@ -207,7 +82,7 @@ function _buildSSR(root, distDir) {
|
|
|
207
82
|
// Write the SSR bridge function.
|
|
208
83
|
const functionsDir = join(root, 'netlify/functions');
|
|
209
84
|
mkdirSync(functionsDir, { recursive: true });
|
|
210
|
-
writeFileSync(join(functionsDir, 'ssr.mjs'),
|
|
85
|
+
writeFileSync(join(functionsDir, 'ssr.mjs'), netlifyBridge(distDir));
|
|
211
86
|
// Build the static publish directory with assets only (no HTML).
|
|
212
87
|
// Netlify serves files in the publish directory as static responses first.
|
|
213
88
|
// By omitting index.html we ensure all HTML routes fall through to the
|
|
@@ -217,6 +92,7 @@ function _buildSSR(root, distDir) {
|
|
|
217
92
|
rmSync(publishDir, { recursive: true, force: true });
|
|
218
93
|
}
|
|
219
94
|
_copyClientAssets(join(distDir, 'client'), publishDir);
|
|
95
|
+
copyGeneratedPublicFiles(distDir, publishDir);
|
|
220
96
|
// netlify.toml: publish directory + cache headers + catch-all to SSR function.
|
|
221
97
|
writeFileSync(join(root, 'netlify.toml'), `# Auto-generated by @jasonshimmy/vite-plugin-cer-app — do not edit.
|
|
222
98
|
[build]
|
|
@@ -238,7 +114,7 @@ function _buildStatic(root, distDir) {
|
|
|
238
114
|
const clientDir = join(distDir, 'client');
|
|
239
115
|
const isSsg = existsSync(join(distDir, 'ssg-manifest.json'));
|
|
240
116
|
let publishDir;
|
|
241
|
-
if (existsSync(clientDir)) {
|
|
117
|
+
if (existsSync(clientDir) || isSsg) {
|
|
242
118
|
// SSG: HTML in dist/, assets in dist/client/. Merge into .netlify/publish/.
|
|
243
119
|
publishDir = join(root, '.netlify/publish');
|
|
244
120
|
if (existsSync(publishDir)) {
|
|
@@ -247,7 +123,7 @@ function _buildStatic(root, distDir) {
|
|
|
247
123
|
// Copy pre-rendered HTML from dist/ (skip client/ sub-dir and manifest).
|
|
248
124
|
cpSync(distDir, publishDir, {
|
|
249
125
|
recursive: true,
|
|
250
|
-
filter: (src) =>
|
|
126
|
+
filter: (src) => isPublicBuildFile(distDir, src),
|
|
251
127
|
});
|
|
252
128
|
// Copy assets from dist/client/ into the publish root.
|
|
253
129
|
_copyClientAssets(clientDir, publishDir);
|
|
@@ -269,7 +145,7 @@ function _buildStatic(root, distDir) {
|
|
|
269
145
|
|
|
270
146
|
[[redirects]]
|
|
271
147
|
from = "/*"
|
|
272
|
-
to = "/index.html"
|
|
148
|
+
to = "${isSsg ? "/404.html" : "/index.html"}"
|
|
273
149
|
status = ${isSsg ? 404 : 200}
|
|
274
150
|
`);
|
|
275
151
|
}
|
|
@@ -284,7 +160,7 @@ function _copyClientAssets(clientDir, destDir) {
|
|
|
284
160
|
return;
|
|
285
161
|
mkdirSync(destDir, { recursive: true });
|
|
286
162
|
for (const entry of readdirSync(clientDir)) {
|
|
287
|
-
if (entry === 'index.html')
|
|
163
|
+
if (entry === 'index.html' || entry === '.vite')
|
|
288
164
|
continue;
|
|
289
165
|
const src = join(clientDir, entry);
|
|
290
166
|
const dest = join(destDir, entry);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"netlify.js","sourceRoot":"","sources":["../../../src/cli/adapters/netlify.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"netlify.js","sourceRoot":"","sources":["../../../src/cli/adapters/netlify.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AAC5B,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAA;AACxH,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EACL,UAAU,EACV,SAAS,EACT,aAAa,EACb,YAAY,EACZ,MAAM,EACN,WAAW,EACX,QAAQ,EACR,MAAM,GACP,MAAM,SAAS,CAAA;AAEhB,gFAAgF;AAEhF;;;;;;;;;;;;;;GAcG;AACH,SAAS,aAAa,CAAC,OAAe;IACpC,OAAO;;;;;EAKP,oBAAoB,CAAC,OAAO,EAAE,aAAa,CAAC;EAC5C,UAAU;;CAEX,CAAA;AACD,CAAC;AAED,iFAAiF;AAEjF,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,IAAY;IAClD,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;IAClC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CACb,yCAAyC,OAAO,8BAA8B,CAC/E,CAAA;IACH,CAAC;IAED,MAAM,KAAK,GAAG,cAAc,CAAC,OAAO,CAAC,CAAA;IAErC,IAAI,K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,WAAW,CAAC,CAAC,CAAC,aAAa;aAChC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG;CAC7B,CACE,CAAA;AACH,CAAC;AAED,iFAAiF;AAEjF;;;;GAIG;AACH,SAAS,iBAAiB,CAAC,SAAiB,EAAE,OAAe;IAC3D,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC;QAAE,OAAM;IAClC,SAAS,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;IACvC,KAAK,MAAM,KAAK,IAAI,WAAW,CAAC,SAAS,CAAC,EAAE,CAAC;QAC3C,IAAI,KAAK,KAAK,YAAY,IAAI,KAAK,KAAK,OAAO;YAAE,SAAQ;QACzD,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,CAAA;QAClC,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;QACjC,IAAI,QAAQ,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC;YAChC,MAAM,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;QACxC,CAAC;aAAM,CAAC;YACN,YAAY,CAAC,GAAG,EAAE,IAAI,CAAC,CAAA;QACzB,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -5,12 +5,11 @@
|
|
|
5
5
|
* that can be deployed with `vercel deploy --prebuilt`.
|
|
6
6
|
*
|
|
7
7
|
* SSR mode:
|
|
8
|
-
* -
|
|
8
|
+
* - Bundles the server graph into a Vercel Serverless Function
|
|
9
9
|
* - Copies dist/client/index.html alongside the server bundle so the
|
|
10
10
|
* `../client/index.html` relative path in the bundle resolves correctly
|
|
11
11
|
* - Copies content-hashed assets to .vercel/output/static/ for CDN delivery
|
|
12
|
-
* - Writes a launcher (index.js) that
|
|
13
|
-
* forwards all other requests to the SSR handler
|
|
12
|
+
* - Writes a launcher (index.js) that exports the shared server dispatcher
|
|
14
13
|
*
|
|
15
14
|
* SPA/SSG mode:
|
|
16
15
|
* - Copies all static files to .vercel/output/static/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vercel.d.ts","sourceRoot":"","sources":["../../../src/cli/adapters/vercel.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"vercel.d.ts","sourceRoot":"","sources":["../../../src/cli/adapters/vercel.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAsCH,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA0BlE"}
|
|
@@ -5,18 +5,19 @@
|
|
|
5
5
|
* that can be deployed with `vercel deploy --prebuilt`.
|
|
6
6
|
*
|
|
7
7
|
* SSR mode:
|
|
8
|
-
* -
|
|
8
|
+
* - Bundles the server graph into a Vercel Serverless Function
|
|
9
9
|
* - Copies dist/client/index.html alongside the server bundle so the
|
|
10
10
|
* `../client/index.html` relative path in the bundle resolves correctly
|
|
11
11
|
* - Copies content-hashed assets to .vercel/output/static/ for CDN delivery
|
|
12
|
-
* - Writes a launcher (index.js) that
|
|
13
|
-
* forwards all other requests to the SSR handler
|
|
12
|
+
* - Writes a launcher (index.js) that exports the shared server dispatcher
|
|
14
13
|
*
|
|
15
14
|
* SPA/SSG mode:
|
|
16
15
|
* - Copies all static files to .vercel/output/static/
|
|
17
16
|
* - Writes a config.json with SPA fallback (serve index.html for unknown paths)
|
|
18
17
|
*/
|
|
19
18
|
import { join } from 'pathe';
|
|
19
|
+
import { build } from 'vite';
|
|
20
|
+
import { requiresServer, isPublicBuildFile, nodeDispatcherSource, copyPrerenderedDocuments, copyGeneratedPublicFiles } from './deployment-mode.js';
|
|
20
21
|
import { existsSync, mkdirSync, writeFileSync, copyFileSync, cpSync, readdirSync, statSync, rmSync, } from 'node:fs';
|
|
21
22
|
// ─── Launcher template ────────────────────────────────────────────────────────
|
|
22
23
|
/**
|
|
@@ -28,111 +29,21 @@ import { existsSync, mkdirSync, writeFileSync, copyFileSync, cpSync, readdirSync
|
|
|
28
29
|
* reference resolves to ./client/index.html — both files are copied into the
|
|
29
30
|
* function directory by the adapter.
|
|
30
31
|
*/
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
import {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const up = urlPath.split('/')
|
|
38
|
-
if (pp.length !== up.length) return null
|
|
39
|
-
const params = {}
|
|
40
|
-
for (let i = 0; i < pp.length; i++) {
|
|
41
|
-
if (pp[i].startsWith(':')) params[pp[i].slice(1)] = decodeURIComponent(up[i])
|
|
42
|
-
else if (pp[i] !== up[i]) return null
|
|
43
|
-
}
|
|
44
|
-
return params
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function parseQuery(url) {
|
|
48
|
-
const qIndex = url.indexOf('?')
|
|
49
|
-
if (qIndex === -1) return {}
|
|
50
|
-
const qs = url.slice(qIndex + 1)
|
|
51
|
-
const result = {}
|
|
52
|
-
for (const part of qs.split('&')) {
|
|
53
|
-
if (!part) continue
|
|
54
|
-
const eqIdx = part.indexOf('=')
|
|
55
|
-
if (eqIdx === -1) result[decodeURIComponent(part)] = ''
|
|
56
|
-
else result[decodeURIComponent(part.slice(0, eqIdx))] = decodeURIComponent(part.slice(eqIdx + 1))
|
|
57
|
-
}
|
|
58
|
-
return result
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
async function readBody(req) {
|
|
62
|
-
return new Promise((resolve, reject) => {
|
|
63
|
-
const chunks = []
|
|
64
|
-
req.on('data', chunk => chunks.push(Buffer.from(chunk)))
|
|
65
|
-
req.on('end', () => resolve(Buffer.concat(chunks)))
|
|
66
|
-
req.on('error', reject)
|
|
67
|
-
})
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
async function parseBody(req) {
|
|
71
|
-
const contentType = req.headers['content-type'] ?? ''
|
|
72
|
-
const method = req.method?.toUpperCase() ?? 'GET'
|
|
73
|
-
if (!['POST', 'PUT', 'PATCH'].includes(method)) return undefined
|
|
74
|
-
const buf = await readBody(req)
|
|
75
|
-
if (contentType.includes('application/json')) {
|
|
76
|
-
try { return JSON.parse(buf.toString('utf-8')) } catch { return undefined }
|
|
77
|
-
}
|
|
78
|
-
return buf
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export default async function cerAppHandler(req, res) {
|
|
82
|
-
// Run server middleware chain (auth, logging, CORS, etc.).
|
|
83
|
-
if (!(await runServerMiddleware(req, res))) return
|
|
84
|
-
|
|
85
|
-
const urlPath = (req.url ?? '/').split('?')[0]
|
|
86
|
-
const method = req.method ?? 'GET'
|
|
87
|
-
|
|
88
|
-
// Route /api/* to API handlers exported by the server bundle.
|
|
89
|
-
if (urlPath.startsWith('/api/')) {
|
|
90
|
-
for (const route of (apiRoutes ?? [])) {
|
|
91
|
-
const params = matchApiPattern(route.path, urlPath)
|
|
92
|
-
if (params !== null) {
|
|
93
|
-
req.params = params
|
|
94
|
-
req.query = parseQuery(req.url ?? '/')
|
|
95
|
-
req.body = await parseBody(req)
|
|
96
|
-
res.json = function (data) {
|
|
97
|
-
this.setHeader('Content-Type', 'application/json; charset=utf-8')
|
|
98
|
-
this.end(JSON.stringify(data))
|
|
99
|
-
}
|
|
100
|
-
res.status = function (code) { this.statusCode = code; return this }
|
|
101
|
-
const fn = route.handlers[method.toLowerCase()]
|
|
102
|
-
?? route.handlers[method.toUpperCase()]
|
|
103
|
-
?? route.handlers['default']
|
|
104
|
-
if (typeof fn === 'function') {
|
|
105
|
-
try {
|
|
106
|
-
await runWithRequestContext(req, res, () => Promise.resolve(fn(req, res)))
|
|
107
|
-
} catch {
|
|
108
|
-
if (!res.writableEnded) {
|
|
109
|
-
res.statusCode = 500
|
|
110
|
-
res.setHeader('Content-Type', 'application/json')
|
|
111
|
-
res.end(JSON.stringify({ error: 'Internal Server Error' }))
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
return
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
res.statusCode = 404
|
|
119
|
-
res.end('Not Found')
|
|
120
|
-
return
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
// All other requests: SSR (with ISR for routes that declare meta.ssg.revalidate).
|
|
124
|
-
await isrHandler(req, res)
|
|
125
|
-
}
|
|
32
|
+
function vercelLauncher(distDir) {
|
|
33
|
+
return `// Auto-generated by @jasonshimmy/vite-plugin-cer-app — do not edit.
|
|
34
|
+
import { readFileSync } from 'node:fs'
|
|
35
|
+
import * as app from './server/server.js'
|
|
36
|
+
${nodeDispatcherSource(distDir, './prerendered/')}
|
|
37
|
+
export default dispatchRequest
|
|
126
38
|
`;
|
|
39
|
+
}
|
|
127
40
|
// ─── Public API ───────────────────────────────────────────────────────────────
|
|
128
41
|
export async function runVercelAdapter(root) {
|
|
129
42
|
const distDir = join(root, 'dist');
|
|
130
43
|
if (!existsSync(distDir)) {
|
|
131
44
|
throw new Error(`[cer-app] No dist/ directory found at ${distDir}. Run 'cer-app build' first.`);
|
|
132
45
|
}
|
|
133
|
-
const
|
|
134
|
-
const ssgManifest = join(distDir, 'ssg-manifest.json');
|
|
135
|
-
const isSSR = existsSync(serverBundle) && !existsSync(ssgManifest);
|
|
46
|
+
const isSSR = requiresServer(distDir);
|
|
136
47
|
const outDir = join(root, '.vercel/output');
|
|
137
48
|
// Clean existing Vercel output to avoid stale files.
|
|
138
49
|
if (existsSync(outDir)) {
|
|
@@ -140,7 +51,7 @@ export async function runVercelAdapter(root) {
|
|
|
140
51
|
}
|
|
141
52
|
mkdirSync(outDir, { recursive: true });
|
|
142
53
|
if (isSSR) {
|
|
143
|
-
_buildSSR(distDir, outDir);
|
|
54
|
+
await _buildSSR(distDir, outDir);
|
|
144
55
|
}
|
|
145
56
|
else {
|
|
146
57
|
_buildStatic(distDir, outDir);
|
|
@@ -149,33 +60,45 @@ export async function runVercelAdapter(root) {
|
|
|
149
60
|
console.log(' Deploy with: vercel deploy --prebuilt');
|
|
150
61
|
}
|
|
151
62
|
// ─── SSR output ───────────────────────────────────────────────────────────────
|
|
152
|
-
function _buildSSR(distDir, outDir) {
|
|
63
|
+
async function _buildSSR(distDir, outDir) {
|
|
153
64
|
const funcDir = join(outDir, 'functions/index.func');
|
|
154
65
|
// Maintain the server/ → ../client/ relative layout so the server bundle's
|
|
155
66
|
// built-in `../client/index.html` reference resolves correctly.
|
|
156
67
|
mkdirSync(join(funcDir, 'server'), { recursive: true });
|
|
157
68
|
mkdirSync(join(funcDir, 'client'), { recursive: true });
|
|
158
|
-
//
|
|
159
|
-
|
|
69
|
+
// Vercel's prebuilt output does not install dependencies or trace chunks.
|
|
70
|
+
// Bundle the complete server graph (including external CER libraries) once
|
|
71
|
+
// so the function is portable and all registrations share one runtime.
|
|
72
|
+
await build({
|
|
73
|
+
root: join(distDir, '..'), configFile: false, logLevel: 'error',
|
|
74
|
+
ssr: { noExternal: true },
|
|
75
|
+
build: {
|
|
76
|
+
ssr: join(distDir, 'server/server.js'), outDir: join(funcDir, 'server'),
|
|
77
|
+
target: 'node24', minify: false,
|
|
78
|
+
rollupOptions: { output: { entryFileNames: 'server.js' } },
|
|
79
|
+
},
|
|
80
|
+
});
|
|
160
81
|
// Client HTML template (referenced as ../client/index.html from server.js).
|
|
161
82
|
const clientHtml = join(distDir, 'client/index.html');
|
|
162
83
|
if (existsSync(clientHtml)) {
|
|
163
84
|
copyFileSync(clientHtml, join(funcDir, 'client/index.html'));
|
|
164
85
|
}
|
|
165
86
|
// Launcher: routes API requests + forwards the rest to the SSR handler.
|
|
166
|
-
|
|
87
|
+
copyPrerenderedDocuments(distDir, join(funcDir, 'prerendered'));
|
|
88
|
+
writeFileSync(join(funcDir, 'index.js'), vercelLauncher(distDir));
|
|
167
89
|
// package.json: mark the function directory as ESM so Node.js treats .js
|
|
168
90
|
// files as ES modules (the server bundle uses import.meta.url, etc.).
|
|
169
91
|
writeFileSync(join(funcDir, 'package.json'), '{"type":"module"}\n');
|
|
170
92
|
// Vercel function config.
|
|
171
93
|
writeFileSync(join(funcDir, '.vc-config.json'), JSON.stringify({
|
|
172
|
-
runtime: '
|
|
94
|
+
runtime: 'nodejs24.x',
|
|
173
95
|
handler: 'index.js',
|
|
174
96
|
launcherType: 'Nodejs',
|
|
175
97
|
}, null, 2) + '\n');
|
|
176
98
|
// Static assets: content-hashed files served by the Vercel CDN.
|
|
177
99
|
const staticDir = join(outDir, 'static');
|
|
178
100
|
_copyClientAssets(join(distDir, 'client'), staticDir);
|
|
101
|
+
copyGeneratedPublicFiles(distDir, staticDir);
|
|
179
102
|
// Vercel output routes config.
|
|
180
103
|
writeFileSync(join(outDir, 'config.json'), JSON.stringify({
|
|
181
104
|
version: 3,
|
|
@@ -205,7 +128,7 @@ function _buildStatic(distDir, outDir) {
|
|
|
205
128
|
// and ssg-manifest.json which are build artifacts, not deployable content.
|
|
206
129
|
cpSync(distDir, staticDir, {
|
|
207
130
|
recursive: true,
|
|
208
|
-
filter: (src) =>
|
|
131
|
+
filter: (src) => isPublicBuildFile(distDir, src),
|
|
209
132
|
});
|
|
210
133
|
// Copy assets and other non-HTML files from dist/client/ into static root
|
|
211
134
|
// so URLs like /assets/main.abc123.js resolve correctly.
|
|
@@ -213,7 +136,7 @@ function _buildStatic(distDir, outDir) {
|
|
|
213
136
|
}
|
|
214
137
|
else {
|
|
215
138
|
// SPA: everything is in dist/ at the correct paths already.
|
|
216
|
-
cpSync(distDir, staticDir, { recursive: true });
|
|
139
|
+
cpSync(distDir, staticDir, { recursive: true, filter: (src) => isPublicBuildFile(distDir, src) });
|
|
217
140
|
}
|
|
218
141
|
// Vercel output config: serve static files, fall back to index.html (SPA).
|
|
219
142
|
writeFileSync(join(outDir, 'config.json'), JSON.stringify({
|
|
@@ -226,7 +149,9 @@ function _buildStatic(distDir, outDir) {
|
|
|
226
149
|
},
|
|
227
150
|
{ handle: 'filesystem' },
|
|
228
151
|
// SPA fallback: serve index.html for any unmatched path.
|
|
229
|
-
|
|
152
|
+
existsSync(join(distDir, 'ssg-manifest.json'))
|
|
153
|
+
? { src: '/(.*)', dest: '/404.html', status: 404 }
|
|
154
|
+
: { src: '/(.*)', dest: '/index.html' },
|
|
230
155
|
],
|
|
231
156
|
}, null, 2) + '\n');
|
|
232
157
|
}
|
|
@@ -241,7 +166,7 @@ function _copyClientAssets(clientDir, destDir) {
|
|
|
241
166
|
return;
|
|
242
167
|
mkdirSync(destDir, { recursive: true });
|
|
243
168
|
for (const entry of readdirSync(clientDir)) {
|
|
244
|
-
if (entry === 'index.html')
|
|
169
|
+
if (entry === 'index.html' || entry === '.vite')
|
|
245
170
|
continue; // served by function / SSG HTML
|
|
246
171
|
const src = join(clientDir, entry);
|
|
247
172
|
const dest = join(destDir, entry);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vercel.js","sourceRoot":"","sources":["../../../src/cli/adapters/vercel.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"vercel.js","sourceRoot":"","sources":["../../../src/cli/adapters/vercel.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AAC5B,OAAO,EAAE,KAAK,EAAE,MAAM,MAAM,CAAA;AAC5B,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAA;AAClJ,OAAO,EACL,UAAU,EACV,SAAS,EACT,aAAa,EACb,YAAY,EACZ,MAAM,EACN,WAAW,EACX,QAAQ,EACR,MAAM,GACP,MAAM,SAAS,CAAA;AAEhB,iFAAiF;AAEjF;;;;;;;;GAQG;AACH,SAAS,cAAc,CAAC,OAAe;IACrC,OAAO;;;EAGP,oBAAoB,CAAC,OAAO,EAAE,gBAAgB,CAAC;;CAEhD,CAAA;AACD,CAAC;AAED,iFAAiF;AAEjF,MAAM,CAAC,KAAK,UAAU,gBAAgB,CA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