@e-mc/image 0.7.1 → 0.7.3
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 +4 -8
- package/README.md +5 -3
- package/index.js +13 -13
- package/package.json +4 -4
package/LICENSE
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
Copyright 2023
|
|
1
|
+
Copyright 2023 Sukina
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
6
|
|
|
7
|
-
|
|
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
|
-
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.
|
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
CHANGED
package/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a, _b;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
const core_1 = require("
|
|
4
|
+
const core_1 = require("@e-mc/core");
|
|
5
5
|
const kCommand = Symbol('command');
|
|
6
6
|
const kOutputAs = Symbol('outputAs');
|
|
7
7
|
const REGEXP_CROP = /\(\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*\|\s*(\d+)\s*[xX]\s*(\d+)\s*\)/;
|
|
@@ -21,7 +21,7 @@ class Image extends core_1.Client {
|
|
|
21
21
|
this[_b] = '';
|
|
22
22
|
}
|
|
23
23
|
static get REGEXP_SIZERANGE() { return REGEXP_SIZERANGE; }
|
|
24
|
-
static transform(file, command, options) {
|
|
24
|
+
static async transform(file, command, options) {
|
|
25
25
|
return Promise.resolve(options?.tempFile ? '' : null);
|
|
26
26
|
}
|
|
27
27
|
static clamp(value, min = 0, max = 1) {
|
|
@@ -170,26 +170,26 @@ class Image extends core_1.Client {
|
|
|
170
170
|
case "'":
|
|
171
171
|
case '"':
|
|
172
172
|
if (type === 0) {
|
|
173
|
-
type = 3
|
|
173
|
+
type = 3;
|
|
174
174
|
stringType = ch;
|
|
175
175
|
continue;
|
|
176
176
|
}
|
|
177
|
-
else if (type === 3
|
|
177
|
+
else if (type === 3 && ch === stringType && !isEscaped(false)) {
|
|
178
178
|
addArg(current);
|
|
179
179
|
continue;
|
|
180
180
|
}
|
|
181
181
|
break;
|
|
182
182
|
case '[':
|
|
183
183
|
if (type === 0) {
|
|
184
|
-
type = 1
|
|
184
|
+
type = 1;
|
|
185
185
|
arrayCount = 1;
|
|
186
186
|
}
|
|
187
|
-
else if (type === 1
|
|
187
|
+
else if (type === 1 && !isEscaped()) {
|
|
188
188
|
++arrayCount;
|
|
189
189
|
}
|
|
190
190
|
break;
|
|
191
191
|
case ']':
|
|
192
|
-
if (type === 1
|
|
192
|
+
if (type === 1 && !isEscaped() && --arrayCount === 0) {
|
|
193
193
|
try {
|
|
194
194
|
addArg(JSON.parse(current + ']'));
|
|
195
195
|
continue;
|
|
@@ -201,15 +201,15 @@ class Image extends core_1.Client {
|
|
|
201
201
|
break;
|
|
202
202
|
case '{':
|
|
203
203
|
if (type === 0) {
|
|
204
|
-
type = 2
|
|
204
|
+
type = 2;
|
|
205
205
|
objectCount = 1;
|
|
206
206
|
}
|
|
207
|
-
else if (type === 2
|
|
207
|
+
else if (type === 2 && !isEscaped()) {
|
|
208
208
|
++objectCount;
|
|
209
209
|
}
|
|
210
210
|
break;
|
|
211
211
|
case '}':
|
|
212
|
-
if (type === 2
|
|
212
|
+
if (type === 2 && !isEscaped() && --objectCount === 0) {
|
|
213
213
|
try {
|
|
214
214
|
addArg(JSON.parse(current + '}'));
|
|
215
215
|
continue;
|
|
@@ -273,14 +273,14 @@ class Image extends core_1.Client {
|
|
|
273
273
|
case '-':
|
|
274
274
|
case '+':
|
|
275
275
|
if (isNumber(value[i + 1])) {
|
|
276
|
-
type = 4
|
|
276
|
+
type = 4;
|
|
277
277
|
current += ch;
|
|
278
278
|
continue;
|
|
279
279
|
}
|
|
280
280
|
break invalid;
|
|
281
281
|
default:
|
|
282
282
|
if (isNumber(ch)) {
|
|
283
|
-
type = 4
|
|
283
|
+
type = 4;
|
|
284
284
|
current += ch;
|
|
285
285
|
continue;
|
|
286
286
|
}
|
|
@@ -291,7 +291,7 @@ class Image extends core_1.Client {
|
|
|
291
291
|
break invalid;
|
|
292
292
|
}
|
|
293
293
|
else {
|
|
294
|
-
if (type === 4
|
|
294
|
+
if (type === 4 && !(ch === '.' && decimal++ === 0)) {
|
|
295
295
|
if (isSpace || ch === ',' || ch === ')') {
|
|
296
296
|
addArg(+current);
|
|
297
297
|
switch (ch) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@e-mc/image",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.3",
|
|
4
4
|
"description": "Image constructor for E-mc.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
},
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
12
|
-
"url": "https://github.com/anpham6/e-mc.git",
|
|
12
|
+
"url": "git+https://github.com/anpham6/e-mc.git",
|
|
13
13
|
"directory": "src/image"
|
|
14
14
|
},
|
|
15
15
|
"keywords": [
|
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
"squared-functions"
|
|
18
18
|
],
|
|
19
19
|
"author": "An Pham <anpham6@gmail.com>",
|
|
20
|
-
"license": "
|
|
20
|
+
"license": "MIT",
|
|
21
21
|
"homepage": "https://github.com/anpham6/e-mc#readme",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@e-mc/core": "0.7.
|
|
23
|
+
"@e-mc/core": "0.7.3"
|
|
24
24
|
}
|
|
25
25
|
}
|