feat: built-in +server support (via Universal Deploy, deprecating vike-photon)#3106
feat: built-in +server support (via Universal Deploy, deprecating vike-photon)#3106
vike-photon)#3106Conversation
packages/vike/src/server/runtime/renderPageServer/createHttpResponse.ts
Outdated
Show resolved
Hide resolved
What's the scope of the current state? Asking because I ain't sure what is temporary or not. |
|
It's feature complete. So the only temporary thing is the remaining TODO comment regarding |
|
E.g. the I guess the goal is to have to distinct response types, either:
I think we can either return only 1 or only 2. Not sure whether returning both would make sense. |
|
Actually, I'm realizing maybe it could make sense: using UM internally to add support for +middlewares with all the current |
packages/vike/src/server/runtime/renderPageServer/createHttpResponse.ts
Outdated
Show resolved
Hide resolved
6238f15 to
560107a
Compare
cdbf593 to
234f499
Compare
|
FYI did some minor refactoring 234f499 — should be equivalent. Bonus: the PR diff is now a lot more readable. |
|
Let me do a final round of reviewing and then I'm good on my side. |
packages/vike/src/server/runtime/renderPageServer/createHttpResponse.ts
Outdated
Show resolved
Hide resolved
|
LGTM (except #3106 (comment)) |
c109c93 to
6767498
Compare
vike-photon features (via Universal Deploy)
# Conflicts: # packages/vike/package.json # pnpm-lock.yaml
# Conflicts: # pnpm-lock.yaml
|
Since last review:
|
|
I'm also creating |
|
So |
|
Even though most frameworks won't use it, I guess it'd sill useful to document |
What does it mean? |
They don't sound that optional.
So these deployment plugins expect a single entry (a single fetch handler) whereas the framework can defines multiple entries (fetch handlers, via In Vike's case, it's only required if the user doesn't define |
|
👍 I wonder what I wonder if we can/should make it completely zero-config. AFAICT it's possible, but not sure if it's what we want. I'll think about it. What I mean with completely zero-config: import universalDeploy from '@universal-deploy/vite'
function pluginUniversalDeploy(vikeConfig: VikeConfigInternal): Plugin | null {
if (hasVikeServerOrVikePhoton(vikeConfig)) return null
return (
// That's it: a single plugin that takes care of it all
universalDeploy({
// UD entries can be passed via this parameter => no need to import @universal-deploy/store
entries: [
...getPageEntries(),
// Default catch-all route
{
id: serverEntryVike,
route: '/**',
// If `serverEntryVike` is the path of +server.js
isFilesystemPath: true // => UD implements the `resolveId()` hook
}
],
prependToGlobalEntry: `import "${vikeVirtualEntry}";`,
})
)
} |
I'm trying to find a solution for that 🤔. It's currently used to help resolve EDIT: found a solution :) |
I like it and IMO we should do it, with one exception: I think entries should still be added via WDYT? |
|
Am I understanding it correctly that Netlify/Fastly/EdgeOne adopting UD simply means using // node_modules/@{netlify,fastly,edgeone}/vite
// The only UD dependency:
import { store } from '@universal-deploy/store'
// The only API used by Vite deployment plugins:
store.entries.forEach(entry => { /* ... */ })Or am I missing something? |
|
How about: - virtual:ud:catch-all
+ virtual:global-entry |
TODO doc
test/vite-plugin-verceltests