A few fixes related to CommonJS module loading (#9540)

* Ensure we always deref the source code

* Move more work to concurrent transpiler

* Update NodeModuleModule.h

* Update string.zig

* Make `Bun.gc()` more effective

* Update text-loader-fixture-dynamic-import-stress.ts

* Update ZigSourceProvider.cpp

* Fixes #6946

* Update ModuleLoader.cpp

* Update ModuleLoader.cpp

* Fixes #8965

* Fixups

* Update ModuleLoader.cpp

* Update ModuleLoader.cpp

* Load it

* Update module_loader.zig

* Update module_loader.zig

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
This commit is contained in:
Jarred Sumner
2024-03-21 10:42:57 -07:00
committed by GitHub
parent 0948727243
commit e124f08caf
27 changed files with 428 additions and 189 deletions

View File

@@ -121,6 +121,13 @@ pub const WTFStringImplStruct = extern struct {
return ZigString.Slice.init(this.refCountAllocator(), this.latin1Slice());
}
extern fn Bun__WTFStringImpl__ensureHash(this: WTFStringImpl) void;
/// Compute the hash() if necessary
pub fn ensureHash(this: WTFStringImpl) void {
JSC.markBinding(@src());
Bun__WTFStringImpl__ensureHash(this);
}
pub fn toUTF8(this: WTFStringImpl, allocator: std.mem.Allocator) ZigString.Slice {
if (this.is8Bit()) {
if (bun.strings.toUTF8FromLatin1(allocator, this.latin1Slice()) catch bun.outOfMemory()) |utf8| {