mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 10:28:47 +00:00
Disable concurrent transpiler in macros
This commit is contained in:
@@ -751,6 +751,7 @@ pub const VirtualMachine = struct {
|
||||
this.macro_mode = true;
|
||||
this.event_loop = &this.macro_event_loop;
|
||||
Analytics.Features.macros = true;
|
||||
this.transpiler_store.enabled = false;
|
||||
}
|
||||
|
||||
pub fn disableMacroMode(this: *VirtualMachine) void {
|
||||
@@ -758,6 +759,7 @@ pub const VirtualMachine = struct {
|
||||
this.bundler.resolver.caches.fs.use_alternate_source_cache = false;
|
||||
this.macro_mode = false;
|
||||
this.event_loop = &this.regular_event_loop;
|
||||
this.transpiler_store.enabled = true;
|
||||
}
|
||||
|
||||
pub fn getAPIGlobals() []js.JSClassRef {
|
||||
|
||||
@@ -178,6 +178,7 @@ pub const RuntimeTranspilerStore = struct {
|
||||
|
||||
generation_number: std.atomic.Atomic(u32) = std.atomic.Atomic(u32).init(0),
|
||||
store: TranspilerJob.Store,
|
||||
enabled: bool = true,
|
||||
|
||||
pub fn init(allocator: std.mem.Allocator) RuntimeTranspilerStore {
|
||||
return RuntimeTranspilerStore{
|
||||
@@ -2035,7 +2036,7 @@ pub const ModuleLoader = struct {
|
||||
if (allow_promise and loader.isJavaScriptLike() and
|
||||
// Plugins make this complicated,
|
||||
// TODO: allow running concurrently when no onLoad handlers match a plugin.
|
||||
jsc_vm.plugin_runner == null)
|
||||
jsc_vm.plugin_runner == null and jsc_vm.transpiler_store.enabled)
|
||||
{
|
||||
if (!strings.eqlLong(specifier, jsc_vm.main, true)) {
|
||||
return jsc_vm.transpiler_store.transpile(
|
||||
|
||||
@@ -11,3 +11,11 @@ test("ascii string", () => {
|
||||
test("utf16 string", () => {
|
||||
expect(identity("😊 Smiling Face with Smiling Eyes Emoji")).toBe("😊 Smiling Face with Smiling Eyes Emoji");
|
||||
});
|
||||
|
||||
test("template string ascii", () => {
|
||||
expect(identity(`A${""}`)).toBe("A");
|
||||
});
|
||||
|
||||
test("template string latin1", () => {
|
||||
expect(identity(`©${""}`)).toBe("©");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user