Skip to content

Commit

Permalink
refactor: update scripts to use transformSync and disable babel.confi…
Browse files Browse the repository at this point in the history
…g.js (#852)
  • Loading branch information
boopathi committed May 16, 2018
1 parent 85c9b6d commit 1cb46b7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
10 changes: 7 additions & 3 deletions scripts/plugin-contribution.js
Expand Up @@ -2,7 +2,7 @@

const fs = require("fs");
const path = require("path");
const { transform } = require("@babel/core");
const { transformSync } = require("@babel/core");
const Table = require("cli-table");
const zlib = require("zlib");
const chalk = require("chalk");
Expand All @@ -29,8 +29,10 @@ function run(inputFile) {
)
);

const baseOutput = transform(input, {
const baseOutput = transformSync(input, {
minified: true,
babelrc: false,
configFile: false,
compact: true,
comments: false
}).code;
Expand All @@ -45,9 +47,11 @@ function run(inputFile) {
plugins.forEach(({ name, plugin }) => {
process.stdout.write(`Plugin ${current++}/${plugins.length}\r`);

const output = transform(baseOutput, {
const output = transformSync(baseOutput, {
plugins: [plugin],
minified: true,
babelrc: false,
configFile: false,
compact: true,
comments: false
}).code;
Expand Down
6 changes: 5 additions & 1 deletion scripts/plugin-timing.js
Expand Up @@ -50,8 +50,12 @@ run(process.argv[2]);

function run(file) {
const b = new Benchmark();
babel.transform(fs.readFileSync(file).toString(), {
babel.transformSync(fs.readFileSync(file).toString(), {
presets: [preset],
babelrc: false,
configFile: false,
minified: true,
compact: true,
wrapPluginVisitorMethod(pluginAlias, visitorType, callback) {
return function(...args) {
b.push(pluginAlias);
Expand Down

0 comments on commit 1cb46b7

Please sign in to comment.