Remove the sourceMapTarget option from core and implement it in babel-cli. (#7500)

This commit is contained in:
Logan Smyth
2018-03-09 14:14:25 -08:00
committed by GitHub
parent 0389035e15
commit b5e6536f26
16 changed files with 20 additions and 27 deletions

View File

@@ -242,7 +242,6 @@ Following is a table of the options you can use:
| `shouldPrintComment` | `null` | An optional callback that controls whether a comment should be output or not. Called as `shouldPrintComment(commentContents)`. **NOTE:** This overrides the `comment` option when used |
| `sourceFileName` | `(filenameRelative)` | Set `sources[0]` on returned source map |
| `sourceMaps` | `false` | If truthy, adds a `map` property to returned output. If set to `"inline"`, a comment with a sourceMappingURL directive is added to the bottom of the returned code. If set to `"both"` then a `map` property is returned as well as a source map comment appended. **This does not emit sourcemap files by itself!** To have sourcemaps emitted using the CLI, you must pass it the `--source-maps` option |
| `sourceMapTarget` | `(filenameRelative)` | Set `file` on returned source map |
| `sourceRoot` | `(moduleRoot)` | The root from which all sources are relative |
| `sourceType` | `"module"` | Indicate the mode the code should be parsed in. Can be one of "script", "module", or "unambiguous". `"unambiguous"` will make Babel attempt to _guess_, based on the presence of ES6 `import` or `export` statements. Files with ES6 `import`s and `export`s are considered `"module"` and are otherwise `"script"`. |
| `wrapPluginVisitorMethod`| `null` | An optional callback that can be used to wrap visitor methods. **NOTE:** This is useful for things like introspection, and not really needed for implementing anything. Called as `wrapPluginVisitorMethod(pluginAlias, visitorType, callback)`.

View File

@@ -119,9 +119,6 @@ const COMMON_VALIDATORS: ValidatorSet = {
sourceMap: (assertSourceMaps: Validator<
$PropertyType<ValidatedOptions, "sourceMap">,
>),
sourceMapTarget: (assertString: Validator<
$PropertyType<ValidatedOptions, "sourceMapTarget">,
>),
sourceFileName: (assertString: Validator<
$PropertyType<ValidatedOptions, "sourceFileName">,
>),
@@ -192,7 +189,6 @@ export type ValidatedOptions = {
// Sourcemap generation options.
sourceMaps?: SourceMapsOption,
sourceMap?: SourceMapsOption,
sourceMapTarget?: string,
sourceFileName?: string,
sourceRoot?: string,

View File

@@ -44,7 +44,8 @@ export default {
message: "Put the specific transforms you want in the `plugins` option",
},
sourceMapName: {
message: "Use the `sourceMapTarget` option",
message:
"The `sourceMapName` option has been removed because it makes more sense for the tooling that calls Babel to assign `map.file` themselves.",
},
stage: {
message:
@@ -64,4 +65,10 @@ export default {
message:
"Generated plugin metadata is always included in the output result",
},
sourceMapTarget: {
version: 6,
message:
"The `sourceMapTarget` option has been removed because it makes more sense for the tooling that calls Babel to assign `map.file` themselves.",
},
};

View File

@@ -15,7 +15,6 @@ export default function normalizeOptions(config: ResolvedConfig): {} {
sourceRoot = moduleRoot,
sourceFileName = filenameRelative,
sourceMapTarget = filenameRelative,
comments = true,
compact = "auto",
@@ -47,7 +46,6 @@ export default function normalizeOptions(config: ResolvedConfig): {} {
// Source-map generation flags.
sourceMaps,
sourceMapTarget,
sourceRoot,
sourceFileName,
},

View File

@@ -1,6 +1,5 @@
{
"version": 3,
"file": "source-maps/full/output.js",
"sources": ["source-maps/full/input.js"],
"names": [
"arr",

View File

@@ -1,4 +1,4 @@
arr.map(function (x) {
return x * x;
});
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNvdXJjZS1tYXBzL2lubGluZS9pbnB1dC5qcyJdLCJuYW1lcyI6WyJhcnIiLCJtYXAiLCJ4Il0sIm1hcHBpbmdzIjoiQUFBQUEsSUFBSUMsR0FBSixDQUFRO0FBQUEsU0FBS0MsSUFBSUEsQ0FBVDtBQUFBLENBQVIiLCJmaWxlIjoic291cmNlLW1hcHMvaW5saW5lL291dHB1dC5qcyIsInNvdXJjZXNDb250ZW50IjpbImFyci5tYXAoeCA9PiB4ICogeCk7Il19
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNvdXJjZS1tYXBzL2lubGluZS9pbnB1dC5qcyJdLCJuYW1lcyI6WyJhcnIiLCJtYXAiLCJ4Il0sIm1hcHBpbmdzIjoiQUFBQUEsSUFBSUMsR0FBSixDQUFRO0FBQUEsU0FBS0MsSUFBSUEsQ0FBVDtBQUFBLENBQVIiLCJzb3VyY2VzQ29udGVudCI6WyJhcnIubWFwKHggPT4geCAqIHgpOyJdfQ==