From c383638ddd0b220c482e2e0ec7baa2f650d05776 Mon Sep 17 00:00:00 2001 From: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> Date: Fri, 28 Apr 2023 10:35:50 -0700 Subject: Use global allocator tsconfig.json --- src/resolver/resolver.zig | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/resolver/resolver.zig') diff --git a/src/resolver/resolver.zig b/src/resolver/resolver.zig index 0e9bd3a22..380992436 100644 --- a/src/resolver/resolver.zig +++ b/src/resolver/resolver.zig @@ -2217,7 +2217,10 @@ pub const Resolver = struct { file: string, dirname_fd: StoredFileDescriptorType, ) !?*TSConfigJSON { - const entry = try r.caches.fs.readFile( + // Since tsconfig.json is cached permanently, in our DirEntries cache + // we must use the global allocator + const entry = try r.caches.fs.readFileWithAllocator( + bun.fs_allocator, r.fs, file, dirname_fd, @@ -2227,12 +2230,12 @@ pub const Resolver = struct { // The file name needs to be persistent because it can have errors // and if those errors need to print the filename // then it will be undefined memory if we parse another tsconfig.json late - const key_path = try Path.init(file).dupeAlloc(r.allocator); + const key_path = Fs.Path.init(r.fs.dirname_store.append(string, file) catch unreachable); const source = logger.Source.initPathString(key_path.text, entry.contents); const file_dir = source.path.sourceDir(); - var result = (try TSConfigJSON.parse(r.allocator, r.log, source, &r.caches.json, r.opts.jsx.development)) orelse return null; + var result = (try TSConfigJSON.parse(bun.fs_allocator, r.log, source, &r.caches.json, r.opts.jsx.development)) orelse return null; if (result.hasBaseURL()) { -- cgit v1.2.3