Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds support for Svelte's preprocessing functionality, which is required to use
ttag-cli
with Svelte if the blocks are written in TypeScript.The PR seems to be functional. However,
I'm having some problems writing tests for this andI'd like to have some guidance on the following points:TransformFn
to async, becausesvelte.preprocess
is async-only. I also changed eg. Babel calls to async. Is this desirable or should sync versions be preferred?import()
calls torequire()
calls, I need to do someeval
hackery to get around this. Is this acceptable or do you have any other suggestions? Should we try to sanitize the (external) input somehow? I don't think I'd like to reconfigure the whole pipeline in this PR. See also Add flag to not transpile dynamicimport()
when module isCommonJS
microsoft/TypeScript#43329.The test setup requires aRunning from eg.svelte.config.js
in the current working directory, or above it, and I'm not sure how to set it up and thus the test is currently failing (in addition to missing the snapshot). I can make this location configurable, but are there any preferences how should I pass the configuration variable?tests/fixtures/testSvelte
seems to be okay, updated the PR.I'd need to add yet another dependency(This affects onlysvelte-preprocess
to test preprocessing TypeScript.devDependencies
, so its not a problem, updated the PR.) I think dependencies are going to get out of hand at some point. Maybevue-sfc-parser
andsvelte
should be dynamically loaded, if available? Thus they could be moved fromdependencies
todevDependencies
at least, if not removed frompackage.json
.Thanks for @MrOrz for initial work with #94.
Feel free to finish this PR.