pub struct SourceMap {
pub version: u8,
pub mappings: String,
pub names: Vec<String>,
pub sources: Vec<Option<String>>,
pub sources_content: Vec<Option<String>>,
pub file: Option<String>,
pub source_root: Option<String>,
}Fields§
§version: u8§mappings: String§names: Vec<String>§sources: Vec<Option<String>>§sources_content: Vec<Option<String>>§file: Option<String>§source_root: Option<String>Implementations§
Source§impl SourceMap
impl SourceMap
pub fn new( mappings: &str, file: Option<&str>, names: Vec<&str>, sources_content: Vec<Option<&str>>, source_root: Option<&str>, sources: Vec<Option<&str>>, ) -> Self
Sourcepub fn new_from_decoded(decoded_map: DecodedMap) -> Result<Self>
pub fn new_from_decoded(decoded_map: DecodedMap) -> Result<Self>
§Create a SourceMap instance from a decoded map
DecodedMap can be created by utilizing generate_decoded_map.
Example:
use magic_string::{MagicString, GenerateDecodedMapOptions, SourceMap};
let mut s = MagicString::new("export default React");
s.prepend("import React from 'react'\n");
let decoded_map = s.generate_decoded_map(GenerateDecodedMapOptions {
file: Some("index.js".to_owned()),
source: Some("index.ts".to_owned()),
source_root: Some("./".to_owned()),
include_content: true,
hires: false,
}).expect("failed to generate decoded map");
SourceMap::new_from_decoded(decoded_map);Trait Implementations§
Auto Trait Implementations§
impl Freeze for SourceMap
impl RefUnwindSafe for SourceMap
impl Send for SourceMap
impl Sync for SourceMap
impl Unpin for SourceMap
impl UnwindSafe for SourceMap
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