@shotstack/shotstack-canvas 2.1.8 → 2.1.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/dist/entry.node.cjs +2 -2
- package/dist/entry.node.js +2 -2
- package/dist/entry.web.js +193 -188
- package/package.json +2 -2
package/dist/entry.node.cjs
CHANGED
|
@@ -668,7 +668,7 @@ function bufferToArrayBuffer(buffer) {
|
|
|
668
668
|
}
|
|
669
669
|
return arrayBuffer;
|
|
670
670
|
}
|
|
671
|
-
var DEFAULT_WASM_URL = "https://shotstack
|
|
671
|
+
var DEFAULT_WASM_URL = "https://js.shotstack.io/canvas/hb.wasm";
|
|
672
672
|
async function fetchWasmFromUrl(url) {
|
|
673
673
|
try {
|
|
674
674
|
const response = await fetch(url);
|
|
@@ -1019,7 +1019,7 @@ var FontRegistry = class _FontRegistry {
|
|
|
1019
1019
|
async _doInit() {
|
|
1020
1020
|
try {
|
|
1021
1021
|
this.hb = await initHB(
|
|
1022
|
-
"https://shotstack
|
|
1022
|
+
"https://js.shotstack.io/canvas/hb.wasm"
|
|
1023
1023
|
);
|
|
1024
1024
|
} catch (error) {
|
|
1025
1025
|
this.initPromise = void 0;
|
package/dist/entry.node.js
CHANGED
|
@@ -264,7 +264,7 @@ function bufferToArrayBuffer(buffer) {
|
|
|
264
264
|
}
|
|
265
265
|
return arrayBuffer;
|
|
266
266
|
}
|
|
267
|
-
var DEFAULT_WASM_URL = "https://shotstack
|
|
267
|
+
var DEFAULT_WASM_URL = "https://js.shotstack.io/canvas/hb.wasm";
|
|
268
268
|
async function fetchWasmFromUrl(url) {
|
|
269
269
|
try {
|
|
270
270
|
const response = await fetch(url);
|
|
@@ -615,7 +615,7 @@ var FontRegistry = class _FontRegistry {
|
|
|
615
615
|
async _doInit() {
|
|
616
616
|
try {
|
|
617
617
|
this.hb = await initHB(
|
|
618
|
-
"https://shotstack
|
|
618
|
+
"https://js.shotstack.io/canvas/hb.wasm"
|
|
619
619
|
);
|
|
620
620
|
} catch (error) {
|
|
621
621
|
this.initPromise = void 0;
|
package/dist/entry.web.js
CHANGED
|
@@ -4063,8 +4063,8 @@ var require_decode = __commonJS({
|
|
|
4063
4063
|
meta_block_remaining_len -= len;
|
|
4064
4064
|
if (copy_dst >= ringbuffer_end) {
|
|
4065
4065
|
output.write(ringbuffer, ringbuffer_size);
|
|
4066
|
-
for (var
|
|
4067
|
-
ringbuffer[
|
|
4066
|
+
for (var _x = 0; _x < copy_dst - ringbuffer_end; _x++)
|
|
4067
|
+
ringbuffer[_x] = ringbuffer[ringbuffer_end + _x];
|
|
4068
4068
|
}
|
|
4069
4069
|
} else {
|
|
4070
4070
|
throw new Error("Invalid backward reference. pos: " + pos + " distance: " + distance + " len: " + copy_length + " bytes left: " + meta_block_remaining_len);
|
|
@@ -4777,7 +4777,7 @@ function assertNotEqual(val) {
|
|
|
4777
4777
|
}
|
|
4778
4778
|
function assertIs(_arg) {
|
|
4779
4779
|
}
|
|
4780
|
-
function assertNever(
|
|
4780
|
+
function assertNever(_x) {
|
|
4781
4781
|
throw new Error("Unexpected value in exhaustive check");
|
|
4782
4782
|
}
|
|
4783
4783
|
function assert(_) {
|
|
@@ -18142,7 +18142,7 @@ function bufferToArrayBuffer(buffer) {
|
|
|
18142
18142
|
}
|
|
18143
18143
|
return arrayBuffer;
|
|
18144
18144
|
}
|
|
18145
|
-
var DEFAULT_WASM_URL = "https://shotstack
|
|
18145
|
+
var DEFAULT_WASM_URL = "https://js.shotstack.io/canvas/hb.wasm";
|
|
18146
18146
|
async function fetchWasmFromUrl(url2) {
|
|
18147
18147
|
try {
|
|
18148
18148
|
const response = await fetch(url2);
|
|
@@ -31883,7 +31883,7 @@ var _FontRegistry = class _FontRegistry {
|
|
|
31883
31883
|
async _doInit() {
|
|
31884
31884
|
try {
|
|
31885
31885
|
this.hb = await initHB(
|
|
31886
|
-
"https://shotstack
|
|
31886
|
+
"https://js.shotstack.io/canvas/hb.wasm"
|
|
31887
31887
|
);
|
|
31888
31888
|
} catch (error48) {
|
|
31889
31889
|
this.initPromise = void 0;
|
|
@@ -34265,12 +34265,12 @@ function parseHex6(hex3, alpha = 1) {
|
|
|
34265
34265
|
return { r, g, b, a: alpha };
|
|
34266
34266
|
}
|
|
34267
34267
|
|
|
34268
|
-
// node_modules/.pnpm/lru-cache@11.2.
|
|
34269
|
-
var
|
|
34268
|
+
// node_modules/.pnpm/lru-cache@11.2.7/node_modules/lru-cache/dist/esm/index.min.js
|
|
34269
|
+
var x = typeof performance == "object" && performance && typeof performance.now == "function" ? performance : Date;
|
|
34270
34270
|
var I = /* @__PURE__ */ new Set();
|
|
34271
34271
|
var R = typeof process == "object" && process ? process : {};
|
|
34272
|
-
var
|
|
34273
|
-
typeof R.emitWarning == "function" ? R.emitWarning(
|
|
34272
|
+
var U = (c, t, e, i) => {
|
|
34273
|
+
typeof R.emitWarning == "function" ? R.emitWarning(c, t, e, i) : console.error(`[${e}] ${t}: ${c}`);
|
|
34274
34274
|
};
|
|
34275
34275
|
var C = globalThis.AbortController;
|
|
34276
34276
|
var D = globalThis.AbortSignal;
|
|
@@ -34298,13 +34298,13 @@ if (typeof C > "u") {
|
|
|
34298
34298
|
}
|
|
34299
34299
|
}
|
|
34300
34300
|
};
|
|
34301
|
-
let
|
|
34302
|
-
|
|
34301
|
+
let c = R.env?.LRU_CACHE_IGNORE_AC_WARNING !== "1", t = () => {
|
|
34302
|
+
c && (c = false, U("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.", "NO_ABORT_CONTROLLER", "ENOTSUP", t));
|
|
34303
34303
|
};
|
|
34304
34304
|
}
|
|
34305
|
-
var G = (
|
|
34306
|
-
var y = (
|
|
34307
|
-
var
|
|
34305
|
+
var G = (c) => !I.has(c);
|
|
34306
|
+
var y = (c) => c && c === Math.floor(c) && c > 0 && isFinite(c);
|
|
34307
|
+
var M = (c) => y(c) ? c <= Math.pow(2, 8) ? Uint8Array : c <= Math.pow(2, 16) ? Uint16Array : c <= Math.pow(2, 32) ? Uint32Array : c <= Number.MAX_SAFE_INTEGER ? z2 : null : null;
|
|
34308
34308
|
var z2 = class extends Array {
|
|
34309
34309
|
constructor(t) {
|
|
34310
34310
|
super(t), this.fill(0);
|
|
@@ -34319,7 +34319,7 @@ var W = (_a2 = class {
|
|
|
34319
34319
|
this.heap = new e(t), this.length = 0;
|
|
34320
34320
|
}
|
|
34321
34321
|
static create(t) {
|
|
34322
|
-
let e =
|
|
34322
|
+
let e = M(t);
|
|
34323
34323
|
if (!e) return [];
|
|
34324
34324
|
__privateSet(_a2, _o, true);
|
|
34325
34325
|
let i = new _a2(t, e);
|
|
@@ -34332,10 +34332,10 @@ var W = (_a2 = class {
|
|
|
34332
34332
|
return this.heap[--this.length];
|
|
34333
34333
|
}
|
|
34334
34334
|
}, _o = new WeakMap(), __privateAdd(_a2, _o, false), _a2);
|
|
34335
|
-
var _a3, _b, _o2, _c2, _w, _C, _S, _L, _I, _m, _n, __, _s, _i, _t, _a4, _u, _l, _h, _b2, _r, _y, _A, _d, _g, _T, _v, _f,
|
|
34335
|
+
var _a3, _b, _o2, _c2, _w, _C, _S, _L, _I, _m, _n, __, _s, _i, _t, _a4, _u, _l, _h, _b2, _r, _y, _A, _d, _g, _T, _v, _f, _U, _c_instances, j_fn, _R, _z, _N, _p, B_fn, _W, _M, _P, F_fn, O_fn, H_fn, x_fn, G_fn, e_fn, k_fn, D_fn, E_fn, V_fn, _c;
|
|
34336
34336
|
var L = (_c = class {
|
|
34337
34337
|
constructor(t) {
|
|
34338
|
-
__privateAdd(this,
|
|
34338
|
+
__privateAdd(this, _c_instances);
|
|
34339
34339
|
__privateAdd(this, _o2);
|
|
34340
34340
|
__privateAdd(this, _c2);
|
|
34341
34341
|
__privateAdd(this, _w);
|
|
@@ -34377,7 +34377,7 @@ var L = (_c = class {
|
|
|
34377
34377
|
__privateAdd(this, _T);
|
|
34378
34378
|
__privateAdd(this, _v);
|
|
34379
34379
|
__privateAdd(this, _f);
|
|
34380
|
-
__privateAdd(this,
|
|
34380
|
+
__privateAdd(this, _U);
|
|
34381
34381
|
__privateAdd(this, _R, () => {
|
|
34382
34382
|
});
|
|
34383
34383
|
__privateAdd(this, _z, () => {
|
|
@@ -34387,37 +34387,37 @@ var L = (_c = class {
|
|
|
34387
34387
|
__privateAdd(this, _p, () => false);
|
|
34388
34388
|
__privateAdd(this, _W, (t) => {
|
|
34389
34389
|
});
|
|
34390
|
-
__privateAdd(this,
|
|
34390
|
+
__privateAdd(this, _M, (t, e, i) => {
|
|
34391
34391
|
});
|
|
34392
34392
|
__privateAdd(this, _P, (t, e, i, s) => {
|
|
34393
34393
|
if (i || s) throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");
|
|
34394
34394
|
return 0;
|
|
34395
34395
|
});
|
|
34396
34396
|
__publicField(this, _a3, "LRUCache");
|
|
34397
|
-
let { max: e = 0, ttl: i, ttlResolution: s = 1, ttlAutopurge:
|
|
34397
|
+
let { max: e = 0, ttl: i, ttlResolution: s = 1, ttlAutopurge: n, updateAgeOnGet: o, updateAgeOnHas: h, allowStale: r, dispose: a, onInsert: w, disposeAfter: f, noDisposeOnSet: d, noUpdateTTL: g, maxSize: A = 0, maxEntrySize: p = 0, sizeCalculation: _, fetchMethod: l, memoMethod: S, noDeleteOnFetchRejection: b, noDeleteOnStaleGet: m, allowStaleOnFetchRejection: u, allowStaleOnFetchAbort: T, ignoreFetchAbort: F, perf: v } = t;
|
|
34398
34398
|
if (v !== void 0 && typeof v?.now != "function") throw new TypeError("perf option must have a now() method if specified");
|
|
34399
|
-
if (__privateSet(this, _m, v ??
|
|
34400
|
-
let O = e ?
|
|
34399
|
+
if (__privateSet(this, _m, v ?? x), e !== 0 && !y(e)) throw new TypeError("max option must be a nonnegative integer");
|
|
34400
|
+
let O = e ? M(e) : Array;
|
|
34401
34401
|
if (!O) throw new Error("invalid max value: " + e);
|
|
34402
34402
|
if (__privateSet(this, _o2, e), __privateSet(this, _c2, A), this.maxEntrySize = p || __privateGet(this, _c2), this.sizeCalculation = _, this.sizeCalculation) {
|
|
34403
34403
|
if (!__privateGet(this, _c2) && !this.maxEntrySize) throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");
|
|
34404
34404
|
if (typeof this.sizeCalculation != "function") throw new TypeError("sizeCalculation set to non-function");
|
|
34405
34405
|
}
|
|
34406
|
-
if (
|
|
34407
|
-
if (__privateSet(this, _I,
|
|
34408
|
-
if (__privateSet(this, _L, l), __privateSet(this, _v, !!l), __privateSet(this, _s, /* @__PURE__ */ new Map()), __privateSet(this, _i, new Array(e).fill(void 0)), __privateSet(this, _t, new Array(e).fill(void 0)), __privateSet(this, _a4, new O(e)), __privateSet(this, _u, new O(e)), __privateSet(this, _l, 0), __privateSet(this, _h, 0), __privateSet(this, _b2, W.create(e)), __privateSet(this, _n, 0), __privateSet(this, __, 0), typeof
|
|
34406
|
+
if (S !== void 0 && typeof S != "function") throw new TypeError("memoMethod must be a function if defined");
|
|
34407
|
+
if (__privateSet(this, _I, S), l !== void 0 && typeof l != "function") throw new TypeError("fetchMethod must be a function if specified");
|
|
34408
|
+
if (__privateSet(this, _L, l), __privateSet(this, _v, !!l), __privateSet(this, _s, /* @__PURE__ */ new Map()), __privateSet(this, _i, new Array(e).fill(void 0)), __privateSet(this, _t, new Array(e).fill(void 0)), __privateSet(this, _a4, new O(e)), __privateSet(this, _u, new O(e)), __privateSet(this, _l, 0), __privateSet(this, _h, 0), __privateSet(this, _b2, W.create(e)), __privateSet(this, _n, 0), __privateSet(this, __, 0), typeof a == "function" && __privateSet(this, _w, a), typeof w == "function" && __privateSet(this, _C, w), typeof f == "function" ? (__privateSet(this, _S, f), __privateSet(this, _r, [])) : (__privateSet(this, _S, void 0), __privateSet(this, _r, void 0)), __privateSet(this, _T, !!__privateGet(this, _w)), __privateSet(this, _U, !!__privateGet(this, _C)), __privateSet(this, _f, !!__privateGet(this, _S)), this.noDisposeOnSet = !!d, this.noUpdateTTL = !!g, this.noDeleteOnFetchRejection = !!b, this.allowStaleOnFetchRejection = !!u, this.allowStaleOnFetchAbort = !!T, this.ignoreFetchAbort = !!F, this.maxEntrySize !== 0) {
|
|
34409
34409
|
if (__privateGet(this, _c2) !== 0 && !y(__privateGet(this, _c2))) throw new TypeError("maxSize must be a positive integer if specified");
|
|
34410
34410
|
if (!y(this.maxEntrySize)) throw new TypeError("maxEntrySize must be a positive integer if specified");
|
|
34411
|
-
__privateMethod(this,
|
|
34411
|
+
__privateMethod(this, _c_instances, B_fn).call(this);
|
|
34412
34412
|
}
|
|
34413
|
-
if (this.allowStale = !!r, this.noDeleteOnStaleGet = !!
|
|
34413
|
+
if (this.allowStale = !!r, this.noDeleteOnStaleGet = !!m, this.updateAgeOnGet = !!o, this.updateAgeOnHas = !!h, this.ttlResolution = y(s) || s === 0 ? s : 1, this.ttlAutopurge = !!n, this.ttl = i || 0, this.ttl) {
|
|
34414
34414
|
if (!y(this.ttl)) throw new TypeError("ttl must be a positive integer if specified");
|
|
34415
|
-
__privateMethod(this,
|
|
34415
|
+
__privateMethod(this, _c_instances, j_fn).call(this);
|
|
34416
34416
|
}
|
|
34417
34417
|
if (__privateGet(this, _o2) === 0 && this.ttl === 0 && __privateGet(this, _c2) === 0) throw new TypeError("At least one of max, maxSize, or ttl is required");
|
|
34418
34418
|
if (!this.ttlAutopurge && !__privateGet(this, _o2) && !__privateGet(this, _c2)) {
|
|
34419
34419
|
let E = "LRU_CACHE_UNBOUNDED";
|
|
34420
|
-
G(E) && (I.add(E),
|
|
34420
|
+
G(E) && (I.add(E), U("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.", "UnboundedCacheWarning", E, _c));
|
|
34421
34421
|
}
|
|
34422
34422
|
}
|
|
34423
34423
|
get perf() {
|
|
@@ -34430,19 +34430,19 @@ var L = (_c = class {
|
|
|
34430
34430
|
return __privateGet(t, _h);
|
|
34431
34431
|
}, free: __privateGet(t, _b2), isBackgroundFetch: (e) => {
|
|
34432
34432
|
var _a5;
|
|
34433
|
-
return __privateMethod(_a5 = t,
|
|
34434
|
-
}, backgroundFetch: (e, i, s,
|
|
34433
|
+
return __privateMethod(_a5 = t, _c_instances, e_fn).call(_a5, e);
|
|
34434
|
+
}, backgroundFetch: (e, i, s, n) => {
|
|
34435
34435
|
var _a5;
|
|
34436
|
-
return __privateMethod(_a5 = t,
|
|
34436
|
+
return __privateMethod(_a5 = t, _c_instances, G_fn).call(_a5, e, i, s, n);
|
|
34437
34437
|
}, moveToTail: (e) => {
|
|
34438
34438
|
var _a5;
|
|
34439
|
-
return __privateMethod(_a5 = t,
|
|
34439
|
+
return __privateMethod(_a5 = t, _c_instances, D_fn).call(_a5, e);
|
|
34440
34440
|
}, indexes: (e) => {
|
|
34441
34441
|
var _a5;
|
|
34442
|
-
return __privateMethod(_a5 = t,
|
|
34442
|
+
return __privateMethod(_a5 = t, _c_instances, F_fn).call(_a5, e);
|
|
34443
34443
|
}, rindexes: (e) => {
|
|
34444
34444
|
var _a5;
|
|
34445
|
-
return __privateMethod(_a5 = t,
|
|
34445
|
+
return __privateMethod(_a5 = t, _c_instances, O_fn).call(_a5, e);
|
|
34446
34446
|
}, isStale: (e) => {
|
|
34447
34447
|
var _a5;
|
|
34448
34448
|
return __privateGet(_a5 = t, _p).call(_a5, e);
|
|
@@ -34479,82 +34479,82 @@ var L = (_c = class {
|
|
|
34479
34479
|
return __privateGet(this, _s).has(t) ? 1 / 0 : 0;
|
|
34480
34480
|
}
|
|
34481
34481
|
*entries() {
|
|
34482
|
-
for (let t of __privateMethod(this,
|
|
34482
|
+
for (let t of __privateMethod(this, _c_instances, F_fn).call(this)) __privateGet(this, _t)[t] !== void 0 && __privateGet(this, _i)[t] !== void 0 && !__privateMethod(this, _c_instances, e_fn).call(this, __privateGet(this, _t)[t]) && (yield [__privateGet(this, _i)[t], __privateGet(this, _t)[t]]);
|
|
34483
34483
|
}
|
|
34484
34484
|
*rentries() {
|
|
34485
|
-
for (let t of __privateMethod(this,
|
|
34485
|
+
for (let t of __privateMethod(this, _c_instances, O_fn).call(this)) __privateGet(this, _t)[t] !== void 0 && __privateGet(this, _i)[t] !== void 0 && !__privateMethod(this, _c_instances, e_fn).call(this, __privateGet(this, _t)[t]) && (yield [__privateGet(this, _i)[t], __privateGet(this, _t)[t]]);
|
|
34486
34486
|
}
|
|
34487
34487
|
*keys() {
|
|
34488
|
-
for (let t of __privateMethod(this,
|
|
34488
|
+
for (let t of __privateMethod(this, _c_instances, F_fn).call(this)) {
|
|
34489
34489
|
let e = __privateGet(this, _i)[t];
|
|
34490
|
-
e !== void 0 && !__privateMethod(this,
|
|
34490
|
+
e !== void 0 && !__privateMethod(this, _c_instances, e_fn).call(this, __privateGet(this, _t)[t]) && (yield e);
|
|
34491
34491
|
}
|
|
34492
34492
|
}
|
|
34493
34493
|
*rkeys() {
|
|
34494
|
-
for (let t of __privateMethod(this,
|
|
34494
|
+
for (let t of __privateMethod(this, _c_instances, O_fn).call(this)) {
|
|
34495
34495
|
let e = __privateGet(this, _i)[t];
|
|
34496
|
-
e !== void 0 && !__privateMethod(this,
|
|
34496
|
+
e !== void 0 && !__privateMethod(this, _c_instances, e_fn).call(this, __privateGet(this, _t)[t]) && (yield e);
|
|
34497
34497
|
}
|
|
34498
34498
|
}
|
|
34499
34499
|
*values() {
|
|
34500
|
-
for (let t of __privateMethod(this,
|
|
34500
|
+
for (let t of __privateMethod(this, _c_instances, F_fn).call(this)) __privateGet(this, _t)[t] !== void 0 && !__privateMethod(this, _c_instances, e_fn).call(this, __privateGet(this, _t)[t]) && (yield __privateGet(this, _t)[t]);
|
|
34501
34501
|
}
|
|
34502
34502
|
*rvalues() {
|
|
34503
|
-
for (let t of __privateMethod(this,
|
|
34503
|
+
for (let t of __privateMethod(this, _c_instances, O_fn).call(this)) __privateGet(this, _t)[t] !== void 0 && !__privateMethod(this, _c_instances, e_fn).call(this, __privateGet(this, _t)[t]) && (yield __privateGet(this, _t)[t]);
|
|
34504
34504
|
}
|
|
34505
34505
|
[(_b = Symbol.iterator, _a3 = Symbol.toStringTag, _b)]() {
|
|
34506
34506
|
return this.entries();
|
|
34507
34507
|
}
|
|
34508
34508
|
find(t, e = {}) {
|
|
34509
|
-
for (let i of __privateMethod(this,
|
|
34510
|
-
let s = __privateGet(this, _t)[i],
|
|
34511
|
-
if (
|
|
34509
|
+
for (let i of __privateMethod(this, _c_instances, F_fn).call(this)) {
|
|
34510
|
+
let s = __privateGet(this, _t)[i], n = __privateMethod(this, _c_instances, e_fn).call(this, s) ? s.__staleWhileFetching : s;
|
|
34511
|
+
if (n !== void 0 && t(n, __privateGet(this, _i)[i], this)) return this.get(__privateGet(this, _i)[i], e);
|
|
34512
34512
|
}
|
|
34513
34513
|
}
|
|
34514
34514
|
forEach(t, e = this) {
|
|
34515
|
-
for (let i of __privateMethod(this,
|
|
34516
|
-
let s = __privateGet(this, _t)[i],
|
|
34517
|
-
|
|
34515
|
+
for (let i of __privateMethod(this, _c_instances, F_fn).call(this)) {
|
|
34516
|
+
let s = __privateGet(this, _t)[i], n = __privateMethod(this, _c_instances, e_fn).call(this, s) ? s.__staleWhileFetching : s;
|
|
34517
|
+
n !== void 0 && t.call(e, n, __privateGet(this, _i)[i], this);
|
|
34518
34518
|
}
|
|
34519
34519
|
}
|
|
34520
34520
|
rforEach(t, e = this) {
|
|
34521
|
-
for (let i of __privateMethod(this,
|
|
34522
|
-
let s = __privateGet(this, _t)[i],
|
|
34523
|
-
|
|
34521
|
+
for (let i of __privateMethod(this, _c_instances, O_fn).call(this)) {
|
|
34522
|
+
let s = __privateGet(this, _t)[i], n = __privateMethod(this, _c_instances, e_fn).call(this, s) ? s.__staleWhileFetching : s;
|
|
34523
|
+
n !== void 0 && t.call(e, n, __privateGet(this, _i)[i], this);
|
|
34524
34524
|
}
|
|
34525
34525
|
}
|
|
34526
34526
|
purgeStale() {
|
|
34527
34527
|
let t = false;
|
|
34528
|
-
for (let e of __privateMethod(this,
|
|
34528
|
+
for (let e of __privateMethod(this, _c_instances, O_fn).call(this, { allowStale: true })) __privateGet(this, _p).call(this, e) && (__privateMethod(this, _c_instances, E_fn).call(this, __privateGet(this, _i)[e], "expire"), t = true);
|
|
34529
34529
|
return t;
|
|
34530
34530
|
}
|
|
34531
34531
|
info(t) {
|
|
34532
34532
|
let e = __privateGet(this, _s).get(t);
|
|
34533
34533
|
if (e === void 0) return;
|
|
34534
|
-
let i = __privateGet(this, _t)[e], s = __privateMethod(this,
|
|
34534
|
+
let i = __privateGet(this, _t)[e], s = __privateMethod(this, _c_instances, e_fn).call(this, i) ? i.__staleWhileFetching : i;
|
|
34535
34535
|
if (s === void 0) return;
|
|
34536
|
-
let
|
|
34536
|
+
let n = { value: s };
|
|
34537
34537
|
if (__privateGet(this, _d) && __privateGet(this, _A)) {
|
|
34538
|
-
let
|
|
34539
|
-
if (
|
|
34540
|
-
let r =
|
|
34541
|
-
|
|
34538
|
+
let o = __privateGet(this, _d)[e], h = __privateGet(this, _A)[e];
|
|
34539
|
+
if (o && h) {
|
|
34540
|
+
let r = o - (__privateGet(this, _m).now() - h);
|
|
34541
|
+
n.ttl = r, n.start = Date.now();
|
|
34542
34542
|
}
|
|
34543
34543
|
}
|
|
34544
|
-
return __privateGet(this, _y) && (
|
|
34544
|
+
return __privateGet(this, _y) && (n.size = __privateGet(this, _y)[e]), n;
|
|
34545
34545
|
}
|
|
34546
34546
|
dump() {
|
|
34547
34547
|
let t = [];
|
|
34548
|
-
for (let e of __privateMethod(this,
|
|
34549
|
-
let i = __privateGet(this, _i)[e], s = __privateGet(this, _t)[e],
|
|
34550
|
-
if (
|
|
34551
|
-
let
|
|
34548
|
+
for (let e of __privateMethod(this, _c_instances, F_fn).call(this, { allowStale: true })) {
|
|
34549
|
+
let i = __privateGet(this, _i)[e], s = __privateGet(this, _t)[e], n = __privateMethod(this, _c_instances, e_fn).call(this, s) ? s.__staleWhileFetching : s;
|
|
34550
|
+
if (n === void 0 || i === void 0) continue;
|
|
34551
|
+
let o = { value: n };
|
|
34552
34552
|
if (__privateGet(this, _d) && __privateGet(this, _A)) {
|
|
34553
|
-
|
|
34554
|
-
let
|
|
34555
|
-
|
|
34553
|
+
o.ttl = __privateGet(this, _d)[e];
|
|
34554
|
+
let h = __privateGet(this, _m).now() - __privateGet(this, _A)[e];
|
|
34555
|
+
o.start = Math.floor(Date.now() - h);
|
|
34556
34556
|
}
|
|
34557
|
-
__privateGet(this, _y) && (
|
|
34557
|
+
__privateGet(this, _y) && (o.size = __privateGet(this, _y)[e]), t.unshift([i, o]);
|
|
34558
34558
|
}
|
|
34559
34559
|
return t;
|
|
34560
34560
|
}
|
|
@@ -34571,28 +34571,28 @@ var L = (_c = class {
|
|
|
34571
34571
|
set(t, e, i = {}) {
|
|
34572
34572
|
var _a5, _b3, _c3, _d2;
|
|
34573
34573
|
if (e === void 0) return this.delete(t), this;
|
|
34574
|
-
let { ttl: s = this.ttl, start:
|
|
34575
|
-
if (this.maxEntrySize &&
|
|
34576
|
-
let
|
|
34577
|
-
if (
|
|
34574
|
+
let { ttl: s = this.ttl, start: n, noDisposeOnSet: o = this.noDisposeOnSet, sizeCalculation: h = this.sizeCalculation, status: r } = i, { noUpdateTTL: a = this.noUpdateTTL } = i, w = __privateGet(this, _P).call(this, t, e, i.size || 0, h);
|
|
34575
|
+
if (this.maxEntrySize && w > this.maxEntrySize) return r && (r.set = "miss", r.maxEntrySizeExceeded = true), __privateMethod(this, _c_instances, E_fn).call(this, t, "set"), this;
|
|
34576
|
+
let f = __privateGet(this, _n) === 0 ? void 0 : __privateGet(this, _s).get(t);
|
|
34577
|
+
if (f === void 0) f = __privateGet(this, _n) === 0 ? __privateGet(this, _h) : __privateGet(this, _b2).length !== 0 ? __privateGet(this, _b2).pop() : __privateGet(this, _n) === __privateGet(this, _o2) ? __privateMethod(this, _c_instances, x_fn).call(this, false) : __privateGet(this, _n), __privateGet(this, _i)[f] = t, __privateGet(this, _t)[f] = e, __privateGet(this, _s).set(t, f), __privateGet(this, _a4)[__privateGet(this, _h)] = f, __privateGet(this, _u)[f] = __privateGet(this, _h), __privateSet(this, _h, f), __privateWrapper(this, _n)._++, __privateGet(this, _M).call(this, f, w, r), r && (r.set = "add"), a = false, __privateGet(this, _U) && ((_a5 = __privateGet(this, _C)) == null ? void 0 : _a5.call(this, e, t, "add"));
|
|
34578
34578
|
else {
|
|
34579
|
-
__privateMethod(this,
|
|
34580
|
-
let d = __privateGet(this, _t)[
|
|
34579
|
+
__privateMethod(this, _c_instances, D_fn).call(this, f);
|
|
34580
|
+
let d = __privateGet(this, _t)[f];
|
|
34581
34581
|
if (e !== d) {
|
|
34582
|
-
if (__privateGet(this, _v) && __privateMethod(this,
|
|
34582
|
+
if (__privateGet(this, _v) && __privateMethod(this, _c_instances, e_fn).call(this, d)) {
|
|
34583
34583
|
d.__abortController.abort(new Error("replaced"));
|
|
34584
34584
|
let { __staleWhileFetching: g } = d;
|
|
34585
|
-
g !== void 0 && !
|
|
34586
|
-
} else
|
|
34587
|
-
if (__privateGet(this, _W).call(this,
|
|
34585
|
+
g !== void 0 && !o && (__privateGet(this, _T) && ((_b3 = __privateGet(this, _w)) == null ? void 0 : _b3.call(this, g, t, "set")), __privateGet(this, _f) && __privateGet(this, _r)?.push([g, t, "set"]));
|
|
34586
|
+
} else o || (__privateGet(this, _T) && ((_c3 = __privateGet(this, _w)) == null ? void 0 : _c3.call(this, d, t, "set")), __privateGet(this, _f) && __privateGet(this, _r)?.push([d, t, "set"]));
|
|
34587
|
+
if (__privateGet(this, _W).call(this, f), __privateGet(this, _M).call(this, f, w, r), __privateGet(this, _t)[f] = e, r) {
|
|
34588
34588
|
r.set = "replace";
|
|
34589
|
-
let g = d && __privateMethod(this,
|
|
34589
|
+
let g = d && __privateMethod(this, _c_instances, e_fn).call(this, d) ? d.__staleWhileFetching : d;
|
|
34590
34590
|
g !== void 0 && (r.oldValue = g);
|
|
34591
34591
|
}
|
|
34592
34592
|
} else r && (r.set = "update");
|
|
34593
|
-
__privateGet(this,
|
|
34593
|
+
__privateGet(this, _U) && this.onInsert?.(e, t, e === d ? "update" : "replace");
|
|
34594
34594
|
}
|
|
34595
|
-
if (s !== 0 && !__privateGet(this, _d) && __privateMethod(this,
|
|
34595
|
+
if (s !== 0 && !__privateGet(this, _d) && __privateMethod(this, _c_instances, j_fn).call(this), __privateGet(this, _d) && (a || __privateGet(this, _N).call(this, f, s, n), r && __privateGet(this, _z).call(this, r, f)), !o && __privateGet(this, _f) && __privateGet(this, _r)) {
|
|
34596
34596
|
let d = __privateGet(this, _r), g;
|
|
34597
34597
|
for (; g = d?.shift(); ) (_d2 = __privateGet(this, _S)) == null ? void 0 : _d2.call(this, ...g);
|
|
34598
34598
|
}
|
|
@@ -34603,7 +34603,7 @@ var L = (_c = class {
|
|
|
34603
34603
|
try {
|
|
34604
34604
|
for (; __privateGet(this, _n); ) {
|
|
34605
34605
|
let t = __privateGet(this, _t)[__privateGet(this, _l)];
|
|
34606
|
-
if (__privateMethod(this,
|
|
34606
|
+
if (__privateMethod(this, _c_instances, x_fn).call(this, true), __privateMethod(this, _c_instances, e_fn).call(this, t)) {
|
|
34607
34607
|
if (t.__staleWhileFetching) return t.__staleWhileFetching;
|
|
34608
34608
|
} else if (t !== void 0) return t;
|
|
34609
34609
|
}
|
|
@@ -34615,38 +34615,38 @@ var L = (_c = class {
|
|
|
34615
34615
|
}
|
|
34616
34616
|
}
|
|
34617
34617
|
has(t, e = {}) {
|
|
34618
|
-
let { updateAgeOnHas: i = this.updateAgeOnHas, status: s } = e,
|
|
34619
|
-
if (
|
|
34620
|
-
let
|
|
34621
|
-
if (__privateMethod(this,
|
|
34622
|
-
if (__privateGet(this, _p).call(this,
|
|
34623
|
-
else return i && __privateGet(this, _R).call(this,
|
|
34618
|
+
let { updateAgeOnHas: i = this.updateAgeOnHas, status: s } = e, n = __privateGet(this, _s).get(t);
|
|
34619
|
+
if (n !== void 0) {
|
|
34620
|
+
let o = __privateGet(this, _t)[n];
|
|
34621
|
+
if (__privateMethod(this, _c_instances, e_fn).call(this, o) && o.__staleWhileFetching === void 0) return false;
|
|
34622
|
+
if (__privateGet(this, _p).call(this, n)) s && (s.has = "stale", __privateGet(this, _z).call(this, s, n));
|
|
34623
|
+
else return i && __privateGet(this, _R).call(this, n), s && (s.has = "hit", __privateGet(this, _z).call(this, s, n)), true;
|
|
34624
34624
|
} else s && (s.has = "miss");
|
|
34625
34625
|
return false;
|
|
34626
34626
|
}
|
|
34627
34627
|
peek(t, e = {}) {
|
|
34628
34628
|
let { allowStale: i = this.allowStale } = e, s = __privateGet(this, _s).get(t);
|
|
34629
34629
|
if (s === void 0 || !i && __privateGet(this, _p).call(this, s)) return;
|
|
34630
|
-
let
|
|
34631
|
-
return __privateMethod(this,
|
|
34630
|
+
let n = __privateGet(this, _t)[s];
|
|
34631
|
+
return __privateMethod(this, _c_instances, e_fn).call(this, n) ? n.__staleWhileFetching : n;
|
|
34632
34632
|
}
|
|
34633
34633
|
async fetch(t, e = {}) {
|
|
34634
|
-
let { allowStale: i = this.allowStale, updateAgeOnGet: s = this.updateAgeOnGet, noDeleteOnStaleGet:
|
|
34635
|
-
if (!__privateGet(this, _v)) return l && (l.fetch = "get"), this.get(t, { allowStale: i, updateAgeOnGet: s, noDeleteOnStaleGet:
|
|
34636
|
-
let b = { allowStale: i, updateAgeOnGet: s, noDeleteOnStaleGet:
|
|
34637
|
-
if (
|
|
34634
|
+
let { allowStale: i = this.allowStale, updateAgeOnGet: s = this.updateAgeOnGet, noDeleteOnStaleGet: n = this.noDeleteOnStaleGet, ttl: o = this.ttl, noDisposeOnSet: h = this.noDisposeOnSet, size: r = 0, sizeCalculation: a = this.sizeCalculation, noUpdateTTL: w = this.noUpdateTTL, noDeleteOnFetchRejection: f = this.noDeleteOnFetchRejection, allowStaleOnFetchRejection: d = this.allowStaleOnFetchRejection, ignoreFetchAbort: g = this.ignoreFetchAbort, allowStaleOnFetchAbort: A = this.allowStaleOnFetchAbort, context: p, forceRefresh: _ = false, status: l, signal: S } = e;
|
|
34635
|
+
if (!__privateGet(this, _v)) return l && (l.fetch = "get"), this.get(t, { allowStale: i, updateAgeOnGet: s, noDeleteOnStaleGet: n, status: l });
|
|
34636
|
+
let b = { allowStale: i, updateAgeOnGet: s, noDeleteOnStaleGet: n, ttl: o, noDisposeOnSet: h, size: r, sizeCalculation: a, noUpdateTTL: w, noDeleteOnFetchRejection: f, allowStaleOnFetchRejection: d, allowStaleOnFetchAbort: A, ignoreFetchAbort: g, status: l, signal: S }, m = __privateGet(this, _s).get(t);
|
|
34637
|
+
if (m === void 0) {
|
|
34638
34638
|
l && (l.fetch = "miss");
|
|
34639
|
-
let u = __privateMethod(this,
|
|
34639
|
+
let u = __privateMethod(this, _c_instances, G_fn).call(this, t, m, b, p);
|
|
34640
34640
|
return u.__returned = u;
|
|
34641
34641
|
} else {
|
|
34642
|
-
let u = __privateGet(this, _t)[
|
|
34643
|
-
if (__privateMethod(this,
|
|
34642
|
+
let u = __privateGet(this, _t)[m];
|
|
34643
|
+
if (__privateMethod(this, _c_instances, e_fn).call(this, u)) {
|
|
34644
34644
|
let E = i && u.__staleWhileFetching !== void 0;
|
|
34645
34645
|
return l && (l.fetch = "inflight", E && (l.returnedStale = true)), E ? u.__staleWhileFetching : u.__returned = u;
|
|
34646
34646
|
}
|
|
34647
|
-
let T = __privateGet(this, _p).call(this,
|
|
34648
|
-
if (!_ && !T) return l && (l.fetch = "hit"), __privateMethod(this,
|
|
34649
|
-
let F = __privateMethod(this,
|
|
34647
|
+
let T = __privateGet(this, _p).call(this, m);
|
|
34648
|
+
if (!_ && !T) return l && (l.fetch = "hit"), __privateMethod(this, _c_instances, D_fn).call(this, m), s && __privateGet(this, _R).call(this, m), l && __privateGet(this, _z).call(this, l, m), u;
|
|
34649
|
+
let F = __privateMethod(this, _c_instances, G_fn).call(this, t, m, b, p), O = F.__staleWhileFetching !== void 0 && i;
|
|
34650
34650
|
return l && (l.fetch = T ? "stale" : "refresh", O && T && (l.returnedStale = true)), O ? F.__staleWhileFetching : F.__returned = F;
|
|
34651
34651
|
}
|
|
34652
34652
|
}
|
|
@@ -34658,117 +34658,122 @@ var L = (_c = class {
|
|
|
34658
34658
|
memo(t, e = {}) {
|
|
34659
34659
|
let i = __privateGet(this, _I);
|
|
34660
34660
|
if (!i) throw new Error("no memoMethod provided to constructor");
|
|
34661
|
-
let { context: s, forceRefresh:
|
|
34662
|
-
if (!
|
|
34663
|
-
let r = i(t,
|
|
34664
|
-
return this.set(t, r,
|
|
34661
|
+
let { context: s, forceRefresh: n, ...o } = e, h = this.get(t, o);
|
|
34662
|
+
if (!n && h !== void 0) return h;
|
|
34663
|
+
let r = i(t, h, { options: o, context: s });
|
|
34664
|
+
return this.set(t, r, o), r;
|
|
34665
34665
|
}
|
|
34666
34666
|
get(t, e = {}) {
|
|
34667
|
-
let { allowStale: i = this.allowStale, updateAgeOnGet: s = this.updateAgeOnGet, noDeleteOnStaleGet:
|
|
34668
|
-
if (
|
|
34669
|
-
let r = __privateGet(this, _t)[
|
|
34670
|
-
return
|
|
34671
|
-
} else
|
|
34667
|
+
let { allowStale: i = this.allowStale, updateAgeOnGet: s = this.updateAgeOnGet, noDeleteOnStaleGet: n = this.noDeleteOnStaleGet, status: o } = e, h = __privateGet(this, _s).get(t);
|
|
34668
|
+
if (h !== void 0) {
|
|
34669
|
+
let r = __privateGet(this, _t)[h], a = __privateMethod(this, _c_instances, e_fn).call(this, r);
|
|
34670
|
+
return o && __privateGet(this, _z).call(this, o, h), __privateGet(this, _p).call(this, h) ? (o && (o.get = "stale"), a ? (o && i && r.__staleWhileFetching !== void 0 && (o.returnedStale = true), i ? r.__staleWhileFetching : void 0) : (n || __privateMethod(this, _c_instances, E_fn).call(this, t, "expire"), o && i && (o.returnedStale = true), i ? r : void 0)) : (o && (o.get = "hit"), a ? r.__staleWhileFetching : (__privateMethod(this, _c_instances, D_fn).call(this, h), s && __privateGet(this, _R).call(this, h), r));
|
|
34671
|
+
} else o && (o.get = "miss");
|
|
34672
34672
|
}
|
|
34673
34673
|
delete(t) {
|
|
34674
|
-
return __privateMethod(this,
|
|
34674
|
+
return __privateMethod(this, _c_instances, E_fn).call(this, t, "delete");
|
|
34675
34675
|
}
|
|
34676
34676
|
clear() {
|
|
34677
|
-
return __privateMethod(this,
|
|
34677
|
+
return __privateMethod(this, _c_instances, V_fn).call(this, "delete");
|
|
34678
34678
|
}
|
|
34679
|
-
}, _o2 = new WeakMap(), _c2 = new WeakMap(), _w = new WeakMap(), _C = new WeakMap(), _S = new WeakMap(), _L = new WeakMap(), _I = new WeakMap(), _m = new WeakMap(), _n = new WeakMap(), __ = new WeakMap(), _s = new WeakMap(), _i = new WeakMap(), _t = new WeakMap(), _a4 = new WeakMap(), _u = new WeakMap(), _l = new WeakMap(), _h = new WeakMap(), _b2 = new WeakMap(), _r = new WeakMap(), _y = new WeakMap(), _A = new WeakMap(), _d = new WeakMap(), _g = new WeakMap(), _T = new WeakMap(), _v = new WeakMap(), _f = new WeakMap(),
|
|
34679
|
+
}, _o2 = new WeakMap(), _c2 = new WeakMap(), _w = new WeakMap(), _C = new WeakMap(), _S = new WeakMap(), _L = new WeakMap(), _I = new WeakMap(), _m = new WeakMap(), _n = new WeakMap(), __ = new WeakMap(), _s = new WeakMap(), _i = new WeakMap(), _t = new WeakMap(), _a4 = new WeakMap(), _u = new WeakMap(), _l = new WeakMap(), _h = new WeakMap(), _b2 = new WeakMap(), _r = new WeakMap(), _y = new WeakMap(), _A = new WeakMap(), _d = new WeakMap(), _g = new WeakMap(), _T = new WeakMap(), _v = new WeakMap(), _f = new WeakMap(), _U = new WeakMap(), _c_instances = new WeakSet(), j_fn = function() {
|
|
34680
34680
|
let t = new z2(__privateGet(this, _o2)), e = new z2(__privateGet(this, _o2));
|
|
34681
34681
|
__privateSet(this, _d, t), __privateSet(this, _A, e);
|
|
34682
34682
|
let i = this.ttlAutopurge ? new Array(__privateGet(this, _o2)) : void 0;
|
|
34683
|
-
__privateSet(this, _g, i), __privateSet(this, _N, (
|
|
34684
|
-
|
|
34685
|
-
|
|
34686
|
-
|
|
34687
|
-
|
|
34688
|
-
|
|
34689
|
-
|
|
34690
|
-
|
|
34691
|
-
|
|
34692
|
-
|
|
34693
|
-
|
|
34694
|
-
|
|
34695
|
-
|
|
34696
|
-
|
|
34697
|
-
|
|
34698
|
-
|
|
34683
|
+
__privateSet(this, _g, i), __privateSet(this, _N, (h, r, a = __privateGet(this, _m).now()) => {
|
|
34684
|
+
e[h] = r !== 0 ? a : 0, t[h] = r, s(h, r);
|
|
34685
|
+
}), __privateSet(this, _R, (h) => {
|
|
34686
|
+
e[h] = t[h] !== 0 ? __privateGet(this, _m).now() : 0, s(h, t[h]);
|
|
34687
|
+
});
|
|
34688
|
+
let s = this.ttlAutopurge ? (h, r) => {
|
|
34689
|
+
if (i?.[h] && (clearTimeout(i[h]), i[h] = void 0), r && r !== 0 && i) {
|
|
34690
|
+
let a = setTimeout(() => {
|
|
34691
|
+
__privateGet(this, _p).call(this, h) && __privateMethod(this, _c_instances, E_fn).call(this, __privateGet(this, _i)[h], "expire");
|
|
34692
|
+
}, r + 1);
|
|
34693
|
+
a.unref && a.unref(), i[h] = a;
|
|
34694
|
+
}
|
|
34695
|
+
} : () => {
|
|
34696
|
+
};
|
|
34697
|
+
__privateSet(this, _z, (h, r) => {
|
|
34698
|
+
if (t[r]) {
|
|
34699
|
+
let a = t[r], w = e[r];
|
|
34700
|
+
if (!a || !w) return;
|
|
34701
|
+
h.ttl = a, h.start = w, h.now = n || o();
|
|
34702
|
+
let f = h.now - w;
|
|
34703
|
+
h.remainingTTL = a - f;
|
|
34699
34704
|
}
|
|
34700
34705
|
});
|
|
34701
|
-
let
|
|
34702
|
-
let
|
|
34706
|
+
let n = 0, o = () => {
|
|
34707
|
+
let h = __privateGet(this, _m).now();
|
|
34703
34708
|
if (this.ttlResolution > 0) {
|
|
34704
|
-
|
|
34705
|
-
let
|
|
34706
|
-
|
|
34707
|
-
}
|
|
34708
|
-
return
|
|
34709
|
-
};
|
|
34710
|
-
this.getRemainingTTL = (
|
|
34711
|
-
let
|
|
34712
|
-
if (
|
|
34713
|
-
let
|
|
34714
|
-
if (!
|
|
34715
|
-
let
|
|
34716
|
-
return
|
|
34717
|
-
}, __privateSet(this, _p, (
|
|
34718
|
-
let
|
|
34719
|
-
return !!
|
|
34709
|
+
n = h;
|
|
34710
|
+
let r = setTimeout(() => n = 0, this.ttlResolution);
|
|
34711
|
+
r.unref && r.unref();
|
|
34712
|
+
}
|
|
34713
|
+
return h;
|
|
34714
|
+
};
|
|
34715
|
+
this.getRemainingTTL = (h) => {
|
|
34716
|
+
let r = __privateGet(this, _s).get(h);
|
|
34717
|
+
if (r === void 0) return 0;
|
|
34718
|
+
let a = t[r], w = e[r];
|
|
34719
|
+
if (!a || !w) return 1 / 0;
|
|
34720
|
+
let f = (n || o()) - w;
|
|
34721
|
+
return a - f;
|
|
34722
|
+
}, __privateSet(this, _p, (h) => {
|
|
34723
|
+
let r = e[h], a = t[h];
|
|
34724
|
+
return !!a && !!r && (n || o()) - r > a;
|
|
34720
34725
|
});
|
|
34721
34726
|
}, _R = new WeakMap(), _z = new WeakMap(), _N = new WeakMap(), _p = new WeakMap(), B_fn = function() {
|
|
34722
34727
|
let t = new z2(__privateGet(this, _o2));
|
|
34723
34728
|
__privateSet(this, __, 0), __privateSet(this, _y, t), __privateSet(this, _W, (e) => {
|
|
34724
34729
|
__privateSet(this, __, __privateGet(this, __) - t[e]), t[e] = 0;
|
|
34725
|
-
}), __privateSet(this, _P, (e, i, s,
|
|
34726
|
-
if (__privateMethod(this,
|
|
34727
|
-
if (!y(s)) if (
|
|
34728
|
-
if (typeof
|
|
34729
|
-
if (s =
|
|
34730
|
+
}), __privateSet(this, _P, (e, i, s, n) => {
|
|
34731
|
+
if (__privateMethod(this, _c_instances, e_fn).call(this, i)) return 0;
|
|
34732
|
+
if (!y(s)) if (n) {
|
|
34733
|
+
if (typeof n != "function") throw new TypeError("sizeCalculation must be a function");
|
|
34734
|
+
if (s = n(i, e), !y(s)) throw new TypeError("sizeCalculation return invalid (expect positive integer)");
|
|
34730
34735
|
} else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");
|
|
34731
34736
|
return s;
|
|
34732
|
-
}), __privateSet(this,
|
|
34737
|
+
}), __privateSet(this, _M, (e, i, s) => {
|
|
34733
34738
|
if (t[e] = i, __privateGet(this, _c2)) {
|
|
34734
|
-
let
|
|
34735
|
-
for (; __privateGet(this, __) >
|
|
34739
|
+
let n = __privateGet(this, _c2) - t[e];
|
|
34740
|
+
for (; __privateGet(this, __) > n; ) __privateMethod(this, _c_instances, x_fn).call(this, true);
|
|
34736
34741
|
}
|
|
34737
34742
|
__privateSet(this, __, __privateGet(this, __) + t[e]), s && (s.entrySize = i, s.totalCalculatedSize = __privateGet(this, __));
|
|
34738
34743
|
});
|
|
34739
|
-
}, _W = new WeakMap(),
|
|
34740
|
-
if (__privateGet(this, _n)) for (let e = __privateGet(this, _h); !(!__privateMethod(this,
|
|
34744
|
+
}, _W = new WeakMap(), _M = new WeakMap(), _P = new WeakMap(), F_fn = function* ({ allowStale: t = this.allowStale } = {}) {
|
|
34745
|
+
if (__privateGet(this, _n)) for (let e = __privateGet(this, _h); !(!__privateMethod(this, _c_instances, H_fn).call(this, e) || ((t || !__privateGet(this, _p).call(this, e)) && (yield e), e === __privateGet(this, _l))); ) e = __privateGet(this, _u)[e];
|
|
34741
34746
|
}, O_fn = function* ({ allowStale: t = this.allowStale } = {}) {
|
|
34742
|
-
if (__privateGet(this, _n)) for (let e = __privateGet(this, _l); !(!__privateMethod(this,
|
|
34747
|
+
if (__privateGet(this, _n)) for (let e = __privateGet(this, _l); !(!__privateMethod(this, _c_instances, H_fn).call(this, e) || ((t || !__privateGet(this, _p).call(this, e)) && (yield e), e === __privateGet(this, _h))); ) e = __privateGet(this, _a4)[e];
|
|
34743
34748
|
}, H_fn = function(t) {
|
|
34744
34749
|
return t !== void 0 && __privateGet(this, _s).get(__privateGet(this, _i)[t]) === t;
|
|
34745
|
-
},
|
|
34750
|
+
}, x_fn = function(t) {
|
|
34746
34751
|
var _a5;
|
|
34747
34752
|
let e = __privateGet(this, _l), i = __privateGet(this, _i)[e], s = __privateGet(this, _t)[e];
|
|
34748
|
-
return __privateGet(this, _v) && __privateMethod(this,
|
|
34753
|
+
return __privateGet(this, _v) && __privateMethod(this, _c_instances, e_fn).call(this, s) ? s.__abortController.abort(new Error("evicted")) : (__privateGet(this, _T) || __privateGet(this, _f)) && (__privateGet(this, _T) && ((_a5 = __privateGet(this, _w)) == null ? void 0 : _a5.call(this, s, i, "evict")), __privateGet(this, _f) && __privateGet(this, _r)?.push([s, i, "evict"])), __privateGet(this, _W).call(this, e), __privateGet(this, _g)?.[e] && (clearTimeout(__privateGet(this, _g)[e]), __privateGet(this, _g)[e] = void 0), t && (__privateGet(this, _i)[e] = void 0, __privateGet(this, _t)[e] = void 0, __privateGet(this, _b2).push(e)), __privateGet(this, _n) === 1 ? (__privateSet(this, _l, __privateSet(this, _h, 0)), __privateGet(this, _b2).length = 0) : __privateSet(this, _l, __privateGet(this, _a4)[e]), __privateGet(this, _s).delete(i), __privateWrapper(this, _n)._--, e;
|
|
34749
34754
|
}, G_fn = function(t, e, i, s) {
|
|
34750
|
-
let
|
|
34751
|
-
if (__privateMethod(this,
|
|
34752
|
-
let
|
|
34753
|
-
|
|
34754
|
-
let r = { signal:
|
|
34755
|
-
let { aborted: l } =
|
|
34756
|
-
if (i.status && (l && !_ ? (i.status.fetchAborted = true, i.status.fetchError =
|
|
34757
|
-
let
|
|
34758
|
-
return (u === g ||
|
|
34759
|
-
},
|
|
34760
|
-
let { aborted: l } =
|
|
34761
|
-
if (__privateGet(this, _t)[e] === g && (!
|
|
34755
|
+
let n = e === void 0 ? void 0 : __privateGet(this, _t)[e];
|
|
34756
|
+
if (__privateMethod(this, _c_instances, e_fn).call(this, n)) return n;
|
|
34757
|
+
let o = new C(), { signal: h } = i;
|
|
34758
|
+
h?.addEventListener("abort", () => o.abort(h.reason), { signal: o.signal });
|
|
34759
|
+
let r = { signal: o.signal, options: i, context: s }, a = (p, _ = false) => {
|
|
34760
|
+
let { aborted: l } = o.signal, S = i.ignoreFetchAbort && p !== void 0, b = i.ignoreFetchAbort || !!(i.allowStaleOnFetchAbort && p !== void 0);
|
|
34761
|
+
if (i.status && (l && !_ ? (i.status.fetchAborted = true, i.status.fetchError = o.signal.reason, S && (i.status.fetchAbortIgnored = true)) : i.status.fetchResolved = true), l && !S && !_) return f(o.signal.reason, b);
|
|
34762
|
+
let m = g, u = __privateGet(this, _t)[e];
|
|
34763
|
+
return (u === g || S && _ && u === void 0) && (p === void 0 ? m.__staleWhileFetching !== void 0 ? __privateGet(this, _t)[e] = m.__staleWhileFetching : __privateMethod(this, _c_instances, E_fn).call(this, t, "fetch") : (i.status && (i.status.fetchUpdated = true), this.set(t, p, r.options))), p;
|
|
34764
|
+
}, w = (p) => (i.status && (i.status.fetchRejected = true, i.status.fetchError = p), f(p, false)), f = (p, _) => {
|
|
34765
|
+
let { aborted: l } = o.signal, S = l && i.allowStaleOnFetchAbort, b = S || i.allowStaleOnFetchRejection, m = b || i.noDeleteOnFetchRejection, u = g;
|
|
34766
|
+
if (__privateGet(this, _t)[e] === g && (!m || !_ && u.__staleWhileFetching === void 0 ? __privateMethod(this, _c_instances, E_fn).call(this, t, "fetch") : S || (__privateGet(this, _t)[e] = u.__staleWhileFetching)), b) return i.status && u.__staleWhileFetching !== void 0 && (i.status.returnedStale = true), u.__staleWhileFetching;
|
|
34762
34767
|
if (u.__returned === u) throw p;
|
|
34763
34768
|
}, d = (p, _) => {
|
|
34764
34769
|
var _a5;
|
|
34765
|
-
let l = (_a5 = __privateGet(this, _L)) == null ? void 0 : _a5.call(this, t,
|
|
34766
|
-
l && l instanceof Promise && l.then((
|
|
34767
|
-
(!i.ignoreFetchAbort || i.allowStaleOnFetchAbort) && (p(void 0), i.allowStaleOnFetchAbort && (p = (
|
|
34770
|
+
let l = (_a5 = __privateGet(this, _L)) == null ? void 0 : _a5.call(this, t, n, r);
|
|
34771
|
+
l && l instanceof Promise && l.then((S) => p(S === void 0 ? void 0 : S), _), o.signal.addEventListener("abort", () => {
|
|
34772
|
+
(!i.ignoreFetchAbort || i.allowStaleOnFetchAbort) && (p(void 0), i.allowStaleOnFetchAbort && (p = (S) => a(S, true)));
|
|
34768
34773
|
});
|
|
34769
34774
|
};
|
|
34770
34775
|
i.status && (i.status.fetchDispatched = true);
|
|
34771
|
-
let g = new Promise(d).then(
|
|
34776
|
+
let g = new Promise(d).then(a, w), A = Object.assign(g, { __abortController: o, __staleWhileFetching: n, __returned: void 0 });
|
|
34772
34777
|
return e === void 0 ? (this.set(t, A, { ...r.options, status: void 0 }), e = __privateGet(this, _s).get(t)) : __privateGet(this, _t)[e] = A, A;
|
|
34773
34778
|
}, e_fn = function(t) {
|
|
34774
34779
|
if (!__privateGet(this, _v)) return false;
|
|
@@ -34777,37 +34782,37 @@ var L = (_c = class {
|
|
|
34777
34782
|
}, k_fn = function(t, e) {
|
|
34778
34783
|
__privateGet(this, _u)[e] = t, __privateGet(this, _a4)[t] = e;
|
|
34779
34784
|
}, D_fn = function(t) {
|
|
34780
|
-
t !== __privateGet(this, _h) && (t === __privateGet(this, _l) ? __privateSet(this, _l, __privateGet(this, _a4)[t]) : __privateMethod(this,
|
|
34785
|
+
t !== __privateGet(this, _h) && (t === __privateGet(this, _l) ? __privateSet(this, _l, __privateGet(this, _a4)[t]) : __privateMethod(this, _c_instances, k_fn).call(this, __privateGet(this, _u)[t], __privateGet(this, _a4)[t]), __privateMethod(this, _c_instances, k_fn).call(this, __privateGet(this, _h), t), __privateSet(this, _h, t));
|
|
34781
34786
|
}, E_fn = function(t, e) {
|
|
34782
34787
|
var _a5, _b3;
|
|
34783
34788
|
let i = false;
|
|
34784
34789
|
if (__privateGet(this, _n) !== 0) {
|
|
34785
34790
|
let s = __privateGet(this, _s).get(t);
|
|
34786
|
-
if (s !== void 0) if (__privateGet(this, _g)?.[s] && (clearTimeout(__privateGet(this, _g)?.[s]), __privateGet(this, _g)[s] = void 0), i = true, __privateGet(this, _n) === 1) __privateMethod(this,
|
|
34791
|
+
if (s !== void 0) if (__privateGet(this, _g)?.[s] && (clearTimeout(__privateGet(this, _g)?.[s]), __privateGet(this, _g)[s] = void 0), i = true, __privateGet(this, _n) === 1) __privateMethod(this, _c_instances, V_fn).call(this, e);
|
|
34787
34792
|
else {
|
|
34788
34793
|
__privateGet(this, _W).call(this, s);
|
|
34789
|
-
let
|
|
34790
|
-
if (__privateMethod(this,
|
|
34794
|
+
let n = __privateGet(this, _t)[s];
|
|
34795
|
+
if (__privateMethod(this, _c_instances, e_fn).call(this, n) ? n.__abortController.abort(new Error("deleted")) : (__privateGet(this, _T) || __privateGet(this, _f)) && (__privateGet(this, _T) && ((_a5 = __privateGet(this, _w)) == null ? void 0 : _a5.call(this, n, t, e)), __privateGet(this, _f) && __privateGet(this, _r)?.push([n, t, e])), __privateGet(this, _s).delete(t), __privateGet(this, _i)[s] = void 0, __privateGet(this, _t)[s] = void 0, s === __privateGet(this, _h)) __privateSet(this, _h, __privateGet(this, _u)[s]);
|
|
34791
34796
|
else if (s === __privateGet(this, _l)) __privateSet(this, _l, __privateGet(this, _a4)[s]);
|
|
34792
34797
|
else {
|
|
34793
|
-
let
|
|
34794
|
-
__privateGet(this, _a4)[
|
|
34795
|
-
let
|
|
34796
|
-
__privateGet(this, _u)[
|
|
34798
|
+
let o = __privateGet(this, _u)[s];
|
|
34799
|
+
__privateGet(this, _a4)[o] = __privateGet(this, _a4)[s];
|
|
34800
|
+
let h = __privateGet(this, _a4)[s];
|
|
34801
|
+
__privateGet(this, _u)[h] = __privateGet(this, _u)[s];
|
|
34797
34802
|
}
|
|
34798
34803
|
__privateWrapper(this, _n)._--, __privateGet(this, _b2).push(s);
|
|
34799
34804
|
}
|
|
34800
34805
|
}
|
|
34801
34806
|
if (__privateGet(this, _f) && __privateGet(this, _r)?.length) {
|
|
34802
|
-
let s = __privateGet(this, _r),
|
|
34803
|
-
for (;
|
|
34807
|
+
let s = __privateGet(this, _r), n;
|
|
34808
|
+
for (; n = s?.shift(); ) (_b3 = __privateGet(this, _S)) == null ? void 0 : _b3.call(this, ...n);
|
|
34804
34809
|
}
|
|
34805
34810
|
return i;
|
|
34806
34811
|
}, V_fn = function(t) {
|
|
34807
34812
|
var _a5, _b3;
|
|
34808
|
-
for (let e of __privateMethod(this,
|
|
34813
|
+
for (let e of __privateMethod(this, _c_instances, O_fn).call(this, { allowStale: true })) {
|
|
34809
34814
|
let i = __privateGet(this, _t)[e];
|
|
34810
|
-
if (__privateMethod(this,
|
|
34815
|
+
if (__privateMethod(this, _c_instances, e_fn).call(this, i)) i.__abortController.abort(new Error("deleted"));
|
|
34811
34816
|
else {
|
|
34812
34817
|
let s = __privateGet(this, _i)[e];
|
|
34813
34818
|
__privateGet(this, _T) && ((_a5 = __privateGet(this, _w)) == null ? void 0 : _a5.call(this, i, s, t)), __privateGet(this, _f) && __privateGet(this, _r)?.push([i, s, t]);
|
|
@@ -37938,7 +37943,7 @@ async function createTextEngine(opts = {}) {
|
|
|
37938
37943
|
const width = opts.width ?? CANVAS_CONFIG.DEFAULTS.width;
|
|
37939
37944
|
const height = opts.height ?? CANVAS_CONFIG.DEFAULTS.height;
|
|
37940
37945
|
const pixelRatio = opts.pixelRatio ?? CANVAS_CONFIG.DEFAULTS.pixelRatio;
|
|
37941
|
-
const wasmBaseURL = "https://shotstack
|
|
37946
|
+
const wasmBaseURL = "https://js.shotstack.io/canvas/hb.wasm";
|
|
37942
37947
|
let fonts;
|
|
37943
37948
|
try {
|
|
37944
37949
|
fonts = await FontRegistry.getSharedInstance(wasmBaseURL);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shotstack/shotstack-canvas",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.10",
|
|
4
4
|
"description": "Text layout & animation engine (HarfBuzz) for Node & Web - fully self-contained.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/entry.node.cjs",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"@resvg/resvg-js": "^2.6.2",
|
|
53
53
|
"@resvg/resvg-wasm": "^2.6.2",
|
|
54
|
-
"@shotstack/schemas": "1.9.
|
|
54
|
+
"@shotstack/schemas": "1.9.3",
|
|
55
55
|
"bidi-js": "^1.0.3",
|
|
56
56
|
"canvas": "npm:@napi-rs/canvas@^0.1.54",
|
|
57
57
|
"ffmpeg-static": "^5.2.0",
|