aboutsummaryrefslogtreecommitdiff
path: root/src/runtime.zig
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2023-05-29 11:23:10 -0700
committerGravatar GitHub <noreply@github.com> 2023-05-29 11:23:10 -0700
commite2de1f5c133ed3aac6fcea7e8e7c5fcd771d65f9 (patch)
tree219ad30067db8641999811b67744ce665f45dd46 /src/runtime.zig
parent2b04ef4fae088b6f39628da312643cf4c54921ad (diff)
downloadbun-e2de1f5c133ed3aac6fcea7e8e7c5fcd771d65f9.tar.gz
bun-e2de1f5c133ed3aac6fcea7e8e7c5fcd771d65f9.tar.zst
bun-e2de1f5c133ed3aac6fcea7e8e7c5fcd771d65f9.zip
Natively support CommonJS at runtime (#3104)
* Natively support CommonJS at runtime * cleanup how getters are handled, add fast path * more consistent with node * use * As * Remove thrown modules on exception * Handle exception better --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Diffstat (limited to 'src/runtime.zig')
-rw-r--r--src/runtime.zig2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/runtime.zig b/src/runtime.zig
index 99d8ca102..f09e16378 100644
--- a/src/runtime.zig
+++ b/src/runtime.zig
@@ -324,6 +324,8 @@ pub const Runtime = struct {
/// So we have a list of packages which we know are safe to do this with.
unwrap_commonjs_packages: []const string = &.{},
+ commonjs_at_runtime: bool = false,
+
pub fn shouldUnwrapRequire(this: *const Features, package_name: string) bool {
return package_name.len > 0 and strings.indexAny(this.unwrap_commonjs_packages, package_name) != null;
}