-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
fix(adapter-netlify)!: write output conforming to Netlify Frameworks API #15294
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
teemingc
merged 33 commits into
sveltejs:version-3
from
serhalp:refactor/netlify-frameworks-api
Feb 20, 2026
Merged
Changes from 17 commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
35e8762
refactor!: migrate to the modern Netlify Functions API
serhalp 0d14399
there are no unit tests anymore
teemingc 324129f
chore: better changesets
serhalp 312d3bf
fix: exclude special .netlify/ path from generated function
serhalp 3f81780
Apply suggestion from @benmccann
teemingc 600efd1
Apply suggestion from @benmccann
teemingc afa9a10
Merge branch 'main' into refactor/netlify-functions-v2
teemingc 4d06096
add ambient types
teemingc ed8bc9d
bump peer version of kit
teemingc 01184a9
chores
teemingc 12234c9
fix: use modern, documented Netlify Frameworks API
serhalp 85e7010
refactor: extract utils from adapter-netlify/index.js
serhalp 47cac99
test: add some unit tests for adapter-netlify utils
serhalp 45348b4
Revert "there are no unit tests anymore"
serhalp 278ab1c
chore: add changeset
serhalp 7039e2e
fix: fix bad rebase
serhalp ca0a9eb
Merge branch 'main' into refactor/netlify-frameworks-api
teemingc c6bbe95
Merge branch 'main' into refactor/netlify-frameworks-api
teemingc f5b01e3
Merge branch 'main' into refactor/netlify-frameworks-api
serhalp e29d240
Apply suggestions from code review
serhalp 2d31712
Merge branch 'main' into refactor/netlify-frameworks-api
teemingc 832c45a
Merge branch 'main' into refactor/netlify-frameworks-api
teemingc e21558e
Merge branch 'main' into refactor/netlify-frameworks-api
teemingc 2f22b89
fix tests
teemingc 12164d9
Merge branch 'refactor/netlify-frameworks-api' of https://github.com/…
teemingc be919e6
Merge branch 'main' into refactor/netlify-frameworks-api
teemingc 9871ba2
fix lockfile
teemingc 03faae0
Merge branch 'main' into refactor/netlify-frameworks-api
teemingc c3db1e4
fix split test app
teemingc 4cc45b5
Merge branch 'main' into refactor/netlify-frameworks-api
teemingc 0250cbe
Update netlify.toml
teemingc 34064f6
Update netlify.toml
teemingc 74f639b
Add TODO comment for Netlify dev plugin issue
teemingc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,7 @@ | ||
| --- | ||
| '@sveltejs/adapter-netlify': major | ||
| --- | ||
|
|
||
| Write output that conforms to the stable [Netlify Frameworks API](https://docs.netlify.com/build/frameworks/frameworks-api/). | ||
|
|
||
| POTENTIALLY BREAKING CHANGE: Deploying and previewing with Netlify CLI now requires [v17.31.0](https://github.com/netlify/cli/releases/tag/v17.31.0) or later. `npm i -g netlify-cli@latest` to upgrade. | ||
|
serhalp marked this conversation as resolved.
Outdated
|
||
This file contains hidden or 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
2 changes: 1 addition & 1 deletion
2
packages/adapter-netlify/test/apps/basic/netlify/functions/render.mjs
This file contains hidden or 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 hidden or 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,70 @@ | ||
| import { resolve } from 'node:path'; | ||
| import process from 'node:process'; | ||
|
|
||
| /** | ||
| * @typedef {{ rest: boolean, dynamic: boolean, content: string }} RouteSegment | ||
| */ | ||
|
|
||
| /** | ||
| * @typedef {{ | ||
| * build?: { publish?: string } | ||
| * functions?: { node_bundler?: 'zisi' | 'esbuild' } | ||
| * }} NetlifyConfig | ||
| */ | ||
|
|
||
| /** | ||
| * @param {RouteSegment[]} a | ||
| * @param {RouteSegment[]} b | ||
| * @returns {boolean} | ||
| */ | ||
| export function matches(a, b) { | ||
| if (a[0] && b[0]) { | ||
| if (b[0].rest) { | ||
| if (b.length === 1) return true; | ||
|
|
||
| const next_b = b.slice(1); | ||
|
|
||
| for (let i = 0; i < a.length; i += 1) { | ||
| if (matches(a.slice(i), next_b)) return true; | ||
| } | ||
|
|
||
| return false; | ||
| } | ||
|
|
||
| if (!b[0].dynamic) { | ||
| if (!a[0].dynamic && a[0].content !== b[0].content) return false; | ||
| } | ||
|
|
||
| if (a.length === 1 && b.length === 1) return true; | ||
| return matches(a.slice(1), b.slice(1)); | ||
| } else if (a[0]) { | ||
| return a.length === 1 && a[0].rest; | ||
| } else { | ||
| return b.length === 1 && b[0].rest; | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * @param {NetlifyConfig | null} netlify_config | ||
| * @param {import('@sveltejs/kit').Builder} builder | ||
| * @returns {string | undefined} | ||
| */ | ||
| export function get_publish_directory(netlify_config, builder) { | ||
| if (netlify_config) { | ||
| if (!netlify_config.build?.publish) { | ||
| builder.log.minor('No publish directory specified in netlify.toml, using default'); | ||
| return; | ||
| } | ||
|
|
||
| if (resolve(netlify_config.build.publish) === process.cwd()) { | ||
| throw new Error( | ||
| 'The publish directory cannot be set to the site root. Please change it to another value such as "build" in netlify.toml.' | ||
| ); | ||
| } | ||
| return netlify_config.build.publish; | ||
| } | ||
|
|
||
| builder.log.warn( | ||
| 'No netlify.toml found. Using default publish directory. Consult https://svelte.dev/docs/kit/adapter-netlify#usage for more details' | ||
| ); | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.