string-uglify 2.0.10 → 2.0.13

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.
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2010-2021 Roy Revelt and other contributors
3
+ Copyright (c) 2010-2022 Roy Revelt and other contributors
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining
6
6
  a copy of this software and associated documentation files (the
package/README.md CHANGED
@@ -26,14 +26,12 @@
26
26
 
27
27
  ## Install
28
28
 
29
- This package is ESM only: Node 12+ is needed to use it and it must be imported instead of required:
29
+ This package is [pure ESM](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c). If you're not ready yet, install an older version of this program, 1.5.0 (`npm i string-uglify@1.5.0`).
30
30
 
31
31
  ```bash
32
32
  npm i string-uglify
33
33
  ```
34
34
 
35
- If you need a legacy version which works with `require`, use version 1.5.0
36
-
37
35
  ## Quick Take
38
36
 
39
37
  ```js
@@ -70,8 +68,6 @@ To report bugs or request features or assistance, [raise an issue](https://githu
70
68
 
71
69
  MIT License
72
70
 
73
- Copyright (c) 2010-2021 Roy Revelt and other contributors
74
-
71
+ Copyright (c) 2010-2022 Roy Revelt and other contributors
75
72
 
76
73
  <img src="https://codsen.com/images/png-codsen-ok.png" width="98" alt="ok" align="center"> <img src="https://codsen.com/images/png-codsen-1.png" width="148" alt="codsen" align="center"> <img src="https://codsen.com/images/png-codsen-star-small.png" width="32" alt="star" align="center">
77
-
@@ -1,10 +1,10 @@
1
1
  /**
2
2
  * @name string-uglify
3
3
  * @fileoverview Shorten sets of strings deterministically, to be git-friendly
4
- * @version 2.0.10
4
+ * @version 2.0.13
5
5
  * @author Roy Revelt, Codsen Ltd
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/string-uglify/}
8
8
  */
9
9
 
10
- var p="2.0.10";var E=p;function m(l,o=0){return l.codePointAt(o)||0}function k(l){let o="abcdefghijklmnopqrstuvwxyz",u="abcdefghijklmnopqrstuvwxyz0123456789",n={a:!1,b:!1,c:!1,d:!1,e:!1,f:!1,g:!1,h:!1,i:!1,j:!1,k:!1,l:!1,m:!1,n:!1,o:!1,p:!1,q:!1,r:!1,s:!1,t:!1,u:!1,v:!1,w:!1,x:!1,y:!1,z:!1},f={a:!1,b:!1,c:!1,d:!1,e:!1,f:!1,g:!1,h:!1,i:!1,j:!1,k:!1,l:!1,m:!1,n:!1,o:!1,p:!1,q:!1,r:!1,s:!1,t:!1,u:!1,v:!1,w:!1,x:!1,y:!1,z:!1},a={a:!1,b:!1,c:!1,d:!1,e:!1,f:!1,g:!1,h:!1,i:!1,j:!1,k:!1,l:!1,m:!1,n:!1,o:!1,p:!1,q:!1,r:!1,s:!1,t:!1,u:!1,v:!1,w:!1,x:!1,y:!1,z:!1},s=[];if(!Array.isArray(l)||!l.length)return l;for(let e=0,h=l.length;e<h;e++){if(l.indexOf(l[e])<e){s.push(s[l.indexOf(l[e])]);continue}let y=".#".includes(l[e][0])?l[e][0]:"",$=Array.from(l[e]).reduce((t,c)=>t+m(c),0);if(".#".includes(l[e][0])&&l[e].length<4||!".#".includes(l[e][0])&&l[e].length<3){let t=l[e];if(!s.includes(t)){s.push(t),t.startsWith(".")&&t.length===2&&n[t.slice(1)]===!1?n[t.slice(1)]=!0:t.startsWith("#")&&t.length===2&&f[t.slice(1)]===!1?f[t.slice(1)]=!0:!t.startsWith(".")&&!t.startsWith("#")&&t.length===1&&a[t]===!1&&(a[t]=!0);continue}}let i=`${y}${o[$%o.length]}${u[$%u.length]}`;if(s.includes(i)){let t=i,c=0,b=Array.from(l[e]).reduce((r,g)=>r<200?r+m(g):(r+m(g))%u.length,0),v=Array.from(l[e]).map(r=>m(r)).reduce((r,g)=>{let d=r+g;do d=String(d).split("").reduce((x,j)=>x+Number.parseInt(j,10),0);while(d>=10);return d},0);for(;s.includes(t);)c+=1,t+=u[b*v*c%u.length];i=t}s.push(i),i.startsWith(".")&&i.length===2&&n[i.slice(1)]===!1?n[i.slice(1)]=!0:i.startsWith("#")&&i.length===2&&f[i.slice(1)]===!1?f[i.slice(1)]=!0:!i.startsWith(".")&&!i.startsWith("#")&&i.length===1&&a[i]===!1&&(a[i]=!0)}for(let e=0,h=s.length;e<h;e++)s[e].startsWith(".")?n[s[e].slice(1,2)]===!1?(n[s[e].slice(1,2)]=s[e],s[e]=s[e].slice(0,2)):n[s[e].slice(1,2)]===s[e]&&(s[e]=s[e].slice(0,2)):s[e].startsWith("#")?f[s[e].slice(1,2)]===!1?(f[s[e].slice(1,2)]=s[e],s[e]=s[e].slice(0,2)):f[s[e].slice(1,2)]===s[e]&&(s[e]=s[e].slice(0,2)):!s[e].startsWith(".")&&!s[e].startsWith("#")&&(a[s[e].slice(0,1)]?a[s[e].slice(0,1)]===s[e]&&(s[e]=s[e].slice(0,1)):(a[s[e].slice(0,1)]=s[e],s[e]=s[e].slice(0,1)));return s}function N(l,o){return k(l)[o]}export{k as uglifyArr,N as uglifyById,E as version};
10
+ var $="2.0.13";var D=$;function m(l,o=0){return l.codePointAt(o)||0}function w(l){let o="abcdefghijklmnopqrstuvwxyz",u="abcdefghijklmnopqrstuvwxyz0123456789",n={a:!1,b:!1,c:!1,d:!1,e:!1,f:!1,g:!1,h:!1,i:!1,j:!1,k:!1,l:!1,m:!1,n:!1,o:!1,p:!1,q:!1,r:!1,s:!1,t:!1,u:!1,v:!1,w:!1,x:!1,y:!1,z:!1},r={a:!1,b:!1,c:!1,d:!1,e:!1,f:!1,g:!1,h:!1,i:!1,j:!1,k:!1,l:!1,m:!1,n:!1,o:!1,p:!1,q:!1,r:!1,s:!1,t:!1,u:!1,v:!1,w:!1,x:!1,y:!1,z:!1},a={a:!1,b:!1,c:!1,d:!1,e:!1,f:!1,g:!1,h:!1,i:!1,j:!1,k:!1,l:!1,m:!1,n:!1,o:!1,p:!1,q:!1,r:!1,s:!1,t:!1,u:!1,v:!1,w:!1,x:!1,y:!1,z:!1},s=[];if(!Array.isArray(l)||!l.length)return l;for(let e=0,p=l.length;e<p;e++){if(l.indexOf(l[e])<e){s.push(s[l.indexOf(l[e])]);continue}let y=".#".includes(l[e][0])?l[e][0]:"",h=Array.from(l[e]).reduce((t,c)=>t+m(c),0);if(".#".includes(l[e][0])&&l[e].length<4||!".#".includes(l[e][0])&&l[e].length<3){let t=l[e];if(!s.includes(t)){s.push(t),t.startsWith(".")&&t.length===2&&n[t.slice(1)]===!1?n[t.slice(1)]=!0:t.startsWith("#")&&t.length===2&&r[t.slice(1)]===!1?r[t.slice(1)]=!0:!t.startsWith(".")&&!t.startsWith("#")&&t.length===1&&a[t]===!1&&(a[t]=!0);continue}}let i=`${y}${o[h%o.length]}${u[h%u.length]}`;if(s.includes(i)){let t=i,c=0,b=Array.from(l[e]).reduce((f,g)=>f<200?f+m(g):(f+m(g))%u.length,0),v=Array.from(l[e]).map(f=>m(f)).reduce((f,g)=>{let d=f+g;do d=String(d).split("").reduce((x,j)=>x+Number.parseInt(j,10),0);while(d>=10);return d},0);for(;s.includes(t);)c+=1,t+=u[b*v*c%u.length];i=t}s.push(i),i.startsWith(".")&&i.length===2&&n[i.slice(1)]===!1?n[i.slice(1)]=!0:i.startsWith("#")&&i.length===2&&r[i.slice(1)]===!1?r[i.slice(1)]=!0:!i.startsWith(".")&&!i.startsWith("#")&&i.length===1&&a[i]===!1&&(a[i]=!0)}for(let e=0,p=s.length;e<p;e++)s[e].startsWith(".")?n[s[e].slice(1,2)]===!1?(n[s[e].slice(1,2)]=s[e],s[e]=s[e].slice(0,2)):n[s[e].slice(1,2)]===s[e]&&(s[e]=s[e].slice(0,2)):s[e].startsWith("#")?r[s[e].slice(1,2)]===!1?(r[s[e].slice(1,2)]=s[e],s[e]=s[e].slice(0,2)):r[s[e].slice(1,2)]===s[e]&&(s[e]=s[e].slice(0,2)):!s[e].startsWith(".")&&!s[e].startsWith("#")&&(a[s[e].slice(0,1)]?a[s[e].slice(0,1)]===s[e]&&(s[e]=s[e].slice(0,1)):(a[s[e].slice(0,1)]=s[e],s[e]=s[e].slice(0,1)));return s}function A(l,o){return w(l)[o]}export{w as uglifyArr,A as uglifyById,D as version};
@@ -1,10 +1,10 @@
1
1
  /**
2
2
  * @name string-uglify
3
3
  * @fileoverview Shorten sets of strings deterministically, to be git-friendly
4
- * @version 2.0.10
4
+ * @version 2.0.13
5
5
  * @author Roy Revelt, Codsen Ltd
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/string-uglify/}
8
8
  */
9
9
 
10
- var stringUglify=(()=>{var $=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var D=Object.getOwnPropertyNames;var E=Object.prototype.hasOwnProperty;var N=l=>$(l,"__esModule",{value:!0});var O=(l,i)=>{for(var f in i)$(l,f,{get:i[f],enumerable:!0})},V=(l,i,f,r)=>{if(i&&typeof i=="object"||typeof i=="function")for(let a of D(i))!E.call(l,a)&&(f||a!=="default")&&$(l,a,{get:()=>i[a],enumerable:!(r=w(i,a))||r.enumerable});return l};var A=(l=>(i,f)=>l&&l.get(i)||(f=V(N({}),i,1),l&&l.set(i,f),f))(typeof WeakMap!="undefined"?new WeakMap:0);var q={};O(q,{uglifyArr:()=>b,uglifyById:()=>I,version:()=>C});var y="2.0.10";var C=y;function m(l,i=0){return l.codePointAt(i)||0}function b(l){let i="abcdefghijklmnopqrstuvwxyz",f="abcdefghijklmnopqrstuvwxyz0123456789",r={a:!1,b:!1,c:!1,d:!1,e:!1,f:!1,g:!1,h:!1,i:!1,j:!1,k:!1,l:!1,m:!1,n:!1,o:!1,p:!1,q:!1,r:!1,s:!1,t:!1,u:!1,v:!1,w:!1,x:!1,y:!1,z:!1},a={a:!1,b:!1,c:!1,d:!1,e:!1,f:!1,g:!1,h:!1,i:!1,j:!1,k:!1,l:!1,m:!1,n:!1,o:!1,p:!1,q:!1,r:!1,s:!1,t:!1,u:!1,v:!1,w:!1,x:!1,y:!1,z:!1},o={a:!1,b:!1,c:!1,d:!1,e:!1,f:!1,g:!1,h:!1,i:!1,j:!1,k:!1,l:!1,m:!1,n:!1,o:!1,p:!1,q:!1,r:!1,s:!1,t:!1,u:!1,v:!1,w:!1,x:!1,y:!1,z:!1},s=[];if(!Array.isArray(l)||!l.length)return l;for(let e=0,h=l.length;e<h;e++){if(l.indexOf(l[e])<e){s.push(s[l.indexOf(l[e])]);continue}let v=".#".includes(l[e][0])?l[e][0]:"",p=Array.from(l[e]).reduce((t,c)=>t+m(c),0);if(".#".includes(l[e][0])&&l[e].length<4||!".#".includes(l[e][0])&&l[e].length<3){let t=l[e];if(!s.includes(t)){s.push(t),t.startsWith(".")&&t.length===2&&r[t.slice(1)]===!1?r[t.slice(1)]=!0:t.startsWith("#")&&t.length===2&&a[t.slice(1)]===!1?a[t.slice(1)]=!0:!t.startsWith(".")&&!t.startsWith("#")&&t.length===1&&o[t]===!1&&(o[t]=!0);continue}}let n=`${v}${i[p%i.length]}${f[p%f.length]}`;if(s.includes(n)){let t=n,c=0,x=Array.from(l[e]).reduce((u,g)=>u<200?u+m(g):(u+m(g))%f.length,0),j=Array.from(l[e]).map(u=>m(u)).reduce((u,g)=>{let d=u+g;do d=String(d).split("").reduce((W,k)=>W+Number.parseInt(k,10),0);while(d>=10);return d},0);for(;s.includes(t);)c+=1,t+=f[x*j*c%f.length];n=t}s.push(n),n.startsWith(".")&&n.length===2&&r[n.slice(1)]===!1?r[n.slice(1)]=!0:n.startsWith("#")&&n.length===2&&a[n.slice(1)]===!1?a[n.slice(1)]=!0:!n.startsWith(".")&&!n.startsWith("#")&&n.length===1&&o[n]===!1&&(o[n]=!0)}for(let e=0,h=s.length;e<h;e++)s[e].startsWith(".")?r[s[e].slice(1,2)]===!1?(r[s[e].slice(1,2)]=s[e],s[e]=s[e].slice(0,2)):r[s[e].slice(1,2)]===s[e]&&(s[e]=s[e].slice(0,2)):s[e].startsWith("#")?a[s[e].slice(1,2)]===!1?(a[s[e].slice(1,2)]=s[e],s[e]=s[e].slice(0,2)):a[s[e].slice(1,2)]===s[e]&&(s[e]=s[e].slice(0,2)):!s[e].startsWith(".")&&!s[e].startsWith("#")&&(o[s[e].slice(0,1)]?o[s[e].slice(0,1)]===s[e]&&(s[e]=s[e].slice(0,1)):(o[s[e].slice(0,1)]=s[e],s[e]=s[e].slice(0,1)));return s}function I(l,i){return b(l)[i]}return A(q);})();
10
+ var stringUglify=(()=>{var h=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var k=Object.getOwnPropertyNames;var D=Object.prototype.hasOwnProperty;var A=(l,n)=>{for(var a in n)h(l,a,{get:n[a],enumerable:!0})},N=(l,n,a,f)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of k(n))!D.call(l,r)&&r!==a&&h(l,r,{get:()=>n[r],enumerable:!(f=E(n,r))||f.enumerable});return l};var O=l=>N(h({},"__esModule",{value:!0}),l);var I={};A(I,{uglifyArr:()=>b,uglifyById:()=>C,version:()=>S});var y="2.0.13";var S=y;function m(l,n=0){return l.codePointAt(n)||0}function b(l){let n="abcdefghijklmnopqrstuvwxyz",a="abcdefghijklmnopqrstuvwxyz0123456789",f={a:!1,b:!1,c:!1,d:!1,e:!1,f:!1,g:!1,h:!1,i:!1,j:!1,k:!1,l:!1,m:!1,n:!1,o:!1,p:!1,q:!1,r:!1,s:!1,t:!1,u:!1,v:!1,w:!1,x:!1,y:!1,z:!1},r={a:!1,b:!1,c:!1,d:!1,e:!1,f:!1,g:!1,h:!1,i:!1,j:!1,k:!1,l:!1,m:!1,n:!1,o:!1,p:!1,q:!1,r:!1,s:!1,t:!1,u:!1,v:!1,w:!1,x:!1,y:!1,z:!1},o={a:!1,b:!1,c:!1,d:!1,e:!1,f:!1,g:!1,h:!1,i:!1,j:!1,k:!1,l:!1,m:!1,n:!1,o:!1,p:!1,q:!1,r:!1,s:!1,t:!1,u:!1,v:!1,w:!1,x:!1,y:!1,z:!1},s=[];if(!Array.isArray(l)||!l.length)return l;for(let e=0,p=l.length;e<p;e++){if(l.indexOf(l[e])<e){s.push(s[l.indexOf(l[e])]);continue}let v=".#".includes(l[e][0])?l[e][0]:"",$=Array.from(l[e]).reduce((t,c)=>t+m(c),0);if(".#".includes(l[e][0])&&l[e].length<4||!".#".includes(l[e][0])&&l[e].length<3){let t=l[e];if(!s.includes(t)){s.push(t),t.startsWith(".")&&t.length===2&&f[t.slice(1)]===!1?f[t.slice(1)]=!0:t.startsWith("#")&&t.length===2&&r[t.slice(1)]===!1?r[t.slice(1)]=!0:!t.startsWith(".")&&!t.startsWith("#")&&t.length===1&&o[t]===!1&&(o[t]=!0);continue}}let i=`${v}${n[$%n.length]}${a[$%a.length]}`;if(s.includes(i)){let t=i,c=0,x=Array.from(l[e]).reduce((u,g)=>u<200?u+m(g):(u+m(g))%a.length,0),j=Array.from(l[e]).map(u=>m(u)).reduce((u,g)=>{let d=u+g;do d=String(d).split("").reduce((W,w)=>W+Number.parseInt(w,10),0);while(d>=10);return d},0);for(;s.includes(t);)c+=1,t+=a[x*j*c%a.length];i=t}s.push(i),i.startsWith(".")&&i.length===2&&f[i.slice(1)]===!1?f[i.slice(1)]=!0:i.startsWith("#")&&i.length===2&&r[i.slice(1)]===!1?r[i.slice(1)]=!0:!i.startsWith(".")&&!i.startsWith("#")&&i.length===1&&o[i]===!1&&(o[i]=!0)}for(let e=0,p=s.length;e<p;e++)s[e].startsWith(".")?f[s[e].slice(1,2)]===!1?(f[s[e].slice(1,2)]=s[e],s[e]=s[e].slice(0,2)):f[s[e].slice(1,2)]===s[e]&&(s[e]=s[e].slice(0,2)):s[e].startsWith("#")?r[s[e].slice(1,2)]===!1?(r[s[e].slice(1,2)]=s[e],s[e]=s[e].slice(0,2)):r[s[e].slice(1,2)]===s[e]&&(s[e]=s[e].slice(0,2)):!s[e].startsWith(".")&&!s[e].startsWith("#")&&(o[s[e].slice(0,1)]?o[s[e].slice(0,1)]===s[e]&&(s[e]=s[e].slice(0,1)):(o[s[e].slice(0,1)]=s[e],s[e]=s[e].slice(0,1)));return s}function C(l,n){return b(l)[n]}return O(I);})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "string-uglify",
3
- "version": "2.0.10",
3
+ "version": "2.0.13",
4
4
  "description": "Shorten sets of strings deterministically, to be git-friendly",
5
5
  "keywords": [
6
6
  "class",
@@ -41,15 +41,18 @@
41
41
  "scripts": {
42
42
  "build": "node '../../ops/scripts/esbuild.js' && yarn run dts",
43
43
  "dev": "DEV=true node '../../ops/scripts/esbuild.js' && yarn run dts",
44
- "dts": "rollup -c",
44
+ "devtest": "c8 yarn run unit && yarn run examples && yarn run lint",
45
+ "dts": "rollup -c && yarn run prettier 'types/index.d.ts' --write",
45
46
  "examples": "node '../../ops/scripts/run-examples.js'",
46
- "lect": "node '../../ops/lect/lect.js'",
47
+ "lect": "node '../../ops/lect/lect.js' && yarn run prettier 'README.md' '.all-contributorsrc' 'rollup.config.js' --write",
47
48
  "letspublish": "yarn publish || :",
48
49
  "lint": "eslint . --fix",
49
50
  "perf": "node perf/check.js",
50
51
  "prepare": "echo 'ready'",
52
+ "prettier": "prettier",
53
+ "prettier:format": "prettier --write '**/*.{ts,tsx,md}' --no-error-on-unmatched-pattern",
51
54
  "pretest": "yarn run lect && yarn run build",
52
- "test": "c8 yarn run unit && yarn run examples && yarn run lint",
55
+ "test": "yarn run devtest",
53
56
  "unit": "uvu test"
54
57
  },
55
58
  "engines": {
@@ -71,6 +74,6 @@
71
74
  "various": {}
72
75
  },
73
76
  "dependencies": {
74
- "@babel/runtime": "^7.16.3"
77
+ "@babel/runtime": "^7.17.9"
75
78
  }
76
79
  }