Icard/angular-clarity-master(work.../node_modules/@jridgewell/source-map/dist/source-map.mjs.map

1 line
6.8 KiB
Plaintext
Raw Normal View History

2024-07-16 14:55:36 +00:00
{"version":3,"file":"source-map.mjs","sources":["../../src/source-map.ts"],"sourcesContent":["import {\n AnyMap,\n originalPositionFor,\n generatedPositionFor,\n allGeneratedPositionsFor,\n eachMapping,\n encodedMappings,\n sourceContentFor,\n} from '@jridgewell/trace-mapping';\nimport {\n GenMapping,\n maybeAddMapping,\n toDecodedMap,\n toEncodedMap,\n setSourceContent,\n fromMap,\n} from '@jridgewell/gen-mapping';\n\nimport type {\n TraceMap,\n SourceMapInput,\n SectionedSourceMapInput,\n DecodedSourceMap,\n} from '@jridgewell/trace-mapping';\nexport type { TraceMap, SourceMapInput, SectionedSourceMapInput, DecodedSourceMap };\n\nimport type { Mapping, EncodedSourceMap } from '@jridgewell/gen-mapping';\nexport type { Mapping, EncodedSourceMap };\n\nexport class SourceMapConsumer {\n private declare _map: TraceMap;\n declare file: TraceMap['file'];\n declare names: TraceMap['names'];\n declare sourceRoot: TraceMap['sourceRoot'];\n declare sources: TraceMap['sources'];\n declare sourcesContent: TraceMap['sourcesContent'];\n declare version: TraceMap['version'];\n\n constructor(map: ConstructorParameters<typeof AnyMap>[0], mapUrl: Parameters<typeof AnyMap>[1]) {\n const trace = (this._map = new AnyMap(map, mapUrl));\n\n this.file = trace.file;\n this.names = trace.names;\n this.sourceRoot = trace.sourceRoot;\n this.sources = trace.resolvedSources;\n this.sourcesContent = trace.sourcesContent;\n this.version = trace.version;\n }\n\n static fromSourceMap(map: SourceMapGenerator, mapUrl: Parameters<typeof AnyMap>[1]) {\n // This is more performant if we receive\n // a @jridgewell/source-map SourceMapGenerator\n if (map.toDecodedMap) {\n return new SourceMapConsumer(map.toDecodedMap() as SectionedSourceMapInput, mapUrl);\n }\n\n // This is a fallback for `source-map` and `source-map-js`\n return new SourceMapConsumer(map.toJSON() as SectionedSourceMapInput, mapUrl);\n }\n\n get mappings(): string {\n return encodedMappings(this._map);\n }\n\n originalPositionFor(\n needle: Parameters<typeof originalPositionFor>[1],\n ): ReturnType<typeof originalPositionFor> {\n return originalPositionFor(this._map, needle);\n }\n\n generatedPositionFor(\n originalPosition: Parameters<typeof generatedPositionFor>[1],\n ): ReturnType<typeof generatedPositionFor> {\n return generatedPositionFor(this._map, originalPosition);\n }\n\n allGeneratedPositionsFor(\n originalPosition: Parameters<typeof generatedPositionFor>[1],\n ): ReturnType<typeof generatedPositionFor>[] {\n return allGeneratedPositionsFor(this._map, originalPosition);\n }\n\n hasContentsOfAllSources(): boolean {\n if (!this.sourcesContent || this.sourcesContent.length !== this.sources.length) {\n return false;\n }\n\n for (const content of this.sourcesContent) {\n if (content == null) {\n return false;\n }\n }\n\n return true;\n }\n\n sourceContentFor(source: string, nullOnMissing?: boolean): string | null {\n const sourceContent = sourceContentFor(this._map, source);\n if (sourceContent != null) {\n return sourceContent;\n }\n\n if (nullOnMissing) {\n return null;\n }\n throw new Error(`\"${source}\" is not in the SourceMap.`);\n }\n\n eachMapping(\n callback: Parameters<typeof eachMapping>[1],\n context?: any /*, order?: number*/,\n ): void {\n // order is ignored as @jridgewell/trace-map doesn't implement it\n eachMapping(this._map, context ? callback.bind(context) : callback);\n }\n\n destroy() {\n // noop.\n }\n}\n\nexport class SourceMapGenerator {\n private declare _map: GenMapping;\n\n constructor(opts: ConstructorParameters<typeof GenMapping>[0] | GenMapping) {\n // TODO :: should this be duck-typed ?\n this._map = opts instanceof GenMapping ? opts : new GenMapping(opts);\n }\n\n static fromSourceMap(consumer: SourceMapConsumer) {\n return new SourceMapGenerator(fromMap(consumer));\n }\n\n addMapping(mapping: Parameters<typeof maybeAddMapping>[1]): ReturnType<typeof m