Skip to content
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

Methods with _ prefix shouldn't be exported #685

Closed
Dan1ve opened this issue Jul 28, 2024 · 3 comments · Fixed by #687
Closed

Methods with _ prefix shouldn't be exported #685

Dan1ve opened this issue Jul 28, 2024 · 3 comments · Fixed by #687

Comments

@Dan1ve
Copy link
Contributor

Dan1ve commented Jul 28, 2024

Describe the bug

If you have a +server.ts endpoint that contains a "private" method like this:

export function _someMethod() {
 // ...
}

Note the _ prefix, which tells Sveltekit that this should act as a regular function, not an endpoint.

However, there will be a corresponding entry in the generated ROUTES file, which is unexpected IMHO.

Severity

annoyance

Steps to Reproduce the Bug

see above :)

Reproduction

No response

@jycouet
Copy link
Owner

jycouet commented Jul 28, 2024

Hummm, yes you are right, good catch 👍.

You want to fix it ? Or could you do a repro that I will use to add tests 😉

Thank you

Dan1ve added a commit to Dan1ve/kitql that referenced this issue Jul 28, 2024
@Dan1ve
Copy link
Contributor Author

Dan1ve commented Jul 28, 2024

Please see this PR: #687

I checked the tests but it wasn't immediately clear to me how the comparison (expected vs actual) is done.

jycouet added a commit that referenced this issue Jul 29, 2024
* #685 Don't export prefixed methods

* ✅ NEW: tests for underscore

* ✏️ UPDATE: changeset

---------

Co-authored-by: jycouet <[email protected]>
@Dan1ve
Copy link
Contributor Author

Dan1ve commented Aug 9, 2024

A bit late, but thanks a lot for the amazing response time and fix! 🥇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants