sptc 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,7 +13,6 @@ module.exports=async function(str) {
13
13
  const {
14
14
  EXTENDS=(wCtx=>({})),
15
15
  TPLS=[],
16
- DEFINES=[],
17
16
  }=query
18
17
 
19
18
  let wCtx={
@@ -21,16 +20,27 @@ module.exports=async function(str) {
21
20
  fn: path.resolve(this.resourcePath).replace(/\\+/g, '/'),
22
21
  webpackLoaderThis: this,
23
22
  }
24
- const globals=Object.assign(EXTENDS(wCtx), {wCtx})
23
+
24
+ const E=EXTENDS(wCtx)
25
+ const globals=Object.assign(E, {wCtx})
25
26
  wCtx.runtimeGlobals=globals
26
27
 
27
28
  let callback=this.async()
28
29
  try{
29
- const output=await executeSptcFileEx(wCtx.fn, globals, {
30
- __DEV__: true,
30
+ const EX={
31
+ __DEV__: false,
31
32
  macroOption: {
32
- defs: DEFINES,
33
+ defs: [],
33
34
  },
35
+ }
36
+ for(let k in E) {
37
+ if(k.match(/^[A-Z_\d]+$/) && typeof E[k]==='boolean' && E[k]) {
38
+ EX.__DEV__=true
39
+ EX.macroOption.defs[k]=E[k]
40
+ }
41
+ }
42
+ const output=await executeSptcFileEx(wCtx.fn, globals, {
43
+ ...EX,
34
44
  mockFileContent: wCtx.str,
35
45
  })
36
46
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sptc",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "description": "Simple Pretreat Toolkit CLI",
5
5
  "main": "index.js",
6
6
  "engines": {