-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
feat(site-2): Fully remove api.svelte.dev #8432
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
}); | ||
} | ||
const components = process_example( | ||
getContext('repl_widget_examples').find(({ id }) => id === example).files |
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.
getContext
could be called outside of component initialization here, I suggest to move the context retrieval part out to the top level.
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.
Done!
I hope this pull request is applied or better saying merged because, To have to set up the backend and frontend to serve the official content |
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.
this is going to make life so much easier! left some comments inline
sites/svelte.dev/svelte.config.js
Outdated
/** @returns {('*' | `/${string}`)[]} */ | ||
function replJsonEntries() { | ||
// @ts-ignore | ||
return get_examples_list( | ||
get_examples_data(new URL('../../site/content/examples', import.meta.url).pathname) | ||
).flatMap(({ examples }) => examples.map(({ slug }) => `/repl/${slug}.json`)); | ||
} | ||
|
||
/** @returns {('*' | `/${string}`)[]} */ | ||
function tutorialEntries() { | ||
// @ts-ignore | ||
return get_tutorial_list( | ||
get_tutorial_data(new URL('../../site/content/tutorial', import.meta.url).pathname) | ||
).flatMap(({ tutorials }) => tutorials.map(({ slug }) => `/tutorial/${slug}`)); | ||
} |
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.
note that elliott is working on a more idiomatic approach to this which we'll be able to use soon instead of this sveltejs/kit#9571
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.
That would make things so much easier 🤩! The second that feature is released I'll move the code to that
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.
@Rich-Harris you're right, the approach used in sveltejs/kit#9571 is much easier to understand.
Co-authored-by: Rich Harris <richard.a.harris@gmail.com>
This makes FAQ and REPLWidget independent of api.svelte.dev. No more external API requests