Skip to content

Commit

Permalink
Require Node.js 14
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Nov 29, 2022
1 parent cd168f3 commit 37bcfef
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 13 deletions.
2 changes: 1 addition & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {PluginObj, types} from '@babel/core';
import {type PluginObj, type types} from '@babel/core';

/**
Strip `console`, `alert`, and `debugger` statements from JavaScript code.
Expand Down
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export default function stripDebugPlugin({types}) {
if (isConsoleNode(path) || isAlertNode(path)) {
path.replaceWith(types.unaryExpression('void', types.numericLiteral(0)));
}
}
}
},
},
};
}
15 changes: 9 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@
"url": "https://sindresorhus.com"
},
"type": "module",
"exports": "./index.js",
"exports": {
"types": "./index.d.ts",
"default": "./index.js"
},
"engines": {
"node": ">=12.20"
"node": ">=14.16"
},
"scripts": {
"test": "xo && ava"
Expand All @@ -37,11 +40,11 @@
"babel-plugin"
],
"dependencies": {
"@types/babel__core": "^7.1.14"
"@types/babel__core": "^7.1.20"
},
"devDependencies": {
"@babel/core": "^7.14.3",
"ava": "^3.15.0",
"xo": "^0.38.2"
"@babel/core": "^7.20.5",
"ava": "^5.1.0",
"xo": "^0.53.1"
}
}
4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ Useful for making sure you didn't leave any logging in production code.

## Usage

```
$ npm install @babel/core strip-debug
```sh
npm install @babel/core strip-debug
```

## Usage
Expand Down
4 changes: 2 additions & 2 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import stripDebugPlugin from './index.js';

async function stripDebug(source) {
const {code} = await transformAsync(source, {
plugins: [stripDebugPlugin]
plugins: [stripDebugPlugin],
});

return code;
Expand Down Expand Up @@ -53,7 +53,7 @@ test('never strip away non-debugging code', async t => {

test('shouldn\'t leak memory', async t => {
await t.notThrowsAsync(() =>
stripDebug('var obj = null; try { obj = \'something\'; } catch (e) { console.warn(\'NOPE!\'); }')
stripDebug('var obj = null; try { obj = \'something\'; } catch (e) { console.warn(\'NOPE!\'); }'),
);
});

Expand Down

0 comments on commit 37bcfef

Please sign in to comment.