remove experimental option in favor of a stage option
This commit is contained in:
@@ -11,6 +11,10 @@ export function transformerList(key, val) {
|
||||
return transform._ensureTransformerNames(key, val);
|
||||
}
|
||||
|
||||
export function number(key, val) {
|
||||
return +val;
|
||||
}
|
||||
|
||||
export function boolean(key, val) {
|
||||
return !!val;
|
||||
}
|
||||
|
||||
@@ -42,11 +42,11 @@
|
||||
"hidden": true
|
||||
},
|
||||
|
||||
"experimental": {
|
||||
"description": "Enable all ES7+ transformers",
|
||||
"stage": {
|
||||
"description": "",
|
||||
"shorthand": "e",
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
"type": "number",
|
||||
"default": 2
|
||||
},
|
||||
|
||||
"blacklist": {
|
||||
|
||||
@@ -32,8 +32,9 @@ export default class TransformerPass {
|
||||
var whitelist = opts.whitelist;
|
||||
if (whitelist) return includes(whitelist, key);
|
||||
|
||||
// experimental
|
||||
if (transformer.metadata.experimental && opts.experimental) return true;
|
||||
// stage
|
||||
var stage = transformer.metadata.stage;
|
||||
if (stage != null && stage >= opts.stage) return true;
|
||||
|
||||
// optional
|
||||
if (transformer.metadata.optional && !includes(opts.optional, key)) return false;
|
||||
|
||||
@@ -30,6 +30,10 @@ export default class Transformer {
|
||||
this.post = take("post");
|
||||
this.pre = take("pre");
|
||||
|
||||
if (this.metadata.stage != null) {
|
||||
this.metadata.optional = true;
|
||||
}
|
||||
|
||||
this.handlers = this.normalize(transformer);
|
||||
this.opts ||= {};
|
||||
this.key = transformerKey;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
export var metadata = {
|
||||
experimental: true,
|
||||
optional: true
|
||||
stage: 1
|
||||
};
|
||||
|
||||
export function check() {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
export var metadata = {
|
||||
experimental: true,
|
||||
optional: true
|
||||
stage: 0
|
||||
};
|
||||
|
||||
export function check() {
|
||||
|
||||
@@ -4,8 +4,7 @@ import * as util from "../../../util";
|
||||
import * as t from "../../../types";
|
||||
|
||||
export var metadata = {
|
||||
experimental: true,
|
||||
optional: true
|
||||
stage: 0
|
||||
};
|
||||
|
||||
export function ComprehensionExpression(node, parent, scope, file) {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
export var metadata = {
|
||||
experimental: true,
|
||||
optional: true
|
||||
optional: true,
|
||||
stage: 1
|
||||
};
|
||||
|
||||
@@ -2,7 +2,8 @@ import * as t from "../../../types";
|
||||
|
||||
export var metadata = {
|
||||
experimental: true,
|
||||
optional: true
|
||||
optional: true,
|
||||
stage: 0
|
||||
};
|
||||
|
||||
export var check = t.isDoExpression;
|
||||
|
||||
@@ -3,6 +3,10 @@
|
||||
import build from "../../helpers/build-binary-assignment-operator-transformer";
|
||||
import * as t from "../../../types";
|
||||
|
||||
export var metadata = {
|
||||
stage: 2
|
||||
};
|
||||
|
||||
var MATH_POW = t.memberExpression(t.identifier("Math"), t.identifier("pow"));
|
||||
|
||||
build(exports, {
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
|
||||
import * as t from "../../../types";
|
||||
|
||||
export var metadata = {
|
||||
stage: 0
|
||||
};
|
||||
|
||||
export function check(node) {
|
||||
return t.isExportDefaultSpecifier(node) || t.isExportNamespaceSpecifier(node);
|
||||
}
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
import * as t from "../../../types";
|
||||
|
||||
export var metadata = {
|
||||
experimental: true,
|
||||
optional: true
|
||||
stage: 1
|
||||
};
|
||||
|
||||
export function manipulateOptions(opts) {
|
||||
|
||||
Reference in New Issue
Block a user