zyd-server-build2 1.0.17 → 1.0.18

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 (2) hide show
  1. package/index.js +8 -3
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -11,8 +11,7 @@ const count = [0, 0, 0]
11
11
  const timer = []
12
12
  const version = require('./package.json').version
13
13
  let baseDst = ''
14
- const operatingDir = generateComplexRandomString(5)
15
-
14
+ const pathLevel = []
16
15
  async function build({ src, dst, ignoreDir = [], ignoreFile = [], copyright = "", noBuildFile = [], noBuildDir = [], noEncryptionPathFile = [], confused = 1, options = {}, encryptionPath = 0 }) {
17
16
  if (!src || !dst) {
18
17
  return
@@ -22,7 +21,13 @@ async function build({ src, dst, ignoreDir = [], ignoreFile = [], copyright = ""
22
21
  const _src = src + "/" + file
23
22
  let _dst = dst + "/" + file
24
23
  if (encryptionPath && !ignore(noBuildFile, _src) && confused === 1 && path.extname(_src) === ".js" && !ignore(noEncryptionPathFile, _src)) {
25
- _dst = `${baseDst}/z.${operatingDir}/${generateComplexRandomString(5)}.${Math.random().toString(36).substring(2, 10)}.js`
24
+ const pathStr = dst.split(baseDst + '/')[1]?.split('/').map((_item, index) => {
25
+ if (!pathLevel[index]) {
26
+ pathLevel.push(generateComplexRandomString(5))
27
+ }
28
+ return pathLevel[index]
29
+ }).join('/')
30
+ _dst = `${baseDst}/z.${pathStr}/${generateComplexRandomString(5)}.${Math.random().toString(36).substring(2, 10)}.js`
26
31
  }
27
32
  const st = fs.statSync(_src)
28
33
  if (st.isFile()) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zyd-server-build2",
3
- "version": "1.0.17",
3
+ "version": "1.0.18",
4
4
  "description": "基于terser的js混淆build库,通过babel支持es6+",
5
5
  "main": "index.js",
6
6
  "scripts": {