Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: update scripts to use transformSync and disable babel.config.js #852

Merged
merged 1 commit into from May 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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