How to use the magic-string.SourceMap function in magic-string

To help you get started, we’ve selected a few magic-string examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rollup / rollup / src / utils / collapseSourcemaps.ts View on Github external
// correct SourceMapSegment tuples. Cast it here to gain type safety.
	let source = new Link(map as ExistingDecodedSourceMap, moduleSources);

	source = bundleSourcemapChain.reduce(linkMap, source);

	let { sources, sourcesContent, names, mappings } = source.traceMappings();

	if (file) {
		const directory = dirname(file);
		sources = sources.map((source: string) => relative(directory, source));
		file = basename(file);
	}

	sourcesContent = (excludeContent ? null : sourcesContent) as string[];

	return new SourceMap({ file, sources, sourcesContent, names, mappings });
}

magic-string

Modify strings, generate sourcemaps

MIT
Latest version published 21 days ago

Package Health Score

89 / 100
Full package analysis