@e-mc/compress 0.9.1 → 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.
Files changed (3) hide show
  1. package/README.md +4 -4
  2. package/index.js +3 -4
  3. package/package.json +3 -3
package/README.md CHANGED
@@ -9,7 +9,7 @@
9
9
 
10
10
  ## Interface
11
11
 
12
- * [View Source](https://www.unpkg.com/@e-mc/types@0.9.1/lib/index.d.ts)
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";
@@ -120,9 +120,9 @@ instance.tryImage("/tmp/image.png", "/path/output/compressed.png", options)
120
120
 
121
121
  ## References
122
122
 
123
- - https://www.unpkg.com/@e-mc/types@0.9.1/lib/squared.d.ts
124
- - https://www.unpkg.com/@e-mc/types@0.9.1/lib/compress.d.ts
125
- - https://www.unpkg.com/@e-mc/types@0.9.1/lib/settings.d.ts
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
126
126
 
127
127
  * https://www.npmjs.com/package/@types/node
128
128
 
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) && checkChunkSize(chunk_size = (0, types_1.formatSize)(chunk_size)) || checkChunkSize(chunk_size = +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 (checkChunkSize(chunkSize)) {
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 (checkChunkSize(chunkSize)) {
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.1",
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.1",
27
- "@e-mc/types": "0.9.1",
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"