@useupup/core 3.3.0
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 +21 -0
- package/NOTICE +8 -0
- package/README.md +75 -0
- package/dist/browser-SXR426OQ.cjs +10 -0
- package/dist/browser-WD6T5ABJ.js +1 -0
- package/dist/chunk-2H5ICKFT.cjs +122 -0
- package/dist/chunk-6HF3I2JS.cjs +39 -0
- package/dist/chunk-6S5DQDQH.js +212 -0
- package/dist/chunk-BMQC27OE.cjs +92 -0
- package/dist/chunk-BSGQGINR.cjs +219 -0
- package/dist/chunk-CPKZ2CXD.cjs +179 -0
- package/dist/chunk-DTKDIMKT.cjs +573 -0
- package/dist/chunk-DYE5XJ6Z.cjs +2134 -0
- package/dist/chunk-E3ZCNOXG.cjs +74 -0
- package/dist/chunk-FEQY2WYY.cjs +2377 -0
- package/dist/chunk-FMURBCZ7.js +120 -0
- package/dist/chunk-FYQQRULL.js +37 -0
- package/dist/chunk-GE4LIVXP.js +133 -0
- package/dist/chunk-HFR5HZJZ.js +56 -0
- package/dist/chunk-I7ULPCA2.js +72 -0
- package/dist/chunk-MHYXDLZR.js +569 -0
- package/dist/chunk-N2SLHVAW.cjs +61 -0
- package/dist/chunk-OOPDEOTM.js +169 -0
- package/dist/chunk-PMBR3OUW.js +2359 -0
- package/dist/chunk-QK7HZIVY.cjs +144 -0
- package/dist/chunk-T2AQHY7V.cjs +59 -0
- package/dist/chunk-TRCP5FUR.js +90 -0
- package/dist/chunk-U7KL5M2H.cjs +374 -0
- package/dist/chunk-UXNPM54W.js +2108 -0
- package/dist/chunk-VV6QCQLL.js +365 -0
- package/dist/chunk-ZMS2HXLB.js +56 -0
- package/dist/context-shapes-123dd3b6.d.cts +207 -0
- package/dist/context-shapes-27b24c8f.d.ts +207 -0
- package/dist/contracts-pipeline-cf177270.d.cts +78 -0
- package/dist/contracts-pipeline-cf177270.d.ts +78 -0
- package/dist/contracts-strategies-378a16b7.d.cts +168 -0
- package/dist/contracts-strategies-378a16b7.d.ts +168 -0
- package/dist/contracts.cjs +181 -0
- package/dist/contracts.d.cts +11 -0
- package/dist/contracts.d.ts +11 -0
- package/dist/contracts.js +4 -0
- package/dist/core-141335ac.d.ts +651 -0
- package/dist/core-bea2ceca.d.cts +651 -0
- package/dist/create-worker-provider-AA5SRII6.js +58 -0
- package/dist/create-worker-provider-KJNUSSTW.cjs +60 -0
- package/dist/eligibility-ONLNJ6FB.cjs +10 -0
- package/dist/eligibility-ULFC3E4G.js +8 -0
- package/dist/error-code-map-9c44a425.d.ts +62 -0
- package/dist/error-code-map-dd5becfa.d.cts +62 -0
- package/dist/i18n/index.cjs +90 -0
- package/dist/i18n/index.d.cts +3 -0
- package/dist/i18n/index.d.ts +3 -0
- package/dist/i18n/index.js +1 -0
- package/dist/index.cjs +1770 -0
- package/dist/index.d.cts +280 -0
- package/dist/index.d.ts +280 -0
- package/dist/index.js +1589 -0
- package/dist/internal.cjs +2407 -0
- package/dist/internal.d.cts +595 -0
- package/dist/internal.d.ts +595 -0
- package/dist/internal.js +2275 -0
- package/dist/pipeline/index.cjs +10 -0
- package/dist/pipeline/index.d.cts +11 -0
- package/dist/pipeline/index.d.ts +11 -0
- package/dist/pipeline/index.js +1 -0
- package/dist/pipeline-worker.cjs +199 -0
- package/dist/pipeline-worker.d.cts +2 -0
- package/dist/pipeline-worker.d.ts +2 -0
- package/dist/pipeline-worker.js +197 -0
- package/dist/resolve-locale-81feef21.d.ts +20 -0
- package/dist/resolve-locale-9cb63600.d.cts +20 -0
- package/dist/resolve-theme-01758105.d.ts +53 -0
- package/dist/resolve-theme-66cf8d98.d.cts +53 -0
- package/dist/server-mode-drive-controller-b5f8ee12.d.cts +180 -0
- package/dist/server-mode-drive-controller-b5f8ee12.d.ts +180 -0
- package/dist/steps/compress.cjs +66 -0
- package/dist/steps/compress.d.cts +10 -0
- package/dist/steps/compress.d.ts +10 -0
- package/dist/steps/compress.js +64 -0
- package/dist/steps/exif.cjs +44 -0
- package/dist/steps/exif.d.cts +5 -0
- package/dist/steps/exif.d.ts +5 -0
- package/dist/steps/exif.js +42 -0
- package/dist/steps/hash.cjs +44 -0
- package/dist/steps/hash.d.cts +5 -0
- package/dist/steps/hash.d.ts +5 -0
- package/dist/steps/hash.js +42 -0
- package/dist/steps/heic.cjs +59 -0
- package/dist/steps/heic.d.cts +5 -0
- package/dist/steps/heic.d.ts +5 -0
- package/dist/steps/heic.js +57 -0
- package/dist/steps/thumbnail.cjs +54 -0
- package/dist/steps/thumbnail.d.cts +10 -0
- package/dist/steps/thumbnail.d.ts +10 -0
- package/dist/steps/thumbnail.js +52 -0
- package/dist/strategies/index.cjs +82 -0
- package/dist/strategies/index.d.cts +187 -0
- package/dist/strategies/index.d.ts +187 -0
- package/dist/strategies/index.js +60 -0
- package/dist/strategies/tus-upload.cjs +14 -0
- package/dist/strategies/tus-upload.d.cts +15 -0
- package/dist/strategies/tus-upload.d.ts +15 -0
- package/dist/strategies/tus-upload.js +5 -0
- package/dist/theme/index.cjs +38 -0
- package/dist/theme/index.d.cts +3 -0
- package/dist/theme/index.d.ts +3 -0
- package/dist/theme/index.js +1 -0
- package/dist/theme-store-2e56a674.d.cts +39 -0
- package/dist/theme-store-f13e0315.d.ts +39 -0
- package/dist/token-endpoint-5fdb4a35.d.ts +20 -0
- package/dist/token-endpoint-a7d15ab6.d.cts +20 -0
- package/dist/ui-translations-c5d00392.d.cts +455 -0
- package/dist/ui-translations-c5d00392.d.ts +455 -0
- package/dist/uploader-props-72242002.d.ts +340 -0
- package/dist/uploader-props-7f956e60.d.cts +340 -0
- package/dist/vars-d3421f6c.d.cts +240 -0
- package/dist/vars-d3421f6c.d.ts +240 -0
- package/package.json +182 -0
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkBSGQGINR_cjs = require('./chunk-BSGQGINR.cjs');
|
|
4
|
+
var chunkQK7HZIVY_cjs = require('./chunk-QK7HZIVY.cjs');
|
|
5
|
+
|
|
6
|
+
// src/steps/heic-decode.ts
|
|
7
|
+
var libheifPromise = null;
|
|
8
|
+
function loadLibheif() {
|
|
9
|
+
if (!libheifPromise) {
|
|
10
|
+
libheifPromise = (async () => {
|
|
11
|
+
let mod;
|
|
12
|
+
try {
|
|
13
|
+
mod = await import('libheif-js/libheif-wasm/libheif-bundle.mjs');
|
|
14
|
+
} catch {
|
|
15
|
+
libheifPromise = null;
|
|
16
|
+
throw new chunkQK7HZIVY_cjs.UpupError(
|
|
17
|
+
'HEIC support requires the optional dependency "libheif-js". Install it: npm i libheif-js',
|
|
18
|
+
"HEIC_CONVERSION_FAILED" /* HEIC_CONVERSION_FAILED */
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
const factory = mod.default ?? mod;
|
|
22
|
+
return factory();
|
|
23
|
+
})();
|
|
24
|
+
}
|
|
25
|
+
return libheifPromise;
|
|
26
|
+
}
|
|
27
|
+
function canvasBackendAvailable() {
|
|
28
|
+
return typeof OffscreenCanvas !== "undefined" || typeof document !== "undefined" && "createElement" in document;
|
|
29
|
+
}
|
|
30
|
+
async function heicToJpegBlob(input, options = {}) {
|
|
31
|
+
if (!canvasBackendAvailable()) return null;
|
|
32
|
+
const quality = typeof options.quality === "number" ? options.quality : 0.92;
|
|
33
|
+
const libheif = await loadLibheif();
|
|
34
|
+
const buffer = await input.arrayBuffer();
|
|
35
|
+
const decoder = new libheif.HeifDecoder();
|
|
36
|
+
let images = [];
|
|
37
|
+
try {
|
|
38
|
+
images = decoder.decode(new Uint8Array(buffer));
|
|
39
|
+
const image = images[0];
|
|
40
|
+
if (!image)
|
|
41
|
+
throw new chunkQK7HZIVY_cjs.UpupError(
|
|
42
|
+
"HEIC: no image found in file",
|
|
43
|
+
"HEIC_CONVERSION_FAILED" /* HEIC_CONVERSION_FAILED */
|
|
44
|
+
);
|
|
45
|
+
const width = image.get_width();
|
|
46
|
+
const height = image.get_height();
|
|
47
|
+
const canvas = chunkBSGQGINR_cjs.createCanvas(width, height);
|
|
48
|
+
const ctx = canvas?.getContext("2d");
|
|
49
|
+
if (!canvas || !ctx) return null;
|
|
50
|
+
const imageData = ctx.createImageData(width, height);
|
|
51
|
+
await new Promise((resolve, reject) => {
|
|
52
|
+
image.display(imageData, (result) => {
|
|
53
|
+
if (result) resolve();
|
|
54
|
+
else reject(new Error("HEIC: display failed"));
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
ctx.putImageData(imageData, 0, 0);
|
|
58
|
+
return await chunkBSGQGINR_cjs.canvasToBlob(canvas, "image/jpeg", quality);
|
|
59
|
+
} finally {
|
|
60
|
+
for (const img of images) {
|
|
61
|
+
try {
|
|
62
|
+
img.free();
|
|
63
|
+
} catch {
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
try {
|
|
67
|
+
libheif.heif_context_free(decoder.decoder);
|
|
68
|
+
} catch {
|
|
69
|
+
}
|
|
70
|
+
decoder.decoder = null;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
exports.heicToJpegBlob = heicToJpegBlob;
|