| 1 | // Alchemy modifications are licensed under Apache-2.0. |
| 2 | // This file includes third-party code; see /THIRD_PARTY_LICENSES.md. |
| 3 | // -- Constants for manifest encoding/decoding -- |
| 4 | // (header and tails are not currently being used for anything afaik) |
| 5 | // NB these all refer to bytes |
| 6 | |
| 7 | /** Reserved header at the start of the whole manifest, NOT in each entry (currently unused) |
| 8 | * manifest = [HEADER, [ entry = PATH_HASH, CONTENT_HASH, TAIL], [entry], ... , [entry] ] |
| 9 | */ |
| 10 | export const HEADER_SIZE = 20; |
| 11 | /** manifest = [HEADER, [ entry = PATH_HASH, CONTENT_HASH, TAIL], [entry], ... , [entry] ] */ |
| 12 | export const PATH_HASH_SIZE = 16; |
| 13 | /** manifest = [HEADER, [ entry = PATH_HASH, CONTENT_HASH, TAIL], [entry], ... , [entry] ] */ |
| 14 | export const CONTENT_HASH_SIZE = 16; |
| 15 | /** manifest = [HEADER, [ entry = PATH_HASH, CONTENT_HASH, TAIL], [entry], ... , [entry] ] */ |
| 16 | export const TAIL_SIZE = 8; |
| 17 | /** offset of PATH_HASH from start of each entry |
| 18 | * manifest = [HEADER, [ entry = PATH_HASH, CONTENT_HASH, TAIL], [entry], ... , [entry] ] */ |
| 19 | export const PATH_HASH_OFFSET = 0; |
| 20 | /** offset of CONTENT_HASH from start of each entry |
| 21 | * manifest = [HEADER, [ entry = PATH_HASH, CONTENT_HASH, TAIL], [entry], ... , [entry] ] */ |
| 22 | export const CONTENT_HASH_OFFSET = PATH_HASH_SIZE; |
| 23 | /** manifest = [HEADER, [ entry = PATH_HASH, CONTENT_HASH, TAIL], [entry], ... , [entry] ] */ |
| 24 | export const ENTRY_SIZE = PATH_HASH_SIZE + CONTENT_HASH_SIZE + TAIL_SIZE; |
| 25 | |
| 26 | // -- Manifest creation constants -- |
| 27 | // used in wrangler dev and deploy |
| 28 | /** |
| 29 | * Maximum number of assets that can be deployed with a Worker; this is a global |
| 30 | * ceiling, and may vary by the user's subscription. |
| 31 | */ |
| 32 | export const MAX_ASSET_COUNT = 100_000; |
| 33 | /** Maximum size per asset that can be deployed with a Worker */ |
| 34 | export const MAX_ASSET_SIZE = 25 * 1024 * 1024; |
| 35 | |
| 36 | export const CF_ASSETS_IGNORE_FILENAME = ".assetsignore"; |
| 37 | export const REDIRECTS_FILENAME = "_redirects"; |
| 38 | export const HEADERS_FILENAME = "_headers"; |