summaryrefslogtreecommitdiff
path: root/node_modules/@jridgewell/remapping/src/remapping.ts
diff options
context:
space:
mode:
authorChristian Cleberg <[email protected]>2026-04-18 22:32:53 -0500
committerChristian Cleberg <[email protected]>2026-04-18 22:32:53 -0500
commit580e798e16346eb894eb899edac82d2efdf40adc (patch)
tree6dec3b7db678f781138b40d34da37d21ac8fbe7d /node_modules/@jridgewell/remapping/src/remapping.ts
downloadbrand-bench-580e798e16346eb894eb899edac82d2efdf40adc.tar.gz
brand-bench-580e798e16346eb894eb899edac82d2efdf40adc.tar.bz2
brand-bench-580e798e16346eb894eb899edac82d2efdf40adc.zip
initial commit
Diffstat (limited to 'node_modules/@jridgewell/remapping/src/remapping.ts')
-rw-r--r--node_modules/@jridgewell/remapping/src/remapping.ts42
1 files changed, 42 insertions, 0 deletions
diff --git a/node_modules/@jridgewell/remapping/src/remapping.ts b/node_modules/@jridgewell/remapping/src/remapping.ts
new file mode 100644
index 0000000..c0f8b0d
--- /dev/null
+++ b/node_modules/@jridgewell/remapping/src/remapping.ts
@@ -0,0 +1,42 @@
+import buildSourceMapTree from './build-source-map-tree';
+import { traceMappings } from './source-map-tree';
+import SourceMap from './source-map';
+
+import type { SourceMapInput, SourceMapLoader, Options } from './types';
+export type {
+ SourceMapSegment,
+ EncodedSourceMap,
+ EncodedSourceMap as RawSourceMap,
+ DecodedSourceMap,
+ SourceMapInput,
+ SourceMapLoader,
+ LoaderContext,
+ Options,
+} from './types';
+export type { SourceMap };
+
+/**
+ * Traces through all the mappings in the root sourcemap, through the sources
+ * (and their sourcemaps), all the way back to the original source location.
+ *
+ * `loader` will be called every time we encounter a source file. If it returns
+ * a sourcemap, we will recurse into that sourcemap to continue the trace. If
+ * it returns a falsey value, that source file is treated as an original,
+ * unmodified source file.
+ *
+ * Pass `excludeContent` to exclude any self-containing source file content
+ * from the output sourcemap.
+ *
+ * Pass `decodedMappings` to receive a SourceMap with decoded (instead of
+ * VLQ encoded) mappings.
+ */
+export default function remapping(
+ input: SourceMapInput | SourceMapInput[],
+ loader: SourceMapLoader,
+ options?: boolean | Options,
+): SourceMap {
+ const opts =
+ typeof options === 'object' ? options : { excludeContent: !!options, decodedMappings: false };
+ const tree = buildSourceMapTree(input, loader);
+ return new SourceMap(traceMappings(tree), opts);
+}