string-uglify 2.0.5 → 2.0.11
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 +1 -1
- package/README.md +4 -5
- package/dist/string-uglify.esm.js +2 -177
- package/dist/string-uglify.umd.js +2 -2
- package/examples/_quickTake.js +2 -0
- package/package.json +25 -78
- package/types/index.d.ts +0 -0
- package/examples/api.json +0 -1
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2010-
|
|
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,18 +26,17 @@
|
|
|
26
26
|
|
|
27
27
|
## Install
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
The latest version is **ESM only**: Node 12+ is needed to use it and it must be `import`ed instead of `require`d. If your project is not on ESM yet and you want to use `require`, use an older version of this program, `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
|
|
40
38
|
import { strict as assert } from "assert";
|
|
39
|
+
|
|
41
40
|
import { uglifyById, uglifyArr, version } from "string-uglify";
|
|
42
41
|
|
|
43
42
|
// notice we put dots and hashes for classes and id's but algorithm will work
|
|
@@ -59,7 +58,7 @@ assert.equal(uglifyById(names, 3), "#l");
|
|
|
59
58
|
|
|
60
59
|
## Documentation
|
|
61
60
|
|
|
62
|
-
Please [visit codsen.com](https://codsen.com/os/string-uglify/) for a full description of the API
|
|
61
|
+
Please [visit codsen.com](https://codsen.com/os/string-uglify/) for a full description of the API.
|
|
63
62
|
|
|
64
63
|
## Contributing
|
|
65
64
|
|
|
@@ -69,6 +68,6 @@ To report bugs or request features or assistance, [raise an issue](https://githu
|
|
|
69
68
|
|
|
70
69
|
MIT License
|
|
71
70
|
|
|
72
|
-
Copyright (c) 2010-
|
|
71
|
+
Copyright (c) 2010-2022 Roy Revelt and other contributors
|
|
73
72
|
|
|
74
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">
|
|
@@ -1,185 +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.
|
|
4
|
+
* @version 2.0.11
|
|
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
|
|
11
|
-
|
|
12
|
-
const version = version$1;
|
|
13
|
-
function tellcp(str, idNum = 0) {
|
|
14
|
-
return str.codePointAt(idNum) || 0;
|
|
15
|
-
}
|
|
16
|
-
function uglifyArr(arr) {
|
|
17
|
-
const letters = "abcdefghijklmnopqrstuvwxyz";
|
|
18
|
-
const lettersAndNumbers = "abcdefghijklmnopqrstuvwxyz0123456789";
|
|
19
|
-
const singleClasses = {
|
|
20
|
-
a: false,
|
|
21
|
-
b: false,
|
|
22
|
-
c: false,
|
|
23
|
-
d: false,
|
|
24
|
-
e: false,
|
|
25
|
-
f: false,
|
|
26
|
-
g: false,
|
|
27
|
-
h: false,
|
|
28
|
-
i: false,
|
|
29
|
-
j: false,
|
|
30
|
-
k: false,
|
|
31
|
-
l: false,
|
|
32
|
-
m: false,
|
|
33
|
-
n: false,
|
|
34
|
-
o: false,
|
|
35
|
-
p: false,
|
|
36
|
-
q: false,
|
|
37
|
-
r: false,
|
|
38
|
-
s: false,
|
|
39
|
-
t: false,
|
|
40
|
-
u: false,
|
|
41
|
-
v: false,
|
|
42
|
-
w: false,
|
|
43
|
-
x: false,
|
|
44
|
-
y: false,
|
|
45
|
-
z: false
|
|
46
|
-
};
|
|
47
|
-
const singleIds = {
|
|
48
|
-
a: false,
|
|
49
|
-
b: false,
|
|
50
|
-
c: false,
|
|
51
|
-
d: false,
|
|
52
|
-
e: false,
|
|
53
|
-
f: false,
|
|
54
|
-
g: false,
|
|
55
|
-
h: false,
|
|
56
|
-
i: false,
|
|
57
|
-
j: false,
|
|
58
|
-
k: false,
|
|
59
|
-
l: false,
|
|
60
|
-
m: false,
|
|
61
|
-
n: false,
|
|
62
|
-
o: false,
|
|
63
|
-
p: false,
|
|
64
|
-
q: false,
|
|
65
|
-
r: false,
|
|
66
|
-
s: false,
|
|
67
|
-
t: false,
|
|
68
|
-
u: false,
|
|
69
|
-
v: false,
|
|
70
|
-
w: false,
|
|
71
|
-
x: false,
|
|
72
|
-
y: false,
|
|
73
|
-
z: false
|
|
74
|
-
};
|
|
75
|
-
const singleNameonly = {
|
|
76
|
-
a: false,
|
|
77
|
-
b: false,
|
|
78
|
-
c: false,
|
|
79
|
-
d: false,
|
|
80
|
-
e: false,
|
|
81
|
-
f: false,
|
|
82
|
-
g: false,
|
|
83
|
-
h: false,
|
|
84
|
-
i: false,
|
|
85
|
-
j: false,
|
|
86
|
-
k: false,
|
|
87
|
-
l: false,
|
|
88
|
-
m: false,
|
|
89
|
-
n: false,
|
|
90
|
-
o: false,
|
|
91
|
-
p: false,
|
|
92
|
-
q: false,
|
|
93
|
-
r: false,
|
|
94
|
-
s: false,
|
|
95
|
-
t: false,
|
|
96
|
-
u: false,
|
|
97
|
-
v: false,
|
|
98
|
-
w: false,
|
|
99
|
-
x: false,
|
|
100
|
-
y: false,
|
|
101
|
-
z: false
|
|
102
|
-
};
|
|
103
|
-
const res = [];
|
|
104
|
-
if (!Array.isArray(arr) || !arr.length) {
|
|
105
|
-
return arr;
|
|
106
|
-
}
|
|
107
|
-
for (let id = 0, len = arr.length; id < len; id++) {
|
|
108
|
-
if (arr.indexOf(arr[id]) < id) {
|
|
109
|
-
res.push(res[arr.indexOf(arr[id])]);
|
|
110
|
-
continue;
|
|
111
|
-
}
|
|
112
|
-
const prefix = `.#`.includes(arr[id][0]) ? arr[id][0] : "";
|
|
113
|
-
const codePointSum = Array.from(arr[id]).reduce((acc, curr) => acc + tellcp(curr), 0);
|
|
114
|
-
if (`.#`.includes(arr[id][0]) && arr[id].length < 4 || !`.#`.includes(arr[id][0]) && arr[id].length < 3) {
|
|
115
|
-
const val = arr[id];
|
|
116
|
-
if (!res.includes(val)) {
|
|
117
|
-
res.push(val);
|
|
118
|
-
if (val.startsWith(".") && val.length === 2 && singleClasses[val.slice(1)] === false) {
|
|
119
|
-
singleClasses[val.slice(1)] = true;
|
|
120
|
-
} else if (val.startsWith("#") && val.length === 2 && singleIds[val.slice(1)] === false) {
|
|
121
|
-
singleIds[val.slice(1)] = true;
|
|
122
|
-
} else if (!val.startsWith(".") && !val.startsWith("#") && val.length === 1 && singleNameonly[val] === false) {
|
|
123
|
-
singleNameonly[val] = true;
|
|
124
|
-
}
|
|
125
|
-
continue;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
let generated = `${prefix}${letters[codePointSum % letters.length]}${lettersAndNumbers[codePointSum % lettersAndNumbers.length]}`;
|
|
129
|
-
if (res.includes(generated)) {
|
|
130
|
-
let soFarWeveGot = generated;
|
|
131
|
-
let counter = 0;
|
|
132
|
-
const reducedCodePointSum = Array.from(arr[id]).reduce((acc, curr) => acc < 200 ? acc + tellcp(curr) : (acc + tellcp(curr)) % lettersAndNumbers.length, 0);
|
|
133
|
-
const magicNumber = Array.from(arr[id]).map(val => tellcp(val)).reduce((accum, curr) => {
|
|
134
|
-
let temp = accum + curr;
|
|
135
|
-
do {
|
|
136
|
-
temp = String(temp).split("").reduce((acc, curr1) => acc + Number.parseInt(curr1, 10), 0);
|
|
137
|
-
} while (temp >= 10);
|
|
138
|
-
return temp;
|
|
139
|
-
}, 0);
|
|
140
|
-
while (res.includes(soFarWeveGot)) {
|
|
141
|
-
counter += 1;
|
|
142
|
-
soFarWeveGot += lettersAndNumbers[reducedCodePointSum * magicNumber * counter % lettersAndNumbers.length];
|
|
143
|
-
}
|
|
144
|
-
generated = soFarWeveGot;
|
|
145
|
-
}
|
|
146
|
-
res.push(generated);
|
|
147
|
-
if (generated.startsWith(".") && generated.length === 2 && singleClasses[generated.slice(1)] === false) {
|
|
148
|
-
singleClasses[generated.slice(1)] = true;
|
|
149
|
-
} else if (generated.startsWith("#") && generated.length === 2 && singleIds[generated.slice(1)] === false) {
|
|
150
|
-
singleIds[generated.slice(1)] = true;
|
|
151
|
-
} else if (!generated.startsWith(".") && !generated.startsWith("#") && generated.length === 1 && singleNameonly[generated] === false) {
|
|
152
|
-
singleNameonly[generated] = true;
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
for (let i = 0, len = res.length; i < len; i++) {
|
|
156
|
-
if (res[i].startsWith(".")) {
|
|
157
|
-
if (singleClasses[res[i].slice(1, 2)] === false) {
|
|
158
|
-
singleClasses[res[i].slice(1, 2)] = res[i];
|
|
159
|
-
res[i] = res[i].slice(0, 2);
|
|
160
|
-
} else if (singleClasses[res[i].slice(1, 2)] === res[i]) {
|
|
161
|
-
res[i] = res[i].slice(0, 2);
|
|
162
|
-
}
|
|
163
|
-
} else if (res[i].startsWith("#")) {
|
|
164
|
-
if (singleIds[res[i].slice(1, 2)] === false) {
|
|
165
|
-
singleIds[res[i].slice(1, 2)] = res[i];
|
|
166
|
-
res[i] = res[i].slice(0, 2);
|
|
167
|
-
} else if (singleIds[res[i].slice(1, 2)] === res[i]) {
|
|
168
|
-
res[i] = res[i].slice(0, 2);
|
|
169
|
-
}
|
|
170
|
-
} else if (!res[i].startsWith(".") && !res[i].startsWith("#")) {
|
|
171
|
-
if (!singleNameonly[res[i].slice(0, 1)]) {
|
|
172
|
-
singleNameonly[res[i].slice(0, 1)] = res[i];
|
|
173
|
-
res[i] = res[i].slice(0, 1);
|
|
174
|
-
} else if (singleNameonly[res[i].slice(0, 1)] === res[i]) {
|
|
175
|
-
res[i] = res[i].slice(0, 1);
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
return res;
|
|
180
|
-
}
|
|
181
|
-
function uglifyById(refArr, idNum) {
|
|
182
|
-
return uglifyArr(refArr)[idNum];
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
export { uglifyArr, uglifyById, version };
|
|
10
|
+
var $="2.0.11";var E=$;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),x=Array.from(l[e]).map(f=>m(f)).reduce((f,g)=>{let d=f+g;do d=String(d).split("").reduce((v,j)=>v+Number.parseInt(j,10),0);while(d>=10);return d},0);for(;s.includes(t);)c+=1,t+=u[b*x*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 N(l,o){return w(l)[o]}export{w as uglifyArr,N as uglifyById,E 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.
|
|
4
|
+
* @version 2.0.11
|
|
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
|
-
|
|
10
|
+
var stringUglify=(()=>{var h=Object.defineProperty;var k=Object.getOwnPropertyDescriptor;var D=Object.getOwnPropertyNames;var E=Object.prototype.hasOwnProperty;var N=l=>h(l,"__esModule",{value:!0});var O=(l,i)=>{for(var r in i)h(l,r,{get:i[r],enumerable:!0})},V=(l,i,r,f)=>{if(i&&typeof i=="object"||typeof i=="function")for(let a of D(i))!E.call(l,a)&&(r||a!=="default")&&h(l,a,{get:()=>i[a],enumerable:!(f=k(i,a))||f.enumerable});return l};var A=(l=>(i,r)=>l&&l.get(i)||(r=V(N({}),i,1),l&&l.set(i,r),r))(typeof WeakMap!="undefined"?new WeakMap:0);var q={};O(q,{uglifyArr:()=>b,uglifyById:()=>I,version:()=>C});var y="2.0.11";var C=y;function m(l,i=0){return l.codePointAt(i)||0}function b(l){let i="abcdefghijklmnopqrstuvwxyz",r="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},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,p=l.length;e<p;e++){if(l.indexOf(l[e])<e){s.push(s[l.indexOf(l[e])]);continue}let x=".#".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&&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=`${x}${i[$%i.length]}${r[$%r.length]}`;if(s.includes(n)){let t=n,c=0,v=Array.from(l[e]).reduce((u,g)=>u<200?u+m(g):(u+m(g))%r.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+=r[v*j*c%r.length];n=t}s.push(n),n.startsWith(".")&&n.length===2&&f[n.slice(1)]===!1?f[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,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("#")?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);})();
|
package/examples/_quickTake.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "string-uglify",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.11",
|
|
4
4
|
"description": "Shorten sets of strings deterministically, to be git-friendly",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"class",
|
|
@@ -39,39 +39,30 @@
|
|
|
39
39
|
},
|
|
40
40
|
"types": "types/index.d.ts",
|
|
41
41
|
"scripts": {
|
|
42
|
-
"build": "
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"tap": "tap",
|
|
57
|
-
"pretest": "npm run build",
|
|
58
|
-
"test": "npm run lint && npm run unittest && npm run test:examples && npm run clean_cov && npm run format",
|
|
59
|
-
"test:examples": "../../scripts/test-examples.js && npm run lect && npm run prettier",
|
|
60
|
-
"tsc": "tsc",
|
|
61
|
-
"unittest": "tap --no-only --output-file=testStats.md --reporter=terse && tsc -p tsconfig.json --noEmit && npm run clean_cov && npm run perf"
|
|
42
|
+
"build": "node '../../ops/scripts/esbuild.js' && yarn run dts",
|
|
43
|
+
"dev": "DEV=true node '../../ops/scripts/esbuild.js' && yarn run dts",
|
|
44
|
+
"dts": "rollup -c && yarn run prettier 'types/index.d.ts' --write",
|
|
45
|
+
"examples": "node '../../ops/scripts/run-examples.js'",
|
|
46
|
+
"lect": "node '../../ops/lect/lect.js'",
|
|
47
|
+
"letspublish": "yarn publish || :",
|
|
48
|
+
"lint": "eslint . --fix",
|
|
49
|
+
"perf": "node perf/check.js",
|
|
50
|
+
"prepare": "echo 'ready'",
|
|
51
|
+
"prettier": "prettier",
|
|
52
|
+
"prettier:format": "prettier --write '**/*.{ts,tsx,md}' --no-error-on-unmatched-pattern",
|
|
53
|
+
"pretest": "yarn run lect && yarn run build",
|
|
54
|
+
"test": "c8 yarn run unit && yarn run examples && yarn run lint",
|
|
55
|
+
"unit": "uvu test"
|
|
62
56
|
},
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
"--no-warnings",
|
|
71
|
-
"--experimental-loader",
|
|
72
|
-
"@istanbuljs/esm-loader-hook"
|
|
57
|
+
"engines": {
|
|
58
|
+
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
|
59
|
+
},
|
|
60
|
+
"c8": {
|
|
61
|
+
"check-coverage": true,
|
|
62
|
+
"exclude": [
|
|
63
|
+
"**/test/**/*.*"
|
|
73
64
|
],
|
|
74
|
-
"
|
|
65
|
+
"lines": 100
|
|
75
66
|
},
|
|
76
67
|
"lect": {
|
|
77
68
|
"licence": {
|
|
@@ -79,53 +70,9 @@
|
|
|
79
70
|
""
|
|
80
71
|
]
|
|
81
72
|
},
|
|
82
|
-
"
|
|
83
|
-
"various": {
|
|
84
|
-
"devDependencies": []
|
|
85
|
-
}
|
|
73
|
+
"various": {}
|
|
86
74
|
},
|
|
87
75
|
"dependencies": {
|
|
88
|
-
"@babel/runtime": "^7.16.
|
|
89
|
-
},
|
|
90
|
-
"devDependencies": {
|
|
91
|
-
"@babel/cli": "^7.16.0",
|
|
92
|
-
"@babel/core": "^7.16.0",
|
|
93
|
-
"@babel/node": "^7.16.0",
|
|
94
|
-
"@babel/plugin-external-helpers": "^7.16.0",
|
|
95
|
-
"@babel/plugin-proposal-class-properties": "^7.16.0",
|
|
96
|
-
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.0",
|
|
97
|
-
"@babel/plugin-proposal-object-rest-spread": "^7.16.0",
|
|
98
|
-
"@babel/plugin-proposal-optional-chaining": "^7.16.0",
|
|
99
|
-
"@babel/plugin-transform-runtime": "^7.16.0",
|
|
100
|
-
"@babel/preset-env": "^7.16.0",
|
|
101
|
-
"@babel/preset-typescript": "^7.16.0",
|
|
102
|
-
"@babel/register": "^7.16.0",
|
|
103
|
-
"@istanbuljs/esm-loader-hook": "^0.1.2",
|
|
104
|
-
"@rollup/plugin-babel": "^5.3.0",
|
|
105
|
-
"@rollup/plugin-commonjs": "^21.0.1",
|
|
106
|
-
"@rollup/plugin-json": "^4.1.0",
|
|
107
|
-
"@rollup/plugin-node-resolve": "^13.0.6",
|
|
108
|
-
"@rollup/plugin-strip": "^2.1.0",
|
|
109
|
-
"@rollup/plugin-typescript": "^8.3.0",
|
|
110
|
-
"@types/node": "^16.11.6",
|
|
111
|
-
"@types/tap": "^15.0.5",
|
|
112
|
-
"@typescript-eslint/eslint-plugin": "^5.3.0",
|
|
113
|
-
"@typescript-eslint/parser": "^5.3.0",
|
|
114
|
-
"core-js": "^3.19.1",
|
|
115
|
-
"cross-env": "^7.0.3",
|
|
116
|
-
"eslint": "^8.2.0",
|
|
117
|
-
"lect": "^0.18.5",
|
|
118
|
-
"rollup": "^2.59.0",
|
|
119
|
-
"rollup-plugin-ascii": "^0.0.3",
|
|
120
|
-
"rollup-plugin-banner": "^0.2.1",
|
|
121
|
-
"rollup-plugin-cleanup": "^3.2.1",
|
|
122
|
-
"rollup-plugin-dts": "^4.0.1",
|
|
123
|
-
"rollup-plugin-terser": "^7.0.2",
|
|
124
|
-
"tap": "^15.0.10",
|
|
125
|
-
"tslib": "^2.3.1",
|
|
126
|
-
"typescript": "^4.4.4"
|
|
127
|
-
},
|
|
128
|
-
"engines": {
|
|
129
|
-
"node": ">=12"
|
|
76
|
+
"@babel/runtime": "^7.16.7"
|
|
130
77
|
}
|
|
131
78
|
}
|
package/types/index.d.ts
CHANGED
|
File without changes
|
package/examples/api.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"_quickTake.js":{"title":"Quick Take","content":"import { strict as assert } from \"assert\";\nimport { uglifyById, uglifyArr, version } from \"string-uglify\";\n\n// notice we put dots and hashes for classes and id's but algorithm will work\n// fine too if you won't.\nconst names = [\n \".module-promo-all\",\n \".module-promo-main\",\n \".module-promo-second\",\n \"#zzz\",\n];\n\n// notice we put dots and hashes for classes and id's but algorithm will work\n// fine too if you won't.\nassert.deepEqual(uglifyArr(names), [\".o\", \".s\", \".z\", \"#l\"]);\n\n// uglify a particular id number (inefficient):\nassert.equal(uglifyById(names, 3), \"#l\");"}}
|