Socket
Socket
Sign inDemoInstall

sourcemap-codec

Package Overview
Dependencies
1
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.3.0 to 1.3.1

dist/sourcemap-codec.es.js

4

CHANGELOG.md
# sourcemap-codec changelog
## 1.3.1
* Update build process, expose `pkg.module`
## 1.3.0

@@ -4,0 +8,0 @@

307

dist/sourcemap-codec.umd.js
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
factory((global.sourcemapCodec = {}));
}(this, function (exports) { 'use strict';
(factory((global.sourcemapCodec = global.sourcemapCodec || {})));
}(this, (function (exports) { 'use strict';
var charToInteger = {};
var integerToChar = {};
var charToInteger = {};
var integerToChar = {};
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='.split( '' ).forEach( function ( char, i ) {
charToInteger[ char ] = i;
integerToChar[ i ] = char;
});
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='.split( '' ).forEach( function ( char, i ) {
charToInteger[ char ] = i;
integerToChar[ i ] = char;
});
function decode$1 ( string ) {
var result = [],
len = string.length,
i,
hasContinuationBit,
shift = 0,
value = 0,
integer,
shouldNegate;
function decode$1 ( string ) {
var result = [],
len = string.length,
i,
hasContinuationBit,
shift = 0,
value = 0,
integer,
shouldNegate;
for ( i = 0; i < len; i += 1 ) {
integer = charToInteger[ string[i] ];
for ( i = 0; i < len; i += 1 ) {
integer = charToInteger[ string[i] ];
if ( integer === undefined ) {
throw new Error( 'Invalid character (' + string[i] + ')' );
}
if ( integer === undefined ) {
throw new Error( 'Invalid character (' + string[i] + ')' );
}
hasContinuationBit = integer & 32;
hasContinuationBit = integer & 32;
integer &= 31;
value += integer << shift;
integer &= 31;
value += integer << shift;
if ( hasContinuationBit ) {
shift += 5;
} else {
shouldNegate = value & 1;
value >>= 1;
if ( hasContinuationBit ) {
shift += 5;
} else {
shouldNegate = value & 1;
value >>= 1;
result.push( shouldNegate ? -value : value );
result.push( shouldNegate ? -value : value );
// reset
value = shift = 0;
}
// reset
value = shift = 0;
}
return result;
}
function encode$1 ( value ) {
var result, i;
return result;
}
if ( typeof value === 'number' ) {
result = encodeInteger( value );
} else {
result = '';
for ( i = 0; i < value.length; i += 1 ) {
result += encodeInteger( value[i] );
}
function encode$1 ( value ) {
var result, i;
if ( typeof value === 'number' ) {
result = encodeInteger( value );
} else {
result = '';
for ( i = 0; i < value.length; i += 1 ) {
result += encodeInteger( value[i] );
}
}
return result;
return result;
}
function encodeInteger ( num ) {
var result = '', clamped;
if ( num < 0 ) {
num = ( -num << 1 ) | 1;
} else {
num <<= 1;
}
function encodeInteger ( num ) {
var result = '', clamped;
do {
clamped = num & 31;
num >>= 5;
if ( num < 0 ) {
num = ( -num << 1 ) | 1;
} else {
num <<= 1;
if ( num > 0 ) {
clamped |= 32;
}
do {
clamped = num & 31;
num >>= 5;
result += integerToChar[ clamped ];
} while ( num > 0 );
if ( num > 0 ) {
clamped |= 32;
}
return result;
}
result += integerToChar[ clamped ];
} while ( num > 0 );
function decodeSegments ( encodedSegments ) {
var i = encodedSegments.length;
var segments = new Array( i );
return result;
}
while ( i-- ) { segments[i] = decode$1( encodedSegments[i] ); }
return segments;
}
function decodeSegments(encodedSegments) {
var i = encodedSegments.length;
var segments = new Array(i);
function decode$$1 ( mappings ) {
var sourceFileIndex = 0; // second field
var sourceCodeLine = 0; // third field
var sourceCodeColumn = 0; // fourth field
var nameIndex = 0; // fifth field
while (i--) {
segments[i] = decode$1(encodedSegments[i]);
}return segments;
}
var lines = mappings.split( ';' );
var numLines = lines.length;
var decoded = new Array( numLines );
function decode(mappings) {
var sourceFileIndex = 0; // second field
var sourceCodeLine = 0; // third field
var sourceCodeColumn = 0; // fourth field
var nameIndex = 0; // fifth field
var i;
var j;
var line;
var generatedCodeColumn;
var decodedLine;
var segments;
var segment;
var result;
var lines = mappings.split(';');
var numLines = lines.length;
var decoded = new Array(numLines);
for ( i = 0; i < numLines; i += 1 ) {
line = lines[i];
var i = undefined;
var j = undefined;
var line = undefined;
var generatedCodeColumn = undefined;
var decodedLine = undefined;
var segments = undefined;
var segment = undefined;
var result = undefined;
generatedCodeColumn = 0; // first field - reset each time
decodedLine = [];
for (i = 0; i < numLines; i += 1) {
line = lines[i];
segments = decodeSegments( line.split( ',' ) );
generatedCodeColumn = 0; // first field - reset each time
decodedLine = [];
for ( j = 0; j < segments.length; j += 1 ) {
segment = segments[j];
segments = decodeSegments(line.split(','));
if ( !segment.length ) {
break;
}
for (j = 0; j < segments.length; j += 1) {
segment = segments[j];
generatedCodeColumn += segment[0];
if (!segment.length) {
break;
}
result = [ generatedCodeColumn ];
decodedLine.push( result );
generatedCodeColumn += segment[0];
if ( segment.length === 1 ) {
// only one field!
continue;
}
result = [generatedCodeColumn];
decodedLine.push(result);
sourceFileIndex += segment[1];
sourceCodeLine += segment[2];
sourceCodeColumn += segment[3];
if (segment.length === 1) {
// only one field!
continue;
}
result.push( sourceFileIndex, sourceCodeLine, sourceCodeColumn );
sourceFileIndex += segment[1];
sourceCodeLine += segment[2];
sourceCodeColumn += segment[3];
result.push(sourceFileIndex, sourceCodeLine, sourceCodeColumn);
if (segment.length === 5) {
nameIndex += segment[4];
result.push(nameIndex);
}
if ( segment.length === 5 ) {
nameIndex += segment[4];
result.push( nameIndex );
}
decoded[i] = decodedLine;
}
return decoded;
decoded[i] = decodedLine;
}
function encode(decoded) {
var offsets = {
generatedCodeColumn: 0,
sourceFileIndex: 0, // second field
sourceCodeLine: 0, // third field
sourceCodeColumn: 0, // fourth field
nameIndex: 0 // fifth field
};
return decoded;
}
return decoded.map(function (line) {
offsets.generatedCodeColumn = 0; // first field - reset each time
return line.map(encodeSegment).join(',');
}).join(';');
function encode$$1 ( decoded ) {
var offsets = {
generatedCodeColumn: 0,
sourceFileIndex: 0, // second field
sourceCodeLine: 0, // third field
sourceCodeColumn: 0, // fourth field
nameIndex: 0 // fifth field
};
function encodeSegment(segment) {
if (!segment.length) {
return segment;
}
return decoded.map( function (line) {
offsets.generatedCodeColumn = 0; // first field - reset each time
return line.map( encodeSegment ).join( ',' );
}).join( ';' );
var result = new Array(segment.length);
function encodeSegment ( segment ) {
if ( !segment.length ) {
return segment;
}
result[0] = segment[0] - offsets.generatedCodeColumn;
offsets.generatedCodeColumn = segment[0];
var result = new Array( segment.length );
if (segment.length === 1) {
// only one field!
return encode$1(result);
}
result[0] = segment[0] - offsets.generatedCodeColumn;
offsets.generatedCodeColumn = segment[0];
result[1] = segment[1] - offsets.sourceFileIndex;
result[2] = segment[2] - offsets.sourceCodeLine;
result[3] = segment[3] - offsets.sourceCodeColumn;
if ( segment.length === 1 ) {
// only one field!
return encode$1( result );
}
offsets.sourceFileIndex = segment[1];
offsets.sourceCodeLine = segment[2];
offsets.sourceCodeColumn = segment[3];
result[1] = segment[1] - offsets.sourceFileIndex;
result[2] = segment[2] - offsets.sourceCodeLine;
result[3] = segment[3] - offsets.sourceCodeColumn;
if (segment.length === 5) {
result[4] = segment[4] - offsets.nameIndex;
offsets.nameIndex = segment[4];
}
offsets.sourceFileIndex = segment[1];
offsets.sourceCodeLine = segment[2];
offsets.sourceCodeColumn = segment[3];
return encode$1(result);
if ( segment.length === 5 ) {
result[4] = segment[4] - offsets.nameIndex;
offsets.nameIndex = segment[4];
}
return encode$1( result );
}
}
exports.decode = decode;
exports.encode = encode;
exports.decode = decode$$1;
exports.encode = encode$$1;
}));
//# sourceMappingURL=sourcemap-codec.umd.js.map
Object.defineProperty(exports, '__esModule', { value: true });
})));
//# sourceMappingURL=sourcemap-codec.umd.js.map
{
"name": "sourcemap-codec",
"version": "1.3.0",
"version": "1.3.1",
"description": "Encode/decode sourcemap mappings",
"main": "dist/sourcemap-codec.umd.js",
"jsnext:main": "dist/sourcemap-codec.es6.js",
"module": "dist/sourcemap-codec.es.js",
"scripts": {
"test": "mocha",
"build": "rm -rf dist && rollup -c -f umd -o dist/sourcemap-codec.umd.js && rollup -c -f es6 -o dist/sourcemap-codec.es6.js",
"build": "rm -rf dist && rollup -c",
"pretest": "npm run build",
"prepublish": "npm test",
"lint": "eslint src",
"pretest-coverage": "npm run build",

@@ -35,12 +36,12 @@ "test-coverage": "rm -rf coverage/* && istanbul cover --report json node_modules/.bin/_mocha -- -u exports -R spec test/test.js",

"devDependencies": {
"babel-preset-es2015-rollup": "^1.0.0",
"codecov.io": "^0.1.6",
"console-group": "^0.1.2",
"eslint": "^1.6.0",
"istanbul": "^0.4.0",
"mocha": "^2.3.3",
"remap-istanbul": "^0.5.1",
"rollup": "^0.21.2",
"rollup-plugin-babel": "^2.2.0",
"rollup-plugin-npm": "^1.1.0"
"console-group": "^0.3.3",
"eslint": "^3.19.0",
"eslint-plugin-import": "^2.2.0",
"istanbul": "^0.4.5",
"mocha": "^3.2.0",
"remap-istanbul": "^0.9.5",
"rollup": "^0.41.6",
"rollup-plugin-buble": "^0.15.0",
"rollup-plugin-node-resolve": "^3.0.0"
},

@@ -47,0 +48,0 @@ "files": [

@@ -5,3 +5,3 @@ import { decode as decodeVlq, encode as encodeVlq } from 'vlq';

let i = encodedSegments.length;
let segments = new Array( i );
const segments = new Array( i );

@@ -18,5 +18,5 @@ while ( i-- ) segments[i] = decodeVlq( encodedSegments[i] );

let lines = mappings.split( ';' );
let numLines = lines.length;
let decoded = new Array( numLines );
const lines = mappings.split( ';' );
const numLines = lines.length;
const decoded = new Array( numLines );

@@ -76,3 +76,3 @@ let i;

export function encode ( decoded ) {
let offsets = {
const offsets = {
generatedCodeColumn: 0,

@@ -95,3 +95,3 @@ sourceFileIndex: 0, // second field

let result = new Array( segment.length );
const result = new Array( segment.length );

@@ -98,0 +98,0 @@ result[0] = segment[0] - offsets.generatedCodeColumn;

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc