@jridgewell/trace-mapping
Advanced tools
Comparing version 0.3.11 to 0.3.12
@@ -296,12 +296,2 @@ (function (global, factory) { | ||
const INVALID_ORIGINAL_MAPPING = Object.freeze({ | ||
source: null, | ||
line: null, | ||
column: null, | ||
name: null, | ||
}); | ||
const INVALID_GENERATED_MAPPING = Object.freeze({ | ||
line: null, | ||
column: null, | ||
}); | ||
const LINE_GTR_ZERO = '`line` must be greater than 0 (lines start at line 1)'; | ||
@@ -421,15 +411,10 @@ const COL_GTR_EQ_ZERO = '`column` must be greater than or equal to 0 (columns start at column 0)'; | ||
if (line >= decoded.length) | ||
return INVALID_ORIGINAL_MAPPING; | ||
return OMapping(null, null, null, null); | ||
const segment = traceSegmentInternal(decoded[line], map._decodedMemo, line, column, bias || GREATEST_LOWER_BOUND); | ||
if (segment == null) | ||
return INVALID_ORIGINAL_MAPPING; | ||
return OMapping(null, null, null, null); | ||
if (segment.length == 1) | ||
return INVALID_ORIGINAL_MAPPING; | ||
return OMapping(null, null, null, null); | ||
const { names, resolvedSources } = map; | ||
return { | ||
source: resolvedSources[segment[SOURCES_INDEX]], | ||
line: segment[SOURCE_LINE] + 1, | ||
column: segment[SOURCE_COLUMN], | ||
name: segment.length === 5 ? names[segment[NAMES_INDEX]] : null, | ||
}; | ||
return OMapping(resolvedSources[segment[SOURCES_INDEX]], segment[SOURCE_LINE] + 1, segment[SOURCE_COLUMN], segment.length === 5 ? names[segment[NAMES_INDEX]] : null); | ||
}; | ||
@@ -447,3 +432,3 @@ exports.generatedPositionFor = (map, { source, line, column, bias }) => { | ||
if (sourceIndex === -1) | ||
return INVALID_GENERATED_MAPPING; | ||
return GMapping(null, null); | ||
const generated = (map._bySources || (map._bySources = buildBySources(exports.decodedMappings(map), (map._bySourceMemos = sources.map(memoizedState))))); | ||
@@ -453,10 +438,7 @@ const memos = map._bySourceMemos; | ||
if (segments == null) | ||
return INVALID_GENERATED_MAPPING; | ||
return GMapping(null, null); | ||
const segment = traceSegmentInternal(segments, memos[sourceIndex], line, column, bias || GREATEST_LOWER_BOUND); | ||
if (segment == null) | ||
return INVALID_GENERATED_MAPPING; | ||
return { | ||
line: segment[REV_GENERATED_LINE] + 1, | ||
column: segment[REV_GENERATED_COLUMN], | ||
}; | ||
return GMapping(null, null); | ||
return GMapping(segment[REV_GENERATED_LINE] + 1, segment[REV_GENERATED_COLUMN]); | ||
}; | ||
@@ -533,2 +515,8 @@ exports.eachMapping = (map, cb) => { | ||
})(); | ||
function OMapping(source, line, column, name) { | ||
return { source, line, column, name }; | ||
} | ||
function GMapping(line, column) { | ||
return { line, column }; | ||
} | ||
function traceSegmentInternal(segments, memo, line, column, bias) { | ||
@@ -535,0 +523,0 @@ let index = memoizedBinarySearch(segments, column, memo, line); |
{ | ||
"name": "@jridgewell/trace-mapping", | ||
"version": "0.3.11", | ||
"version": "0.3.12", | ||
"description": "Trace the original position through a source map", | ||
@@ -52,17 +52,17 @@ "keywords": [ | ||
"devDependencies": { | ||
"@rollup/plugin-typescript": "8.3.0", | ||
"@typescript-eslint/eslint-plugin": "5.10.0", | ||
"@typescript-eslint/parser": "5.10.0", | ||
"ava": "4.0.1", | ||
"@rollup/plugin-typescript": "8.3.2", | ||
"@typescript-eslint/eslint-plugin": "5.23.0", | ||
"@typescript-eslint/parser": "5.23.0", | ||
"ava": "4.2.0", | ||
"benchmark": "2.1.4", | ||
"c8": "7.11.0", | ||
"esbuild": "0.14.14", | ||
"esbuild-node-loader": "0.6.4", | ||
"eslint": "8.7.0", | ||
"eslint-config-prettier": "8.3.0", | ||
"c8": "7.11.2", | ||
"esbuild": "0.14.38", | ||
"esbuild-node-loader": "0.8.0", | ||
"eslint": "8.15.0", | ||
"eslint-config-prettier": "8.5.0", | ||
"eslint-plugin-no-only-tests": "2.6.0", | ||
"npm-run-all": "4.1.5", | ||
"prettier": "2.5.1", | ||
"rollup": "2.64.0", | ||
"typescript": "4.5.4" | ||
"prettier": "2.6.2", | ||
"rollup": "2.72.1", | ||
"typescript": "4.6.4" | ||
}, | ||
@@ -69,0 +69,0 @@ "dependencies": { |
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
99931
1267