aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-04-28 10:35:50 -0700
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-04-28 10:35:50 -0700
commitc383638ddd0b220c482e2e0ec7baa2f650d05776 (patch)
tree0dec655530d525ccb3f2f75ed82e0d48c7849046
parentaf02b75f7939981bf7330df435e0e1751c7b0958 (diff)
downloadbun-c383638ddd0b220c482e2e0ec7baa2f650d05776.tar.gz
bun-c383638ddd0b220c482e2e0ec7baa2f650d05776.tar.zst
bun-c383638ddd0b220c482e2e0ec7baa2f650d05776.zip
Use global allocator tsconfig.json
-rw-r--r--src/resolver/resolver.zig9
1 files changed, 6 insertions, 3 deletions
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()) {