Skip to content

Commit c38dfb8

Browse files
committed
feat: multiline import
1 parent d45a432 commit c38dfb8

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ You must use the wrapper around [`debug`](https://www.npmjs.com/package/debug) n
1212

1313
Do not:
1414
* Alias your `import` or `require` of `Debug`
15-
* Spread your `import` of `require` of `Debug` over more than one line
16-
* Put more than one `debug()` call on a single line
15+
* Spread your `require` of `Debug` over more than one line
16+
* Wrap code with `debug();like(this);debug()` on the same line
1717
* Other crazy things
1818

1919
Just make simple debug statements.
@@ -36,6 +36,7 @@ if (foo) {
3636
'foo happened',
3737
foo,
3838
{ ...foo }
39+
someFunc(foo)
3940
)
4041
}
4142
```

__tests__/__fixtures__/file.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ import { t } from 'ttag'
33
import isObject from 'lodash/isObject'
44

55
import { findFilterById, findFilterByType } from './search/filters'
6-
6+
import {
7+
Debug
8+
} from 'webpack-strip-debug-loader'
79
import { browserHistory } from '../Routes'
810
import * as waterApi from '../waterApi'
911

@@ -438,4 +440,4 @@ debugLogger("something happened")
438440
foo()
439441
debugLogger(someFuncCall())
440442
foo()
441-
debug('no newline')
443+
debug('no newline')

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "webpack-strip-debug-loader",
3-
"version": "1.2.3",
3+
"version": "1.3.0",
44
"description": "Strips debug imports, declarations and expressions from your webpack bundles",
55
"main": "dist",
66
"type": "module",

src/purge.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const imports =
2-
/import\s.+\sfrom\s+['"]webpack-strip-debug-loader['"]|.*require\(['"]webpack-strip-debug-loader['"]\).*/
2+
/import\s?{\s*?Debug\s*?}\sfrom\s+['"]webpack-strip-debug-loader['"]|.*require\(['"]webpack-strip-debug-loader['"]\).*/
33
const declarations = /(var|let|const)?\s*debug(\w?)+\s*=\s*Debug\([\s\S]*?.*\)/
44
const invocations = /\s*debug(\w?)+\s*?\([\s\S]*?.*\s*\)(?![),])/
55
const debugCode = new RegExp(

0 commit comments

Comments
 (0)