#![feature(inherent_associated_types)]
#![feature(adt_const_params, allocator_api, thread_local)]
#![allow(incomplete_features)] #![allow(non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![warn(unused_must_use)]
pub use bun_resolver::fs as bun_fs;
pub use bun_resolver::node_fallbacks as bun_node_fallbacks;
pub mod perf {
pub use bun_perf::{Ctx, PerfEvent};
#[inline]
pub(crate) fn trace(_name: &'static str) -> Ctx {
bun_perf::trace(PerfEvent::_Stub)
}
}
pub mod bun_css {
pub use ::bun_css::css_modules::Config as CssModuleConfig;
pub use ::bun_css::css_parser::LayerName;
pub use ::bun_css::*;
}
pub use crate::HTMLScanner as html_scanner;
pub(crate) mod index {
pub(crate) use bun_ast::IndexInt as Int;
}
pub(crate) mod part {
pub(crate) use bun_ast::PartList as List;
}
pub(crate) mod import_record {
pub(crate) use bun_ast::import_record::List;
}
pub(crate) type JSAst<'a> = crate::BundledAst<'a>;
pub(crate) use bun_ast::UseDirective;
pub(crate) use bun_ast::{Part, Ref};
pub use bun_js_printer::MangledProps;
pub use options_impl::PathTemplate;
pub use HTMLImportManifest::html_import_manifest;
pub use bun_core::cheap_prefix_normalizer;
pub use bundle_v2::{
CompileResult, CompileResultForSourceMap, ContentHasher, DeclInfo, DeclInfoKind, EventLoop,
ImportTracker, PartRange, StableRef, WrapKind, generic_path_with_pretty_initialized,
target_from_hashbang,
};
pub use chunk::{
CrossChunkImport, CrossChunkImportItem, CrossChunkImportItemList, bun_renamer,
cross_chunk_import,
};
pub use linker_graph::{
ExportData, ImportData, JSMeta, RefImportData, ResolvedExports, TopLevelSymbolToParts,
entry_point, js_meta,
};
pub mod mal_prelude {
pub use crate::Graph::InputFileColumns as _;
pub use crate::bundle_v2::CompileResultForSourceMapColumns as _;
pub use crate::bundled_ast::BundledAstColumns as _;
pub use crate::linker_graph::FileColumns as _;
pub use crate::linker_graph::entry_point::EntryPointColumns as _;
pub use crate::linker_graph::js_meta::JSMetaColumns as _;
pub use bun_ast::server_component_boundary::ServerComponentBoundaryColumns as _;
}
pub mod DeferredBatchTask;
pub mod Graph;
pub mod IndexStringMap;
pub mod PathToSourceIndexMap;
pub mod BundleThread;
pub mod ServerComponentParseTask;
pub mod HTMLImportManifest;
pub mod HTMLScanner;
pub mod cache;
pub mod entry_points;
#[path = "OutputFile.rs"]
pub mod output_file;
#[path = "ThreadPool.rs"]
pub mod thread_pool;
pub mod AstBuilder;
pub mod analyze_transpiled_module;
pub mod bundled_ast;
pub use bundled_ast::BundledAst;
pub mod barrel_imports;
#[path = "Chunk.rs"]
pub mod chunk;
pub mod defines;
pub mod linker;
#[path = "LinkerGraph.rs"]
pub mod linker_graph;
pub use bun_js_parser::defines_table;
pub mod bundle_v2;
#[path = "LinkerContext.rs"]
pub mod linker_context_mod;
#[path = "options.rs"]
pub mod options_impl;
#[path = "ParseTask.rs"]
pub mod parse_task;
pub mod transpiler;
pub mod linker_context {
#[path = "scanImportsAndExports.rs"]
pub mod scan_imports_and_exports;
#[path = "computeChunks.rs"]
pub mod compute_chunks;
#[path = "computeCrossChunkDependencies.rs"]
pub mod compute_cross_chunk_dependencies;
#[path = "convertStmtsForChunk.rs"]
pub mod convert_stmts_for_chunk;
#[path = "convertStmtsForChunkForDevServer.rs"]
pub mod convert_stmts_for_chunk_for_dev_server;
#[path = "doStep5.rs"]
pub mod do_step5;
#[path = "findAllImportedPartsInJSOrder.rs"]
pub mod find_all_imported_parts_in_js_order;
#[path = "findImportedCSSFilesInJSOrder.rs"]
pub mod find_imported_css_files_in_js_order;
#[path = "findImportedFilesInCSSOrder.rs"]
pub mod find_imported_files_in_css_order;
#[path = "generateChunksInParallel.rs"]
pub mod generate_chunks_in_parallel;
#[path = "generateCodeForFileInChunkJS.rs"]
pub mod generate_code_for_file_in_chunk_js;
#[path = "generateCodeForLazyExport.rs"]
pub mod generate_code_for_lazy_export;
#[path = "generateCompileResultForCssChunk.rs"]
pub mod generate_compile_result_for_css_chunk;
#[path = "generateCompileResultForHtmlChunk.rs"]
pub mod generate_compile_result_for_html_chunk;
#[path = "generateCompileResultForJSChunk.rs"]
pub mod generate_compile_result_for_js_chunk;
#[path = "postProcessCSSChunk.rs"]
pub mod post_process_css_chunk;
#[path = "postProcessHTMLChunk.rs"]
pub mod post_process_html_chunk;
#[path = "postProcessJSChunk.rs"]
pub mod post_process_js_chunk;
#[path = "prepareCssAstsForChunk.rs"]
pub mod prepare_css_asts_for_chunk;
#[path = "renameSymbolsInChunk.rs"]
pub mod rename_symbols_in_chunk;
#[path = "writeOutputFilesToDisk.rs"]
pub mod write_output_files_to_disk;
#[path = "MetafileBuilder.rs"]
pub mod metafile_builder;
#[path = "OutputFileListBuilder.rs"]
pub mod output_file_list_builder;
#[path = "StaticRouteVisitor.rs"]
pub mod static_route_visitor;
pub use crate::linker_context_mod::{
ChunkMeta, GenerateChunkCtx, LinkerContext, PendingPartRange,
};
pub use output_file_list_builder::OutputFileList as OutputFileListBuilder;
pub use static_route_visitor::StaticRouteVisitor;
}
pub use Graph::Graph as GraphStruct;
pub use bundle_v2::BundleV2;
pub use chunk::Chunk;
pub use defines::{Define, DefineDataExt, DefineExt};
pub use linker::Linker;
pub use linker_context_mod::LinkerContext;
pub use linker_graph::LinkerGraph;
pub use linker_graph::entry_point::EntryPoint;
pub use options_impl::BundleOptions;
pub use output_file::OutputFile;
pub use parse_task::ParseTask;
pub use thread_pool::{ThreadPool, Worker};
pub use transpiler::Transpiler;
pub enum AdditionalFile {
SourceIndex(u32),
OutputFile(u32),
}
pub(crate) use bun_ast::{Index, IndexInt};
pub mod options {
pub use super::OutputFile;
pub use super::options_impl::*;
pub use super::output_file::BakeExtra;
pub use super::output_file::IndexOptional;
pub use super::output_file::Options as OutputFileInit;
pub use super::output_file::OptionsData as OutputFileData;
pub use super::output_file::Value as OutputValue;
pub use super::output_file::Value as OutputFileValue;
pub use bun_options_types::Format as OutputFormat;
pub use bun_options_types::schema::api::DotEnvBehavior as EnvBehavior;
pub type Options<'a> = super::BundleOptions<'a>;
#[repr(u8)]
#[derive(Clone, Copy, PartialEq, Eq, Debug, Default, strum::IntoStaticStr)]
pub enum OutputKind {
#[default]
#[strum(serialize = "chunk")]
Chunk,
#[strum(serialize = "asset")]
Asset,
#[strum(serialize = "entry-point")]
EntryPoint,
#[strum(serialize = "sourcemap")]
Sourcemap,
#[strum(serialize = "bytecode")]
Bytecode,
#[strum(serialize = "module_info")]
ModuleInfo,
#[strum(serialize = "metafile-json")]
MetafileJson,
#[strum(serialize = "metafile-markdown")]
MetafileMarkdown,
}
impl OutputKind {
pub fn is_file_in_standalone_mode(self) -> bool {
!matches!(
self,
OutputKind::Sourcemap
| OutputKind::Bytecode
| OutputKind::ModuleInfo
| OutputKind::MetafileJson
| OutputKind::MetafileMarkdown
)
}
}
pub use crate::bake_types::Side;
pub use crate::bake_types::Framework;
}
pub use cache::RuntimeTranspilerCacheExt;
pub use cache::Set as Cache;
pub use bundle_v2::bake_types;
pub use bundle_v2::dispatch;
bun_dispatch::link_interface! {
pub DevServerHandle[Bake] {
fn barrel_needed_exports() -> *mut bun_collections::StringArrayHashMap<bun_collections::StringHashMap<()>>;
fn log_for_resolution_failures(abs_path: &[u8], graph: bake_types::Graph) -> *mut bun_ast::Log;
fn finalize_bundle(bv2: *mut bundle_v2::BundleV2<'_>, result: *mut bundle_v2::DevServerOutput<'_>) -> Result<(), bun_core::Error>;
fn handle_parse_task_failure(err: bun_core::Error, graph: bake_types::Graph, abs_path: &[u8], log: *const bun_ast::Log, bv2: *mut bundle_v2::BundleV2<'_>) -> Result<(), bun_core::Error>;
fn put_or_overwrite_asset(path: *const (), contents: &[u8], content_hash: u64) -> Result<(), bun_core::Error>;
fn track_resolution_failure(import_source: &[u8], specifier: &[u8], renderer: bake_types::Graph, loader: bun_ast::Loader) -> Result<(), bun_core::Error>;
fn is_file_cached(abs_path: &[u8], side: bake_types::Graph) -> Option<bake_types::CacheEntry>;
fn asset_hash(abs_path: &[u8]) -> Option<u64>;
fn current_bundle_start_data() -> *mut ();
fn register_barrel_with_deferrals(path: &[u8]) -> Result<(), bun_core::Error>;
fn register_barrel_export(barrel_path: &[u8], alias: &[u8]);
}
}
unsafe impl Send for DevServerHandle {}
unsafe impl Sync for DevServerHandle {}
bun_dispatch::link_interface! {
pub VmLoaderCtx[Runtime] {
fn origin_host() -> &'static [u8];
fn origin_path() -> &'static [u8];
fn loaders() -> *const bun_collections::StringArrayHashMap<bun_ast::Loader>;
fn eval_source() -> Option<*const bun_ast::Source>;
fn main() -> &'static [u8];
fn read_dir_info_package_json(dir: &[u8]) -> Option<*const bun_resolver::PackageJSON>;
fn is_blob_url(specifier: &[u8]) -> bool;
fn resolve_blob(specifier: &[u8]) -> Option<options::OpaqueBlob>;
fn blob_loader(blob: options::OpaqueBlob) -> Option<bun_ast::Loader>;
fn blob_file_name(blob: options::OpaqueBlob) -> Option<&'static [u8]>;
fn blob_needs_read_file(blob: options::OpaqueBlob) -> bool;
fn blob_shared_view(blob: options::OpaqueBlob) -> &'static [u8];
fn blob_deinit(blob: options::OpaqueBlob);
}
}
impl Default for output_file::OptionsData {
fn default() -> Self {
output_file::OptionsData::Buffer {
data: Box::default(),
}
}
}
impl Default for output_file::Options {
fn default() -> Self {
output_file::Options {
loader: options::Loader::default(),
input_loader: options::Loader::default(),
hash: None,
source_map_index: None,
bytecode_index: None,
module_info_index: None,
output_path: Box::default(),
source_index: output_file::IndexOptional::NONE,
size: None,
input_path: Box::default(),
display_size: 0,
output_kind: options::OutputKind::Chunk,
is_executable: false,
data: output_file::OptionsData::default(),
side: None,
entry_point_index: None,
referenced_css_chunks: Box::default(),
bake_extra: output_file::BakeExtra::default(),
}
}
}