-
Notifications
You must be signed in to change notification settings - Fork 75
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
TODOs #1
Comments
Making this step synchronous might effect performance. |
@znck we can make it optionally sync. Most preprocessors have both sync and async APIs. Sync is a requirement for |
Something like |
Heads up. I'm working on compileStyle. Planning to send a PR by mid next week. |
@yyx990803 Do we need compileScript? |
@znck we eventually do but for now we don't have anything that immediately needs it - maybe when @eddyerburgh starts to migrate |
Will this package help resolve this issue with vue-jest debugging. Thanks guys @yyx990803 @znck @eddyerburgh |
The current API surface is the minimal amount of methods needed in
vue-loader
. There are a few features that are good to have here but not currently present:CSS pre-processor handling in
compileStyle
This is currently not included because in
vue-loader
CSS preprocessing is delegated to other webpack loaders. However for some other systems that do not support that kind of usage, directly handling preprocessors here will make more sense.We will need to add the same
preprocessLang
andpreprocessOptions
fields toStyleCompileOptions
. The implementation should look like the preprocess step incompileTemplate
and be synchronous. It will require whatever preprocessor is specified inlang
to be separately installed.compileScript
for JavaScript pre-processor handlingThis is left out because again
vue-loader
delegates script processing to webpack loaders. Same idea:Actual compilation for babel, ts and coffee can probably be reused from
vue-jest
.genId
Probably a good idea to put in this package as well.
assemble
This is intentionally left out because in actual implementations, the assemble step is highly dependent on the targeted system. Behaviors like hot reload and style injection have to be handled differently in different environments.
Tests
Currently this package has no tests for itself yet because most of the logic was tested during the development of
vue-loader
15 and later simply moved into this package with minimal modifications.But we surely need to write the tests :)
Higher-Level Convenience Method
The current
vue-component-compiler
package can be built on top of this package and expose an API that looks like this:Note the
compile
method returns a descriptor instead of code. The descriptor has the sametemplate
,script
andstyle
parts but contains compiled code and source maps. It is then up to the user to decide how to assemble these compiled descriptors into final code.This API may or may not be flexible enough - but ideally tools like
vue-jest
should be able to use this API instead of the lower level ones./cc @znck @eddyerburgh
The text was updated successfully, but these errors were encountered: