aboutsummaryrefslogtreecommitdiff
path: root/src/api
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2022-04-16 09:29:10 -0700
committerGravatar Jarred Sumner <jarred@jarredsumner.com> 2022-04-16 09:29:10 -0700
commit0137e5cf94a2cfd510f70d8881f67e8066e0d098 (patch)
treec16b792c1e75b010f5e8a9b0cc7f924f69e3e236 /src/api
parent89ca887ea0c0c673f1c1c22cb5913f09435feeb6 (diff)
downloadbun-0137e5cf94a2cfd510f70d8881f67e8066e0d098.tar.gz
bun-0137e5cf94a2cfd510f70d8881f67e8066e0d098.tar.zst
bun-0137e5cf94a2cfd510f70d8881f67e8066e0d098.zip
[JS Parser] Support explicit removing
Diffstat (limited to 'src/api')
-rw-r--r--src/api/bundle_v2.peechy75
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;
+}