Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/denoland/eszip
A compact file format to losslessly serialize an ECMAScript module graph into a single file
https://github.com/denoland/eszip
deno esm javascript rust typescript
Last synced: 5 days ago
JSON representation
A compact file format to losslessly serialize an ECMAScript module graph into a single file
- Host: GitHub
- URL: https://github.com/denoland/eszip
- Owner: denoland
- License: mit
- Created: 2021-02-14T22:40:09.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2024-12-17T02:50:02.000Z (about 1 month ago)
- Last Synced: 2025-01-10T09:05:06.650Z (12 days ago)
- Topics: deno, esm, javascript, rust, typescript
- Language: Rust
- Homepage: https://crates.io/crates/eszip
- Size: 70.8 MB
- Stars: 235
- Watchers: 17
- Forks: 27
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-repositories - denoland/eszip - A compact file format to losslessly serialize an ECMAScript module graph into a single file (Rust)
README
# eszip
The eszip format lets you losslessly serialize an ECMAScript module graph
(represented by [`deno_graph::ModuleGraph`][module_graph]) into a single compact
file.The eszip file format is designed to be compact and streaming capable. This
allows for efficient loading of large ECMAScript module graphs.https://eszip-viewer.deno.dev/ is a tool for inspecting eszip files.
[module_graph]: https://docs.rs/deno_graph/latest/deno_graph/struct.ModuleGraph.html
## Examples
### Creating an eszip
```shell
cargo run --example eszip_builder https://deno.land/std/http/file_server.ts file_server.eszip2
```### Viewing the contents of an eszip
```shell
cargo run --example eszip_viewer file_server.eszip2
```### Loading the eszip into V8
```shell
cargo run --example eszip_load file_server.eszip2 https://deno.land/std/http/file_server.ts
```## File format
The file format looks as follows:
```
Eszip:
| Magic (8) | Header size (4) | Header (n) | Header hash (32) | Sources size (4) | Sources (n) | SourceMaps size (4) | SourceMaps (n) |Header:
( | Specifier size (4) | Specifier (n) | Entry type (1) | Entry (n) | )*Entry (redirect):
| Specifier size (4) | Specifier (n) |Entry (module):
| Source offset (4) | Source size (4) | SourceMap offset (4) | SourceMap size (4) | Module type (1) |Sources:
( | Source (n) | Hash (32) | )*SourceMaps:
( | SourceMap (n) | Hash (32) | )*
```There is one optimization for empty source / source map entries. If both the
offset and size are set to 0, no entry and no hash is present in the data
sections for that module.## Development
When opening a PR make sure to rebuild Wasm by running:
```
deno task build
```