From e29b244aeab08ea36fb385c7beb2ad0560217039 Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Sun, 13 Oct 2024 10:37:19 +0800 Subject: =?UTF-8?q?bump:=20@babel/cli=207.25.6=20=E2=86=92=207.25.7,=20@ba?= =?UTF-8?q?bel/core=207.25.2=20=E2=86=92=207.25.8,=20@babel/preset-env=207?= =?UTF-8?q?.25.4=20=E2=86=92=207.25.8,=20postcss=208.4.41=20=E2=86=92=208.?= =?UTF-8?q?4.47,=20swup=204.7.0=20=E2=86=92=204.8.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- node_modules/source-map/lib/base64-vlq.js | 51 ++++++++++++++++++++++++------- 1 file changed, 40 insertions(+), 11 deletions(-) (limited to 'node_modules/source-map/lib/base64-vlq.js') diff --git a/node_modules/source-map/lib/base64-vlq.js b/node_modules/source-map/lib/base64-vlq.js index fc1049c8..612b4040 100644 --- a/node_modules/source-map/lib/base64-vlq.js +++ b/node_modules/source-map/lib/base64-vlq.js @@ -35,7 +35,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -const base64 = require("./base64"); +var base64 = require('./base64'); // 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, @@ -49,16 +49,16 @@ const base64 = require("./base64"); // V V // 101011 -const VLQ_BASE_SHIFT = 5; +var VLQ_BASE_SHIFT = 5; // binary: 100000 -const VLQ_BASE = 1 << VLQ_BASE_SHIFT; +var VLQ_BASE = 1 << VLQ_BASE_SHIFT; // binary: 011111 -const VLQ_BASE_MASK = VLQ_BASE - 1; +var VLQ_BASE_MASK = VLQ_BASE - 1; // binary: 100000 -const VLQ_CONTINUATION_BIT = VLQ_BASE; +var VLQ_CONTINUATION_BIT = VLQ_BASE; /** * Converts from a two-complement value to a value where the sign bit is @@ -78,10 +78,9 @@ function toVLQSigned(aValue) { * 2 (10 binary) becomes 1, 3 (11 binary) becomes -1 * 4 (100 binary) becomes 2, 5 (101 binary) becomes -2 */ -// eslint-disable-next-line no-unused-vars function fromVLQSigned(aValue) { - const isNegative = (aValue & 1) === 1; - const shifted = aValue >> 1; + var isNegative = (aValue & 1) === 1; + var shifted = aValue >> 1; return isNegative ? -shifted : shifted; @@ -91,10 +90,10 @@ function fromVLQSigned(aValue) { * Returns the base 64 VLQ encoded value. */ exports.encode = function base64VLQ_encode(aValue) { - let encoded = ""; - let digit; + var encoded = ""; + var digit; - let vlq = toVLQSigned(aValue); + var vlq = toVLQSigned(aValue); do { digit = vlq & VLQ_BASE_MASK; @@ -109,3 +108,33 @@ exports.encode = function base64VLQ_encode(aValue) { 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; +}; -- cgit v1.2.3