diff options
Diffstat (limited to 'src/api')
-rw-r--r-- | src/api/bundle_v2.peechy | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/src/api/bundle_v2.peechy b/src/api/bundle_v2.peechy new file mode 100644 index 000000000..db83d257b --- /dev/null +++ b/src/api/bundle_v2.peechy @@ -0,0 +1,75 @@ +struct Export { + uint32 part_id; + StringPointer name; +} + + +struct JavascriptBundledPart { + StringPointer code; + + uint32 dependencies_offset; + uint32 dependencies_length; + + uint32 exports_offset; + uint32 exports_length; + + uint32 from_module; + + // The ESM export is this id ("$" + number.toString(16)) + uint32 id; +} + +struct JavascriptBundledModule { + // package-relative path including file extension + StringPointer path; + + uint32 parts_offset; + uint32 parts_length; + + uint32 exports_offset; + uint32 exports_length; + + // index into JavascriptBundle.packages + uint32 package_id; + + // This lets us efficiently compare strings ignoring the extension + byte path_extname_length; +} + +struct JavascriptBundledPackage { + StringPointer name; + StringPointer version; + uint32 hash; + + uint32 modules_offset; + uint32 modules_length; +} + +struct JavascriptBundle { + // These are sorted alphabetically so you can do binary search + JavascriptBundledModule[] modules; + JavascriptBundledPackage[] packages; + + // This is ASCII-encoded so you can send it directly over HTTP + byte[] etag; + + uint32 generated_at; + + byte[] import_from_name; + + // This is what StringPointer refers to + byte[] manifest_string; +} + +message JavascriptBundleContainer { + uint32 bundle_format_version = 1; + + // These go first so if we change JavaScriptBundle we can still read these + LoadedRouteConfig routes = 3; + LoadedFramework framework = 2; + + JavascriptBundle bundle = 4; + + // Don't technically need to store this, but it may be helpful as a sanity check + uint32 code_length = 5; +} |