Add some internal deprecation @compileError messages

This commit is contained in:
Jarred Sumner
2025-10-24 23:42:20 -07:00
parent f4b6396eac
commit 0fba69d50c
3 changed files with 28 additions and 23 deletions

View File

@@ -8,5 +8,4 @@ Syntax reminders:
Conventions:
- Prefer `@import` at the **bottom** of the file, but the auto formatter will move them so you don't need to worry about it.
- Prefer `@import("bun")`. Not `@import("root").bun` or `@import("../bun.zig")`.
- You must be patient with the build.

View File

@@ -3770,3 +3770,6 @@ const CopyFile = @import("./copy_file.zig");
const builtin = @import("builtin");
const std = @import("std");
const Allocator = std.mem.Allocator;
// Claude thinks its bun.JSC when we renamed it to bun.jsc months ago.
pub const JSC = @compileError("Deprecated: Use @import(\"bun\").jsc instead");

View File

@@ -1,4 +1,4 @@
pub const panic = bun.crash_handler.panic;
pub const panic = _bun.crash_handler.panic;
pub const std_options = std.Options{
.enable_segfault_handler = false,
};
@@ -6,7 +6,7 @@ pub const std_options = std.Options{
pub const io_mode = .blocking;
comptime {
bun.assert(builtin.target.cpu.arch.endian() == .little);
_bun.assert(builtin.target.cpu.arch.endian() == .little);
}
extern fn bun_warn_avx_missing(url: [*:0]const u8) void;
@@ -15,7 +15,7 @@ pub extern "c" var _environ: ?*anyopaque;
pub extern "c" var environ: ?*anyopaque;
pub fn main() void {
bun.crash_handler.init();
_bun.crash_handler.init();
if (Environment.isPosix) {
var act: std.posix.Sigaction = .{
@@ -28,38 +28,38 @@ pub fn main() void {
}
if (Environment.isDebug) {
bun.debug_allocator_data.backing = .init;
_bun.debug_allocator_data.backing = .init;
}
// This should appear before we make any calls at all to libuv.
// So it's safest to put it very early in the main function.
if (Environment.isWindows) {
_ = bun.windows.libuv.uv_replace_allocator(
&bun.mimalloc.mi_malloc,
&bun.mimalloc.mi_realloc,
&bun.mimalloc.mi_calloc,
&bun.mimalloc.mi_free,
_ = _bun.windows.libuv.uv_replace_allocator(
&_bun.mimalloc.mi_malloc,
&_bun.mimalloc.mi_realloc,
&_bun.mimalloc.mi_calloc,
&_bun.mimalloc.mi_free,
);
bun.handleOom(bun.windows.env.convertEnvToWTF8());
_bun.handleOom(_bun.windows.env.convertEnvToWTF8());
environ = @ptrCast(std.os.environ.ptr);
_environ = @ptrCast(std.os.environ.ptr);
}
bun.start_time = std.time.nanoTimestamp();
bun.initArgv(bun.default_allocator) catch |err| {
_bun.start_time = std.time.nanoTimestamp();
_bun.initArgv(_bun.default_allocator) catch |err| {
Output.panic("Failed to initialize argv: {s}\n", .{@errorName(err)});
};
Output.Source.Stdio.init();
defer Output.flush();
if (Environment.isX64 and Environment.enableSIMD and Environment.isPosix) {
bun_warn_avx_missing(bun.cli.UpgradeCommand.Bun__githubBaselineURL.ptr);
bun_warn_avx_missing(_bun.cli.UpgradeCommand.Bun__githubBaselineURL.ptr);
}
bun.StackCheck.configureThread();
_bun.StackCheck.configureThread();
bun.cli.Cli.start(bun.default_allocator);
bun.Global.exit(0);
_bun.cli.Cli.start(_bun.default_allocator);
_bun.Global.exit(0);
}
pub export fn Bun__panic(msg: [*]const u8, len: usize) noreturn {
@@ -71,22 +71,25 @@ pub fn copyForwards(comptime T: type, dest: []T, source: []const T) void {
if (source.len == 0) {
return;
}
bun.copy(T, dest[0..source.len], source);
_bun.copy(T, dest[0..source.len], source);
}
pub fn copyBackwards(comptime T: type, dest: []T, source: []const T) void {
if (source.len == 0) {
return;
}
bun.copy(T, dest[0..source.len], source);
_bun.copy(T, dest[0..source.len], source);
}
pub fn eqlBytes(src: []const u8, dest: []const u8) bool {
return bun.c.memcmp(src.ptr, dest.ptr, src.len) == 0;
return _bun.c.memcmp(src.ptr, dest.ptr, src.len) == 0;
}
// -- End Zig Standard Library Additions --
const builtin = @import("builtin");
const std = @import("std");
const bun = @import("bun");
const Environment = bun.Environment;
const Output = bun.Output;
// Claude thinks its @import("root").bun when it's @import("bun").
const bun = @compileError("Deprecated: Use @import(\"bun\") instead");
const _bun = @import("bun");
const Environment = _bun.Environment;
const Output = _bun.Output;