js-conditional-compile-loader
Advanced tools
+6
-1
@@ -10,3 +10,8 @@ var loaderUtils = require('loader-utils'); | ||
| } | ||
| return replacer.replaceMatched(source, options) | ||
| source = replacer.replaceMatched(source, options) | ||
| // changeSource 可修改内容 | ||
| if (options.changeSource) { | ||
| source = options.changeSource(source, options) | ||
| } | ||
| return source | ||
| }; |
+0
-0
@@ -0,0 +0,0 @@ MIT License |
+1
-1
| { | ||
| "name": "js-conditional-compile-loader", | ||
| "version": "1.0.15", | ||
| "version": "1.0.16", | ||
| "description": "A conditional compiling loader for webpack, support js,ts,css,scss,vue. 一个条件编译的webpack loader,支持js,ts,css,scss,vue等。", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
+11
-1
@@ -117,4 +117,14 @@ # js-conditional-compile-loader | ||
| - 任意属性名:boolean | ||
| - changeSource: Function(source, options) | ||
| 自定义的修改源码函数。可选。比如对于后端为java环境时,将代码中的`.aspx`替换为`.do`: | ||
| ````js | ||
| var options = { | ||
| changeSource: process.env.npm_config_java ? source => source.replace(/\.aspx\b/i, '.do') : null | ||
| } | ||
| ```` | ||
| - 其他任意属性名:boolean | ||
| 如果 [属性值] === false,则所有`/\* IFTRUE_属性名` 和 `FITRUE_属性名 \*/`之间的代码都会被移除。 其他情况,这些代码则会被保留。 | ||
@@ -121,0 +131,0 @@ |
+10
-0
@@ -113,2 +113,12 @@ # js-conditional-compile-loader | ||
| - changeSource: Function(source, options) | ||
| Custom function to change source code. Optional. Sample: change `.aspx` to `.do` for java backend: | ||
| ````js | ||
| var options = { | ||
| changeSource: process.env.npm_config_java ? source => source.replace(/\.aspx\b/i, '.do') : null | ||
| } | ||
| ```` | ||
| - \[any propertyName\]:{bool} | ||
@@ -115,0 +125,0 @@ if [propertyValue] === false, all codes between `/\* IFTRUE_propertyName` and `FITRUE_propertyName \*/` will be removed, otherwise the codes will be remained. |
+0
-0
@@ -0,0 +0,0 @@ var REG = /\/\*\s*IF(DEBUG|TRUE_\w+)(?:\s*\*\/)?([\s\S]+?)(?:\/\*\s*)?FI\1\s*\*\//g; |
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
15353
1.41%29
20.83%222
4.72%