Skip to content

refactor: caching #1154

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
merged 1 commit into from
Jul 4, 2025
Merged

refactor: caching #1154

merged 1 commit into from
Jul 4, 2025

Conversation

dominikg
Copy link
Member

@dominikg dominikg commented Jul 2, 2025

changes:

  • move handling of preprocessor dependencies into preprocess plugin
  • remove stats for preprocess (that never worked)
  • instead of a separate cache for js+css, attach the css output to js module and grab it from moduleinfo in load
  • pass input sourcemap into svelte.compile instead of cached preprocessor sourcemap that could be missing transforms

svelteRequest,
code,
options,
this.getCombinedSourcemap()
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of passing in sourcemap from preprocessed that could be outdated because another transform changed the code in between the 2 plugins, use getCombinedSourceMap() this has the added benefit that we don't have to pass preprocessed around in meta

return {
...compileData.compiled.js,
moduleType: 'js',
meta: {
vite: {
lang: compileData.lang
},
svelte: {
css: compileData.compiled.css
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of caching the css in a separate cache structure, attach it to the meta of the js module

}
}
const hasSelfDependency = selfIdx.length > 0;
if (hasSelfDependency) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was an issue with svelte-preprocess and has been fixed in 2023, we don't need it anymore

});
}

if (dependencies.length > 10) {
Copy link
Member Author

@dominikg dominikg Jul 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was an issue when users put tailwind base rules into svelte style blocks, but that is no longer a thing with tailwind@4.

existing projects have seen this warning plenty of times and either dealt with it or accepted the penalty. new projects are unlikely to use tailwind@3 in this fashion.

so we don't need this anymore either

Copy link
Member

@eltigerchino eltigerchino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@eltigerchino eltigerchino merged commit a494b03 into main Jul 4, 2025
8 checks passed
@eltigerchino eltigerchino deleted the refactor/caching branch July 4, 2025 03:43
@github-actions github-actions bot mentioned this pull request Jul 4, 2025
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 this pull request may close these issues.

2 participants