UNPKG

@umijs/deps

Version:

[![Install size](https://badgen.net/packagephobia/install/@umijs/deps)](https://packagephobia.now.sh/result?p=@umijs/deps)

1,674 lines (1,436 loc) 4.28 MB
module.exports = /******/ (function() { // webpackBootstrap /******/ var __webpack_modules__ = ({ /***/ 36233: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php Author Tobias Koppers @sokra */ const getNumberOfLines = __webpack_require__(52335)/* .getNumberOfLines */ .y; const getUnfinishedLine = __webpack_require__(52335)/* .getUnfinishedLine */ .P; class CodeNode { constructor(generatedCode) { this.generatedCode = generatedCode; } clone() { return new CodeNode(this.generatedCode); } getGeneratedCode() { return this.generatedCode; } getMappings(mappingsContext) { const lines = getNumberOfLines(this.generatedCode); const mapping = Array(lines+1).join(";"); if(lines > 0) { mappingsContext.unfinishedGeneratedLine = getUnfinishedLine(this.generatedCode); if(mappingsContext.unfinishedGeneratedLine > 0) { return mapping + "A"; } else { return mapping; } } else { const prevUnfinished = mappingsContext.unfinishedGeneratedLine; mappingsContext.unfinishedGeneratedLine += getUnfinishedLine(this.generatedCode); if(prevUnfinished === 0 && mappingsContext.unfinishedGeneratedLine > 0) { return "A"; } else { return ""; } } } addGeneratedCode(generatedCode) { this.generatedCode += generatedCode; } mapGeneratedCode(fn) { const generatedCode = fn(this.generatedCode); return new CodeNode(generatedCode); } getNormalizedNodes() { return [this]; } merge(otherNode) { if(otherNode instanceof CodeNode) { this.generatedCode += otherNode.generatedCode; return this; } return false; } } module.exports = CodeNode; /***/ }), /***/ 28940: /***/ (function(module) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php Author Tobias Koppers @sokra */ class MappingsContext { constructor() { this.sourcesIndices = new Map(); this.sourcesContent = new Map(); this.hasSourceContent = false; this.currentOriginalLine = 1; this.currentSource = 0; this.unfinishedGeneratedLine = false; } ensureSource(source, originalSource) { let idx = this.sourcesIndices.get(source); if(typeof idx === "number") { return idx; } idx = this.sourcesIndices.size; this.sourcesIndices.set(source, idx); this.sourcesContent.set(source, originalSource) if(typeof originalSource === "string") this.hasSourceContent = true; return idx; } getArrays() { const sources = []; const sourcesContent = []; for(const pair of this.sourcesContent) { sources.push(pair[0]); sourcesContent.push(pair[1]); } return { sources, sourcesContent }; } } module.exports = MappingsContext; /***/ }), /***/ 8482: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php Author Tobias Koppers @sokra */ const base64VLQ = __webpack_require__(98439); const getNumberOfLines = __webpack_require__(52335)/* .getNumberOfLines */ .y; const getUnfinishedLine = __webpack_require__(52335)/* .getUnfinishedLine */ .P; const LINE_MAPPING = ";AAAA"; class SingleLineNode { constructor(generatedCode, source, originalSource, line) { this.generatedCode = generatedCode; this.originalSource = originalSource; this.source = source; this.line = line || 1; this._numberOfLines = getNumberOfLines(this.generatedCode); this._endsWithNewLine = generatedCode[generatedCode.length - 1] === "\n"; } clone() { return new SingleLineNode(this.generatedCode, this.source, this.originalSource, this.line); } getGeneratedCode() { return this.generatedCode; } getMappings(mappingsContext) { if(!this.generatedCode) return ""; const lines = this._numberOfLines; const sourceIdx = mappingsContext.ensureSource(this.source, this.originalSource); let mappings = "A"; // generated column 0 if(mappingsContext.unfinishedGeneratedLine) mappings = "," + base64VLQ.encode(mappingsContext.unfinishedGeneratedLine); mappings += base64VLQ.encode(sourceIdx - mappingsContext.currentSource); // source index mappings += base64VLQ.encode(this.line - mappingsContext.currentOriginalLine); // original line index mappings += "A"; // original column 0 mappingsContext.currentSource = sourceIdx; mappingsContext.currentOriginalLine = this.line; const unfinishedGeneratedLine = mappingsContext.unfinishedGeneratedLine = getUnfinishedLine(this.generatedCode) mappings += Array(lines).join(LINE_MAPPING); if(unfinishedGeneratedLine === 0) { mappings += ";"; } else { if(lines !== 0) mappings += LINE_MAPPING; } return mappings; } getNormalizedNodes() { return [this]; } mapGeneratedCode(fn) { const generatedCode = fn(this.generatedCode); return new SingleLineNode(generatedCode, this.source, this.originalSource, this.line); } merge(otherNode) { if(otherNode instanceof SingleLineNode) { return this.mergeSingleLineNode(otherNode); } return false; } mergeSingleLineNode(otherNode) { if(this.source === otherNode.source && this.originalSource === otherNode.originalSource) { if(this.line === otherNode.line) { this.generatedCode += otherNode.generatedCode; this._numberOfLines += otherNode._numberOfLines; this._endsWithNewLine = otherNode._endsWithNewLine; return this; } else if(this.line + 1 === otherNode.line && this._endsWithNewLine && this._numberOfLines === 1 && otherNode._numberOfLines <= 1) { return new SourceNode(this.generatedCode + otherNode.generatedCode, this.source, this.originalSource, this.line); } } return false; } } module.exports = SingleLineNode; const SourceNode = __webpack_require__(90839); // circular dependency /***/ }), /***/ 68950: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php Author Tobias Koppers @sokra */ const CodeNode = __webpack_require__(36233); const SourceNode = __webpack_require__(90839); const MappingsContext = __webpack_require__(28940); const getNumberOfLines = __webpack_require__(52335)/* .getNumberOfLines */ .y; class SourceListMap { constructor(generatedCode, source, originalSource) { if(Array.isArray(generatedCode)) { this.children = generatedCode; } else { this.children = []; if(generatedCode || source) this.add(generatedCode, source, originalSource); } } add(generatedCode, source, originalSource) { if(typeof generatedCode === "string") { if(source) { this.children.push(new SourceNode(generatedCode, source, originalSource)); } else if(this.children.length > 0 && this.children[this.children.length - 1] instanceof CodeNode) { this.children[this.children.length - 1].addGeneratedCode(generatedCode); } else { this.children.push(new CodeNode(generatedCode)); } } else if(generatedCode.getMappings && generatedCode.getGeneratedCode) { this.children.push(generatedCode); } else if(generatedCode.children) { generatedCode.children.forEach(function(sln) { this.children.push(sln); }, this); } else { throw new Error("Invalid arguments to SourceListMap.protfotype.add: Expected string, Node or SourceListMap"); } }; preprend(generatedCode, source, originalSource) { if(typeof generatedCode === "string") { if(source) { this.children.unshift(new SourceNode(generatedCode, source, originalSource)); } else if(this.children.length > 0 && this.children[this.children.length - 1].preprendGeneratedCode) { this.children[this.children.length - 1].preprendGeneratedCode(generatedCode); } else { this.children.unshift(new CodeNode(generatedCode)); } } else if(generatedCode.getMappings && generatedCode.getGeneratedCode) { this.children.unshift(generatedCode); } else if(generatedCode.children) { generatedCode.children.slice().reverse().forEach(function(sln) { this.children.unshift(sln); }, this); } else { throw new Error("Invalid arguments to SourceListMap.protfotype.prerend: Expected string, Node or SourceListMap"); } }; mapGeneratedCode(fn) { const normalizedNodes = []; this.children.forEach(function(sln) { sln.getNormalizedNodes().forEach(function(newNode) { normalizedNodes.push(newNode); }); }); const optimizedNodes = []; normalizedNodes.forEach(function(sln) { sln = sln.mapGeneratedCode(fn); if(optimizedNodes.length === 0) { optimizedNodes.push(sln); } else { const last = optimizedNodes[optimizedNodes.length - 1]; const mergedNode = last.merge(sln); if(mergedNode) { optimizedNodes[optimizedNodes.length - 1] = mergedNode; } else { optimizedNodes.push(sln); } } }); return new SourceListMap(optimizedNodes); }; toString() { return this.children.map(function(sln) { return sln.getGeneratedCode(); }).join(""); }; toStringWithSourceMap(options) { const mappingsContext = new MappingsContext(); const source = this.children.map(function(sln) { return sln.getGeneratedCode(); }).join(""); const mappings = this.children.map(function(sln) { return sln.getMappings(mappingsContext); }).join(""); const arrays = mappingsContext.getArrays(); return { source, map: { version: 3, file: options && options.file, sources: arrays.sources, sourcesContent: mappingsContext.hasSourceContent ? arrays.sourcesContent : undefined, mappings: mappings } }; } } module.exports = SourceListMap; /***/ }), /***/ 90839: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php Author Tobias Koppers @sokra */ const base64VLQ = __webpack_require__(98439); const getNumberOfLines = __webpack_require__(52335)/* .getNumberOfLines */ .y; const getUnfinishedLine = __webpack_require__(52335)/* .getUnfinishedLine */ .P; const LINE_MAPPING = ";AACA"; class SourceNode { constructor(generatedCode, source, originalSource, startingLine) { this.generatedCode = generatedCode; this.originalSource = originalSource; this.source = source; this.startingLine = startingLine || 1; this._numberOfLines = getNumberOfLines(this.generatedCode); this._endsWithNewLine = generatedCode[generatedCode.length - 1] === "\n"; } clone() { return new SourceNode(this.generatedCode, this.source, this.originalSource, this.startingLine); } getGeneratedCode() { return this.generatedCode; } addGeneratedCode(code) { this.generatedCode += code; this._numberOfLines += getNumberOfLines(code); this._endsWithNewLine = code[code.length - 1] === "\n"; } getMappings(mappingsContext) { if(!this.generatedCode) return ""; const lines = this._numberOfLines; const sourceIdx = mappingsContext.ensureSource(this.source, this.originalSource); let mappings = "A"; // generated column 0 if(mappingsContext.unfinishedGeneratedLine) mappings = "," + base64VLQ.encode(mappingsContext.unfinishedGeneratedLine); mappings += base64VLQ.encode(sourceIdx - mappingsContext.currentSource); // source index mappings += base64VLQ.encode(this.startingLine - mappingsContext.currentOriginalLine); // original line index mappings += "A"; // original column 0 mappingsContext.currentSource = sourceIdx; mappingsContext.currentOriginalLine = this.startingLine + lines - 1; const unfinishedGeneratedLine = mappingsContext.unfinishedGeneratedLine = getUnfinishedLine(this.generatedCode) mappings += Array(lines).join(LINE_MAPPING); if(unfinishedGeneratedLine === 0) { mappings += ";"; } else { if(lines !== 0) { mappings += LINE_MAPPING; } mappingsContext.currentOriginalLine++; } return mappings; } mapGeneratedCode(fn) { throw new Error("Cannot map generated code on a SourceMap. Normalize to SingleLineNode first."); } getNormalizedNodes() { var results = []; var currentLine = this.startingLine; var generatedCode = this.generatedCode; var index = 0; var indexEnd = generatedCode.length; while(index < indexEnd) { // get one generated line var nextLine = generatedCode.indexOf("\n", index) + 1; if(nextLine === 0) nextLine = indexEnd; var lineGenerated = generatedCode.substr(index, nextLine - index); results.push(new SingleLineNode(lineGenerated, this.source, this.originalSource, currentLine)); // move cursors index = nextLine; currentLine++; } return results; } merge(otherNode) { if(otherNode instanceof SourceNode) { return this.mergeSourceNode(otherNode); } else if(otherNode instanceof SingleLineNode) { return this.mergeSingleLineNode(otherNode); } return false; } mergeSourceNode(otherNode) { if(this.source === otherNode.source && this._endsWithNewLine && this.startingLine + this._numberOfLines === otherNode.startingLine) { this.generatedCode += otherNode.generatedCode; this._numberOfLines += otherNode._numberOfLines; this._endsWithNewLine = otherNode._endsWithNewLine; return this; } return false; } mergeSingleLineNode(otherNode) { if(this.source === otherNode.source && this._endsWithNewLine && this.startingLine + this._numberOfLines === otherNode.line && otherNode._numberOfLines <= 1) { this.addSingleLineNode(otherNode); return this; } return false; } addSingleLineNode(otherNode) { this.generatedCode += otherNode.generatedCode; this._numberOfLines += otherNode._numberOfLines this._endsWithNewLine = otherNode._endsWithNewLine; } } module.exports = SourceNode; const SingleLineNode = __webpack_require__(8482); // circular dependency /***/ }), /***/ 98439: /***/ (function(__unused_webpack_module, exports) { /* -*- Mode: js; js-indent-level: 2; -*- */ /* * Copyright 2011 Mozilla Foundation and contributors * Licensed under the New BSD license. See LICENSE or: * http://opensource.org/licenses/BSD-3-Clause * * Based on the Base 64 VLQ implementation in Closure Compiler: * https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java * * Copyright 2011 The Closure Compiler Authors. All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * * Neither the name of Google Inc. nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /*eslint no-bitwise:0,quotes:0,global-strict:0*/ var charToIntMap = {}; var intToCharMap = {}; 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' .split('') .forEach(function (ch, index) { charToIntMap[ch] = index; intToCharMap[index] = ch; }); var base64 = {}; /** * Encode an integer in the range of 0 to 63 to a single base 64 digit. */ base64.encode = function base64_encode(aNumber) { if (aNumber in intToCharMap) { return intToCharMap[aNumber]; } throw new TypeError("Must be between 0 and 63: " + aNumber); }; /** * Decode a single base 64 digit to an integer. */ base64.decode = function base64_decode(aChar) { if (aChar in charToIntMap) { return charToIntMap[aChar]; } throw new TypeError("Not a valid base 64 digit: " + aChar); }; // A single base 64 digit can contain 6 bits of data. For the base 64 variable // length quantities we use in the source map spec, the first bit is the sign, // the next four bits are the actual value, and the 6th bit is the // continuation bit. The continuation bit tells us whether there are more // digits in this value following this digit. // // Continuation // | Sign // | | // V V // 101011 var VLQ_BASE_SHIFT = 5; // binary: 100000 var VLQ_BASE = 1 << VLQ_BASE_SHIFT; // binary: 011111 var VLQ_BASE_MASK = VLQ_BASE - 1; // binary: 100000 var VLQ_CONTINUATION_BIT = VLQ_BASE; /** * Converts from a two-complement value to a value where the sign bit is * placed in the least significant bit. For example, as decimals: * 1 becomes 2 (10 binary), -1 becomes 3 (11 binary) * 2 becomes 4 (100 binary), -2 becomes 5 (101 binary) */ function toVLQSigned(aValue) { return aValue < 0 ? ((-aValue) << 1) + 1 : (aValue << 1) + 0; } /** * Converts to a two-complement value from a value where the sign bit is * placed in the least significant bit. For example, as decimals: * 2 (10 binary) becomes 1, 3 (11 binary) becomes -1 * 4 (100 binary) becomes 2, 5 (101 binary) becomes -2 */ function fromVLQSigned(aValue) { var isNegative = (aValue & 1) === 1; var shifted = aValue >> 1; return isNegative ? -shifted : shifted; } /** * Returns the base 64 VLQ encoded value. */ exports.encode = function base64VLQ_encode(aValue) { var encoded = ""; var digit; var vlq = toVLQSigned(aValue); do { digit = vlq & VLQ_BASE_MASK; vlq >>>= VLQ_BASE_SHIFT; if (vlq > 0) { // There are still more digits in this value, so we must make sure the // continuation bit is marked. digit |= VLQ_CONTINUATION_BIT; } encoded += base64.encode(digit); } while (vlq > 0); return encoded; }; /** * Decodes the next base 64 VLQ value from the given string and returns the * value and the rest of the string via the out parameter. */ exports.decode = function base64VLQ_decode(aStr, aOutParam) { var i = 0; var strLen = aStr.length; var result = 0; var shift = 0; var continuation, digit; do { if (i >= strLen) { throw new Error("Expected more digits in base 64 VLQ value."); } digit = base64.decode(aStr.charAt(i++)); continuation = !!(digit & VLQ_CONTINUATION_BIT); digit &= VLQ_BASE_MASK; result = result + (digit << shift); shift += VLQ_BASE_SHIFT; } while (continuation); aOutParam.value = fromVLQSigned(result); aOutParam.rest = aStr.slice(i); }; /***/ }), /***/ 37835: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php Author Tobias Koppers @sokra */ const base64VLQ = __webpack_require__(98439); const SourceNode = __webpack_require__(90839); const CodeNode = __webpack_require__(36233); const SourceListMap = __webpack_require__(68950); module.exports = function fromStringWithSourceMap(code, map) { const sources = map.sources; const sourcesContent = map.sourcesContent; const mappings = map.mappings.split(";"); const lines = code.split("\n"); const nodes = []; let currentNode = null; let currentLine = 1; let currentSourceIdx = 0; let currentSourceNodeLine; function addCode(generatedCode) { if(currentNode && currentNode instanceof CodeNode) { currentNode.addGeneratedCode(generatedCode); } else if(currentNode && currentNode instanceof SourceNode && !generatedCode.trim()) { currentNode.addGeneratedCode(generatedCode); currentSourceNodeLine++; } else { currentNode = new CodeNode(generatedCode); nodes.push(currentNode); } } function addSource(generatedCode, source, originalSource, linePosition) { if(currentNode && currentNode instanceof SourceNode && currentNode.source === source && currentSourceNodeLine === linePosition ) { currentNode.addGeneratedCode(generatedCode); currentSourceNodeLine++; } else { currentNode = new SourceNode(generatedCode, source, originalSource, linePosition); currentSourceNodeLine = linePosition + 1; nodes.push(currentNode); } } mappings.forEach(function(mapping, idx) { let line = lines[idx]; if(typeof line === 'undefined') return; if(idx !== lines.length - 1) line += "\n"; if(!mapping) return addCode(line); mapping = { value: 0, rest: mapping }; let lineAdded = false; while(mapping.rest) lineAdded = processMapping(mapping, line, lineAdded) || lineAdded; if(!lineAdded) addCode(line); }); if(mappings.length < lines.length) { let idx = mappings.length; while(!lines[idx].trim() && idx < lines.length-1) { addCode(lines[idx] + "\n"); idx++; } addCode(lines.slice(idx).join("\n")); } return new SourceListMap(nodes); function processMapping(mapping, line, ignore) { if(mapping.rest && mapping.rest[0] !== ",") { base64VLQ.decode(mapping.rest, mapping); } if(!mapping.rest) return false; if(mapping.rest[0] === ",") { mapping.rest = mapping.rest.substr(1); return false; } base64VLQ.decode(mapping.rest, mapping); const sourceIdx = mapping.value + currentSourceIdx; currentSourceIdx = sourceIdx; let linePosition; if(mapping.rest && mapping.rest[0] !== ",") { base64VLQ.decode(mapping.rest, mapping); linePosition = mapping.value + currentLine; currentLine = linePosition; } else { linePosition = currentLine; } if(mapping.rest) { const next = mapping.rest.indexOf(","); mapping.rest = next === -1 ? "" : mapping.rest.substr(next); } if(!ignore) { addSource(line, sources ? sources[sourceIdx] : null, sourcesContent ? sourcesContent[sourceIdx] : null, linePosition) return true; } } }; /***/ }), /***/ 52335: /***/ (function(__unused_webpack_module, exports) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php Author Tobias Koppers @sokra */ exports.y = function getNumberOfLines(str) { let nr = -1; let idx = -1; do { nr++ idx = str.indexOf("\n", idx + 1); } while(idx >= 0); return nr; }; exports.P = function getUnfinishedLine(str) { const idx = str.lastIndexOf("\n"); if(idx === -1) return str.length; else return str.length - idx - 1; }; /***/ }), /***/ 84728: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { exports.SourceListMap = __webpack_require__(68950); exports.SourceNode = __webpack_require__(90839); exports.SingleLineNode = __webpack_require__(8482); exports.CodeNode = __webpack_require__(36233); exports.MappingsContext = __webpack_require__(28940); exports.fromStringWithSourceMap = __webpack_require__(37835); /***/ }), /***/ 94209: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { /* -*- Mode: js; js-indent-level: 2; -*- */ /* * Copyright 2011 Mozilla Foundation and contributors * Licensed under the New BSD license. See LICENSE or: * http://opensource.org/licenses/BSD-3-Clause */ var util = __webpack_require__(40755); var has = Object.prototype.hasOwnProperty; var hasNativeMap = typeof Map !== "undefined"; /** * A data structure which is a combination of an array and a set. Adding a new * member is O(1), testing for membership is O(1), and finding the index of an * element is O(1). Removing elements from the set is not supported. Only * strings are supported for membership. */ function ArraySet() { this._array = []; this._set = hasNativeMap ? new Map() : Object.create(null); } /** * Static method for creating ArraySet instances from an existing array. */ ArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) { var set = new ArraySet(); for (var i = 0, len = aArray.length; i < len; i++) { set.add(aArray[i], aAllowDuplicates); } return set; }; /** * Return how many unique items are in this ArraySet. If duplicates have been * added, than those do not count towards the size. * * @returns Number */ ArraySet.prototype.size = function ArraySet_size() { return hasNativeMap ? this._set.size : Object.getOwnPropertyNames(this._set).length; }; /** * Add the given string to this set. * * @param String aStr */ ArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) { var sStr = hasNativeMap ? aStr : util.toSetString(aStr); var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, sStr); var idx = this._array.length; if (!isDuplicate || aAllowDuplicates) { this._array.push(aStr); } if (!isDuplicate) { if (hasNativeMap) { this._set.set(aStr, idx); } else { this._set[sStr] = idx; } } }; /** * Is the given string a member of this set? * * @param String aStr */ ArraySet.prototype.has = function ArraySet_has(aStr) { if (hasNativeMap) { return this._set.has(aStr); } else { var sStr = util.toSetString(aStr); return has.call(this._set, sStr); } }; /** * What is the index of the given string in the array? * * @param String aStr */ ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) { if (hasNativeMap) { var idx = this._set.get(aStr); if (idx >= 0) { return idx; } } else { var sStr = util.toSetString(aStr); if (has.call(this._set, sStr)) { return this._set[sStr]; } } throw new Error('"' + aStr + '" is not in the set.'); }; /** * What is the element at the given index? * * @param Number aIdx */ ArraySet.prototype.at = function ArraySet_at(aIdx) { if (aIdx >= 0 && aIdx < this._array.length) { return this._array[aIdx]; } throw new Error('No element indexed by ' + aIdx); }; /** * Returns the array representation of this set (which has the proper indices * indicated by indexOf). Note that this is a copy of the internal array used * for storing the members so that no one can mess with internal state. */ ArraySet.prototype.toArray = function ArraySet_toArray() { return this._array.slice(); }; exports.I = ArraySet; /***/ }), /***/ 94720: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { /* -*- Mode: js; js-indent-level: 2; -*- */ /* * Copyright 2011 Mozilla Foundation and contributors * Licensed under the New BSD license. See LICENSE or: * http://opensource.org/licenses/BSD-3-Clause * * Based on the Base 64 VLQ implementation in Closure Compiler: * https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java * * Copyright 2011 The Closure Compiler Authors. All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * * Neither the name of Google Inc. nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ var base64 = __webpack_require__(79427); // A single base 64 digit can contain 6 bits of data. For the base 64 variable // length quantities we use in the source map spec, the first bit is the sign, // the next four bits are the actual value, and the 6th bit is the // continuation bit. The continuation bit tells us whether there are more // digits in this value following this digit. // // Continuation // | Sign // | | // V V // 101011 var VLQ_BASE_SHIFT = 5; // binary: 100000 var VLQ_BASE = 1 << VLQ_BASE_SHIFT; // binary: 011111 var VLQ_BASE_MASK = VLQ_BASE - 1; // binary: 100000 var VLQ_CONTINUATION_BIT = VLQ_BASE; /** * Converts from a two-complement value to a value where the sign bit is * placed in the least significant bit. For example, as decimals: * 1 becomes 2 (10 binary), -1 becomes 3 (11 binary) * 2 becomes 4 (100 binary), -2 becomes 5 (101 binary) */ function toVLQSigned(aValue) { return aValue < 0 ? ((-aValue) << 1) + 1 : (aValue << 1) + 0; } /** * Converts to a two-complement value from a value where the sign bit is * placed in the least significant bit. For example, as decimals: * 2 (10 binary) becomes 1, 3 (11 binary) becomes -1 * 4 (100 binary) becomes 2, 5 (101 binary) becomes -2 */ function fromVLQSigned(aValue) { var isNegative = (aValue & 1) === 1; var shifted = aValue >> 1; return isNegative ? -shifted : shifted; } /** * Returns the base 64 VLQ encoded value. */ exports.encode = function base64VLQ_encode(aValue) { var encoded = ""; var digit; var vlq = toVLQSigned(aValue); do { digit = vlq & VLQ_BASE_MASK; vlq >>>= VLQ_BASE_SHIFT; if (vlq > 0) { // There are still more digits in this value, so we must make sure the // continuation bit is marked. digit |= VLQ_CONTINUATION_BIT; } encoded += base64.encode(digit); } while (vlq > 0); return encoded; }; /** * Decodes the next base 64 VLQ value from the given string and returns the * value and the rest of the string via the out parameter. */ exports.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) { var strLen = aStr.length; var result = 0; var shift = 0; var continuation, digit; do { if (aIndex >= strLen) { throw new Error("Expected more digits in base 64 VLQ value."); } digit = base64.decode(aStr.charCodeAt(aIndex++)); if (digit === -1) { throw new Error("Invalid base64 digit: " + aStr.charAt(aIndex - 1)); } continuation = !!(digit & VLQ_CONTINUATION_BIT); digit &= VLQ_BASE_MASK; result = result + (digit << shift); shift += VLQ_BASE_SHIFT; } while (continuation); aOutParam.value = fromVLQSigned(result); aOutParam.rest = aIndex; }; /***/ }), /***/ 79427: /***/ (function(__unused_webpack_module, exports) { /* -*- Mode: js; js-indent-level: 2; -*- */ /* * Copyright 2011 Mozilla Foundation and contributors * Licensed under the New BSD license. See LICENSE or: * http://opensource.org/licenses/BSD-3-Clause */ var intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split(''); /** * Encode an integer in the range of 0 to 63 to a single base 64 digit. */ exports.encode = function (number) { if (0 <= number && number < intToCharMap.length) { return intToCharMap[number]; } throw new TypeError("Must be between 0 and 63: " + number); }; /** * Decode a single base 64 character code digit to an integer. Returns -1 on * failure. */ exports.decode = function (charCode) { var bigA = 65; // 'A' var bigZ = 90; // 'Z' var littleA = 97; // 'a' var littleZ = 122; // 'z' var zero = 48; // '0' var nine = 57; // '9' var plus = 43; // '+' var slash = 47; // '/' var littleOffset = 26; var numberOffset = 52; // 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ if (bigA <= charCode && charCode <= bigZ) { return (charCode - bigA); } // 26 - 51: abcdefghijklmnopqrstuvwxyz if (littleA <= charCode && charCode <= littleZ) { return (charCode - littleA + littleOffset); } // 52 - 61: 0123456789 if (zero <= charCode && charCode <= nine) { return (charCode - zero + numberOffset); } // 62: + if (charCode == plus) { return 62; } // 63: / if (charCode == slash) { return 63; } // Invalid base64 digit. return -1; }; /***/ }), /***/ 50273: /***/ (function(__unused_webpack_module, exports) { /* -*- Mode: js; js-indent-level: 2; -*- */ /* * Copyright 2011 Mozilla Foundation and contributors * Licensed under the New BSD license. See LICENSE or: * http://opensource.org/licenses/BSD-3-Clause */ exports.GREATEST_LOWER_BOUND = 1; exports.LEAST_UPPER_BOUND = 2; /** * Recursive implementation of binary search. * * @param aLow Indices here and lower do not contain the needle. * @param aHigh Indices here and higher do not contain the needle. * @param aNeedle The element being searched for. * @param aHaystack The non-empty array being searched. * @param aCompare Function which takes two elements and returns -1, 0, or 1. * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the * closest element that is smaller than or greater than the one we are * searching for, respectively, if the exact element cannot be found. */ function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) { // This function terminates when one of the following is true: // // 1. We find the exact element we are looking for. // // 2. We did not find the exact element, but we can return the index of // the next-closest element. // // 3. We did not find the exact element, and there is no next-closest // element than the one we are searching for, so we return -1. var mid = Math.floor((aHigh - aLow) / 2) + aLow; var cmp = aCompare(aNeedle, aHaystack[mid], true); if (cmp === 0) { // Found the element we are looking for. return mid; } else if (cmp > 0) { // Our needle is greater than aHaystack[mid]. if (aHigh - mid > 1) { // The element is in the upper half. return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias); } // The exact needle element was not found in this haystack. Determine if // we are in termination case (3) or (2) and return the appropriate thing. if (aBias == exports.LEAST_UPPER_BOUND) { return aHigh < aHaystack.length ? aHigh : -1; } else { return mid; } } else { // Our needle is less than aHaystack[mid]. if (mid - aLow > 1) { // The element is in the lower half. return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias); } // we are in termination case (3) or (2) and return the appropriate thing. if (aBias == exports.LEAST_UPPER_BOUND) { return mid; } else { return aLow < 0 ? -1 : aLow; } } } /** * This is an implementation of binary search which will always try and return * the index of the closest element if there is no exact hit. This is because * mappings between original and generated line/col pairs are single points, * and there is an implicit region between each of them, so a miss just means * that you aren't on the very start of a region. * * @param aNeedle The element you are looking for. * @param aHaystack The array that is being searched. * @param aCompare A function which takes the needle and an element in the * array and returns -1, 0, or 1 depending on whether the needle is less * than, equal to, or greater than the element, respectively. * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the * closest element that is smaller than or greater than the one we are * searching for, respectively, if the exact element cannot be found. * Defaults to 'binarySearch.GREATEST_LOWER_BOUND'. */ exports.search = function search(aNeedle, aHaystack, aCompare, aBias) { if (aHaystack.length === 0) { return -1; } var index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack, aCompare, aBias || exports.GREATEST_LOWER_BOUND); if (index < 0) { return -1; } // We have found either the exact element, or the next-closest element than // the one we are searching for. However, there may be more than one such // element. Make sure we always return the smallest of these. while (index - 1 >= 0) { if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) { break; } --index; } return index; }; /***/ }), /***/ 25823: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { /* -*- Mode: js; js-indent-level: 2; -*- */ /* * Copyright 2014 Mozilla Foundation and contributors * Licensed under the New BSD license. See LICENSE or: * http://opensource.org/licenses/BSD-3-Clause */ var util = __webpack_require__(40755); /** * Determine whether mappingB is after mappingA with respect to generated * position. */ function generatedPositionAfter(mappingA, mappingB) { // Optimized for most common case var lineA = mappingA.generatedLine; var lineB = mappingB.generatedLine; var columnA = mappingA.generatedColumn; var columnB = mappingB.generatedColumn; return lineB > lineA || lineB == lineA && columnB >= columnA || util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0; } /** * A data structure to provide a sorted view of accumulated mappings in a * performance conscious manner. It trades a neglibable overhead in general * case for a large speedup in case of mappings being added in order. */ function MappingList() { this._array = []; this._sorted = true; // Serves as infimum this._last = {generatedLine: -1, generatedColumn: 0}; } /** * Iterate through internal items. This method takes the same arguments that * `Array.prototype.forEach` takes. * * NOTE: The order of the mappings is NOT guaranteed. */ MappingList.prototype.unsortedForEach = function MappingList_forEach(aCallback, aThisArg) { this._array.forEach(aCallback, aThisArg); }; /** * Add the given source mapping. * * @param Object aMapping */ MappingList.prototype.add = function MappingList_add(aMapping) { if (generatedPositionAfter(this._last, aMapping)) { this._last = aMapping; this._array.push(aMapping); } else { this._sorted = false; this._array.push(aMapping); } }; /** * Returns the flat, sorted array of mappings. The mappings are sorted by * generated position. * * WARNING: This method returns internal data without copying, for * performance. The return value must NOT be mutated, and should be treated as * an immutable borrow. If you want to take ownership, you must make your own * copy. */ MappingList.prototype.toArray = function MappingList_toArray() { if (!this._sorted) { this._array.sort(util.compareByGeneratedPositionsInflated); this._sorted = true; } return this._array; }; exports.H = MappingList; /***/ }), /***/ 746: /***/ (function(__unused_webpack_module, exports) { /* -*- Mode: js; js-indent-level: 2; -*- */ /* * Copyright 2011 Mozilla Foundation and contributors * Licensed under the New BSD license. See LICENSE or: * http://opensource.org/licenses/BSD-3-Clause */ // It turns out that some (most?) JavaScript engines don't self-host // `Array.prototype.sort`. This makes sense because C++ will likely remain // faster than JS when doing raw CPU-intensive sorting. However, when using a // custom comparator function, calling back and forth between the VM's C++ and // JIT'd JS is rather slow *and* loses JIT type information, resulting in // worse generated code for the comparator function than would be optimal. In // fact, when sorting with a comparator, these costs outweigh the benefits of // sorting in C++. By using our own JS-implemented Quick Sort (below), we get // a ~3500ms mean speed-up in `bench/bench.html`. /** * Swap the elements indexed by `x` and `y` in the array `ary`. * * @param {Array} ary * The array. * @param {Number} x * The index of the first item. * @param {Number} y * The index of the second item. */ function swap(ary, x, y) { var temp = ary[x]; ary[x] = ary[y]; ary[y] = temp; } /** * Returns a random integer within the range `low .. high` inclusive. * * @param {Number} low * The lower bound on the range. * @param {Number} high * The upper bound on the range. */ function randomIntInRange(low, high) { return Math.round(low + (Math.random() * (high - low))); } /** * The Quick Sort algorithm. * * @param {Array} ary * An array to sort. * @param {function} comparator * Function to use to compare two items. * @param {Number} p * Start index of the array * @param {Number} r * End index of the array */ function doQuickSort(ary, comparator, p, r) { // If our lower bound is less than our upper bound, we (1) partition the // array into two pieces and (2) recurse on each half. If it is not, this is // the empty array and our base case. if (p < r) { // (1) Partitioning. // // The partitioning chooses a pivot between `p` and `r` and moves all // elements that are less than or equal to the pivot to the before it, and // all the elements that are greater than it after it. The effect is that // once partition is done, the pivot is in the exact place it will be when // the array is put in sorted order, and it will not need to be moved // again. This runs in O(n) time. // Always choose a random pivot so that an input array which is reverse // sorted does not cause O(n^2) running time. var pivotIndex = randomIntInRange(p, r); var i = p - 1; swap(ary, pivotIndex, r); var pivot = ary[r]; // Immediately after `j` is incremented in this loop, the following hold // true: // // * Every element in `ary[p .. i]` is less than or equal to the pivot. // // * Every element in `ary[i+1 .. j-1]` is greater than the pivot. for (var j = p; j < r; j++) { if (comparator(ary[j], pivot) <= 0) { i += 1; swap(ary, i, j); } } swap(ary, i + 1, j); var q = i + 1; // (2) Recurse on each half. doQuickSort(ary, comparator, p, q - 1); doQuickSort(ary, comparator, q + 1, r); } } /** * Sort the given array in-place with the given comparator function. * * @param {Array} ary * An array to sort. * @param {function} comparator * Function to use to compare two items. */ exports.U = function (ary, comparator) { doQuickSort(ary, comparator, 0, ary.length - 1); }; /***/ }), /***/ 22445: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { var __webpack_unused_export__; /* -*- Mode: js; js-indent-level: 2; -*- */ /* * Copyright 2011 Mozilla Foundation and contributors * Licensed under the New BSD license. See LICENSE or: * http://opensource.org/licenses/BSD-3-Clause */ var util = __webpack_require__(40755); var binarySearch = __webpack_require__(50273); var ArraySet = __webpack_require__(94209)/* .ArraySet */ .I; var base64VLQ = __webpack_require__(94720); var quickSort = __webpack_require__(746)/* .quickSort */ .U; function SourceMapConsumer(aSourceMap, aSourceMapURL) { var sourceMap = aSourceMap; if (typeof aSourceMap === 'string') { sourceMap = util.parseSourceMapInput(aSourceMap); } return sourceMap.sections != null ? new IndexedSourceMapConsumer(sourceMap, aSourceMapURL) : new BasicSourceMapConsumer(sourceMap, aSourceMapURL); } SourceMapConsumer.fromSourceMap = function(aSourceMap, aSourceMapURL) { return BasicSourceMapConsumer.fromSourceMap(aSourceMap, aSourceMapURL); } /** * The version of the source mapping spec that we are consuming. */ SourceMapConsumer.prototype._version = 3; // `__generatedMappings` and `__originalMappings` are arrays that hold the // parsed mapping coordinates from the source map's "mappings" attribute. They // are lazily instantiated, accessed via the `_generatedMappings` and // `_originalMappings` getters respectively, and we only parse the mappings // and create these arrays once queried for a source location. We jump through // these hoops because there can be many thousands of mappings, and parsing // them is expensive, so we only want to do it if we must. // // Each object in the arrays is of the form: // // { // generatedLine: The line number in the generated code, // generatedColumn: The column number in the generated code, // source: The path to the original source file that generated this // chunk of code, // originalLine: The line number in the original source that // corresponds to this chunk of generated code, // originalColumn: The column number in the original source that // corresponds to this chunk of generated code, // name: The name of the original symbol which generated this chunk of // code. // } // // All properties except for `generatedLine` and `generatedColumn` can be // `null`. // // `_generatedMappings` is ordered by the generated positions. // // `_originalMappings` is ordered by the original positions. SourceMapConsumer.prototype.__generatedMappings = null; Object.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', { configurable: true, enumerable: true, get: function () { if (!this.__generatedMappings) { this._parseMappings(this._mappings, this.sourceRoot); } return this.__generatedMappings; } }); SourceMapConsumer.prototype.__originalMappings = null; Object.defineProperty(SourceMapConsumer.prototype, '_originalMappings', { configurable: true, enumerable: true, get: function () { if (!this.__originalMappings) { this._parseMappings(this._mappings, this.sourceRoot); } return this.__originalMappings; } }); SourceMapConsumer.prototype._charIsMappingSeparator = function SourceMapConsumer_charIsMappingSeparator(aStr, index) { var c = aStr.charAt(index); return c === ";" || c === ","; }; /** * Parse the mappings in a string in to a data structure which we can easily * query (the ordered arrays in the `this.__generatedMappings` and * `this.__originalMappings` properties). */ SourceMapConsumer.prototype._parseMappings = function SourceMapConsumer_parseMappings(aStr, aSourceRoot) { throw new Error("Subclasses must implement _parseMappings"); }; SourceMapConsumer.GENERATED_ORDER = 1; SourceMapConsumer.ORIGINAL_ORDER = 2; SourceMapConsumer.GREATEST_LOWER_BOUND = 1; SourceMapConsumer.LEAST_UPPER_BOUND = 2; /** * Iterate over each mapping between an original source/line/column and a * generated line/column in this source map. * * @param Function aCallback * The function that is called with each mapping. * @param Object aContext * Optional. If specified, this object will be the value of `this` every * time that `aCallback` is called. * @param aOrder * Either `SourceMapConsumer.GENERATED_ORDER` or * `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to * iterate over the mappings sorted by the generated file's line/column * order or the original's source/line/column order, respectively. Defaults to * `SourceMapConsumer.GENERATED_ORDER`. */ SourceMapConsumer.prototype.eachMapping = function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) { var context = aContext || null; var order = aOrder || SourceMapConsumer.GENERATED_ORDER; var mappings; switch (order) { case SourceMapConsumer.GENERATED_ORDER: mappings = this._generatedMappings; break; case SourceMapConsumer.ORIGINAL_ORDER: mappings = this._originalMappings; break; default: throw new Error("Unknown order of iteration."); } var sourceRoot = this.sourceRoot; mappings.map(function (mapping) { var source = mapping.source === null ? null : this._sources.at(mapping.source); source = util.computeSourceURL(sourceRoot, source, this._sourceMapURL); return { source: source, generatedLine: mapping.generatedLine, generatedColumn: mapping.generatedColumn, originalLine: mapping.originalLine, originalColumn: mapping.originalColumn, name: mapping.name === null ? null : this._names.at(mapping.name) }; }, this).forEach(aCallback, context); }; /** * Returns all generated line and column information for the original source, * line, and column provided. If no column is provided, returns all mappings * corresponding to a either the line we are searching for or the next * closest line that has any mappings. Otherwise, returns all mappings * corresponding to the given line and either the column we are searching for * or the next closest column that has any offsets. * * The only argument is an object with the following properties: * * - source: The filename of the original source. * - line: The line number in the original source. The line number is 1-based. * - column: Opt