File tree Expand file tree Collapse file tree 3 files changed +16
-9
lines changed Expand file tree Collapse file tree 3 files changed +16
-9
lines changed Original file line number Diff line number Diff line change @@ -12,24 +12,31 @@ You must use the wrapper around [`debug`](https://www.npmjs.com/package/debug) n
12
12
13
13
Do not:
14
14
* Alias your ` import ` or ` require ` of ` Debug `
15
+ * Spread your ` import ` of ` require ` of ` Debug ` over more than one line
15
16
* Put more than one ` debug() ` call on a single line
16
- * Have a comment including a ` debug('call') `
17
17
* Other crazy things
18
18
19
19
Just make simple debug statements.
20
20
21
21
``` js
22
22
import { Debug } from ' webpack-strip-debug-loader'
23
23
24
- const debug = Debug (' feature' )
24
+ // Or use require if you prefer that
25
+ const { Debug } = require (" webpack-strip-debug-loader" )
26
+
27
+ const debug = Debug (" feature" )
25
28
const debugFoo = Debug (' foo' )
26
29
27
30
if (somethingOfInterestHappens) {
28
- debug (' something happened' )
31
+ debug (" something happened" )
29
32
}
30
33
31
34
if (foo) {
32
- debugFoo (' foo happened' , foo)
35
+ debugFoo (
36
+ ' foo happened' ,
37
+ foo,
38
+ { ... foo }
39
+ )
33
40
}
34
41
```
35
42
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " webpack-strip-debug-loader" ,
3
- "version" : " 1.1 .0" ,
3
+ "version" : " 1.2 .0" ,
4
4
"description" : " Strips debug imports, declarations and expressions from your webpack bundles" ,
5
5
"main" : " dist" ,
6
6
"repository" : {
Original file line number Diff line number Diff line change 1
1
const purge = source => {
2
- // No Imports: /import\s.+\sfrom\s+' webpack-strip-debug-loader' |.*require\(' webpack-strip-debug-loader' \).*/
3
- // No Declarations: /(var|let|const)?\s+debug(\w?)+\s*=\s*Debug\(.+ \)/g
4
- // No Invocations: /\s*debug(\w?)+\s*?\(.+ \)/g
2
+ // No Imports: /import\s.+\sfrom\s+['"] webpack-strip-debug-loader['"] |.*require\(['"] webpack-strip-debug-loader['"] \).*/
3
+ // No Declarations: /(var|let|const)?\s+debug(\w?)+\s*=\s*Debug\([\s\S]*?.* \)/g
4
+ // No Invocations: /\s*debug(\w?)+\s*?\([\s\S]*?.* \)/g
5
5
6
6
return source . replace (
7
- / ( i m p o r t \s .+ \s f r o m \s + ' w e b p a c k - s t r i p - d e b u g - l o a d e r ' | .* r e q u i r e \( ' w e b p a c k - s t r i p - d e b u g - l o a d e r ' \) .* ) | ( ( v a r | l e t | c o n s t ) ? \s + d e b u g ( \w ? ) + \s * = \s * D e b u g \( . + \) ) | ( \s * d e b u g ( \w ? ) + \s * ?\( . + \) ) / g,
7
+ / ( i m p o r t \s .+ \s f r o m \s + [ ' " ] w e b p a c k - s t r i p - d e b u g - l o a d e r [ ' " ] | .* r e q u i r e \( [ ' " ] w e b p a c k - s t r i p - d e b u g - l o a d e r [ ' " ] \) .* ) | ( ( v a r | l e t | c o n s t ) ? \s + d e b u g ( \w ? ) + \s * = \s * D e b u g \( [ \s \S ] * ?. * \) ) | ( \s * d e b u g ( \w ? ) + \s * ?\( [ \s \S ] * ?. * \) ) / g,
8
8
'\n'
9
9
)
10
10
}
You can’t perform that action at this time.
0 commit comments