diff options
author | 2023-04-29 19:42:38 -0700 | |
---|---|---|
committer | 2023-04-29 19:42:38 -0700 | |
commit | 5fb014876b7eb207d985933714678a71a07777b6 (patch) | |
tree | 316a5be9fe25d7bcfe4c9a110c04584837db518e | |
parent | e7ff65ce2cd0b165592a145f8abf242f04655d9f (diff) | |
download | bun-5fb014876b7eb207d985933714678a71a07777b6.tar.gz bun-5fb014876b7eb207d985933714678a71a07777b6.tar.zst bun-5fb014876b7eb207d985933714678a71a07777b6.zip |
Fix plugin namespaces always being set to `"flie"`
-rw-r--r-- | src/bun.js/builtins/cpp/BundlerPluginBuiltins.cpp | 5 | ||||
-rw-r--r-- | src/bun.js/builtins/js/BundlerPlugin.js | 2 | ||||
-rw-r--r-- | src/bundler/bundle_v2.zig | 2 |
3 files changed, 5 insertions, 4 deletions
diff --git a/src/bun.js/builtins/cpp/BundlerPluginBuiltins.cpp b/src/bun.js/builtins/cpp/BundlerPluginBuiltins.cpp index 552057d51..0b2c71adf 100644 --- a/src/bun.js/builtins/cpp/BundlerPluginBuiltins.cpp +++ b/src/bun.js/builtins/cpp/BundlerPluginBuiltins.cpp @@ -192,7 +192,7 @@ const char* const s_bundlerPluginRunOnResolvePluginsCode = const JSC::ConstructAbility s_bundlerPluginRunSetupFunctionCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; const JSC::ConstructorKind s_bundlerPluginRunSetupFunctionCodeConstructorKind = JSC::ConstructorKind::None; const JSC::ImplementationVisibility s_bundlerPluginRunSetupFunctionCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_bundlerPluginRunSetupFunctionCodeLength = 3786; +const int s_bundlerPluginRunSetupFunctionCodeLength = 3795; static const JSC::Intrinsic s_bundlerPluginRunSetupFunctionCodeIntrinsic = JSC::NoIntrinsic; const char* const s_bundlerPluginRunSetupFunctionCode = "(function (setup) {\n" \ @@ -223,7 +223,7 @@ const char* const s_bundlerPluginRunSetupFunctionCode = " @throwTypeError(\"namespace must be a string\");\n" \ " }\n" \ "\n" \ - " if (namespace?.length ?? 0) {\n" \ + " if ((namespace?.length ?? 0) === 0) {\n" \ " namespace = \"file\";\n" \ " }\n" \ "\n" \ @@ -233,6 +233,7 @@ const char* const s_bundlerPluginRunSetupFunctionCode = "\n" \ " var callbacks = map.@get(namespace);\n" \ "\n" \ + "\n" \ " if (!callbacks) {\n" \ " map.@set(namespace, [[filter, callback]]);\n" \ " } else {\n" \ diff --git a/src/bun.js/builtins/js/BundlerPlugin.js b/src/bun.js/builtins/js/BundlerPlugin.js index 4daa2dcbb..8e587794b 100644 --- a/src/bun.js/builtins/js/BundlerPlugin.js +++ b/src/bun.js/builtins/js/BundlerPlugin.js @@ -196,7 +196,7 @@ function runSetupFunction(setup) { @throwTypeError("namespace must be a string"); } - if (namespace?.length ?? 0) { + if ((namespace?.length ?? 0) === 0) { namespace = "file"; } diff --git a/src/bundler/bundle_v2.zig b/src/bundler/bundle_v2.zig index 168ef3137..41f7c3e17 100644 --- a/src/bundler/bundle_v2.zig +++ b/src/bundler/bundle_v2.zig @@ -1146,7 +1146,7 @@ pub const BundleV2 = struct { var out_source_index: ?Index = null; if (!result.external) { var path = Fs.Path.init(result.path); - if (path.namespace.len == 0 or strings.eqlComptime(path.namespace, "file")) { + if (result.namespace.len == 0 or strings.eqlComptime(result.namespace, "file")) { path.namespace = "file"; } else { path.namespace = result.namespace; |