Template Upload
This commit is contained in:
17
node_modules/vlq/CHANGELOG.md
generated
vendored
Normal file
17
node_modules/vlq/CHANGELOG.md
generated
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
# changelog
|
||||
|
||||
## 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
|
73
node_modules/vlq/README.md
generated
vendored
Normal file
73
node_modules/vlq/README.md
generated
vendored
Normal file
@ -0,0 +1,73 @@
|
||||
# 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 |
|
||||
| 123456789123456789 | gxvh6sB |
|
||||
|
||||
|
||||
## 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 ]
|
||||
```
|
||||
|
||||
|
||||
## 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.
|
91
node_modules/vlq/dist/vlq.js
generated
vendored
Normal file
91
node_modules/vlq/dist/vlq.js
generated
vendored
Normal file
@ -0,0 +1,91 @@
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
||||
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
||||
(factory((global.vlq = 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;
|
||||
|
||||
result.push( shouldNegate ? -value : 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 });
|
||||
|
||||
})));
|
87
node_modules/vlq/package.json
generated
vendored
Normal file
87
node_modules/vlq/package.json
generated
vendored
Normal file
@ -0,0 +1,87 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"vlq@^0.2.1",
|
||||
"C:\\Users\\x2mjbyrn\\Source\\Repos\\Skeleton\\node_modules\\magic-string"
|
||||
]
|
||||
],
|
||||
"_from": "vlq@>=0.2.1-0 <0.3.0-0",
|
||||
"_id": "vlq@0.2.2",
|
||||
"_inCache": true,
|
||||
"_location": "/vlq",
|
||||
"_nodeVersion": "7.8.0",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-18-east.internal.npmjs.com",
|
||||
"tmp": "tmp/vlq-0.2.2.tgz_1492045338584_0.668944044271484"
|
||||
},
|
||||
"_npmUser": {
|
||||
"email": "richard.a.harris@gmail.com",
|
||||
"name": "rich_harris"
|
||||
},
|
||||
"_npmVersion": "4.2.0",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "vlq",
|
||||
"raw": "vlq@^0.2.1",
|
||||
"rawSpec": "^0.2.1",
|
||||
"scope": null,
|
||||
"spec": ">=0.2.1-0 <0.3.0-0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/magic-string"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/vlq/-/vlq-0.2.2.tgz",
|
||||
"_shasum": "e316d5257b40b86bb43cb8d5fea5d7f54d6b0ca1",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "vlq@^0.2.1",
|
||||
"_where": "C:\\Users\\x2mjbyrn\\Source\\Repos\\Skeleton\\node_modules\\magic-string",
|
||||
"author": {
|
||||
"name": "Rich Harris"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/Rich-Harris/vlq/issues"
|
||||
},
|
||||
"dependencies": {},
|
||||
"description": "Generate, and decode, base64 VLQ mappings for source maps and other uses",
|
||||
"devDependencies": {
|
||||
"eslint": "^3.19.0",
|
||||
"rollup": "^0.41.6"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "e316d5257b40b86bb43cb8d5fea5d7f54d6b0ca1",
|
||||
"tarball": "https://registry.npmjs.org/vlq/-/vlq-0.2.2.tgz"
|
||||
},
|
||||
"files": [
|
||||
"README.md",
|
||||
"dist/vlq.js",
|
||||
"src/vlq.js"
|
||||
],
|
||||
"gitHead": "a208af958037eeea3b0978b1a353c77e837a4ac8",
|
||||
"homepage": "https://github.com/Rich-Harris/vlq#readme",
|
||||
"installable": true,
|
||||
"license": "MIT",
|
||||
"main": "dist/vlq.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "rich_harris",
|
||||
"email": "richard.a.harris@gmail.com"
|
||||
}
|
||||
],
|
||||
"module": "src/vlq.js",
|
||||
"name": "vlq",
|
||||
"optionalDependencies": {},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/Rich-Harris/vlq.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "rollup src/vlq.js -n vlq -f umd > dist/vlq.js",
|
||||
"lint": "eslint src",
|
||||
"prepublish": "npm test",
|
||||
"pretest": "npm run build",
|
||||
"test": "node test"
|
||||
},
|
||||
"version": "0.2.2"
|
||||
}
|
78
node_modules/vlq/src/vlq.js
generated
vendored
Normal file
78
node_modules/vlq/src/vlq.js
generated
vendored
Normal file
@ -0,0 +1,78 @@
|
||||
var charToInteger = {};
|
||||
var integerToChar = {};
|
||||
|
||||
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='.split( '' ).forEach( function ( char, i ) {
|
||||
charToInteger[ char ] = i;
|
||||
integerToChar[ i ] = char;
|
||||
});
|
||||
|
||||
export 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;
|
||||
|
||||
result.push( shouldNegate ? -value : value );
|
||||
|
||||
// reset
|
||||
value = shift = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
export 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;
|
||||
}
|
Reference in New Issue
Block a user