Struct magic_string::SourceMap [−][src]
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
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
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 RefUnwindSafe for SourceMap
impl UnwindSafe for SourceMap
Blanket Implementations
Mutably borrows from an owned value. Read more