grunt-strip-code
Advanced tools
| var a = 10; | ||
| var b = 20; | ||
| /* exclude:start */ | ||
| var c = 30; | ||
| /* exclude:stop */ |
| var a = 10; | ||
| var b = 20; |
| var a = 10; | ||
| var b = 20; | ||
| /* exclude:start */ | ||
| var c = 30; | ||
| /* exclude:stop */ |
| var a = 10; | ||
| var b = 20; | ||
| /* exclude:start */ | ||
| var c = 30; | ||
| /* exclude:stop */ |
+24
-0
@@ -163,2 +163,26 @@ /* | ||
| src: 'test/tmp/legacy_start_end.js' | ||
| }, | ||
| custom_eol_lf: { | ||
| options: { | ||
| eol: 'lf', | ||
| blocks: [ | ||
| { | ||
| start_block: '/* exclude:start */', | ||
| end_block: '/* exclude:stop */' | ||
| } | ||
| ] | ||
| }, | ||
| src: 'test/tmp/custom_eol1.js' | ||
| }, | ||
| custom_eol_crlf: { | ||
| options: { | ||
| eol: 'crlf', | ||
| blocks: [ | ||
| { | ||
| start_block: '/* exclude:start */', | ||
| end_block: '/* exclude:stop */' | ||
| } | ||
| ] | ||
| }, | ||
| src: 'test/tmp/custom_eol2.js' | ||
| } | ||
@@ -165,0 +189,0 @@ }, |
+1
-1
| { | ||
| "name": "grunt-strip-code", | ||
| "description": "Remove dev and test only code in production builds", | ||
| "version": "1.0.4", | ||
| "version": "1.0.5", | ||
| "homepage": "https://github.com/nuzzio/grunt-strip-code", | ||
@@ -6,0 +6,0 @@ "author": { |
+12
-1
@@ -25,3 +25,3 @@ # grunt-strip-code | ||
| ## Getting Started | ||
| This plugin requires Grunt `>=0.4.0 <=1.0.1` | ||
| This plugin requires Grunt `>=0.4.0` | ||
@@ -105,2 +105,9 @@ If you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command: | ||
| #### options.eol | ||
| Type: `String` | ||
| Choices: `'lf'`, `'cr'`, `'crlf'` | ||
| Default value: `''` | ||
| Unless one of the choices is explicitly specified, end-of-line defaults to the operating system specific character(s). | ||
| ### Usage Examples | ||
@@ -302,2 +309,6 @@ | ||
| #### 1.0.5 | ||
| Custom line endings contributed. | ||
| #### 1.0.4 | ||
@@ -304,0 +315,0 @@ |
+24
-3
@@ -63,5 +63,26 @@ /* | ||
| end_comment: false, | ||
| pattern: false | ||
| pattern: false, | ||
| eol: '' | ||
| }); | ||
| // | ||
| // Allow custom end-of-line, if specified. | ||
| // | ||
| var endOfLine; | ||
| switch(options.eol) { | ||
| case 'lf': | ||
| endOfLine = '\n'; | ||
| break; | ||
| case 'crlf': | ||
| endOfLine = '\r\n'; | ||
| break; | ||
| default: | ||
| endOfLine = grunt.util.linefeed; | ||
| break; | ||
| } | ||
| /** | ||
@@ -178,3 +199,3 @@ * Takes in dynamic parameters and expects first param to be a key for a string, | ||
| '[\\t ]*', | ||
| escapeStringRegexp(grunt.util.linefeed) + '?' | ||
| escapeStringRegexp(endOfLine) + '?' | ||
| ]; | ||
@@ -375,3 +396,3 @@ | ||
| */ | ||
| contents.split(grunt.util.linefeed).forEach(checkLine); | ||
| contents.split(endOfLine).forEach(checkLine); | ||
@@ -378,0 +399,0 @@ /** |
@@ -13,2 +13,3 @@ /** | ||
| var helper = require('./helper.js').helper; | ||
| var os = require('os'); | ||
@@ -208,3 +209,59 @@ /* | ||
| test.done(); | ||
| }, | ||
| custom_eol_lf: function (test) { | ||
| test.expect(1); | ||
| var file = 'custom_eol1.js'; | ||
| var actual = helper.tmpReader(file); | ||
| var expected; | ||
| if (os.EOL === '\n') { | ||
| expected = helper.expectedReader('custom_eol_stripped.js'); | ||
| test.equal( | ||
| actual, | ||
| expected, | ||
| 'should strip code when default end-of-line is "lf"' | ||
| ); | ||
| } else { | ||
| expected = helper.expectedReader('custom_eol_as_is.js'); | ||
| test.equal( | ||
| actual, | ||
| expected, | ||
| 'should not strip code when default end-of-line is not "lf"' | ||
| ); | ||
| } | ||
| test.done(); | ||
| }, | ||
| custom_eol_crlf: function (test) { | ||
| test.expect(1); | ||
| var file = 'custom_eol2.js'; | ||
| var actual = helper.tmpReader(file); | ||
| var expected; | ||
| if (os.EOL === '\r\n') { | ||
| expected = helper.expectedReader('custom_eol_stripped.js'); | ||
| test.equal( | ||
| actual, | ||
| expected, | ||
| 'should strip code when default end-of-line is "crlf"' | ||
| ); | ||
| } else { | ||
| expected = helper.expectedReader('custom_eol_as_is.js'); | ||
| test.equal( | ||
| actual, | ||
| expected, | ||
| 'should not strip code when default end-of-line is not "crlf"' | ||
| ); | ||
| } | ||
| test.done(); | ||
| } | ||
| }; |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
44033
6.99%41
10.81%992
11.46%339
3.35%