@awacloud/fw 0.1.0 → 1.0.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 +125 -0
- package/NOTICE +8 -0
- package/README.md +163 -31
- package/dist/build/fw.core.pure.meta.json +6 -6
- package/dist/build/fw.core.pure.min.js +15 -12
- package/dist/build/fw.full.pure.meta.json +13 -7
- package/dist/build/fw.full.pure.min.js +45 -42
- package/dist/build/fw.minimal.pure.meta.json +6 -6
- package/dist/build/fw.minimal.pure.min.js +16 -13
- package/dist/build/fw.pack.compress-heavy.pure.meta.json +6 -6
- package/dist/build/fw.pack.compress-heavy.pure.min.js +3 -3
- package/dist/build/fw.pack.crypto-advanced.pure.meta.json +6 -6
- package/dist/build/fw.pack.crypto-advanced.pure.min.js +1 -1
- package/dist/build/fw.pack.crypto-basic.pure.meta.json +6 -6
- package/dist/build/fw.pack.crypto-basic.pure.min.js +1 -1
- package/dist/build/fw.pack.crypto-identity.pure.meta.json +7 -6
- package/dist/build/fw.pack.crypto-identity.pure.min.js +4 -4
- package/dist/build/fw.pwa.pure.meta.json +7 -6
- package/dist/build/fw.pwa.pure.min.js +38 -35
- package/dist/build/fw.site-interactive.pure.meta.json +6 -6
- package/dist/build/fw.site-interactive.pure.min.js +37 -34
- package/dist/build/fw.site.pure.meta.json +6 -6
- package/dist/build/fw.site.pure.min.js +24 -21
- package/dist/build/fw.spa.pure.meta.json +8 -7
- package/dist/build/fw.spa.pure.min.js +41 -38
- package/dist/build/sanity-base-classic.min.js +1 -1
- package/dist/build/sanity.min.js +1 -1
- package/dist/types/core/internal.d.ts +29 -0
- package/dist/types/core/internal.d.ts.map +1 -0
- package/dist/types/core/logger.d.ts +23 -4
- package/dist/types/core/logger.d.ts.map +1 -1
- package/dist/types/core/modules.d.ts +374 -61
- package/dist/types/core/modules.d.ts.map +1 -1
- package/dist/types/core/runtime.d.ts +10 -6
- package/dist/types/core/runtime.d.ts.map +1 -1
- package/dist/types/core/worker-helper.d.ts +35 -0
- package/dist/types/core/worker-helper.d.ts.map +1 -1
- package/dist/types/crypto/cipher/aes.d.ts +1 -7
- package/dist/types/crypto/cipher/aes.d.ts.map +1 -1
- package/dist/types/crypto/cipher/chacha20.d.ts +0 -10
- package/dist/types/crypto/cipher/chacha20.d.ts.map +1 -1
- package/dist/types/crypto/hash/argon2.d.ts +0 -15
- package/dist/types/crypto/hash/argon2.d.ts.map +1 -1
- package/dist/types/crypto/hash/blake2b.d.ts.map +1 -1
- package/dist/types/crypto/hash/hmac.d.ts.map +1 -1
- package/dist/types/crypto/hash/pbkdf2.d.ts.map +1 -1
- package/dist/types/crypto/hash/poly1305.d.ts.map +1 -1
- package/dist/types/crypto/hash/sha224.d.ts +1 -1
- package/dist/types/crypto/hash/sha256.d.ts +4 -13
- package/dist/types/crypto/hash/sha256.d.ts.map +1 -1
- package/dist/types/crypto/hash/sha3.d.ts.map +1 -1
- package/dist/types/crypto/hash/sha384.d.ts +1 -1
- package/dist/types/crypto/hash/sha512.d.ts +4 -13
- package/dist/types/crypto/hash/sha512.d.ts.map +1 -1
- package/dist/types/crypto/mode/cmac.d.ts +0 -6
- package/dist/types/crypto/mode/cmac.d.ts.map +1 -1
- package/dist/types/crypto/mode/ctr.d.ts +0 -6
- package/dist/types/crypto/mode/ctr.d.ts.map +1 -1
- package/dist/types/crypto/mode/gcm.d.ts +0 -9
- package/dist/types/crypto/mode/gcm.d.ts.map +1 -1
- package/dist/types/crypto/pkc/ecc.d.ts +0 -1
- package/dist/types/crypto/pkc/ecc.d.ts.map +1 -1
- package/dist/types/crypto/pkc/ed25519.d.ts +4 -25
- package/dist/types/crypto/pkc/ed25519.d.ts.map +1 -1
- package/dist/types/crypto/pkc/hybridSign.d.ts +25 -5
- package/dist/types/crypto/pkc/hybridSign.d.ts.map +1 -1
- package/dist/types/crypto/pkc/ml_dsa.d.ts +6 -26
- package/dist/types/crypto/pkc/ml_dsa.d.ts.map +1 -1
- package/dist/types/crypto/pkc/ml_kem.d.ts +0 -43
- package/dist/types/crypto/pkc/ml_kem.d.ts.map +1 -1
- package/dist/types/crypto/pkc/rsa.d.ts +0 -24
- package/dist/types/crypto/pkc/rsa.d.ts.map +1 -1
- package/dist/types/crypto/pkc/slh_dsa.d.ts +6 -16
- package/dist/types/crypto/pkc/slh_dsa.d.ts.map +1 -1
- package/dist/types/crypto/pkc/x25519.d.ts +0 -6
- package/dist/types/crypto/pkc/x25519.d.ts.map +1 -1
- package/dist/types/crypto/utils/bitArray.d.ts +0 -8
- package/dist/types/crypto/utils/bitArray.d.ts.map +1 -1
- package/dist/types/crypto/utils/jws.d.ts +6 -14
- package/dist/types/crypto/utils/jws.d.ts.map +1 -1
- package/dist/types/crypto/utils/keyformat.d.ts +52 -0
- package/dist/types/crypto/utils/keyformat.d.ts.map +1 -1
- package/dist/types/crypto/utils/random.d.ts +1 -10
- package/dist/types/crypto/utils/random.d.ts.map +1 -1
- package/dist/types/crypto/utils/rsaKeygen.d.ts +0 -10
- package/dist/types/crypto/utils/rsaKeygen.d.ts.map +1 -1
- package/dist/types/crypto/utils/uuid.d.ts.map +1 -1
- package/dist/types/crypto/utils/x509.d.ts +397 -0
- package/dist/types/crypto/utils/x509.d.ts.map +1 -0
- package/dist/types/crypto/wasm/argon2.d.ts +2 -1
- package/dist/types/crypto/wasm/argon2.d.ts.map +1 -1
- package/dist/types/crypto/wasm/pbkdf2.d.ts +2 -2
- package/dist/types/crypto/wasm/pbkdf2.d.ts.map +1 -1
- package/dist/types/crypto/wasm/rsa.d.ts.map +1 -1
- package/dist/types/crypto/wasm/runtime.d.ts +13 -0
- package/dist/types/crypto/wasm/runtime.d.ts.map +1 -1
- package/dist/types/crypto/webcrypto/aes.d.ts.map +1 -1
- package/dist/types/crypto/webcrypto/aeskw.d.ts.map +1 -1
- package/dist/types/crypto/webcrypto/digest.d.ts +0 -4
- package/dist/types/crypto/webcrypto/digest.d.ts.map +1 -1
- package/dist/types/crypto/webcrypto/rsa.d.ts.map +1 -1
- package/dist/types/dom/fs/fileIntake.d.ts +59 -0
- package/dist/types/dom/fs/fileIntake.d.ts.map +1 -0
- package/dist/types/dom/fs/fsAccess.d.ts.map +1 -1
- package/dist/types/dom/query/dnd.d.ts.map +1 -1
- package/dist/types/dom/query/sound.d.ts +89 -0
- package/dist/types/dom/query/sound.d.ts.map +1 -0
- package/dist/types/dom/rendering/chart.d.ts.map +1 -1
- package/dist/types/dom/rendering/component.d.ts +9 -3
- package/dist/types/dom/rendering/component.d.ts.map +1 -1
- package/dist/types/dom/rendering/parser.d.ts +39 -0
- package/dist/types/dom/rendering/parser.d.ts.map +1 -1
- package/dist/types/dom/rendering/render.d.ts.map +1 -1
- package/dist/types/dom/rendering/sanitize.d.ts +4 -0
- package/dist/types/dom/rendering/sanitize.d.ts.map +1 -1
- package/dist/types/dom/rendering/secPolicy.d.ts.map +1 -1
- package/dist/types/dom/rendering/styleSheet.d.ts +74 -0
- package/dist/types/dom/rendering/styleSheet.d.ts.map +1 -0
- package/dist/types/dom/rendering/template.d.ts +9 -3
- package/dist/types/dom/rendering/template.d.ts.map +1 -1
- package/dist/types/dom/rendering/themeTokens.d.ts +9 -3
- package/dist/types/dom/rendering/themeTokens.d.ts.map +1 -1
- package/dist/types/dom/rendering/uiSession-core.d.ts +9 -3
- package/dist/types/dom/rendering/uiSession-core.d.ts.map +1 -1
- package/dist/types/dom/rendering/uiSession-list.d.ts +9 -3
- package/dist/types/dom/rendering/uiSession-list.d.ts.map +1 -1
- package/dist/types/dom/rendering/uiSession.d.ts +18 -6
- package/dist/types/dom/rendering/uiSession.d.ts.map +1 -1
- package/dist/types/dom/sw/installPrompt.d.ts +89 -0
- package/dist/types/dom/sw/installPrompt.d.ts.map +1 -0
- package/dist/types/dom/sw/precache.d.ts +149 -0
- package/dist/types/dom/sw/precache.d.ts.map +1 -0
- package/dist/types/dom/sw/swUpdate.d.ts +129 -0
- package/dist/types/dom/sw/swUpdate.d.ts.map +1 -0
- package/dist/types/dom/utils/clipboard.d.ts +8 -0
- package/dist/types/dom/utils/clipboard.d.ts.map +1 -1
- package/dist/types/dom/utils/keybindings.d.ts.map +1 -1
- package/dist/types/dom/utils/route.d.ts.map +1 -1
- package/dist/types/dom/utils/ua.d.ts +2 -2
- package/dist/types/dom/utils/ua.d.ts.map +1 -1
- package/dist/types/io/calc/crc32.d.ts.map +1 -1
- package/dist/types/io/codec/b64.d.ts +24 -0
- package/dist/types/io/codec/b64.d.ts.map +1 -1
- package/dist/types/io/codec/cbor.d.ts +1 -0
- package/dist/types/io/codec/cbor.d.ts.map +1 -1
- package/dist/types/io/codec/hex.d.ts.map +1 -1
- package/dist/types/io/codec/msgpack.d.ts +1 -0
- package/dist/types/io/codec/msgpack.d.ts.map +1 -1
- package/dist/types/io/codec/url.d.ts +3 -1
- package/dist/types/io/codec/url.d.ts.map +1 -1
- package/dist/types/io/codec/utf8.d.ts.map +1 -1
- package/dist/types/io/compress/bitstream.d.ts +1 -1
- package/dist/types/io/compress/brotli.d.ts +0 -1
- package/dist/types/io/compress/brotli.d.ts.map +1 -1
- package/dist/types/io/compress/brotli_shared.d.ts +0 -4
- package/dist/types/io/compress/brotli_shared.d.ts.map +1 -1
- package/dist/types/io/compress/deflate.d.ts +14 -1
- package/dist/types/io/compress/deflate.d.ts.map +1 -1
- package/dist/types/io/compress/gzip.d.ts +4 -0
- package/dist/types/io/compress/gzip.d.ts.map +1 -1
- package/dist/types/io/compress/huffman.d.ts +7 -0
- package/dist/types/io/compress/huffman.d.ts.map +1 -1
- package/dist/types/io/compress/lz4.d.ts +4 -2
- package/dist/types/io/compress/lz4.d.ts.map +1 -1
- package/dist/types/io/compress/lz77.d.ts +17 -0
- package/dist/types/io/compress/lz77.d.ts.map +1 -1
- package/dist/types/io/compress/lzw.d.ts +2 -0
- package/dist/types/io/compress/lzw.d.ts.map +1 -1
- package/dist/types/io/compress/zip.d.ts.map +1 -1
- package/dist/types/io/compress/zlib.d.ts +9 -2
- package/dist/types/io/compress/zlib.d.ts.map +1 -1
- package/dist/types/io/math/linalg.d.ts.map +1 -1
- package/dist/types/process/rpc.d.ts.map +1 -1
- package/dist/types/process/workerPool.d.ts.map +1 -1
- package/dist/types/sanity/base.d.ts +12 -2
- package/dist/types/sanity/base.d.ts.map +1 -1
- package/dist/types/sanity/lockdown.d.ts +6 -5
- package/dist/types/sanity/lockdown.d.ts.map +1 -1
- package/dist/types/sanity/wasm-gate.d.ts +1 -1
- package/docs/README.md +17 -10
- package/docs/api/README.md +5 -5
- package/docs/api/core/logger.md +2 -1
- package/docs/api/core/modules.md +3 -3
- package/docs/api/core/runtime.md +9 -9
- package/docs/api/core/worker-helper.md +12 -2
- package/docs/api/crypto/README.md +1 -1
- package/docs/api/crypto/cipher/README.md +2 -2
- package/docs/api/crypto/cipher/aes.md +5 -10
- package/docs/api/crypto/cipher/chacha20.md +3 -8
- package/docs/api/crypto/hash/README.md +5 -5
- package/docs/api/crypto/hash/adf.md +21 -11
- package/docs/api/crypto/hash/argon2.md +3 -12
- package/docs/api/crypto/hash/blake2b.md +12 -14
- package/docs/api/crypto/hash/pbkdf2.md +1 -1
- package/docs/api/crypto/hash/sha224.md +2 -2
- package/docs/api/crypto/hash/sha256.md +4 -4
- package/docs/api/crypto/hash/sha3.md +2 -2
- package/docs/api/crypto/hash/sha384.md +1 -1
- package/docs/api/crypto/hash/sha512.md +5 -5
- package/docs/api/crypto/hash/sha512_224.md +1 -1
- package/docs/api/crypto/hash/sha512_256.md +1 -1
- package/docs/api/crypto/mode/README.md +3 -3
- package/docs/api/crypto/mode/cbc.md +2 -2
- package/docs/api/crypto/mode/chacha20poly1305.md +1 -1
- package/docs/api/crypto/mode/cmac.md +4 -4
- package/docs/api/crypto/mode/ctr.md +2 -3
- package/docs/api/crypto/mode/gcm.md +5 -5
- package/docs/api/crypto/mode/kw.md +4 -4
- package/docs/api/crypto/pkc/README.md +8 -8
- package/docs/api/crypto/pkc/ecc.md +19 -17
- package/docs/api/crypto/pkc/ed25519.md +10 -15
- package/docs/api/crypto/pkc/hybridKem.md +8 -2
- package/docs/api/crypto/pkc/hybridSign.md +34 -7
- package/docs/api/crypto/pkc/ml_dsa.md +20 -19
- package/docs/api/crypto/pkc/ml_kem.md +3 -3
- package/docs/api/crypto/pkc/rsa.md +7 -9
- package/docs/api/crypto/pkc/slh_dsa.md +12 -12
- package/docs/api/crypto/pkc/x25519.md +5 -4
- package/docs/api/crypto/utils/README.md +7 -7
- package/docs/api/crypto/utils/aes_modes.md +2 -5
- package/docs/api/crypto/utils/asn1.md +25 -16
- package/docs/api/crypto/utils/jws.md +6 -4
- package/docs/api/crypto/utils/keyformat.md +24 -15
- package/docs/api/crypto/utils/pad.md +1 -1
- package/docs/api/crypto/utils/pem.md +3 -3
- package/docs/api/crypto/utils/random.md +3 -4
- package/docs/api/crypto/utils/rsaKeygen.md +2 -2
- package/docs/api/crypto/utils/totp.md +2 -2
- package/docs/api/crypto/utils/uuid.md +5 -5
- package/docs/api/crypto/utils/x509.md +124 -0
- package/docs/api/crypto/wasm/aes.md +1 -1
- package/docs/api/crypto/wasm/argon2.md +6 -4
- package/docs/api/crypto/wasm/ml_kem.md +1 -0
- package/docs/api/crypto/wasm/pbkdf2.md +8 -8
- package/docs/api/crypto/wasm/rsa.md +1 -1
- package/docs/api/crypto/wasm/runtime.md +27 -10
- package/docs/api/crypto/webcrypto/aes.md +1 -1
- package/docs/api/crypto/webcrypto/aeskw.md +2 -2
- package/docs/api/crypto/webcrypto/digest.md +3 -5
- package/docs/api/crypto/webcrypto/ecc.md +1 -1
- package/docs/api/crypto/webcrypto/ed25519.md +1 -1
- package/docs/api/crypto/webcrypto/rsa.md +3 -2
- package/docs/api/crypto/webcrypto/x25519.md +1 -1
- package/docs/api/dom/README.md +6 -1
- package/docs/api/dom/fs/README.md +1 -0
- package/docs/api/dom/fs/fileIntake.md +120 -0
- package/docs/api/dom/fs/fsAccess.md +1 -0
- package/docs/api/dom/fs/indexedDB.md +1 -1
- package/docs/api/dom/fs/storage.md +1 -1
- package/docs/api/dom/query/README.md +2 -1
- package/docs/api/dom/query/dnd.md +4 -1
- package/docs/api/dom/query/dom.md +5 -0
- package/docs/api/dom/query/sound.md +103 -0
- package/docs/api/dom/rendering/README.md +4 -3
- package/docs/api/dom/rendering/chart.md +5 -4
- package/docs/api/dom/rendering/component.md +25 -3
- package/docs/api/dom/rendering/parser.md +5 -2
- package/docs/api/dom/rendering/reactiveBind.md +1 -1
- package/docs/api/dom/rendering/render.md +2 -2
- package/docs/api/dom/rendering/sanitize.md +10 -2
- package/docs/api/dom/rendering/secPolicy.md +4 -4
- package/docs/api/dom/rendering/styleSheet.md +85 -0
- package/docs/api/dom/rendering/template.md +20 -5
- package/docs/api/dom/rendering/themeTokens.md +6 -3
- package/docs/api/dom/rendering/uiSession.md +18 -5
- package/docs/api/dom/rendering/virtualScroll.md +2 -2
- package/docs/api/dom/sensors/geolocation.md +1 -1
- package/docs/api/dom/sw/README.md +7 -1
- package/docs/api/dom/sw/cache.md +2 -1
- package/docs/api/dom/sw/installPrompt.md +111 -0
- package/docs/api/dom/sw/precache.md +124 -0
- package/docs/api/dom/sw/serviceWorker.md +4 -2
- package/docs/api/dom/sw/swUpdate.md +112 -0
- package/docs/api/dom/utils/clipboard.md +56 -5
- package/docs/api/dom/utils/entropyCollector.md +1 -1
- package/docs/api/dom/utils/keybindings.md +17 -2
- package/docs/api/dom/utils/leaderElection.md +2 -2
- package/docs/api/dom/utils/route.md +1 -0
- package/docs/api/dom/utils/ua.md +15 -10
- package/docs/api/io/calc/crc32.md +4 -1
- package/docs/api/io/codec/README.md +2 -2
- package/docs/api/io/codec/b64.md +31 -2
- package/docs/api/io/codec/buffer.md +1 -1
- package/docs/api/io/codec/cbor.md +6 -4
- package/docs/api/io/codec/csv.md +178 -178
- package/docs/api/io/codec/hex.md +10 -2
- package/docs/api/io/codec/msgpack.md +4 -3
- package/docs/api/io/codec/url.md +4 -3
- package/docs/api/io/codec/utf8.md +3 -3
- package/docs/api/io/compress/bitstream.md +6 -3
- package/docs/api/io/compress/brotli.md +36 -4
- package/docs/api/io/compress/brotli_shared.md +1 -1
- package/docs/api/io/compress/deflate.md +42 -34
- package/docs/api/io/compress/gzip.md +26 -6
- package/docs/api/io/compress/huffman.md +2 -1
- package/docs/api/io/compress/lz4.md +5 -3
- package/docs/api/io/compress/lz77.md +26 -3
- package/docs/api/io/compress/lzw.md +13 -8
- package/docs/api/io/compress/zip.md +36 -10
- package/docs/api/io/compress/zlib.md +21 -5
- package/docs/api/io/math/linalg.md +1 -1
- package/docs/api/io/utils/valid.md +1 -1
- package/docs/api/process/rpc.md +3 -2
- package/docs/api/process/workerPool.md +1 -1
- package/docs/api/sanity/base.md +9 -5
- package/docs/api/sanity/lockdown.md +7 -6
- package/docs/api/surface.json +12311 -0
- package/docs/api/typed.md +5 -3
- package/docs/dev/README.md +2 -0
- package/docs/dev/bench.md +76 -0
- package/docs/dev/crypto-references.md +54 -0
- package/docs/dev/provenance.md +30 -7
- package/docs/dev/publishing.md +7 -7
- package/docs/dev/runtime.md +1 -1
- package/docs/dev/testing.md +13 -0
- package/docs/evidence/l4-evidence.md +86 -0
- package/docs/evidence/pqc-hybrid-evidence.md +7 -6
- package/docs/guide/README.md +1 -0
- package/docs/guide/_QUICK_REF.md +5 -5
- package/docs/guide/doc-format.md +4 -3
- package/docs/guide/integrations-hmr.md +1 -1
- package/docs/guide/module-creation-workflow.md +8 -8
- package/docs/guide/rendering-pipeline.md +11 -4
- package/docs/guide/security.md +7 -5
- package/docs/guide/stability.md +123 -0
- package/docs/guide/tutorial-todo.md +20 -8
- package/docs/guide/typescript.md +9 -0
- package/docs/guide/worker-confinement.md +30 -17
- package/docs/notes/lz77-deflate-factorization.md +3 -3
- package/docs/tools/README.md +1 -1
- package/docs/tools/bundler.md +3 -3
- package/docs/tools/codegen.md +1 -1
- package/docs/tools/standalone.md +0 -1
- package/fw.config.json +2 -2
- package/integrations/_shared/catalog.generated.json +7 -1
- package/integrations/_shared/core.js +1 -1
- package/integrations/astro/index.js +1 -1
- package/integrations/eslint/README.md +7 -1
- package/integrations/nextjs/index.js +1 -1
- package/integrations/nodejs/README.md +3 -3
- package/integrations/turbopack/index.js +2 -2
- package/integrations/typedoc/categorize.js +1 -1
- package/integrations/typedoc/typedoc.json +2 -1
- package/integrations/vite/index.js +2 -2
- package/integrations/vite/vite-env.d.ts +7 -4
- package/integrations/webpack/index.js +3 -3
- package/package.json +76 -10
- package/src/core/internal.js +31 -0
- package/src/core/logger.js +95 -23
- package/src/core/modules.js +17 -8
- package/src/core/readyState.js +1 -1
- package/src/core/runtime.js +74 -27
- package/src/core/worker-helper.js +83 -4
- package/src/crypto/NIST_CONFORMANCE.md +47 -34
- package/src/crypto/cipher/aes.acvp.md +7 -8
- package/src/crypto/cipher/aes.js +280 -229
- package/src/crypto/cipher/chacha20.acvp.md +6 -7
- package/src/crypto/cipher/chacha20.js +91 -61
- package/src/crypto/hash/adf.js +1 -1
- package/src/crypto/hash/argon2.acvp.md +11 -15
- package/src/crypto/hash/argon2.js +9 -24
- package/src/crypto/hash/blake2b.js +157 -125
- package/src/crypto/hash/hkdf.acvp.md +15 -15
- package/src/crypto/hash/hkdf.js +1 -1
- package/src/crypto/hash/hmac.acvp.md +10 -12
- package/src/crypto/hash/hmac.js +5 -1
- package/src/crypto/hash/pbkdf2.acvp.md +13 -13
- package/src/crypto/hash/pbkdf2.js +36 -8
- package/src/crypto/hash/poly1305.acvp.md +10 -6
- package/src/crypto/hash/poly1305.js +171 -50
- package/src/crypto/hash/sha224.acvp.md +3 -3
- package/src/crypto/hash/sha224.js +4 -4
- package/src/crypto/hash/sha256.acvp.md +2 -2
- package/src/crypto/hash/sha256.js +514 -50
- package/src/crypto/hash/sha3.acvp.md +9 -9
- package/src/crypto/hash/sha3.js +127 -71
- package/src/crypto/hash/sha384.acvp.md +3 -3
- package/src/crypto/hash/sha384.js +4 -4
- package/src/crypto/hash/sha512.acvp.md +7 -8
- package/src/crypto/hash/sha512.js +107 -108
- package/src/crypto/hash/sha512_224.acvp.md +6 -6
- package/src/crypto/hash/sha512_224.js +2 -2
- package/src/crypto/hash/sha512_256.acvp.md +6 -6
- package/src/crypto/hash/sha512_256.js +2 -2
- package/src/crypto/mode/cbc.acvp.md +2 -2
- package/src/crypto/mode/cbc.js +1 -1
- package/src/crypto/mode/chacha20poly1305.acvp.md +6 -6
- package/src/crypto/mode/chacha20poly1305.js +3 -3
- package/src/crypto/mode/cmac.acvp.md +5 -5
- package/src/crypto/mode/cmac.js +8 -8
- package/src/crypto/mode/ctr.acvp.md +2 -2
- package/src/crypto/mode/ctr.js +1 -3
- package/src/crypto/mode/gcm.acvp.md +6 -6
- package/src/crypto/mode/gcm.js +7 -7
- package/src/crypto/mode/kw.acvp.md +4 -4
- package/src/crypto/mode/kw.js +5 -5
- package/src/crypto/pkc/ecc.acvp.md +13 -13
- package/src/crypto/pkc/ecc.js +9 -11
- package/src/crypto/pkc/ed25519.acvp.md +30 -34
- package/src/crypto/pkc/ed25519.js +453 -94
- package/src/crypto/pkc/hybrid-kat.provenance.md +4 -4
- package/src/crypto/pkc/hybridSign.js +103 -24
- package/src/crypto/pkc/ml_dsa.acvp.md +18 -18
- package/src/crypto/pkc/ml_dsa.js +29 -32
- package/src/crypto/pkc/ml_kem.acvp.md +7 -7
- package/src/crypto/pkc/ml_kem.js +15 -21
- package/src/crypto/pkc/rsa.acvp.md +11 -15
- package/src/crypto/pkc/rsa.js +7 -44
- package/src/crypto/pkc/slh_dsa.acvp.md +16 -16
- package/src/crypto/pkc/slh_dsa.js +16 -18
- package/src/crypto/pkc/x25519.acvp.md +13 -10
- package/src/crypto/pkc/x25519.js +273 -29
- package/src/crypto/utils/aes_modes.acvp.md +1 -2
- package/src/crypto/utils/aes_modes.js +2 -2
- package/src/crypto/utils/asn1-oid.js +1 -1
- package/src/crypto/utils/asn1.js +1 -1
- package/src/crypto/utils/bitArray.js +33 -48
- package/src/crypto/utils/bn.js +1 -1
- package/src/crypto/utils/jws.js +37 -41
- package/src/crypto/utils/keyformat.js +181 -2
- package/src/crypto/utils/pem.js +1 -1
- package/src/crypto/utils/random.acvp.md +5 -5
- package/src/crypto/utils/random.js +845 -846
- package/src/crypto/utils/rsaKeygen.acvp.md +3 -2
- package/src/crypto/utils/rsaKeygen.js +6 -6
- package/src/crypto/utils/totp.js +1 -1
- package/src/crypto/utils/uuid.acvp.md +5 -5
- package/src/crypto/utils/uuid.js +11 -10
- package/src/crypto/utils/x509.js +591 -0
- package/src/crypto/wasm/aes.js +1 -1
- package/src/crypto/wasm/aes.scalar.wasm +0 -0
- package/src/crypto/wasm/argon2.js +17 -1
- package/src/crypto/wasm/argon2.scalar.wasm +0 -0
- package/src/crypto/wasm/blake2b.scalar.wasm +0 -0
- package/src/crypto/wasm/blake2b.simd.wasm +0 -0
- package/src/crypto/wasm/chacha20poly1305.scalar.wasm +0 -0
- package/src/crypto/wasm/chacha20poly1305.simd.wasm +0 -0
- package/src/crypto/wasm/cmac.scalar.wasm +0 -0
- package/src/crypto/wasm/ecc.js +3 -3
- package/src/crypto/wasm/ecc.scalar.wasm +0 -0
- package/src/crypto/wasm/ed25519.js +1 -1
- package/src/crypto/wasm/ed25519.scalar.wasm +0 -0
- package/src/crypto/wasm/hkdf.scalar.wasm +0 -0
- package/src/crypto/wasm/hmac.scalar.wasm +0 -0
- package/src/crypto/wasm/ml_dsa.js +2 -2
- package/src/crypto/wasm/ml_dsa.scalar.wasm +0 -0
- package/src/crypto/wasm/ml_dsa.simd.wasm +0 -0
- package/src/crypto/wasm/ml_kem.js +2 -2
- package/src/crypto/wasm/ml_kem.scalar.wasm +0 -0
- package/src/crypto/wasm/ml_kem.simd.wasm +0 -0
- package/src/crypto/wasm/pbkdf2.js +8 -6
- package/src/crypto/wasm/pbkdf2.scalar.wasm +0 -0
- package/src/crypto/wasm/rsa.js +6 -5
- package/src/crypto/wasm/rsa.scalar.wasm +0 -0
- package/src/crypto/wasm/runtime.js +84 -17
- package/src/crypto/wasm/sha2.scalar.wasm +0 -0
- package/src/crypto/wasm/sha3.scalar.wasm +0 -0
- package/src/crypto/wasm/sha3.simd.wasm +0 -0
- package/src/crypto/wasm/slh_dsa.js +1 -1
- package/src/crypto/wasm/slh_dsa.scalar.wasm +0 -0
- package/src/crypto/wasm/x25519.js +1 -1
- package/src/crypto/wasm/x25519.scalar.wasm +0 -0
- package/src/crypto/webcrypto/aes.js +8 -2
- package/src/crypto/webcrypto/aeskw.js +7 -2
- package/src/crypto/webcrypto/digest.js +1 -15
- package/src/crypto/webcrypto/ecc.js +2 -2
- package/src/crypto/webcrypto/ed25519.js +2 -2
- package/src/crypto/webcrypto/hmac.js +2 -2
- package/src/crypto/webcrypto/rsa.js +7 -2
- package/src/crypto/webcrypto/x25519.js +2 -2
- package/src/dom/display/animate.js +1 -1
- package/src/dom/display/fullscreen.js +1 -1
- package/src/dom/fs/download.js +1 -1
- package/src/dom/fs/fileIntake.js +192 -0
- package/src/dom/fs/fsAccess.js +2 -3
- package/src/dom/fs/indexedDB.js +1 -1
- package/src/dom/fs/remoteStore.js +1 -1
- package/src/dom/fs/storage.js +1 -1
- package/src/dom/lifecycle/idle.js +1 -1
- package/src/dom/lifecycle/visibility.js +1 -1
- package/src/dom/lifecycle/wakeLock.js +1 -1
- package/src/dom/net/ajax.js +1 -1
- package/src/dom/net/network.js +1 -1
- package/src/dom/net/sse.js +1 -1
- package/src/dom/net/webrtc.js +1 -1
- package/src/dom/net/ws.js +1 -1
- package/src/dom/query/dnd.js +56 -4
- package/src/dom/query/dom.js +1 -1
- package/src/dom/query/events.js +1 -1
- package/src/dom/query/gesture.js +1 -1
- package/src/dom/query/media.js +1 -1
- package/src/dom/query/sound.js +333 -0
- package/src/dom/rendering/chart.js +736 -663
- package/src/dom/rendering/component.js +25 -14
- package/src/dom/rendering/devtools.js +2 -2
- package/src/dom/rendering/parser.js +155 -12
- package/src/dom/rendering/render.js +14 -4
- package/src/dom/rendering/sanitize.js +11 -4
- package/src/dom/rendering/secPolicy.js +6 -4
- package/src/dom/rendering/styleSheet.js +217 -0
- package/src/dom/rendering/template.js +72 -13
- package/src/dom/rendering/themeTokens.js +542 -522
- package/src/dom/rendering/uiSession-core.js +51 -6
- package/src/dom/rendering/uiSession-direct.js +1 -1
- package/src/dom/rendering/uiSession-list.js +4 -4
- package/src/dom/rendering/uiSession.js +1 -1
- package/src/dom/rendering/virtualScroll.js +341 -341
- package/src/dom/sensors/battery.js +1 -1
- package/src/dom/sensors/geolocation.js +1 -1
- package/src/dom/sensors/networkInfo.js +1 -1
- package/src/dom/sensors/sensors.js +1 -1
- package/src/dom/sw/backgroundSync.js +1 -1
- package/src/dom/sw/cache.js +1 -1
- package/src/dom/sw/installPrompt.js +151 -0
- package/src/dom/sw/precache.js +257 -0
- package/src/dom/sw/push.js +1 -1
- package/src/dom/sw/sharedWorker.js +1 -1
- package/src/dom/sw/swUpdate.js +239 -0
- package/src/dom/utils/a11y.js +1 -1
- package/src/dom/utils/clipboard.js +56 -6
- package/src/dom/utils/entropyCollector.js +1 -1
- package/src/dom/utils/focus.js +1 -1
- package/src/dom/utils/form.js +1 -1
- package/src/dom/utils/keybindings.js +600 -574
- package/src/dom/utils/leaderElection.js +1 -1
- package/src/dom/utils/notifications.js +1 -1
- package/src/dom/utils/permissions.js +107 -107
- package/src/dom/utils/route.js +14 -2
- package/src/dom/utils/ua.js +42 -28
- package/src/dom/utils/webauthn.js +1 -1
- package/src/io/binary/reader.js +1 -1
- package/src/io/binary/writer.js +1 -1
- package/src/io/calc/bigint.js +1 -1
- package/src/io/calc/crc32.js +28 -2
- package/src/io/calc/easing.js +514 -514
- package/src/io/codec/b64.js +189 -52
- package/src/io/codec/base32.js +1 -1
- package/src/io/codec/base58.js +1 -1
- package/src/io/codec/buffer.js +1 -1
- package/src/io/codec/cbor.js +111 -18
- package/src/io/codec/csv.js +1 -1
- package/src/io/codec/hex.js +51 -6
- package/src/io/codec/mime.js +1 -1
- package/src/io/codec/msgpack.js +47 -6
- package/src/io/codec/url.js +24 -7
- package/src/io/codec/utf8.js +5 -3
- package/src/io/codec/xml.js +1 -1
- package/src/io/compress/bitstream.js +2 -2
- package/src/io/compress/brotli.js +663 -163
- package/src/io/compress/brotli_dict.js +1 -1
- package/src/io/compress/brotli_dict_words.js +1 -1
- package/src/io/compress/brotli_frame.js +1 -1
- package/src/io/compress/brotli_shared.js +7 -7
- package/src/io/compress/deflate.js +87 -53
- package/src/io/compress/gzip.js +187 -74
- package/src/io/compress/huffman.js +24 -1
- package/src/io/compress/lz4.js +45 -7
- package/src/io/compress/lz77.js +148 -63
- package/src/io/compress/lzw.js +35 -19
- package/src/io/compress/zip.js +862 -815
- package/src/io/compress/zlib.js +87 -7
- package/src/io/i18n/i18n.js +1 -1
- package/src/io/math/fixed-point.js +1 -1
- package/src/io/math/geom.js +1 -1
- package/src/io/math/interp.js +1 -1
- package/src/io/math/linalg.js +10 -4
- package/src/io/math/stats.js +1 -1
- package/src/io/structures/btree.js +1 -1
- package/src/io/structures/heap.js +1 -1
- package/src/io/structures/lruCache.js +1 -1
- package/src/io/structures/ringBuffer.js +1 -1
- package/src/io/structures/tree-walker.js +1 -1
- package/src/io/structures/trie.js +1 -1
- package/src/io/sync/abort.js +1 -1
- package/src/io/sync/atomics.js +1 -1
- package/src/io/sync/cancellable.js +1 -1
- package/src/io/sync/channel.js +1 -1
- package/src/io/sync/mutex.js +1 -1
- package/src/io/sync/semaphore.js +1 -1
- package/src/io/sync/tokenBucket.js +1 -1
- package/src/io/text/ansi.js +1 -1
- package/src/io/text/html-entities.js +1 -1
- package/src/io/time/date.js +1 -1
- package/src/io/timing/clock.js +1 -1
- package/src/io/timing/rateLimit.js +1 -1
- package/src/io/timing/scheduler.js +1 -1
- package/src/io/utils/errors.js +1 -1
- package/src/io/utils/eventBus.js +1 -1
- package/src/io/utils/signal.js +1 -1
- package/src/io/utils/valid.js +1 -1
- package/src/main.js +1 -1
- package/src/process/message.js +1 -1
- package/src/process/rpc.js +7 -3
- package/src/process/workerPool.js +11 -4
- package/src/sanity/base.js +85 -39
- package/src/sanity/lockdown-apply.js +3 -3
- package/src/sanity/lockdown.js +58 -32
- package/src/sanity/wasm-gate.js +2 -2
- package/src/typed.js +7 -3
- package/third-party/NOTICE-brotli-dictionary.txt +69 -0
- package/third-party/NOTICE-fw-wasm-crypto.txt +576 -0
- package/third-party/NOTICE-whatwg-entities.txt +44 -0
- package/types/registry.generated.d.ts +7 -1
- package/types/typed.d.ts +7 -3
- package/dist/types/crypto/utils/aes_ctr.d.ts +0 -84
- package/dist/types/crypto/utils/aes_ctr.d.ts.map +0 -1
- package/docs/api/crypto/utils/aes_ctr.md +0 -71
- package/src/crypto/utils/aes_ctr.acvp.md +0 -67
- package/src/crypto/utils/aes_ctr.js +0 -134
|
@@ -22,14 +22,14 @@ const deflate = runtime.resolve('deflate');
|
|
|
22
22
|
|
|
23
23
|
## API
|
|
24
24
|
|
|
25
|
-
###
|
|
25
|
+
### Synchronous
|
|
26
26
|
|
|
27
27
|
```js
|
|
28
28
|
const compressed = deflate.deflateSync(uint8Array, opts?); // → Uint8Array
|
|
29
29
|
const decompressed = deflate.inflateSync(compressed, opts?); // → Uint8Array
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
-
###
|
|
32
|
+
### Asynchronous
|
|
33
33
|
|
|
34
34
|
```js
|
|
35
35
|
const compressed = await deflate.deflate(uint8Array, opts?); // → Uint8Array
|
|
@@ -60,6 +60,12 @@ stream.push(compressedChunk);
|
|
|
60
60
|
stream.push(lastChunk, true);
|
|
61
61
|
```
|
|
62
62
|
|
|
63
|
+
Where the deflate stream ends — what a container (a gzip member, a zlib
|
|
64
|
+
trailer) needs to read on: `inflateSync(data, { onEnd(byteLength) })` calls
|
|
65
|
+
`onEnd` with the input bytes the stream used; on a stream, `ended` turns
|
|
66
|
+
`true` once the final block is decoded and `rest()` returns the bytes pushed
|
|
67
|
+
after it (`null` before).
|
|
68
|
+
|
|
63
69
|
## Options
|
|
64
70
|
|
|
65
71
|
### Compression
|
|
@@ -80,6 +86,7 @@ The same options reach `deflate` through `gzip`, `zlib` and `zip`, so
|
|
|
80
86
|
|--------|------|-------------|
|
|
81
87
|
| `out` | `Uint8Array` | Pre-allocated output buffer |
|
|
82
88
|
| `dictionary` | `Uint8Array` | Dictionary matching the compression |
|
|
89
|
+
| `maxOutput` | `number` | Cap, in bytes, on the decoded output (a non-negative integer; absent = no cap). One byte more throws `EMAXOUT` (errno 7) before the buffer grows past the cap — the bound against a decompression bomb. On `InflateStream` it caps the stream's total. The dictionary does not count |
|
|
83
90
|
|
|
84
91
|
## Error codes
|
|
85
92
|
|
|
@@ -87,15 +94,20 @@ Every error thrown by this module is an `Error` carrying a numeric `e.code`.
|
|
|
87
94
|
The table lists the complete set — verified against the `fail()` call sites in
|
|
88
95
|
`deflate.js`.
|
|
89
96
|
|
|
90
|
-
|
|
|
91
|
-
|
|
92
|
-
| 0 | `unexpected EOF` | the input ends inside a block header, a symbol, or a stored body (one-shot decoding, or a stream closed with `final = true`) |
|
|
93
|
-
| 1 | `invalid block type` | `BTYPE = 3` (RFC 1951 §3.2.3 reserved value) |
|
|
94
|
-
| 2 | `invalid length/literal` | a literal/length code has no entry in the active table, or a length symbol above 285 is read |
|
|
95
|
-
| 3 | `invalid distance` | a distance code has no entry, a distance symbol above 29 is read, or the distance reaches back before the start of the output (dictionary included) |
|
|
96
|
-
| 4 | `stream finished` | `push()` after the chunk marked `final` |
|
|
97
|
-
| 5 | `no stream handler` | `push()` on a stream constructed without `ondata` |
|
|
98
|
-
|
|
|
97
|
+
| `code` | `errno` | Message | Raised when |
|
|
98
|
+
|---|------|---------|-------------|
|
|
99
|
+
| `EEOF` | 0 | `unexpected EOF` | the input ends inside a block header, a symbol, or a stored body (one-shot decoding, or a stream closed with `final = true`) |
|
|
100
|
+
| `EBADBLOCK` | 1 | `invalid block type` | `BTYPE = 3` (RFC 1951 §3.2.3 reserved value) |
|
|
101
|
+
| `EBADSYMBOL` | 2 | `invalid length/literal` | a literal/length code has no entry in the active table, or a length symbol above 285 is read |
|
|
102
|
+
| `EBADDISTANCE` | 3 | `invalid distance` | a distance code has no entry, a distance symbol above 29 is read, or the distance reaches back before the start of the output (dictionary included) |
|
|
103
|
+
| `ESTREAMEND` | 4 | `stream finished` | `push()` after the chunk marked `final` |
|
|
104
|
+
| `ENOHANDLER` | 5 | `no stream handler` | `push()` on a stream constructed without `ondata` |
|
|
105
|
+
| `EMAXOUT` | 7 | `output limit exceeded` | the decoded output would pass `maxOutput` |
|
|
106
|
+
| `EBADSTREAM` | 8 | `invalid data` | a malformed dynamic header, a stored-block `LEN`/`NLEN` mismatch, or an overflow of the caller-provided `out` buffer (the message states which) |
|
|
107
|
+
|
|
108
|
+
`e.code` is the string in the first column; `e.errno` keeps the number of the
|
|
109
|
+
earlier convention (the compressor family's one typed convention, shared
|
|
110
|
+
with brotli).
|
|
99
111
|
|
|
100
112
|
Codes 12 and 13 belong to [gzip](./gzip.md) and [zip](./zip.md); `deflate`
|
|
101
113
|
never emits them.
|
|
@@ -135,7 +147,7 @@ with zeros, so an overrun is detected by POSITION, never by an exception:
|
|
|
135
147
|
`bitPos` is snapshotted before each block header and before each symbol, and a
|
|
136
148
|
read that lands past `input.length * 8` — or a table lookup that returns entry
|
|
137
149
|
`0` while fewer than `maxBits` bits remain — restores the snapshot. In
|
|
138
|
-
one-shot mode that condition fails with
|
|
150
|
+
one-shot mode that condition fails with `EEOF`; in stream mode it returns
|
|
139
151
|
"need input", `InflateStream` keeps the bytes from the last consumed byte
|
|
140
152
|
boundary, and the next `push` re-reads from the snapshot (a partially read
|
|
141
153
|
dynamic header is simply re-parsed, which is bounded by the header size).
|
|
@@ -145,7 +157,7 @@ back-reference window.
|
|
|
145
157
|
**Output growth.** Without `opts.out` the buffer starts at
|
|
146
158
|
`max(64 KiB, 3 × input.length)` and doubles on demand; the result is a
|
|
147
159
|
copy trimmed to the exact length. With `opts.out` the decoder writes directly
|
|
148
|
-
into the caller's buffer, returns a view into it, and raises
|
|
160
|
+
into the caller's buffer, returns a view into it, and raises `EBADSTREAM` rather
|
|
149
161
|
than growing. `opts.dictionary` primes the output with the dictionary's last
|
|
150
162
|
32 KiB so back-references into it are ordinary in-buffer copies; combined with
|
|
151
163
|
`opts.out`, decoding runs in an internal buffer and the payload alone is
|
|
@@ -153,7 +165,7 @@ copied across at the end.
|
|
|
153
165
|
|
|
154
166
|
**Known limitation.** An over-subscribed or incomplete dynamic Huffman code is
|
|
155
167
|
not validated when the header is read. Such a stream is not silently accepted:
|
|
156
|
-
decoding proceeds and ends in
|
|
168
|
+
decoding proceeds and ends in `EBADSYMBOL`, `EBADDISTANCE` or `EBADSTREAM` as soon as a hole in
|
|
157
169
|
the table is hit.
|
|
158
170
|
|
|
159
171
|
### Encoder
|
|
@@ -163,7 +175,7 @@ RFC 1951 as well. Its matching pass is the shared [lz77](./lz77.md) module —
|
|
|
163
175
|
`deflate` owns only the DEFLATE-specific parts: the symbol mapping of §3.2.5,
|
|
164
176
|
the block-type decision, and the canonical Huffman coding of §3.2.6/§3.2.7.
|
|
165
177
|
|
|
166
|
-
**Matching.** `lz77.
|
|
178
|
+
**Matching.** One `lz77.createScanner` per compression unit, with
|
|
167
179
|
`windowBits: 15`, `minMatch: 3`, `maxMatch: 258` and an injected `hashFn` —
|
|
168
180
|
the 3-byte Fibonacci hash
|
|
169
181
|
`imul(d[i] | d[i+1] << 8 | d[i+2] << 16, 0x9E3779B1) >>> (32 - hashBits)`,
|
|
@@ -206,10 +218,9 @@ other — noise, so one loop and one option rather than two scan functions.
|
|
|
206
218
|
`min(22, 12 + mem)` bits wide; without it the width tracks the input size,
|
|
207
219
|
`clamp(ceil(log2(inputLength)), 12, 20)`.
|
|
208
220
|
|
|
209
|
-
**Blocks and cost.** The
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
buffer, tallied in one pass into the literal/length and distance
|
|
221
|
+
**Blocks and cost.** The scanner of a compression unit fills one buffer
|
|
222
|
+
of 16 384 packed `(len | 0, dist | byte)` pairs per block, read in place:
|
|
223
|
+
the block is tallied in one pass into the literal/length and distance
|
|
213
224
|
frequencies and the total of extra bits, then written; the tail block
|
|
214
225
|
carries `BFINAL`. The pairs are never copied into a second layout. For each
|
|
215
226
|
block three exact bit costs are computed and the cheapest wins:
|
|
@@ -232,12 +243,12 @@ fixed block — the two bytes `03 00`.
|
|
|
232
243
|
`BLOCK_TOKENS` stays at 16 384: `huffman.buildTree` uses a frequency
|
|
233
244
|
sentinel of 25 001, so a block's symbol total must stay below it.
|
|
234
245
|
|
|
235
|
-
**Memory.** The
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
`
|
|
246
|
+
**Memory.** The encoder holds one block of tokens — a 128 KiB buffer of
|
|
247
|
+
`2 × BLOCK_TOKENS` entries, shared by every call — plus the scan's hash
|
|
248
|
+
table (`2^hashBits` entries) and chain links (one per window position),
|
|
249
|
+
whatever the input size. `deflateSync` on N bytes used to
|
|
250
|
+
hold `8 × N` bytes of tokens until it returned: 256 MiB for a 32 MiB
|
|
251
|
+
input. `DeflateStream` compresses in 64 KiB units.
|
|
241
252
|
|
|
242
253
|
**Streaming.** `DeflateStream` keeps the last 32 KiB of input as a window and
|
|
243
254
|
buffers pushes until 64 KiB or `final`, then compresses `window ++ pending`
|
|
@@ -249,9 +260,8 @@ fall is not part of it, and they differ from the pre-batch engine's.
|
|
|
249
260
|
|
|
250
261
|
## Benchmark
|
|
251
262
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
master HEAD`), with the batch's exact command:
|
|
263
|
+
Measured on the merged tree, baseline sha `b10c8a6da43e8c598645d097a678c38249ddebbc` (`git merge-base
|
|
264
|
+
master HEAD`), with this command:
|
|
255
265
|
|
|
256
266
|
```
|
|
257
267
|
bun packages/front/fw/tools/bench/deflate-levels.js \
|
|
@@ -305,15 +315,13 @@ disappears when level 4 runs alone or in a directory-to-directory
|
|
|
305
315
|
interleaved comparison — there this engine is byte-identical to the
|
|
306
316
|
analysis' `p6nl` prototype at every cell and within ±1 % of its time — and
|
|
307
317
|
is unrelated to the engine change. Read the aggregates, not the cells; a
|
|
308
|
-
finer per-corpus verdict needs interleaved A/B repetitions
|
|
309
|
-
|
|
310
|
-
perimeter excludes the bench tool).
|
|
318
|
+
finer per-corpus verdict needs interleaved A/B repetitions, which the bench
|
|
319
|
+
tool does not run yet.
|
|
311
320
|
|
|
312
321
|
### `{ lazy: true }` (same engine, lazy matching on) — supplementary, not gated
|
|
313
322
|
|
|
314
|
-
Measured separately
|
|
315
|
-
|
|
316
|
-
configuration above).
|
|
323
|
+
Measured separately at `--warmup 15 --reps 11` (not re-run with the gate
|
|
324
|
+
above, which covers the default configuration only).
|
|
317
325
|
|
|
318
326
|
| Level | Old ms | New ms | Δtime | Old bytes | New bytes | Δbytes |
|
|
319
327
|
|---|---|---|---|---|---|---|
|
|
@@ -22,14 +22,14 @@ const gzip = runtime.resolve('gzip');
|
|
|
22
22
|
|
|
23
23
|
## API
|
|
24
24
|
|
|
25
|
-
###
|
|
25
|
+
### Synchronous
|
|
26
26
|
|
|
27
27
|
```js
|
|
28
28
|
const compressed = gzip.gzipSync(uint8Array, opts?); // → Uint8Array
|
|
29
29
|
const decompressed = gzip.gunzipSync(compressed, opts?); // → Uint8Array
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
-
###
|
|
32
|
+
### Asynchronous
|
|
33
33
|
|
|
34
34
|
```js
|
|
35
35
|
const compressed = await gzip.gzip(uint8Array, opts?);
|
|
@@ -47,7 +47,7 @@ comp.push(lastChunk, true);
|
|
|
47
47
|
|
|
48
48
|
// Decompression
|
|
49
49
|
const output = [];
|
|
50
|
-
const decomp = new gzip.GunzipStream(opts?, (chunk) => output.push(chunk));
|
|
50
|
+
const decomp = new gzip.GunzipStream(opts?, (chunk) => output.push(chunk)); // flush() as for zlib
|
|
51
51
|
decomp.push(gzChunk);
|
|
52
52
|
decomp.push(lastGzChunk, true);
|
|
53
53
|
```
|
|
@@ -62,12 +62,20 @@ decomp.push(lastGzChunk, true);
|
|
|
62
62
|
| `filename` | `string` | Original filename (stored in the header) |
|
|
63
63
|
| `mtime` | `number \| Date` | Modification date (stored in the header) |
|
|
64
64
|
|
|
65
|
+
`flush()` ends the stream when no trailer can be expected (a source that may
|
|
66
|
+
be truncated, such as a PDF FlateDecode stream): the last bytes, held back
|
|
67
|
+
until then as a presumed trailer, are decoded as payload and emitted. A
|
|
68
|
+
`push` after `flush()` (or after `final`) throws `ESTREAMEND` (errno 4). A header split
|
|
69
|
+
across chunks is fine: the stream waits until the whole header has arrived.
|
|
70
|
+
|
|
65
71
|
### Decompression (`gunzipSync`, `gunzip`, `GunzipStream`)
|
|
66
72
|
|
|
67
73
|
| Option | Type | Description |
|
|
68
74
|
|--------|------|-------------|
|
|
69
75
|
| `out` | `Uint8Array` | Pre-allocated output buffer |
|
|
70
76
|
| `dictionary` | `Uint8Array` | Decompression dictionary |
|
|
77
|
+
| `maxOutput` | `number` | Cap, in bytes, on the decoded output (a non-negative integer; absent = no cap). One byte more throws `EMAXOUT` (errno 7) before the buffer grows past the cap — the bound against a decompression bomb. It holds over every member, and on `GunzipStream` over the stream's life |
|
|
78
|
+
| `verify` | `boolean` | Check the CRC-32 and ISIZE trailer against the decoded bytes (RFC 1952 § 2.3.1); a mismatch throws `ECHECKSUM` (errno 16). Default `true`; `false` skips the check |
|
|
71
79
|
|
|
72
80
|
## Internal format (RFC 1952)
|
|
73
81
|
|
|
@@ -77,11 +85,23 @@ decomp.push(lastGzChunk, true);
|
|
|
77
85
|
|
|
78
86
|
Header: magic `0x1F 0x8B`, method `0x08`, flags, mtime, XFL, OS (`3` = Unix).
|
|
79
87
|
|
|
88
|
+
A gzip file is a series of members (RFC 1952 § 2.2): `gunzipSync` and
|
|
89
|
+
`GunzipStream` decode every member and return their concatenation (each
|
|
90
|
+
member's trailer is checked, unless `verify: false`). Zero bytes after the last
|
|
91
|
+
member are ignored; any other trailing byte throws `EBADFORMAT` (errno 6), and a member cut
|
|
92
|
+
short throws `EEOF` (errno 0).
|
|
93
|
+
|
|
80
94
|
## Error codes
|
|
81
95
|
|
|
82
|
-
|
|
|
83
|
-
|
|
84
|
-
| 6 | Invalid gzip data (incorrect magic bytes) |
|
|
96
|
+
| `code` | `errno` | Meaning |
|
|
97
|
+
|---|------|---------|
|
|
98
|
+
| `EBADFORMAT` | 6 | Invalid gzip data (incorrect magic bytes) |
|
|
99
|
+
| `EMAXOUT` | 7 | Output limit exceeded — the decoded output would pass `maxOutput` |
|
|
100
|
+
| `ECHECKSUM` | 16 | Incorrect data check — unless `verify: false`, the CRC-32 or the size mod 2^32 does not match the decoded bytes |
|
|
101
|
+
|
|
102
|
+
`e.code` is the string in the first column; `e.errno` keeps the number of the
|
|
103
|
+
earlier convention (the compressor family's one typed convention, shared
|
|
104
|
+
with brotli).
|
|
85
105
|
|
|
86
106
|
## Example
|
|
87
107
|
|
|
@@ -29,7 +29,7 @@ first, ties broken by symbol order. See RFC 1951 §3.2.2.
|
|
|
29
29
|
|
|
30
30
|
```js
|
|
31
31
|
const hf = runtime.resolve('huffman');
|
|
32
|
-
// { buildMap, buildTree }
|
|
32
|
+
// { buildMap, buildTree, kraft }
|
|
33
33
|
```
|
|
34
34
|
|
|
35
35
|
## API
|
|
@@ -38,6 +38,7 @@ const hf = runtime.resolve('huffman');
|
|
|
38
38
|
|--------|-----------|---------|
|
|
39
39
|
| `buildMap` | `(codeLengths: Uint8Array, maxBits: number, reversed: 0\|1) => Uint16Array` | encode table (`reversed=0`) or decode table (`reversed=1`) |
|
|
40
40
|
| `buildTree` | `(freqs: Uint16Array \| number[], maxBits: number) => { t: Uint8Array, l: number }` | `t` = code lengths, `l` = max bits used |
|
|
41
|
+
| `kraft` | `(codeLengths: Uint8Array \| number[]) => { oversubscribed: boolean, incomplete: boolean }` | Kraft check of a code-length set: more codes than exist, or codes left unused. RFC 1951 § 3.2.7 allows one incomplete set (a single distance code); the caller decides. `buildMap` does not check |
|
|
41
42
|
|
|
42
43
|
### `buildMap(cd, mb, reversed)`
|
|
43
44
|
|
|
@@ -22,11 +22,13 @@ const lz4 = runtime.resolve('lz4');
|
|
|
22
22
|
|
|
23
23
|
## API
|
|
24
24
|
|
|
25
|
-
### `lz4.compress(src, len
|
|
25
|
+
### `lz4.compress(src, len?, opts?) → [size, data]`
|
|
26
26
|
|
|
27
|
-
Compresses a `Uint8Array` block
|
|
27
|
+
Compresses a `Uint8Array` block: `src[0, len)`, the whole of `src` when `len`
|
|
28
|
+
is omitted (`compress(src)`, `compress(src, opts)`).
|
|
28
29
|
|
|
29
30
|
```js
|
|
31
|
+
const [n, block] = lz4.compress(uint8Array); // all of src
|
|
30
32
|
const [size, data] = lz4.compress(uint8Array, uint8Array.length); // mode 'speed'
|
|
31
33
|
const [rSize, rData] = lz4.compress(uint8Array, uint8Array.length, { mode: 'ratio' }); // smaller, slower
|
|
32
34
|
```
|
|
@@ -165,7 +167,7 @@ const worker = fw.createWorker(
|
|
|
165
167
|
|
|
166
168
|
- LZ4 favours **speed** (hundreds of MB/s) over ratio — for maximum ratio, use `brotli` (quality 11) or `deflate` (level 9).
|
|
167
169
|
- Block format: each `compress` call produces an independent LZ4 block — no multi-block LZ4 frame header.
|
|
168
|
-
- `Lz4CompressStream
|
|
170
|
+
- `Lz4CompressStream`: each `push` emits exactly one block — when `compress` returns no block for the chunk (`[0, copy]`: 12 bytes or less, or incompressible), a block of its bytes as literals — so `Lz4DecompressStream`, which decodes each pushed block, gives every chunk back. A chunk past the size limit throws `EMAXOUT`. No inter-push buffering.
|
|
169
171
|
|
|
170
172
|
## Design
|
|
171
173
|
|
|
@@ -27,8 +27,11 @@ Brotli (RFC 7932), Snappy, etc. Classic hash-chain implementation with:
|
|
|
27
27
|
- Optional chain-skip walk (`chainSkip`) — the fflate heuristic that
|
|
28
28
|
continues the walk on the sparsest chain inside the current best match.
|
|
29
29
|
|
|
30
|
-
The scan
|
|
31
|
-
`
|
|
30
|
+
The scan packs the token stream as `(len|0, dist|byte)` pairs into an
|
|
31
|
+
`Int32Array`. `createScanner` runs it in steps: each `fill(tokens, max)`
|
|
32
|
+
writes the next `max` tokens at most and resumes where it stopped, so a
|
|
33
|
+
consumer that works block by block (DEFLATE) holds one block of tokens.
|
|
34
|
+
`encodeTokens` is one fill over the whole input (8 bytes per input byte
|
|
32
35
|
past `start`); `encode` replays that buffer through two callbacks
|
|
33
36
|
(`literal(pos)`, `match(pos, len, dist)`). Both accept `opts.tokens` to
|
|
34
37
|
reuse a caller-owned buffer across calls.
|
|
@@ -37,7 +40,7 @@ reuse a caller-owned buffer across calls.
|
|
|
37
40
|
|
|
38
41
|
```js
|
|
39
42
|
const lz77 = runtime.resolve('lz77');
|
|
40
|
-
// { encode, encodeTokens, findMatch, decodeStream, DEFAULT }
|
|
43
|
+
// { encode, encodeTokens, createScanner, findMatch, decodeStream, DEFAULT }
|
|
41
44
|
```
|
|
42
45
|
|
|
43
46
|
## API
|
|
@@ -46,6 +49,7 @@ const lz77 = runtime.resolve('lz77');
|
|
|
46
49
|
|--------|-----------|---------|
|
|
47
50
|
| `encode` | `(data: Uint8Array, opts, callbacks) => void` | Scans with `encodeTokens`, replays the pairs via callbacks |
|
|
48
51
|
| `encodeTokens` | `(data: Uint8Array, opts?) => { tokens: Int32Array, count: number }` | The scan: token stream packed as `(len\|0, dist\|byte)` pairs |
|
|
52
|
+
| `createScanner` | `(data: Uint8Array, opts?) => { fill(tokens, max): number, done: boolean }` | The same scan, resumable: successive fills give the `encodeTokens` sequence, `max` tokens at a time |
|
|
49
53
|
| `findMatch` | `(data, pos, head, prev, opts) => {len, dist} \| null` | Probes a position |
|
|
50
54
|
| `decodeStream` | `(dst: Uint8Array, ops: array) => number` | Test helper: reconstructs from a stream |
|
|
51
55
|
| `DEFAULT` | `object` | Default options |
|
|
@@ -144,6 +148,25 @@ const buf = new Int32Array(2 * data.length);
|
|
|
144
148
|
lz77.encodeTokens(data, { minMatch: 4, tokens: buf });
|
|
145
149
|
```
|
|
146
150
|
|
|
151
|
+
### Resumable scan
|
|
152
|
+
|
|
153
|
+
`createScanner(data, opts)` holds the scan's state — the position and the
|
|
154
|
+
hash chains — and `fill(tokens, max)` writes the next tokens from index 0,
|
|
155
|
+
at most `max` of them (`tokens` holds `2 × max` entries), returning how
|
|
156
|
+
many. It writes fewer than `max` only at the end of the input; `done` turns
|
|
157
|
+
`true` once the last token is out. The concatenated fills equal one
|
|
158
|
+
`encodeTokens` call whatever `max` each fill gets: when a cut falls between
|
|
159
|
+
a lazy step's literal and its match, the match opens the next fill.
|
|
160
|
+
|
|
161
|
+
```js
|
|
162
|
+
const scan = lz77.createScanner(data, { minMatch: 3, windowBits: 15 });
|
|
163
|
+
const block = new Int32Array(2 * 16384);
|
|
164
|
+
while (!scan.done) {
|
|
165
|
+
const n = scan.fill(block, 16384);
|
|
166
|
+
consumeBlock(block, n); // the pairs at block[0 .. 2n)
|
|
167
|
+
}
|
|
168
|
+
```
|
|
169
|
+
|
|
147
170
|
## Worker Usage
|
|
148
171
|
|
|
149
172
|
```js
|
|
@@ -22,13 +22,17 @@ decode, requires no window, and performs well on locally repeated data.
|
|
|
22
22
|
|
|
23
23
|
## Wire-format profiles
|
|
24
24
|
|
|
25
|
-
| Family | `bigEndian` | `useClearEnd` | `minCodeBits` | Used by |
|
|
26
|
-
|
|
27
|
-
| GIF | `false` (LSB-first) | `true` (CLEAR + END) | 8
|
|
28
|
-
| TIFF | `true` (MSB-first) | `true` | 8 | `image/tiff` |
|
|
29
|
-
| `compress` / `.Z` | `false` | `false` | 8 | Unix |
|
|
30
|
-
|
|
31
|
-
**Defaults match the GIF profile
|
|
25
|
+
| Family | `bigEndian` | `earlyChange` | `useClearEnd` | `minCodeBits` | Used by |
|
|
26
|
+
|--------|-------------|---------------|---------------|---------------|---------|
|
|
27
|
+
| GIF | `false` (LSB-first) | `false` | `true` (CLEAR + END) | 2–8, the image's | `image/gif` |
|
|
28
|
+
| TIFF, PDF `LZWDecode` | `true` (MSB-first) | `true` | `true` | 8 | `image/tiff`, `application/pdf` |
|
|
29
|
+
| `compress` / `.Z` | `false` | `false` | `false` | 8 | Unix |
|
|
30
|
+
|
|
31
|
+
**Defaults match the GIF profile**; `bigEndian: true` alone is the TIFF / PDF
|
|
32
|
+
profile (`earlyChange` defaults to `bigEndian`). `earlyChange` is when the
|
|
33
|
+
code width grows: GIF widens once the table holds `2^n` entries, TIFF and PDF
|
|
34
|
+
(`/EarlyChange 1`, its default) one code sooner. Both are checked against a
|
|
35
|
+
foreign encoder and decoder (GDI+).
|
|
32
36
|
|
|
33
37
|
## Resolve
|
|
34
38
|
|
|
@@ -51,6 +55,7 @@ const lzw = runtime.resolve('lzw');
|
|
|
51
55
|
| `minCodeBits` | `number` (2-12) | `8` | log2 of the initial alphabet (`1 << minCodeBits` first codes) |
|
|
52
56
|
| `maxBits` | `number` (9-16) | `12` | Max code width before dictionary growth stops |
|
|
53
57
|
| `bigEndian` | `boolean` | `false` | `false` = LSB-first packing (GIF/Z); `true` = MSB-first (TIFF) |
|
|
58
|
+
| `earlyChange` | `boolean` | `bigEndian` | `true` = widen the code one code early (TIFF, PDF `/EarlyChange 1`); `false` = at `2^n` entries (GIF, .Z; PDF `/EarlyChange 0`) |
|
|
54
59
|
| `useClearEnd` | `boolean` | `true` | Emit the `CLEAR = 1 << minCodeBits` and `END = CLEAR + 1` markers |
|
|
55
60
|
|
|
56
61
|
> Options **must match** between encode and decode — the LZW container
|
|
@@ -106,7 +111,7 @@ const worker = fw.createWorker(
|
|
|
106
111
|
|
|
107
112
|
## Notes
|
|
108
113
|
|
|
109
|
-
- The decoder
|
|
114
|
+
- The decoder lags the encoder by one entry (it adds nothing after the first code), so each side tests its own count: GIF widens at `2^n` entries on the decoder side (`2^n + 1` on the encoder's), early change one entry sooner on both.
|
|
110
115
|
- Handles the **KwKwK** case (code referring to the entry being created) — tested via the canonical sequence `"TOBEORNOTTOBEORTOBEORNOT"`.
|
|
111
116
|
- Once `nextCode > (1 << maxBits) - 1`, the dictionary stops growing; existing codes continue to be emitted at `maxBits`. No automatic reset (compress "block mode" / GIF "CLEAR on full" strategy is left to the consumer, which can manually insert a CLEAR via options).
|
|
112
117
|
- Edge case: empty input → stream containing only `CLEAR + END` (if `useClearEnd`), otherwise empty.
|
|
@@ -110,6 +110,23 @@ const files = zip.unzipSync(archive, {
|
|
|
110
110
|
});
|
|
111
111
|
```
|
|
112
112
|
|
|
113
|
+
Entry names are read with `/` as the separator: a `\` (written by .NET Framework's `ZipFile.CreateFromDirectory`, against APPNOTE 4.4.17) becomes `/`, as Info-ZIP, 7-Zip and CPython present it; the zip-slip check runs on the normalised name. An entry named `__proto__` is extracted as an own property of the result (and written as an entry by `zipSync`); the result has a `null` prototype (no inherited key; use `Object.hasOwn`).
|
|
114
|
+
|
|
115
|
+
### Extraction (`maxOutput`)
|
|
116
|
+
|
|
117
|
+
`unzipSync(archive, { maxOutput })` (and `unzip`, `ZipStreamReader`) caps the
|
|
118
|
+
bytes extracted over every entry. Each entry's size as the central directory
|
|
119
|
+
declares it is checked against what is left **before** its buffer is
|
|
120
|
+
allocated, so an archive declaring a 4 GiB entry fails with `EMAXOUT` instead of
|
|
121
|
+
allocating it. Absent, there is no cap.
|
|
122
|
+
|
|
123
|
+
### Extraction (`verify`)
|
|
124
|
+
|
|
125
|
+
`unzipSync(archive)` checks each extracted entry against the CRC-32 and the
|
|
126
|
+
uncompressed size the central directory records; a mismatch throws `ECHECKSUM` (errno 16)
|
|
127
|
+
naming the entry. `{ verify: false }` skips the check. The streaming reader
|
|
128
|
+
(`ZipStreamReader`) does not take the option.
|
|
129
|
+
|
|
113
130
|
## Deterministic / reproducible archives
|
|
114
131
|
|
|
115
132
|
Fixing the writer-level `mtime` makes two writes of an identical payload
|
|
@@ -134,7 +151,7 @@ const stream = new zip.ZipStream({ mtime: MTIME }, (chunk) => parts.push(chunk))
|
|
|
134
151
|
the `[data, opts]` tuple, or `openEntry`/`add`'s own `opts`) always
|
|
135
152
|
wins over the writer-level default.
|
|
136
153
|
- The valid range stays 1980-2099 (MS-DOS date/time) — a fixed `mtime`
|
|
137
|
-
outside that range throws
|
|
154
|
+
outside that range throws `EBADDATE` just like the per-entry form;
|
|
138
155
|
the writer-level option does not relax or clamp the range.
|
|
139
156
|
- **Claim boundary**: `zip` only provides the option. A consumer built on
|
|
140
157
|
top of it (e.g. a document-format writer producing DOCX/ODT/PPTX,
|
|
@@ -153,14 +170,21 @@ const stream = new zip.ZipStream({ mtime: MTIME }, (chunk) => parts.push(chunk))
|
|
|
153
170
|
|
|
154
171
|
## Error codes
|
|
155
172
|
|
|
156
|
-
|
|
|
157
|
-
|
|
158
|
-
| 6 | Invalid ZIP data |
|
|
159
|
-
|
|
|
160
|
-
|
|
|
161
|
-
|
|
|
162
|
-
|
|
|
163
|
-
|
|
|
173
|
+
| `code` | `errno` | Meaning |
|
|
174
|
+
|---|------|---------|
|
|
175
|
+
| `EBADFORMAT` | 6 | Invalid ZIP data |
|
|
176
|
+
| `EMAXOUT` | 7 | Output limit exceeded — an entry's declared size passes what `maxOutput` leaves |
|
|
177
|
+
| `EEXTRATOOLONG` | 9 | Extra field too long |
|
|
178
|
+
| `EBADDATE` | 10 | Date out of range (before 1980 or after 2099) |
|
|
179
|
+
| `ENAMETOOLONG` | 11 | Filename too long |
|
|
180
|
+
| `EBADFORMAT` | 13 | Invalid ZIP |
|
|
181
|
+
| `EBADMETHOD` | 14 | Unknown compression method |
|
|
182
|
+
| `EUNSAFEPATH` | 15 | Unsafe entry path (zip-slip: `..` segment or absolute path) — unless `safe: false` |
|
|
183
|
+
| `ECHECKSUM` | 16 | Incorrect data check — unless `verify: false`, an entry's CRC-32 or size does not match the central directory |
|
|
184
|
+
|
|
185
|
+
`e.code` is the string in the first column; `e.errno` keeps the number of the
|
|
186
|
+
earlier convention (the compressor family's one typed convention, shared
|
|
187
|
+
with brotli).
|
|
164
188
|
|
|
165
189
|
## Full example
|
|
166
190
|
|
|
@@ -200,8 +224,10 @@ const worker = fw.createWorker(
|
|
|
200
224
|
## Notes
|
|
201
225
|
|
|
202
226
|
- ZIP64 automatic: ZIP64 extensions are used as soon as a file exceeds 4 GB or the archive exceeds 4 GB / 65535 entries.
|
|
203
|
-
- Dates are stored in MS-DOS format (2-second resolution) — range 1980–2099; out-of-range dates →
|
|
227
|
+
- Dates are stored in MS-DOS format (2-second resolution) — range 1980–2099; out-of-range dates → `EBADDATE`.
|
|
204
228
|
- Store mode (method 0): useful for already-compressed files (PNG, JPEG, MP4) — avoids double compression with no gain.
|
|
229
|
+
- Methods: stored (0) and deflate (8). Any other — Deflate64 (9, 7-Zip's `-mm=Deflate64`), bzip2, LZMA, zstd — is refused with `EBADMETHOD`, never misread.
|
|
230
|
+
- Read against archives from CPython, .NET Framework, 7-Zip and libarchive (data descriptors on stored entries, NTFS and Unix extras included); what fw writes is checked by Info-ZIP UnZip where it is installed.
|
|
205
231
|
|
|
206
232
|
## See also
|
|
207
233
|
|
|
@@ -22,14 +22,14 @@ const zlib = runtime.resolve('zlib');
|
|
|
22
22
|
|
|
23
23
|
## API
|
|
24
24
|
|
|
25
|
-
###
|
|
25
|
+
### Synchronous
|
|
26
26
|
|
|
27
27
|
```js
|
|
28
28
|
const compressed = zlib.zlibSync(uint8Array, opts?); // → Uint8Array
|
|
29
29
|
const decompressed = zlib.unzlibSync(compressed, opts?); // → Uint8Array
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
-
###
|
|
32
|
+
### Asynchronous
|
|
33
33
|
|
|
34
34
|
```js
|
|
35
35
|
const compressed = await zlib.zlib(uint8Array, opts?);
|
|
@@ -50,8 +50,15 @@ const output = [];
|
|
|
50
50
|
const decomp = new zlib.UnzlibStream(opts?, (chunk) => output.push(chunk));
|
|
51
51
|
decomp.push(zlibChunk);
|
|
52
52
|
decomp.push(lastZlibChunk, true);
|
|
53
|
+
// or, when the trailer may be missing: decomp.push(chunk); decomp.flush();
|
|
53
54
|
```
|
|
54
55
|
|
|
56
|
+
`flush()` ends the stream when no trailer can be expected (a source that may
|
|
57
|
+
be truncated, such as a PDF FlateDecode stream): the last bytes, held back
|
|
58
|
+
until then as a presumed trailer, are decoded as payload and emitted. A
|
|
59
|
+
`push` after `flush()` (or after `final`) throws `ESTREAMEND` (errno 4). A header split
|
|
60
|
+
across chunks is fine: the stream waits until the whole header has arrived.
|
|
61
|
+
|
|
55
62
|
## Options
|
|
56
63
|
|
|
57
64
|
### Compression (`zlibSync`, `zlib`, `ZlibStream`)
|
|
@@ -67,6 +74,8 @@ decomp.push(lastZlibChunk, true);
|
|
|
67
74
|
|--------|------|-------------|
|
|
68
75
|
| `out` | `Uint8Array` | Pre-allocated output buffer |
|
|
69
76
|
| `dictionary` | `Uint8Array` | Matching dictionary |
|
|
77
|
+
| `maxOutput` | `number` | Cap, in bytes, on the decoded output (a non-negative integer; absent = no cap). One byte more throws `EMAXOUT` (errno 7) before the buffer grows past the cap — the bound against a decompression bomb. On `UnzlibStream` it caps the stream's total |
|
|
78
|
+
| `verify` | `boolean` | Check the Adler-32 trailer against the decoded bytes (RFC 1950 § 2.3); a mismatch throws `ECHECKSUM` (errno 16), a frame too short for a deflate stream and its trailer throws `EEOF` (errno 0). Default `true`; `false` skips both checks (the trailer is not read) |
|
|
70
79
|
|
|
71
80
|
## Internal format (RFC 1950)
|
|
72
81
|
|
|
@@ -78,9 +87,16 @@ CMF = `0x78` (CM=8 DEFLATE, CINFO=7 window 32K). FCHECK ensures `(CMF×256 + FLG
|
|
|
78
87
|
|
|
79
88
|
## Error codes
|
|
80
89
|
|
|
81
|
-
|
|
|
82
|
-
|
|
83
|
-
|
|
|
90
|
+
| `code` | `errno` | Meaning |
|
|
91
|
+
|---|------|---------|
|
|
92
|
+
| `EEOF` | 0 | Unexpected EOF — unless `verify: false`, a frame shorter than a deflate stream and its trailer (e.g. the header plus 0-4 bytes) |
|
|
93
|
+
| `EBADFORMAT` | 6 | Invalid zlib data |
|
|
94
|
+
| `EMAXOUT` | 7 | Output limit exceeded — the decoded output would pass `maxOutput` |
|
|
95
|
+
| `ECHECKSUM` | 16 | Incorrect data check — unless `verify: false`, the Adler-32 trailer does not match the decoded bytes |
|
|
96
|
+
|
|
97
|
+
`e.code` is the string in the first column; `e.errno` keeps the number of the
|
|
98
|
+
earlier convention (the compressor family's one typed convention, shared
|
|
99
|
+
with brotli).
|
|
84
100
|
|
|
85
101
|
## Example
|
|
86
102
|
|
|
@@ -126,7 +126,7 @@ const worker = fw.createWorker(
|
|
|
126
126
|
|
|
127
127
|
## Notes
|
|
128
128
|
|
|
129
|
-
- Aliasing safe: `add(a, a, b)`
|
|
129
|
+
- Aliasing safe: `out` may be one of the inputs in every vector and matrix operation (`add(a, a, b)`, `mat3.transpose(m, m)`, `mat4.multiply(m, m, n)`) — each reads its inputs before writing, and a test checks every operation under both aliases.
|
|
130
130
|
- Column-major: the 4th column of mat4 contains the translation (`m[12]`, `m[13]`, `m[14]`). Pass directly to `gl.uniformMatrix4fv(loc, false, mat4)`.
|
|
131
131
|
- No quaternions — for chained rotations without gimbal lock, see the separate `linalg-quat` plan.
|
|
132
132
|
- `Float32Array` precision: for high-precision computation, use `Float64Array` + adapted functions.
|
|
@@ -23,7 +23,7 @@ Two distinct surfaces:
|
|
|
23
23
|
const valid = runtime.resolve('valid');
|
|
24
24
|
// Returns: { is, isNumber, isString, isBoolean, isArray, isObject,
|
|
25
25
|
// isUint8Array, isUint8ClampedArray, isFunction,
|
|
26
|
-
// validate, test, compile, formats
|
|
26
|
+
// validate, test, compile, formats }
|
|
27
27
|
```
|
|
28
28
|
|
|
29
29
|
## API — Type guards
|
package/docs/api/process/rpc.md
CHANGED
|
@@ -60,7 +60,7 @@ const str = await proxy.utils.encode([255]); // → "ff"
|
|
|
60
60
|
| Param | Type | Description |
|
|
61
61
|
|-------|------|-------------|
|
|
62
62
|
| `port` | `MessagePort` | Port received by transfer (`event.ports[0]`) |
|
|
63
|
-
| `options.timeout` | `number` | Per-call timeout in ms (default 30000) |
|
|
63
|
+
| `options.timeout` | `number` | Per-call and handshake timeout in ms (default 30000), clamped to 2^31-1 ms — `Infinity` means that maximum |
|
|
64
64
|
|
|
65
65
|
Returns: `Promise<Proxy>` — each property access returns a `Promise`.
|
|
66
66
|
|
|
@@ -152,7 +152,8 @@ receives it in `event.ports[0]` and calls `rpc.open(port)`.
|
|
|
152
152
|
|
|
153
153
|
- `rpc.create` sends the descriptor immediately on `port1` — it is queued until `port2` becomes active.
|
|
154
154
|
- Async functions on the host object are `await`-ed before the response is sent.
|
|
155
|
-
- The proxy
|
|
155
|
+
- The proxy reaches only what the descriptor lists: reading a name the host object does not expose throws `RPC endpoint not found: <name>` at once.
|
|
156
|
+
- A **primitive** property is read as a value (`await proxy.version`); an **object-valued** property is exposed as a namespace of endpoints, not as a value — `await api.publicKey` on a `Uint8Array` property fails (`RPC endpoint not found: publicKey.length`). Return bytes and objects from a method instead.
|
|
156
157
|
- `port` is a `Transferable` — it must be transferred via the 2nd argument of `postMessage` (zero-copy transfer). Do **not** pass it in `options.args` of `createWorker`: the args are JSON-serialised and the port would become `{}`.
|
|
157
158
|
|
|
158
159
|
## See also
|
|
@@ -52,7 +52,7 @@ Returns a `Promise` resolved with the value of `event.data` from the worker's re
|
|
|
52
52
|
- If `maxQueue` is reached: throws `'workerPool: queue is full'`.
|
|
53
53
|
- If the signal is already aborted: immediate rejection with `AbortError`.
|
|
54
54
|
|
|
55
|
-
**Abort behaviour during execution:** if `signal.abort()` is called while a job is already dispatched to a worker, that worker is `terminate()`d immediately (it is impossible to cancel a worker without killing it)
|
|
55
|
+
**Abort behaviour during execution:** if `signal.abort()` is called while a job is already dispatched to a worker, that worker is `terminate()`d immediately (it is impossible to cancel a worker without killing it) and the job is rejected with `AbortError`. An abort is not a crash: the slot always gets a replacement worker, whatever `respawnOnCrash` says, so the pool keeps its size and the next job runs. A slot that `resize()` already removed gets none.
|
|
56
56
|
|
|
57
57
|
### `pool.resize(n)`
|
|
58
58
|
|
package/docs/api/sanity/base.md
CHANGED
|
@@ -31,11 +31,11 @@ For zero-bundler deployment (static HTML), load the built classic artifact inste
|
|
|
31
31
|
|
|
32
32
|
## API
|
|
33
33
|
|
|
34
|
-
`applyBase()` applies 15 sequential steps that lock down the realm. Returns `{ applied: boolean, reason?: string, steps: string[] }` — the step list records the order
|
|
34
|
+
`applyBase()` applies 15 sequential steps that lock down the realm. Returns `{ applied: boolean, reason?: string, steps: string[], failures: { step, target, message }[] }` — the step list records the order; `failures` lists every slot a step could not harden (a non-configurable property, a frozen namespace), `[]` on a clean apply.
|
|
35
35
|
|
|
36
36
|
| Section | Method / Property | Effect |
|
|
37
37
|
|---------|-------------------|--------|
|
|
38
|
-
| **window** | `eval`, `Function`, `Reflect` | Throws `'not allowed'` |
|
|
38
|
+
| **window** | `eval`, `Function`, `Reflect` | Throws `'not allowed'` — the global slots only: `({}).constructor.constructor('code')` still builds an evaluator under this tier alone (`lockdown()` closes it) |
|
|
39
39
|
| **window** | `alert`, `confirm`, `prompt`, `open` | Throws `'not allowed'` |
|
|
40
40
|
| **window** | `importScripts` | Throws `'not allowed'` |
|
|
41
41
|
| **window** | `import()` (dynamic) | **Not intercepted** — the `window.import` property throws on access, but the syntactic `import()` form is language syntax, not a property, so it cannot be poisoned by slot replacement. Closed by a server CSP (`script-src`) or a Worker, not this tier. |
|
|
@@ -43,9 +43,10 @@ For zero-bundler deployment (static HTML), load the built classic artifact inste
|
|
|
43
43
|
| **window** | `crypto.randomUUID` | Throws `'not allowed'` |
|
|
44
44
|
| **window** | `performance.now`, `performance.mark`, `performance.measure`, `performance.getEntries` | Throws `'not allowed'` |
|
|
45
45
|
| **document** | `write`, `writeln`, `open`, `close`, `execCommand`, `execScript`, `evaluate`, `implementation`, `createContextualFragment` | Throws `'not allowed'` |
|
|
46
|
+
| **Range.prototype** | `createContextualFragment` | Throws `'not allowed'` — the markup parser `document.createRange()` reaches (blocked in the `Element.prototype` step; measured in Chromium) |
|
|
46
47
|
| **document** | `domain` (set) | Throws `'not allowed'` |
|
|
47
48
|
| **history** | `pushState`, `replaceState`, `go`, `back`, `forward` | Throws `'not allowed'` |
|
|
48
|
-
| **Element.prototype** | `innerHTML` (set), `outerHTML` (set), `insertAdjacentHTML` (
|
|
49
|
+
| **Element.prototype** | `innerHTML` (set), `outerHTML` (set), `insertAdjacentHTML(position, html)` (call) | Redirected to `innerText` / `outerText` / `insertAdjacentText` — no exception raised; the getters keep working |
|
|
49
50
|
| **Date** | `Date.now` | Rounded to 100 ms (`Math.floor(ts / 100) * 100`) |
|
|
50
51
|
| **Timing** | `setTimeout`, `setInterval`, `requestAnimationFrame` with a string | Throws `'not allowed'` |
|
|
51
52
|
| **JSON** | `JSON.parse(text, reviver)` | Throws `'not allowed'` if reviver is present |
|
|
@@ -62,7 +63,9 @@ String.prototype Number.prototype Boolean.prototype
|
|
|
62
63
|
Date.prototype RegExp.prototype Error.prototype
|
|
63
64
|
```
|
|
64
65
|
|
|
65
|
-
|
|
66
|
+
Only these nine. The other built-in prototypes (`Map`, `Set`, `Promise`, the typed arrays) and the DOM prototypes (`Element`, `Node`, `EventTarget`) stay unfrozen under this tier; `lockdown()` freezes every intrinsic.
|
|
67
|
+
|
|
68
|
+
On each prototype, `constructor` → non-writable / non-configurable. Setting `__proto__` throws: the guarded setter is installed on `Object.prototype`, the one prototype that owns the accessor, so every object inherits it and `[].__proto__` still reads `Array.prototype`.
|
|
66
69
|
|
|
67
70
|
## Examples
|
|
68
71
|
|
|
@@ -71,7 +74,7 @@ On each prototype, `__proto__` (set) → throws, `constructor` → non-writable
|
|
|
71
74
|
```js
|
|
72
75
|
// app.js — first import
|
|
73
76
|
import { applyBase } from '@awacloud/fw/sanity/base';
|
|
74
|
-
const result = applyBase(); // → { applied: true, steps: ['freezePrototypes', 'window', ...] }
|
|
77
|
+
const result = applyBase(); // → { applied: true, steps: ['freezePrototypes', 'window', ...], failures: [] }
|
|
75
78
|
// Now safe to import and use the framework
|
|
76
79
|
import { runtime } from '@awacloud/fw';
|
|
77
80
|
```
|
|
@@ -123,6 +126,7 @@ random.bytes(buf); // CTR_DRBG-AES-256
|
|
|
123
126
|
- Prototype freezing is irreversible for the duration of the session — call `applyBase()` before any library that attempts to modify prototypes.
|
|
124
127
|
- Dangerous elements covered: `iframe`, `object`, `embed`. `community.js` covers the same set with relaxed restrictions to remain compatible with popular frameworks.
|
|
125
128
|
- **Playwright drivability consequence**: Observe a hardened realm over the network, never through the evaluation channel. `applyBase()` makes a page undrivable by Playwright — its blocked-property getter (at `base.js:100`) throws inside the injected UtilityScript in both Chromium and Firefox engines (measured). End-to-end test legs must use network observation with a barrier request afterwards to confirm confinement, never via `page.evaluate()` on an applyBase'd page; absent requests and unobserved requests are indistinguishable without the barrier.
|
|
129
|
+
- **What this tier does not do (measured in Chromium).** It does not close the `({}).constructor.constructor` evaluator escape and does not affect the `debugger` statement (the `disableDebugger` step only caps `Error.stackTraceLimit`; a `debugger` statement is language syntax and never consults `window.debugger`). For the integrity guarantees use `lockdown()`, which composes this tier.
|
|
126
130
|
- **Dynamic `import()` survives `applyBase()` (measured)**: `src/crypto/wasm/runtime.js` performs a live in-factory dynamic import after `applyBase()` has already run, in the same realm — direct proof that the syntactic form is not intercepted by this tier's property poisoning (see the `import()` row above).
|
|
127
131
|
|
|
128
132
|
## See also
|