pub enum Eszip {
V1(EszipV1),
V2(EszipV2),
}
Variants§
Implementations§
source§impl Eszip
impl Eszip
sourcepub async fn parse<R: AsyncRead + Unpin + 'static>(
reader: R
) -> Result<(Eszip, Pin<Box<dyn Future<Output = Result<BufReader<R>, ParseError>>>>), ParseError>
pub async fn parse<R: AsyncRead + Unpin + 'static>( reader: R ) -> Result<(Eszip, Pin<Box<dyn Future<Output = Result<BufReader<R>, ParseError>>>>), ParseError>
Parse a byte stream into an Eszip. This function completes when the header is fully received. This does not mean that the entire file is fully received or parsed yet. To finish parsing, the future returned by this function in the second tuple slot needs to be polled.
sourcepub fn get_module(&self, specifier: &str) -> Option<Module>
pub fn get_module(&self, specifier: &str) -> Option<Module>
Get the module metadata for a given module specifier. This function will follow redirects. The returned module has functions that can be used to obtain the module source and source map. The module returned from this function is guaranteed to be a valid module, which can be loaded into v8.
Note that this function should be used to obtain a module; if you wish to
get an import map, use get_import_map
instead.
sourcepub fn get_import_map(&self, specifier: &str) -> Option<Module>
pub fn get_import_map(&self, specifier: &str) -> Option<Module>
Get the import map for a given specifier.
Note that this function should be used to obtain an import map; the returned
“Module” is not necessarily a valid module that can be loaded into v8 (in
other words, JSONC may be returned). If you wish to get a valid module,
use get_module
instead.
sourcepub fn take_npm_snapshot(
&mut self
) -> Option<ValidSerializedNpmResolutionSnapshot>
pub fn take_npm_snapshot( &mut self ) -> Option<ValidSerializedNpmResolutionSnapshot>
Takes the npm snapshot out of the eszip.