Skip to content

Commit

Permalink
chore: bump rewrite-imports version
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeed committed Jun 4, 2021
1 parent 3694b1e commit 4fb40f3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ const entry = resolve(!argv[0] || /^-/.test(argv[0]) ? 'src/index.js' : argv.shi
if (!existsSync(entry) && !pkg.modes) return bail(`File not found: ${entry}`);

// We'll actually do something – require deps
const imports = require('rewrite-imports');
const { rewrite } = require('rewrite-imports');
const { mkdir } = require('mk-dirs/sync');
const { minify } = require('terser');

Expand Down Expand Up @@ -128,7 +128,7 @@ function run(filepath, isMode) {
const ESM = readFileSync(filepath, 'utf8');
const isDefault = /export default/.test(ESM);

let CJS = imports(ESM)
let CJS = rewrite(ESM)
.replace(/(^|\s|;)export default/, '$1module.exports =')
.replace(/(^|\s|;)export (const|(?:async )?function|class|let|var) (.+?)(?=(\(|\s|\=))/gi, (_, x, type, name) => {
return keys.push(name) && `${x}${type} ${name}`;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"dependencies": {
"kleur": "^4.0.0",
"mk-dirs": "^3.0.0",
"rewrite-imports": "^2.0.0",
"rewrite-imports": "^3.0.0",
"terser": "^4.8.0"
},
"devDependencies": {
Expand Down

0 comments on commit 4fb40f3

Please sign in to comment.