Skip to content

Commit 47c9045

Browse files
authored
Merge pull request #6 from morganney/develop
Develop
2 parents d45a432 + 7eb5d00 commit 47c9045

File tree

5 files changed

+13
-5
lines changed

5 files changed

+13
-5
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: 3 additions & 1 deletion
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

__tests__/purge.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ describe('purge', () => {
1515
it('removes imports for Debug', () => {
1616
expect(purge("import { Debug } from 'webpack-strip-debug-loader'")).toBe('\n')
1717
expect(purge('import {Debug} from "webpack-strip-debug-loader"')).toBe('\n')
18+
expect(
19+
purge(`import {
20+
Debug
21+
} from 'webpack-strip-debug-loader'`)
22+
).toBe('\n')
1823
})
1924

2025
it('removes requires for Debug', () => {

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)