diff options
author | 2020-11-18 23:26:45 +0100 | |
---|---|---|
committer | 2020-11-18 23:26:45 +0100 | |
commit | 81ddf9b700bc48a1f8e472209f080f9c1d9a9b09 (patch) | |
tree | 8b959d50c5a614cbf9fcb346ed556140374d4b6d /node_modules/source-list-map/lib | |
parent | 1870f3fdf43707a15fda0f609a021f516f45eb63 (diff) | |
download | website_creator-81ddf9b700bc48a1f8e472209f080f9c1d9a9b09.tar.gz website_creator-81ddf9b700bc48a1f8e472209f080f9c1d9a9b09.tar.bz2 website_creator-81ddf9b700bc48a1f8e472209f080f9c1d9a9b09.zip |
rm node_modules
Diffstat (limited to 'node_modules/source-list-map/lib')
-rw-r--r-- | node_modules/source-list-map/lib/CodeNode.js | 66 | ||||
-rw-r--r-- | node_modules/source-list-map/lib/MappingsContext.js | 45 | ||||
-rw-r--r-- | node_modules/source-list-map/lib/SingleLineNode.js | 93 | ||||
-rw-r--r-- | node_modules/source-list-map/lib/SourceListMap.js | 117 | ||||
-rw-r--r-- | node_modules/source-list-map/lib/SourceNode.js | 129 | ||||
-rw-r--r-- | node_modules/source-list-map/lib/base64-vlq.js | 169 | ||||
-rw-r--r-- | node_modules/source-list-map/lib/fromStringWithSourceMap.js | 102 | ||||
-rw-r--r-- | node_modules/source-list-map/lib/helpers.js | 23 | ||||
-rw-r--r-- | node_modules/source-list-map/lib/index.js | 6 |
9 files changed, 0 insertions, 750 deletions
diff --git a/node_modules/source-list-map/lib/CodeNode.js b/node_modules/source-list-map/lib/CodeNode.js deleted file mode 100644 index 2013363..0000000 --- a/node_modules/source-list-map/lib/CodeNode.js +++ /dev/null @@ -1,66 +0,0 @@ -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ -"use strict"; - -const getNumberOfLines = require("./helpers").getNumberOfLines; -const getUnfinishedLine = require("./helpers").getUnfinishedLine; - -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; diff --git a/node_modules/source-list-map/lib/MappingsContext.js b/node_modules/source-list-map/lib/MappingsContext.js deleted file mode 100644 index 9a0c905..0000000 --- a/node_modules/source-list-map/lib/MappingsContext.js +++ /dev/null @@ -1,45 +0,0 @@ -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ -"use strict"; - -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; diff --git a/node_modules/source-list-map/lib/SingleLineNode.js b/node_modules/source-list-map/lib/SingleLineNode.js deleted file mode 100644 index bbc1b5d..0000000 --- a/node_modules/source-list-map/lib/SingleLineNode.js +++ /dev/null @@ -1,93 +0,0 @@ -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ -"use strict"; - -const base64VLQ = require("./base64-vlq"); -const getNumberOfLines = require("./helpers").getNumberOfLines; -const getUnfinishedLine = require("./helpers").getUnfinishedLine; - -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 = require("./SourceNode"); // circular dependency diff --git a/node_modules/source-list-map/lib/SourceListMap.js b/node_modules/source-list-map/lib/SourceListMap.js deleted file mode 100644 index 575b2d7..0000000 --- a/node_modules/source-list-map/lib/SourceListMap.js +++ /dev/null @@ -1,117 +0,0 @@ -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ -"use strict"; - -const CodeNode = require("./CodeNode"); -const SourceNode = require("./SourceNode"); -const MappingsContext = require("./MappingsContext"); -const getNumberOfLines = require("./helpers").getNumberOfLines; - -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; diff --git a/node_modules/source-list-map/lib/SourceNode.js b/node_modules/source-list-map/lib/SourceNode.js deleted file mode 100644 index 7dd235e..0000000 --- a/node_modules/source-list-map/lib/SourceNode.js +++ /dev/null @@ -1,129 +0,0 @@ -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ -"use strict"; - -const base64VLQ = require("./base64-vlq"); -const getNumberOfLines = require("./helpers").getNumberOfLines; -const getUnfinishedLine = require("./helpers").getUnfinishedLine; - -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 = require("./SingleLineNode"); // circular dependency diff --git a/node_modules/source-list-map/lib/base64-vlq.js b/node_modules/source-list-map/lib/base64-vlq.js deleted file mode 100644 index 4483a50..0000000 --- a/node_modules/source-list-map/lib/base64-vlq.js +++ /dev/null @@ -1,169 +0,0 @@ -/* -*- 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); -}; diff --git a/node_modules/source-list-map/lib/fromStringWithSourceMap.js b/node_modules/source-list-map/lib/fromStringWithSourceMap.js deleted file mode 100644 index 0148d7e..0000000 --- a/node_modules/source-list-map/lib/fromStringWithSourceMap.js +++ /dev/null @@ -1,102 +0,0 @@ -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ -"use strict"; - -const base64VLQ = require("./base64-vlq"); -const SourceNode = require("./SourceNode"); -const CodeNode = require("./CodeNode"); -const SourceListMap = require("./SourceListMap"); - -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; - } - } -}; diff --git a/node_modules/source-list-map/lib/helpers.js b/node_modules/source-list-map/lib/helpers.js deleted file mode 100644 index d0b4292..0000000 --- a/node_modules/source-list-map/lib/helpers.js +++ /dev/null @@ -1,23 +0,0 @@ -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ -"use strict"; - -exports.getNumberOfLines = function getNumberOfLines(str) { - let nr = -1; - let idx = -1; - do { - nr++ - idx = str.indexOf("\n", idx + 1); - } while(idx >= 0); - return nr; -}; - -exports.getUnfinishedLine = function getUnfinishedLine(str) { - const idx = str.lastIndexOf("\n"); - if(idx === -1) - return str.length; - else - return str.length - idx - 1; -}; diff --git a/node_modules/source-list-map/lib/index.js b/node_modules/source-list-map/lib/index.js deleted file mode 100644 index c1ad107..0000000 --- a/node_modules/source-list-map/lib/index.js +++ /dev/null @@ -1,6 +0,0 @@ -exports.SourceListMap = require("./SourceListMap"); -exports.SourceNode = require("./SourceNode"); -exports.SingleLineNode = require("./SingleLineNode"); -exports.CodeNode = require("./CodeNode"); -exports.MappingsContext = require("./MappingsContext"); -exports.fromStringWithSourceMap = require("./fromStringWithSourceMap"); |