Represent helpers as simple modules.
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
export default function (arr) {
|
||||
export default function _toArray(arr) {
|
||||
return Array.isArray(arr) ? arr : Array.from(arr);
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
exports.__esModule = true;
|
||||
exports.default = _default;
|
||||
exports.default = _toArray;
|
||||
|
||||
function _default(arr) {
|
||||
function _toArray(arr) {
|
||||
return Array.isArray(arr) ? arr : Array.from(arr);
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import _Array$from from "../../core-js/array/from";
|
||||
export default function (arr) {
|
||||
export default function _toArray(arr) {
|
||||
return Array.isArray(arr) ? arr : _Array$from(arr);
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
exports.__esModule = true;
|
||||
exports.default = _default;
|
||||
exports.default = _toArray;
|
||||
|
||||
var _from = _interopRequireDefault(require("../core-js/array/from"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _default(arr) {
|
||||
function _toArray(arr) {
|
||||
return Array.isArray(arr) ? arr : (0, _from.default)(arr);
|
||||
}
|
||||
@@ -104,12 +104,7 @@ function buildRuntimeRewritePlugin(relativePath, helperName) {
|
||||
}
|
||||
|
||||
function buildHelper(helperName, modules, useBuiltIns) {
|
||||
const helper = helpers.get(helperName);
|
||||
// avoid an unneccessary TDZ in the easy case
|
||||
if (helper.type === "FunctionExpression") {
|
||||
helper.type = "FunctionDeclaration";
|
||||
}
|
||||
const tree = t.program([t.exportDefaultDeclaration(helper)]);
|
||||
const tree = t.program(helpers.get(helperName).nodes);
|
||||
|
||||
const transformOpts = makeTransformOpts(modules, useBuiltIns);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user