@e-mc/image 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 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/image
2
2
 
3
- * NodeJS 14/16
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.0/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 { IHost, ModuleConstructor } from "./index";
@@ -84,27 +84,11 @@ interface ImageModule {
84
84
 
85
85
  NOTE: Usage without a **Host** is conducted through static methods. The **using** class method is called by the **Host** to perform the transformation.
86
86
 
87
- ## NodeJS 14 LTS
88
-
89
- 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:
90
-
91
- ### Under 15.4 + 16.0
92
-
93
- ```sh
94
- npm i abort-controller event-target-shim
95
- ```
96
-
97
- ### Under 14.17 + 15.6
98
-
99
- ```sh
100
- npm i uuid
101
- ```
102
-
103
87
  ## References
104
88
 
105
- - https://www.unpkg.com/@e-mc/types@0.9.0/lib/asset.d.ts
106
- - https://www.unpkg.com/@e-mc/types@0.9.0/lib/image.d.ts
107
- - https://www.unpkg.com/@e-mc/types@0.9.0/lib/settings.d.ts
89
+ - https://www.unpkg.com/@e-mc/types@0.9.2/lib/asset.d.ts
90
+ - https://www.unpkg.com/@e-mc/types@0.9.2/lib/image.d.ts
91
+ - https://www.unpkg.com/@e-mc/types@0.9.2/lib/settings.d.ts
108
92
 
109
93
  ## LICENSE
110
94
 
package/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import type { ImageConstructor } from '../types/lib';
2
-
3
- declare const Image: ImageConstructor;
4
-
1
+ import type { ImageConstructor } from '../types/lib';
2
+
3
+ declare const Image: ImageConstructor;
4
+
5
5
  export = Image;
package/index.js CHANGED
@@ -10,6 +10,20 @@ const REGEXP_RESIZE = /\(\s*(\d+|auto)\s*x\s*(\d+|auto)(?:\s*\[\s*(bilinear|bicu
10
10
  const REGEXP_ROTATE = /\{((?:\s*-?\d+\s*,?)+)(?:\s*#\s*([a-f\d]{1,8}))?\s*\}/i;
11
11
  const REGEXP_METHOD = /!\s*([a-z$][\w$]*)(\()?/gi;
12
12
  const REGEXP_SIZERANGE = /(!\s*[\w$]+)?\(\s*(\d+)\s*(?:,\s*(\d+|\*)\s*)?\)/;
13
+ function isEscaped(value, checkQuote) {
14
+ if (!checkQuote || /["']/.test(value)) {
15
+ let k = 0;
16
+ for (let j = value.length - 1; j >= 0; --j) {
17
+ if (value[j] === '\\') {
18
+ ++k;
19
+ }
20
+ }
21
+ if (k % 2 === 1) {
22
+ return true;
23
+ }
24
+ }
25
+ return false;
26
+ }
13
27
  const isNumber = (ch) => ch >= '0' && ch <= '9';
14
28
  const parseHexDecimal = (value) => value ? +('0x' + value.toUpperCase().padEnd(8, 'F')) : NaN;
15
29
  class Image extends core_1.Client {
@@ -148,20 +162,6 @@ class Image extends core_1.Client {
148
162
  next = false;
149
163
  args.push(item);
150
164
  };
151
- const isEscaped = (checkQuote = true) => {
152
- if (!checkQuote || /["']/.test(current)) {
153
- let k = 0;
154
- for (let j = current.length - 1; j >= 0; --j) {
155
- if (current[j] === '\\') {
156
- ++k;
157
- }
158
- }
159
- if (k % 2 === 1) {
160
- return true;
161
- }
162
- }
163
- return false;
164
- };
165
165
  found: {
166
166
  for (const length = value.length; i < length; ++i) {
167
167
  const ch = value[i];
@@ -173,7 +173,7 @@ class Image extends core_1.Client {
173
173
  stringType = ch;
174
174
  continue;
175
175
  }
176
- else if (type === 3 && ch === stringType && !isEscaped(false)) {
176
+ else if (type === 3 && ch === stringType && !isEscaped(current, false)) {
177
177
  addArg(current);
178
178
  continue;
179
179
  }
@@ -183,12 +183,12 @@ class Image extends core_1.Client {
183
183
  type = 1;
184
184
  arrayCount = 1;
185
185
  }
186
- else if (type === 1 && !isEscaped()) {
186
+ else if (type === 1 && !isEscaped(current, true)) {
187
187
  ++arrayCount;
188
188
  }
189
189
  break;
190
190
  case ']':
191
- if (type === 1 && !isEscaped() && --arrayCount === 0) {
191
+ if (type === 1 && !isEscaped(current, true) && --arrayCount === 0) {
192
192
  try {
193
193
  addArg(JSON.parse(current + ']'));
194
194
  continue;
@@ -203,12 +203,12 @@ class Image extends core_1.Client {
203
203
  type = 2;
204
204
  objectCount = 1;
205
205
  }
206
- else if (type === 2 && !isEscaped()) {
206
+ else if (type === 2 && !isEscaped(current, true)) {
207
207
  ++objectCount;
208
208
  }
209
209
  break;
210
210
  case '}':
211
- if (type === 2 && !isEscaped() && --objectCount === 0) {
211
+ if (type === 2 && !isEscaped(current, true) && --objectCount === 0) {
212
212
  try {
213
213
  addArg(JSON.parse(current + '}'));
214
214
  continue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-mc/image",
3
- "version": "0.9.0",
3
+ "version": "0.9.2",
4
4
  "description": "Image constructor for E-mc.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -20,6 +20,6 @@
20
20
  "license": "BSD 3-Clause",
21
21
  "homepage": "https://github.com/anpham6/e-mc#readme",
22
22
  "dependencies": {
23
- "@e-mc/core": "0.9.0"
23
+ "@e-mc/core": "0.9.2"
24
24
  }
25
25
  }