Struct deno_core::ModuleSource
source · pub struct ModuleSource {
pub code: ModuleCode,
pub module_type: ModuleType,
/* private fields */
}
Expand description
EsModule source code that will be loaded into V8.
Users can implement Into<ModuleInfo>
for different file types that
can be transpiled to valid EsModule.
Found module URL might be different from specified URL
used for loading due to redirections (like HTTP 303).
Eg. Both “https://example.com/a.ts
” and
“https://example.com/b.ts
” may point to “https://example.com/c.ts
”
By keeping track of specified and found URL we can alias modules and avoid
recompiling the same code 3 times.
Fields§
§code: ModuleCode
§module_type: ModuleType
Implementations§
source§impl ModuleSource
impl ModuleSource
sourcepub fn new(
module_type: impl Into<ModuleType>,
code: ModuleCode,
specifier: &ModuleSpecifier
) -> Self
pub fn new( module_type: impl Into<ModuleType>, code: ModuleCode, specifier: &ModuleSpecifier ) -> Self
Create a ModuleSource
without a redirect.
sourcepub fn new_with_redirect(
module_type: impl Into<ModuleType>,
code: ModuleCode,
specifier: &ModuleSpecifier,
specifier_found: &ModuleSpecifier
) -> Self
pub fn new_with_redirect( module_type: impl Into<ModuleType>, code: ModuleCode, specifier: &ModuleSpecifier, specifier_found: &ModuleSpecifier ) -> Self
Create a ModuleSource
with a potential redirect. If the specifier_found
parameter is the same as the
specifier, the code behaves the same was as ModuleSource::new
.
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for ModuleSource
impl Send for ModuleSource
impl Sync for ModuleSource
impl Unpin for ModuleSource
impl UnwindSafe for ModuleSource
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
Mutably borrows from an owned value. Read more