Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/api/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//! Ground truth: `src/api/schema.peechy`. The full peechy → `.rs` emitter is
//! not landed yet; this crate hand-writes the slice of the schema that
//! downstream crates name today (`bun_ini`, `bun_install`, `bun_runtime`
//! bunfig parser) so they can un-gate against real field shapes.
//! bunfig parser).
//!
//! LAYERING: the actual data shapes (`NpmRegistry`, `NpmRegistryMap`, `Ca`,
//! `BunInstall`) were originally hand-written in two places — here *and* in
Expand Down
5 changes: 2 additions & 3 deletions src/ast/fold_string_addition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ use crate::{E, Expr, StoreRef, e};
use bun_alloc::Arena; // bumpalo::Bump re-export

// ── local rope helpers ─────────────────────────────────────────────────────
// `EString::push` / `EString::clone_rope_nodes` are still gated in E.rs
// (round-C draft); inline the minimal surface here so this file can un-gate
// without touching E.rs.
// `EString` has no `push` / `clone_rope_nodes` inherent methods yet;
// provide the minimal surface here.

#[inline]
fn store_append_string(s: E::EString) -> StoreRef<E::EString> {
Expand Down
2 changes: 1 addition & 1 deletion src/bun_bin/phase_c_exports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ pub(crate) extern "C" fn Bun__panic(msg: *const u8, len: usize) -> ! {
// Bun__NODE_NO_WARNINGS

// REAL: `Bun__getTLSRejectUnauthorizedValue` / `Bun__isNoProxy` now exported
// directly from `bun_jsc::virtual_machine_exports` (un-gated in phase-d).
// directly from `bun_jsc::virtual_machine_exports`.

// REAL: now provided by bun_runtime (src/runtime/napi/napi_body.rs).
// napi_internal_suppress_crash_on_abort_if_desired
Expand Down
12 changes: 5 additions & 7 deletions src/bun_core/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1202,10 +1202,8 @@ pub mod time {
}
}

/// `bun.schema`. The full generated API
/// types live in `bun_api` (tier-2); tier-0 only needs the namespace to
/// exist so `bun_core::schema::api::StringPointer` etc. resolve as re-exports
/// once that crate un-gates. For now expose the one type tier-0 itself owns.
/// `bun.schema`. The full generated API types live in `bun_api` (tier-2);
/// tier-0 cannot depend on that, so expose the one type tier-0 itself owns.
pub mod schema {
pub mod api {
pub use crate::util::StringPointer;
Expand Down Expand Up @@ -2605,9 +2603,9 @@ pub mod debug_allocator_data {
}
}

/// `bun.feature_flag.*` runtime env-var getters (real impl in env_var.rs, still gated).
/// feature_flags.rs (compile-time consts) is now real; this stub provides the
/// `.get()` accessor surface that env_var.rs will replace.
/// `bun.feature_flag.*` runtime env-var getters. The canonical typed
/// accessors live in `env_var::feature_flag`; this stub provides the
/// `.get()` accessor surface for flags not yet wired there.
pub mod feature_flag {
macro_rules! flag { ($($name:ident),* $(,)?) => { $(
#[allow(non_camel_case_types)] pub struct $name;
Expand Down
2 changes: 0 additions & 2 deletions src/bun_core/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -976,8 +976,6 @@ pub fn is_ai_agent() -> bool {
VALUE.load(Ordering::Relaxed)
}

// (IS_VERBOSE defined above at L887; ungate exposed a duplicate.)

pub fn set_is_verbose(verbose: bool) {
IS_VERBOSE.store(verbose, Ordering::Relaxed);
}
Expand Down
5 changes: 2 additions & 3 deletions src/bun_core/string/immutable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,8 @@ pub use unicode_draft::{
/// surface for the remaining Rust callers.
pub use visible_impl::visible;

/// Minimal `unicode` surface needed by `immutable.rs` itself (CodepointIterator
/// + WTF-8 decode). Full transcoding suite (to_utf8_*, convert_utf16_*) lives
/// in the gated `unicode_draft` module — un-gate after simdutf wiring.
/// `unicode` surface needed by `immutable.rs` itself (CodepointIterator +
/// WTF-8 decode). Full transcoding suite lives in `unicode_draft`.
pub mod unicode {
use super::CodePoint;

Expand Down
5 changes: 3 additions & 2 deletions src/bun_core/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4733,8 +4733,9 @@ impl SpawnStatus {
//
// This is the single source of truth for the request layout; `spawn_sys`
// re-exports these types rather than re-declaring them. The #[repr(C)] data
// mirrors are target-agnostic so the module is ungated; only the extern decl
// is `cfg(unix)` (Windows spawns go through libuv and never link this symbol).
// mirrors are target-agnostic so the module compiles on all platforms; only
// the extern decl is `cfg(unix)` (Windows spawns go through libuv and never
// link this symbol).
pub mod spawn_ffi {
use core::ffi::{c_char, c_int};

Expand Down
4 changes: 1 addition & 3 deletions src/bundler/BundleThread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ pub(crate) extern "C" fn timer_callback(_: *mut bun_sys::windows::libuv::Timer)
pub use bun_threading::ResetEvent;

/// Result of a `Bun.build` invocation handed back to the JS thread.
// Defined here (not re-exported from `bundle_v2`) because the un-gated
// `bundle_v2` module keeps the draft body private; T6 (`bundler_jsc`) consumes
// this via the `CompletionStruct` trait.
/// Consumed by `bundler_jsc` via the `CompletionStruct` trait.
pub struct BuildResult {
pub output_files: Vec<crate::options::OutputFile>,
pub metafile: Option<Box<[u8]>>,
Expand Down
8 changes: 1 addition & 7 deletions src/bundler/LinkerContext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,7 @@ pub(crate) use debug;
bun_core::define_scoped_log!(debug_tree_shake, crate::linker_context_mod::TreeShake);

// Re-exports from sibling modules in `linker_context/`.
// `LinkerGraph` SoA accessors are real now (`` on
// `JSAst`/`JSMeta`/`File`); the submodule bodies un-gate against those. Module
// declarations live in `lib.rs::linker_context` — each re-export below is
// gated alongside its module declaration so partial un-gates compile.
// Module declarations live in `lib.rs::linker_context`.
pub use crate::linker_context::scan_imports_and_exports::scan_imports_and_exports;

pub use crate::linker_context::compute_chunks::compute_chunks;
Expand Down Expand Up @@ -2161,9 +2158,6 @@ impl<'a> LinkerContext<'a> {
Ok(true)
}

// runtime_function: moved to the un-gated forward-decl impl block
// (see "Forward-decl shims for scanImportsAndExports.rs callees" below).

pub fn print_code_for_file_in_chunk_js(
&mut self,
r: renamer::Renamer,
Expand Down
52 changes: 0 additions & 52 deletions src/bundler/ParseTask.rs
Original file line number Diff line number Diff line change
Expand Up @@ -489,11 +489,6 @@ export var __callDispose = (stack, error, hasError) => {

// ══════════════════════════════════════════════════════════════════════════
// Per-file parse worker — `getAST`/`getCodeForParseTask`/`runFromThreadPool`.
// The struct/FFI surface and `get_runtime_source` are real. Bodies
// that touch the still-gated `crate::ThreadPool` Worker module or the opaque
// `JSBundlerPlugin`/`FileMap` forward-decls remain ``-gated
// per-function below with explicit `// blocked_on:` notes; they un-gate by
// deletion once those modules land.
// ══════════════════════════════════════════════════════════════════════════
pub mod parse_worker {
use super::*;
Expand Down Expand Up @@ -592,10 +587,6 @@ pub mod parse_worker {
// getEmptyCSSAST / getEmptyAST
// ───────────────────────────────────────────────────────────────────────────

// blocked_on: `js_parser::new_lazy_export_ast` body
// (`Parser::to_lazy_export_ast`); `bun_css::BundlerStyleSheet` (gated
// upstream); `Expr::init` overload set for arbitrary `E::*` defaults.

// `transpiler: *mut Transpiler` stays raw. Callers
// (`get_ast`, `run_with_source_code`) may also hold a raw pointer to
// `(*transpiler).resolver`; materializing `&mut Transpiler` here would assert
Expand Down Expand Up @@ -693,17 +684,6 @@ pub mod parse_worker {
// getAST
// ───────────────────────────────────────────────────────────────────────────

// blocked_on: per-loader branches require:
// - `resolver.caches.js.parse` / `resolver.caches.json.parse_json` (gated in
// `bun_resolver::cache_set`);
// - `bun_parsers::{toml,yaml,json5}` parser entry points;
// - `bun_css::BundlerStyleSheet::parse_bundler` (gated upstream);
// - `crate::HTMLScanner` (gated module);
// - `bun_core::fmt::bytes_to_hex_lower` Display adaptor;
// - `js_parser::new_lazy_export_ast` body.
// The signature now names the real `ParserOptions`; body un-gates in lockstep
// with the above.

// `transpiler`/`resolver` are raw `*mut`. The caller may pass
// `resolver = &transpiler.resolver`, so
// the two may point into the same allocation. Taking `&mut Transpiler` +
Expand Down Expand Up @@ -1348,12 +1328,6 @@ pub mod parse_worker {
// getCodeForParseTaskWithoutPlugins
// ───────────────────────────────────────────────────────────────────────────

// blocked_on: `BundleV2.file_map` is `Option<NonNull<FileMap>>` where `FileMap`
// is an opaque forward-decl (`_opaque: [u8; 0]`); `.get(path)`
// requires the real T6 `jsc::api::JSBundler::FileMap` surface. Also blocked on
// `bake_types::Framework.built_in_modules` value variant carrying `&[u8]` (vs
// `Box<[u8]>` here) and `resolver.caches.fs.read_file_with_allocator` shape.

// `transpiler`/`resolver` are raw `*mut`.
// Callers pass `resolver = &mut (*transpiler).resolver`; taking
// `&mut Transpiler` + `&mut Resolver` would be aliased-`&mut` UB. We only
Expand Down Expand Up @@ -1518,12 +1492,6 @@ pub mod parse_worker {
// getCodeForParseTask
// ───────────────────────────────────────────────────────────────────────────

// blocked_on: `BundleV2.plugins` is `Option<NonNull<JSBundlerPlugin>>` where
// `JSBundlerPlugin` is an opaque forward-decl; `.has_on_before_parse_plugins()`
// requires the real T6 `jsc::api::JSBundler::Plugin` surface (or a
// `dispatch::PluginVTable` slot). Also calls the gated
// `get_code_for_parse_task_without_plugins`.

// `transpiler`/`resolver` are raw `*mut` — see
// `get_code_for_parse_task_without_plugins`.
#[allow(clippy::too_many_arguments)]
Expand Down Expand Up @@ -1865,8 +1833,6 @@ pub mod parse_worker {
}
}

// blocked_on: calls `get_code_for_parse_task_without_plugins` (gated above).

/// # Safety
/// `args` and `result_ptr` must point at the live `OnBeforeParseArguments`
/// / `OnBeforeParseResultWrapper.result` set up by `OnBeforeParsePlugin::run`
Expand Down Expand Up @@ -2014,11 +1980,6 @@ pub mod parse_worker {
0
}

// blocked_on: `crate::api::JSBundler::Plugin` (T6) — `call_on_before_parse_plugins`
// is an `extern "C"` JSC dispatch; needs a `dispatch` vtable slot or the real
// `bun_bundler_jsc::JSBundler::Plugin` re-export. Also references the gated
// `fetch_source_code` callback above.

impl<'a, 'b: 'a> OnBeforeParsePlugin<'a, 'b> {
pub fn run(
&mut self,
Expand Down Expand Up @@ -2201,10 +2162,6 @@ pub mod parse_worker {
// getSourceCode
// ───────────────────────────────────────────────────────────────────────────

// blocked_on: `crate::ThreadPool::Worker` (lib.rs ` pub mod
// ThreadPool` — the bundler worker module, distinct from `bun_threading`).
// `Worker.{arena, data.transpiler}` field shape comes from there.

fn get_source_code(
task: &mut ParseTask,
this: &mut crate::Worker,
Expand Down Expand Up @@ -2257,15 +2214,6 @@ pub mod parse_worker {
// runWithSourceCode
// ───────────────────────────────────────────────────────────────────────────

// blocked_on: `crate::ThreadPool::Worker` (gated module) for
// `this.{arena, transpiler_for_target, ctx}`; `bake_types::Framework`
// missing `server_components` field; `ParserOptions` field-type mismatches
// (`allow_unresolved`, `framework`, `unwrap_commonjs_packages`,
// `server_components` — bundler's `BundleOptions` types diverge from the
// js_parser-local `parser::options` shims); `get_ast`/`get_empty_*` (gated).
// Signature is real; body un-gates once the `ThreadPool` module + the
// `parser::options` ↔ `BundleOptions` type unification land.

fn run_with_source_code(
task: &mut ParseTask,
this: &mut crate::Worker,
Expand Down
9 changes: 3 additions & 6 deletions src/bundler/linker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,13 @@ bun_core::named_error_set!(CSSResolveError);

type HashedFileNameMap = HashMap<u64, &'static [u8]>;

// `_transpiler.Transpiler.isCacheEnabled` is gated in the draft body
// (`transpiler.rs:1111`). The value is a hard `false`;
// inline it here so `get_hashed_filename` compiles without depending
// on the gated `Transpiler` impl.
// Matches `Transpiler::IS_CACHE_ENABLED`; inlined so `get_hashed_filename`
// doesn't need a `Transpiler` handle.
const IS_CACHE_ENABLED: bool = false;

pub struct Linker {
// arena field dropped — global mimalloc (callers pass `bun.default_allocator`)
// The un-gated
// `Transpiler` struct owns these values directly and also owns `linker:
// `Transpiler` owns these values directly and also owns `linker:
// crate::Linker` by value, so storing references here would alias
// `&mut self` on every `transpiler.linker.link(...)` call. Use raw
// pointers and dereference at use-site; same
Expand Down
4 changes: 2 additions & 2 deletions src/bundler/linker_context/findImportedFilesInCSSOrder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -408,8 +408,8 @@ pub fn find_imported_files_in_css_order<'a>(
//
// `crate::bun_css::LayerName` (lifetime-erased
// shadow) and `::bun_css::LayerName` are distinct nominal
// types until the ungate shadow is removed; cast through
// `NonNull` to satisfy `Layers::borrow`.
// types; cast through `NonNull` to satisfy
// `Layers::borrow`.
let layer_names_ptr = core::ptr::NonNull::from(
&css_asts[idx.get() as usize].as_deref().unwrap().layer_names,
)
Expand Down
22 changes: 8 additions & 14 deletions src/bundler/transpiler.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// ══════════════════════════════════════════════════════════════════════════
// `Transpiler` — the legacy single-file transpile path (pre-`bundle_v2`).
// resolver↔bundler cycle broken in O; `bun_resolver` is now a direct dep so
// the struct and all method bodies are un-gated and live at this tier.
// ══════════════════════════════════════════════════════════════════════════

use bun_alloc::Arena;
Expand Down Expand Up @@ -156,8 +154,8 @@ impl<'a> Transpiler<'a> {
pub const IS_CACHE_ENABLED: bool = false;

/// Takes `*mut Log` (not `&'a mut`) because the same
/// `*Log` is aliased into `linker.log` / `resolver.log`; the un-gated struct field is
/// already a raw pointer for that reason.
/// `*Log` is aliased into `linker.log` / `resolver.log`; the struct
/// field is a raw pointer for that reason.
pub fn set_log(&mut self, log: *mut bun_ast::Log) {
self.log = log;
self.linker.log = log;
Expand Down Expand Up @@ -678,9 +676,8 @@ impl<'a> Transpiler<'a> {
/// optionally auto-configuring JSX from the nearest `tsconfig.json`.
pub fn configure_linker_with_auto_jsx(&mut self, auto_jsx: bool) {
// `Linker::init` dropped its `arena` arg (linker.rs:172
// — global mimalloc). The
// un-gated `crate::linker::Linker` stores raw pointers so
// `&mut self.options` etc. coerce directly. Self-reference is
// — global mimalloc). `crate::linker::Linker` stores raw pointers
// so `&mut self.options` etc. coerce directly. Self-reference is
// load-bearing — `linker.link()` reads back through these into the
// owning `Transpiler` — hence raw `*mut`, not `&'a mut` (would alias
// `&mut self` on every call).
Expand Down Expand Up @@ -1168,8 +1165,8 @@ impl<'a> Transpiler<'a> {
/// * [`Resolver::init1`] — `bun_resolver`
///
/// `log` / `env_loader_` are raw pointers (not `&'a mut`) to
/// match the un-gated struct field types — the same `*Log` is aliased
/// into `linker.log` / `resolver.log` (see `set_log`).
/// match the struct field types — the same `*Log` is aliased into
/// `linker.log` / `resolver.log` (see `set_log`).
pub fn init(
arena: &'a Arena,
log: *mut bun_ast::Log,
Expand Down Expand Up @@ -1773,13 +1770,10 @@ impl<'a> Transpiler<'a> {
// `path_buf2[total] == 0` already; safe to
// borrow as a NUL-terminated ZStr.
let zpath = bun_core::ZStr::from_buf(&path_buf2[..], total);
// spec calls
// `bun.sys.File.toSourceAt(...)` which is
// `bun.sys.File.toSourceAt(...)` is
// `read_from` + wrap-in-`bun_ast::Source`.
// We only need `.contents`, so call
// `read_from` directly (the `to_source_at`
// wrapper is gated as a T1→T2 move-in,
// sys/File.rs:446).
// `read_from` directly.
let dir = dirname_fd.unwrap_valid().unwrap_or_else(FD::cwd);
match bun_sys::File::read_from(dir, zpath) {
Ok(contents) if !contents.is_empty() => {
Expand Down
7 changes: 1 addition & 6 deletions src/cares_sys/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,7 @@ pub mod winsock {
}
}

/// The full c-ares FFI module. The temporary inline scaffold that previously
/// duplicated `ares_socklen_t` / `AddrInfo_hints` / `ares_inet_*` here has been
/// collapsed to a re-export of the canonical `c_ares.rs` module now that it is
/// un-gated. `c_ares` and `c_ares_draft` resolve to the SAME module, so the two
/// `AddrInfo_hints` definitions are now nominally identical (previously a latent
/// type-mismatch footgun for callers mixing the two paths).
/// `c_ares` and `c_ares_draft` resolve to the same module.
pub use c_ares_draft as c_ares;

// Crate-root re-exports for callers that reference `bun_cares_sys::ares_inet_*`
Expand Down
11 changes: 1 addition & 10 deletions src/css/context.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
use crate::css_parser as css;

// blocked_on: rules/media + media_query::{MediaCondition,MediaFeature,...} +
// properties/custom — only the gated `get_*_rules` / `add_unparsed_fallbacks`
// bodies below reference these.

use css::css_rules::media::MediaRule;

use css::css_properties::custom::UnparsedProperty;
Expand Down Expand Up @@ -95,12 +91,7 @@ impl<'a> PropertyHandlerContext<'a> {
}
}

// ─── heavy rule-building helpers (gated) ──────────────────────────────────
// blocked_on: css_rules::{CssRule,CssRuleList,StyleRule,SupportsRule,media},
// selectors::parser::{Direction,Component,PseudoClass}, DeclarationBlock
// construction with bump-allocated lists, properties/custom::UnparsedProperty.
// These build whole rule subtrees and are only called from the (still-gated)
// minify path; un-gate alongside `rules/style.rs`.
// ─── heavy rule-building helpers ──────────────────────────────────────────

impl<'a> PropertyHandlerContext<'a> {
/// `'static`-erased arena handle for building `DeclarationBlock<'static>` /
Expand Down
Loading
Loading