Socket
Socket
Sign inDemoInstall

@jridgewell/trace-mapping

Package Overview
Dependencies
2
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.3.16 to 0.3.17

30

dist/trace-mapping.umd.js

@@ -300,3 +300,2 @@ (function (global, factory) {

const GREATEST_LOWER_BOUND = 1;
const ALL_BOUND = 0;
/**

@@ -420,7 +419,8 @@ * Returns the encoded (VLQ string) form of the SourceMap's mappings field.

};
exports.allGeneratedPositionsFor = (map, { source, line, column }) => {
return generatedPosition(map, source, line, column, ALL_BOUND);
exports.allGeneratedPositionsFor = (map, { source, line, column, bias }) => {
// SourceMapConsumer uses LEAST_UPPER_BOUND for some reason, so we follow suit.
return generatedPosition(map, source, line, column, bias || LEAST_UPPER_BOUND, true);
};
exports.generatedPositionFor = (map, { source, line, column, bias }) => {
return generatedPosition(map, source, line, column, bias || GREATEST_LOWER_BOUND);
return generatedPosition(map, source, line, column, bias || GREATEST_LOWER_BOUND, false);
};

@@ -478,3 +478,3 @@ exports.eachMapping = (map, cb) => {

};
function generatedPosition(map, source, line, column, bias) {
function generatedPosition(map, source, line, column, bias, all) {
line--;

@@ -490,10 +490,10 @@ if (line < 0)

if (sourceIndex === -1)
return bias === ALL_BOUND ? [] : GMapping(null, null);
return all ? [] : GMapping(null, null);
const generated = (map._bySources || (map._bySources = buildBySources(exports.decodedMappings(map), (map._bySourceMemos = sources.map(memoizedState)))));
const segments = generated[sourceIndex][line];
if (segments == null)
return bias === ALL_BOUND ? [] : GMapping(null, null);
return all ? [] : GMapping(null, null);
const memo = map._bySourceMemos[sourceIndex];
if (bias === ALL_BOUND)
return sliceGeneratedPositions(segments, memo, line, column);
if (all)
return sliceGeneratedPositions(segments, memo, line, column, bias);
const index = traceSegmentInternal(segments, memo, line, column, bias);

@@ -534,5 +534,13 @@ if (index === -1)

}
function sliceGeneratedPositions(segments, memo, line, column) {
function sliceGeneratedPositions(segments, memo, line, column, bias) {
let min = traceSegmentInternal(segments, memo, line, column, GREATEST_LOWER_BOUND);
if (min === -1)
// We ignored the bias when tracing the segment so that we're guarnateed to find the first (in
// insertion order) segment that matched. Even if we did respect the bias when tracing, we would
// still need to call `lowerBound()` to find the first segment, which is slower than just looking
// for the GREATEST_LOWER_BOUND to begin with. The only difference that matters for us is when the
// binary search didn't match, in which case GREATEST_LOWER_BOUND just needs to increment to
// match LEAST_UPPER_BOUND.
if (!found && bias === LEAST_UPPER_BOUND)
min++;
if (min === -1 || min === segments.length)
return [];

@@ -539,0 +547,0 @@ // We may have found the segment that started at an earlier column. If this is the case, then we

{
"name": "@jridgewell/trace-mapping",
"version": "0.3.16",
"version": "0.3.17",
"description": "Trace the original position through a source map",

@@ -5,0 +5,0 @@ "keywords": [

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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