diff options
Diffstat (limited to 'node_modules/@ampproject/remapping/dist/remapping.mjs')
| -rw-r--r-- | node_modules/@ampproject/remapping/dist/remapping.mjs | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/node_modules/@ampproject/remapping/dist/remapping.mjs b/node_modules/@ampproject/remapping/dist/remapping.mjs index b5eddeda..f3875999 100644 --- a/node_modules/@ampproject/remapping/dist/remapping.mjs +++ b/node_modules/@ampproject/remapping/dist/remapping.mjs @@ -1,17 +1,18 @@ import { decodedMappings, traceSegment, TraceMap } from '@jridgewell/trace-mapping'; -import { GenMapping, maybeAddSegment, setSourceContent, toDecodedMap, toEncodedMap } from '@jridgewell/gen-mapping'; +import { GenMapping, maybeAddSegment, setSourceContent, setIgnore, toDecodedMap, toEncodedMap } from '@jridgewell/gen-mapping'; -const SOURCELESS_MAPPING = /* #__PURE__ */ SegmentObject('', -1, -1, '', null); +const SOURCELESS_MAPPING = /* #__PURE__ */ SegmentObject('', -1, -1, '', null, false); const EMPTY_SOURCES = []; -function SegmentObject(source, line, column, name, content) { - return { source, line, column, name, content }; +function SegmentObject(source, line, column, name, content, ignore) { + return { source, line, column, name, content, ignore }; } -function Source(map, sources, source, content) { +function Source(map, sources, source, content, ignore) { return { map, sources, source, content, + ignore, }; } /** @@ -19,14 +20,14 @@ function Source(map, sources, source, content) { * (which may themselves be SourceMapTrees). */ function MapSource(map, sources) { - return Source(map, sources, '', null); + return Source(map, sources, '', null, false); } /** * A "leaf" node in the sourcemap tree, representing an original, unmodified source file. Recursive * segment tracing ends at the `OriginalSource`. */ -function OriginalSource(source, content) { - return Source(null, EMPTY_SOURCES, source, content); +function OriginalSource(source, content, ignore) { + return Source(null, EMPTY_SOURCES, source, content, ignore); } /** * traceMappings is only called on the root level SourceMapTree, and begins the process of @@ -55,10 +56,12 @@ function traceMappings(tree) { if (traced == null) continue; } - const { column, line, name, content, source } = traced; + const { column, line, name, content, source, ignore } = traced; maybeAddSegment(gen, i, genCol, source, line, column, name); if (source && content != null) setSourceContent(gen, source, content); + if (ignore) + setIgnore(gen, source, true); } } return gen; @@ -69,7 +72,7 @@ function traceMappings(tree) { */ function originalPositionFor(source, line, column, name) { if (!source.map) { - return SegmentObject(source.source, line, column, name, source.content); + return SegmentObject(source.source, line, column, name, source.content, source.ignore); } const segment = traceSegment(source.map, line, column); // If we couldn't find a segment, then this doesn't exist in the sourcemap. @@ -114,7 +117,7 @@ function buildSourceMapTree(input, loader) { return tree; } function build(map, loader, importer, importerDepth) { - const { resolvedSources, sourcesContent } = map; + const { resolvedSources, sourcesContent, ignoreList } = map; const depth = importerDepth + 1; const children = resolvedSources.map((sourceFile, i) => { // The loading context gives the loader more information about why this file is being loaded @@ -126,20 +129,22 @@ function build(map, loader, importer, importerDepth) { depth, source: sourceFile || '', content: undefined, + ignore: undefined, }; // Use the provided loader callback to retrieve the file's sourcemap. // TODO: We should eventually support async loading of sourcemap files. const sourceMap = loader(ctx.source, ctx); - const { source, content } = ctx; + const { source, content, ignore } = ctx; // If there is a sourcemap, then we need to recurse into it to load its source files. if (sourceMap) return build(new TraceMap(sourceMap, source), loader, source, depth); - // Else, it's an an unmodified source file. + // Else, it's an unmodified source file. // The contents of this unmodified source file can be overridden via the loader context, // allowing it to be explicitly null or a string. If it remains undefined, we fall back to // the importing sourcemap's `sourcesContent` field. const sourceContent = content !== undefined ? content : sourcesContent ? sourcesContent[i] : null; - return OriginalSource(source, sourceContent); + const ignored = ignore !== undefined ? ignore : ignoreList ? ignoreList.includes(i) : false; + return OriginalSource(source, sourceContent, ignored); }); return MapSource(map, children); } @@ -155,6 +160,7 @@ class SourceMap { this.file = out.file; this.mappings = out.mappings; this.names = out.names; + this.ignoreList = out.ignoreList; this.sourceRoot = out.sourceRoot; this.sources = out.sources; if (!options.excludeContent) { |
