mirror of
https://github.com/oven-sh/bun
synced 2026-02-14 21:01:52 +00:00
fix loaders used by Module._extensions (#23291)
### What does this PR do? Three things: - JSCommonJSExtensions.cpp `onAssign` was returning out of sync numbers instead of `BunLoaderTypeJS`/`BunLoaderTypeNAPI`/... - `bun.schema.api.Loader._none` was 255 instead of 254 like `BunLoaderTypeNone` - `Bun__transpileFile` used `bun.options.Loader.Optional` instead of `bun.schema.api.Loader`. `bun.options.Loader` does not have a type kept in sync in C++. ### How did you verify your code works? Added tests that make sure the correct loader is used for modules required with custom _extensions functions
This commit is contained in:
@@ -1600,9 +1600,10 @@ pub export fn Bun__transpileFile(
|
||||
ret: *jsc.ErrorableResolvedSource,
|
||||
allow_promise: bool,
|
||||
is_commonjs_require: bool,
|
||||
force_loader_type: bun.options.Loader.Optional,
|
||||
_force_loader_type: bun.schema.api.Loader,
|
||||
) ?*anyopaque {
|
||||
jsc.markBinding(@src());
|
||||
const force_loader_type: bun.options.Loader.Optional = .fromAPI(_force_loader_type);
|
||||
var log = logger.Log.init(jsc_vm.transpiler.allocator);
|
||||
defer log.deinit();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user