Create File class for babel helpers (#10575)
* add test * fix: pass File to helper traverser * pass babel.File to helpers.ensure
This commit is contained in:
@@ -2,6 +2,7 @@ import * as helpers from "@babel/helpers";
|
||||
import generator from "@babel/generator";
|
||||
import template from "@babel/template";
|
||||
import * as t from "@babel/types";
|
||||
import File from "../transformation/file/file";
|
||||
|
||||
// Wrapped to avoid wasting time parsing this when almost no-one uses
|
||||
// build-external-helpers.
|
||||
@@ -136,6 +137,7 @@ function buildHelpers(body, namespace, whitelist) {
|
||||
|
||||
const ref = (refs[name] = getHelperReference(name));
|
||||
|
||||
helpers.ensure(name, File);
|
||||
const { nodes } = helpers.get(name, getHelperReference, ref);
|
||||
|
||||
body.push(...nodes);
|
||||
|
||||
@@ -174,7 +174,7 @@ export default class File {
|
||||
}
|
||||
|
||||
// make sure that the helper exists
|
||||
helpers.ensure(name);
|
||||
helpers.ensure(name, File);
|
||||
|
||||
const uid = (this.declarations[name] = this.scope.generateUidIdentifier(
|
||||
name,
|
||||
|
||||
Reference in New Issue
Block a user