diff options
Diffstat (limited to 'src/bun.js')
-rw-r--r-- | src/bun.js/bindings/JSBuffer.lut.h | 4 | ||||
-rw-r--r-- | src/bun.js/module_loader.zig | 23 |
2 files changed, 17 insertions, 10 deletions
diff --git a/src/bun.js/bindings/JSBuffer.lut.h b/src/bun.js/bindings/JSBuffer.lut.h index 47e8cb984..35a3acea9 100644 --- a/src/bun.js/bindings/JSBuffer.lut.h +++ b/src/bun.js/bindings/JSBuffer.lut.h @@ -37,8 +37,8 @@ static const struct CompactHashIndex jsBufferConstructorTableIndex[33] = { static const struct HashTableValue jsBufferConstructorTableValues[10] = { { "alloc"_s, static_cast<unsigned>(PropertyAttribute::Constructable|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, jsBufferConstructorFunction_alloc, 1 } }, - { "allocUnsafe"_s, static_cast<unsigned>(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, jsBufferConstructorFunction_allocUnsafe, 1 } }, - { "allocUnsafeSlow"_s, static_cast<unsigned>(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, jsBufferConstructorFunction_allocUnsafeSlow, 1 } }, + { "allocUnsafe"_s, static_cast<unsigned>(PropertyAttribute::Constructable|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, jsBufferConstructorFunction_allocUnsafe, 1 } }, + { "allocUnsafeSlow"_s, static_cast<unsigned>(PropertyAttribute::Constructable|PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, jsBufferConstructorFunction_allocUnsafeSlow, 1 } }, { "byteLength"_s, static_cast<unsigned>(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, jsBufferConstructorFunction_byteLength, 2 } }, { "compare"_s, static_cast<unsigned>(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, jsBufferConstructorFunction_compare, 2 } }, { "concat"_s, static_cast<unsigned>(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, jsBufferConstructorFunction_concat, 2 } }, diff --git a/src/bun.js/module_loader.zig b/src/bun.js/module_loader.zig index a54b42825..ca066450d 100644 --- a/src/bun.js/module_loader.zig +++ b/src/bun.js/module_loader.zig @@ -1937,14 +1937,21 @@ pub const ModuleLoader = struct { } } - const synchronous_loader = loader orelse - // Unknown extensions are to be treated as file loader - if (jsc_vm.has_loaded or jsc_vm.is_in_preload) - options.Loader.file - else - // Unless it's potentially the main module - // This is important so that "bun run ./foo-i-have-no-extension" works - options.Loader.js; + const synchronous_loader = loader orelse loader: { + if (jsc_vm.has_loaded or jsc_vm.is_in_preload) { + // Extensionless files in this context are treated as the JS loader + if (path.name.ext.len == 0) { + break :loader options.Loader.tsx; + } + + // Unknown extensions are to be treated as file loader + break :loader options.Loader.file; + } else { + // Unless it's potentially the main module + // This is important so that "bun run ./foo-i-have-no-extension" works + break :loader options.Loader.tsx; + } + }; var promise: ?*JSC.JSInternalPromise = null; ret.* = ErrorableResolvedSource.ok( |