yeet
This commit is contained in:
29
node_modules/vlq/CHANGELOG.md
generated
vendored
Normal file
29
node_modules/vlq/CHANGELOG.md
generated
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
# changelog
|
||||
|
||||
## 1.0.1
|
||||
|
||||
* Handle overflow cases ([#9](https://github.com/Rich-Harris/vlq/pull/9))
|
||||
|
||||
## 1.0.0
|
||||
|
||||
* Rewrite in TypeScript, include definitions in package ([#6](https://github.com/Rich-Harris/vlq/pull/6))
|
||||
|
||||
## 0.2.3
|
||||
|
||||
* Add LICENSE to npm package
|
||||
|
||||
## 0.2.2
|
||||
|
||||
* Expose `pkg.module`, not `jsnext:main`
|
||||
|
||||
## 0.2.1
|
||||
|
||||
* Performance boost - vlq no longer checks that you've passed a number or an array into `vlq.encode()`, making it significantly faster
|
||||
|
||||
## 0.2.0
|
||||
|
||||
* Author as ES6 module, accessible to ES6-aware systems via the `jsnext:main` field in `package.json`
|
||||
|
||||
## 0.1.0
|
||||
|
||||
* First release
|
7
node_modules/vlq/LICENSE
generated
vendored
Normal file
7
node_modules/vlq/LICENSE
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
Copyright (c) 2017 [these people](https://github.com/Rich-Harris/vlq/graphs/contributors)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
77
node_modules/vlq/README.md
generated
vendored
Normal file
77
node_modules/vlq/README.md
generated
vendored
Normal file
@ -0,0 +1,77 @@
|
||||
# vlq.js
|
||||
|
||||
Convert integers to a Base64-encoded VLQ string, and vice versa. No dependencies, works in node.js or browsers, supports AMD.
|
||||
|
||||
|
||||
## Why would you want to do that?
|
||||
|
||||
Sourcemaps are the most likely use case. Mappings from original source to generated content are encoded as a sequence of VLQ strings.
|
||||
|
||||
|
||||
## What is a VLQ string?
|
||||
|
||||
A [variable-length quantity](http://en.wikipedia.org/wiki/Variable-length_quantity) is a compact way of encoding large integers in text (i.e. in situations where you can't transmit raw binary data). An integer represented as digits will always take up more space than the equivalent VLQ representation:
|
||||
|
||||
| Integer | VLQ |
|
||||
| :------------------ | :--------- |
|
||||
| 0 | A |
|
||||
| 1 | C |
|
||||
| -1 | D |
|
||||
| 123 | 2H |
|
||||
| 123456789 | qxmvrH |
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
npm install vlq
|
||||
```
|
||||
|
||||
...or...
|
||||
|
||||
```bash
|
||||
bower install vlq
|
||||
```
|
||||
|
||||
...or grab the vlq.js file and include it with a `<script src='vlq.js'>` tag.
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
### Encoding
|
||||
|
||||
`vlq.encode` accepts an integer, or an array of integers, and returns a string:
|
||||
|
||||
```js
|
||||
vlq.encode( 123 ); // '2H';
|
||||
vlq.encode([ 123, 456, 789 ]); // '2HwcqxB'
|
||||
```
|
||||
|
||||
### Decoding
|
||||
|
||||
`vlq.decode` accepts a string and always returns an array:
|
||||
|
||||
```js
|
||||
vlq.decode( '2H' ); // [ 123 ]
|
||||
vlq.decode( '2HwcqxB' ); // [ 123, 456, 789 ]
|
||||
```
|
||||
|
||||
|
||||
## Limitations
|
||||
|
||||
Since JavaScript bitwise operators work on 32 bit integers, the maximum value this library can handle is 2^30 - 1, or 1073741823.
|
||||
|
||||
|
||||
## Using vlq.js with sourcemaps
|
||||
|
||||
[See here for an example of using vlq.js with sourcemaps.](https://github.com/Rich-Harris/vlq/tree/master/sourcemaps)
|
||||
|
||||
|
||||
## Credits
|
||||
|
||||
Adapted from [murzwin.com/base64vlq.html](http://murzwin.com/base64vlq.html) by Alexander Pavlov.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE).
|
2
node_modules/vlq/dist/types/vlq.d.ts
generated
vendored
Normal file
2
node_modules/vlq/dist/types/vlq.d.ts
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
export declare function decode(string: string): number[];
|
||||
export declare function encode(value: number | number[]): string;
|
71
node_modules/vlq/dist/vlq.es.js
generated
vendored
Normal file
71
node_modules/vlq/dist/vlq.es.js
generated
vendored
Normal file
@ -0,0 +1,71 @@
|
||||
var charToInteger = {};
|
||||
var integerToChar = {};
|
||||
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='
|
||||
.split('')
|
||||
.forEach(function (char, i) {
|
||||
charToInteger[char] = i;
|
||||
integerToChar[i] = char;
|
||||
});
|
||||
function decode(string) {
|
||||
var result = [];
|
||||
var shift = 0;
|
||||
var value = 0;
|
||||
for (var i = 0; i < string.length; i += 1) {
|
||||
var integer = charToInteger[string[i]];
|
||||
if (integer === undefined) {
|
||||
throw new Error('Invalid character (' + string[i] + ')');
|
||||
}
|
||||
var hasContinuationBit = integer & 32;
|
||||
integer &= 31;
|
||||
value += integer << shift;
|
||||
if (hasContinuationBit) {
|
||||
shift += 5;
|
||||
}
|
||||
else {
|
||||
var shouldNegate = value & 1;
|
||||
value >>>= 1;
|
||||
if (shouldNegate) {
|
||||
result.push(value === 0 ? -0x80000000 : -value);
|
||||
}
|
||||
else {
|
||||
result.push(value);
|
||||
}
|
||||
// reset
|
||||
value = shift = 0;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function encode(value) {
|
||||
var result;
|
||||
if (typeof value === 'number') {
|
||||
result = encodeInteger(value);
|
||||
}
|
||||
else {
|
||||
result = '';
|
||||
for (var i = 0; i < value.length; i += 1) {
|
||||
result += encodeInteger(value[i]);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function encodeInteger(num) {
|
||||
var result = '';
|
||||
if (num < 0) {
|
||||
num = (-num << 1) | 1;
|
||||
}
|
||||
else {
|
||||
num <<= 1;
|
||||
}
|
||||
do {
|
||||
var clamped = num & 31;
|
||||
num >>>= 5;
|
||||
if (num > 0) {
|
||||
clamped |= 32;
|
||||
}
|
||||
result += integerToChar[clamped];
|
||||
} while (num > 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
export { decode, encode };
|
82
node_modules/vlq/dist/vlq.js
generated
vendored
Normal file
82
node_modules/vlq/dist/vlq.js
generated
vendored
Normal file
@ -0,0 +1,82 @@
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
||||
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
||||
(global = global || self, factory(global.vlq = {}));
|
||||
}(this, function (exports) { 'use strict';
|
||||
|
||||
var charToInteger = {};
|
||||
var integerToChar = {};
|
||||
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='
|
||||
.split('')
|
||||
.forEach(function (char, i) {
|
||||
charToInteger[char] = i;
|
||||
integerToChar[i] = char;
|
||||
});
|
||||
function decode(string) {
|
||||
var result = [];
|
||||
var shift = 0;
|
||||
var value = 0;
|
||||
for (var i = 0; i < string.length; i += 1) {
|
||||
var integer = charToInteger[string[i]];
|
||||
if (integer === undefined) {
|
||||
throw new Error('Invalid character (' + string[i] + ')');
|
||||
}
|
||||
var hasContinuationBit = integer & 32;
|
||||
integer &= 31;
|
||||
value += integer << shift;
|
||||
if (hasContinuationBit) {
|
||||
shift += 5;
|
||||
}
|
||||
else {
|
||||
var shouldNegate = value & 1;
|
||||
value >>>= 1;
|
||||
if (shouldNegate) {
|
||||
result.push(value === 0 ? -0x80000000 : -value);
|
||||
}
|
||||
else {
|
||||
result.push(value);
|
||||
}
|
||||
// reset
|
||||
value = shift = 0;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function encode(value) {
|
||||
var result;
|
||||
if (typeof value === 'number') {
|
||||
result = encodeInteger(value);
|
||||
}
|
||||
else {
|
||||
result = '';
|
||||
for (var i = 0; i < value.length; i += 1) {
|
||||
result += encodeInteger(value[i]);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function encodeInteger(num) {
|
||||
var result = '';
|
||||
if (num < 0) {
|
||||
num = (-num << 1) | 1;
|
||||
}
|
||||
else {
|
||||
num <<= 1;
|
||||
}
|
||||
do {
|
||||
var clamped = num & 31;
|
||||
num >>>= 5;
|
||||
if (num > 0) {
|
||||
clamped |= 32;
|
||||
}
|
||||
result += integerToChar[clamped];
|
||||
} while (num > 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
exports.decode = decode;
|
||||
exports.encode = encode;
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
}));
|
30
node_modules/vlq/package.json
generated
vendored
Normal file
30
node_modules/vlq/package.json
generated
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
{
|
||||
"name": "vlq",
|
||||
"description": "Generate, and decode, base64 VLQ mappings for source maps and other uses",
|
||||
"author": "Rich Harris",
|
||||
"repository": "https://github.com/Rich-Harris/vlq",
|
||||
"license": "MIT",
|
||||
"version": "1.0.1",
|
||||
"main": "dist/vlq.js",
|
||||
"module": "dist/vlq.es.js",
|
||||
"types": "dist/types/vlq.d.ts",
|
||||
"files": [
|
||||
"README.md",
|
||||
"LICENSE",
|
||||
"dist/*.js",
|
||||
"dist/**/*.d.ts"
|
||||
],
|
||||
"devDependencies": {
|
||||
"eslint": "^6.0.1",
|
||||
"rollup": "^1.16.4",
|
||||
"rollup-plugin-typescript": "^1.0.1",
|
||||
"typescript": "^3.5.2"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "rollup -c && tsc",
|
||||
"lint": "eslint src",
|
||||
"test": "node test",
|
||||
"pretest": "npm run build",
|
||||
"prepublish": "npm test"
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user