-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
fix: correctly analyse exported endpoint methods during build #11019
Conversation
🦋 Changeset detectedLatest commit: 2145088 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
would it be too hard to add a test for this one? |
I guess I wasn't sure how to set one up. I can try to see if I can add an |
if (mod[method] && ENDPOINT_METHODS.has(method)) { | ||
api_methods.push(method); | ||
} else if (mod.fallback) { | ||
} else if (mod.fallback && key === 'fallback') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I think this would be equivalent and shorter?
} else if (mod.fallback && key === 'fallback') { | |
} else if (key === 'fallback') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it depends if we want to check the value of fallback
for truthiness. Is there a case (or is it even possible) where someone conditionally assigns a request handler to it?
e.g., export const fallback = dev ? requestHandler : undefined;
IIRC the history here is that the arc.codes adapter needed to know which methods existed on each route. It was complicated and no-one was actually using it so we stopped maintaining it long before SvelteKit went stable, but kept the metadata around. Not super valuable but probably not worth killing off either |
fixes #10984
Previously, the endpoint metadata would never be populated as described in the issue. However, I think it was only used in the Vercel adapter to fire off some warning
kit/packages/adapter-vercel/index.js
Lines 562 to 593 in 20d2fe7
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
Tests
pnpm test
and lint the project withpnpm lint
andpnpm check
Changesets
pnpm changeset
and following the prompts. Changesets that add features should beminor
and those that fix bugs should bepatch
. Please prefix changeset messages withfeat:
,fix:
, orchore:
.