Add @taskr/sourcemaps #294
Open
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 source map init, write, and apply for use in tasks and plugins. The approach is very similar to Gulp 4 (in fact most of the code is based on gulp-sourcemaps). Important improvements include:
Usage
Build-in support:
Custom usage:
Plugin usage:
Discussion
1. Should this be included by default with the
taskr
packageI think building gulp-sourcemaps into gulp 4 was well received and would be a nice addition to taskr. Currently, most of the plugins have source map support currently, which is awesome, but they only support merging if the tool supports it (which is rare) and some don't allow control between inline and external source maps. This adds 4 direct dependencies, but they have no sub-dependencies, so in total it's fairly reasonable at 80k.
Alternative: It could potentially be an optional dependency that needs to be explicitly installed, but it will most likely be installed by plugins needing
applySourceMap
that in the end it may not lead to savings for the user to make it optional.2. Should source maps be written by default
Currently, unless source map writing is explicitly disabled with
.target('...', { sourcemaps: false })
, if thesourceMap
property is found on a file, it is written as an inline source map. ThesourceMap
property should only be set if source maps are enabled in.source
orinitSourceMaps
, so it's reasonable to assume it is an intelligent default to write them.I've added support to
@taskr/babel
, wanted to see what you think before I went any further. Thanks!