first commit

This commit is contained in:
s.golasch
2023-08-01 13:49:46 +02:00
commit 1fc239fd54
20238 changed files with 3112246 additions and 0 deletions

31
build/node_modules/source-list-map/lib/CodeNode.js generated vendored Normal file
View File

@@ -0,0 +1,31 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
var getNumberOfLines = require("./helpers").getNumberOfLines;
function CodeNode(generatedCode) {
this.generatedCode = generatedCode;
}
module.exports = CodeNode;
CodeNode.prototype.clone = function() {
return new CodeNode(this.generatedCode);
}
CodeNode.prototype.getGeneratedCode = function() {
return this.generatedCode;
};
CodeNode.prototype.getMappings = function(mappingsContext) {
var lines = getNumberOfLines(this.generatedCode);
return Array(lines+1).join(";");
};
CodeNode.prototype.addGeneratedCode = function(generatedCode) {
this.generatedCode += generatedCode;
};
CodeNode.prototype.mapGeneratedCode = function(fn) {
this.generatedCode = fn(this.generatedCode);
};

View File

@@ -0,0 +1,24 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
function MappingsContext() {
this.sources = [];
this.sourcesContent = [];
this.hasSourceContent = false;
this.currentOriginalLine = 1;
this.currentSource = 0;
}
module.exports = MappingsContext;
MappingsContext.prototype.ensureSource = function(source, originalSource) {
var idx = this.sources.indexOf(source);
if(idx >= 0)
return idx;
idx = this.sources.length;
this.sources.push(source);
this.sourcesContent.push(originalSource);
if(typeof originalSource === "string")
this.hasSourceContent = true;
return idx;
};

View File

@@ -0,0 +1,90 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
var CodeNode = require("./CodeNode");
var SourceNode = require("./SourceNode");
var MappingsContext = require("./MappingsContext");
function SourceListMap(generatedCode, source, originalSource) {
if(Array.isArray(generatedCode)) {
this.children = generatedCode;
} else {
this.children = [];
if(generatedCode || source)
this.add(generatedCode, source, originalSource);
}
}
module.exports = SourceListMap;
SourceListMap.prototype.add = function(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].addGeneratedCode) {
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.prototype.add: Expected string, Node or SourceListMap");
}
};
SourceListMap.prototype.preprend = function(source) {
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.prototype.prerend: Expected string, Node or SourceListMap");
}
};
SourceListMap.prototype.mapGeneratedCode = function(fn) {
this.children.forEach(function(sln) {
sln.mapGeneratedCode(fn);
});
};
SourceListMap.prototype.toString = function() {
return this.children.map(function(sln) {
return sln.getGeneratedCode();
}).join("");
};
SourceListMap.prototype.toStringWithSourceMap = function(options) {
var mappingsContext = new MappingsContext();
var source = this.children.map(function(sln) {
return sln.generatedCode;
}).join("");
var mappings = this.children.map(function(sln) {
return sln.getMappings(mappingsContext);
}).join("");
return {
source: source,
map: {
version: 3,
file: options && options.file,
sources: mappingsContext.sources,
sourcesContent: mappingsContext.hasSourceContent ? mappingsContext.sourcesContent : undefined,
mappings: mappings
}
};
}

48
build/node_modules/source-list-map/lib/SourceNode.js generated vendored Normal file
View File

@@ -0,0 +1,48 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
var base64VLQ = require("./base64-vlq");
var getNumberOfLines = require("./helpers").getNumberOfLines;
function SourceNode(generatedCode, source, originalSource, startingLine) {
this.generatedCode = generatedCode;
this.originalSource = originalSource;
this.source = source;
this.startingLine = startingLine || 1;
}
module.exports = SourceNode;
SourceNode.prototype.clone = function() {
return new SourceNode(this.generatedCode, this.source, this.originalSource, this.startingLine);
}
var LINE_MAPPING = "AACA;";
var LAST_LINE_MAPPING = "AACA";
SourceNode.prototype.getGeneratedCode = function() {
return this.generatedCode;
};
SourceNode.prototype.getMappings = function(mappingsContext) {
var lines = getNumberOfLines(this.generatedCode);
var sourceIdx = mappingsContext.ensureSource(this.source, this.originalSource);
var mappings = "A"; // generated column 0
mappings += base64VLQ.encode(sourceIdx - mappingsContext.currentSource); // source index
mappings += base64VLQ.encode(this.startingLine - mappingsContext.currentOriginalLine); // original line index
mappings += "A"; // original column 0
if(lines !== 0)
mappings += ";"
mappingsContext.currentSource = sourceIdx;
mappingsContext.currentOriginalLine = (lines || 1) + this.startingLine - 1;
mappings += Array(lines).join(LINE_MAPPING);
if(lines !== 0 && this.generatedCode[this.generatedCode.length - 1] !== "\n") {
mappings += LAST_LINE_MAPPING;
mappingsContext.currentOriginalLine++;
}
return mappings;
};
SourceNode.prototype.mapGeneratedCode = function(fn) {
this.generatedCode = fn(this.generatedCode);
};

169
build/node_modules/source-list-map/lib/base64-vlq.js generated vendored Normal file
View File

@@ -0,0 +1,169 @@
/* -*- 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);
};

View File

@@ -0,0 +1,99 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
var base64VLQ = require("./base64-vlq");
var SourceNode = require("./SourceNode");
var CodeNode = require("./CodeNode");
var SourceListMap = require("./SourceListMap");
module.exports = function fromStringWithSourceMap(code, map) {
var sources = map.sources;
var sourcesContent = map.sourcesContent;
var mappings = map.mappings.split(";");
var lines = code.split("\n");
var nodes = [];
var currentNode = null;
var currentLine = 1;
var currentSourceIdx = 0;
var currentSourceNodeLine;
mappings.forEach(function(mapping, idx) {
var 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 };
var lineAdded = false;
while(mapping.rest)
lineAdded = processMapping(mapping, line, lineAdded) || lineAdded;
if(!lineAdded)
addCode(line);
});
if(mappings.length < lines.length) {
var 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);
var sourceIdx = mapping.value + currentSourceIdx;
currentSourceIdx = sourceIdx;
if(mapping.rest && mapping.rest[0] !== ",") {
base64VLQ.decode(mapping.rest, mapping);
var linePosition = mapping.value + currentLine;
currentLine = linePosition;
} else {
var linePosition = currentLine;
}
if(mapping.rest) {
var 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;
}
}
function addCode(generatedCode) {
if(currentNode && currentNode instanceof CodeNode) {
currentNode.addGeneratedCode(generatedCode);
} else if(currentNode && currentNode instanceof SourceNode && !generatedCode.trim()) {
currentNode.generatedCode += 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.generatedCode += generatedCode;
currentSourceNodeLine++;
} else {
currentNode = new SourceNode(generatedCode, source, originalSource, linePosition);
currentSourceNodeLine = linePosition + 1;
nodes.push(currentNode);
}
}
};

13
build/node_modules/source-list-map/lib/helpers.js generated vendored Normal file
View File

@@ -0,0 +1,13 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
exports.getNumberOfLines = function getNumberOfLines(str) {
var nr = -1;
var idx = -1;
do {
nr++
idx = str.indexOf("\n", idx + 1);
} while(idx >= 0);
return nr;
};

5
build/node_modules/source-list-map/lib/index.js generated vendored Normal file
View File

@@ -0,0 +1,5 @@
exports.SourceListMap = require("./SourceListMap");
exports.SourceNode = require("./SourceNode");
exports.CodeNode = require("./CodeNode");
exports.MappingsContext = require("./MappingsContext");
exports.fromStringWithSourceMap = require("./fromStringWithSourceMap");