@design-edito/tools 0.1.52 → 0.1.54
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/agnostic/arrays/find-duplicates/index.js +1 -0
- package/agnostic/arrays/index.js +10 -9
- package/agnostic/arrays/is-array-of/index.js +1 -0
- package/agnostic/arrays/make/index.js +1 -0
- package/agnostic/arrays/random-pick/index.js +7 -6
- package/agnostic/arrays/shuffle/index.js +1 -0
- package/agnostic/booleans/index.js +1 -0
- package/agnostic/booleans/is-falsy/index.js +1 -0
- package/agnostic/css/bem/index.js +3 -2
- package/agnostic/css/generate-nice-color/index.js +1 -0
- package/agnostic/css/index.js +16 -15
- package/agnostic/css/is-valid-css-class-name/index.js +1 -0
- package/agnostic/css/styles-set/index.js +9 -8
- package/agnostic/errors/index.js +3 -2
- package/agnostic/errors/register/index.js +1 -0
- package/agnostic/errors/unknown-to-string/index.js +1 -0
- package/agnostic/html/get-node-ancestors/index.js +1 -0
- package/agnostic/html/get-position-inside-parent/index.js +1 -0
- package/agnostic/html/hyper-json/cast/index.js +7 -6
- package/agnostic/html/hyper-json/index.js +8 -7
- package/agnostic/html/hyper-json/method/index.js +1 -0
- package/agnostic/html/hyper-json/serialize/index.js +1 -0
- package/agnostic/html/hyper-json/smart-tags/coalesced/add/index.js +7 -6
- package/agnostic/html/hyper-json/smart-tags/coalesced/addclass/index.js +7 -6
- package/agnostic/html/hyper-json/smart-tags/coalesced/and/index.js +7 -6
- package/agnostic/html/hyper-json/smart-tags/coalesced/append/index.js +7 -6
- package/agnostic/html/hyper-json/smart-tags/coalesced/at/index.js +7 -6
- package/agnostic/html/hyper-json/smart-tags/coalesced/call/index.js +7 -6
- package/agnostic/html/hyper-json/smart-tags/coalesced/clone/index.js +7 -6
- package/agnostic/html/hyper-json/smart-tags/coalesced/deleteproperties/index.js +7 -6
- package/agnostic/html/hyper-json/smart-tags/coalesced/equals/index.js +7 -6
- package/agnostic/html/hyper-json/smart-tags/coalesced/getattribute/index.js +7 -6
- package/agnostic/html/hyper-json/smart-tags/coalesced/getproperties/index.js +7 -6
- package/agnostic/html/hyper-json/smart-tags/coalesced/getproperty/index.js +7 -6
- package/agnostic/html/hyper-json/smart-tags/coalesced/if/index.js +7 -6
- package/agnostic/html/hyper-json/smart-tags/coalesced/initialize/index.js +7 -6
- package/agnostic/html/hyper-json/smart-tags/coalesced/join/index.js +7 -6
- package/agnostic/html/hyper-json/smart-tags/coalesced/length/index.js +7 -6
- package/agnostic/html/hyper-json/smart-tags/coalesced/map/index.js +7 -6
- package/agnostic/html/hyper-json/smart-tags/coalesced/negate/index.js +7 -6
- package/agnostic/html/hyper-json/smart-tags/coalesced/notrailing/index.js +7 -6
- package/agnostic/html/hyper-json/smart-tags/coalesced/or/index.js +7 -6
- package/agnostic/html/hyper-json/smart-tags/coalesced/pickrandom/index.js +7 -6
- package/agnostic/html/hyper-json/smart-tags/coalesced/populate/index.js +7 -6
- package/agnostic/html/hyper-json/smart-tags/coalesced/print/index.js +7 -6
- package/agnostic/html/hyper-json/smart-tags/coalesced/push/index.js +7 -6
- package/agnostic/html/hyper-json/smart-tags/coalesced/pusheach/index.js +7 -6
- package/agnostic/html/hyper-json/smart-tags/coalesced/recordtoarray/index.js +7 -6
- package/agnostic/html/hyper-json/smart-tags/coalesced/removeattribute/index.js +7 -6
- package/agnostic/html/hyper-json/smart-tags/coalesced/removeclass/index.js +7 -6
- package/agnostic/html/hyper-json/smart-tags/coalesced/renameproperty/index.js +7 -6
- package/agnostic/html/hyper-json/smart-tags/coalesced/replace/index.js +7 -6
- package/agnostic/html/hyper-json/smart-tags/coalesced/select/index.js +7 -6
- package/agnostic/html/hyper-json/smart-tags/coalesced/set/index.js +7 -6
- package/agnostic/html/hyper-json/smart-tags/coalesced/setattribute/index.js +7 -6
- package/agnostic/html/hyper-json/smart-tags/coalesced/setproperty/index.js +7 -6
- package/agnostic/html/hyper-json/smart-tags/coalesced/sorton/index.js +7 -6
- package/agnostic/html/hyper-json/smart-tags/coalesced/split/index.js +7 -6
- package/agnostic/html/hyper-json/smart-tags/coalesced/spread/index.js +7 -6
- package/agnostic/html/hyper-json/smart-tags/coalesced/toarray/index.js +7 -6
- package/agnostic/html/hyper-json/smart-tags/coalesced/toboolean/index.js +7 -6
- package/agnostic/html/hyper-json/smart-tags/coalesced/toelement/index.js +7 -6
- package/agnostic/html/hyper-json/smart-tags/coalesced/toggleclass/index.js +7 -6
- package/agnostic/html/hyper-json/smart-tags/coalesced/tonodelist/index.js +7 -6
- package/agnostic/html/hyper-json/smart-tags/coalesced/tonull/index.js +7 -6
- package/agnostic/html/hyper-json/smart-tags/coalesced/tonumber/index.js +7 -6
- package/agnostic/html/hyper-json/smart-tags/coalesced/torecord/index.js +7 -6
- package/agnostic/html/hyper-json/smart-tags/coalesced/toref/index.js +7 -6
- package/agnostic/html/hyper-json/smart-tags/coalesced/tostring/index.js +7 -6
- package/agnostic/html/hyper-json/smart-tags/coalesced/totext/index.js +7 -6
- package/agnostic/html/hyper-json/smart-tags/coalesced/transformselected/index.js +7 -6
- package/agnostic/html/hyper-json/smart-tags/coalesced/trim/index.js +7 -6
- package/agnostic/html/hyper-json/smart-tags/index.js +1 -0
- package/agnostic/html/hyper-json/smart-tags/isolated/any/index.js +1 -0
- package/agnostic/html/hyper-json/smart-tags/isolated/array/index.js +1 -0
- package/agnostic/html/hyper-json/smart-tags/isolated/boolean/index.js +7 -6
- package/agnostic/html/hyper-json/smart-tags/isolated/element/index.js +7 -6
- package/agnostic/html/hyper-json/smart-tags/isolated/get/index.js +7 -6
- package/agnostic/html/hyper-json/smart-tags/isolated/global/index.js +7 -6
- package/agnostic/html/hyper-json/smart-tags/isolated/guess/index.js +7 -6
- package/agnostic/html/hyper-json/smart-tags/isolated/nodelist/index.js +7 -6
- package/agnostic/html/hyper-json/smart-tags/isolated/null/index.js +1 -0
- package/agnostic/html/hyper-json/smart-tags/isolated/number/index.js +7 -6
- package/agnostic/html/hyper-json/smart-tags/isolated/record/index.js +7 -6
- package/agnostic/html/hyper-json/smart-tags/isolated/ref/index.js +7 -6
- package/agnostic/html/hyper-json/smart-tags/isolated/string/index.js +7 -6
- package/agnostic/html/hyper-json/smart-tags/isolated/text/index.js +7 -6
- package/agnostic/html/hyper-json/transformer/index.js +1 -0
- package/agnostic/html/hyper-json/tree/index.js +7 -6
- package/agnostic/html/hyper-json/types/index.js +1 -0
- package/agnostic/html/hyper-json/utils/index.js +7 -6
- package/agnostic/html/index.js +24 -23
- package/agnostic/html/insert-node/index.js +1 -0
- package/agnostic/html/placeholders/index.js +1 -0
- package/agnostic/html/replace-in-element/index.js +1 -0
- package/agnostic/html/sanitize/index.js +7 -6
- package/agnostic/html/selector-to-element/index.js +7 -6
- package/agnostic/html/string-to-nodes/index.js +8 -7
- package/agnostic/misc/assert/index.js +4 -3
- package/agnostic/misc/cast/index.js +1 -0
- package/agnostic/misc/crawler/index.js +1 -0
- package/agnostic/misc/crossenv/detect-runtime/index.js +1 -0
- package/agnostic/misc/crossenv/index.js +3 -2
- package/agnostic/misc/crossenv/types/index.js +1 -0
- package/agnostic/misc/crossenv/window/index.js +1 -0
- package/agnostic/misc/data-size/index.js +1 -0
- package/agnostic/misc/elo/index.js +2 -0
- package/agnostic/misc/get-current-downlink/index.js +1 -0
- package/agnostic/misc/index.js +18 -17
- package/agnostic/misc/is-constructor-function/index.js +1 -0
- package/agnostic/misc/is-nullish/index.js +1 -0
- package/agnostic/misc/logs/index.js +1 -0
- package/agnostic/misc/logs/logger/index.js +1 -0
- package/agnostic/misc/logs/make-text-block/index.js +1 -0
- package/agnostic/misc/logs/styles/index.js +1 -0
- package/agnostic/misc/lorem-ipsum/index.js +13 -12
- package/agnostic/misc/outcome/index.js +1 -0
- package/agnostic/numbers/absolute-modulo/index.js +1 -0
- package/agnostic/numbers/clamp/index.js +1 -0
- package/agnostic/numbers/index.js +4 -3
- package/agnostic/numbers/interpolate/index.js +1 -0
- package/agnostic/numbers/responsive-harmonics/index.js +1 -0
- package/agnostic/numbers/round/index.js +1 -0
- package/agnostic/objects/deep-get-property/index.js +1 -0
- package/agnostic/objects/enums/index.js +1 -0
- package/agnostic/objects/enums/is-in-enum/index.js +1 -0
- package/agnostic/objects/flatten-getters/index.js +1 -0
- package/agnostic/objects/index.js +14 -13
- package/agnostic/objects/is-object/index.js +1 -0
- package/agnostic/objects/is-record/index.js +1 -0
- package/agnostic/objects/record-format/index.js +1 -0
- package/agnostic/objects/record-map/index.js +1 -0
- package/agnostic/objects/validation/index.js +1 -0
- package/agnostic/optim/index.js +1 -0
- package/agnostic/optim/memoize/index.js +1 -0
- package/agnostic/optim/throttle-debounce/index.js +1 -0
- package/agnostic/random/hex-char/index.js +1 -0
- package/agnostic/random/index.js +3 -2
- package/agnostic/random/random/index.js +1 -0
- package/agnostic/random/uuid/index.js +1 -0
- package/agnostic/regexps/index.js +2 -0
- package/agnostic/strings/char-codes/index.js +1 -0
- package/agnostic/strings/index.js +9 -8
- package/agnostic/strings/matches/index.js +1 -0
- package/agnostic/strings/normalize-indent/index.js +1 -0
- package/agnostic/strings/replace-all/index.js +1 -0
- package/agnostic/strings/to-alphanum/index.js +1 -0
- package/agnostic/strings/trim/index.js +1 -0
- package/agnostic/time/dates/format-date/index.js +1 -0
- package/agnostic/time/dates/index.js +1 -0
- package/agnostic/time/duration/index.js +1 -0
- package/agnostic/time/index.js +4 -3
- package/agnostic/time/timeout/index.js +1 -0
- package/agnostic/time/transitions/index.js +1 -0
- package/agnostic/time/wait/index.js +1 -0
- package/chunks/chunk-2KCKWG7R.js +104 -0
- package/chunks/chunk-35W7XRC3.js +173 -0
- package/chunks/chunk-365LSZZ7.js +37 -0
- package/chunks/chunk-3GTGE66Y.js +32 -0
- package/chunks/chunk-422KBDRV.js +203 -0
- package/chunks/chunk-4FOK7DUZ.js +35 -0
- package/chunks/chunk-4LCL2RIC.js +209 -0
- package/chunks/chunk-4OH2EX3D.js +191 -0
- package/chunks/chunk-4WOAFIVN.js +31 -0
- package/chunks/chunk-4WOYAD35.js +31 -0
- package/chunks/chunk-53MBV4TG.js +6212 -0
- package/chunks/chunk-57YCNOX7.js +15 -0
- package/chunks/chunk-5JMTDJWX.js +37 -0
- package/chunks/chunk-5QVKJGTN.js +95 -0
- package/chunks/chunk-5RGHYFQH.js +70 -0
- package/chunks/chunk-5VHFXWFM.js +31 -0
- package/chunks/chunk-6DA4S65P.js +37 -0
- package/chunks/chunk-6GZXU2Z3.js +191 -0
- package/chunks/chunk-7DDXALPH.js +49 -0
- package/chunks/chunk-7QIYI4CK.js +209 -0
- package/chunks/chunk-7YSTZ7GY.js +31 -0
- package/chunks/chunk-A4FSJC46.js +58 -0
- package/chunks/chunk-AF2MI5O5.js +29 -0
- package/chunks/chunk-ARDAQZRR.js +239 -0
- package/chunks/chunk-BLAAWANI.js +191 -0
- package/chunks/chunk-BNNAZPI2.js +191 -0
- package/chunks/chunk-BONBND7I.js +239 -0
- package/chunks/chunk-BV67SWXG.js +20 -0
- package/chunks/chunk-CIJQHLIW.js +31 -0
- package/chunks/chunk-DHMARF6D.js +62 -0
- package/chunks/chunk-DHWHB53F.js +191 -0
- package/chunks/chunk-DMR2WE3C.js +62 -0
- package/chunks/chunk-DPBYDWV3.js +2369 -0
- package/chunks/chunk-ECKOTCS4.js +2369 -0
- package/chunks/chunk-EEIJDUNV.js +209 -0
- package/chunks/chunk-EIU72AEZ.js +31 -0
- package/chunks/chunk-EM37BFXO.js +35 -0
- package/chunks/chunk-ERAFJXWH.js +20 -0
- package/chunks/chunk-F5GXXF3A.js +31 -0
- package/chunks/chunk-FEFY3V6P.js +31 -0
- package/chunks/chunk-FG53JEP2.js +31 -0
- package/chunks/chunk-FJTOFK3C.js +203 -0
- package/chunks/chunk-FTIDPZZ5.js +209 -0
- package/chunks/chunk-G66DWXF3.js +31 -0
- package/chunks/chunk-GARJTJ6V.js +6 -0
- package/chunks/chunk-GL54CDM2.js +20 -0
- package/chunks/chunk-GNZY3ZTH.js +14 -0
- package/chunks/chunk-GP44TBRI.js +39 -0
- package/chunks/chunk-GWXVHCAB.js +31 -0
- package/chunks/chunk-HTNLTDQT.js +28 -0
- package/chunks/chunk-I2ILSLBK.js +32 -0
- package/chunks/chunk-I66DPQN2.js +31 -0
- package/chunks/chunk-IGHRNHVK.js +16 -0
- package/chunks/chunk-IOWZMFCU.js +28 -0
- package/chunks/chunk-IPON4W2H.js +31 -0
- package/chunks/chunk-IUFAHY2R.js +38 -0
- package/chunks/chunk-JBDWHJ4Q.js +31 -0
- package/chunks/chunk-JBSS64SA.js +6 -0
- package/chunks/chunk-JJWKHBXD.js +68 -0
- package/chunks/chunk-JRXTMXKV.js +15967 -0
- package/chunks/chunk-KEYRP27F.js +191 -0
- package/chunks/chunk-KYMCGWPM.js +31 -0
- package/chunks/chunk-L5JWJRZ7.js +484 -0
- package/chunks/chunk-L7EUEQZP.js +0 -0
- package/chunks/chunk-LAA2DQDK.js +31 -0
- package/chunks/chunk-LATEK24U.js +31 -0
- package/chunks/chunk-LDLSU4OG.js +191 -0
- package/chunks/chunk-LWWXPVXY.js +25173 -0
- package/chunks/chunk-MMPJODO2.js +31 -0
- package/chunks/chunk-MOA6JFUQ.js +2369 -0
- package/chunks/chunk-MUYZV5F3.js +2369 -0
- package/chunks/chunk-MY4VMHSH.js +191 -0
- package/chunks/chunk-MZ2RAM5Y.js +62 -0
- package/chunks/chunk-N4BZJOGW.js +56 -0
- package/chunks/chunk-N4LMP4UM.js +31 -0
- package/chunks/chunk-NGYJGQT3.js +25002 -0
- package/chunks/chunk-NIOOIUSD.js +104 -0
- package/chunks/chunk-NLHFSJYR.js +15 -0
- package/chunks/chunk-NQ5ESZNO.js +191 -0
- package/chunks/chunk-O6NULFZI.js +37 -0
- package/chunks/chunk-OVMNSJOW.js +6 -0
- package/chunks/chunk-PPK2JEO6.js +28 -0
- package/chunks/chunk-PVHLWKA6.js +31 -0
- package/chunks/chunk-Q7HA7IAA.js +20 -0
- package/chunks/chunk-QMWX2A56.js +56 -0
- package/chunks/chunk-QPBY235R.js +239 -0
- package/chunks/chunk-QTTNO4T6.js +37 -0
- package/chunks/chunk-QVIRBFMQ.js +31 -0
- package/chunks/chunk-REBANVPP.js +104 -0
- package/chunks/chunk-ROJZUEYL.js +37 -0
- package/chunks/chunk-RSMUYH5H.js +31 -0
- package/chunks/chunk-RVVJ4QD4.js +173 -0
- package/chunks/chunk-SPMF4X5X.js +31 -0
- package/chunks/chunk-TSQVG7GA.js +31 -0
- package/chunks/chunk-TXOUGP37.js +62 -0
- package/chunks/chunk-UG36UPJK.js +31 -0
- package/chunks/chunk-UVSTFYSD.js +28 -0
- package/chunks/chunk-UXM54YBI.js +68 -0
- package/chunks/chunk-VHFMQI7Z.js +20 -0
- package/chunks/chunk-VP3Y6EMX.js +190 -0
- package/chunks/chunk-VQEP2EQF.js +100 -0
- package/chunks/chunk-VV72XGJJ.js +58 -0
- package/chunks/chunk-VXSOUAUT.js +100 -0
- package/chunks/chunk-W6BFU7Y5.js +56 -0
- package/chunks/chunk-WLHJM76F.js +2369 -0
- package/chunks/chunk-WNLP6R5Y.js +191 -0
- package/chunks/chunk-WOGRENMM.js +31 -0
- package/chunks/chunk-WQKFVIUF.js +37 -0
- package/chunks/chunk-WSFCRVEQ.js +9 -0
- package/chunks/chunk-WTPUSGMJ.js +104 -0
- package/chunks/chunk-X5FAZBWL.js +130 -0
- package/chunks/chunk-XCBH6NLF.js +42 -0
- package/chunks/chunk-XETVQW6S.js +56 -0
- package/chunks/chunk-XT6XKGKK.js +20 -0
- package/chunks/chunk-YDNQHZRS.js +31 -0
- package/chunks/chunk-YHT73ULP.js +2369 -0
- package/chunks/chunk-YMRAUWRW.js +20 -0
- package/chunks/chunk-YRSNU7IX.js +49 -0
- package/chunks/chunk-YVSS4IT2.js +37 -0
- package/chunks/chunk-YZDZQ7AZ.js +37 -0
- package/chunks/chunk-Z4SQDCFG.js +37 -0
- package/chunks/chunk-ZNA7SWFK.js +29 -0
- package/chunks/chunk-ZS5OHINP.js +31 -0
- package/components/Comp/index.js +2 -0
- package/node/@design-edito/index.d.ts +2 -0
- package/node/@design-edito/index.js +12 -0
- package/node/@design-edito/thumbnails/colors/index.d.ts +35 -0
- package/node/@design-edito/thumbnails/colors/index.js +29 -0
- package/node/@design-edito/thumbnails/common/index.d.ts +5 -0
- package/node/@design-edito/thumbnails/common/index.js +15 -0
- package/node/@design-edito/thumbnails/easings/index.d.ts +8 -0
- package/node/@design-edito/thumbnails/easings/index.js +21 -0
- package/node/@design-edito/thumbnails/index.d.ts +5 -0
- package/node/@design-edito/thumbnails/index.js +20 -0
- package/node/@design-edito/thumbnails/layout/index.d.ts +63 -0
- package/node/@design-edito/thumbnails/layout/index.js +31 -0
- package/node/@express/@multer/index.d.ts +22 -0
- package/node/@express/@multer/index.js +8 -0
- package/node/@express/index.d.ts +2 -0
- package/node/@express/index.js +8 -0
- package/node/@google-cloud/index.d.ts +2 -0
- package/node/@google-cloud/index.js +24 -0
- package/node/@google-cloud/storage/bucket/get-metadata/index.d.ts +18 -0
- package/node/@google-cloud/storage/bucket/get-metadata/index.js +9 -0
- package/node/@google-cloud/storage/bucket/index.d.ts +3 -0
- package/node/@google-cloud/storage/bucket/index.js +14 -0
- package/node/@google-cloud/storage/bucket/list/index.d.ts +17 -0
- package/node/@google-cloud/storage/bucket/list/index.js +9 -0
- package/node/@google-cloud/storage/file/copy/index.d.ts +21 -0
- package/node/@google-cloud/storage/file/copy/index.js +9 -0
- package/node/@google-cloud/storage/file/download/index.d.ts +20 -0
- package/node/@google-cloud/storage/file/download/index.js +9 -0
- package/node/@google-cloud/storage/file/erase/index.d.ts +20 -0
- package/node/@google-cloud/storage/file/erase/index.js +9 -0
- package/node/@google-cloud/storage/file/exists/index.d.ts +19 -0
- package/node/@google-cloud/storage/file/exists/index.js +9 -0
- package/node/@google-cloud/storage/file/generate-signed-url/index.d.ts +23 -0
- package/node/@google-cloud/storage/file/generate-signed-url/index.js +9 -0
- package/node/@google-cloud/storage/file/get-metadata/index.d.ts +22 -0
- package/node/@google-cloud/storage/file/get-metadata/index.js +9 -0
- package/node/@google-cloud/storage/file/get-permissions/index.d.ts +19 -0
- package/node/@google-cloud/storage/file/get-permissions/index.js +9 -0
- package/node/@google-cloud/storage/file/index.d.ts +12 -0
- package/node/@google-cloud/storage/file/index.js +50 -0
- package/node/@google-cloud/storage/file/move/index.d.ts +24 -0
- package/node/@google-cloud/storage/file/move/index.js +9 -0
- package/node/@google-cloud/storage/file/revoke-signed-urls/index.d.ts +26 -0
- package/node/@google-cloud/storage/file/revoke-signed-urls/index.js +12 -0
- package/node/@google-cloud/storage/file/update-metadata/index.d.ts +24 -0
- package/node/@google-cloud/storage/file/update-metadata/index.js +9 -0
- package/node/@google-cloud/storage/file/upload/index.d.ts +21 -0
- package/node/@google-cloud/storage/file/upload/index.js +9 -0
- package/node/@google-cloud/storage/index.d.ts +3 -0
- package/node/@google-cloud/storage/index.js +27 -0
- package/node/encryption/buffer/index.d.ts +55 -0
- package/node/encryption/buffer/index.js +16 -0
- package/node/encryption/generate-key/index.d.ts +16 -0
- package/node/encryption/generate-key/index.js +7 -0
- package/node/encryption/index.d.ts +5 -0
- package/node/encryption/index.js +29 -0
- package/node/encryption/uint8-array/index.d.ts +57 -0
- package/node/encryption/uint8-array/index.js +15 -0
- package/node/files/index.d.ts +4 -6
- package/node/files/index.js +11 -11
- package/node/files/is-in-directory/index.js +1 -0
- package/node/files/read-write/index.d.ts +1 -1
- package/node/files/read-write/index.js +1 -0
- package/node/files/subpaths/index.js +1 -0
- package/node/images/exports/index.d.ts +15 -0
- package/node/images/exports/index.js +9 -0
- package/node/images/index.d.ts +4 -0
- package/node/images/index.js +22 -0
- package/node/images/prepare/index.d.ts +17 -0
- package/node/images/prepare/index.js +20 -0
- package/node/images/transform/area-composition/index.d.ts +60 -0
- package/node/images/transform/area-composition/index.js +15 -0
- package/node/images/transform/index.d.ts +30 -0
- package/node/images/transform/index.js +16 -0
- package/node/index.d.ts +8 -6
- package/node/process/index.d.ts +5 -7
- package/node/process/index.js +11 -9
- package/node/process/on-exit/index.js +1 -0
- package/package.json +13 -2
@@ -0,0 +1,31 @@
|
|
1
|
+
import {
|
2
|
+
isArrayOf
|
3
|
+
} from "./chunk-6RGDWX4A.js";
|
4
|
+
import {
|
5
|
+
findDuplicates
|
6
|
+
} from "./chunk-YS6WMSWC.js";
|
7
|
+
import {
|
8
|
+
make
|
9
|
+
} from "./chunk-RLAZR3NL.js";
|
10
|
+
import {
|
11
|
+
randomPick,
|
12
|
+
randomPickMany
|
13
|
+
} from "./chunk-WJMBLQRX.js";
|
14
|
+
import {
|
15
|
+
shuffle
|
16
|
+
} from "./chunk-VJJIYJMY.js";
|
17
|
+
|
18
|
+
// src/agnostic/arrays/index.tsx
|
19
|
+
var Arrays;
|
20
|
+
((Arrays2) => {
|
21
|
+
Arrays2.findDuplicates = findDuplicates;
|
22
|
+
Arrays2.isArrayOf = isArrayOf;
|
23
|
+
Arrays2.make = make;
|
24
|
+
Arrays2.randomPick = randomPick;
|
25
|
+
Arrays2.randomPickMany = randomPickMany;
|
26
|
+
Arrays2.shuffle = shuffle;
|
27
|
+
})(Arrays || (Arrays = {}));
|
28
|
+
|
29
|
+
export {
|
30
|
+
Arrays
|
31
|
+
};
|
@@ -0,0 +1,62 @@
|
|
1
|
+
import {
|
2
|
+
areaCompose
|
3
|
+
} from "./chunk-4LCL2RIC.js";
|
4
|
+
import {
|
5
|
+
require_lib
|
6
|
+
} from "./chunk-53MBV4TG.js";
|
7
|
+
import {
|
8
|
+
__export,
|
9
|
+
__toESM
|
10
|
+
} from "./chunk-XCBH6NLF.js";
|
11
|
+
|
12
|
+
// src/node/images/transform/index.ts
|
13
|
+
var transform_exports = {};
|
14
|
+
__export(transform_exports, {
|
15
|
+
isOperation: () => isOperation,
|
16
|
+
transformImage: () => transformImage
|
17
|
+
});
|
18
|
+
var import_sharp = __toESM(require_lib(), 1);
|
19
|
+
async function transformImage(imageBuffer, operations, maxDimensions) {
|
20
|
+
const imageSharp = (0, import_sharp.default)(imageBuffer);
|
21
|
+
let imageSharped = imageSharp;
|
22
|
+
for await (const operation of operations) {
|
23
|
+
if (isOperation(operation)) {
|
24
|
+
imageSharped = await applyOperation(imageSharped, operation, maxDimensions);
|
25
|
+
}
|
26
|
+
}
|
27
|
+
return await imageSharped.toBuffer();
|
28
|
+
}
|
29
|
+
function isOperation(operation) {
|
30
|
+
return true;
|
31
|
+
}
|
32
|
+
async function applyOperation(imageSharp, operation, maxDimensions) {
|
33
|
+
switch (operation.name) {
|
34
|
+
case "rotate":
|
35
|
+
return imageSharp.rotate(operation.params.angle);
|
36
|
+
case "resize":
|
37
|
+
return imageSharp.resize({
|
38
|
+
width: operation.params.width,
|
39
|
+
height: operation.params.height,
|
40
|
+
fit: operation.params.fit || "cover",
|
41
|
+
background: { r: 255, g: 255, b: 255, alpha: 0 }
|
42
|
+
});
|
43
|
+
/* Adds a transparent background (necessary for png) */
|
44
|
+
case "area-composition":
|
45
|
+
const composedImage = await areaCompose(imageSharp, {
|
46
|
+
...operation.params,
|
47
|
+
dimensions: {
|
48
|
+
w: maxDimensions.width,
|
49
|
+
h: maxDimensions.height
|
50
|
+
}
|
51
|
+
});
|
52
|
+
return composedImage;
|
53
|
+
default:
|
54
|
+
return imageSharp;
|
55
|
+
}
|
56
|
+
}
|
57
|
+
|
58
|
+
export {
|
59
|
+
transformImage,
|
60
|
+
isOperation,
|
61
|
+
transform_exports
|
62
|
+
};
|
@@ -0,0 +1,31 @@
|
|
1
|
+
import {
|
2
|
+
Outcome
|
3
|
+
} from "./chunk-JMU5PDBD.js";
|
4
|
+
import {
|
5
|
+
unknownToString
|
6
|
+
} from "./chunk-FENXVJYO.js";
|
7
|
+
import {
|
8
|
+
__export
|
9
|
+
} from "./chunk-XCBH6NLF.js";
|
10
|
+
|
11
|
+
// src/node/@google-cloud/storage/file/update-metadata/index.ts
|
12
|
+
var update_metadata_exports = {};
|
13
|
+
__export(update_metadata_exports, {
|
14
|
+
updateFileMetadata: () => updateFileMetadata
|
15
|
+
});
|
16
|
+
async function updateFileMetadata(sourcePath, bucket, metadata, options) {
|
17
|
+
const { fileOptions, metadataOptions } = options ?? {};
|
18
|
+
try {
|
19
|
+
const file = bucket.file(sourcePath, fileOptions);
|
20
|
+
await file.setMetadata(metadata, metadataOptions);
|
21
|
+
return Outcome.makeSuccess(true);
|
22
|
+
} catch (err) {
|
23
|
+
const errStr = unknownToString(err);
|
24
|
+
return Outcome.makeFailure(errStr);
|
25
|
+
}
|
26
|
+
}
|
27
|
+
|
28
|
+
export {
|
29
|
+
updateFileMetadata,
|
30
|
+
update_metadata_exports
|
31
|
+
};
|
@@ -0,0 +1,28 @@
|
|
1
|
+
import {
|
2
|
+
colors_exports
|
3
|
+
} from "./chunk-X5FAZBWL.js";
|
4
|
+
import {
|
5
|
+
layout_exports
|
6
|
+
} from "./chunk-BONBND7I.js";
|
7
|
+
import {
|
8
|
+
common_exports
|
9
|
+
} from "./chunk-7DDXALPH.js";
|
10
|
+
import {
|
11
|
+
easings_exports
|
12
|
+
} from "./chunk-JJWKHBXD.js";
|
13
|
+
import {
|
14
|
+
__export
|
15
|
+
} from "./chunk-WSFCRVEQ.js";
|
16
|
+
|
17
|
+
// src/node/@design-edito/thumbnails/index.ts
|
18
|
+
var thumbnails_exports = {};
|
19
|
+
__export(thumbnails_exports, {
|
20
|
+
Colors: () => colors_exports,
|
21
|
+
Common: () => common_exports,
|
22
|
+
Easings: () => easings_exports,
|
23
|
+
Layout: () => layout_exports
|
24
|
+
});
|
25
|
+
|
26
|
+
export {
|
27
|
+
thumbnails_exports
|
28
|
+
};
|
@@ -0,0 +1,68 @@
|
|
1
|
+
import {
|
2
|
+
__export
|
3
|
+
} from "./chunk-XCBH6NLF.js";
|
4
|
+
|
5
|
+
// src/node/@design-edito/thumbnails/easings/index.ts
|
6
|
+
var easings_exports = {};
|
7
|
+
__export(easings_exports, {
|
8
|
+
ease: () => ease,
|
9
|
+
easeInOutQuad: () => easeInOutQuad,
|
10
|
+
easeInOutSine: () => easeInOutSine,
|
11
|
+
easeInQuad: () => easeInQuad,
|
12
|
+
easeInSine: () => easeInSine,
|
13
|
+
easeOutQuad: () => easeOutQuad,
|
14
|
+
easeOutSine: () => easeOutSine,
|
15
|
+
linear: () => linear
|
16
|
+
});
|
17
|
+
function ease(t, name) {
|
18
|
+
switch (name) {
|
19
|
+
case "in-sine":
|
20
|
+
return easeInSine(t);
|
21
|
+
case "out-sine":
|
22
|
+
return easeOutSine(t);
|
23
|
+
case "in-out-sine":
|
24
|
+
return easeInOutSine(t);
|
25
|
+
case "in-quad":
|
26
|
+
return easeInQuad(t);
|
27
|
+
case "out-quad":
|
28
|
+
return easeOutQuad(t);
|
29
|
+
case "in-out-quad":
|
30
|
+
return easeInOutQuad(t);
|
31
|
+
case "linear":
|
32
|
+
default:
|
33
|
+
return linear(t);
|
34
|
+
}
|
35
|
+
}
|
36
|
+
function linear(t) {
|
37
|
+
return t;
|
38
|
+
}
|
39
|
+
function easeOutSine(t) {
|
40
|
+
return Math.sin(t * (Math.PI / 2));
|
41
|
+
}
|
42
|
+
function easeInSine(t) {
|
43
|
+
return -1 * Math.cos(t * (Math.PI / 2)) + 1;
|
44
|
+
}
|
45
|
+
function easeInOutSine(t) {
|
46
|
+
return -0.5 * (Math.cos(Math.PI * t) - 1);
|
47
|
+
}
|
48
|
+
function easeInQuad(t) {
|
49
|
+
return t * t;
|
50
|
+
}
|
51
|
+
function easeOutQuad(t) {
|
52
|
+
return t * (2 - t);
|
53
|
+
}
|
54
|
+
function easeInOutQuad(t) {
|
55
|
+
return t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t;
|
56
|
+
}
|
57
|
+
|
58
|
+
export {
|
59
|
+
ease,
|
60
|
+
linear,
|
61
|
+
easeOutSine,
|
62
|
+
easeInSine,
|
63
|
+
easeInOutSine,
|
64
|
+
easeInQuad,
|
65
|
+
easeOutQuad,
|
66
|
+
easeInOutQuad,
|
67
|
+
easings_exports
|
68
|
+
};
|
@@ -0,0 +1,20 @@
|
|
1
|
+
import {
|
2
|
+
get_metadata_exports
|
3
|
+
} from "./chunk-AF2MI5O5.js";
|
4
|
+
import {
|
5
|
+
list_exports
|
6
|
+
} from "./chunk-KYMCGWPM.js";
|
7
|
+
import {
|
8
|
+
__export
|
9
|
+
} from "./chunk-XCBH6NLF.js";
|
10
|
+
|
11
|
+
// src/node/@google-cloud/storage/bucket/index.ts
|
12
|
+
var bucket_exports = {};
|
13
|
+
__export(bucket_exports, {
|
14
|
+
GetMetadata: () => get_metadata_exports,
|
15
|
+
List: () => list_exports
|
16
|
+
});
|
17
|
+
|
18
|
+
export {
|
19
|
+
bucket_exports
|
20
|
+
};
|
@@ -0,0 +1,190 @@
|
|
1
|
+
import {
|
2
|
+
__commonJS,
|
3
|
+
__require
|
4
|
+
} from "./chunk-XCBH6NLF.js";
|
5
|
+
|
6
|
+
// node_modules/inherits/inherits_browser.js
|
7
|
+
var require_inherits_browser = __commonJS({
|
8
|
+
"node_modules/inherits/inherits_browser.js"(exports, module) {
|
9
|
+
if (typeof Object.create === "function") {
|
10
|
+
module.exports = function inherits(ctor, superCtor) {
|
11
|
+
if (superCtor) {
|
12
|
+
ctor.super_ = superCtor;
|
13
|
+
ctor.prototype = Object.create(superCtor.prototype, {
|
14
|
+
constructor: {
|
15
|
+
value: ctor,
|
16
|
+
enumerable: false,
|
17
|
+
writable: true,
|
18
|
+
configurable: true
|
19
|
+
}
|
20
|
+
});
|
21
|
+
}
|
22
|
+
};
|
23
|
+
} else {
|
24
|
+
module.exports = function inherits(ctor, superCtor) {
|
25
|
+
if (superCtor) {
|
26
|
+
ctor.super_ = superCtor;
|
27
|
+
var TempCtor = function() {
|
28
|
+
};
|
29
|
+
TempCtor.prototype = superCtor.prototype;
|
30
|
+
ctor.prototype = new TempCtor();
|
31
|
+
ctor.prototype.constructor = ctor;
|
32
|
+
}
|
33
|
+
};
|
34
|
+
}
|
35
|
+
}
|
36
|
+
});
|
37
|
+
|
38
|
+
// node_modules/inherits/inherits.js
|
39
|
+
var require_inherits = __commonJS({
|
40
|
+
"node_modules/inherits/inherits.js"(exports, module) {
|
41
|
+
try {
|
42
|
+
util = __require("util");
|
43
|
+
if (typeof util.inherits !== "function") throw "";
|
44
|
+
module.exports = util.inherits;
|
45
|
+
} catch (e) {
|
46
|
+
module.exports = require_inherits_browser();
|
47
|
+
}
|
48
|
+
var util;
|
49
|
+
}
|
50
|
+
});
|
51
|
+
|
52
|
+
// node_modules/process-nextick-args/index.js
|
53
|
+
var require_process_nextick_args = __commonJS({
|
54
|
+
"node_modules/process-nextick-args/index.js"(exports, module) {
|
55
|
+
"use strict";
|
56
|
+
if (typeof process === "undefined" || !process.version || process.version.indexOf("v0.") === 0 || process.version.indexOf("v1.") === 0 && process.version.indexOf("v1.8.") !== 0) {
|
57
|
+
module.exports = { nextTick };
|
58
|
+
} else {
|
59
|
+
module.exports = process;
|
60
|
+
}
|
61
|
+
function nextTick(fn, arg1, arg2, arg3) {
|
62
|
+
if (typeof fn !== "function") {
|
63
|
+
throw new TypeError('"callback" argument must be a function');
|
64
|
+
}
|
65
|
+
var len = arguments.length;
|
66
|
+
var args, i;
|
67
|
+
switch (len) {
|
68
|
+
case 0:
|
69
|
+
case 1:
|
70
|
+
return process.nextTick(fn);
|
71
|
+
case 2:
|
72
|
+
return process.nextTick(function afterTickOne() {
|
73
|
+
fn.call(null, arg1);
|
74
|
+
});
|
75
|
+
case 3:
|
76
|
+
return process.nextTick(function afterTickTwo() {
|
77
|
+
fn.call(null, arg1, arg2);
|
78
|
+
});
|
79
|
+
case 4:
|
80
|
+
return process.nextTick(function afterTickThree() {
|
81
|
+
fn.call(null, arg1, arg2, arg3);
|
82
|
+
});
|
83
|
+
default:
|
84
|
+
args = new Array(len - 1);
|
85
|
+
i = 0;
|
86
|
+
while (i < args.length) {
|
87
|
+
args[i++] = arguments[i];
|
88
|
+
}
|
89
|
+
return process.nextTick(function afterTick() {
|
90
|
+
fn.apply(null, args);
|
91
|
+
});
|
92
|
+
}
|
93
|
+
}
|
94
|
+
}
|
95
|
+
});
|
96
|
+
|
97
|
+
// node_modules/isarray/index.js
|
98
|
+
var require_isarray = __commonJS({
|
99
|
+
"node_modules/isarray/index.js"(exports, module) {
|
100
|
+
var toString = {}.toString;
|
101
|
+
module.exports = Array.isArray || function(arr) {
|
102
|
+
return toString.call(arr) == "[object Array]";
|
103
|
+
};
|
104
|
+
}
|
105
|
+
});
|
106
|
+
|
107
|
+
// node_modules/core-util-is/lib/util.js
|
108
|
+
var require_util = __commonJS({
|
109
|
+
"node_modules/core-util-is/lib/util.js"(exports) {
|
110
|
+
function isArray(arg) {
|
111
|
+
if (Array.isArray) {
|
112
|
+
return Array.isArray(arg);
|
113
|
+
}
|
114
|
+
return objectToString(arg) === "[object Array]";
|
115
|
+
}
|
116
|
+
exports.isArray = isArray;
|
117
|
+
function isBoolean(arg) {
|
118
|
+
return typeof arg === "boolean";
|
119
|
+
}
|
120
|
+
exports.isBoolean = isBoolean;
|
121
|
+
function isNull(arg) {
|
122
|
+
return arg === null;
|
123
|
+
}
|
124
|
+
exports.isNull = isNull;
|
125
|
+
function isNullOrUndefined(arg) {
|
126
|
+
return arg == null;
|
127
|
+
}
|
128
|
+
exports.isNullOrUndefined = isNullOrUndefined;
|
129
|
+
function isNumber(arg) {
|
130
|
+
return typeof arg === "number";
|
131
|
+
}
|
132
|
+
exports.isNumber = isNumber;
|
133
|
+
function isString(arg) {
|
134
|
+
return typeof arg === "string";
|
135
|
+
}
|
136
|
+
exports.isString = isString;
|
137
|
+
function isSymbol(arg) {
|
138
|
+
return typeof arg === "symbol";
|
139
|
+
}
|
140
|
+
exports.isSymbol = isSymbol;
|
141
|
+
function isUndefined(arg) {
|
142
|
+
return arg === void 0;
|
143
|
+
}
|
144
|
+
exports.isUndefined = isUndefined;
|
145
|
+
function isRegExp(re) {
|
146
|
+
return objectToString(re) === "[object RegExp]";
|
147
|
+
}
|
148
|
+
exports.isRegExp = isRegExp;
|
149
|
+
function isObject(arg) {
|
150
|
+
return typeof arg === "object" && arg !== null;
|
151
|
+
}
|
152
|
+
exports.isObject = isObject;
|
153
|
+
function isDate(d) {
|
154
|
+
return objectToString(d) === "[object Date]";
|
155
|
+
}
|
156
|
+
exports.isDate = isDate;
|
157
|
+
function isError(e) {
|
158
|
+
return objectToString(e) === "[object Error]" || e instanceof Error;
|
159
|
+
}
|
160
|
+
exports.isError = isError;
|
161
|
+
function isFunction(arg) {
|
162
|
+
return typeof arg === "function";
|
163
|
+
}
|
164
|
+
exports.isFunction = isFunction;
|
165
|
+
function isPrimitive(arg) {
|
166
|
+
return arg === null || typeof arg === "boolean" || typeof arg === "number" || typeof arg === "string" || typeof arg === "symbol" || // ES6 symbol
|
167
|
+
typeof arg === "undefined";
|
168
|
+
}
|
169
|
+
exports.isPrimitive = isPrimitive;
|
170
|
+
exports.isBuffer = __require("buffer").Buffer.isBuffer;
|
171
|
+
function objectToString(o) {
|
172
|
+
return Object.prototype.toString.call(o);
|
173
|
+
}
|
174
|
+
}
|
175
|
+
});
|
176
|
+
|
177
|
+
// node_modules/util-deprecate/node.js
|
178
|
+
var require_node = __commonJS({
|
179
|
+
"node_modules/util-deprecate/node.js"(exports, module) {
|
180
|
+
module.exports = __require("util").deprecate;
|
181
|
+
}
|
182
|
+
});
|
183
|
+
|
184
|
+
export {
|
185
|
+
require_process_nextick_args,
|
186
|
+
require_isarray,
|
187
|
+
require_util,
|
188
|
+
require_inherits,
|
189
|
+
require_node
|
190
|
+
};
|
@@ -0,0 +1,100 @@
|
|
1
|
+
import {
|
2
|
+
transformImage
|
3
|
+
} from "./chunk-VV72XGJJ.js";
|
4
|
+
import {
|
5
|
+
thumbnails_exports
|
6
|
+
} from "./chunk-UVSTFYSD.js";
|
7
|
+
import {
|
8
|
+
exportZipBuffer,
|
9
|
+
prepareExport
|
10
|
+
} from "./chunk-5RGHYFQH.js";
|
11
|
+
import {
|
12
|
+
__export
|
13
|
+
} from "./chunk-WSFCRVEQ.js";
|
14
|
+
|
15
|
+
// src/node/images/prepare/index.ts
|
16
|
+
var prepare_exports = {};
|
17
|
+
__export(prepare_exports, {
|
18
|
+
MAX_NB_OUTPUTS: () => MAX_NB_OUTPUTS,
|
19
|
+
OUTPUT_ZIP_FOLDER: () => OUTPUT_ZIP_FOLDER,
|
20
|
+
prepareImage: () => prepareImage
|
21
|
+
});
|
22
|
+
import sharp from "sharp";
|
23
|
+
var MAX_NB_OUTPUTS = 50;
|
24
|
+
var OUTPUT_ZIP_FOLDER = "./output-zips";
|
25
|
+
async function prepareImage(imageBuffer, customOptions) {
|
26
|
+
const sharpImage = sharp(imageBuffer);
|
27
|
+
const sharpImageMetadata = await sharpImage.metadata();
|
28
|
+
const imageBufferMetadata = {
|
29
|
+
width: sharpImageMetadata.width || 0,
|
30
|
+
height: sharpImageMetadata.height || 0,
|
31
|
+
format: sharpImageMetadata.format || "png"
|
32
|
+
};
|
33
|
+
const options = getOptions(imageBufferMetadata, customOptions);
|
34
|
+
const nbOutputs = options.qualities.length * (options.ratios.length + 1) * (options.widths.length + 1) * (options.heights.length + 1);
|
35
|
+
if (nbOutputs > MAX_NB_OUTPUTS) {
|
36
|
+
throw Error("Nb output exceeds supported max nb output");
|
37
|
+
}
|
38
|
+
const transformedBuffer = await transformImage(imageBuffer, options.inputOperations, {
|
39
|
+
width: thumbnails_exports.Common.getArrayMax(options.widths) || 0,
|
40
|
+
height: thumbnails_exports.Common.getArrayMax(options.heights) || 0
|
41
|
+
});
|
42
|
+
const exportsBuffers = [{
|
43
|
+
buffer: imageBuffer,
|
44
|
+
name: generateFileName({
|
45
|
+
...imageBufferMetadata,
|
46
|
+
quality: 100,
|
47
|
+
suffix: "original",
|
48
|
+
preffix: options.name
|
49
|
+
})
|
50
|
+
}];
|
51
|
+
for await (const width of options.widths) {
|
52
|
+
for await (const height of options.heights) {
|
53
|
+
for await (const quality of options.qualities) {
|
54
|
+
for await (const format of options.formats) {
|
55
|
+
const exportBuffer = await prepareExport(transformedBuffer, {
|
56
|
+
format,
|
57
|
+
quality,
|
58
|
+
width,
|
59
|
+
height
|
60
|
+
});
|
61
|
+
exportsBuffers.push({
|
62
|
+
buffer: exportBuffer,
|
63
|
+
name: generateFileName({ width, height, quality, format, preffix: options.name })
|
64
|
+
});
|
65
|
+
}
|
66
|
+
}
|
67
|
+
}
|
68
|
+
}
|
69
|
+
const zipBuffer = exportZipBuffer(exportsBuffers, generateZipName());
|
70
|
+
return zipBuffer;
|
71
|
+
}
|
72
|
+
function getOptions(imageBufferMetadata, options) {
|
73
|
+
return {
|
74
|
+
center: [0.5, 0.5],
|
75
|
+
qualities: [100],
|
76
|
+
inputOperations: [],
|
77
|
+
...options,
|
78
|
+
name: options?.name || "",
|
79
|
+
formats: [imageBufferMetadata.format, ...options?.formats ? options.formats : []],
|
80
|
+
ratios: [...options?.ratios ? options.ratios : []],
|
81
|
+
widths: [imageBufferMetadata.width, ...options?.widths ? options.widths : []],
|
82
|
+
heights: [imageBufferMetadata.height, ...options?.heights ? options.heights : []]
|
83
|
+
};
|
84
|
+
}
|
85
|
+
function generateZipName() {
|
86
|
+
const date = /* @__PURE__ */ new Date();
|
87
|
+
return `image-exports_${date.toLocaleDateString()}_${date.toLocaleTimeString()}_${date.getTime()}`.replace(/\/|:/g, "-").replace(/ /g, "").trim();
|
88
|
+
}
|
89
|
+
function generateFileName({ width, height, quality, format, suffix, preffix }) {
|
90
|
+
const _preffix = preffix ? `${preffix}_` : "image-formats_";
|
91
|
+
const _suffix = `${suffix ? `_${suffix}` : ""}.${format}`;
|
92
|
+
return `${_preffix}${width}${height}_Q${quality}${_suffix}`;
|
93
|
+
}
|
94
|
+
|
95
|
+
export {
|
96
|
+
MAX_NB_OUTPUTS,
|
97
|
+
OUTPUT_ZIP_FOLDER,
|
98
|
+
prepareImage,
|
99
|
+
prepare_exports
|
100
|
+
};
|
@@ -0,0 +1,58 @@
|
|
1
|
+
import {
|
2
|
+
areaCompose
|
3
|
+
} from "./chunk-422KBDRV.js";
|
4
|
+
import {
|
5
|
+
__export
|
6
|
+
} from "./chunk-WSFCRVEQ.js";
|
7
|
+
|
8
|
+
// src/node/images/transform/index.ts
|
9
|
+
var transform_exports = {};
|
10
|
+
__export(transform_exports, {
|
11
|
+
isOperation: () => isOperation,
|
12
|
+
transformImage: () => transformImage
|
13
|
+
});
|
14
|
+
import sharp from "sharp";
|
15
|
+
async function transformImage(imageBuffer, operations, maxDimensions) {
|
16
|
+
const imageSharp = sharp(imageBuffer);
|
17
|
+
let imageSharped = imageSharp;
|
18
|
+
for await (const operation of operations) {
|
19
|
+
if (isOperation(operation)) {
|
20
|
+
imageSharped = await applyOperation(imageSharped, operation, maxDimensions);
|
21
|
+
}
|
22
|
+
}
|
23
|
+
return await imageSharped.toBuffer();
|
24
|
+
}
|
25
|
+
function isOperation(operation) {
|
26
|
+
return true;
|
27
|
+
}
|
28
|
+
async function applyOperation(imageSharp, operation, maxDimensions) {
|
29
|
+
switch (operation.name) {
|
30
|
+
case "rotate":
|
31
|
+
return imageSharp.rotate(operation.params.angle);
|
32
|
+
case "resize":
|
33
|
+
return imageSharp.resize({
|
34
|
+
width: operation.params.width,
|
35
|
+
height: operation.params.height,
|
36
|
+
fit: operation.params.fit || "cover",
|
37
|
+
background: { r: 255, g: 255, b: 255, alpha: 0 }
|
38
|
+
});
|
39
|
+
/* Adds a transparent background (necessary for png) */
|
40
|
+
case "area-composition":
|
41
|
+
const composedImage = await areaCompose(imageSharp, {
|
42
|
+
...operation.params,
|
43
|
+
dimensions: {
|
44
|
+
w: maxDimensions.width,
|
45
|
+
h: maxDimensions.height
|
46
|
+
}
|
47
|
+
});
|
48
|
+
return composedImage;
|
49
|
+
default:
|
50
|
+
return imageSharp;
|
51
|
+
}
|
52
|
+
}
|
53
|
+
|
54
|
+
export {
|
55
|
+
transformImage,
|
56
|
+
isOperation,
|
57
|
+
transform_exports
|
58
|
+
};
|
@@ -0,0 +1,100 @@
|
|
1
|
+
import {
|
2
|
+
exportZipBuffer,
|
3
|
+
prepareExport
|
4
|
+
} from "./chunk-5RGHYFQH.js";
|
5
|
+
import {
|
6
|
+
transformImage
|
7
|
+
} from "./chunk-A4FSJC46.js";
|
8
|
+
import {
|
9
|
+
thumbnails_exports
|
10
|
+
} from "./chunk-HTNLTDQT.js";
|
11
|
+
import {
|
12
|
+
__export
|
13
|
+
} from "./chunk-WSFCRVEQ.js";
|
14
|
+
|
15
|
+
// src/node/images/prepare/index.ts
|
16
|
+
var prepare_exports = {};
|
17
|
+
__export(prepare_exports, {
|
18
|
+
MAX_NB_OUTPUTS: () => MAX_NB_OUTPUTS,
|
19
|
+
OUTPUT_ZIP_FOLDER: () => OUTPUT_ZIP_FOLDER,
|
20
|
+
prepareImage: () => prepareImage
|
21
|
+
});
|
22
|
+
import sharp from "sharp";
|
23
|
+
var MAX_NB_OUTPUTS = 50;
|
24
|
+
var OUTPUT_ZIP_FOLDER = "./output-zips";
|
25
|
+
async function prepareImage(imageBuffer, customOptions) {
|
26
|
+
const sharpImage = sharp(imageBuffer);
|
27
|
+
const sharpImageMetadata = await sharpImage.metadata();
|
28
|
+
const imageBufferMetadata = {
|
29
|
+
width: sharpImageMetadata.width || 0,
|
30
|
+
height: sharpImageMetadata.height || 0,
|
31
|
+
format: sharpImageMetadata.format || "png"
|
32
|
+
};
|
33
|
+
const options = getOptions(imageBufferMetadata, customOptions);
|
34
|
+
const nbOutputs = options.qualities.length * (options.ratios.length + 1) * (options.widths.length + 1) * (options.heights.length + 1);
|
35
|
+
if (nbOutputs > MAX_NB_OUTPUTS) {
|
36
|
+
throw Error("Nb output exceeds supported max nb output");
|
37
|
+
}
|
38
|
+
const transformedBuffer = await transformImage(imageBuffer, options.inputOperations, {
|
39
|
+
width: thumbnails_exports.Common.getArrayMax(options.widths) || 0,
|
40
|
+
height: thumbnails_exports.Common.getArrayMax(options.heights) || 0
|
41
|
+
});
|
42
|
+
const exportsBuffers = [{
|
43
|
+
buffer: imageBuffer,
|
44
|
+
name: generateFileName({
|
45
|
+
...imageBufferMetadata,
|
46
|
+
quality: 100,
|
47
|
+
suffix: "original",
|
48
|
+
preffix: options.name
|
49
|
+
})
|
50
|
+
}];
|
51
|
+
for await (const width of options.widths) {
|
52
|
+
for await (const height of options.heights) {
|
53
|
+
for await (const quality of options.qualities) {
|
54
|
+
for await (const format of options.formats) {
|
55
|
+
const exportBuffer = await prepareExport(transformedBuffer, {
|
56
|
+
format,
|
57
|
+
quality,
|
58
|
+
width,
|
59
|
+
height
|
60
|
+
});
|
61
|
+
exportsBuffers.push({
|
62
|
+
buffer: exportBuffer,
|
63
|
+
name: generateFileName({ width, height, quality, format, preffix: options.name })
|
64
|
+
});
|
65
|
+
}
|
66
|
+
}
|
67
|
+
}
|
68
|
+
}
|
69
|
+
const zipBuffer = exportZipBuffer(exportsBuffers, generateZipName());
|
70
|
+
return zipBuffer;
|
71
|
+
}
|
72
|
+
function getOptions(imageBufferMetadata, options) {
|
73
|
+
return {
|
74
|
+
center: [0.5, 0.5],
|
75
|
+
qualities: [100],
|
76
|
+
inputOperations: [],
|
77
|
+
...options,
|
78
|
+
name: options?.name || "",
|
79
|
+
formats: [imageBufferMetadata.format, ...options?.formats ? options.formats : []],
|
80
|
+
ratios: [...options?.ratios ? options.ratios : []],
|
81
|
+
widths: [imageBufferMetadata.width, ...options?.widths ? options.widths : []],
|
82
|
+
heights: [imageBufferMetadata.height, ...options?.heights ? options.heights : []]
|
83
|
+
};
|
84
|
+
}
|
85
|
+
function generateZipName() {
|
86
|
+
const date = /* @__PURE__ */ new Date();
|
87
|
+
return `image-exports_${date.toLocaleDateString()}_${date.toLocaleTimeString()}_${date.getTime()}`.replace(/\/|:/g, "-").replace(/ /g, "").trim();
|
88
|
+
}
|
89
|
+
function generateFileName({ width, height, quality, format, suffix, preffix }) {
|
90
|
+
const _preffix = preffix ? `${preffix}_` : "image-formats_";
|
91
|
+
const _suffix = `${suffix ? `_${suffix}` : ""}.${format}`;
|
92
|
+
return `${_preffix}${width}${height}_Q${quality}${_suffix}`;
|
93
|
+
}
|
94
|
+
|
95
|
+
export {
|
96
|
+
MAX_NB_OUTPUTS,
|
97
|
+
OUTPUT_ZIP_FOLDER,
|
98
|
+
prepareImage,
|
99
|
+
prepare_exports
|
100
|
+
};
|