smart-preprocessor
Advanced tools
Comparing version 0.0.3 to 0.0.4
@@ -39,3 +39,3 @@ # TOC | ||
"var debug = false ;\n" + | ||
"debug = true ; //#! production\n" + | ||
"debug = true ; //#production!\n" + | ||
"console.log( debug ) ;\n" ; | ||
@@ -78,10 +78,10 @@ | ||
```js | ||
expect( spp.preprocess( "debug = true ;//#!production" ) ).to.be( "debug = true ;" ) ; | ||
expect( spp.preprocess( "debug = true ;//#!production" , { production: true } ) ).to.be( "//debug = true ;" ) ; | ||
expect( spp.preprocess( "debug = true ;//#production!" ) ).to.be( "debug = true ;" ) ; | ||
expect( spp.preprocess( "debug = true ;//#production!" , { production: true } ) ).to.be( "//debug = true ;" ) ; | ||
expect( spp.preprocess( "debug = true ; \t //# \t ! \t production \t " ) ).to.be( "debug = true ;" ) ; | ||
expect( spp.preprocess( "debug = true ; \t //# \t ! \t production \t " , { production: true } ) ).to.be( "//debug = true ;" ) ; | ||
expect( spp.preprocess( "debug = true ; \t //# \t production \t ! \t " ) ).to.be( "debug = true ;" ) ; | ||
expect( spp.preprocess( "debug = true ; \t //# \t production \t ! \t " , { production: true } ) ).to.be( "//debug = true ;" ) ; | ||
expect( spp.preprocess( " \t debug = true ; \t //# \t ! \t production \t " ) ).to.be( " \t debug = true ;" ) ; | ||
expect( spp.preprocess( " \t debug = true ; \t //# \t ! \t production \t " , { production: true } ) ).to.be( " \t //debug = true ;" ) ; | ||
expect( spp.preprocess( " \t debug = true ; \t //# \t production \t ! \t " ) ).to.be( " \t debug = true ;" ) ; | ||
expect( spp.preprocess( " \t debug = true ; \t //# \t production \t ! \t " , { production: true } ) ).to.be( " \t //debug = true ;" ) ; | ||
``` | ||
@@ -129,3 +129,3 @@ | ||
"var debug = false ;\n" + | ||
"//*#! production\n" + | ||
"//*# production !\n" + | ||
"debug = true ;\n" + | ||
@@ -204,3 +204,3 @@ "//*/\n" + | ||
"fn1() ;\n" + | ||
"console.log( '[VERBOSE] Loading...' ) ; //#!debug=error\n" + | ||
"console.log( '[VERBOSE] Loading...' ) ; //# debug=error !\n" + | ||
"fn2() ;\n" ; | ||
@@ -295,3 +295,3 @@ | ||
"fn1() ;\n" + | ||
"//*#!debug=error\n" + | ||
"//*# debug=error !\n" + | ||
"console.log( '[TRACE] Current state: ' , state ) ;\n" + | ||
@@ -298,0 +298,0 @@ "//*/\n" + |
@@ -50,7 +50,6 @@ /* | ||
// Comment/remove line tag | ||
str = str.replace( /(^|\n)([ \t]*)(.*?)[ \t]*\/\/#[ \t]*![ \t]*([a-zA-Z0-9_.-]+)(?:[ \t]*=[ \t]*([a-zA-Z0-9_.-]+))?[ \t]*($|\n)/g , | ||
// Comment line tag | ||
str = str.replace( /(^|\n)([ \t]*)(.*?)[ \t]*\/\/#[ \t]*([a-zA-Z0-9_.-]+)(?:[ \t]*=[ \t]*([a-zA-Z0-9_.-]+))?[ \t]*![ \t]*($|\n)/g , | ||
function( match , sol , indent , code , parameter , value , eol ) { | ||
//if ( value ? parameters[ parameter ] === value : parameters[ parameter ] ) { return sol ; } | ||
if ( value ? parameters[ parameter ] === value : parameters[ parameter ] ) { return sol + indent + '//' + code + eol ; } | ||
@@ -71,3 +70,3 @@ else { return sol + indent + code + eol ; } | ||
// Comment block tag | ||
str = str.replace( /(^|\n)([ \t]*)\/\/\*#[ \t]*![ \t]*([a-zA-Z0-9_.-]+)(?:[ \t]*=[ \t]*([a-zA-Z0-9_.-]+))?[ \t]*($|\n)/g , | ||
str = str.replace( /(^|\n)([ \t]*)\/\/\*#[ \t]*([a-zA-Z0-9_.-]+)(?:[ \t]*=[ \t]*([a-zA-Z0-9_.-]+))?[ \t]*![ \t]*($|\n)/g , | ||
function( match , sol , indent , parameter , value , eol ) { | ||
@@ -74,0 +73,0 @@ |
{ | ||
"name": "smart-preprocessor", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "A smart preprocessor for Node.", | ||
@@ -5,0 +5,0 @@ "main": "lib/smartPreprocessor.js", |
@@ -73,3 +73,3 @@ /* | ||
"var debug = false ;\n" + | ||
"debug = true ; //#! production\n" + | ||
"debug = true ; //#production!\n" + | ||
"console.log( debug ) ;\n" ; | ||
@@ -110,10 +110,10 @@ | ||
expect( spp.preprocess( "debug = true ;//#!production" ) ).to.be( "debug = true ;" ) ; | ||
expect( spp.preprocess( "debug = true ;//#!production" , { production: true } ) ).to.be( "//debug = true ;" ) ; | ||
expect( spp.preprocess( "debug = true ;//#production!" ) ).to.be( "debug = true ;" ) ; | ||
expect( spp.preprocess( "debug = true ;//#production!" , { production: true } ) ).to.be( "//debug = true ;" ) ; | ||
expect( spp.preprocess( "debug = true ; \t //# \t ! \t production \t " ) ).to.be( "debug = true ;" ) ; | ||
expect( spp.preprocess( "debug = true ; \t //# \t ! \t production \t " , { production: true } ) ).to.be( "//debug = true ;" ) ; | ||
expect( spp.preprocess( "debug = true ; \t //# \t production \t ! \t " ) ).to.be( "debug = true ;" ) ; | ||
expect( spp.preprocess( "debug = true ; \t //# \t production \t ! \t " , { production: true } ) ).to.be( "//debug = true ;" ) ; | ||
expect( spp.preprocess( " \t debug = true ; \t //# \t ! \t production \t " ) ).to.be( " \t debug = true ;" ) ; | ||
expect( spp.preprocess( " \t debug = true ; \t //# \t ! \t production \t " , { production: true } ) ).to.be( " \t //debug = true ;" ) ; | ||
expect( spp.preprocess( " \t debug = true ; \t //# \t production \t ! \t " ) ).to.be( " \t debug = true ;" ) ; | ||
expect( spp.preprocess( " \t debug = true ; \t //# \t production \t ! \t " , { production: true } ) ).to.be( " \t //debug = true ;" ) ; | ||
} ) ; | ||
@@ -159,3 +159,3 @@ | ||
"var debug = false ;\n" + | ||
"//*#! production\n" + | ||
"//*# production !\n" + | ||
"debug = true ;\n" + | ||
@@ -232,3 +232,3 @@ "//*/\n" + | ||
"fn1() ;\n" + | ||
"console.log( '[VERBOSE] Loading...' ) ; //#!debug=error\n" + | ||
"console.log( '[VERBOSE] Loading...' ) ; //# debug=error !\n" + | ||
"fn2() ;\n" ; | ||
@@ -321,3 +321,3 @@ | ||
"fn1() ;\n" + | ||
"//*#!debug=error\n" + | ||
"//*# debug=error !\n" + | ||
"console.log( '[TRACE] Current state: ' , state ) ;\n" + | ||
@@ -324,0 +324,0 @@ "//*/\n" + |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
28297
351