rolldown_common 1.0.0

This crate is mostly for sharing code between rolldwon crates.
Documentation
mod chunk;
mod ecmascript;
mod file_emitter;
mod generated;
mod hmr;
mod inner_bundler_options;
mod module;
mod module_loader;
mod source_map_gen_msg;
mod type_aliases;
mod types;
mod utils;

/// This module is to help `rolldown` crate could export types related bundler options easily.
/// `rolldown` crate could use `pub use rolldown_common::bundler_options::*;` to export all types, so we don't need write
/// the same code in `rolldown` crate again.
pub mod bundler_options {
  pub use crate::generated::{
    checks_options::ChecksOptions,
    runtime_helper::{DependedRuntimeHelperMap, RUNTIME_HELPER_NAMES, RuntimeHelper},
  };

  #[cfg(feature = "deserialize_bundler_options")]
  pub use crate::inner_bundler_options::types::optimization::deserialize_inline_const;
  pub use crate::inner_bundler_options::{
    BundlerOptions,
    types::{
      attach_debug_info::AttachDebugInfo,
      chunk_import_map::ChunkImportMap,
      chunk_modules_order::ChunkModulesOrderBy,
      code_splitting_mode::CodeSplittingMode,
      comments::CommentsOptions,
      defer_sync_scan_data_option::DeferSyncScanDataOption,
      dev_mode_options::DevModeOptions,
      devtools_options::DevtoolsOptions,
      es_module_flag::EsModuleFlag,
      experimental_options::{
        ChunkOptimizationOption, ChunkOptimizationOptions, ExperimentalOptions,
      },
      filename_template::{FilenameTemplate, is_path_fragment},
      generated_code_options::GeneratedCodeOptions,
      hash_characters::HashCharacters,
      inject_import::InjectImport,
      input_item::InputItem,
      invalidate_js_side_cache::InvalidateJsSideCache,
      is_external::IsExternal,
      legal_comments::LegalComments,
      log_level::LogLevel,
      make_absolute_externals_relative::MakeAbsoluteExternalsRelative,
      manual_code_splitting_options::{
        ChunkingContext, ManualCodeSplittingOptions, MatchGroup, MatchGroupName, MatchGroupTest,
      },
      minify_options::{
        MinifyOptions, RawCompressOptions, RawMangleOptions, RawMinifyOptions,
        RawMinifyOptionsDetailed,
      },
      module_type::ModuleType,
      normalized_bundler_options::{NormalizedBundlerOptions, SharedNormalizedBundlerOptions},
      on_log::{Log, LogLocation, LogWithoutPlugin, OnLog},
      optimization::{
        InlineConstConfig, InlineConstMode, InlineConstOption, OptimizationOption,
        normalize_optimization_option,
      },
      output_exports::OutputExports,
      output_format::OutputFormat,
      output_option::{
        AddonFunction, AddonOutputOption, AssetFilenamesOutputOption, ChunkFilenamesOutputOption,
        GlobalsOutputOption, PathsOutputOption, PreserveEntrySignatures,
      },
      platform::Platform,
      resolve_options::ResolveOptions,
      sanitize_filename::SanitizeFilename,
      source_map_type::SourceMapType,
      sourcemap_ignore_list::SourceMapIgnoreList,
      sourcemap_path_transform::SourceMapPathTransform,
      strict_mode::StrictMode,
      target::ESTarget,
      transform_option::{
        CompilerAssumptions, DecoratorOptions, Either, IsolatedDeclarationsOptions, JsxOptions,
        PluginsOptions, ReactRefreshOptions, StyledComponentsOptions,
        TransformOptions as BundlerTransformOptions, TypeScriptOptions,
      },
      transform_options::{
        JsxPreset, RawTransformOptions, TransformOptions, TransformOptionsInner,
        merge_transform_options_with_tsconfig,
      },
      treeshake::{
        InnerOptions, ModuleSideEffects, ModuleSideEffectsRule, PropertyReadSideEffects,
        PropertyWriteSideEffects, TreeshakeOptions,
      },
      tsconfig::TsConfig,
      tsconfig_merge::merge_transform_options_with_tsconfig as merge_tsconfig,
      watch_option::{OnInvalidate, WatchOption},
    },
  };

  pub use crate::utils::enhanced_transform::{
    EnhancedTransformOptions, EnhancedTransformResult, TsconfigOption, enhanced_transform,
  };
}

// We don't want internal position adjustment of files affect users, so all items are exported in the root.
pub use crate::{
  chunk::{
    Chunk, ChunkMeta, PostChunkOptimizationOperation,
    chunk_table::ChunkTable,
    types::{
      AddonRenderContext,
      chunk_debug_info::{ChunkDebugInfo, FacadeChunkEliminationReason},
      chunk_reason_type::ChunkReasonType,
      cross_chunk_import_item::CrossChunkImportItem,
      module_group::ModuleGroup,
      preliminary_filename::PreliminaryFilename,
    },
  },
  ecmascript::{
    comment_annotation::get_leading_comment,
    dynamic_import_usage,
    ecma_asset_meta::EcmaAssetMeta,
    ecma_view::{
      EcmaModuleAstUsage, EcmaView, EcmaViewMeta, PrependRenderedImport, ThisExprReplaceKind,
      generate_replace_this_expr_map,
    },
    json_to_program::{json_value_to_ecma_ast, json_value_to_expression},
    module_idx::ModuleIdx,
  },
  file_emitter::{
    EmittedAsset, EmittedChunk, EmittedChunkInfo, EmittedPrebuiltChunk, FileEmitter,
    SharedFileEmitter,
  },
  hmr::{
    client_hmr_input::ClientHmrInput, client_hmr_update::ClientHmrUpdate,
    hmr_boundary::HmrBoundary, hmr_boundary_output::HmrBoundaryOutput, hmr_patch::HmrPatch,
    hmr_update::HmrUpdate,
  },
  module::{
    Module,
    external_module::ExternalModule,
    normal_module::{ModuleRenderArgs, NormalModule},
  },
  module_loader::{
    AddEntryModuleMsg, ModuleLoaderMsg,
    runtime_module_brief::{RUNTIME_MODULE_ID, RUNTIME_MODULE_KEY, RuntimeModuleBrief},
    runtime_task_result::RuntimeModuleTaskResult,
    task_result::{EcmaRelated, ExternalModuleTaskResult, NormalModuleTaskResult},
  },
  source_map_gen_msg::SourceMapGenMsg,
  type_aliases::{MemberExprRefResolutionMap, SharedModuleInfoDashMap},
  types::asset::Asset,
  types::asset_meta::{InstantiationKind, SourcemapAssetMeta},
  types::ast_scope_idx::AstScopeIdx,
  types::ast_scopes::AstScopes,
  types::bundle_mode::BundleMode,
  types::chunk_idx::ChunkIdx,
  types::chunk_kind::ChunkKind,
  types::concatenate_wrapped_module::{
    ConcatenateWrappedModuleKind, RenderedConcatenatedModuleParts,
  },
  types::constant_value::{ConstExportMeta, ConstantValue},
  types::deconflict::ModuleScopeSymbolIdMap,
  types::defer_sync_scan_data::DeferSyncScanData,
  types::entry_point::{EntryPoint, EntryPointKind},
  types::exports_kind::ExportsKind,
  types::external_module_idx::ExternalModuleIdx,
  types::flat_options::FlatOptions,
  types::hmr_info::HmrInfo,
  types::hybrid_index_vec::HybridIndexVec,
  types::import_attribute::ImportAttribute,
  types::import_kind::ImportKind,
  types::import_record::{
    DynamicImportExprInfo, ImportRecordIdx, ImportRecordMeta, ImportRecordStateInit,
    RawImportRecord, ResolvedImportRecord,
  },
  types::importer_record::ImporterRecord,
  types::ins_chunk_idx::InsChunkIdx,
  types::instantiated_chunk::InstantiatedChunk,
  types::interop::Interop,
  types::lazy_barrel::{
    BarrelInfo, BarrelState, ExportSource, ImportedExports, LazyBarrelInfo,
    try_extract_lazy_barrel_info,
  },
  types::member_expr_ref::{MemberExprObjectReferencedType, MemberExprProp, MemberExprRef},
  types::member_expr_ref_resolution::MemberExprRefResolution,
  types::module_def_format::ModuleDefFormat,
  types::module_id::ModuleId,
  types::module_idx::LegacyModuleIdx,
  types::module_info::ModuleInfo,
  types::module_namespace_included_reason::ModuleNamespaceIncludedReason,
  types::module_render_output::ModuleRenderOutput,
  types::module_table::{IndexModules, ModuleTable},
  types::module_tag::{ModuleTag, ModuleTagBitSet, ModuleTagRegistry},
  types::named_export::LocalExport,
  types::named_import::{NamedImport, Specifier},
  types::namespace_alias::NamespaceAlias,
  types::output::{Output, OutputAsset},
  types::output_chunk::{Modules, OutputChunk},
  types::outputs_diagnostics::OutputsDiagnostics,
  types::package_json::PackageJson,
  types::plugin_idx::PluginIdx,
  types::rendered_module::RenderedModule,
  types::resolved_export::ResolvedExport,
  types::resolved_id::{ResolvedExternal, ResolvedId},
  types::rollup_pre_rendered_asset::RollupPreRenderedAsset,
  types::rollup_pre_rendered_chunk::RollupPreRenderedChunk,
  types::rollup_rendered_chunk::RollupRenderedChunk,
  types::scan_mode::ScanMode,
  types::side_effect_detail::SideEffectDetail,
  types::side_effects,
  types::source_mutation::SourceMutation,
  types::sourcemap_chain_element::SourcemapChainElement,
  types::stable_module_id::StableModuleId,
  types::stmt_info::{DebugStmtInfoForTreeShaking, StmtInfo, StmtInfoIdx, StmtInfoMeta, StmtInfos},
  types::str_or_bytes::StrOrBytes,
  types::symbol_or_member_expr_ref::{SymbolOrMemberExprRef, TaggedSymbolRef},
  types::symbol_ref::{SymbolRef, common_debug_symbol_ref},
  types::symbol_ref_db::{
    GetLocalDb, GetLocalDbMut, SymbolRefDb, SymbolRefDbForModule, SymbolRefFlags,
  },
  types::used_symbol_refs::UsedSymbolRefs,
  types::watch::WatcherChangeKind,
  types::wrap_kind::WrapKind,
};
pub use bundler_options::*;
#[cfg(debug_assertions)]
pub use types::idx_ext::IdxDebugExt;