Skip to content

Commit b8c06e6

Browse files
committed
Convert ES6 imports to CJS require()
1 parent f0df203 commit b8c06e6

File tree

5 files changed

+18
-17
lines changed

5 files changed

+18
-17
lines changed

src/index.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
import Macros from './lib/utils/macros';
2-
import { readFileSync } from 'fs';
3-
import { dirname, join } from 'path';
4-
import { normalizeOptions } from './lib/utils/normalize-options';
1+
const Macros = require('./lib/utils/macros');
2+
const normalizeOptions = require('./lib/utils/normalize-options').normalizeOptions;
53

64
function macros(babel) {
75
const t = babel.types;
@@ -56,4 +54,4 @@ macros.baseDir = function() {
5654
return dirname(__dirname);
5755
}
5856

59-
export default macros;
57+
module.exports = macros;

src/lib/utils/builder.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export default class Builder {
1+
module.exports = class Builder {
22
constructor(t, options) {
33
this.t = t;
44
this.module = options.module;

src/lib/utils/macros.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
const DEBUG = 'DEBUG';
2-
3-
import Builder from './builder';
1+
const Builder = require('./builder');
42

3+
const DEBUG = 'DEBUG';
54
const SUPPORTED_MACROS = ['assert', 'deprecate', 'warn', 'log'];
65

7-
export default class Macros {
6+
module.exports = class Macros {
87
constructor(t, options) {
98
this.localDebugBindings = [];
109
this.envFlagBindings = [];

src/lib/utils/normalize-options.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { satisfies } from 'semver';
1+
const satisfies = require('semver').satisfies;
22

3-
export function normalizeOptions(options) {
3+
function normalizeOptions(options) {
44
let features = options.features || [];
55
let debugTools = options.debugTools;
66
let envFlags = options.envFlags;
@@ -83,3 +83,7 @@ export function normalizeOptions(options) {
8383
}
8484
};
8585
}
86+
87+
module.exports = {
88+
normalizeOptions,
89+
};

src/tests/debug-tools-test.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import DebugToolsPlugin from '../index';
2-
import { transform } from 'babel-core';
3-
import { expect } from 'chai';
4-
import { file } from 'chai-files';
5-
import { lstatSync, writeFileSync } from 'fs';
1+
const DebugToolsPlugin = require('../index');
2+
const transform = require('babel-core').transform;
3+
const expect = require('chai').expect;
4+
const file = require('chai-files').file;
5+
const lstatSync = require('fs').lstatSync;
66

77
const presets = [["latest", {
88
"es2015": false,

0 commit comments

Comments
 (0)