-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make sure shared bundles across API routes and SSR pages get included…
… in adapter upload bundles (#1149)
- Loading branch information
1 parent
28f0ed4
commit a7b18b3
Showing
6 changed files
with
113 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
packages/plugin-adapter-netlify/test/cases/build.default/src/api/search.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { renderFromHTML } from 'wc-compiler'; | ||
import { getArtists } from '../services/artists.js'; | ||
|
||
export async function handler(request) { | ||
const formData = await request.formData(); | ||
const term = formData.has('term') ? formData.get('term') : ''; | ||
const artists = (await getArtists()) | ||
.filter((artist) => { | ||
return term !== '' && artist.name.toLowerCase().includes(term.toLowerCase()); | ||
}); | ||
let body = ''; | ||
|
||
if (artists.length === 0) { | ||
body = 'No results found.'; | ||
} else { | ||
const { html } = await renderFromHTML(` | ||
${ | ||
artists.map((item, idx) => { | ||
const { name, imageUrl } = item; | ||
return ` | ||
<app-card | ||
title="${idx + 1}) ${name}" | ||
thumbnail="${imageUrl}" | ||
></app-card> | ||
`; | ||
}).join('') | ||
} | ||
`, [ | ||
new URL('../components/card.js', import.meta.url) | ||
]); | ||
|
||
body = html; | ||
} | ||
|
||
return new Response(body, { | ||
headers: new Headers({ | ||
'Content-Type': 'text/html' | ||
}) | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
packages/plugin-adapter-vercel/test/cases/build.default/src/api/search.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { renderFromHTML } from 'wc-compiler'; | ||
import { getArtists } from '../services/artists.js'; | ||
|
||
export async function handler(request) { | ||
const formData = await request.formData(); | ||
const term = formData.has('term') ? formData.get('term') : ''; | ||
const artists = (await getArtists()) | ||
.filter((artist) => { | ||
return term !== '' && artist.name.toLowerCase().includes(term.toLowerCase()); | ||
}); | ||
let body = ''; | ||
|
||
if (artists.length === 0) { | ||
body = 'No results found.'; | ||
} else { | ||
const { html } = await renderFromHTML(` | ||
${ | ||
artists.map((item, idx) => { | ||
const { name, imageUrl } = item; | ||
return ` | ||
<app-card | ||
title="${idx + 1}) ${name}" | ||
thumbnail="${imageUrl}" | ||
></app-card> | ||
`; | ||
}).join('') | ||
} | ||
`, [ | ||
new URL('../components/card.js', import.meta.url) | ||
]); | ||
|
||
body = html; | ||
} | ||
|
||
return new Response(body, { | ||
headers: new Headers({ | ||
'Content-Type': 'text/html' | ||
}) | ||
}); | ||
} |