string-uglify 2.0.4 → 2.0.10
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/CHANGELOG.md +0 -20
- package/LICENSE +1 -1
- package/README.md +4 -1
- 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 +23 -78
- package/types/index.d.ts +0 -0
- package/examples/api.json +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,26 +3,6 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
## 2.0.3 (2021-11-02)
|
|
7
|
-
|
|
8
|
-
### Bug Fixes
|
|
9
|
-
|
|
10
|
-
- bump TS and separate ESLint plugins away from this monorepo ([b1ebce1](https://github.com/codsen/codsen/commit/b1ebce1637d8c41c2d848fc24b0ba4058865bd5d))
|
|
11
|
-
|
|
12
|
-
### Features
|
|
13
|
-
|
|
14
|
-
- migrate to ES Modules ([c579dff](https://github.com/codsen/codsen/commit/c579dff3b23205e383035ca10ddcec671e35d0fe))
|
|
15
|
-
|
|
16
|
-
### BREAKING CHANGES
|
|
17
|
-
|
|
18
|
-
- programs now are in ES Modules and won't work with Common JS require()
|
|
19
|
-
|
|
20
|
-
## 2.0.1 (2021-09-13)
|
|
21
|
-
|
|
22
|
-
### Bug Fixes
|
|
23
|
-
|
|
24
|
-
- bump TS and separate ESLint plugins away from this monorepo ([2e07d42](https://github.com/codsen/codsen/commit/2e07d424222b6ffedf5fb45c83ad453627ec2904))
|
|
25
|
-
|
|
26
6
|
## 2.0.0 (2021-09-09)
|
|
27
7
|
|
|
28
8
|
### Features
|
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2010
|
|
3
|
+
Copyright (c) 2010-2021 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
|
@@ -38,6 +38,7 @@ If you need a legacy version which works with `require`, use version 1.5.0
|
|
|
38
38
|
|
|
39
39
|
```js
|
|
40
40
|
import { strict as assert } from "assert";
|
|
41
|
+
|
|
41
42
|
import { uglifyById, uglifyArr, version } from "string-uglify";
|
|
42
43
|
|
|
43
44
|
// notice we put dots and hashes for classes and id's but algorithm will work
|
|
@@ -59,7 +60,7 @@ assert.equal(uglifyById(names, 3), "#l");
|
|
|
59
60
|
|
|
60
61
|
## Documentation
|
|
61
62
|
|
|
62
|
-
Please [visit codsen.com](https://codsen.com/os/string-uglify/) for a full description of the API
|
|
63
|
+
Please [visit codsen.com](https://codsen.com/os/string-uglify/) for a full description of the API.
|
|
63
64
|
|
|
64
65
|
## Contributing
|
|
65
66
|
|
|
@@ -71,4 +72,6 @@ MIT License
|
|
|
71
72
|
|
|
72
73
|
Copyright (c) 2010-2021 Roy Revelt and other contributors
|
|
73
74
|
|
|
75
|
+
|
|
74
76
|
<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,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.10
|
|
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 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};
|
|
@@ -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.10
|
|
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 $=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);})();
|
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.10",
|
|
4
4
|
"description": "Shorten sets of strings deterministically, to be git-friendly",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"class",
|
|
@@ -39,39 +39,28 @@
|
|
|
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
|
-
"prettier": "../../node_modules/prettier/bin-prettier.js '*.{js,css,scss,vue,md,ts}' --write --loglevel silent",
|
|
55
|
-
"republish": "npm publish || :",
|
|
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",
|
|
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
|
+
"pretest": "yarn run lect && yarn run build",
|
|
52
|
+
"test": "c8 yarn run unit && yarn run examples && yarn run lint",
|
|
53
|
+
"unit": "uvu test"
|
|
62
54
|
},
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
"--no-warnings",
|
|
71
|
-
"--experimental-loader",
|
|
72
|
-
"@istanbuljs/esm-loader-hook"
|
|
55
|
+
"engines": {
|
|
56
|
+
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
|
57
|
+
},
|
|
58
|
+
"c8": {
|
|
59
|
+
"check-coverage": true,
|
|
60
|
+
"exclude": [
|
|
61
|
+
"**/test/**/*.*"
|
|
73
62
|
],
|
|
74
|
-
"
|
|
63
|
+
"lines": 100
|
|
75
64
|
},
|
|
76
65
|
"lect": {
|
|
77
66
|
"licence": {
|
|
@@ -79,53 +68,9 @@
|
|
|
79
68
|
""
|
|
80
69
|
]
|
|
81
70
|
},
|
|
82
|
-
"
|
|
83
|
-
"various": {
|
|
84
|
-
"devDependencies": []
|
|
85
|
-
}
|
|
71
|
+
"various": {}
|
|
86
72
|
},
|
|
87
73
|
"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.1.0",
|
|
117
|
-
"lect": "^0.18.4",
|
|
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.0",
|
|
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"
|
|
74
|
+
"@babel/runtime": "^7.16.3"
|
|
130
75
|
}
|
|
131
76
|
}
|
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\");"}}
|