@awacloud/fw 0.1.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/CHANGELOG.md +79 -0
- package/LICENSE +176 -0
- package/NOTICE +12 -0
- package/README.md +355 -0
- package/dist/build/fw.core.pure.meta.json +29 -0
- package/dist/build/fw.core.pure.min.js +26 -0
- package/dist/build/fw.full.pure.meta.json +224 -0
- package/dist/build/fw.full.pure.min.js +60 -0
- package/dist/build/fw.minimal.pure.meta.json +21 -0
- package/dist/build/fw.minimal.pure.min.js +26 -0
- package/dist/build/fw.pack.compress-heavy.pure.meta.json +29 -0
- package/dist/build/fw.pack.compress-heavy.pure.min.js +8 -0
- package/dist/build/fw.pack.crypto-advanced.pure.meta.json +38 -0
- package/dist/build/fw.pack.crypto-advanced.pure.min.js +6 -0
- package/dist/build/fw.pack.crypto-basic.pure.meta.json +29 -0
- package/dist/build/fw.pack.crypto-basic.pure.min.js +6 -0
- package/dist/build/fw.pack.crypto-identity.pure.meta.json +29 -0
- package/dist/build/fw.pack.crypto-identity.pure.min.js +9 -0
- package/dist/build/fw.pack.realtime.pure.meta.json +21 -0
- package/dist/build/fw.pack.realtime.pure.min.js +6 -0
- package/dist/build/fw.pack.sensors.pure.meta.json +21 -0
- package/dist/build/fw.pack.sensors.pure.min.js +6 -0
- package/dist/build/fw.pack.structures-advanced.pure.meta.json +20 -0
- package/dist/build/fw.pack.structures-advanced.pure.min.js +6 -0
- package/dist/build/fw.pack.text-advanced.pure.meta.json +20 -0
- package/dist/build/fw.pack.text-advanced.pure.min.js +6 -0
- package/dist/build/fw.pwa.pure.meta.json +127 -0
- package/dist/build/fw.pwa.pure.min.js +55 -0
- package/dist/build/fw.site-interactive.pure.meta.json +81 -0
- package/dist/build/fw.site-interactive.pure.min.js +52 -0
- package/dist/build/fw.site.pure.meta.json +51 -0
- package/dist/build/fw.site.pure.min.js +35 -0
- package/dist/build/fw.spa.pure.meta.json +108 -0
- package/dist/build/fw.spa.pure.min.js +55 -0
- package/dist/build/io/compress/brotli_dict.bin +432 -0
- package/dist/build/sanity-base-classic.min.js +6 -0
- package/dist/build/sanity-community-classic.min.js +6 -0
- package/dist/build/sanity.min.js +6 -0
- package/dist/types/core/logger.d.ts +71 -0
- package/dist/types/core/logger.d.ts.map +1 -0
- package/dist/types/core/modules.d.ts +3962 -0
- package/dist/types/core/modules.d.ts.map +1 -0
- package/dist/types/core/readyState.d.ts +14 -0
- package/dist/types/core/readyState.d.ts.map +1 -0
- package/dist/types/core/runtime.d.ts +625 -0
- package/dist/types/core/runtime.d.ts.map +1 -0
- package/dist/types/core/worker-helper.d.ts +153 -0
- package/dist/types/core/worker-helper.d.ts.map +1 -0
- package/dist/types/crypto/cipher/aes.d.ts +55 -0
- package/dist/types/crypto/cipher/aes.d.ts.map +1 -0
- package/dist/types/crypto/cipher/chacha20.d.ts +33 -0
- package/dist/types/crypto/cipher/chacha20.d.ts.map +1 -0
- package/dist/types/crypto/hash/adf.d.ts +65 -0
- package/dist/types/crypto/hash/adf.d.ts.map +1 -0
- package/dist/types/crypto/hash/argon2.d.ts +79 -0
- package/dist/types/crypto/hash/argon2.d.ts.map +1 -0
- package/dist/types/crypto/hash/blake2b.d.ts +40 -0
- package/dist/types/crypto/hash/blake2b.d.ts.map +1 -0
- package/dist/types/crypto/hash/hkdf.d.ts +88 -0
- package/dist/types/crypto/hash/hkdf.d.ts.map +1 -0
- package/dist/types/crypto/hash/hmac.d.ts +85 -0
- package/dist/types/crypto/hash/hmac.d.ts.map +1 -0
- package/dist/types/crypto/hash/pbkdf2.d.ts +80 -0
- package/dist/types/crypto/hash/pbkdf2.d.ts.map +1 -0
- package/dist/types/crypto/hash/poly1305.d.ts +31 -0
- package/dist/types/crypto/hash/poly1305.d.ts.map +1 -0
- package/dist/types/crypto/hash/sha224.d.ts +80 -0
- package/dist/types/crypto/hash/sha224.d.ts.map +1 -0
- package/dist/types/crypto/hash/sha256.d.ts +82 -0
- package/dist/types/crypto/hash/sha256.d.ts.map +1 -0
- package/dist/types/crypto/hash/sha3.d.ts +111 -0
- package/dist/types/crypto/hash/sha3.d.ts.map +1 -0
- package/dist/types/crypto/hash/sha384.d.ts +84 -0
- package/dist/types/crypto/hash/sha384.d.ts.map +1 -0
- package/dist/types/crypto/hash/sha512.d.ts +87 -0
- package/dist/types/crypto/hash/sha512.d.ts.map +1 -0
- package/dist/types/crypto/hash/sha512_224.d.ts +84 -0
- package/dist/types/crypto/hash/sha512_224.d.ts.map +1 -0
- package/dist/types/crypto/hash/sha512_256.d.ts +84 -0
- package/dist/types/crypto/hash/sha512_256.d.ts.map +1 -0
- package/dist/types/crypto/mode/cbc.d.ts +38 -0
- package/dist/types/crypto/mode/cbc.d.ts.map +1 -0
- package/dist/types/crypto/mode/chacha20poly1305.d.ts +71 -0
- package/dist/types/crypto/mode/chacha20poly1305.d.ts.map +1 -0
- package/dist/types/crypto/mode/cmac.d.ts +56 -0
- package/dist/types/crypto/mode/cmac.d.ts.map +1 -0
- package/dist/types/crypto/mode/ctr.d.ts +52 -0
- package/dist/types/crypto/mode/ctr.d.ts.map +1 -0
- package/dist/types/crypto/mode/gcm.d.ts +88 -0
- package/dist/types/crypto/mode/gcm.d.ts.map +1 -0
- package/dist/types/crypto/mode/kw.d.ts +60 -0
- package/dist/types/crypto/mode/kw.d.ts.map +1 -0
- package/dist/types/crypto/pkc/ecc.d.ts +284 -0
- package/dist/types/crypto/pkc/ecc.d.ts.map +1 -0
- package/dist/types/crypto/pkc/ed25519.d.ts +107 -0
- package/dist/types/crypto/pkc/ed25519.d.ts.map +1 -0
- package/dist/types/crypto/pkc/hybridKem.d.ts +154 -0
- package/dist/types/crypto/pkc/hybridKem.d.ts.map +1 -0
- package/dist/types/crypto/pkc/hybridSign.d.ts +383 -0
- package/dist/types/crypto/pkc/hybridSign.d.ts.map +1 -0
- package/dist/types/crypto/pkc/ml_dsa.d.ts +174 -0
- package/dist/types/crypto/pkc/ml_dsa.d.ts.map +1 -0
- package/dist/types/crypto/pkc/ml_kem.d.ts +194 -0
- package/dist/types/crypto/pkc/ml_kem.d.ts.map +1 -0
- package/dist/types/crypto/pkc/rsa.d.ts +175 -0
- package/dist/types/crypto/pkc/rsa.d.ts.map +1 -0
- package/dist/types/crypto/pkc/slh_dsa.d.ts +232 -0
- package/dist/types/crypto/pkc/slh_dsa.d.ts.map +1 -0
- package/dist/types/crypto/pkc/x25519.d.ts +37 -0
- package/dist/types/crypto/pkc/x25519.d.ts.map +1 -0
- package/dist/types/crypto/utils/aes_ctr.d.ts +84 -0
- package/dist/types/crypto/utils/aes_ctr.d.ts.map +1 -0
- package/dist/types/crypto/utils/aes_modes.d.ts +128 -0
- package/dist/types/crypto/utils/aes_modes.d.ts.map +1 -0
- package/dist/types/crypto/utils/asn1-oid.d.ts +45 -0
- package/dist/types/crypto/utils/asn1-oid.d.ts.map +1 -0
- package/dist/types/crypto/utils/asn1.d.ts +115 -0
- package/dist/types/crypto/utils/asn1.d.ts.map +1 -0
- package/dist/types/crypto/utils/bitArray.d.ts +75 -0
- package/dist/types/crypto/utils/bitArray.d.ts.map +1 -0
- package/dist/types/crypto/utils/bn.d.ts +214 -0
- package/dist/types/crypto/utils/bn.d.ts.map +1 -0
- package/dist/types/crypto/utils/jws.d.ts +159 -0
- package/dist/types/crypto/utils/jws.d.ts.map +1 -0
- package/dist/types/crypto/utils/keyformat.d.ts +100 -0
- package/dist/types/crypto/utils/keyformat.d.ts.map +1 -0
- package/dist/types/crypto/utils/pad.d.ts +44 -0
- package/dist/types/crypto/utils/pad.d.ts.map +1 -0
- package/dist/types/crypto/utils/pem.d.ts +41 -0
- package/dist/types/crypto/utils/pem.d.ts.map +1 -0
- package/dist/types/crypto/utils/random.d.ts +203 -0
- package/dist/types/crypto/utils/random.d.ts.map +1 -0
- package/dist/types/crypto/utils/rsaKeygen.d.ts +162 -0
- package/dist/types/crypto/utils/rsaKeygen.d.ts.map +1 -0
- package/dist/types/crypto/utils/totp.d.ts +183 -0
- package/dist/types/crypto/utils/totp.d.ts.map +1 -0
- package/dist/types/crypto/utils/uuid.d.ts +29 -0
- package/dist/types/crypto/utils/uuid.d.ts.map +1 -0
- package/dist/types/crypto/wasm/aes.d.ts +59 -0
- package/dist/types/crypto/wasm/aes.d.ts.map +1 -0
- package/dist/types/crypto/wasm/argon2.d.ts +70 -0
- package/dist/types/crypto/wasm/argon2.d.ts.map +1 -0
- package/dist/types/crypto/wasm/blake2b.d.ts +59 -0
- package/dist/types/crypto/wasm/blake2b.d.ts.map +1 -0
- package/dist/types/crypto/wasm/chacha20poly1305.d.ts +43 -0
- package/dist/types/crypto/wasm/chacha20poly1305.d.ts.map +1 -0
- package/dist/types/crypto/wasm/cmac.d.ts +42 -0
- package/dist/types/crypto/wasm/cmac.d.ts.map +1 -0
- package/dist/types/crypto/wasm/ecc.d.ts +56 -0
- package/dist/types/crypto/wasm/ecc.d.ts.map +1 -0
- package/dist/types/crypto/wasm/ed25519.d.ts +52 -0
- package/dist/types/crypto/wasm/ed25519.d.ts.map +1 -0
- package/dist/types/crypto/wasm/hkdf.d.ts +40 -0
- package/dist/types/crypto/wasm/hkdf.d.ts.map +1 -0
- package/dist/types/crypto/wasm/hmac.d.ts +42 -0
- package/dist/types/crypto/wasm/hmac.d.ts.map +1 -0
- package/dist/types/crypto/wasm/ml_dsa.d.ts +48 -0
- package/dist/types/crypto/wasm/ml_dsa.d.ts.map +1 -0
- package/dist/types/crypto/wasm/ml_kem.d.ts +58 -0
- package/dist/types/crypto/wasm/ml_kem.d.ts.map +1 -0
- package/dist/types/crypto/wasm/pbkdf2.d.ts +38 -0
- package/dist/types/crypto/wasm/pbkdf2.d.ts.map +1 -0
- package/dist/types/crypto/wasm/rsa.d.ts +56 -0
- package/dist/types/crypto/wasm/rsa.d.ts.map +1 -0
- package/dist/types/crypto/wasm/runtime.d.ts +99 -0
- package/dist/types/crypto/wasm/runtime.d.ts.map +1 -0
- package/dist/types/crypto/wasm/sha2.d.ts +45 -0
- package/dist/types/crypto/wasm/sha2.d.ts.map +1 -0
- package/dist/types/crypto/wasm/sha3.d.ts +57 -0
- package/dist/types/crypto/wasm/sha3.d.ts.map +1 -0
- package/dist/types/crypto/wasm/slh_dsa.d.ts +62 -0
- package/dist/types/crypto/wasm/slh_dsa.d.ts.map +1 -0
- package/dist/types/crypto/wasm/x25519.d.ts +53 -0
- package/dist/types/crypto/wasm/x25519.d.ts.map +1 -0
- package/dist/types/crypto/webcrypto/aes.d.ts +59 -0
- package/dist/types/crypto/webcrypto/aes.d.ts.map +1 -0
- package/dist/types/crypto/webcrypto/aeskw.d.ts +40 -0
- package/dist/types/crypto/webcrypto/aeskw.d.ts.map +1 -0
- package/dist/types/crypto/webcrypto/digest.d.ts +43 -0
- package/dist/types/crypto/webcrypto/digest.d.ts.map +1 -0
- package/dist/types/crypto/webcrypto/ecc.d.ts +51 -0
- package/dist/types/crypto/webcrypto/ecc.d.ts.map +1 -0
- package/dist/types/crypto/webcrypto/ed25519.d.ts +43 -0
- package/dist/types/crypto/webcrypto/ed25519.d.ts.map +1 -0
- package/dist/types/crypto/webcrypto/hkdf.d.ts +18 -0
- package/dist/types/crypto/webcrypto/hkdf.d.ts.map +1 -0
- package/dist/types/crypto/webcrypto/hmac.d.ts +43 -0
- package/dist/types/crypto/webcrypto/hmac.d.ts.map +1 -0
- package/dist/types/crypto/webcrypto/pbkdf2.d.ts +18 -0
- package/dist/types/crypto/webcrypto/pbkdf2.d.ts.map +1 -0
- package/dist/types/crypto/webcrypto/rsa.d.ts +51 -0
- package/dist/types/crypto/webcrypto/rsa.d.ts.map +1 -0
- package/dist/types/crypto/webcrypto/x25519.d.ts +43 -0
- package/dist/types/crypto/webcrypto/x25519.d.ts.map +1 -0
- package/dist/types/dom/display/animate.d.ts +35 -0
- package/dist/types/dom/display/animate.d.ts.map +1 -0
- package/dist/types/dom/display/fullscreen.d.ts +59 -0
- package/dist/types/dom/display/fullscreen.d.ts.map +1 -0
- package/dist/types/dom/fs/download.d.ts +36 -0
- package/dist/types/dom/fs/download.d.ts.map +1 -0
- package/dist/types/dom/fs/fsAccess.d.ts +107 -0
- package/dist/types/dom/fs/fsAccess.d.ts.map +1 -0
- package/dist/types/dom/fs/indexedDB.d.ts +62 -0
- package/dist/types/dom/fs/indexedDB.d.ts.map +1 -0
- package/dist/types/dom/fs/remoteStore.d.ts +64 -0
- package/dist/types/dom/fs/remoteStore.d.ts.map +1 -0
- package/dist/types/dom/fs/storage.d.ts +56 -0
- package/dist/types/dom/fs/storage.d.ts.map +1 -0
- package/dist/types/dom/lifecycle/idle.d.ts +91 -0
- package/dist/types/dom/lifecycle/idle.d.ts.map +1 -0
- package/dist/types/dom/lifecycle/visibility.d.ts +49 -0
- package/dist/types/dom/lifecycle/visibility.d.ts.map +1 -0
- package/dist/types/dom/lifecycle/wakeLock.d.ts +69 -0
- package/dist/types/dom/lifecycle/wakeLock.d.ts.map +1 -0
- package/dist/types/dom/net/ajax.d.ts +27 -0
- package/dist/types/dom/net/ajax.d.ts.map +1 -0
- package/dist/types/dom/net/broadcastChannel.d.ts +51 -0
- package/dist/types/dom/net/broadcastChannel.d.ts.map +1 -0
- package/dist/types/dom/net/network.d.ts +80 -0
- package/dist/types/dom/net/network.d.ts.map +1 -0
- package/dist/types/dom/net/sse.d.ts +72 -0
- package/dist/types/dom/net/sse.d.ts.map +1 -0
- package/dist/types/dom/net/webrtc.d.ts +149 -0
- package/dist/types/dom/net/webrtc.d.ts.map +1 -0
- package/dist/types/dom/net/ws.d.ts +70 -0
- package/dist/types/dom/net/ws.d.ts.map +1 -0
- package/dist/types/dom/query/dnd.d.ts +86 -0
- package/dist/types/dom/query/dnd.d.ts.map +1 -0
- package/dist/types/dom/query/dom.d.ts +194 -0
- package/dist/types/dom/query/dom.d.ts.map +1 -0
- package/dist/types/dom/query/events.d.ts +135 -0
- package/dist/types/dom/query/events.d.ts.map +1 -0
- package/dist/types/dom/query/gesture.d.ts +59 -0
- package/dist/types/dom/query/gesture.d.ts.map +1 -0
- package/dist/types/dom/query/media.d.ts +156 -0
- package/dist/types/dom/query/media.d.ts.map +1 -0
- package/dist/types/dom/rendering/chart.d.ts +143 -0
- package/dist/types/dom/rendering/chart.d.ts.map +1 -0
- package/dist/types/dom/rendering/component.d.ts +92 -0
- package/dist/types/dom/rendering/component.d.ts.map +1 -0
- package/dist/types/dom/rendering/devtools-ui.d.ts +83 -0
- package/dist/types/dom/rendering/devtools-ui.d.ts.map +1 -0
- package/dist/types/dom/rendering/devtools.d.ts +68 -0
- package/dist/types/dom/rendering/devtools.d.ts.map +1 -0
- package/dist/types/dom/rendering/parser.d.ts +216 -0
- package/dist/types/dom/rendering/parser.d.ts.map +1 -0
- package/dist/types/dom/rendering/reactiveBind.d.ts +101 -0
- package/dist/types/dom/rendering/reactiveBind.d.ts.map +1 -0
- package/dist/types/dom/rendering/render.d.ts +121 -0
- package/dist/types/dom/rendering/render.d.ts.map +1 -0
- package/dist/types/dom/rendering/sanitize.d.ts +48 -0
- package/dist/types/dom/rendering/sanitize.d.ts.map +1 -0
- package/dist/types/dom/rendering/secPolicy.d.ts +89 -0
- package/dist/types/dom/rendering/secPolicy.d.ts.map +1 -0
- package/dist/types/dom/rendering/template.d.ts +251 -0
- package/dist/types/dom/rendering/template.d.ts.map +1 -0
- package/dist/types/dom/rendering/themeTokens.d.ts +61 -0
- package/dist/types/dom/rendering/themeTokens.d.ts.map +1 -0
- package/dist/types/dom/rendering/uiSession-core.d.ts +192 -0
- package/dist/types/dom/rendering/uiSession-core.d.ts.map +1 -0
- package/dist/types/dom/rendering/uiSession-direct.d.ts +63 -0
- package/dist/types/dom/rendering/uiSession-direct.d.ts.map +1 -0
- package/dist/types/dom/rendering/uiSession-list.d.ts +205 -0
- package/dist/types/dom/rendering/uiSession-list.d.ts.map +1 -0
- package/dist/types/dom/rendering/uiSession.d.ts +285 -0
- package/dist/types/dom/rendering/uiSession.d.ts.map +1 -0
- package/dist/types/dom/rendering/virtualScroll.d.ts +80 -0
- package/dist/types/dom/rendering/virtualScroll.d.ts.map +1 -0
- package/dist/types/dom/sensors/battery.d.ts +71 -0
- package/dist/types/dom/sensors/battery.d.ts.map +1 -0
- package/dist/types/dom/sensors/geolocation.d.ts +83 -0
- package/dist/types/dom/sensors/geolocation.d.ts.map +1 -0
- package/dist/types/dom/sensors/networkInfo.d.ts +82 -0
- package/dist/types/dom/sensors/networkInfo.d.ts.map +1 -0
- package/dist/types/dom/sensors/sensors.d.ts +191 -0
- package/dist/types/dom/sensors/sensors.d.ts.map +1 -0
- package/dist/types/dom/sw/backgroundSync.d.ts +48 -0
- package/dist/types/dom/sw/backgroundSync.d.ts.map +1 -0
- package/dist/types/dom/sw/cache.d.ts +71 -0
- package/dist/types/dom/sw/cache.d.ts.map +1 -0
- package/dist/types/dom/sw/push.d.ts +77 -0
- package/dist/types/dom/sw/push.d.ts.map +1 -0
- package/dist/types/dom/sw/serviceWorker.d.ts +57 -0
- package/dist/types/dom/sw/serviceWorker.d.ts.map +1 -0
- package/dist/types/dom/sw/sharedWorker.d.ts +81 -0
- package/dist/types/dom/sw/sharedWorker.d.ts.map +1 -0
- package/dist/types/dom/utils/a11y.d.ts +53 -0
- package/dist/types/dom/utils/a11y.d.ts.map +1 -0
- package/dist/types/dom/utils/clipboard.d.ts +44 -0
- package/dist/types/dom/utils/clipboard.d.ts.map +1 -0
- package/dist/types/dom/utils/entropyCollector.d.ts +58 -0
- package/dist/types/dom/utils/entropyCollector.d.ts.map +1 -0
- package/dist/types/dom/utils/focus.d.ts +123 -0
- package/dist/types/dom/utils/focus.d.ts.map +1 -0
- package/dist/types/dom/utils/form.d.ts +227 -0
- package/dist/types/dom/utils/form.d.ts.map +1 -0
- package/dist/types/dom/utils/formKit.d.ts +206 -0
- package/dist/types/dom/utils/formKit.d.ts.map +1 -0
- package/dist/types/dom/utils/keybindings.d.ts +53 -0
- package/dist/types/dom/utils/keybindings.d.ts.map +1 -0
- package/dist/types/dom/utils/leaderElection.d.ts +70 -0
- package/dist/types/dom/utils/leaderElection.d.ts.map +1 -0
- package/dist/types/dom/utils/notifications.d.ts +164 -0
- package/dist/types/dom/utils/notifications.d.ts.map +1 -0
- package/dist/types/dom/utils/permissions.d.ts +35 -0
- package/dist/types/dom/utils/permissions.d.ts.map +1 -0
- package/dist/types/dom/utils/route.d.ts +117 -0
- package/dist/types/dom/utils/route.d.ts.map +1 -0
- package/dist/types/dom/utils/ua.d.ts +35 -0
- package/dist/types/dom/utils/ua.d.ts.map +1 -0
- package/dist/types/dom/utils/webauthn.d.ts +98 -0
- package/dist/types/dom/utils/webauthn.d.ts.map +1 -0
- package/dist/types/io/binary/reader.d.ts +59 -0
- package/dist/types/io/binary/reader.d.ts.map +1 -0
- package/dist/types/io/binary/writer.d.ts +56 -0
- package/dist/types/io/binary/writer.d.ts.map +1 -0
- package/dist/types/io/calc/adler32.d.ts +31 -0
- package/dist/types/io/calc/adler32.d.ts.map +1 -0
- package/dist/types/io/calc/bigint.d.ts +74 -0
- package/dist/types/io/calc/bigint.d.ts.map +1 -0
- package/dist/types/io/calc/crc32.d.ts +36 -0
- package/dist/types/io/calc/crc32.d.ts.map +1 -0
- package/dist/types/io/calc/easing.d.ts +60 -0
- package/dist/types/io/calc/easing.d.ts.map +1 -0
- package/dist/types/io/codec/b64.d.ts +28 -0
- package/dist/types/io/codec/b64.d.ts.map +1 -0
- package/dist/types/io/codec/base32.d.ts +28 -0
- package/dist/types/io/codec/base32.d.ts.map +1 -0
- package/dist/types/io/codec/base58.d.ts +28 -0
- package/dist/types/io/codec/base58.d.ts.map +1 -0
- package/dist/types/io/codec/buffer.d.ts +66 -0
- package/dist/types/io/codec/buffer.d.ts.map +1 -0
- package/dist/types/io/codec/cbor.d.ts +43 -0
- package/dist/types/io/codec/cbor.d.ts.map +1 -0
- package/dist/types/io/codec/csv.d.ts +35 -0
- package/dist/types/io/codec/csv.d.ts.map +1 -0
- package/dist/types/io/codec/hex.d.ts +28 -0
- package/dist/types/io/codec/hex.d.ts.map +1 -0
- package/dist/types/io/codec/mime.d.ts +100 -0
- package/dist/types/io/codec/mime.d.ts.map +1 -0
- package/dist/types/io/codec/msgpack.d.ts +36 -0
- package/dist/types/io/codec/msgpack.d.ts.map +1 -0
- package/dist/types/io/codec/url.d.ts +52 -0
- package/dist/types/io/codec/url.d.ts.map +1 -0
- package/dist/types/io/codec/utf8.d.ts +22 -0
- package/dist/types/io/codec/utf8.d.ts.map +1 -0
- package/dist/types/io/codec/xml.d.ts +91 -0
- package/dist/types/io/codec/xml.d.ts.map +1 -0
- package/dist/types/io/compress/bitstream.d.ts +51 -0
- package/dist/types/io/compress/bitstream.d.ts.map +1 -0
- package/dist/types/io/compress/brotli.d.ts +86 -0
- package/dist/types/io/compress/brotli.d.ts.map +1 -0
- package/dist/types/io/compress/brotli_dict.d.ts +76 -0
- package/dist/types/io/compress/brotli_dict.d.ts.map +1 -0
- package/dist/types/io/compress/brotli_dict_words.d.ts +43 -0
- package/dist/types/io/compress/brotli_dict_words.d.ts.map +1 -0
- package/dist/types/io/compress/brotli_frame.d.ts +166 -0
- package/dist/types/io/compress/brotli_frame.d.ts.map +1 -0
- package/dist/types/io/compress/brotli_shared.d.ts +165 -0
- package/dist/types/io/compress/brotli_shared.d.ts.map +1 -0
- package/dist/types/io/compress/deflate.d.ts +89 -0
- package/dist/types/io/compress/deflate.d.ts.map +1 -0
- package/dist/types/io/compress/gzip.d.ts +100 -0
- package/dist/types/io/compress/gzip.d.ts.map +1 -0
- package/dist/types/io/compress/huffman.d.ts +37 -0
- package/dist/types/io/compress/huffman.d.ts.map +1 -0
- package/dist/types/io/compress/lz4.d.ts +45 -0
- package/dist/types/io/compress/lz4.d.ts.map +1 -0
- package/dist/types/io/compress/lz77.d.ts +66 -0
- package/dist/types/io/compress/lz77.d.ts.map +1 -0
- package/dist/types/io/compress/lzw.d.ts +37 -0
- package/dist/types/io/compress/lzw.d.ts.map +1 -0
- package/dist/types/io/compress/zip.d.ts +112 -0
- package/dist/types/io/compress/zip.d.ts.map +1 -0
- package/dist/types/io/compress/zlib.d.ts +97 -0
- package/dist/types/io/compress/zlib.d.ts.map +1 -0
- package/dist/types/io/i18n/i18n.d.ts +64 -0
- package/dist/types/io/i18n/i18n.d.ts.map +1 -0
- package/dist/types/io/math/fixed-point.d.ts +30 -0
- package/dist/types/io/math/fixed-point.d.ts.map +1 -0
- package/dist/types/io/math/geom.d.ts +125 -0
- package/dist/types/io/math/geom.d.ts.map +1 -0
- package/dist/types/io/math/interp.d.ts +48 -0
- package/dist/types/io/math/interp.d.ts.map +1 -0
- package/dist/types/io/math/linalg.d.ts +117 -0
- package/dist/types/io/math/linalg.d.ts.map +1 -0
- package/dist/types/io/math/stats.d.ts +45 -0
- package/dist/types/io/math/stats.d.ts.map +1 -0
- package/dist/types/io/structures/btree.d.ts +84 -0
- package/dist/types/io/structures/btree.d.ts.map +1 -0
- package/dist/types/io/structures/heap.d.ts +75 -0
- package/dist/types/io/structures/heap.d.ts.map +1 -0
- package/dist/types/io/structures/lruCache.d.ts +88 -0
- package/dist/types/io/structures/lruCache.d.ts.map +1 -0
- package/dist/types/io/structures/ringBuffer.d.ts +82 -0
- package/dist/types/io/structures/ringBuffer.d.ts.map +1 -0
- package/dist/types/io/structures/tree-walker.d.ts +95 -0
- package/dist/types/io/structures/tree-walker.d.ts.map +1 -0
- package/dist/types/io/structures/trie.d.ts +71 -0
- package/dist/types/io/structures/trie.d.ts.map +1 -0
- package/dist/types/io/sync/abort.d.ts +59 -0
- package/dist/types/io/sync/abort.d.ts.map +1 -0
- package/dist/types/io/sync/atomics.d.ts +107 -0
- package/dist/types/io/sync/atomics.d.ts.map +1 -0
- package/dist/types/io/sync/cancellable.d.ts +69 -0
- package/dist/types/io/sync/cancellable.d.ts.map +1 -0
- package/dist/types/io/sync/channel.d.ts +70 -0
- package/dist/types/io/sync/channel.d.ts.map +1 -0
- package/dist/types/io/sync/mutex.d.ts +39 -0
- package/dist/types/io/sync/mutex.d.ts.map +1 -0
- package/dist/types/io/sync/semaphore.d.ts +40 -0
- package/dist/types/io/sync/semaphore.d.ts.map +1 -0
- package/dist/types/io/sync/tokenBucket.d.ts +53 -0
- package/dist/types/io/sync/tokenBucket.d.ts.map +1 -0
- package/dist/types/io/text/ansi.d.ts +125 -0
- package/dist/types/io/text/ansi.d.ts.map +1 -0
- package/dist/types/io/text/html-entities.d.ts +35 -0
- package/dist/types/io/text/html-entities.d.ts.map +1 -0
- package/dist/types/io/text/semver.d.ts +75 -0
- package/dist/types/io/text/semver.d.ts.map +1 -0
- package/dist/types/io/text/str.d.ts +88 -0
- package/dist/types/io/text/str.d.ts.map +1 -0
- package/dist/types/io/text/unicode.d.ts +70 -0
- package/dist/types/io/text/unicode.d.ts.map +1 -0
- package/dist/types/io/time/date.d.ts +73 -0
- package/dist/types/io/time/date.d.ts.map +1 -0
- package/dist/types/io/timing/clock.d.ts +39 -0
- package/dist/types/io/timing/clock.d.ts.map +1 -0
- package/dist/types/io/timing/rateLimit.d.ts +40 -0
- package/dist/types/io/timing/rateLimit.d.ts.map +1 -0
- package/dist/types/io/timing/scheduler.d.ts +122 -0
- package/dist/types/io/timing/scheduler.d.ts.map +1 -0
- package/dist/types/io/utils/bitmap.d.ts +34 -0
- package/dist/types/io/utils/bitmap.d.ts.map +1 -0
- package/dist/types/io/utils/errors.d.ts +94 -0
- package/dist/types/io/utils/errors.d.ts.map +1 -0
- package/dist/types/io/utils/eventBus.d.ts +68 -0
- package/dist/types/io/utils/eventBus.d.ts.map +1 -0
- package/dist/types/io/utils/queue.d.ts +69 -0
- package/dist/types/io/utils/queue.d.ts.map +1 -0
- package/dist/types/io/utils/signal.d.ts +362 -0
- package/dist/types/io/utils/signal.d.ts.map +1 -0
- package/dist/types/io/utils/ui8.d.ts +34 -0
- package/dist/types/io/utils/ui8.d.ts.map +1 -0
- package/dist/types/io/utils/valid.d.ts +130 -0
- package/dist/types/io/utils/valid.d.ts.map +1 -0
- package/dist/types/main.d.ts +25 -0
- package/dist/types/main.d.ts.map +1 -0
- package/dist/types/process/message.d.ts +64 -0
- package/dist/types/process/message.d.ts.map +1 -0
- package/dist/types/process/rpc.d.ts +35 -0
- package/dist/types/process/rpc.d.ts.map +1 -0
- package/dist/types/process/workerPool.d.ts +62 -0
- package/dist/types/process/workerPool.d.ts.map +1 -0
- package/dist/types/sanity/base.d.ts +28 -0
- package/dist/types/sanity/base.d.ts.map +1 -0
- package/dist/types/sanity/community.d.ts +20 -0
- package/dist/types/sanity/community.d.ts.map +1 -0
- package/dist/types/sanity/lockdown-apply.d.ts +7 -0
- package/dist/types/sanity/lockdown-apply.d.ts.map +1 -0
- package/dist/types/sanity/lockdown.d.ts +43 -0
- package/dist/types/sanity/lockdown.d.ts.map +1 -0
- package/dist/types/sanity/wasm-gate.d.ts +128 -0
- package/dist/types/sanity/wasm-gate.d.ts.map +1 -0
- package/docs/README.md +301 -0
- package/docs/api/README.md +33 -0
- package/docs/api/core/README.md +14 -0
- package/docs/api/core/logger.md +151 -0
- package/docs/api/core/main.md +105 -0
- package/docs/api/core/modules.md +123 -0
- package/docs/api/core/readyState.md +94 -0
- package/docs/api/core/runtime.md +499 -0
- package/docs/api/core/worker-helper.md +180 -0
- package/docs/api/crypto/README.md +39 -0
- package/docs/api/crypto/cipher/README.md +24 -0
- package/docs/api/crypto/cipher/aes.md +101 -0
- package/docs/api/crypto/cipher/chacha20.md +85 -0
- package/docs/api/crypto/hash/README.md +49 -0
- package/docs/api/crypto/hash/adf.md +61 -0
- package/docs/api/crypto/hash/argon2.md +92 -0
- package/docs/api/crypto/hash/blake2b.md +88 -0
- package/docs/api/crypto/hash/hkdf.md +82 -0
- package/docs/api/crypto/hash/hmac.md +90 -0
- package/docs/api/crypto/hash/pbkdf2.md +93 -0
- package/docs/api/crypto/hash/poly1305.md +71 -0
- package/docs/api/crypto/hash/sha224.md +61 -0
- package/docs/api/crypto/hash/sha256.md +84 -0
- package/docs/api/crypto/hash/sha3.md +89 -0
- package/docs/api/crypto/hash/sha384.md +58 -0
- package/docs/api/crypto/hash/sha512.md +73 -0
- package/docs/api/crypto/hash/sha512_224.md +59 -0
- package/docs/api/crypto/hash/sha512_256.md +58 -0
- package/docs/api/crypto/mode/README.md +33 -0
- package/docs/api/crypto/mode/cbc.md +69 -0
- package/docs/api/crypto/mode/chacha20poly1305.md +77 -0
- package/docs/api/crypto/mode/cmac.md +79 -0
- package/docs/api/crypto/mode/ctr.md +66 -0
- package/docs/api/crypto/mode/gcm.md +93 -0
- package/docs/api/crypto/mode/kw.md +84 -0
- package/docs/api/crypto/pkc/README.md +48 -0
- package/docs/api/crypto/pkc/ecc.md +91 -0
- package/docs/api/crypto/pkc/ed25519.md +99 -0
- package/docs/api/crypto/pkc/hybridKem.md +178 -0
- package/docs/api/crypto/pkc/hybridSign.md +192 -0
- package/docs/api/crypto/pkc/ml_dsa.md +99 -0
- package/docs/api/crypto/pkc/ml_kem.md +90 -0
- package/docs/api/crypto/pkc/rsa.md +87 -0
- package/docs/api/crypto/pkc/slh_dsa.md +86 -0
- package/docs/api/crypto/pkc/x25519.md +84 -0
- package/docs/api/crypto/utils/README.md +39 -0
- package/docs/api/crypto/utils/aes_ctr.md +71 -0
- package/docs/api/crypto/utils/aes_modes.md +81 -0
- package/docs/api/crypto/utils/asn1-oid.md +130 -0
- package/docs/api/crypto/utils/asn1.md +69 -0
- package/docs/api/crypto/utils/bitArray.md +77 -0
- package/docs/api/crypto/utils/bn.md +67 -0
- package/docs/api/crypto/utils/jws.md +94 -0
- package/docs/api/crypto/utils/keyformat.md +78 -0
- package/docs/api/crypto/utils/pad.md +66 -0
- package/docs/api/crypto/utils/pem.md +63 -0
- package/docs/api/crypto/utils/random.md +103 -0
- package/docs/api/crypto/utils/rsaKeygen.md +118 -0
- package/docs/api/crypto/utils/totp.md +159 -0
- package/docs/api/crypto/utils/uuid.md +98 -0
- package/docs/api/crypto/wasm/README.md +76 -0
- package/docs/api/crypto/wasm/aes.md +128 -0
- package/docs/api/crypto/wasm/argon2.md +110 -0
- package/docs/api/crypto/wasm/blake2b.md +103 -0
- package/docs/api/crypto/wasm/chacha20poly1305.md +120 -0
- package/docs/api/crypto/wasm/cmac.md +119 -0
- package/docs/api/crypto/wasm/ecc.md +114 -0
- package/docs/api/crypto/wasm/ed25519.md +117 -0
- package/docs/api/crypto/wasm/hkdf.md +163 -0
- package/docs/api/crypto/wasm/hmac.md +129 -0
- package/docs/api/crypto/wasm/ml_dsa.md +99 -0
- package/docs/api/crypto/wasm/ml_kem.md +91 -0
- package/docs/api/crypto/wasm/pbkdf2.md +111 -0
- package/docs/api/crypto/wasm/rsa.md +113 -0
- package/docs/api/crypto/wasm/runtime.md +172 -0
- package/docs/api/crypto/wasm/sha2.md +95 -0
- package/docs/api/crypto/wasm/sha3.md +127 -0
- package/docs/api/crypto/wasm/slh_dsa.md +89 -0
- package/docs/api/crypto/wasm/x25519.md +116 -0
- package/docs/api/crypto/webcrypto/README.md +56 -0
- package/docs/api/crypto/webcrypto/aes.md +140 -0
- package/docs/api/crypto/webcrypto/aeskw.md +120 -0
- package/docs/api/crypto/webcrypto/digest.md +103 -0
- package/docs/api/crypto/webcrypto/ecc.md +122 -0
- package/docs/api/crypto/webcrypto/ed25519.md +121 -0
- package/docs/api/crypto/webcrypto/hkdf.md +141 -0
- package/docs/api/crypto/webcrypto/hmac.md +112 -0
- package/docs/api/crypto/webcrypto/pbkdf2.md +140 -0
- package/docs/api/crypto/webcrypto/rsa.md +149 -0
- package/docs/api/crypto/webcrypto/x25519.md +96 -0
- package/docs/api/dom/README.md +117 -0
- package/docs/api/dom/display/README.md +27 -0
- package/docs/api/dom/display/animate.md +113 -0
- package/docs/api/dom/display/fullscreen.md +121 -0
- package/docs/api/dom/fs/README.md +36 -0
- package/docs/api/dom/fs/download.md +108 -0
- package/docs/api/dom/fs/fsAccess.md +200 -0
- package/docs/api/dom/fs/indexedDB.md +219 -0
- package/docs/api/dom/fs/remoteStore.md +158 -0
- package/docs/api/dom/fs/storage.md +197 -0
- package/docs/api/dom/lifecycle/README.md +11 -0
- package/docs/api/dom/lifecycle/idle.md +89 -0
- package/docs/api/dom/lifecycle/visibility.md +73 -0
- package/docs/api/dom/lifecycle/wakeLock.md +94 -0
- package/docs/api/dom/net/README.md +31 -0
- package/docs/api/dom/net/ajax.md +176 -0
- package/docs/api/dom/net/broadcastChannel.md +110 -0
- package/docs/api/dom/net/network.md +137 -0
- package/docs/api/dom/net/sse.md +141 -0
- package/docs/api/dom/net/webrtc.md +158 -0
- package/docs/api/dom/net/ws.md +168 -0
- package/docs/api/dom/query/README.md +30 -0
- package/docs/api/dom/query/dnd.md +137 -0
- package/docs/api/dom/query/dom.md +275 -0
- package/docs/api/dom/query/events.md +211 -0
- package/docs/api/dom/query/gesture.md +137 -0
- package/docs/api/dom/query/media.md +188 -0
- package/docs/api/dom/rendering/README.md +41 -0
- package/docs/api/dom/rendering/chart.md +149 -0
- package/docs/api/dom/rendering/component.md +287 -0
- package/docs/api/dom/rendering/devtools-ui.md +129 -0
- package/docs/api/dom/rendering/devtools.md +157 -0
- package/docs/api/dom/rendering/parser.md +200 -0
- package/docs/api/dom/rendering/reactiveBind.md +234 -0
- package/docs/api/dom/rendering/render.md +219 -0
- package/docs/api/dom/rendering/sanitize.md +97 -0
- package/docs/api/dom/rendering/secPolicy.md +155 -0
- package/docs/api/dom/rendering/template.md +301 -0
- package/docs/api/dom/rendering/themeTokens.md +175 -0
- package/docs/api/dom/rendering/uiSession.md +546 -0
- package/docs/api/dom/rendering/virtualScroll.md +126 -0
- package/docs/api/dom/sensors/README.md +12 -0
- package/docs/api/dom/sensors/battery.md +70 -0
- package/docs/api/dom/sensors/geolocation.md +115 -0
- package/docs/api/dom/sensors/networkInfo.md +73 -0
- package/docs/api/dom/sensors/sensors.md +123 -0
- package/docs/api/dom/sw/README.md +31 -0
- package/docs/api/dom/sw/backgroundSync.md +145 -0
- package/docs/api/dom/sw/cache.md +116 -0
- package/docs/api/dom/sw/push.md +114 -0
- package/docs/api/dom/sw/serviceWorker.md +90 -0
- package/docs/api/dom/sw/sharedWorker.md +131 -0
- package/docs/api/dom/utils/README.md +25 -0
- package/docs/api/dom/utils/a11y.md +143 -0
- package/docs/api/dom/utils/clipboard.md +146 -0
- package/docs/api/dom/utils/entropyCollector.md +175 -0
- package/docs/api/dom/utils/focus.md +140 -0
- package/docs/api/dom/utils/form.md +196 -0
- package/docs/api/dom/utils/formKit.md +181 -0
- package/docs/api/dom/utils/keybindings.md +138 -0
- package/docs/api/dom/utils/leaderElection.md +130 -0
- package/docs/api/dom/utils/notifications.md +106 -0
- package/docs/api/dom/utils/permissions.md +82 -0
- package/docs/api/dom/utils/route.md +112 -0
- package/docs/api/dom/utils/ua.md +119 -0
- package/docs/api/dom/utils/webauthn.md +190 -0
- package/docs/api/io/README.md +20 -0
- package/docs/api/io/binary/README.md +29 -0
- package/docs/api/io/binary/reader.md +126 -0
- package/docs/api/io/binary/writer.md +127 -0
- package/docs/api/io/calc/README.md +22 -0
- package/docs/api/io/calc/adler32.md +75 -0
- package/docs/api/io/calc/bigint.md +105 -0
- package/docs/api/io/calc/crc32.md +74 -0
- package/docs/api/io/calc/easing.md +118 -0
- package/docs/api/io/codec/README.md +35 -0
- package/docs/api/io/codec/b64.md +92 -0
- package/docs/api/io/codec/base32.md +98 -0
- package/docs/api/io/codec/base58.md +104 -0
- package/docs/api/io/codec/buffer.md +144 -0
- package/docs/api/io/codec/cbor.md +179 -0
- package/docs/api/io/codec/csv.md +178 -0
- package/docs/api/io/codec/hex.md +75 -0
- package/docs/api/io/codec/mime.md +156 -0
- package/docs/api/io/codec/msgpack.md +142 -0
- package/docs/api/io/codec/url.md +265 -0
- package/docs/api/io/codec/utf8.md +84 -0
- package/docs/api/io/codec/xml.md +87 -0
- package/docs/api/io/compress/README.md +62 -0
- package/docs/api/io/compress/bitstream.md +131 -0
- package/docs/api/io/compress/brotli.md +232 -0
- package/docs/api/io/compress/brotli_dict.md +119 -0
- package/docs/api/io/compress/brotli_dict_words.md +142 -0
- package/docs/api/io/compress/brotli_frame.md +214 -0
- package/docs/api/io/compress/brotli_shared.md +144 -0
- package/docs/api/io/compress/deflate.md +474 -0
- package/docs/api/io/compress/gzip.md +130 -0
- package/docs/api/io/compress/huffman.md +210 -0
- package/docs/api/io/compress/lz4.md +278 -0
- package/docs/api/io/compress/lz77.md +180 -0
- package/docs/api/io/compress/lzw.md +121 -0
- package/docs/api/io/compress/zip.md +209 -0
- package/docs/api/io/compress/zlib.md +125 -0
- package/docs/api/io/i18n/README.md +23 -0
- package/docs/api/io/i18n/i18n.md +128 -0
- package/docs/api/io/math/README.md +24 -0
- package/docs/api/io/math/fixed-point.md +115 -0
- package/docs/api/io/math/geom.md +144 -0
- package/docs/api/io/math/interp.md +115 -0
- package/docs/api/io/math/linalg.md +138 -0
- package/docs/api/io/math/stats.md +109 -0
- package/docs/api/io/structures/README.md +31 -0
- package/docs/api/io/structures/btree.md +155 -0
- package/docs/api/io/structures/heap.md +166 -0
- package/docs/api/io/structures/lruCache.md +156 -0
- package/docs/api/io/structures/ringBuffer.md +188 -0
- package/docs/api/io/structures/tree-walker.md +132 -0
- package/docs/api/io/structures/trie.md +138 -0
- package/docs/api/io/sync/README.md +29 -0
- package/docs/api/io/sync/abort.md +129 -0
- package/docs/api/io/sync/atomics.md +159 -0
- package/docs/api/io/sync/cancellable.md +176 -0
- package/docs/api/io/sync/channel.md +125 -0
- package/docs/api/io/sync/mutex.md +93 -0
- package/docs/api/io/sync/semaphore.md +106 -0
- package/docs/api/io/sync/tokenBucket.md +139 -0
- package/docs/api/io/text/README.md +23 -0
- package/docs/api/io/text/ansi.md +182 -0
- package/docs/api/io/text/html-entities.md +79 -0
- package/docs/api/io/text/semver.md +158 -0
- package/docs/api/io/text/str.md +129 -0
- package/docs/api/io/text/unicode.md +89 -0
- package/docs/api/io/time/README.md +22 -0
- package/docs/api/io/time/date.md +128 -0
- package/docs/api/io/timing/README.md +32 -0
- package/docs/api/io/timing/clock.md +102 -0
- package/docs/api/io/timing/rateLimit.md +137 -0
- package/docs/api/io/timing/scheduler.md +163 -0
- package/docs/api/io/utils/README.md +30 -0
- package/docs/api/io/utils/bitmap.md +96 -0
- package/docs/api/io/utils/errors.md +165 -0
- package/docs/api/io/utils/eventBus.md +162 -0
- package/docs/api/io/utils/queue.md +141 -0
- package/docs/api/io/utils/signal.md +388 -0
- package/docs/api/io/utils/ui8.md +111 -0
- package/docs/api/io/utils/valid.md +272 -0
- package/docs/api/process/README.md +18 -0
- package/docs/api/process/message.md +166 -0
- package/docs/api/process/rpc.md +161 -0
- package/docs/api/process/workerPool.md +130 -0
- package/docs/api/sanity/base.md +132 -0
- package/docs/api/sanity/community.md +96 -0
- package/docs/api/sanity/lockdown.md +128 -0
- package/docs/api/typed.md +85 -0
- package/docs/dev/README.md +25 -0
- package/docs/dev/provenance.md +80 -0
- package/docs/dev/publishing.md +31 -0
- package/docs/dev/runtime.md +64 -0
- package/docs/dev/testing.md +61 -0
- package/docs/dev/types.md +35 -0
- package/docs/evidence/pqc-hybrid-evidence.md +438 -0
- package/docs/guide/README.md +38 -0
- package/docs/guide/_QUICK_REF.md +341 -0
- package/docs/guide/by-use-case.md +160 -0
- package/docs/guide/doc-format.md +306 -0
- package/docs/guide/gesture-dnd-side-channel.md +119 -0
- package/docs/guide/getting-started.md +134 -0
- package/docs/guide/hmr.md +187 -0
- package/docs/guide/integration-bundlers.md +193 -0
- package/docs/guide/integrations-hmr.md +103 -0
- package/docs/guide/module-creation-workflow.md +342 -0
- package/docs/guide/module-pattern.md +244 -0
- package/docs/guide/rendering-pipeline.md +422 -0
- package/docs/guide/security.md +346 -0
- package/docs/guide/test-format.md +190 -0
- package/docs/guide/tutorial-todo.md +298 -0
- package/docs/guide/typescript.md +215 -0
- package/docs/guide/worker-confinement.md +301 -0
- package/docs/guide/workers.md +168 -0
- package/docs/notes/lz77-deflate-factorization.md +96 -0
- package/docs/notes/worker-confinement-spike.md +302 -0
- package/docs/tools/README.md +56 -0
- package/docs/tools/aot.md +108 -0
- package/docs/tools/audit.md +61 -0
- package/docs/tools/bundler.md +215 -0
- package/docs/tools/codegen.md +64 -0
- package/docs/tools/jsx.md +236 -0
- package/docs/tools/precompilation.md +88 -0
- package/docs/tools/standalone.md +107 -0
- package/fw.config.json +129 -0
- package/integrations/README.md +52 -0
- package/integrations/_shared/catalog.generated.json +207 -0
- package/integrations/_shared/config-resolve.js +201 -0
- package/integrations/_shared/core.js +362 -0
- package/integrations/astro/README.md +96 -0
- package/integrations/astro/index.d.ts +42 -0
- package/integrations/astro/index.js +94 -0
- package/integrations/bun/README.md +62 -0
- package/integrations/bun/index.d.ts +30 -0
- package/integrations/bun/index.js +134 -0
- package/integrations/deno/README.md +55 -0
- package/integrations/deno/deno.json +10 -0
- package/integrations/esbuild/README.md +75 -0
- package/integrations/esbuild/backend.js +147 -0
- package/integrations/esbuild/index.d.ts +32 -0
- package/integrations/esbuild/index.js +147 -0
- package/integrations/eslint/README.md +27 -0
- package/integrations/eslint/no-factory-capture.js +99 -0
- package/integrations/jest/README.md +45 -0
- package/integrations/jest/bun-test-shim.js +43 -0
- package/integrations/nestjs/README.md +68 -0
- package/integrations/nestjs/index.d.ts +38 -0
- package/integrations/nestjs/index.js +99 -0
- package/integrations/nextjs/README.md +149 -0
- package/integrations/nextjs/index.d.ts +30 -0
- package/integrations/nextjs/index.js +98 -0
- package/integrations/nodejs/README.md +46 -0
- package/integrations/nodejs/package.node.example.json +31 -0
- package/integrations/rollup/README.md +65 -0
- package/integrations/rollup/backend.js +132 -0
- package/integrations/rollup/index.d.ts +32 -0
- package/integrations/rollup/index.js +84 -0
- package/integrations/turbopack/README.md +56 -0
- package/integrations/turbopack/index.d.ts +47 -0
- package/integrations/turbopack/index.js +164 -0
- package/integrations/typedoc/README.md +57 -0
- package/integrations/typedoc/categorize.js +121 -0
- package/integrations/typedoc/tsconfig.typedoc.json +14 -0
- package/integrations/typedoc/typedoc.json +19 -0
- package/integrations/vite/README.md +115 -0
- package/integrations/vite/index.d.ts +29 -0
- package/integrations/vite/index.js +182 -0
- package/integrations/vite/package.json +8 -0
- package/integrations/vite/vite-env.d.ts +36 -0
- package/integrations/vitest/README.md +77 -0
- package/integrations/vitest/bun-test-shim.js +92 -0
- package/integrations/vitest/vitest.config.js +41 -0
- package/integrations/webpack/README.md +53 -0
- package/integrations/webpack/index.d.ts +29 -0
- package/integrations/webpack/index.js +182 -0
- package/package.json +303 -0
- package/src/core/logger.js +373 -0
- package/src/core/modules.js +289 -0
- package/src/core/readyState.js +119 -0
- package/src/core/runtime.js +929 -0
- package/src/core/worker-helper.js +261 -0
- package/src/crypto/NIST_CONFORMANCE.md +249 -0
- package/src/crypto/cipher/aes.acvp.md +74 -0
- package/src/crypto/cipher/aes.js +512 -0
- package/src/crypto/cipher/chacha20.acvp.md +117 -0
- package/src/crypto/cipher/chacha20.js +147 -0
- package/src/crypto/hash/adf.acvp.md +144 -0
- package/src/crypto/hash/adf.js +127 -0
- package/src/crypto/hash/argon2.acvp.md +144 -0
- package/src/crypto/hash/argon2.js +517 -0
- package/src/crypto/hash/blake2b.acvp.md +122 -0
- package/src/crypto/hash/blake2b.js +367 -0
- package/src/crypto/hash/hkdf.acvp.md +128 -0
- package/src/crypto/hash/hkdf.js +145 -0
- package/src/crypto/hash/hmac.acvp.md +110 -0
- package/src/crypto/hash/hmac.js +177 -0
- package/src/crypto/hash/pbkdf2.acvp.md +122 -0
- package/src/crypto/hash/pbkdf2.js +120 -0
- package/src/crypto/hash/poly1305.acvp.md +111 -0
- package/src/crypto/hash/poly1305.js +126 -0
- package/src/crypto/hash/sha224.acvp.md +81 -0
- package/src/crypto/hash/sha224.js +60 -0
- package/src/crypto/hash/sha256.acvp.md +75 -0
- package/src/crypto/hash/sha256.js +217 -0
- package/src/crypto/hash/sha3.acvp.md +133 -0
- package/src/crypto/hash/sha3.js +391 -0
- package/src/crypto/hash/sha384.acvp.md +82 -0
- package/src/crypto/hash/sha384.js +61 -0
- package/src/crypto/hash/sha512.acvp.md +84 -0
- package/src/crypto/hash/sha512.js +314 -0
- package/src/crypto/hash/sha512_224.acvp.md +90 -0
- package/src/crypto/hash/sha512_224.js +66 -0
- package/src/crypto/hash/sha512_256.acvp.md +96 -0
- package/src/crypto/hash/sha512_256.js +75 -0
- package/src/crypto/mode/cbc.acvp.md +105 -0
- package/src/crypto/mode/cbc.js +136 -0
- package/src/crypto/mode/chacha20poly1305.acvp.md +116 -0
- package/src/crypto/mode/chacha20poly1305.js +190 -0
- package/src/crypto/mode/cmac.acvp.md +106 -0
- package/src/crypto/mode/cmac.js +172 -0
- package/src/crypto/mode/ctr.acvp.md +110 -0
- package/src/crypto/mode/ctr.js +174 -0
- package/src/crypto/mode/gcm.acvp.md +129 -0
- package/src/crypto/mode/gcm.js +333 -0
- package/src/crypto/mode/kw.acvp.md +145 -0
- package/src/crypto/mode/kw.js +323 -0
- package/src/crypto/pkc/ecc.acvp.md +181 -0
- package/src/crypto/pkc/ecc.js +941 -0
- package/src/crypto/pkc/ed25519.acvp.md +172 -0
- package/src/crypto/pkc/ed25519.js +582 -0
- package/src/crypto/pkc/hybrid-kat.provenance.md +89 -0
- package/src/crypto/pkc/hybridKem.js +255 -0
- package/src/crypto/pkc/hybridSign.js +437 -0
- package/src/crypto/pkc/ml_dsa.acvp.md +146 -0
- package/src/crypto/pkc/ml_dsa.js +984 -0
- package/src/crypto/pkc/ml_kem.acvp.md +117 -0
- package/src/crypto/pkc/ml_kem.js +596 -0
- package/src/crypto/pkc/rsa.acvp.md +187 -0
- package/src/crypto/pkc/rsa.js +470 -0
- package/src/crypto/pkc/slh_dsa.acvp.md +155 -0
- package/src/crypto/pkc/slh_dsa.js +820 -0
- package/src/crypto/pkc/x25519.acvp.md +113 -0
- package/src/crypto/pkc/x25519.js +290 -0
- package/src/crypto/utils/aes_ctr.acvp.md +67 -0
- package/src/crypto/utils/aes_ctr.js +134 -0
- package/src/crypto/utils/aes_modes.acvp.md +66 -0
- package/src/crypto/utils/aes_modes.js +241 -0
- package/src/crypto/utils/asn1-oid.js +369 -0
- package/src/crypto/utils/asn1.js +343 -0
- package/src/crypto/utils/bitArray.js +312 -0
- package/src/crypto/utils/bn.js +825 -0
- package/src/crypto/utils/jws.js +222 -0
- package/src/crypto/utils/keyformat.js +303 -0
- package/src/crypto/utils/pad.js +198 -0
- package/src/crypto/utils/pem.js +90 -0
- package/src/crypto/utils/random.acvp.md +167 -0
- package/src/crypto/utils/random.js +846 -0
- package/src/crypto/utils/rsaKeygen.acvp.md +158 -0
- package/src/crypto/utils/rsaKeygen.js +448 -0
- package/src/crypto/utils/totp.js +409 -0
- package/src/crypto/utils/uuid.acvp.md +137 -0
- package/src/crypto/utils/uuid.js +176 -0
- package/src/crypto/wasm/aes.js +494 -0
- package/src/crypto/wasm/argon2.js +236 -0
- package/src/crypto/wasm/blake2b.js +213 -0
- package/src/crypto/wasm/chacha20poly1305.js +238 -0
- package/src/crypto/wasm/cmac.js +207 -0
- package/src/crypto/wasm/ecc.js +437 -0
- package/src/crypto/wasm/ed25519.js +307 -0
- package/src/crypto/wasm/hkdf.js +183 -0
- package/src/crypto/wasm/hmac.js +215 -0
- package/src/crypto/wasm/ml_dsa.js +375 -0
- package/src/crypto/wasm/ml_kem.js +313 -0
- package/src/crypto/wasm/pbkdf2.js +205 -0
- package/src/crypto/wasm/rsa.js +674 -0
- package/src/crypto/wasm/runtime.js +400 -0
- package/src/crypto/wasm/sha2.js +183 -0
- package/src/crypto/wasm/sha3.js +221 -0
- package/src/crypto/wasm/slh_dsa.js +397 -0
- package/src/crypto/wasm/x25519.js +241 -0
- package/src/crypto/webcrypto/aes.js +370 -0
- package/src/crypto/webcrypto/aeskw.js +185 -0
- package/src/crypto/webcrypto/digest.js +136 -0
- package/src/crypto/webcrypto/ecc.js +371 -0
- package/src/crypto/webcrypto/ed25519.js +248 -0
- package/src/crypto/webcrypto/hkdf.js +132 -0
- package/src/crypto/webcrypto/hmac.js +213 -0
- package/src/crypto/webcrypto/pbkdf2.js +146 -0
- package/src/crypto/webcrypto/rsa.js +415 -0
- package/src/crypto/webcrypto/x25519.js +250 -0
- package/src/dom/display/animate.js +154 -0
- package/src/dom/display/fullscreen.js +305 -0
- package/src/dom/fs/download.js +118 -0
- package/src/dom/fs/fsAccess.js +307 -0
- package/src/dom/fs/indexedDB.js +465 -0
- package/src/dom/fs/remoteStore.js +484 -0
- package/src/dom/fs/storage.js +440 -0
- package/src/dom/lifecycle/idle.js +133 -0
- package/src/dom/lifecycle/visibility.js +140 -0
- package/src/dom/lifecycle/wakeLock.js +187 -0
- package/src/dom/net/ajax.js +303 -0
- package/src/dom/net/broadcastChannel.js +89 -0
- package/src/dom/net/network.js +260 -0
- package/src/dom/net/sse.js +295 -0
- package/src/dom/net/webrtc.js +381 -0
- package/src/dom/net/ws.js +290 -0
- package/src/dom/query/dnd.js +409 -0
- package/src/dom/query/dom.js +831 -0
- package/src/dom/query/events.js +425 -0
- package/src/dom/query/gesture.js +396 -0
- package/src/dom/query/media.js +616 -0
- package/src/dom/rendering/chart.js +663 -0
- package/src/dom/rendering/component.js +469 -0
- package/src/dom/rendering/devtools-ui.js +399 -0
- package/src/dom/rendering/devtools.js +352 -0
- package/src/dom/rendering/parser.js +1055 -0
- package/src/dom/rendering/reactiveBind.js +341 -0
- package/src/dom/rendering/render.js +601 -0
- package/src/dom/rendering/sanitize.js +364 -0
- package/src/dom/rendering/secPolicy.js +281 -0
- package/src/dom/rendering/template.js +1031 -0
- package/src/dom/rendering/themeTokens.js +522 -0
- package/src/dom/rendering/uiSession-core.js +597 -0
- package/src/dom/rendering/uiSession-direct.js +251 -0
- package/src/dom/rendering/uiSession-list.js +751 -0
- package/src/dom/rendering/uiSession.js +145 -0
- package/src/dom/rendering/virtualScroll.js +341 -0
- package/src/dom/sensors/battery.js +153 -0
- package/src/dom/sensors/geolocation.js +156 -0
- package/src/dom/sensors/networkInfo.js +136 -0
- package/src/dom/sensors/sensors.js +340 -0
- package/src/dom/sw/backgroundSync.js +113 -0
- package/src/dom/sw/cache.js +139 -0
- package/src/dom/sw/push.js +181 -0
- package/src/dom/sw/serviceWorker.js +193 -0
- package/src/dom/sw/sharedWorker.js +192 -0
- package/src/dom/utils/a11y.js +244 -0
- package/src/dom/utils/clipboard.js +113 -0
- package/src/dom/utils/entropyCollector.js +344 -0
- package/src/dom/utils/focus.js +421 -0
- package/src/dom/utils/form.js +535 -0
- package/src/dom/utils/formKit.js +427 -0
- package/src/dom/utils/keybindings.js +574 -0
- package/src/dom/utils/leaderElection.js +280 -0
- package/src/dom/utils/notifications.js +218 -0
- package/src/dom/utils/permissions.js +107 -0
- package/src/dom/utils/route.js +482 -0
- package/src/dom/utils/ua.js +109 -0
- package/src/dom/utils/webauthn.js +369 -0
- package/src/external/README.md +15 -0
- package/src/io/binary/reader.js +374 -0
- package/src/io/binary/writer.js +351 -0
- package/src/io/calc/adler32.js +94 -0
- package/src/io/calc/bigint.js +276 -0
- package/src/io/calc/crc32.js +111 -0
- package/src/io/calc/easing.js +514 -0
- package/src/io/codec/b64.js +235 -0
- package/src/io/codec/base32.js +147 -0
- package/src/io/codec/base58.js +167 -0
- package/src/io/codec/buffer.js +630 -0
- package/src/io/codec/cbor.js +550 -0
- package/src/io/codec/csv.js +299 -0
- package/src/io/codec/hex.js +129 -0
- package/src/io/codec/mime.js +398 -0
- package/src/io/codec/msgpack.js +491 -0
- package/src/io/codec/url.js +530 -0
- package/src/io/codec/utf8.js +181 -0
- package/src/io/codec/xml.js +428 -0
- package/src/io/compress/bitstream.js +199 -0
- package/src/io/compress/brotli.js +3073 -0
- package/src/io/compress/brotli_dict.bin +432 -0
- package/src/io/compress/brotli_dict.js +356 -0
- package/src/io/compress/brotli_dict_words.js +157 -0
- package/src/io/compress/brotli_frame.js +420 -0
- package/src/io/compress/brotli_shared.js +715 -0
- package/src/io/compress/deflate.js +1432 -0
- package/src/io/compress/gzip.js +406 -0
- package/src/io/compress/huffman.js +322 -0
- package/src/io/compress/lz4.js +451 -0
- package/src/io/compress/lz77.js +408 -0
- package/src/io/compress/lzw.js +332 -0
- package/src/io/compress/zip.js +815 -0
- package/src/io/compress/zlib.js +340 -0
- package/src/io/i18n/i18n.js +236 -0
- package/src/io/math/fixed-point.js +269 -0
- package/src/io/math/geom.js +350 -0
- package/src/io/math/interp.js +263 -0
- package/src/io/math/linalg.js +472 -0
- package/src/io/math/stats.js +339 -0
- package/src/io/structures/btree.js +357 -0
- package/src/io/structures/heap.js +249 -0
- package/src/io/structures/lruCache.js +219 -0
- package/src/io/structures/ringBuffer.js +208 -0
- package/src/io/structures/tree-walker.js +413 -0
- package/src/io/structures/trie.js +219 -0
- package/src/io/sync/abort.js +196 -0
- package/src/io/sync/atomics.js +342 -0
- package/src/io/sync/cancellable.js +279 -0
- package/src/io/sync/channel.js +301 -0
- package/src/io/sync/mutex.js +148 -0
- package/src/io/sync/semaphore.js +156 -0
- package/src/io/sync/tokenBucket.js +208 -0
- package/src/io/text/ansi.js +536 -0
- package/src/io/text/html-entities.js +143 -0
- package/src/io/text/semver.js +375 -0
- package/src/io/text/str.js +243 -0
- package/src/io/text/unicode.js +188 -0
- package/src/io/time/date.js +355 -0
- package/src/io/timing/clock.js +79 -0
- package/src/io/timing/rateLimit.js +264 -0
- package/src/io/timing/scheduler.js +351 -0
- package/src/io/utils/bitmap.js +94 -0
- package/src/io/utils/errors.js +269 -0
- package/src/io/utils/eventBus.js +315 -0
- package/src/io/utils/queue.js +223 -0
- package/src/io/utils/signal.js +858 -0
- package/src/io/utils/ui8.js +99 -0
- package/src/io/utils/valid.js +556 -0
- package/src/main.js +41 -0
- package/src/polyfill/README.md +9 -0
- package/src/process/message.js +257 -0
- package/src/process/rpc.js +286 -0
- package/src/process/workerPool.js +392 -0
- package/src/sanity/base.js +374 -0
- package/src/sanity/community.js +254 -0
- package/src/sanity/lockdown-apply.js +58 -0
- package/src/sanity/lockdown.js +408 -0
- package/src/sanity/wasm-gate.js +316 -0
- package/src/typed.js +53 -0
- package/third-party/NOTICE-penner-easing +88 -0
- package/third-party/NOTICE-sjcl +50 -0
- package/tools/_lib/cli-help.js +55 -0
- package/tools/rendering/aot/index.js +148 -0
- package/tools/rendering/aot/lib/dom-codegen.js +295 -0
- package/tools/rendering/jsx/index.js +654 -0
- package/tools/rendering/precompilation/index.js +368 -0
- package/types/registry.generated.d.ts +217 -0
- package/types/typed.d.ts +106 -0
|
@@ -0,0 +1,715 @@
|
|
|
1
|
+
// Copyright (c) 2026 AwaCloud SAS
|
|
2
|
+
// Author: Matthieu Bouilloux
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @fileoverview Shared Brotli - RFC 9841 (Shared Brotli Compressed Data Format).
|
|
7
|
+
*
|
|
8
|
+
* Companion module to `brotli` that adds the RFC 9841 extensions on top of
|
|
9
|
+
* the RFC 7932 base codec:
|
|
10
|
+
*
|
|
11
|
+
* - §3.1 Custom static dictionary (multi-dict + context map + ShiftFirst /
|
|
12
|
+
* ShiftAll transforms)
|
|
13
|
+
* - §3.2 Shared LZ77 dictionary (virtual output prefix)
|
|
14
|
+
* - §5 Shared Dictionary Stream container (`parseSharedDictionary`)
|
|
15
|
+
* - §6 Large window mode (`allowLargeWindow`)
|
|
16
|
+
* - §8 Framing format is handled by the separate `brotliFrame` module.
|
|
17
|
+
*
|
|
18
|
+
* ## Why a separate module?
|
|
19
|
+
*
|
|
20
|
+
* RFC 7932 (`brotli`) is a complete, stable codec. RFC 9841 is a strict
|
|
21
|
+
* superset that adds features absent from the base spec. Keeping the
|
|
22
|
+
* two concerns in separate modules:
|
|
23
|
+
*
|
|
24
|
+
* - lets consumers that only need RFC 7932 avoid importing the §5 parser
|
|
25
|
+
* and the custom-transform helpers (smaller surface, cleaner audits);
|
|
26
|
+
* - keeps the entry point unambiguous - if you reach for `brotliShared`
|
|
27
|
+
* you know you're opting into the extension semantics;
|
|
28
|
+
* - makes the test surface tractable per-spec (the brotli.test.js suite
|
|
29
|
+
* is RFC 7932 only, brotli_shared.test.js is RFC 9841 only).
|
|
30
|
+
*
|
|
31
|
+
* `brotli_shared` *depends on* `brotli`. It wires RFC 9841 features into
|
|
32
|
+
* brotli's internal extension hooks (`opts._ext`) so that the underlying
|
|
33
|
+
* decoder/encoder loop is shared and not duplicated. The hooks are:
|
|
34
|
+
*
|
|
35
|
+
* | Hook | Purpose |
|
|
36
|
+
* |---|---|
|
|
37
|
+
* | `_ext.allowLargeWindow` | Permit the §6 large-window WBITS prefix |
|
|
38
|
+
* | `_ext.lz77Dict` | Virtual output prefix for §3.2 distance redirection |
|
|
39
|
+
* | `_ext.resolveStaticDictRef` | Override the RFC 7932 dict-ref path (§3.1 custom dicts) |
|
|
40
|
+
* | `_ext.lz77Prefix` | Encoder-side prefix for §3.2 shared LZ77 dict |
|
|
41
|
+
*
|
|
42
|
+
* ## API
|
|
43
|
+
*
|
|
44
|
+
* | Method | Description |
|
|
45
|
+
* |---|---|
|
|
46
|
+
* | `brotliDecompressSync(buf, opts?)` | Like `brotli.brotliDecompressSync` but accepts `opts.allowLargeWindow` and `opts.sharedDictionary` |
|
|
47
|
+
* | `brotliDecompress(buf, opts?)` | Async variant |
|
|
48
|
+
* | `brotliCompressSync(data, opts?)` | Like `brotli.brotliCompressSync` with shared-LZ77-dict support |
|
|
49
|
+
* | `brotliCompress(data, opts?)` | Async variant |
|
|
50
|
+
* | `BrotliCompressStream(opts?, ondata?)` | Streaming compressor with RFC 9841 opts |
|
|
51
|
+
* | `BrotliDecompressStream(opts?, ondata?)` | Streaming decompressor with RFC 9841 opts |
|
|
52
|
+
* | `parseSharedDictionary(buf)` | RFC 9841 §5 - parse a shared-dictionary stream |
|
|
53
|
+
*
|
|
54
|
+
*/
|
|
55
|
+
|
|
56
|
+
import { brotli } from './brotli.js';
|
|
57
|
+
import { brotliDict } from './brotli_dict.js';
|
|
58
|
+
import { brotliDictWords } from './brotli_dict_words.js';
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Streaming wrapper instance (RFC 9841-aware).
|
|
62
|
+
* @typedef {object} BrotliSharedStreamInstance
|
|
63
|
+
* @property {(chunk: Uint8Array, final?: boolean) => void} push Push a chunk into the underlying brotli stream.
|
|
64
|
+
*/
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Constructor for a shared-brotli streaming wrapper.
|
|
68
|
+
* @typedef {new (opts?: object, ondata?: (chunk: Uint8Array, isFinal: boolean) => void) => BrotliSharedStreamInstance} BrotliSharedStreamCtor
|
|
69
|
+
*/
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Result of `parseSharedDictionary` (RFC 9841 §5).
|
|
73
|
+
* @typedef {object} BrotliSharedDictionary
|
|
74
|
+
* @property {Uint8Array|null} lz77Dict Shared LZ77 dictionary, or `null`.
|
|
75
|
+
* @property {Array<{ sizeBits: Uint8Array, offsets: Int32Array, words: Uint8Array }>} wordLists Custom word lists.
|
|
76
|
+
* @property {Array<{ stringlets: Uint8Array[], transforms: Array<{ prefixIdx: number, suffixIdx: number, opIdx: number, param: number }> }>} transformLists Custom transform lists.
|
|
77
|
+
* @property {Array<{ wordListIdx: number, transformListIdx: number }>|null} dictionaryMap Dictionary map, or `null`.
|
|
78
|
+
* @property {Uint8Array|null} contextMap 64-entry context map, or `null`.
|
|
79
|
+
* @property {number} bytesConsumed Number of bytes consumed from the input.
|
|
80
|
+
*/
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Public surface of `brotliShared.factory(...)`.
|
|
84
|
+
* @typedef {object} BrotliSharedAPI
|
|
85
|
+
* @property {(data: Uint8Array, opts?: object) => Uint8Array} brotliCompressSync RFC 9841-aware sync compression.
|
|
86
|
+
* @property {(data: Uint8Array, opts?: object) => Uint8Array} brotliDecompressSync RFC 9841-aware sync decompression.
|
|
87
|
+
* @property {(data: Uint8Array, opts?: object) => Promise<Uint8Array>} brotliCompress Async compression.
|
|
88
|
+
* @property {(data: Uint8Array, opts?: object) => Promise<Uint8Array>} brotliDecompress Async decompression.
|
|
89
|
+
* @property {BrotliSharedStreamCtor} BrotliCompressStream Streaming compressor.
|
|
90
|
+
* @property {BrotliSharedStreamCtor} BrotliDecompressStream Streaming decompressor.
|
|
91
|
+
* @property {(buf: Uint8Array) => BrotliSharedDictionary} parseSharedDictionary Parse a §5 shared-dictionary stream.
|
|
92
|
+
* @property {object} _internal Internal helpers exposed for tests.
|
|
93
|
+
*/
|
|
94
|
+
|
|
95
|
+
export const brotliShared = {
|
|
96
|
+
name: 'brotliShared',
|
|
97
|
+
version: '1.2.0',
|
|
98
|
+
type: 'fw.io.compress',
|
|
99
|
+
dependencies: ['brotli', 'brotliDict', 'brotliDictWords'],
|
|
100
|
+
deps: [brotli, brotliDict, brotliDictWords],
|
|
101
|
+
|
|
102
|
+
/** @returns {BrotliSharedAPI} */
|
|
103
|
+
factory(brotli, brotliDict, brotliDictWords) {
|
|
104
|
+
|
|
105
|
+
const u8 = Uint8Array;
|
|
106
|
+
|
|
107
|
+
function _err(code, msg, bitPos) {
|
|
108
|
+
const e = new Error(
|
|
109
|
+
'brotliShared: ' + msg + (bitPos != null ? ' @ bit ' + bitPos : '')
|
|
110
|
+
);
|
|
111
|
+
// @ts-ignore - Error.code/context is a non-standard but widely-used extension
|
|
112
|
+
e.code = code;
|
|
113
|
+
throw e;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// --- RFC 9841 §4 - base-128 varint -----------------------------
|
|
117
|
+
// LSB-first per byte, MSB continuation flag; max 9 bytes / 63 bits.
|
|
118
|
+
function _readSharedVarint(buf, p) {
|
|
119
|
+
let v = 0;
|
|
120
|
+
let shift = 0;
|
|
121
|
+
let count = 0;
|
|
122
|
+
while (count < 9) {
|
|
123
|
+
if (p >= buf.length) _err('EBADSTREAM', 'shared dict: varint truncated');
|
|
124
|
+
const b = buf[p++];
|
|
125
|
+
v += (b & 0x7F) * Math.pow(2, shift);
|
|
126
|
+
count++;
|
|
127
|
+
if ((b & 0x80) === 0) break;
|
|
128
|
+
shift += 7;
|
|
129
|
+
if (count === 9) _err('EBADSTREAM', 'shared dict: varint too long');
|
|
130
|
+
}
|
|
131
|
+
return { v, p };
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// --- RFC 9841 §5 - Shared Dictionary Stream parser ------------
|
|
135
|
+
//
|
|
136
|
+
// Decodes the standalone "shared dictionary" file format that
|
|
137
|
+
// pairs an LZ77 dictionary with custom static word/transform
|
|
138
|
+
// lists. Returns a structured object that callers can pass to
|
|
139
|
+
// `brotliDecompressSync(stream, { sharedDictionary: parsed })`.
|
|
140
|
+
function parseSharedDictionary(buf) {
|
|
141
|
+
if (!(buf instanceof u8)) _err('EBADARG', 'parseSharedDictionary: expected Uint8Array');
|
|
142
|
+
if (buf.length < 4) _err('EBADSTREAM', 'shared dict: too short for header');
|
|
143
|
+
|
|
144
|
+
let p = 0;
|
|
145
|
+
|
|
146
|
+
// File signature: 0x91, 0x00
|
|
147
|
+
if (buf[p++] !== 0x91 || buf[p++] !== 0x00) {
|
|
148
|
+
_err('EBADSTREAM', 'shared dict: invalid signature (expected 91 00)');
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// LZ77 dictionary
|
|
152
|
+
const lz = _readSharedVarint(buf, p);
|
|
153
|
+
p = lz.p;
|
|
154
|
+
const lz77Len = lz.v;
|
|
155
|
+
if (lz77Len > buf.length - p) _err('EBADSTREAM', 'shared dict: LZ77 length exceeds buffer');
|
|
156
|
+
let lz77Dict = null;
|
|
157
|
+
if (lz77Len > 0) {
|
|
158
|
+
lz77Dict = new u8(buf.subarray(p, p + lz77Len));
|
|
159
|
+
p += lz77Len;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// Custom word lists
|
|
163
|
+
if (p >= buf.length) _err('EBADSTREAM', 'shared dict: truncated at NUM_CUSTOM_WORD_LISTS');
|
|
164
|
+
const numWordLists = buf[p++];
|
|
165
|
+
if (numWordLists > 64) _err('EBADSTREAM', 'shared dict: NUM_CUSTOM_WORD_LISTS > 64');
|
|
166
|
+
const wordLists = [];
|
|
167
|
+
for (let i = 0; i < numWordLists; ++i) {
|
|
168
|
+
if (p + 28 > buf.length) _err('EBADSTREAM', 'shared dict: truncated at SIZE_BITS_BY_LENGTH');
|
|
169
|
+
const sizeBits = new u8(buf.subarray(p, p + 28));
|
|
170
|
+
p += 28;
|
|
171
|
+
let totalBytes = 0;
|
|
172
|
+
const offsets = new Int32Array(28);
|
|
173
|
+
for (let k = 0; k < 28; ++k) {
|
|
174
|
+
offsets[k] = totalBytes;
|
|
175
|
+
const sb = sizeBits[k];
|
|
176
|
+
if (sb > 15) _err('EBADSTREAM', 'shared dict: SIZE_BITS_BY_LENGTH[' + k + '] > 15');
|
|
177
|
+
if (sb > 0) totalBytes += (k + 4) << sb;
|
|
178
|
+
}
|
|
179
|
+
if (p + totalBytes > buf.length) {
|
|
180
|
+
_err('EBADSTREAM', 'shared dict: word list payload exceeds buffer');
|
|
181
|
+
}
|
|
182
|
+
const words = new u8(buf.subarray(p, p + totalBytes));
|
|
183
|
+
p += totalBytes;
|
|
184
|
+
wordLists.push({ sizeBits, offsets, words });
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
// Custom transform lists
|
|
188
|
+
if (p >= buf.length) _err('EBADSTREAM', 'shared dict: truncated at NUM_CUSTOM_TRANSFORM_LISTS');
|
|
189
|
+
const numTransformLists = buf[p++];
|
|
190
|
+
if (numTransformLists > 64) _err('EBADSTREAM', 'shared dict: NUM_CUSTOM_TRANSFORM_LISTS > 64');
|
|
191
|
+
const transformLists = [];
|
|
192
|
+
for (let i = 0; i < numTransformLists; ++i) {
|
|
193
|
+
if (p + 2 > buf.length) _err('EBADSTREAM', 'shared dict: truncated at PREFIX_SUFFIX_LENGTH');
|
|
194
|
+
const psLen = buf[p] | (buf[p + 1] << 8);
|
|
195
|
+
p += 2;
|
|
196
|
+
if (psLen < 1) _err('EBADSTREAM', 'shared dict: PREFIX_SUFFIX_LENGTH must be ≥ 1');
|
|
197
|
+
if (p + psLen > buf.length) _err('EBADSTREAM', 'shared dict: prefix/suffix data exceeds buffer');
|
|
198
|
+
const psEnd = p + psLen;
|
|
199
|
+
const stringlets = [];
|
|
200
|
+
let sawTerminator = false;
|
|
201
|
+
while (p < psEnd) {
|
|
202
|
+
const slen = buf[p++];
|
|
203
|
+
if (slen === 0) {
|
|
204
|
+
sawTerminator = true;
|
|
205
|
+
if (p !== psEnd) {
|
|
206
|
+
_err('EBADSTREAM', 'shared dict: 0-length stringlet must be the last entry');
|
|
207
|
+
}
|
|
208
|
+
break;
|
|
209
|
+
}
|
|
210
|
+
if (slen > 255) _err('EBADSTREAM', 'shared dict: STRING_LENGTH > 255');
|
|
211
|
+
if (p + slen > psEnd) _err('EBADSTREAM', 'shared dict: stringlet payload exceeds list');
|
|
212
|
+
stringlets.push(new u8(buf.subarray(p, p + slen)));
|
|
213
|
+
p += slen;
|
|
214
|
+
}
|
|
215
|
+
if (!sawTerminator) _err('EBADSTREAM', 'shared dict: missing 0-length terminator');
|
|
216
|
+
if (stringlets.length < 1 || stringlets.length > 255) {
|
|
217
|
+
_err('EBADSTREAM', 'shared dict: NUM_PREFIX_SUFFIX out of range');
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
if (p >= buf.length) _err('EBADSTREAM', 'shared dict: truncated at NTRANSFORMS');
|
|
221
|
+
const ntransforms = buf[p++];
|
|
222
|
+
if (ntransforms < 1) _err('EBADSTREAM', 'shared dict: NTRANSFORMS must be ≥ 1');
|
|
223
|
+
const transforms = [];
|
|
224
|
+
let hasShift = false;
|
|
225
|
+
for (let t = 0; t < ntransforms; ++t) {
|
|
226
|
+
if (p + 3 > buf.length) _err('EBADSTREAM', 'shared dict: truncated at transform triplet');
|
|
227
|
+
const prefixIdx = buf[p++];
|
|
228
|
+
const suffixIdx = buf[p++];
|
|
229
|
+
const opIdx = buf[p++];
|
|
230
|
+
if (prefixIdx >= stringlets.length || suffixIdx >= stringlets.length) {
|
|
231
|
+
_err('EBADSTREAM', 'shared dict: prefix/suffix index out of range');
|
|
232
|
+
}
|
|
233
|
+
if (opIdx > 22) _err('EBADSTREAM', 'shared dict: invalid op index ' + opIdx);
|
|
234
|
+
transforms.push({ prefixIdx, suffixIdx, opIdx, param: 0 });
|
|
235
|
+
if (opIdx === 21 || opIdx === 22) hasShift = true;
|
|
236
|
+
}
|
|
237
|
+
if (hasShift) {
|
|
238
|
+
for (let t = 0; t < ntransforms; ++t) {
|
|
239
|
+
if (p + 2 > buf.length) _err('EBADSTREAM', 'shared dict: truncated at transform params');
|
|
240
|
+
const op = transforms[t].opIdx;
|
|
241
|
+
const param = buf[p] | (buf[p + 1] << 8);
|
|
242
|
+
p += 2;
|
|
243
|
+
if (op !== 21 && op !== 22 && param !== 0) {
|
|
244
|
+
_err('EBADSTREAM', 'shared dict: non-zero param for non-shift transform');
|
|
245
|
+
}
|
|
246
|
+
transforms[t].param = param;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
transformLists.push({ stringlets, transforms });
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
// Dictionary map + optional context map
|
|
253
|
+
let dictionaryMap = null;
|
|
254
|
+
let contextMap = null;
|
|
255
|
+
if (numWordLists > 0 || numTransformLists > 0) {
|
|
256
|
+
if (p >= buf.length) _err('EBADSTREAM', 'shared dict: truncated at NUM_DICTIONARIES');
|
|
257
|
+
const numDicts = buf[p++];
|
|
258
|
+
if (numDicts < 1 || numDicts > 64) _err('EBADSTREAM', 'shared dict: NUM_DICTIONARIES out of [1, 64]');
|
|
259
|
+
dictionaryMap = new Array(numDicts);
|
|
260
|
+
for (let i = 0; i < numDicts; ++i) {
|
|
261
|
+
if (p + 2 > buf.length) _err('EBADSTREAM', 'shared dict: truncated at DICTIONARY_MAP entry');
|
|
262
|
+
const wordListIdx = buf[p++];
|
|
263
|
+
const transformListIdx = buf[p++];
|
|
264
|
+
if (wordListIdx > numWordLists) {
|
|
265
|
+
_err('EBADSTREAM', 'shared dict: word list index ' + wordListIdx + ' > ' + numWordLists);
|
|
266
|
+
}
|
|
267
|
+
if (transformListIdx > numTransformLists) {
|
|
268
|
+
_err('EBADSTREAM', 'shared dict: transform list index ' + transformListIdx + ' > ' + numTransformLists);
|
|
269
|
+
}
|
|
270
|
+
dictionaryMap[i] = { wordListIdx, transformListIdx };
|
|
271
|
+
}
|
|
272
|
+
if (p >= buf.length) _err('EBADSTREAM', 'shared dict: truncated at CONTEXT_ENABLED');
|
|
273
|
+
const contextEnabled = buf[p++];
|
|
274
|
+
if (contextEnabled === 1) {
|
|
275
|
+
if (p + 64 > buf.length) _err('EBADSTREAM', 'shared dict: truncated at CONTEXT_MAP');
|
|
276
|
+
contextMap = new u8(buf.subarray(p, p + 64));
|
|
277
|
+
for (let i = 0; i < 64; ++i) {
|
|
278
|
+
if (contextMap[i] >= dictionaryMap.length) {
|
|
279
|
+
_err('EBADSTREAM', 'shared dict: CONTEXT_MAP[' + i + '] references missing dictionary');
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
p += 64;
|
|
283
|
+
} else if (contextEnabled !== 0) {
|
|
284
|
+
_err('EBADSTREAM', 'shared dict: CONTEXT_ENABLED must be 0 or 1');
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
return {
|
|
289
|
+
lz77Dict,
|
|
290
|
+
wordLists,
|
|
291
|
+
transformLists,
|
|
292
|
+
dictionaryMap,
|
|
293
|
+
contextMap,
|
|
294
|
+
bytesConsumed: p,
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
// --- RFC 7932 §8 / RFC 9841 §3.1.1 Ferment helper -------------
|
|
299
|
+
function _ferment(word, pos, len) {
|
|
300
|
+
const b = word[pos];
|
|
301
|
+
if (b < 192) {
|
|
302
|
+
if (b >= 97 && b <= 122) word[pos] = b ^ 32;
|
|
303
|
+
return 1;
|
|
304
|
+
}
|
|
305
|
+
if (b < 224) {
|
|
306
|
+
if (pos + 1 < len) word[pos + 1] ^= 32;
|
|
307
|
+
return 2;
|
|
308
|
+
}
|
|
309
|
+
if (pos + 2 < len) word[pos + 2] ^= 5;
|
|
310
|
+
return 3;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
// --- RFC 9841 §3.1.1 ShiftAll / ShiftFirst - SCALAR shift -----
|
|
314
|
+
function _shiftStep(word, pos, len, addend) {
|
|
315
|
+
const b = word[pos];
|
|
316
|
+
let n;
|
|
317
|
+
if (b < 0x80) {
|
|
318
|
+
const scalar = b & 0x7F;
|
|
319
|
+
const shifted = (scalar + addend) & 0x7F;
|
|
320
|
+
word[pos] = shifted;
|
|
321
|
+
return 1;
|
|
322
|
+
}
|
|
323
|
+
if (b >= 0xC0 && b < 0xE0) n = 2;
|
|
324
|
+
else if (b >= 0xE0 && b < 0xF0) n = 3;
|
|
325
|
+
else if (b >= 0xF0 && b < 0xF8) n = 4;
|
|
326
|
+
else return 1;
|
|
327
|
+
|
|
328
|
+
if (pos + n > len) return 0;
|
|
329
|
+
|
|
330
|
+
let scalar;
|
|
331
|
+
let mask;
|
|
332
|
+
if (n === 2) { scalar = ((b & 0x1F) << 6) | (word[pos + 1] & 0x3F); mask = 0x7FF; }
|
|
333
|
+
else if (n === 3) { scalar = ((b & 0x0F) << 12) | ((word[pos + 1] & 0x3F) << 6) | (word[pos + 2] & 0x3F); mask = 0xFFFF; }
|
|
334
|
+
else /* n=4 */ { scalar = ((b & 0x07) << 18) | ((word[pos + 1] & 0x3F) << 12) | ((word[pos + 2] & 0x3F) << 6) | (word[pos + 3] & 0x3F); mask = 0x1FFFFF; }
|
|
335
|
+
|
|
336
|
+
const shifted = (scalar + addend) & mask;
|
|
337
|
+
|
|
338
|
+
if (n === 2) {
|
|
339
|
+
word[pos] = (b & 0xE0) | ((shifted >> 6) & 0x1F);
|
|
340
|
+
word[pos + 1] = (word[pos + 1] & 0xC0) | (shifted & 0x3F);
|
|
341
|
+
} else if (n === 3) {
|
|
342
|
+
word[pos] = (b & 0xF0) | ((shifted >> 12) & 0x0F);
|
|
343
|
+
word[pos + 1] = (word[pos + 1] & 0xC0) | ((shifted >> 6) & 0x3F);
|
|
344
|
+
word[pos + 2] = (word[pos + 2] & 0xC0) | (shifted & 0x3F);
|
|
345
|
+
} else {
|
|
346
|
+
word[pos] = (b & 0xF8) | ((shifted >> 18) & 0x07);
|
|
347
|
+
word[pos + 1] = (word[pos + 1] & 0xC0) | ((shifted >> 12) & 0x3F);
|
|
348
|
+
word[pos + 2] = (word[pos + 2] & 0xC0) | ((shifted >> 6) & 0x3F);
|
|
349
|
+
word[pos + 3] = (word[pos + 3] & 0xC0) | (shifted & 0x3F);
|
|
350
|
+
}
|
|
351
|
+
return n;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
function _shiftAddend(param) {
|
|
355
|
+
return param < 0x8000 ? param : param - 0x10000;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
function _shiftFirst(word, len, param) {
|
|
359
|
+
if (len === 0) return;
|
|
360
|
+
_shiftStep(word, 0, len, _shiftAddend(param));
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
function _shiftAll(word, len, param) {
|
|
364
|
+
const addend = _shiftAddend(param);
|
|
365
|
+
let i = 0;
|
|
366
|
+
while (i < len) {
|
|
367
|
+
const n = _shiftStep(word, i, len, addend);
|
|
368
|
+
if (n === 0) return;
|
|
369
|
+
i += n;
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
// Apply a CUSTOM transform list entry (RFC 9841 §3.1.1) to a base
|
|
374
|
+
// word. Returns the transformed bytes.
|
|
375
|
+
function _applyCustomTransform(transformList, transformId, baseWord, r) {
|
|
376
|
+
if (transformId < 0 || transformId >= transformList.transforms.length) {
|
|
377
|
+
_err('EBADSTREAM', 'custom dict: transform id ' + transformId + ' out of range', r ? r.p : 0);
|
|
378
|
+
}
|
|
379
|
+
const t = transformList.transforms[transformId];
|
|
380
|
+
const prefix = transformList.stringlets[t.prefixIdx];
|
|
381
|
+
const suffix = transformList.stringlets[t.suffixIdx];
|
|
382
|
+
|
|
383
|
+
let body;
|
|
384
|
+
if (t.opIdx === 0) {
|
|
385
|
+
body = new u8(baseWord);
|
|
386
|
+
} else if (t.opIdx >= 1 && t.opIdx <= 9) {
|
|
387
|
+
const k = t.opIdx;
|
|
388
|
+
body = baseWord.length < k ? new u8(0) : new u8(baseWord.subarray(0, baseWord.length - k));
|
|
389
|
+
} else if (t.opIdx === 10) {
|
|
390
|
+
body = new u8(baseWord);
|
|
391
|
+
if (body.length > 0) _ferment(body, 0, body.length);
|
|
392
|
+
} else if (t.opIdx === 11) {
|
|
393
|
+
body = new u8(baseWord);
|
|
394
|
+
let i = 0;
|
|
395
|
+
while (i < body.length) i += _ferment(body, i, body.length);
|
|
396
|
+
} else if (t.opIdx >= 12 && t.opIdx <= 20) {
|
|
397
|
+
const k = t.opIdx - 11;
|
|
398
|
+
body = baseWord.length < k ? new u8(0) : new u8(baseWord.subarray(k));
|
|
399
|
+
} else if (t.opIdx === 21) {
|
|
400
|
+
body = new u8(baseWord);
|
|
401
|
+
_shiftFirst(body, body.length, t.param);
|
|
402
|
+
} else if (t.opIdx === 22) {
|
|
403
|
+
body = new u8(baseWord);
|
|
404
|
+
_shiftAll(body, body.length, t.param);
|
|
405
|
+
} else {
|
|
406
|
+
_err('EBADSTREAM', 'custom dict: invalid op index ' + t.opIdx, r ? r.p : 0);
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
const out = new u8(prefix.length + body.length + suffix.length);
|
|
410
|
+
out.set(prefix, 0);
|
|
411
|
+
out.set(body, prefix.length);
|
|
412
|
+
out.set(suffix, prefix.length + body.length);
|
|
413
|
+
return out;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
// Look up a base word in a CUSTOM word list (RFC 9841 §3.1).
|
|
417
|
+
function _customLookupWord(wordList, length, index, r) {
|
|
418
|
+
if (length < 4 || length > 31) {
|
|
419
|
+
_err('EBADSTREAM', 'custom dict: word length ' + length + ' out of [4, 31]', r ? r.p : 0);
|
|
420
|
+
}
|
|
421
|
+
const sb = wordList.sizeBits[length - 4];
|
|
422
|
+
if (sb === 0) _err('EBADSTREAM', 'custom dict: no words of length ' + length, r ? r.p : 0);
|
|
423
|
+
const nwords = 1 << sb;
|
|
424
|
+
if (index < 0 || index >= nwords) {
|
|
425
|
+
_err('EBADSTREAM', 'custom dict: index ' + index + ' >= NWORDS(' + length + ')=' + nwords, r ? r.p : 0);
|
|
426
|
+
}
|
|
427
|
+
const off = wordList.offsets[length - 4] + length * index;
|
|
428
|
+
return wordList.words.subarray(off, off + length);
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
// Ensure brotliDict is loaded before falling back to the built-in
|
|
432
|
+
// RFC 7932 dict in a custom-dict slot.
|
|
433
|
+
function _ensureDictLoaded(r) {
|
|
434
|
+
if (brotliDict.hasWords()) return;
|
|
435
|
+
if (brotliDictWords.isLoaded) {
|
|
436
|
+
brotliDict.setWords(brotliDictWords.blob);
|
|
437
|
+
return;
|
|
438
|
+
}
|
|
439
|
+
_err('ENEEDDICT',
|
|
440
|
+
'brotli static dictionary required for this stream - load it via ' +
|
|
441
|
+
'brotliDictWords.setBlob(bytes) or .load(url), then the decoder ' +
|
|
442
|
+
'will auto-wire on the next dict-ref',
|
|
443
|
+
r ? r.p : 0);
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
// Build a `findCustomDictMatch` closure for the encoder side
|
|
447
|
+
// (RFC 9841 §3.1). Scans the first custom dict in `customDict`
|
|
448
|
+
// for the longest match against input bytes at position `pos`,
|
|
449
|
+
// applying each Identity-op (opIdx=0) transform of the custom
|
|
450
|
+
// transform list. Returns `{ outputLen, dictLen, wordId } | null`.
|
|
451
|
+
//
|
|
452
|
+
// Currently encoder-side support is limited to:
|
|
453
|
+
// - NUM_DICTIONARIES = 1 (multi-dict encoder is future)
|
|
454
|
+
// - Identity transforms only (FermentFirst/All + Shift skipped
|
|
455
|
+
// since they'd require hashing fermented variants of the input)
|
|
456
|
+
//
|
|
457
|
+
// Scan complexity per position is O(N_transforms × Σ NWORDS[len]).
|
|
458
|
+
// For typical web-bundle shared dicts (≤ 100 words, ≤ 20 transforms)
|
|
459
|
+
// this is ~ a few thousand ops/position - acceptable on small to
|
|
460
|
+
// medium inputs.
|
|
461
|
+
function _makeCustomDictMatchFinder(customDict) {
|
|
462
|
+
if (!customDict || !customDict.dicts || customDict.dicts.length === 0) return null;
|
|
463
|
+
const dict = customDict.dicts[0];
|
|
464
|
+
const wordList = dict.wordList;
|
|
465
|
+
const transformList = dict.transformList;
|
|
466
|
+
if (!wordList) return null; // single-dict encoder; built-in dict path stays
|
|
467
|
+
|
|
468
|
+
// Pre-compute the Identity transforms (op=0) we'll scan.
|
|
469
|
+
const identityTransforms = [];
|
|
470
|
+
if (transformList) {
|
|
471
|
+
for (let id = 0; id < transformList.transforms.length; ++id) {
|
|
472
|
+
const t = transformList.transforms[id];
|
|
473
|
+
if (t.opIdx !== 0) continue;
|
|
474
|
+
identityTransforms.push({
|
|
475
|
+
id,
|
|
476
|
+
prefix: transformList.stringlets[t.prefixIdx],
|
|
477
|
+
suffix: transformList.stringlets[t.suffixIdx],
|
|
478
|
+
});
|
|
479
|
+
}
|
|
480
|
+
} else {
|
|
481
|
+
// No custom transforms → only RFC 7932 Identity (id=0,
|
|
482
|
+
// empty prefix + suffix). The other 120 RFC 7932 transforms
|
|
483
|
+
// operate on the built-in dict, not the custom one.
|
|
484
|
+
identityTransforms.push({ id: 0, prefix: new u8(0), suffix: new u8(0) });
|
|
485
|
+
}
|
|
486
|
+
if (identityTransforms.length === 0) return null;
|
|
487
|
+
|
|
488
|
+
return function findCustomDictMatch(data, pos, end, minLen) {
|
|
489
|
+
let bestOutLen = 0, bestDictLen = 0, bestIdx = 0, bestTransformId = 0;
|
|
490
|
+
|
|
491
|
+
for (let ti = 0; ti < identityTransforms.length; ++ti) {
|
|
492
|
+
const t = identityTransforms[ti];
|
|
493
|
+
const pre = t.prefix;
|
|
494
|
+
const suf = t.suffix;
|
|
495
|
+
const preLen = pre.length;
|
|
496
|
+
const sufLen = suf.length;
|
|
497
|
+
if (pos + preLen > end) continue;
|
|
498
|
+
// Verify prefix bytes match.
|
|
499
|
+
let pm = 0;
|
|
500
|
+
while (pm < preLen && data[pos + pm] === pre[pm]) ++pm;
|
|
501
|
+
if (pm !== preLen) continue;
|
|
502
|
+
|
|
503
|
+
const wordStart = pos + preLen;
|
|
504
|
+
for (let len = 4; len <= 31; ++len) {
|
|
505
|
+
const sb = wordList.sizeBits[len - 4];
|
|
506
|
+
if (sb === 0) continue;
|
|
507
|
+
const nw = 1 << sb;
|
|
508
|
+
if (wordStart + len > end) break;
|
|
509
|
+
const baseOff = wordList.offsets[len - 4];
|
|
510
|
+
|
|
511
|
+
for (let idx = 0; idx < nw; ++idx) {
|
|
512
|
+
const wordOff = baseOff + len * idx;
|
|
513
|
+
let wm = 0;
|
|
514
|
+
while (wm < len && data[wordStart + wm] === wordList.words[wordOff + wm]) ++wm;
|
|
515
|
+
if (wm !== len) continue;
|
|
516
|
+
// Word matched - check suffix.
|
|
517
|
+
if (wordStart + len + sufLen > end) continue;
|
|
518
|
+
let sm = 0;
|
|
519
|
+
while (sm < sufLen && data[wordStart + len + sm] === suf[sm]) ++sm;
|
|
520
|
+
if (sm !== sufLen) continue;
|
|
521
|
+
|
|
522
|
+
const outLen = preLen + len + sufLen;
|
|
523
|
+
if (outLen > bestOutLen) {
|
|
524
|
+
bestOutLen = outLen;
|
|
525
|
+
bestDictLen = len;
|
|
526
|
+
bestIdx = idx;
|
|
527
|
+
bestTransformId = t.id;
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
if (bestOutLen < minLen) return null;
|
|
533
|
+
const nw = 1 << wordList.sizeBits[bestDictLen - 4];
|
|
534
|
+
const wordId = bestTransformId * nw + bestIdx;
|
|
535
|
+
return { outputLen: bestOutLen, dictLen: bestDictLen, wordId };
|
|
536
|
+
};
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
// Build a `resolveStaticDictRef` closure over a custom-dict
|
|
540
|
+
// configuration (parsed shared dictionary). This is the callback
|
|
541
|
+
// brotli.js calls when `state.resolveStaticDictRef` is set and a
|
|
542
|
+
// static-dict reference is encountered.
|
|
543
|
+
//
|
|
544
|
+
// Signature: (state, wordId, clen, contextIdL, reader) → Uint8Array
|
|
545
|
+
function _makeResolveStaticDictRef(customDict) {
|
|
546
|
+
const cd = customDict;
|
|
547
|
+
return function resolveStaticDictRef(state, wordId, clen, contextIdL, r) {
|
|
548
|
+
if (clen < 4 || clen > 31) {
|
|
549
|
+
_err('EBADSTREAM', 'static dict ref length ' + clen + ' not in [4, 31]', r ? r.p : 0);
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
let order;
|
|
553
|
+
if (cd.contextMap) {
|
|
554
|
+
const first = cd.contextMap[contextIdL];
|
|
555
|
+
order = [first];
|
|
556
|
+
for (let i = 0; i < cd.dicts.length; ++i) {
|
|
557
|
+
if (i !== first) order.push(i);
|
|
558
|
+
}
|
|
559
|
+
} else {
|
|
560
|
+
order = cd.dicts.map((_, i) => i);
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
let wid = wordId;
|
|
564
|
+
for (const di of order) {
|
|
565
|
+
const dict = cd.dicts[di];
|
|
566
|
+
let nw;
|
|
567
|
+
if (dict.wordList) {
|
|
568
|
+
const sb = dict.wordList.sizeBits[clen - 4];
|
|
569
|
+
if (sb === 0) continue;
|
|
570
|
+
nw = 1 << sb;
|
|
571
|
+
} else {
|
|
572
|
+
_ensureDictLoaded(r);
|
|
573
|
+
nw = brotliDict.NWORDS(clen);
|
|
574
|
+
}
|
|
575
|
+
const transformCount = dict.transformList
|
|
576
|
+
? dict.transformList.transforms.length
|
|
577
|
+
: 121;
|
|
578
|
+
const capacity = nw * transformCount;
|
|
579
|
+
if (wid < capacity) {
|
|
580
|
+
const index = wid % nw;
|
|
581
|
+
const transformId = (wid - index) / nw;
|
|
582
|
+
const baseWord = dict.wordList
|
|
583
|
+
? _customLookupWord(dict.wordList, clen, index, r)
|
|
584
|
+
: brotliDict.lookupWord(clen, index);
|
|
585
|
+
return dict.transformList
|
|
586
|
+
? _applyCustomTransform(dict.transformList, transformId, baseWord, r)
|
|
587
|
+
: brotliDict.applyTransform(transformId, baseWord);
|
|
588
|
+
}
|
|
589
|
+
wid -= capacity;
|
|
590
|
+
}
|
|
591
|
+
_err('EBADSTREAM', 'custom dict: word_id exceeds total capacity across dicts', r ? r.p : 0);
|
|
592
|
+
};
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
// Translate user-facing RFC 9841 opts into brotli's internal
|
|
596
|
+
// `_ext` extension protocol. Returns a fresh opts object with
|
|
597
|
+
// `_ext` populated and the user-facing keys preserved as-is for
|
|
598
|
+
// anything brotli.js itself consumes (e.g. quality, lazyMatch).
|
|
599
|
+
function _buildExt(opts) {
|
|
600
|
+
if (!opts) return opts;
|
|
601
|
+
const ext = opts._ext ? { ...opts._ext } : {};
|
|
602
|
+
|
|
603
|
+
if (opts.allowLargeWindow) ext.allowLargeWindow = true;
|
|
604
|
+
|
|
605
|
+
// Encoder-side RFC 9841 §6 large window opt-in. Public API
|
|
606
|
+
// accepts a single `windowBits` (10..62) ; if > 24 we also
|
|
607
|
+
// tag `largeWindow` so brotli.js emits the 14-bit prefix.
|
|
608
|
+
if (opts.windowBits != null) {
|
|
609
|
+
const wb = opts.windowBits | 0;
|
|
610
|
+
if (wb !== opts.windowBits || wb < 10 || wb > 62) {
|
|
611
|
+
_err('EBADARG', 'windowBits must be an integer in [10, 62]');
|
|
612
|
+
}
|
|
613
|
+
ext.windowBits = wb;
|
|
614
|
+
if (wb > 24) ext.largeWindow = true;
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
if (opts.sharedDictionary) {
|
|
618
|
+
const sd = opts.sharedDictionary;
|
|
619
|
+
if (sd.lz77 != null) {
|
|
620
|
+
if (!(sd.lz77 instanceof u8)) {
|
|
621
|
+
_err('EBADARG', 'sharedDictionary.lz77 must be Uint8Array');
|
|
622
|
+
}
|
|
623
|
+
ext.lz77Dict = sd.lz77;
|
|
624
|
+
ext.lz77Prefix = sd.lz77;
|
|
625
|
+
} else if (sd.lz77Dict != null) {
|
|
626
|
+
if (!(sd.lz77Dict instanceof u8)) {
|
|
627
|
+
_err('EBADARG', 'sharedDictionary.lz77Dict must be Uint8Array');
|
|
628
|
+
}
|
|
629
|
+
ext.lz77Dict = sd.lz77Dict;
|
|
630
|
+
ext.lz77Prefix = sd.lz77Dict;
|
|
631
|
+
}
|
|
632
|
+
if (sd.dictionaryMap && sd.dictionaryMap.length >= 1) {
|
|
633
|
+
const dicts = sd.dictionaryMap.map(entry => {
|
|
634
|
+
const useBuiltinWords = entry.wordListIdx === sd.wordLists.length;
|
|
635
|
+
const useBuiltinTransforms = entry.transformListIdx === sd.transformLists.length;
|
|
636
|
+
return {
|
|
637
|
+
wordList: useBuiltinWords ? null : sd.wordLists[entry.wordListIdx],
|
|
638
|
+
transformList: useBuiltinTransforms ? null : sd.transformLists[entry.transformListIdx],
|
|
639
|
+
};
|
|
640
|
+
});
|
|
641
|
+
const customDict = { dicts, contextMap: sd.contextMap || null };
|
|
642
|
+
ext.resolveStaticDictRef = _makeResolveStaticDictRef(customDict);
|
|
643
|
+
// Encoder-side custom-dict scan (RFC 9841 §3.1).
|
|
644
|
+
// Returns `null` if no custom wordList present in the
|
|
645
|
+
// first dict slot - encoder then keeps the RFC 7932
|
|
646
|
+
// built-in dict scan path.
|
|
647
|
+
const customFinder = _makeCustomDictMatchFinder(customDict);
|
|
648
|
+
if (customFinder) ext.findCustomDictMatch = customFinder;
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
return { ...opts, _ext: ext };
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
// --- Public API - RFC 9841-aware codec wrappers ----------------
|
|
656
|
+
//
|
|
657
|
+
// Each public method calls `_buildExt(opts)` to translate
|
|
658
|
+
// `allowLargeWindow` / `sharedDictionary` into the internal
|
|
659
|
+
// `_ext` channel that brotli.js consumes, then delegates.
|
|
660
|
+
|
|
661
|
+
function brotliDecompressSync(data, opts) {
|
|
662
|
+
return brotli.brotliDecompressSync(data, _buildExt(opts));
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
function brotliDecompress(data, opts) {
|
|
666
|
+
return brotli.brotliDecompress(data, _buildExt(opts));
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
function brotliCompressSync(data, opts) {
|
|
670
|
+
return brotli.brotliCompressSync(data, _buildExt(opts));
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
function brotliCompress(data, opts) {
|
|
674
|
+
return brotli.brotliCompress(data, _buildExt(opts));
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
// Streaming wrappers - translate opts up front, then use the
|
|
678
|
+
// underlying brotli stream class verbatim.
|
|
679
|
+
class BrotliCompressStream {
|
|
680
|
+
constructor(opts, ondata) {
|
|
681
|
+
this._inner = new brotli.BrotliCompressStream(_buildExt(opts), ondata);
|
|
682
|
+
}
|
|
683
|
+
push(chunk, final) { return this._inner.push(chunk, final); }
|
|
684
|
+
}
|
|
685
|
+
class BrotliDecompressStream {
|
|
686
|
+
constructor(opts, ondata) {
|
|
687
|
+
this._inner = new brotli.BrotliDecompressStream(_buildExt(opts), ondata);
|
|
688
|
+
}
|
|
689
|
+
push(chunk, final) { return this._inner.push(chunk, final); }
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
return {
|
|
693
|
+
brotliCompressSync,
|
|
694
|
+
brotliDecompressSync,
|
|
695
|
+
brotliCompress,
|
|
696
|
+
brotliDecompress,
|
|
697
|
+
BrotliCompressStream,
|
|
698
|
+
BrotliDecompressStream,
|
|
699
|
+
parseSharedDictionary,
|
|
700
|
+
// Internal helpers exposed for tests and potential companion
|
|
701
|
+
// modules. Same `_internal` convention as the rest of fw.
|
|
702
|
+
_internal: {
|
|
703
|
+
ferment: _ferment,
|
|
704
|
+
shiftStep: _shiftStep,
|
|
705
|
+
shiftAddend: _shiftAddend,
|
|
706
|
+
shiftFirst: _shiftFirst,
|
|
707
|
+
shiftAll: _shiftAll,
|
|
708
|
+
applyCustomTransform: _applyCustomTransform,
|
|
709
|
+
customLookupWord: _customLookupWord,
|
|
710
|
+
makeResolveStaticDictRef: _makeResolveStaticDictRef,
|
|
711
|
+
buildExt: _buildExt,
|
|
712
|
+
},
|
|
713
|
+
};
|
|
714
|
+
}
|
|
715
|
+
};
|