Files
babel/src/babel/transformation/transformers/internal/module-formatter.js
2015-05-31 23:40:59 +01:00

21 lines
502 B
JavaScript

export var metadata = {
group: "builtin-modules"
};
export var Program = {
exit(program, parent, scope, file) {
// ensure that these are at the top, just like normal imports
for (var node of (file.dynamicImports: Array)) {
node._blockHoist = 3;
}
program.body = file.dynamicImports.concat(program.body);
if (!file.transformers["es6.modules"].canTransform()) return;
if (file.moduleFormatter.transform) {
file.moduleFormatter.transform(program);
}
}
};