diff options
author | 2022-04-10 04:57:51 -0700 | |
---|---|---|
committer | 2022-04-10 04:57:51 -0700 | |
commit | 1e810d229e954353cc2e76d650b5c3cc81e19e47 (patch) | |
tree | cc7229a4b05e5dbe36f4e825514c6bdd99a1a99b /src/linker.zig | |
parent | a82c486878d49f3f3507b5677ca3232c75940db5 (diff) | |
download | bun-1e810d229e954353cc2e76d650b5c3cc81e19e47.tar.gz bun-1e810d229e954353cc2e76d650b5c3cc81e19e47.tar.zst bun-1e810d229e954353cc2e76d650b5c3cc81e19e47.zip |
Fix tests
Diffstat (limited to 'src/linker.zig')
-rw-r--r-- | src/linker.zig | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/src/linker.zig b/src/linker.zig index d13a61a88..e7a0b0191 100644 --- a/src/linker.zig +++ b/src/linker.zig @@ -259,7 +259,23 @@ pub const Linker = struct { } if (linker.options.platform.isBun()) { - if (strings.eqlComptime(import_record.path.text, "fs") or strings.eqlComptime(import_record.path.text, "node:fs")) { + if (import_record.path.text.len > 5 and strings.eqlComptime(import_record.path.text[0.."node:".len], "node:")) { + const is_fs = strings.eqlComptime(import_record.path.text[5..], "fs"); + const is_path = strings.eqlComptime(import_record.path.text[5..], "path"); + if (is_path) { + import_record.path.text = "node:fs"; + externals.append(record_index) catch unreachable; + continue; + } + + if (is_fs) { + import_record.path.text = "node:path"; + externals.append(record_index) catch unreachable; + continue; + } + } + + if (strings.eqlComptime(import_record.path.text, "fs")) { import_record.path.text = "node:fs"; externals.append(record_index) catch unreachable; continue; @@ -270,13 +286,13 @@ pub const Linker = struct { continue; } - if (strings.eqlComptime(import_record.path.text, "path") or strings.eqlComptime(import_record.path.text, "node:path")) { + if (strings.eqlComptime(import_record.path.text, "path")) { import_record.path.text = "node:path"; externals.append(record_index) catch unreachable; continue; } - // if (strings.eqlComptime(import_record.path.text, "process") or strings.eqlComptime(import_record.path.text, "node:process")) { + // if (strings.eqlComptime(import_record.path.text, "process")) { // import_record.path.text = "node:process"; // externals.append(record_index) catch unreachable; // continue; @@ -301,6 +317,9 @@ pub const Linker = struct { if (import_record.path.text.len > 4 and strings.eqlComptime(import_record.path.text[0.."bun:".len], "bun:")) { import_record.path = Fs.Path.init(import_record.path.text["bun:".len..]); import_record.path.namespace = "bun"; + if (strings.eqlComptime(import_record.path.text, "test")) { + import_record.tag = .bun_test; + } // don't link bun continue; } |