Commit b4169a3
feat(astro): bundle SSR with esbuild + drop /* catchall + colocate manifest
Three coordinated fixes that align @run402/astro/release-slice with the
gateway's actual contract (Kychon's adoption of v1.1.0 surfaced the gaps):
1) SSR bundling (gateway rejects multi-file specs).
The helper previously emitted functions.replace.<name>.{files,entrypoint}
pointing at the multi-file Astro server output. The gateway hard-rejects
that shape with "multi-file function spec (files + entrypoint) is not
yet supported by the gateway; bundle locally with esbuild and pass
`source` instead". New src/ssr-bundler.ts wraps esbuild with the right
defaults (target node22, ESM, externalize Node built-ins +
@run402/functions) and returns a bundled ESM string. release-slice
emits source: <bundled string> instead.
2) Drop /* catchall + drop static aliases (gateway auto-fallback).
The gateway's v1.52 ssr-fallback (run402-private commit 22bf0059)
routes every unmatched-path request to the project's single class:'ssr'
function automatically. The helper no longer needs to declare a /*
catchall (route validator rejected it as "prefix wildcard must include
a path segment before /*") and no longer emits static aliases for
prerendered routes (the implicit public-paths mode handles them via
the static manifest, and dual declarations were conflicting at /).
3) _assets-manifest.json colocated with the resolved client dir.
The integration's vite plugin wrote dist/_assets-manifest.json at
top-level, but the adapter relocates build.client to
dist/run402/client/. The release slice's site.replace dir then didn't
carry the manifest, triggering
site.public_paths.inherited./_assets-manifest.json missing-asset
rejections from the gateway. Fix: astro:config:done hook reads the
final build.client and writes the manifest inside it. Universally
correct — without an adapter, build.client defaults to dist/.
Plus dep: esbuild as a direct dependency (regular dep, not peer, since
bundling is a hard requirement for the helper to produce gateway-valid
specs).
Plus tests: 11 unit tests rewritten for the v1.2 contract (source-only
function shape, empty routes, cacheClass=>explicit public_paths). 244
astro tests / 11 release-slice tests all pass. End-to-end smoke against
api.run402.com confirms the gateway accepts the new slice shape (gets
past validation to plan phase).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent d129043 commit b4169a3
6 files changed
Lines changed: 765 additions & 140 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
90 | 93 | | |
91 | 94 | | |
92 | 95 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
69 | 79 | | |
70 | 80 | | |
71 | 81 | | |
| |||
121 | 131 | | |
122 | 132 | | |
123 | 133 | | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
124 | 141 | | |
125 | 142 | | |
126 | 143 | | |
| |||
131 | 148 | | |
132 | 149 | | |
133 | 150 | | |
134 | | - | |
| 151 | + | |
135 | 152 | | |
136 | 153 | | |
137 | 154 | | |
| |||
145 | 162 | | |
146 | 163 | | |
147 | 164 | | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
148 | 171 | | |
149 | 172 | | |
150 | 173 | | |
| |||
164 | 187 | | |
165 | 188 | | |
166 | 189 | | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
167 | 212 | | |
168 | 213 | | |
169 | 214 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
25 | 31 | | |
26 | 32 | | |
27 | 33 | | |
| |||
122 | 128 | | |
123 | 129 | | |
124 | 130 | | |
125 | | - | |
| 131 | + | |
126 | 132 | | |
127 | 133 | | |
128 | 134 | | |
| |||
131 | 137 | | |
132 | 138 | | |
133 | 139 | | |
134 | | - | |
| 140 | + | |
135 | 141 | | |
136 | 142 | | |
137 | 143 | | |
| |||
142 | 148 | | |
143 | 149 | | |
144 | 150 | | |
145 | | - | |
| 151 | + | |
146 | 152 | | |
147 | 153 | | |
148 | 154 | | |
149 | 155 | | |
150 | 156 | | |
151 | 157 | | |
152 | 158 | | |
153 | | - | |
| 159 | + | |
154 | 160 | | |
155 | 161 | | |
156 | 162 | | |
157 | 163 | | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
162 | 168 | | |
163 | 169 | | |
164 | | - | |
165 | | - | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
166 | 182 | | |
167 | 183 | | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
234 | 190 | | |
235 | 191 | | |
236 | | - | |
| 192 | + | |
237 | 193 | | |
238 | 194 | | |
239 | 195 | | |
240 | | - | |
241 | | - | |
242 | | - | |
| 196 | + | |
243 | 197 | | |
244 | 198 | | |
245 | | - | |
| 199 | + | |
246 | 200 | | |
247 | 201 | | |
248 | 202 | | |
| |||
264 | 218 | | |
265 | 219 | | |
266 | 220 | | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
267 | 231 | | |
268 | 232 | | |
269 | 233 | | |
| |||
294 | 258 | | |
295 | 259 | | |
296 | 260 | | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
297 | 275 | | |
0 commit comments