| 1 | (function (global, factory) {
|
|---|
| 2 | if (typeof exports === 'object' && typeof module !== 'undefined') {
|
|---|
| 3 | factory(module, require('@jridgewell/gen-mapping'), require('@jridgewell/trace-mapping'));
|
|---|
| 4 | module.exports = def(module);
|
|---|
| 5 | } else if (typeof define === 'function' && define.amd) {
|
|---|
| 6 | define(['module', '@jridgewell/gen-mapping', '@jridgewell/trace-mapping'], function(mod) {
|
|---|
| 7 | factory.apply(this, arguments);
|
|---|
| 8 | mod.exports = def(mod);
|
|---|
| 9 | });
|
|---|
| 10 | } else {
|
|---|
| 11 | const mod = { exports: {} };
|
|---|
| 12 | factory(mod, global.genMapping, global.traceMapping);
|
|---|
| 13 | global = typeof globalThis !== 'undefined' ? globalThis : global || self;
|
|---|
| 14 | global.sourceMap = def(mod);
|
|---|
| 15 | }
|
|---|
| 16 | function def(m) { return 'default' in m.exports ? m.exports.default : m.exports; }
|
|---|
| 17 | })(this, (function (module, require_genMapping, require_traceMapping) {
|
|---|
| 18 | "use strict";
|
|---|
| 19 | var __create = Object.create;
|
|---|
| 20 | var __defProp = Object.defineProperty;
|
|---|
| 21 | var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|---|
| 22 | var __getOwnPropNames = Object.getOwnPropertyNames;
|
|---|
| 23 | var __getProtoOf = Object.getPrototypeOf;
|
|---|
| 24 | var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|---|
| 25 | var __commonJS = (cb, mod) => function __require() {
|
|---|
| 26 | return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|---|
| 27 | };
|
|---|
| 28 | var __export = (target, all) => {
|
|---|
| 29 | for (var name in all)
|
|---|
| 30 | __defProp(target, name, { get: all[name], enumerable: true });
|
|---|
| 31 | };
|
|---|
| 32 | var __copyProps = (to, from, except, desc) => {
|
|---|
| 33 | if (from && typeof from === "object" || typeof from === "function") {
|
|---|
| 34 | for (let key of __getOwnPropNames(from))
|
|---|
| 35 | if (!__hasOwnProp.call(to, key) && key !== except)
|
|---|
| 36 | __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|---|
| 37 | }
|
|---|
| 38 | return to;
|
|---|
| 39 | };
|
|---|
| 40 | var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|---|
| 41 | // If the importer is in node compatibility mode or this is not an ESM
|
|---|
| 42 | // file that has been converted to a CommonJS file using a Babel-
|
|---|
| 43 | // compatible transform (i.e. "__esModule" has not been set), then set
|
|---|
| 44 | // "default" to the CommonJS "module.exports" for node compatibility.
|
|---|
| 45 | isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|---|
| 46 | mod
|
|---|
| 47 | ));
|
|---|
| 48 | var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|---|
| 49 |
|
|---|
| 50 | // umd:@jridgewell/trace-mapping
|
|---|
| 51 | var require_trace_mapping = __commonJS({
|
|---|
| 52 | "umd:@jridgewell/trace-mapping"(exports, module2) {
|
|---|
| 53 | module2.exports = require_traceMapping;
|
|---|
| 54 | }
|
|---|
| 55 | });
|
|---|
| 56 |
|
|---|
| 57 | // umd:@jridgewell/gen-mapping
|
|---|
| 58 | var require_gen_mapping = __commonJS({
|
|---|
| 59 | "umd:@jridgewell/gen-mapping"(exports, module2) {
|
|---|
| 60 | module2.exports = require_genMapping;
|
|---|
| 61 | }
|
|---|
| 62 | });
|
|---|
| 63 |
|
|---|
| 64 | // src/source-map.ts
|
|---|
| 65 | var source_map_exports = {};
|
|---|
| 66 | __export(source_map_exports, {
|
|---|
| 67 | SourceMapConsumer: () => SourceMapConsumer,
|
|---|
| 68 | SourceMapGenerator: () => SourceMapGenerator
|
|---|
| 69 | });
|
|---|
| 70 | module.exports = __toCommonJS(source_map_exports);
|
|---|
| 71 | var import_trace_mapping = __toESM(require_trace_mapping());
|
|---|
| 72 | var import_gen_mapping = __toESM(require_gen_mapping());
|
|---|
| 73 | var SourceMapConsumer = class _SourceMapConsumer {
|
|---|
| 74 | constructor(map, mapUrl) {
|
|---|
| 75 | const trace = this._map = new import_trace_mapping.AnyMap(map, mapUrl);
|
|---|
| 76 | this.file = trace.file;
|
|---|
| 77 | this.names = trace.names;
|
|---|
| 78 | this.sourceRoot = trace.sourceRoot;
|
|---|
| 79 | this.sources = trace.resolvedSources;
|
|---|
| 80 | this.sourcesContent = trace.sourcesContent;
|
|---|
| 81 | this.version = trace.version;
|
|---|
| 82 | }
|
|---|
| 83 | static fromSourceMap(map, mapUrl) {
|
|---|
| 84 | if (map.toDecodedMap) {
|
|---|
| 85 | return new _SourceMapConsumer(map.toDecodedMap(), mapUrl);
|
|---|
| 86 | }
|
|---|
| 87 | return new _SourceMapConsumer(map.toJSON(), mapUrl);
|
|---|
| 88 | }
|
|---|
| 89 | get mappings() {
|
|---|
| 90 | return (0, import_trace_mapping.encodedMappings)(this._map);
|
|---|
| 91 | }
|
|---|
| 92 | originalPositionFor(needle) {
|
|---|
| 93 | return (0, import_trace_mapping.originalPositionFor)(this._map, needle);
|
|---|
| 94 | }
|
|---|
| 95 | generatedPositionFor(originalPosition) {
|
|---|
| 96 | return (0, import_trace_mapping.generatedPositionFor)(this._map, originalPosition);
|
|---|
| 97 | }
|
|---|
| 98 | allGeneratedPositionsFor(originalPosition) {
|
|---|
| 99 | return (0, import_trace_mapping.allGeneratedPositionsFor)(this._map, originalPosition);
|
|---|
| 100 | }
|
|---|
| 101 | hasContentsOfAllSources() {
|
|---|
| 102 | if (!this.sourcesContent || this.sourcesContent.length !== this.sources.length) {
|
|---|
| 103 | return false;
|
|---|
| 104 | }
|
|---|
| 105 | for (const content of this.sourcesContent) {
|
|---|
| 106 | if (content == null) {
|
|---|
| 107 | return false;
|
|---|
| 108 | }
|
|---|
| 109 | }
|
|---|
| 110 | return true;
|
|---|
| 111 | }
|
|---|
| 112 | sourceContentFor(source, nullOnMissing) {
|
|---|
| 113 | const sourceContent = (0, import_trace_mapping.sourceContentFor)(this._map, source);
|
|---|
| 114 | if (sourceContent != null) {
|
|---|
| 115 | return sourceContent;
|
|---|
| 116 | }
|
|---|
| 117 | if (nullOnMissing) {
|
|---|
| 118 | return null;
|
|---|
| 119 | }
|
|---|
| 120 | throw new Error(`"${source}" is not in the SourceMap.`);
|
|---|
| 121 | }
|
|---|
| 122 | eachMapping(callback, context) {
|
|---|
| 123 | (0, import_trace_mapping.eachMapping)(this._map, context ? callback.bind(context) : callback);
|
|---|
| 124 | }
|
|---|
| 125 | destroy() {
|
|---|
| 126 | }
|
|---|
| 127 | };
|
|---|
| 128 | var SourceMapGenerator = class _SourceMapGenerator {
|
|---|
| 129 | constructor(opts) {
|
|---|
| 130 | this._map = opts instanceof import_gen_mapping.GenMapping ? opts : new import_gen_mapping.GenMapping(opts);
|
|---|
| 131 | }
|
|---|
| 132 | static fromSourceMap(consumer) {
|
|---|
| 133 | return new _SourceMapGenerator((0, import_gen_mapping.fromMap)(consumer));
|
|---|
| 134 | }
|
|---|
| 135 | addMapping(mapping) {
|
|---|
| 136 | (0, import_gen_mapping.maybeAddMapping)(this._map, mapping);
|
|---|
| 137 | }
|
|---|
| 138 | setSourceContent(source, content) {
|
|---|
| 139 | (0, import_gen_mapping.setSourceContent)(this._map, source, content);
|
|---|
| 140 | }
|
|---|
| 141 | toJSON() {
|
|---|
| 142 | return (0, import_gen_mapping.toEncodedMap)(this._map);
|
|---|
| 143 | }
|
|---|
| 144 | toString() {
|
|---|
| 145 | return JSON.stringify(this.toJSON());
|
|---|
| 146 | }
|
|---|
| 147 | toDecodedMap() {
|
|---|
| 148 | return (0, import_gen_mapping.toDecodedMap)(this._map);
|
|---|
| 149 | }
|
|---|
| 150 | };
|
|---|
| 151 | }));
|
|---|
| 152 | //# sourceMappingURL=source-map.umd.js.map
|
|---|