#[repr(u8)]pub enum ModuleKind {
None = 0,
CommonJS = 1,
AMD = 2,
UMD = 3,
System = 4,
ES2015 = 5,
ES2020 = 6,
ES2022 = 7,
ESNext = 99,
Node16 = 100,
NodeNext = 199,
Preserve = 200,
}Expand description
Module system kind.
Determines how modules are resolved and emitted in the output.
Variants§
None = 0
No module system (script mode)
CommonJS = 1
CommonJS (Node.js style)
AMD = 2
Asynchronous Module Definition (RequireJS style)
UMD = 3
Universal Module Definition
System = 4
SystemJS
ES2015 = 5
ES2015 modules (import/export)
ES2020 = 6
ES2020 modules with dynamic import()
ES2022 = 7
ES2022 modules with top-level await
ESNext = 99
Latest module features
Node16 = 100
Node.js ESM (package.json “type”: “module”)
NodeNext = 199
Node.js with automatic detection
Preserve = 200
Preserve original import/export syntax (let bundler handle it)
Implementations§
Source§impl ModuleKind
impl ModuleKind
Sourcepub const fn is_commonjs(self) -> bool
pub const fn is_commonjs(self) -> bool
Check if this is a CommonJS-like module system
Sourcepub const fn is_es_module(self) -> bool
pub const fn is_es_module(self) -> bool
Check if this uses ES modules (import/export)
Returns true only for pure ES module systems where export = is forbidden.
Node16/NodeNext are hybrid systems that support both CommonJS and ESM,
so they return false here (the checker must use file extension to decide).
Trait Implementations§
Source§impl Clone for ModuleKind
impl Clone for ModuleKind
Source§fn clone(&self) -> ModuleKind
fn clone(&self) -> ModuleKind
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ModuleKind
impl Debug for ModuleKind
Source§impl Default for ModuleKind
impl Default for ModuleKind
Source§fn default() -> ModuleKind
fn default() -> ModuleKind
Source§impl PartialEq for ModuleKind
impl PartialEq for ModuleKind
impl Copy for ModuleKind
impl Eq for ModuleKind
impl StructuralPartialEq for ModuleKind
Auto Trait Implementations§
impl Freeze for ModuleKind
impl RefUnwindSafe for ModuleKind
impl Send for ModuleKind
impl Sync for ModuleKind
impl Unpin for ModuleKind
impl UnsafeUnpin for ModuleKind
impl UnwindSafe for ModuleKind
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.