zyd-server-build2 1.0.19 → 1.0.21

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.
Files changed (3) hide show
  1. package/README.md +2 -1
  2. package/index.js +4 -2
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -88,7 +88,8 @@ zsb({
88
88
  DEBUG: false
89
89
  },
90
90
  },
91
- encryptionPath: 0 // 混淆加密路径,默认为0,0代表不加密,1代表加密路径
91
+ encryptionPath: 0, // 混淆加密路径,默认为0,0代表不加密,1代表加密路径
92
+ afterBuild: () => {} // 编译后运行的函数
92
93
  })
93
94
  ```
94
95
  ## License
package/index.js CHANGED
@@ -26,7 +26,7 @@ async function build({ src, dst, ignoreDir = [], ignoreFile = [], copyright = ""
26
26
  pathLevel.push(generateComplexRandomString(5))
27
27
  }
28
28
  return pathLevel[index]
29
- }).join('/')
29
+ }).join('/') || pathLevel[0]
30
30
  _dst = `${baseDst}/z.${pathStr}/${generateComplexRandomString(5)}.${Math.random().toString(36).substring(2, 10)}.js`
31
31
  }
32
32
  const st = fs.statSync(_src)
@@ -258,7 +258,8 @@ module.exports = async ({
258
258
  DEBUG: false
259
259
  },
260
260
  },
261
- encryptionPath = 0
261
+ encryptionPath = 0,
262
+ afterBuild = () => { }
262
263
  } = {}) => {
263
264
  console.log(`\x1B[33m
264
265
  ┌─────────────────────┐
@@ -274,6 +275,7 @@ module.exports = async ({
274
275
  await execSync(`rm -rf ${dst}`)
275
276
  await build({ src, dst, ignoreDir, ignoreFile, copyright, noBuildFile, noBuildDir, noEncryptionPathFile, options, encryptionPath })
276
277
  process.nextTick(async () => {
278
+ afterBuild && afterBuild()
277
279
  console.log("")
278
280
  console.log(`number of files: \x1B[36m${count[0]}\x1B[0m`)
279
281
  console.log(`Number of Obfuscated Files: \x1B[36m${count[1]}\x1B[0m`)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zyd-server-build2",
3
- "version": "1.0.19",
3
+ "version": "1.0.21",
4
4
  "description": "基于terser的js混淆build库,通过babel支持es6+",
5
5
  "main": "index.js",
6
6
  "scripts": {