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

Synchronous preprocessing for Svelte TypeScript tests #85

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ehrencrona
Copy link

This is based on #49 and shows how support for synchronous preprocessing in Svelte as per sveltejs/svelte-preprocess#291 and sveltejs/svelte#5770 could improve the code so as to not need to spawn a new node process for every file that is to be processed.

const { preprocess, rootMode } = options;
if (preprocess) {
const svelteConfig = getSvelteConfig(rootMode, filename);
const config = cosmiconfigSync().load(svelteConfig).config
Copy link
Author

Choose a reason for hiding this comment

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

It's probably unnecessary to load the config for every file to be processed.

const svelteConfig = getSvelteConfig(rootMode, filename);
const config = cosmiconfigSync().load(svelteConfig).config

return preprocess_sync(source, config.preprocess || {}, { filename }).code
Copy link
Author

@ehrencrona ehrencrona Dec 11, 2020

Choose a reason for hiding this comment

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

this line is pretty much the only change compared to #49

@seanlail seanlail mentioned this pull request Sep 22, 2021
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