-
Notifications
You must be signed in to change notification settings - Fork 0
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
Refactor to use svelte.compile and svelte.preprocess #50
Comments
Something big to consider is that the EDIT: actually, I don't think this will be an issue, because the modules won't actually be imported, but re-compiled each time using their file contents as the |
In order to get svelte-process goodness for all components and pages, every component, whether it's a dependency of a page or just another component, will need to be compiled the new way. That means I'll need to maintain some sort of dependency tree, just for knowing what does/doesn't need to be compiled when the watcher detects a change in a particular Svelte component. Something like: // I'm thinking the key is the dependee, and its value is an array of its dependers
const dependees = {
'/path/to/component1.svelte': ['/path/to/component2.svelte', '/path/to/page1.svelte'],
'/path/to/component2.svelte': ['/path/to/component3.svelte', '/path/to/page2.svelte'],
} Just regarding the inner component dependencies: In this case, 2 has 1 in it. 3 has 2 in it. So technically, 3 has two dependees: 2 and 1. Need to figure out how to solve for that too, "nested" dependencies n levels deep. The upside down tree, I was thinking would be useful because you could see: ok this component was modified, Also need a flat list of all things that were compiled per refresh, so that unchanged dependencies of multiple Svelte components don't have to be recompiled if they were already compiled due to another dependency relationship. |
Would it make sense to put the logic of Edit: Yes. Make a custom preprocessor with a similar signature to svelte-preprocess, and have it provide a markup function for now: // preprocess.js
export default function cayo() {
const markup = (...) => {
// ... resolveImports logic
}
return {
markup,
}
}
|
New
Still need to figure out how to flow the compiled code through the other things prerender did. Right now the two new compile functions also write the resulting code to a file. Basically, the "post-process" stuff from Still to do:
|
The stale module issue is still around even after a good majority of the rewrite. page modules recompile/render their local contents fine, but their external dependencies, even though the deps themselves are updating, the instance is getting stale versions of the modules. E.g., Page uses component A. Module A gets updated when user changes the source file (A.svelte). But Page does not see the changes even tho it also re-renders after it is recompiled and reloaded via dynamic import. I think the fix may be to move the external dependencies into the page module, so there are no external deps. This wouldn't be too hard I don't think, since I have each file and could just copy it directly into the file but wrapped in a function to call instead of the imported object. Pretty confident that'd work. Think of it like each page is a bundle. |
why can't we just use Preprocess > compile was the main concern, but that' what rollup can do with the right plugins, it just also bundles. |
Biggest problem with using just I think
|
Not sure when/where this issue is from, but right now the only pages that get compiled are the ones you save after running the command. It should compile all of them when starting.
|
Since we don't need to compile normal components, change the references for generic
|
7339477 adds component dependency watching, which triggers a rerender of dependent pages. This as the last big piece of the puzzle. |
Todo:
svelte.preprocess
Related Issues:
The text was updated successfully, but these errors were encountered: