-
-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature(@putout/plugin-convert-commonjs-to-esm) add support of declar…
…ed require
- Loading branch information
1 parent
6f50235
commit 359c317
Showing
6 changed files
with
43 additions
and
1 deletion.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
packages/plugin-convert-commonjs-to-esm/lib/commons/fixture/declared-require.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const require = () => {}; | ||
|
||
function info() { | ||
return require('./package.json'); | ||
} |
6 changes: 6 additions & 0 deletions
6
packages/plugin-convert-commonjs-to-esm/lib/commons/fixture/info.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import {createCommons} from 'simport'; | ||
const {__filename, __dirname, require} = createCommons(import.meta.url); | ||
|
||
function info() { | ||
return require('./package.json'); | ||
} |
11 changes: 11 additions & 0 deletions
11
packages/plugin-convert-commonjs-to-esm/lib/commons/fixture/require-fix.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import {createCommons} from 'simport'; | ||
|
||
const { | ||
__filename, | ||
__dirname, | ||
require | ||
} = createCommons(import.meta.url); | ||
|
||
function info() { | ||
return require('./package.json'); | ||
} |
3 changes: 3 additions & 0 deletions
3
packages/plugin-convert-commonjs-to-esm/lib/commons/fixture/require.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
function info() { | ||
return require('./package.json'); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters