Skip to content

Commit ddae66c

Browse files
committed
feature: @putout/plugin-nodejs: convert-commonjs-to-esm: exclude logical
1 parent 45ecd31 commit ddae66c

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
0 && (module.exports = {
2+
imports,
3+
stack,
4+
x,
5+
});

packages/plugin-nodejs/lib/convert-commonjs-to-esm-exports/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ const {replaceWith} = operator;
1111

1212
export const report = () => `Use 'ESM' instead of 'CommonJS'`;
1313

14-
export const exclude = () => ['__, __'];
14+
export const exclude = () => [
15+
'__, __',
16+
'__ && __',
17+
];
1518

1619
export const match = () => ({
1720
'module.exports.__a = __b': ({__a, __b}, path) => {

packages/plugin-nodejs/lib/convert-commonjs-to-esm-exports/index.spec.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,8 @@ test('plugin-convert-commonjs-to-esm: exports: no transform: reserved', (t) => {
7676
t.noTransform('reserved');
7777
t.end();
7878
});
79+
80+
test('plugin-convert-commonjs-to-esm: exports: no report: logical', (t) => {
81+
t.noReport('logical');
82+
t.end();
83+
});

0 commit comments

Comments
 (0)