aboutsummaryrefslogtreecommitdiff
path: root/src/node_fallbacks.zig
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2023-07-11 19:14:34 -0700
committerGravatar GitHub <noreply@github.com> 2023-07-11 19:14:34 -0700
commitcbb88672f217a90db1aa1eb29cd92d5d9035b22b (patch)
tree43a00501f3cde495967e116f0b660777051551f8 /src/node_fallbacks.zig
parent1f900cff453700b19bca2acadfe26da4468c1282 (diff)
parent34b0e7a2bbd8bf8097341cdb0075d0908283e834 (diff)
downloadbun-cbb88672f217a90db1aa1eb29cd92d5d9035b22b.tar.gz
bun-cbb88672f217a90db1aa1eb29cd92d5d9035b22b.tar.zst
bun-cbb88672f217a90db1aa1eb29cd92d5d9035b22b.zip
Merge branch 'main' into jarred/esm-conditionsjarred/esm-conditions
Diffstat (limited to 'src/node_fallbacks.zig')
-rw-r--r--src/node_fallbacks.zig109
1 files changed, 55 insertions, 54 deletions
diff --git a/src/node_fallbacks.zig b/src/node_fallbacks.zig
index fc0dc3bef..51da04be0 100644
--- a/src/node_fallbacks.zig
+++ b/src/node_fallbacks.zig
@@ -3,6 +3,7 @@ const string = @import("./string_types.zig").string;
const PackageJSON = @import("./resolver/package_json.zig").PackageJSON;
const logger = @import("root").bun.logger;
const Fs = @import("./fs.zig");
+const bun = @import("root").bun;
const ComptimeStringMap = @import("./comptime_string_map.zig").ComptimeStringMap;
const assert_code: string = @embedFile("./node-fallbacks/out/assert.js");
@@ -66,8 +67,8 @@ const vercel_fetch_import_path = "/bun-vfs/node_modules/@vercel/fetch/index.js";
const assert_package_json = PackageJSON{
.name = "assert",
.version = "0.0.0-polyfill",
- .module_type = .cjs,
- .hash = @truncate(u32, std.hash.Wyhash.hash(0, "assert@0.0.0-polyfill")),
+ .module_type = .esm,
+ .hash = @truncate(u32, bun.hash("assert@0.0.0-polyfill")),
.main_fields = undefined,
.browser_map = undefined,
.source = logger.Source.initPathString("/bun-vfs/node_modules/assert/package.json", ""),
@@ -75,8 +76,8 @@ const assert_package_json = PackageJSON{
const buffer_package_json = PackageJSON{
.name = "buffer",
.version = "0.0.0-polyfill",
- .module_type = .cjs,
- .hash = @truncate(u32, std.hash.Wyhash.hash(0, "buffer@0.0.0-polyfill")),
+ .module_type = .esm,
+ .hash = @truncate(u32, bun.hash("buffer@0.0.0-polyfill")),
.main_fields = undefined,
.browser_map = undefined,
.source = logger.Source.initPathString("/bun-vfs/node_modules/buffer/package.json", ""),
@@ -84,8 +85,8 @@ const buffer_package_json = PackageJSON{
const console_package_json = PackageJSON{
.name = "console",
.version = "0.0.0-polyfill",
- .module_type = .cjs,
- .hash = @truncate(u32, std.hash.Wyhash.hash(0, "console@0.0.0-polyfill")),
+ .module_type = .esm,
+ .hash = @truncate(u32, bun.hash("console@0.0.0-polyfill")),
.main_fields = undefined,
.browser_map = undefined,
.source = logger.Source.initPathString("/bun-vfs/node_modules/console/package.json", ""),
@@ -93,8 +94,8 @@ const console_package_json = PackageJSON{
const constants_package_json = PackageJSON{
.name = "constants",
.version = "0.0.0-polyfill",
- .module_type = .cjs,
- .hash = @truncate(u32, std.hash.Wyhash.hash(0, "constants@0.0.0-polyfill")),
+ .module_type = .esm,
+ .hash = @truncate(u32, bun.hash("constants@0.0.0-polyfill")),
.main_fields = undefined,
.browser_map = undefined,
.source = logger.Source.initPathString("/bun-vfs/node_modules/constants/package.json", ""),
@@ -102,8 +103,8 @@ const constants_package_json = PackageJSON{
const crypto_package_json = PackageJSON{
.name = "crypto",
.version = "0.0.0-polyfill",
- .module_type = .cjs,
- .hash = @truncate(u32, std.hash.Wyhash.hash(0, "crypto@0.0.0-polyfill")),
+ .module_type = .esm,
+ .hash = @truncate(u32, bun.hash("crypto@0.0.0-polyfill")),
.main_fields = undefined,
.browser_map = undefined,
.source = logger.Source.initPathString("/bun-vfs/node_modules/crypto/package.json", ""),
@@ -111,8 +112,8 @@ const crypto_package_json = PackageJSON{
const domain_package_json = PackageJSON{
.name = "domain",
.version = "0.0.0-polyfill",
- .module_type = .cjs,
- .hash = @truncate(u32, std.hash.Wyhash.hash(0, "domain@0.0.0-polyfill")),
+ .module_type = .esm,
+ .hash = @truncate(u32, bun.hash("domain@0.0.0-polyfill")),
.main_fields = undefined,
.browser_map = undefined,
.source = logger.Source.initPathString("/bun-vfs/node_modules/domain/package.json", ""),
@@ -120,8 +121,8 @@ const domain_package_json = PackageJSON{
const events_package_json = PackageJSON{
.name = "events",
.version = "0.0.0-polyfill",
- .module_type = .cjs,
- .hash = @truncate(u32, std.hash.Wyhash.hash(0, "events@0.0.0-polyfill")),
+ .module_type = .esm,
+ .hash = @truncate(u32, bun.hash("events@0.0.0-polyfill")),
.main_fields = undefined,
.browser_map = undefined,
.source = logger.Source.initPathString("/bun-vfs/node_modules/events/package.json", ""),
@@ -129,8 +130,8 @@ const events_package_json = PackageJSON{
const http_package_json = PackageJSON{
.name = "http",
.version = "0.0.0-polyfill",
- .module_type = .cjs,
- .hash = @truncate(u32, std.hash.Wyhash.hash(0, "http@0.0.0-polyfill")),
+ .module_type = .esm,
+ .hash = @truncate(u32, bun.hash("http@0.0.0-polyfill")),
.main_fields = undefined,
.browser_map = undefined,
.source = logger.Source.initPathString("/bun-vfs/node_modules/http/package.json", ""),
@@ -138,8 +139,8 @@ const http_package_json = PackageJSON{
const https_package_json = PackageJSON{
.name = "https",
.version = "0.0.0-polyfill",
- .module_type = .cjs,
- .hash = @truncate(u32, std.hash.Wyhash.hash(0, "https@0.0.0-polyfill")),
+ .module_type = .esm,
+ .hash = @truncate(u32, bun.hash("https@0.0.0-polyfill")),
.main_fields = undefined,
.browser_map = undefined,
.source = logger.Source.initPathString("/bun-vfs/node_modules/https/package.json", ""),
@@ -147,8 +148,8 @@ const https_package_json = PackageJSON{
const net_package_json = PackageJSON{
.name = "net",
.version = "0.0.0-polyfill",
- .module_type = .cjs,
- .hash = @truncate(u32, std.hash.Wyhash.hash(0, "net@0.0.0-polyfill")),
+ .module_type = .esm,
+ .hash = @truncate(u32, bun.hash("net@0.0.0-polyfill")),
.main_fields = undefined,
.browser_map = undefined,
.source = logger.Source.initPathString("/bun-vfs/node_modules/net/package.json", ""),
@@ -156,8 +157,8 @@ const net_package_json = PackageJSON{
const os_package_json = PackageJSON{
.name = "os",
.version = "0.0.0-polyfill",
- .module_type = .cjs,
- .hash = @truncate(u32, std.hash.Wyhash.hash(0, "os@0.0.0-polyfill")),
+ .module_type = .esm,
+ .hash = @truncate(u32, bun.hash("os@0.0.0-polyfill")),
.main_fields = undefined,
.browser_map = undefined,
.source = logger.Source.initPathString("/bun-vfs/node_modules/os/package.json", ""),
@@ -165,8 +166,8 @@ const os_package_json = PackageJSON{
const path_package_json = PackageJSON{
.name = "path",
.version = "0.0.0-polyfill",
- .module_type = .cjs,
- .hash = @truncate(u32, std.hash.Wyhash.hash(0, "path@0.0.0-polyfill")),
+ .module_type = .esm,
+ .hash = @truncate(u32, bun.hash("path@0.0.0-polyfill")),
.main_fields = undefined,
.browser_map = undefined,
.source = logger.Source.initPathString("/bun-vfs/node_modules/path/package.json", ""),
@@ -174,8 +175,8 @@ const path_package_json = PackageJSON{
const process_package_json = PackageJSON{
.name = "process",
.version = "0.0.0-polyfill",
- .module_type = .cjs,
- .hash = @truncate(u32, std.hash.Wyhash.hash(0, "process@0.0.0-polyfill")),
+ .module_type = .esm,
+ .hash = @truncate(u32, bun.hash("process@0.0.0-polyfill")),
.main_fields = undefined,
.browser_map = undefined,
.source = logger.Source.initPathString("/bun-vfs/node_modules/process/package.json", ""),
@@ -183,8 +184,8 @@ const process_package_json = PackageJSON{
const punycode_package_json = PackageJSON{
.name = "punycode",
.version = "0.0.0-polyfill",
- .module_type = .cjs,
- .hash = @truncate(u32, std.hash.Wyhash.hash(0, "punycode@0.0.0-polyfill")),
+ .module_type = .esm,
+ .hash = @truncate(u32, bun.hash("punycode@0.0.0-polyfill")),
.main_fields = undefined,
.browser_map = undefined,
.source = logger.Source.initPathString("/bun-vfs/node_modules/punycode/package.json", ""),
@@ -192,8 +193,8 @@ const punycode_package_json = PackageJSON{
const querystring_package_json = PackageJSON{
.name = "querystring",
.version = "0.0.0-polyfill",
- .module_type = .cjs,
- .hash = @truncate(u32, std.hash.Wyhash.hash(0, "querystring@0.0.0-polyfill")),
+ .module_type = .esm,
+ .hash = @truncate(u32, bun.hash("querystring@0.0.0-polyfill")),
.main_fields = undefined,
.browser_map = undefined,
.source = logger.Source.initPathString("/bun-vfs/node_modules/querystring/package.json", ""),
@@ -201,8 +202,8 @@ const querystring_package_json = PackageJSON{
const stream_package_json = PackageJSON{
.name = "stream",
.version = "0.0.0-polyfill",
- .module_type = .cjs,
- .hash = @truncate(u32, std.hash.Wyhash.hash(0, "stream@0.0.0-polyfill")),
+ .module_type = .esm,
+ .hash = @truncate(u32, bun.hash("stream@0.0.0-polyfill")),
.main_fields = undefined,
.browser_map = undefined,
.source = logger.Source.initPathString("/bun-vfs/node_modules/stream/package.json", ""),
@@ -210,10 +211,10 @@ const stream_package_json = PackageJSON{
const string_decoder_package_json = PackageJSON{
.name = "string_decoder",
.version = "0.0.0-polyfill",
- .module_type = .cjs,
+ .module_type = .esm,
.hash = brk: {
@setEvalBranchQuota(9999);
- break :brk @truncate(u32, std.hash.Wyhash.hash(0, "string_decoder@0.0.0-polyfill"));
+ break :brk @truncate(u32, bun.hash("string_decoder@0.0.0-polyfill"));
},
.main_fields = undefined,
@@ -224,8 +225,8 @@ const string_decoder_package_json = PackageJSON{
const sys_package_json = PackageJSON{
.name = "sys",
.version = "0.0.0-polyfill",
- .module_type = .cjs,
- .hash = @truncate(u32, std.hash.Wyhash.hash(0, "sys@0.0.0-polyfill")),
+ .module_type = .esm,
+ .hash = @truncate(u32, bun.hash("sys@0.0.0-polyfill")),
.main_fields = undefined,
.browser_map = undefined,
.source = logger.Source.initPathString("/bun-vfs/node_modules/sys/package.json", ""),
@@ -233,8 +234,8 @@ const sys_package_json = PackageJSON{
const timers_package_json = PackageJSON{
.name = "timers",
.version = "0.0.0-polyfill",
- .module_type = .cjs,
- .hash = @truncate(u32, std.hash.Wyhash.hash(0, "timers@0.0.0-polyfill")),
+ .module_type = .esm,
+ .hash = @truncate(u32, bun.hash("timers@0.0.0-polyfill")),
.main_fields = undefined,
.browser_map = undefined,
.source = logger.Source.initPathString("/bun-vfs/node_modules/timers/package.json", ""),
@@ -242,8 +243,8 @@ const timers_package_json = PackageJSON{
const tty_package_json = PackageJSON{
.name = "tty",
.version = "0.0.0-polyfill",
- .module_type = .cjs,
- .hash = @truncate(u32, std.hash.Wyhash.hash(0, "tty@0.0.0-polyfill")),
+ .module_type = .esm,
+ .hash = @truncate(u32, bun.hash("tty@0.0.0-polyfill")),
.main_fields = undefined,
.browser_map = undefined,
.source = logger.Source.initPathString("/bun-vfs/node_modules/tty/package.json", ""),
@@ -251,8 +252,8 @@ const tty_package_json = PackageJSON{
const url_package_json = PackageJSON{
.name = "url",
.version = "0.0.0-polyfill",
- .module_type = .cjs,
- .hash = @truncate(u32, std.hash.Wyhash.hash(0, "url@0.0.0-polyfill")),
+ .module_type = .esm,
+ .hash = @truncate(u32, bun.hash("url@0.0.0-polyfill")),
.main_fields = undefined,
.browser_map = undefined,
.source = logger.Source.initPathString("/bun-vfs/node_modules/url/package.json", ""),
@@ -260,8 +261,8 @@ const url_package_json = PackageJSON{
const util_package_json = PackageJSON{
.name = "util",
.version = "0.0.0-polyfill",
- .module_type = .cjs,
- .hash = @truncate(u32, std.hash.Wyhash.hash(0, "util@0.0.0-polyfill")),
+ .module_type = .esm,
+ .hash = @truncate(u32, bun.hash("util@0.0.0-polyfill")),
.main_fields = undefined,
.browser_map = undefined,
.source = logger.Source.initPathString("/bun-vfs/node_modules/util/package.json", ""),
@@ -269,8 +270,8 @@ const util_package_json = PackageJSON{
const zlib_package_json = PackageJSON{
.name = "zlib",
.version = "0.0.0-polyfill",
- .module_type = .cjs,
- .hash = @truncate(u32, std.hash.Wyhash.hash(0, "zlib@0.0.0-polyfill")),
+ .module_type = .esm,
+ .hash = @truncate(u32, bun.hash("zlib@0.0.0-polyfill")),
.main_fields = undefined,
.browser_map = undefined,
.source = logger.Source.initPathString("/bun-vfs/node_modules/zlib/package.json", ""),
@@ -279,8 +280,8 @@ const zlib_package_json = PackageJSON{
const node_fetch_package_json = PackageJSON{
.name = "node-fetch",
.version = "0.0.0-polyfill",
- .module_type = .cjs,
- .hash = @truncate(u32, std.hash.Wyhash.hash(0, "node-fetch@0.0.0-polyfill")),
+ .module_type = .esm,
+ .hash = @truncate(u32, bun.hash("node-fetch@0.0.0-polyfill")),
.main_fields = undefined,
.browser_map = undefined,
.source = logger.Source.initPathString("/bun-vfs/node_modules/node-fetch/package.json", ""),
@@ -288,8 +289,8 @@ const node_fetch_package_json = PackageJSON{
const isomorphic_fetch_package_json = PackageJSON{
.name = "isomorphic-fetch",
.version = "0.0.0-polyfill",
- .module_type = .cjs,
- .hash = @truncate(u32, std.hash.Wyhash.hash(0, "isomorphic-fetch@0.0.0-polyfill")),
+ .module_type = .esm,
+ .hash = @truncate(u32, bun.hash("isomorphic-fetch@0.0.0-polyfill")),
.main_fields = undefined,
.browser_map = undefined,
.source = logger.Source.initPathString("/bun-vfs/node_modules/isomorphic-fetch/package.json", ""),
@@ -297,8 +298,8 @@ const isomorphic_fetch_package_json = PackageJSON{
const supports_color_package_json = PackageJSON{
.name = "supports-color",
.version = "0.0.0-polyfill",
- .module_type = .cjs,
- .hash = @truncate(u32, std.hash.Wyhash.hash(0, "supports-color@0.0.0-polyfill")),
+ .module_type = .esm,
+ .hash = @truncate(u32, bun.hash("supports-color@0.0.0-polyfill")),
.main_fields = undefined,
.browser_map = undefined,
.source = logger.Source.initPathString("/bun-vfs/node_modules/supports-color/package.json", ""),
@@ -307,8 +308,8 @@ const supports_color_package_json = PackageJSON{
const vercel_fetch_package_json = PackageJSON{
.name = "@vercel/fetch",
.version = "0.0.0-polyfill",
- .module_type = .cjs,
- .hash = @truncate(u32, std.hash.Wyhash.hash(0, "@vercel/fetch@0.0.0-polyfill")),
+ .module_type = .esm,
+ .hash = @truncate(u32, bun.hash("@vercel/fetch@0.0.0-polyfill")),
.main_fields = undefined,
.browser_map = undefined,
.source = logger.Source.initPathString("/bun-vfs/node_modules/@vercel/fetch/package.json", ""),