@e-mc/compress 0.9.0 → 0.9.2
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 +10 -10
- package/README.md +5 -21
- package/index.d.ts +4 -4
- package/index.js +3 -4
- package/package.json +3 -3
package/LICENSE
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
Copyright 2024 An Pham
|
|
2
|
-
|
|
3
|
-
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
4
|
-
|
|
5
|
-
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
6
|
-
|
|
7
|
-
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
8
|
-
|
|
9
|
-
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
|
10
|
-
|
|
1
|
+
Copyright 2024 An Pham
|
|
2
|
+
|
|
3
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
4
|
+
|
|
5
|
+
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
6
|
+
|
|
7
|
+
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
8
|
+
|
|
9
|
+
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
|
10
|
+
|
|
11
11
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @e-mc/compress
|
|
2
2
|
|
|
3
|
-
* NodeJS
|
|
3
|
+
* NodeJS 16
|
|
4
4
|
* ES2020
|
|
5
5
|
|
|
6
6
|
## General Usage
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
## Interface
|
|
11
11
|
|
|
12
|
-
* [View Source](https://www.unpkg.com/@e-mc/types@0.9.
|
|
12
|
+
* [View Source](https://www.unpkg.com/@e-mc/types@0.9.2/lib/index.d.ts)
|
|
13
13
|
|
|
14
14
|
```typescript
|
|
15
15
|
import type { CompressLevel } from "./squared";
|
|
@@ -118,27 +118,11 @@ instance.tryImage("/tmp/image.png", "/path/output/compressed.png", options)
|
|
|
118
118
|
.catch(err => console.error(err));
|
|
119
119
|
```
|
|
120
120
|
|
|
121
|
-
## NodeJS 14 LTS
|
|
122
|
-
|
|
123
|
-
Any optional fail safe dependencies were removed as of `E-mc 0.9`. The code itself will still be *ES2020* and will continue to work equivalently when self-installing these dependencies:
|
|
124
|
-
|
|
125
|
-
### Under 15.4 + 16.0
|
|
126
|
-
|
|
127
|
-
```sh
|
|
128
|
-
npm i abort-controller event-target-shim
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
### Under 14.17 + 15.6
|
|
132
|
-
|
|
133
|
-
```sh
|
|
134
|
-
npm i uuid
|
|
135
|
-
```
|
|
136
|
-
|
|
137
121
|
## References
|
|
138
122
|
|
|
139
|
-
- https://www.unpkg.com/@e-mc/types@0.9.
|
|
140
|
-
- https://www.unpkg.com/@e-mc/types@0.9.
|
|
141
|
-
- https://www.unpkg.com/@e-mc/types@0.9.
|
|
123
|
+
- https://www.unpkg.com/@e-mc/types@0.9.2/lib/squared.d.ts
|
|
124
|
+
- https://www.unpkg.com/@e-mc/types@0.9.2/lib/compress.d.ts
|
|
125
|
+
- https://www.unpkg.com/@e-mc/types@0.9.2/lib/settings.d.ts
|
|
142
126
|
|
|
143
127
|
* https://www.npmjs.com/package/@types/node
|
|
144
128
|
|
package/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { CompressConstructor } from '../types/lib';
|
|
2
|
-
|
|
3
|
-
declare const Compress: CompressConstructor;
|
|
4
|
-
|
|
1
|
+
import type { CompressConstructor } from '../types/lib';
|
|
2
|
+
|
|
3
|
+
declare const Compress: CompressConstructor;
|
|
4
|
+
|
|
5
5
|
export = Compress;
|
package/index.js
CHANGED
|
@@ -80,7 +80,6 @@ function setCacheData(index) {
|
|
|
80
80
|
return CACHE_INIT[index] = true;
|
|
81
81
|
}
|
|
82
82
|
const removeFile = (pathname) => fs.unlink(pathname, () => { });
|
|
83
|
-
const checkChunkSize = (value) => typeof value === 'number' && value > 0 && value % 1024 === 0;
|
|
84
83
|
class Compress extends module_1 {
|
|
85
84
|
static singleton() {
|
|
86
85
|
if (!SINGLETON_INSTANCE) {
|
|
@@ -113,7 +112,7 @@ class Compress extends module_1 {
|
|
|
113
112
|
if (zopfli_iterations && (zopfli_iterations = Math.floor(+zopfli_iterations)) > 0) {
|
|
114
113
|
this.level.zopfli = zopfli_iterations;
|
|
115
114
|
}
|
|
116
|
-
if (chunk_size && ((0, types_1.isString)(chunk_size) &&
|
|
115
|
+
if (chunk_size && ((0, types_1.isString)(chunk_size) && (0, types_1.alignSize)(chunk_size = (0, types_1.formatSize)(chunk_size), 1) || (0, types_1.alignSize)(chunk_size = +chunk_size, 1))) {
|
|
117
116
|
this.chunkSize = chunk_size;
|
|
118
117
|
}
|
|
119
118
|
return this;
|
|
@@ -168,7 +167,7 @@ class Compress extends module_1 {
|
|
|
168
167
|
else {
|
|
169
168
|
gzip.level ?? (gzip.level = this.level.gz);
|
|
170
169
|
}
|
|
171
|
-
if (
|
|
170
|
+
if (!isNaN(chunkSize = (0, types_1.alignSize)(chunkSize, 1))) {
|
|
172
171
|
gzip.chunkSize = chunkSize;
|
|
173
172
|
}
|
|
174
173
|
else {
|
|
@@ -195,7 +194,7 @@ class Compress extends module_1 {
|
|
|
195
194
|
}
|
|
196
195
|
catch {
|
|
197
196
|
}
|
|
198
|
-
if (
|
|
197
|
+
if (!isNaN(chunkSize = (0, types_1.alignSize)(chunkSize, 1))) {
|
|
199
198
|
brotli.chunkSize = chunkSize;
|
|
200
199
|
}
|
|
201
200
|
else {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@e-mc/compress",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.2",
|
|
4
4
|
"description": "Compress constructor for E-mc.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
"license": "BSD 3-Clause",
|
|
24
24
|
"homepage": "https://github.com/anpham6/e-mc#readme",
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@e-mc/module": "0.9.
|
|
27
|
-
"@e-mc/types": "0.9.
|
|
26
|
+
"@e-mc/module": "0.9.2",
|
|
27
|
+
"@e-mc/types": "0.9.2",
|
|
28
28
|
"tinify": "^1.7.1",
|
|
29
29
|
"wawoff2": "^2.0.1",
|
|
30
30
|
"woff2sfnt-sfnt2woff": "^1.0.0"
|