add corejs aliasing transformer and support for optional transformers
This commit is contained in:
1
test/fixtures/transformation/optional-core-aliasing/es6-destructuring/actual.js
vendored
Normal file
1
test/fixtures/transformation/optional-core-aliasing/es6-destructuring/actual.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
var [a, [b], [c], d] = ["hello", [", ", "junk"], ["world"]];
|
||||
35
test/fixtures/transformation/optional-core-aliasing/es6-destructuring/expected.js
vendored
Normal file
35
test/fixtures/transformation/optional-core-aliasing/es6-destructuring/expected.js
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
"use strict";
|
||||
|
||||
var _slicedToArray = function (arr, i) {
|
||||
if (Array.isArray(arr)) {
|
||||
return arr;
|
||||
} else {
|
||||
var _arr = [];
|
||||
for (var _iterator = _core.$for.getIterator(arr), _step; !(_step = _iterator.next()).done;) {
|
||||
_arr.push(_step.value);
|
||||
|
||||
if (i && _arr.length === i) break;
|
||||
}
|
||||
|
||||
return _arr;
|
||||
}
|
||||
};
|
||||
|
||||
var _interopRequire = function (obj) {
|
||||
return obj && (obj["default"] || obj);
|
||||
};
|
||||
|
||||
var _core = _interopRequire(require("core-js/library"));
|
||||
|
||||
var _ref = ["hello", [", ", "junk"], ["world"]];
|
||||
|
||||
var _ref2 = _slicedToArray(_ref, 4);
|
||||
|
||||
var a = _ref2[0];
|
||||
var _ref3 = _slicedToArray(_ref2[1], 1);
|
||||
|
||||
var b = _ref3[0];
|
||||
var _ref4 = _slicedToArray(_ref2[2], 1);
|
||||
|
||||
var c = _ref4[0];
|
||||
var d = _ref2[3];
|
||||
3
test/fixtures/transformation/optional-core-aliasing/es6-for-of/actual.js
vendored
Normal file
3
test/fixtures/transformation/optional-core-aliasing/es6-for-of/actual.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
for (var i of arr) {
|
||||
|
||||
}
|
||||
11
test/fixtures/transformation/optional-core-aliasing/es6-for-of/expected.js
vendored
Normal file
11
test/fixtures/transformation/optional-core-aliasing/es6-for-of/expected.js
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
"use strict";
|
||||
|
||||
var _interopRequire = function (obj) {
|
||||
return obj && (obj["default"] || obj);
|
||||
};
|
||||
|
||||
var _core = _interopRequire(require("core-js/library"));
|
||||
|
||||
for (var _iterator = _core.$for.getIterator(arr), _step; !(_step = _iterator.next()).done;) {
|
||||
var i = _step.value;
|
||||
}
|
||||
1
test/fixtures/transformation/optional-core-aliasing/es6-spread/actual.js
vendored
Normal file
1
test/fixtures/transformation/optional-core-aliasing/es6-spread/actual.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
var lyrics = ["head", "and", "toes", ...parts];
|
||||
13
test/fixtures/transformation/optional-core-aliasing/es6-spread/expected.js
vendored
Normal file
13
test/fixtures/transformation/optional-core-aliasing/es6-spread/expected.js
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
"use strict";
|
||||
|
||||
var _toArray = function (arr) {
|
||||
return Array.isArray(arr) ? arr : _core.Array.from(arr);
|
||||
};
|
||||
|
||||
var _interopRequire = function (obj) {
|
||||
return obj && (obj["default"] || obj);
|
||||
};
|
||||
|
||||
var _core = _interopRequire(require("core-js/library"));
|
||||
|
||||
var lyrics = ["head", "and", "toes"].concat(_toArray(parts));
|
||||
1
test/fixtures/transformation/optional-core-aliasing/es7-array-comprehensions/actual.js
vendored
Normal file
1
test/fixtures/transformation/optional-core-aliasing/es7-array-comprehensions/actual.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
var arr = [for (i of nums) i * i];
|
||||
15
test/fixtures/transformation/optional-core-aliasing/es7-array-comprehensions/expected.js
vendored
Normal file
15
test/fixtures/transformation/optional-core-aliasing/es7-array-comprehensions/expected.js
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
|
||||
var _toArray = function (arr) {
|
||||
return Array.isArray(arr) ? arr : _core.Array.from(arr);
|
||||
};
|
||||
|
||||
var _interopRequire = function (obj) {
|
||||
return obj && (obj["default"] || obj);
|
||||
};
|
||||
|
||||
var _core = _interopRequire(require("core-js/library"));
|
||||
|
||||
var arr = _toArray(nums).map(function (i) {
|
||||
return i * i;
|
||||
});
|
||||
1
test/fixtures/transformation/optional-core-aliasing/es7-object-spread-rest/actual.js
vendored
Normal file
1
test/fixtures/transformation/optional-core-aliasing/es7-object-spread-rest/actual.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
var z = { ...x };
|
||||
9
test/fixtures/transformation/optional-core-aliasing/es7-object-spread-rest/expected.js
vendored
Normal file
9
test/fixtures/transformation/optional-core-aliasing/es7-object-spread-rest/expected.js
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
"use strict";
|
||||
|
||||
var _interopRequire = function (obj) {
|
||||
return obj && (obj["default"] || obj);
|
||||
};
|
||||
|
||||
var _core = _interopRequire(require("core-js/library"));
|
||||
|
||||
var z = _core.Object.assign({}, x);
|
||||
4
test/fixtures/transformation/optional-core-aliasing/options.json
vendored
Normal file
4
test/fixtures/transformation/optional-core-aliasing/options.json
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"optional": ["coreAliasing"],
|
||||
"experimental": true
|
||||
}
|
||||
Reference in New Issue
Block a user