source: trip-planner-front/node_modules/@angular/compiler/src/output/source_map.js

Last change on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 22.2 KB
Line 
1/**
2 * @license
3 * Copyright Google LLC All Rights Reserved.
4 *
5 * Use of this source code is governed by an MIT-style license that can be
6 * found in the LICENSE file at https://angular.io/license
7 */
8(function (factory) {
9 if (typeof module === "object" && typeof module.exports === "object") {
10 var v = factory(require, exports);
11 if (v !== undefined) module.exports = v;
12 }
13 else if (typeof define === "function" && define.amd) {
14 define("@angular/compiler/src/output/source_map", ["require", "exports", "@angular/compiler/src/util"], factory);
15 }
16})(function (require, exports) {
17 "use strict";
18 Object.defineProperty(exports, "__esModule", { value: true });
19 exports.toBase64String = exports.SourceMapGenerator = void 0;
20 var util_1 = require("@angular/compiler/src/util");
21 // https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit
22 var VERSION = 3;
23 var JS_B64_PREFIX = '# sourceMappingURL=data:application/json;base64,';
24 var SourceMapGenerator = /** @class */ (function () {
25 function SourceMapGenerator(file) {
26 if (file === void 0) { file = null; }
27 this.file = file;
28 this.sourcesContent = new Map();
29 this.lines = [];
30 this.lastCol0 = 0;
31 this.hasMappings = false;
32 }
33 // The content is `null` when the content is expected to be loaded using the URL
34 SourceMapGenerator.prototype.addSource = function (url, content) {
35 if (content === void 0) { content = null; }
36 if (!this.sourcesContent.has(url)) {
37 this.sourcesContent.set(url, content);
38 }
39 return this;
40 };
41 SourceMapGenerator.prototype.addLine = function () {
42 this.lines.push([]);
43 this.lastCol0 = 0;
44 return this;
45 };
46 SourceMapGenerator.prototype.addMapping = function (col0, sourceUrl, sourceLine0, sourceCol0) {
47 if (!this.currentLine) {
48 throw new Error("A line must be added before mappings can be added");
49 }
50 if (sourceUrl != null && !this.sourcesContent.has(sourceUrl)) {
51 throw new Error("Unknown source file \"" + sourceUrl + "\"");
52 }
53 if (col0 == null) {
54 throw new Error("The column in the generated code must be provided");
55 }
56 if (col0 < this.lastCol0) {
57 throw new Error("Mapping should be added in output order");
58 }
59 if (sourceUrl && (sourceLine0 == null || sourceCol0 == null)) {
60 throw new Error("The source location must be provided when a source url is provided");
61 }
62 this.hasMappings = true;
63 this.lastCol0 = col0;
64 this.currentLine.push({ col0: col0, sourceUrl: sourceUrl, sourceLine0: sourceLine0, sourceCol0: sourceCol0 });
65 return this;
66 };
67 Object.defineProperty(SourceMapGenerator.prototype, "currentLine", {
68 /**
69 * @internal strip this from published d.ts files due to
70 * https://github.com/microsoft/TypeScript/issues/36216
71 */
72 get: function () {
73 return this.lines.slice(-1)[0];
74 },
75 enumerable: false,
76 configurable: true
77 });
78 SourceMapGenerator.prototype.toJSON = function () {
79 var _this = this;
80 if (!this.hasMappings) {
81 return null;
82 }
83 var sourcesIndex = new Map();
84 var sources = [];
85 var sourcesContent = [];
86 Array.from(this.sourcesContent.keys()).forEach(function (url, i) {
87 sourcesIndex.set(url, i);
88 sources.push(url);
89 sourcesContent.push(_this.sourcesContent.get(url) || null);
90 });
91 var mappings = '';
92 var lastCol0 = 0;
93 var lastSourceIndex = 0;
94 var lastSourceLine0 = 0;
95 var lastSourceCol0 = 0;
96 this.lines.forEach(function (segments) {
97 lastCol0 = 0;
98 mappings += segments
99 .map(function (segment) {
100 // zero-based starting column of the line in the generated code
101 var segAsStr = toBase64VLQ(segment.col0 - lastCol0);
102 lastCol0 = segment.col0;
103 if (segment.sourceUrl != null) {
104 // zero-based index into the “sources” list
105 segAsStr +=
106 toBase64VLQ(sourcesIndex.get(segment.sourceUrl) - lastSourceIndex);
107 lastSourceIndex = sourcesIndex.get(segment.sourceUrl);
108 // the zero-based starting line in the original source
109 segAsStr += toBase64VLQ(segment.sourceLine0 - lastSourceLine0);
110 lastSourceLine0 = segment.sourceLine0;
111 // the zero-based starting column in the original source
112 segAsStr += toBase64VLQ(segment.sourceCol0 - lastSourceCol0);
113 lastSourceCol0 = segment.sourceCol0;
114 }
115 return segAsStr;
116 })
117 .join(',');
118 mappings += ';';
119 });
120 mappings = mappings.slice(0, -1);
121 return {
122 'file': this.file || '',
123 'version': VERSION,
124 'sourceRoot': '',
125 'sources': sources,
126 'sourcesContent': sourcesContent,
127 'mappings': mappings,
128 };
129 };
130 SourceMapGenerator.prototype.toJsComment = function () {
131 return this.hasMappings ? '//' + JS_B64_PREFIX + toBase64String(JSON.stringify(this, null, 0)) :
132 '';
133 };
134 return SourceMapGenerator;
135 }());
136 exports.SourceMapGenerator = SourceMapGenerator;
137 function toBase64String(value) {
138 var b64 = '';
139 var encoded = util_1.utf8Encode(value);
140 for (var i = 0; i < encoded.length;) {
141 var i1 = encoded[i++];
142 var i2 = i < encoded.length ? encoded[i++] : null;
143 var i3 = i < encoded.length ? encoded[i++] : null;
144 b64 += toBase64Digit(i1 >> 2);
145 b64 += toBase64Digit(((i1 & 3) << 4) | (i2 === null ? 0 : i2 >> 4));
146 b64 += i2 === null ? '=' : toBase64Digit(((i2 & 15) << 2) | (i3 === null ? 0 : i3 >> 6));
147 b64 += i2 === null || i3 === null ? '=' : toBase64Digit(i3 & 63);
148 }
149 return b64;
150 }
151 exports.toBase64String = toBase64String;
152 function toBase64VLQ(value) {
153 value = value < 0 ? ((-value) << 1) + 1 : value << 1;
154 var out = '';
155 do {
156 var digit = value & 31;
157 value = value >> 5;
158 if (value > 0) {
159 digit = digit | 32;
160 }
161 out += toBase64Digit(digit);
162 } while (value > 0);
163 return out;
164 }
165 var B64_DIGITS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
166 function toBase64Digit(value) {
167 if (value < 0 || value >= 64) {
168 throw new Error("Can only encode value in the range [0, 63]");
169 }
170 return B64_DIGITS[value];
171 }
172});
173//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic291cmNlX21hcC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4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Y29uc3Qgc291cmNlczogc3RyaW5nW10gPSBbXTtcbiAgICBjb25zdCBzb3VyY2VzQ29udGVudDogKHN0cmluZ3xudWxsKVtdID0gW107XG5cbiAgICBBcnJheS5mcm9tKHRoaXMuc291cmNlc0NvbnRlbnQua2V5cygpKS5mb3JFYWNoKCh1cmw6IHN0cmluZywgaTogbnVtYmVyKSA9PiB7XG4gICAgICBzb3VyY2VzSW5kZXguc2V0KHVybCwgaSk7XG4gICAgICBzb3VyY2VzLnB1c2godXJsKTtcbiAgICAgIHNvdXJjZXNDb250ZW50LnB1c2godGhpcy5zb3VyY2VzQ29udGVudC5nZXQodXJsKSB8fCBudWxsKTtcbiAgICB9KTtcblxuICAgIGxldCBtYXBwaW5nczogc3RyaW5nID0gJyc7XG4gICAgbGV0IGxhc3RDb2wwOiBudW1iZXIgPSAwO1xuICAgIGxldCBsYXN0U291cmNlSW5kZXg6IG51bWJlciA9IDA7XG4gICAgbGV0IGxhc3RTb3VyY2VMaW5lMDogbnVtYmVyID0gMDtcbiAgICBsZXQgbGFzdFNvdXJjZUNvbDA6IG51bWJlciA9IDA7XG5cbiAgICB0aGlzLmxpbmVzLmZvckVhY2goc2VnbWVudHMgPT4ge1xuICAgICAgbGFzdENvbDAgPSAwO1xuXG4gICAgICBtYXBwaW5ncyArPSBzZWdtZW50c1xuICAgICAgICAgICAgICAgICAgICAgIC5tYXAoc2VnbWVudCA9PiB7XG4gICAgICAgICAgICAgICAgICAgICAgICAvLyB6ZXJvLWJhc2VkIHN0YXJ0aW5nIGNvbHVtbiBvZiB0aGUgbGluZSBpbiB0aGUgZ2VuZXJhdGVkIGNvZGVcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCBzZWdBc1N0ciA9IHRvQmFzZTY0VkxRKHNlZ21lbnQuY29sMCAtIGxhc3RDb2wwKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGxhc3RDb2wwID0gc2VnbWVudC5jb2wwO1xuXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoc2VnbWVudC5zb3VyY2VVcmwgIT0gbnVsbCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAvLyB6ZXJvLWJhc2VkIGluZGV4IGludG8gdGhlIOKAnHNvdXJjZXPigJ0gbGlzdFxuICAgICAgICAgICAgICAgICAgICAgICAgICBzZWdBc1N0ciArPVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdG9CYXNlNjRWTFEoc291cmNlc0luZGV4LmdldChzZWdtZW50LnNvdXJjZVVybCkhIC0gbGFzdFNvdXJjZUluZGV4KTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgbGFzdFNvdXJjZUluZGV4ID0gc291cmNlc0luZGV4LmdldChzZWdtZW50LnNvdXJjZVVybCkhO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAvLyB0aGUgemVyby1iYXNlZCBzdGFydGluZyBsaW5lIGluIHRoZSBvcmlnaW5hbCBzb3VyY2VcbiAgICAgICAgICAgICAgICAgICAgICAgICAgc2VnQXNTdHIgKz0gdG9CYXNlNjRWTFEoc2VnbWVudC5zb3VyY2VMaW5lMCEgLSBsYXN0U291cmNlTGluZTApO1xuICAgICAgICAgICAgICAgICAgICAgICAgICBsYXN0U291cmNlTGluZTAgPSBzZWdtZW50LnNvdXJjZUxpbmUwITtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gdGhlIHplcm8tYmFzZWQgc3RhcnRpbmcgY29sdW1uIGluIHRoZSBvcmlnaW5hbCBzb3VyY2VcbiAgICAgICAgICAgICAgICAgICAgICAgICAgc2VnQXNTdHIgKz0gdG9CYXNlNjRWTFEoc2VnbWVudC5zb3VyY2VDb2wwISAtIGxhc3RTb3VyY2VDb2wwKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgbGFzdFNvdXJjZUNvbDAgPSBzZWdtZW50LnNvdXJjZUNvbDAhO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gc2VnQXNTd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