mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 10:28:47 +00:00
Fix bug with macro remaps in Bun.Transpiler api
This commit is contained in:
@@ -530,6 +530,10 @@ pub fn constructor(
|
||||
return null;
|
||||
};
|
||||
|
||||
if (transpiler_options.macro_map.count() > 0) {
|
||||
bundler.options.macro_remap = transpiler_options.macro_map;
|
||||
}
|
||||
|
||||
var transpiler = getAllocator(ctx).create(Transpiler) catch unreachable;
|
||||
transpiler.* = Transpiler{
|
||||
.transpiler_options = transpiler_options,
|
||||
@@ -538,10 +542,6 @@ pub fn constructor(
|
||||
.scan_pass_result = ScanPassResult.init(getAllocator(ctx)),
|
||||
};
|
||||
|
||||
if (transpiler_options.macro_map.count() > 0) {
|
||||
bundler.options.macro_remap = transpiler_options.macro_map;
|
||||
}
|
||||
|
||||
return Class.make(ctx, transpiler);
|
||||
}
|
||||
|
||||
@@ -907,6 +907,9 @@ pub fn scanImports(
|
||||
this.bundler.options.jsx;
|
||||
|
||||
var opts = JSParser.Parser.Options.init(jsx, loader);
|
||||
if (this.bundler.macro_context == null) {
|
||||
this.bundler.macro_context = JSAst.Macro.MacroContext.init(&this.bundler);
|
||||
}
|
||||
opts.macro_context = &this.bundler.macro_context.?;
|
||||
var log = logger.Log.init(getAllocator(ctx));
|
||||
defer log.deinit();
|
||||
|
||||
@@ -87,7 +87,7 @@ static bool isTaggedUTF16Ptr(const unsigned char *ptr) {
|
||||
return (reinterpret_cast<uintptr_t>(ptr) & (static_cast<uint64_t>(1) << 63)) != 0;
|
||||
}
|
||||
|
||||
// Do we need to upcase the string?
|
||||
// Do we need to convert the string from UTF-8 to UTF-16?
|
||||
static bool isTaggedUTF8Ptr(const unsigned char *ptr) {
|
||||
return (reinterpret_cast<uintptr_t>(ptr) & (static_cast<uint64_t>(1) << 61)) != 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user