@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,301 @@
|
|
|
1
|
+
---
|
|
2
|
+
category: guide
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Worker confinement under lockdown
|
|
6
|
+
|
|
7
|
+
Running untrusted or high-risk computation safely needs **two** properties, and
|
|
8
|
+
`@awacloud/fw` gets them from two different places. **Integrity** comes from
|
|
9
|
+
`lockdown()` in the main realm: the intrinsics are frozen and the evaluators are
|
|
10
|
+
severed, so nothing can rewrite the language substrate underneath your code.
|
|
11
|
+
**Confinement** comes from a Web Worker: a separate realm behind a
|
|
12
|
+
structured-clone boundary, entered with an explicit capability grant. Neither
|
|
13
|
+
alone is enough — `lockdown()` does not stop code in the same realm from reading
|
|
14
|
+
your module scope, and a Worker on its own hands untrusted code a fresh,
|
|
15
|
+
fully-mutable realm complete with ambient network authority. See
|
|
16
|
+
[`security.md` § Integrity vs confinement](./security.md#integrity-vs-confinement)
|
|
17
|
+
for the blunt version of that table.
|
|
18
|
+
|
|
19
|
+
## The two properties
|
|
20
|
+
|
|
21
|
+
| Property | What it means | Where fw gets it |
|
|
22
|
+
|---|---|---|
|
|
23
|
+
| **Integrity** | Intrinsics are tamper-proof; `eval`/`Function` cannot be reconstructed via `f.constructor`; no prototype poisoning | `lockdown()` — [`sanity/lockdown`](../api/sanity/lockdown.md), called once per realm |
|
|
24
|
+
| **Confinement** | Untrusted code cannot read or write outside its assigned scope; it reaches only what it was granted | `createWorker(fn, { dependencies })` — separate realm + structured-clone boundary + capability grant |
|
|
25
|
+
|
|
26
|
+
Applied together the guarantees compose: code runs in a realm where (a) it can
|
|
27
|
+
reach only the modules you granted, (b) the built-ins are frozen, (c) the
|
|
28
|
+
ambient authorities you revoked are gone, and (d) data crosses only as
|
|
29
|
+
structured-clone values.
|
|
30
|
+
|
|
31
|
+
## Grant = the dependencies list
|
|
32
|
+
|
|
33
|
+
`createWorker(workerFn, { dependencies })` is the capability grant, and it is
|
|
34
|
+
**structural rather than advisory**. `runtime.serialize(dependencies)`
|
|
35
|
+
(`core/worker-helper.js:184`) builds the source of exactly the listed modules
|
|
36
|
+
plus their transitive graph; that string — and nothing else from the parent
|
|
37
|
+
registry — is embedded in the worker program. A module you did not list has no
|
|
38
|
+
factory source inside the worker at all: it is not hidden, it is absent, and
|
|
39
|
+
even `runtime.resolve('secret')` inside the worker throws `Module not found`.
|
|
40
|
+
|
|
41
|
+
Transitive dependencies are a second, finer distinction. They are **registered**
|
|
42
|
+
in the worker's runtime (the graph must resolve) but they are **not exposed** in
|
|
43
|
+
`libs`: `DEFAULT_WORKER_FRAMEWORK` calls `runtime.resolveAll()` with your
|
|
44
|
+
original `dependencies` array, not with the serialized graph
|
|
45
|
+
(`core/worker-helper.js:196`). Granting `['sha256']` therefore yields
|
|
46
|
+
`libs === { sha256 }`, even though `bitArray` and `utf8` were serialized
|
|
47
|
+
alongside it.
|
|
48
|
+
|
|
49
|
+
Measured, in a browser page served from the fw package root: granting
|
|
50
|
+
`['sha256', 'hex']` produced `Object.keys(ctx.libs) === ['sha256', 'hex']`, and
|
|
51
|
+
a module registered on the parent runtime but absent from the grant
|
|
52
|
+
(`signal`) was `undefined` inside the worker. The same claims are asserted
|
|
53
|
+
under `bun test` by the regression suite
|
|
54
|
+
(`src/core/worker-confinement.poc.test.js`).
|
|
55
|
+
|
|
56
|
+
## Withholding ambient authority
|
|
57
|
+
|
|
58
|
+
The `workerFw` option is the hook that runs **before** user code. fw assigns its
|
|
59
|
+
return value to `runtime.context` and immediately calls `workerFn` with it
|
|
60
|
+
(`core/worker-helper.js:207-209`), so the ordering is deterministic:
|
|
61
|
+
confinement setup → resolve the grant → run user code. Three constraints follow
|
|
62
|
+
from how it is embedded:
|
|
63
|
+
|
|
64
|
+
- It is **stringified** (`workerFw.toString()`), so it must be self-contained —
|
|
65
|
+
no closure over any main-thread binding.
|
|
66
|
+
- It is **synchronous**: its return value is assigned directly, never awaited.
|
|
67
|
+
A `workerFw` that returns a Promise assigns a Promise to `runtime.context`.
|
|
68
|
+
- Its only channel from the parent is `args`, which is JSON-serialised into the
|
|
69
|
+
worker program.
|
|
70
|
+
|
|
71
|
+
### Revoking an authority is not always `delete globalThis.X`
|
|
72
|
+
|
|
73
|
+
This is the part that is easy to get wrong, and both halves below are measured.
|
|
74
|
+
|
|
75
|
+
In a **browser** worker the global's own properties are only part of the story.
|
|
76
|
+
Chrome's `DedicatedWorkerGlobalScope` inherits from `WorkerGlobalScope`, and
|
|
77
|
+
`fetch` is an own property of `WorkerGlobalScope.prototype`, not of the global
|
|
78
|
+
object. `delete globalThis.fetch` therefore deletes nothing and `fetch` stays
|
|
79
|
+
fully usable. `WebSocket` *is* an own property of the global and is deleted as
|
|
80
|
+
expected — so the naive pattern half-works, which is worse than failing.
|
|
81
|
+
|
|
82
|
+
Measured in Chrome, inside a `blob:` worker spawned by `createWorker`:
|
|
83
|
+
|
|
84
|
+
| Probe | Result |
|
|
85
|
+
|---|---|
|
|
86
|
+
| `Object.hasOwn(self, 'fetch')` | `false` — it lives on `WorkerGlobalScope.prototype` |
|
|
87
|
+
| `Object.hasOwn(self, 'WebSocket')` | `true` |
|
|
88
|
+
| `delete globalThis.fetch` then `typeof fetch` | still `'function'` — **no-op** |
|
|
89
|
+
| delete `fetch` from its owning prototype, then `typeof fetch` | `'undefined'` — revoked |
|
|
90
|
+
|
|
91
|
+
Under **Bun** (`bun test`, Bun 1.3.13) `fetch` *is* an own property of the
|
|
92
|
+
worker global, so `delete globalThis.fetch` works there. The portable form walks
|
|
93
|
+
the prototype chain and deletes the property from whichever object actually owns
|
|
94
|
+
it:
|
|
95
|
+
|
|
96
|
+
```js
|
|
97
|
+
const confinedWorkerFw = function (runtime, moduleNames, args) {
|
|
98
|
+
// Self-contained by contract: no closure over main-thread bindings.
|
|
99
|
+
const revoke = (name) => {
|
|
100
|
+
let o = globalThis;
|
|
101
|
+
while (o) {
|
|
102
|
+
if (Object.prototype.hasOwnProperty.call(o, name)) { delete o[name]; return; }
|
|
103
|
+
o = Object.getPrototypeOf(o);
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
['fetch', 'WebSocket', 'Worker', 'BroadcastChannel', 'XMLHttpRequest'].forEach(revoke);
|
|
107
|
+
|
|
108
|
+
const libs = runtime.resolveAll(moduleNames);
|
|
109
|
+
return { libs, args };
|
|
110
|
+
};
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Residuals
|
|
114
|
+
|
|
115
|
+
Two authorities survive any property-level revocation, because they are
|
|
116
|
+
**syntax**, not properties:
|
|
117
|
+
|
|
118
|
+
- **Dynamic `import()`** cannot be deleted. It is available inside the `blob:`
|
|
119
|
+
classic worker fw spawns (measured in Chrome and under Bun) and will resolve
|
|
120
|
+
absolute URLs. Close it with a server-side CSP (`script-src`,
|
|
121
|
+
`worker-src`) — property taming cannot.
|
|
122
|
+
- **`eval` / `Function`** are live inside a fresh worker realm. `lockdown()`
|
|
123
|
+
severs them, which is exactly why the next section exists.
|
|
124
|
+
|
|
125
|
+
## Applying lockdown inside the worker — status
|
|
126
|
+
|
|
127
|
+
**fw does not wire `lockdown()` into the worker realm.** That is a measured
|
|
128
|
+
statement about the current code, not a policy: `lockdown` is not a DI module
|
|
129
|
+
(it is absent from `src/core/modules.js`), it is not part of `runtimeSource`, and
|
|
130
|
+
`workerFw` — the only pre-user-code hook — is synchronous
|
|
131
|
+
(`core/worker-helper.js:207`), so it cannot `await` the dynamic `import()` that
|
|
132
|
+
would be needed to obtain the module inside a `blob:` worker.
|
|
133
|
+
|
|
134
|
+
A worker that needs its own intrinsics frozen must therefore do it itself:
|
|
135
|
+
`import()` `sanity/lockdown` at the top of `workerFn` and call `lockdown()`
|
|
136
|
+
before touching `libs`. The module URL has to travel through `args`, because a
|
|
137
|
+
`blob:` worker has no notion of the package root and cannot resolve a bare or
|
|
138
|
+
relative specifier.
|
|
139
|
+
|
|
140
|
+
This leg is measured green in both realms — see [Example 2](#example-2--freezing-the-workers-own-intrinsics)
|
|
141
|
+
below. Productising it (a first-class `lockdown: true` worker option) is **not**
|
|
142
|
+
part of this guide's contract; it is tracked separately.
|
|
143
|
+
|
|
144
|
+
## Runnable example
|
|
145
|
+
|
|
146
|
+
Both examples below were executed before being written down. Example 1 was run
|
|
147
|
+
in Chrome against a page served from the fw package root; Example 2 was run in
|
|
148
|
+
Chrome the same way **and** is asserted under `bun test` as the ninth test of
|
|
149
|
+
`src/core/worker-confinement.poc.test.js`.
|
|
150
|
+
|
|
151
|
+
### Example 1 — integrity in the main realm, confinement in the worker
|
|
152
|
+
|
|
153
|
+
```html
|
|
154
|
+
<!doctype html>
|
|
155
|
+
<script type="importmap">
|
|
156
|
+
{ "imports": {
|
|
157
|
+
"@awacloud/fw": "/packages/front/fw/src/main.js",
|
|
158
|
+
"@awacloud/fw/": "/packages/front/fw/src/"
|
|
159
|
+
}}
|
|
160
|
+
</script>
|
|
161
|
+
<script type="module">
|
|
162
|
+
import { lockdown } from '@awacloud/fw/sanity/lockdown.js';
|
|
163
|
+
lockdown(); // integrity — this realm
|
|
164
|
+
|
|
165
|
+
import fw from '@awacloud/fw';
|
|
166
|
+
import modules from '@awacloud/fw/core/modules.js';
|
|
167
|
+
fw.runtime.registerAll(modules);
|
|
168
|
+
|
|
169
|
+
// Confinement setup: runs inside the worker, before user code.
|
|
170
|
+
const confinedWorkerFw = function (runtime, moduleNames, args) {
|
|
171
|
+
const revoke = (name) => {
|
|
172
|
+
let o = globalThis;
|
|
173
|
+
while (o) {
|
|
174
|
+
if (Object.prototype.hasOwnProperty.call(o, name)) { delete o[name]; return; }
|
|
175
|
+
o = Object.getPrototypeOf(o);
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
['fetch', 'WebSocket', 'Worker', 'BroadcastChannel', 'XMLHttpRequest'].forEach(revoke);
|
|
179
|
+
const libs = runtime.resolveAll(moduleNames);
|
|
180
|
+
return { libs, args };
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
const worker = fw.createWorker(function (ctx) {
|
|
184
|
+
// Self-contained: stringified into the worker program.
|
|
185
|
+
const words = ctx.libs.sha256.hash(ctx.args[0]); // bitArray (32-bit words)
|
|
186
|
+
const bytes = new Uint8Array(words.length * 4);
|
|
187
|
+
for (let i = 0; i < words.length; i++) {
|
|
188
|
+
bytes[i * 4] = (words[i] >>> 24) & 0xff;
|
|
189
|
+
bytes[i * 4 + 1] = (words[i] >>> 16) & 0xff;
|
|
190
|
+
bytes[i * 4 + 2] = (words[i] >>> 8) & 0xff;
|
|
191
|
+
bytes[i * 4 + 3] = words[i] & 0xff;
|
|
192
|
+
}
|
|
193
|
+
self.postMessage({
|
|
194
|
+
hasFetch: typeof fetch !== 'undefined',
|
|
195
|
+
hasWebSocket: typeof WebSocket !== 'undefined',
|
|
196
|
+
hasNonGranted: typeof ctx.libs.signal !== 'undefined',
|
|
197
|
+
libs: Object.keys(ctx.libs),
|
|
198
|
+
digest: ctx.libs.hex.fromBytes(bytes),
|
|
199
|
+
});
|
|
200
|
+
}, { dependencies: ['sha256', 'hex'], workerFw: confinedWorkerFw, args: ['abc'] });
|
|
201
|
+
|
|
202
|
+
worker.onmessage = (e) => { console.log(e.data); worker.terminate(); };
|
|
203
|
+
</script>
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
Observed console output (Chrome, page served from the fw package root):
|
|
207
|
+
|
|
208
|
+
```
|
|
209
|
+
{ hasFetch: false,
|
|
210
|
+
hasWebSocket: false,
|
|
211
|
+
hasNonGranted: false,
|
|
212
|
+
libs: ['sha256', 'hex'],
|
|
213
|
+
digest: 'ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad' }
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
Read that line by line: the network authorities are gone; `signal` — registered
|
|
217
|
+
on the parent runtime, absent from the grant — is unreachable; `libs` holds
|
|
218
|
+
exactly the grant, not the serialized transitive graph; and the granted
|
|
219
|
+
computation is correct (`sha256('abc')`).
|
|
220
|
+
|
|
221
|
+
> **Import-map spelling.** In a raw import map the subpath needs its `.js`
|
|
222
|
+
> extension — `@awacloud/fw/sanity/lockdown.js`. The extensionless
|
|
223
|
+
> `@awacloud/fw/sanity/lockdown` spelling used elsewhere in these docs is the
|
|
224
|
+
> package **exports-map** form: bundlers and Node resolve it, a browser import
|
|
225
|
+
> map does not, and it 404s. Measured.
|
|
226
|
+
|
|
227
|
+
### Example 2 — freezing the worker's own intrinsics
|
|
228
|
+
|
|
229
|
+
Same setup; only `workerFn` changes. The lockdown module URL is computed on the
|
|
230
|
+
main thread and handed over through `args`.
|
|
231
|
+
|
|
232
|
+
```js
|
|
233
|
+
const worker = fw.createWorker(function (ctx) {
|
|
234
|
+
import(ctx.args[0]).then(function (mod) {
|
|
235
|
+
mod.lockdown(); // integrity — the WORKER realm
|
|
236
|
+
|
|
237
|
+
let escapeOpen = true;
|
|
238
|
+
try { ({}).constructor.constructor('return 1'); } catch (e) { escapeOpen = false; }
|
|
239
|
+
|
|
240
|
+
self.postMessage({
|
|
241
|
+
hasFetch: typeof fetch !== 'undefined',
|
|
242
|
+
escapeClosed: escapeOpen === false,
|
|
243
|
+
objectProtoFrozen: Object.isFrozen(Object.prototype),
|
|
244
|
+
digest: ctx.libs.hex.fromBytes(new Uint8Array([0xba, 0x77])),
|
|
245
|
+
});
|
|
246
|
+
}).catch(function (e) {
|
|
247
|
+
self.postMessage({ importError: String((e && e.message) || e) });
|
|
248
|
+
});
|
|
249
|
+
}, {
|
|
250
|
+
dependencies: ['hex'],
|
|
251
|
+
workerFw: confinedWorkerFw,
|
|
252
|
+
args: [new URL('/packages/front/fw/src/sanity/lockdown.js', location.href).href],
|
|
253
|
+
});
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
Observed output (Chrome):
|
|
257
|
+
|
|
258
|
+
```
|
|
259
|
+
{ hasFetch: false, escapeClosed: true, objectProtoFrozen: true, digest: 'ba77' }
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
The `bun test` equivalent — same shape, the module resolved by absolute
|
|
263
|
+
`file://` URL through `args` — is the ninth test of
|
|
264
|
+
`src/core/worker-confinement.poc.test.js` and asserts the same four facts.
|
|
265
|
+
|
|
266
|
+
Note the shape this forces on you: `lockdown()` lands on a later microtask, so
|
|
267
|
+
**all** worker logic has to live inside the `.then()` callback. Anything you run
|
|
268
|
+
before it runs unhardened.
|
|
269
|
+
|
|
270
|
+
## Limits (honest)
|
|
271
|
+
|
|
272
|
+
- **Async only.** Every call in or out goes through `postMessage` and
|
|
273
|
+
structured-clone. There is no synchronous route to a worker result — a
|
|
274
|
+
fundamental property of the Web Worker API, not an fw limitation.
|
|
275
|
+
- **Per-worker cost.** Each `createWorker` allocates a thread (~1–10 ms).
|
|
276
|
+
For recurring tasks use the `workerPool` module rather than spawning per call.
|
|
277
|
+
- **Dynamic `import()` residual.** It cannot be revoked and is available in the
|
|
278
|
+
`blob:` worker. In a browser it is network-capable; close it with a CSP.
|
|
279
|
+
- **No SES `Compartment`.** This is a true engine boundary, not a virtualised
|
|
280
|
+
one — stronger isolation, but async-only and costly. See
|
|
281
|
+
[`sanity/lockdown` § Comparison to SES](../api/sanity/lockdown.md#comparison-to-ses-honest).
|
|
282
|
+
- **`lockdown()` before `new Worker()` breaks under Bun.** Measured on Bun
|
|
283
|
+
1.3.13: freezing the parent realm's intrinsics and *then* calling
|
|
284
|
+
`createWorker` throws
|
|
285
|
+
`TypeError: undefined is not an object (evaluating 'FunctionPrototypeCall')`
|
|
286
|
+
from `internal:primordials`, because Bun initialises those internals lazily,
|
|
287
|
+
after the freeze. Chrome is unaffected (its `Worker` constructor is native).
|
|
288
|
+
Under Bun, spawn the workers you need before locking down the parent realm, or
|
|
289
|
+
keep the parent lockdown to browser deployments.
|
|
290
|
+
- **The DOM step never runs in a worker.** `lockdown()`'s step 6 is gated on
|
|
291
|
+
`window` + `document` (`sanity/lockdown.js:383`), so a worker realm gets the
|
|
292
|
+
intrinsic tier only — which is all a worker realm has to harden anyway.
|
|
293
|
+
|
|
294
|
+
## See also
|
|
295
|
+
|
|
296
|
+
- [`sanity/lockdown` — API reference](../api/sanity/lockdown.md) — the integrity tier, step by step, and the SES comparison
|
|
297
|
+
- [Security guide](./security.md) — the tier spectrum, the recommended default, integrity vs confinement
|
|
298
|
+
- [Web Workers guide](./workers.md) — `createWorker`, serialisation, the RPC pattern
|
|
299
|
+
- [`core/worker-helper` — API reference](../api/core/worker-helper.md) — `WorkerOptions`, `workerFw`, the patched `terminate`
|
|
300
|
+
- [Worker confinement spike (2026-06-15)](../notes/worker-confinement-spike.md) — the historical investigation this guide supersedes for guidance
|
|
301
|
+
- `src/core/worker-confinement.poc.test.js` — the regression suite backing every claim above
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
# Web Workers
|
|
2
|
+
|
|
3
|
+
The framework allows spawning Workers from inline functions, with automatic injection of the required modules.
|
|
4
|
+
|
|
5
|
+
> The examples below assume that the cited modules (`hex`, `lz4`,
|
|
6
|
+
> `b64`, `processMessage`, `processRPC`, …) have been registered beforehand
|
|
7
|
+
> via `fw.runtime.registerAll(modules)` or by manual composition. `main.js`
|
|
8
|
+
> registers **nothing** automatically — see [Quick start](./getting-started.md).
|
|
9
|
+
|
|
10
|
+
## Principle
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
main.js → createWorker(fn, options)
|
|
14
|
+
↓
|
|
15
|
+
serialize modules → Blob URL → new Worker(blobUrl)
|
|
16
|
+
↓ (inside the worker)
|
|
17
|
+
ModuleRuntime + registered modules
|
|
18
|
+
workerFw(runtime, modules, args) → context
|
|
19
|
+
workerFn(context)
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Full signature
|
|
23
|
+
|
|
24
|
+
```js
|
|
25
|
+
const worker = fw.createWorker(workerFn, {
|
|
26
|
+
dependencies: ['hex', 'lz4'], // required modules
|
|
27
|
+
workerFw: myFrameworkFn, // optional — custom bootstrap
|
|
28
|
+
args: ['param1', 42], // optional — JSON-serialisable
|
|
29
|
+
terminate: () => cleanup() // optional — cleanup callback
|
|
30
|
+
});
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
See [createWorker API](../api/core/worker-helper.md) for the full reference.
|
|
34
|
+
|
|
35
|
+
## Typical use cases
|
|
36
|
+
|
|
37
|
+
### 1. Data processing
|
|
38
|
+
|
|
39
|
+
```js
|
|
40
|
+
const worker = fw.createWorker(
|
|
41
|
+
function({ libs, args }) {
|
|
42
|
+
const [data] = args;
|
|
43
|
+
const compressed = libs.lz4.compress(new Uint8Array(data));
|
|
44
|
+
self.postMessage({ compressed: Array.from(compressed[1]) });
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
dependencies: ['lz4'],
|
|
48
|
+
args: [largeArrayBuffer]
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
worker.onmessage = ({ data }) => {
|
|
53
|
+
console.log('compressed:', data.compressed.length, 'bytes');
|
|
54
|
+
};
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### 2. Inline parallel execution
|
|
58
|
+
|
|
59
|
+
Same logic, without a worker — useful for debugging and testing:
|
|
60
|
+
|
|
61
|
+
```js
|
|
62
|
+
const workerFn = function({ libs, args }) {
|
|
63
|
+
return libs.hex.fromBytes(args[0]);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
// Inline
|
|
67
|
+
const libs = fw.runtime.resolveAll(['hex'], { instances: new Map() });
|
|
68
|
+
const result = workerFn({ libs, process: {}, args: [new Uint8Array([255])] });
|
|
69
|
+
|
|
70
|
+
// Worker (same function)
|
|
71
|
+
const worker = fw.createWorker(workerFn, {
|
|
72
|
+
dependencies: ['hex'],
|
|
73
|
+
args: [Array.from(new Uint8Array([255]))] // JSON-serialisable
|
|
74
|
+
});
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### 3. Bidirectional messages with processMessage
|
|
78
|
+
|
|
79
|
+
```js
|
|
80
|
+
// Main thread
|
|
81
|
+
const { processMessage } = fw.runtime.resolveAll(['processMessage']);
|
|
82
|
+
const workerRef = fw.createWorker(
|
|
83
|
+
function({ libs, process }) {
|
|
84
|
+
// Register a command handler
|
|
85
|
+
process.doWork = function(data) {
|
|
86
|
+
const result = libs.b64.fromBytes(new Uint8Array(data));
|
|
87
|
+
process.postMessage({ result });
|
|
88
|
+
};
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
dependencies: ['processMessage', 'b64'],
|
|
92
|
+
workerFw: processMessage.workerFramework
|
|
93
|
+
}
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
const cmd = processMessage.workerCommand(workerRef);
|
|
97
|
+
cmd.doWork([72, 101, 108]); // sends the command
|
|
98
|
+
|
|
99
|
+
workerRef.onmessage = ({ data }) => console.log(data.result);
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### 4. RPC (Remote Procedure Call)
|
|
103
|
+
|
|
104
|
+
A `MessagePort` is a `Transferable`, **not** a JSON-serialisable value:
|
|
105
|
+
it cannot therefore pass through `options.args` (see Constraints). It must be
|
|
106
|
+
transferred explicitly via `postMessage`.
|
|
107
|
+
|
|
108
|
+
```js
|
|
109
|
+
// Object to expose from the main thread
|
|
110
|
+
const api = {
|
|
111
|
+
add: (a, b) => a + b,
|
|
112
|
+
format: { hex: (bytes) => fw.runtime.resolve('hex').fromBytes(bytes) }
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
const { processRPC } = fw.runtime.resolveAll(['processRPC']);
|
|
116
|
+
const { port } = processRPC.create(api);
|
|
117
|
+
|
|
118
|
+
const worker = fw.createWorker(
|
|
119
|
+
function({ libs }) {
|
|
120
|
+
// The port arrives by explicit transfer — not via `args`.
|
|
121
|
+
self.onmessage = async (event) => {
|
|
122
|
+
const rpc = await libs.processRPC.open(event.ports[0]);
|
|
123
|
+
|
|
124
|
+
const sum = await rpc.add(10, 32); // → 42
|
|
125
|
+
const str = await rpc.format.hex([255, 0]); // → "ff00"
|
|
126
|
+
self.postMessage({ sum, str });
|
|
127
|
+
};
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
dependencies: ['processRPC']
|
|
131
|
+
}
|
|
132
|
+
);
|
|
133
|
+
|
|
134
|
+
// Transfer the port to the worker (2nd argument = list of Transferables)
|
|
135
|
+
worker.postMessage(null, [port[0]]);
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
The reverse direction (worker exposes the API, main thread consumes) also works:
|
|
139
|
+
the worker calls `libs.processRPC.create(api)` then
|
|
140
|
+
`self.postMessage({ rpcReady: true }, [port[0]])`, and the main thread opens
|
|
141
|
+
`event.ports[0]` with `processRPC.open(...)`.
|
|
142
|
+
|
|
143
|
+
## Constraints
|
|
144
|
+
|
|
145
|
+
| Constraint | Reason |
|
|
146
|
+
|-----------|--------|
|
|
147
|
+
| `workerFn` must be self-contained | Converted to string via `.toString()` |
|
|
148
|
+
| `args` must be JSON-serialisable | Transmitted via `JSON.stringify/parse` |
|
|
149
|
+
| No closures over main-thread variables | Not serialisable |
|
|
150
|
+
| No `document`/`window` in the factory | Not available inside workers |
|
|
151
|
+
|
|
152
|
+
## Cleanup
|
|
153
|
+
|
|
154
|
+
```js
|
|
155
|
+
worker.terminate(); // patched → revokeObjectURL + callback + native terminate
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Idempotent — multiple calls are no-ops.
|
|
159
|
+
|
|
160
|
+
## Worker logs
|
|
161
|
+
|
|
162
|
+
If `ENV.LOG = true`, `console.log/warn/error` calls inside the worker are automatically forwarded to `fw.log`. They appear in `fw.log.get()` with the appropriate `lvl`.
|
|
163
|
+
|
|
164
|
+
## See also
|
|
165
|
+
|
|
166
|
+
- [createWorker API](../api/core/worker-helper.md)
|
|
167
|
+
- [processMessage](../api/process/message.md)
|
|
168
|
+
- [processRPC](../api/process/rpc.md)
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
---
|
|
2
|
+
category: note
|
|
3
|
+
status: delivered
|
|
4
|
+
scope: io/compress
|
|
5
|
+
date: 2026-09-05
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# LZ77 scanner factorisation in `deflate`
|
|
9
|
+
|
|
10
|
+
> Engineering note — identified technical debt, non-urgent. Prerequisites to fulfil before execution.
|
|
11
|
+
|
|
12
|
+
## Finding
|
|
13
|
+
|
|
14
|
+
`deflate.js` re-implements its own LZ77 logic inline in `_dflt()` (3-byte hash-chain, `head`/`prev` arrays, lazy match — ~50 dense lines). In parallel, the standalone `lz77` module exists, tested, and is already consumed by `brotli`. The primitive is therefore duplicated.
|
|
15
|
+
|
|
16
|
+
`huffman` does not suffer from this problem: it is already shared between `deflate` and `brotli`.
|
|
17
|
+
|
|
18
|
+
## Proposal
|
|
19
|
+
|
|
20
|
+
Rewrite the matching pass of `deflate._dflt()` to use `lz77.encode(data, opts, { literal, match })` instead of the inline block.
|
|
21
|
+
|
|
22
|
+
## Motivation
|
|
23
|
+
|
|
24
|
+
Clean technical debt:
|
|
25
|
+
|
|
26
|
+
- **DRY** — a single hash-chain scanner across the whole framework.
|
|
27
|
+
- **Future encoders** — a Zopfli-like encoder or a "max compression" mode plugs in by changing `chainDepth`/`lazy`/`maxMatch` without touching the rest of `deflate`.
|
|
28
|
+
- **Bug isolation** — fixes on `lz77` (boundary checks, edge cases on small buffers) automatically benefit `deflate` instead of having to be replicated.
|
|
29
|
+
- **Readability** — `deflate.js` loses ~50 dense lines, gains in intent clarity.
|
|
30
|
+
|
|
31
|
+
## Status
|
|
32
|
+
|
|
33
|
+
**Not urgent.** The inline code of `deflate` is not broken and produces good ratios. This is architectural hygiene, not a bug fix nor an optimisation.
|
|
34
|
+
|
|
35
|
+
## Prerequisites before cutover
|
|
36
|
+
|
|
37
|
+
1. **Make `lz77.hashFn` injectable.** The `deflate` hash is very specific to RFC 1951:
|
|
38
|
+
```js
|
|
39
|
+
const hsh = i => (dat[i] ^ (dat[i+1] << bs1) ^ (dat[i+2] << bs2)) & msk;
|
|
40
|
+
```
|
|
41
|
+
Whereas `lz77` uses a multiplicative FNV-1a. Without an injectable `hashFn` option, the factorisation would change the produced bytes (still conformant to the DEFLATE format, but different). An injectable hash function allows a **bit-exact** cutover if golden tests or reference vectors require it.
|
|
42
|
+
|
|
43
|
+
2. **Benchmark the cost of callbacks vs inline before merging.** The `literal(pos)/match(pos, len, dist)` interface adds one function call per token, whereas the inline block is tight and JIT-warmed. The expected cost is **10–30 %** depending on the workload. To measure with:
|
|
44
|
+
- representative corpora (text, JSON, binary, source code),
|
|
45
|
+
- all levels `level=1..9`,
|
|
46
|
+
- comparison vs the current implementation on the same hardware.
|
|
47
|
+
|
|
48
|
+
If the regression is unacceptable, consider a "fast path" variant of the `lz77` module that returns a packed buffer directly instead of going through callbacks.
|
|
49
|
+
|
|
50
|
+
## Additional considerations
|
|
51
|
+
|
|
52
|
+
- The `syms[]` of `deflate` is not pure LZ77 — it already contains the DEFLATE pre-encoding (RFC 1951 length/distance codes, extra bits). The conversion to this format remains **inline after each `match` callback**. The line-count gain is therefore more modest than expected.
|
|
53
|
+
- Verify that the `lz77` module properly supports `minMatch = 3` (used by DEFLATE, whereas the documented default is 4 for Brotli).
|
|
54
|
+
- Ensure that the existing `deflate` tests cover the round-trip (compress → decompress → identity). If they are bit-exact (binary comparison with a reference encoder), prerequisite 1 above is blocking; otherwise, optional.
|
|
55
|
+
|
|
56
|
+
## Decision
|
|
57
|
+
|
|
58
|
+
Revisit when one of the following occurs:
|
|
59
|
+
- need for an alternative DEFLATE encoder (Zopfli, max compression, custom streaming mode),
|
|
60
|
+
- bug fixed on `lz77` that would need to be replicated manually in `deflate`,
|
|
61
|
+
- broader refactor of the `io/compress` directory.
|
|
62
|
+
|
|
63
|
+
Until then, keep the duplication as an accepted trade-off.
|
|
64
|
+
|
|
65
|
+
## Outcome
|
|
66
|
+
|
|
67
|
+
- **Prerequisite 1 fulfilled.** `lz77.encode`/`encodeTokens` gained
|
|
68
|
+
additive `hashFn`, `start` and `niceLength` options (task 01,
|
|
69
|
+
`01-lz77-scanner-extensions`), making an injectable hash function — and
|
|
70
|
+
therefore a bit-exact cutover path — available without touching the
|
|
71
|
+
module's existing default behaviour or its 6 pre-existing `DEFAULT`
|
|
72
|
+
values.
|
|
73
|
+
- **The factorisation landed, but as a full in-house rewrite rather than a
|
|
74
|
+
cutover onto the pre-existing `lz77.encode` callback interface.**
|
|
75
|
+
`deflate.js`'s DEFLATE encoder was rewritten from RFC 1951 (task 03,
|
|
76
|
+
`03-deflate-encoder-rfc1951`) to scan through the shared `lz77` module —
|
|
77
|
+
first via `lz77.encode`'s `literal`/`match` callbacks, then via
|
|
78
|
+
`lz77.encodeTokens`'s packed `(len, dist)` buffer — replacing the
|
|
79
|
+
duplicated inline hash-chain scanner this note flagged.
|
|
80
|
+
- **Prerequisite 2's callback-vs-packed-token measurement (task 03) settled
|
|
81
|
+
as a wash, not a win**, and a separate perf landing then closed the
|
|
82
|
+
larger regression the note did not anticipate. Quoted from
|
|
83
|
+
`03-report.md`: "Δbytes is IDENTICAL to the callback run at every level,
|
|
84
|
+
which independently confirms `encodeTokens` emits the same token
|
|
85
|
+
sequence as `encode`. Δtime is within run-to-run noise of the callback
|
|
86
|
+
path (no consistent direction: −6 pp at level 3, +10 pp at level 8). The
|
|
87
|
+
packed path ships — exactly one path, no dead alternative — per the
|
|
88
|
+
plan's branch, but it is a wash, not a win." Both paths initially missed
|
|
89
|
+
the batch's `< +5 %` Δtime gate by a wide margin (+21 % … +272 %); an
|
|
90
|
+
owner-commissioned perf analysis then found 85–100 % of the regression
|
|
91
|
+
inside the `lz77` scan itself (not the callback/packed-token boundary)
|
|
92
|
+
and directed a scanner rewrite with lazy matching off by default — see
|
|
93
|
+
[`deflate.md` § Design › Encoder](../api/io/compress/deflate.md#encoder)
|
|
94
|
+
for the shipped `lz77.encodeTokens` wiring and level table, and
|
|
95
|
+
[`deflate.md` § Benchmark](../api/io/compress/deflate.md#benchmark) for
|
|
96
|
+
the final measured record (all nine levels PASS the gate).
|