metro-source-map
Advanced tools
Comparing version 0.64.0 to 0.65.0
{ | ||
"name": "metro-source-map", | ||
"version": "0.64.0", | ||
"version": "0.65.0", | ||
"description": "🚇 Source map generator for Metro.", | ||
@@ -18,5 +18,5 @@ "main": "src/source-map.js", | ||
"invariant": "^2.2.4", | ||
"metro-symbolicate": "0.64.0", | ||
"metro-symbolicate": "0.65.0", | ||
"nullthrows": "^1.1.1", | ||
"ob1": "0.64.0", | ||
"ob1": "0.65.0", | ||
"source-map": "^0.5.6", | ||
@@ -23,0 +23,0 @@ "vlq": "^1.0.0" |
@@ -101,3 +101,3 @@ /** | ||
_realloc() { | ||
const buffer = this.buffer; | ||
const { buffer } = this; | ||
this.buffer = Buffer.alloc(buffer.length * 2); | ||
@@ -104,0 +104,0 @@ buffer.copy(this.buffer); |
@@ -66,5 +66,3 @@ /** | ||
const _measureString = measureString(code), | ||
lineBreaks = _measureString.lineBreaks, | ||
lastLineColumns = _measureString.lastLineColumns; | ||
const { lineBreaks, lastLineColumns } = measureString(code); | ||
@@ -71,0 +69,0 @@ if (map) { |
@@ -16,5 +16,5 @@ /** | ||
const _require = require("source-map"), | ||
SourceMapGenerator = _require.SourceMapGenerator; // Originally based on https://github.com/jakobwesthoff/source-map-merger | ||
const { SourceMapGenerator } = require("source-map"); | ||
// Originally based on https://github.com/jakobwesthoff/source-map-merger | ||
function composeSourceMaps(maps) { | ||
@@ -21,0 +21,0 @@ // NOTE: require() here to break dependency cycle |
@@ -14,6 +14,5 @@ /** | ||
const _require = require("./constants"), | ||
GENERATED_ORDER = _require.GENERATED_ORDER, | ||
iterationOrderToString = _require.iterationOrderToString; // Implementation details shared between MappingsConsumer and SectionsConsumer | ||
const { GENERATED_ORDER, iterationOrderToString } = require("./constants"); | ||
// Implementation details shared between MappingsConsumer and SectionsConsumer | ||
class AbstractConsumer { | ||
@@ -32,9 +31,3 @@ constructor(sourceMap) { | ||
eachMapping(callback) { | ||
let context = | ||
arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; | ||
let order = | ||
arguments.length > 2 && arguments[2] !== undefined | ||
? arguments[2] | ||
: GENERATED_ORDER; | ||
eachMapping(callback, context = null, order = GENERATED_ORDER) { | ||
invariant( | ||
@@ -41,0 +34,0 @@ order === GENERATED_ORDER, |
@@ -12,5 +12,3 @@ /** | ||
const _require = require("ob1"), | ||
add0 = _require.add0, | ||
add1 = _require.add1; | ||
const { add0, add1 } = require("ob1"); | ||
@@ -17,0 +15,0 @@ const FIRST_COLUMN = add0(0); |
@@ -12,24 +12,11 @@ /** | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
} | ||
const createConsumer = require("./createConsumer"); | ||
return obj; | ||
} | ||
const { | ||
GENERATED_ORDER, | ||
ORIGINAL_ORDER, | ||
GREATEST_LOWER_BOUND, | ||
LEAST_UPPER_BOUND | ||
} = require("./constants"); | ||
const createConsumer = require("./createConsumer"); | ||
const _require = require("./constants"), | ||
GENERATED_ORDER = _require.GENERATED_ORDER, | ||
ORIGINAL_ORDER = _require.ORIGINAL_ORDER, | ||
GREATEST_LOWER_BOUND = _require.GREATEST_LOWER_BOUND, | ||
LEAST_UPPER_BOUND = _require.LEAST_UPPER_BOUND; | ||
/** | ||
@@ -40,4 +27,8 @@ * A source map consumer that supports both "basic" and "indexed" source maps. | ||
*/ | ||
class DelegatingConsumer { | ||
static GENERATED_ORDER = GENERATED_ORDER; | ||
static ORIGINAL_ORDER = ORIGINAL_ORDER; | ||
static GREATEST_LOWER_BOUND = GREATEST_LOWER_BOUND; | ||
static LEAST_UPPER_BOUND = LEAST_UPPER_BOUND; | ||
class DelegatingConsumer { | ||
constructor(sourceMap) { | ||
@@ -69,14 +60,2 @@ this._rootConsumer = createConsumer(sourceMap); | ||
_defineProperty(DelegatingConsumer, "GENERATED_ORDER", GENERATED_ORDER); | ||
_defineProperty(DelegatingConsumer, "ORIGINAL_ORDER", ORIGINAL_ORDER); | ||
_defineProperty( | ||
DelegatingConsumer, | ||
"GREATEST_LOWER_BOUND", | ||
GREATEST_LOWER_BOUND | ||
); | ||
_defineProperty(DelegatingConsumer, "LEAST_UPPER_BOUND", LEAST_UPPER_BOUND); | ||
module.exports = DelegatingConsumer; |
@@ -12,149 +12,2 @@ /** | ||
function _toConsumableArray(arr) { | ||
return ( | ||
_arrayWithoutHoles(arr) || | ||
_iterableToArray(arr) || | ||
_unsupportedIterableToArray(arr) || | ||
_nonIterableSpread() | ||
); | ||
} | ||
function _nonIterableSpread() { | ||
throw new TypeError( | ||
"Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method." | ||
); | ||
} | ||
function _iterableToArray(iter) { | ||
if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) | ||
return Array.from(iter); | ||
} | ||
function _arrayWithoutHoles(arr) { | ||
if (Array.isArray(arr)) return _arrayLikeToArray(arr); | ||
} | ||
function _slicedToArray(arr, i) { | ||
return ( | ||
_arrayWithHoles(arr) || | ||
_iterableToArrayLimit(arr, i) || | ||
_unsupportedIterableToArray(arr, i) || | ||
_nonIterableRest() | ||
); | ||
} | ||
function _nonIterableRest() { | ||
throw new TypeError( | ||
"Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method." | ||
); | ||
} | ||
function _unsupportedIterableToArray(o, minLen) { | ||
if (!o) return; | ||
if (typeof o === "string") return _arrayLikeToArray(o, minLen); | ||
var n = Object.prototype.toString.call(o).slice(8, -1); | ||
if (n === "Object" && o.constructor) n = o.constructor.name; | ||
if (n === "Map" || n === "Set") return Array.from(o); | ||
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) | ||
return _arrayLikeToArray(o, minLen); | ||
} | ||
function _arrayLikeToArray(arr, len) { | ||
if (len == null || len > arr.length) len = arr.length; | ||
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; | ||
return arr2; | ||
} | ||
function _iterableToArrayLimit(arr, i) { | ||
if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) | ||
return; | ||
var _arr = []; | ||
var _n = true; | ||
var _d = false; | ||
var _e = undefined; | ||
try { | ||
for ( | ||
var _i = arr[Symbol.iterator](), _s; | ||
!(_n = (_s = _i.next()).done); | ||
_n = true | ||
) { | ||
_arr.push(_s.value); | ||
if (i && _arr.length === i) break; | ||
} | ||
} catch (err) { | ||
_d = true; | ||
_e = err; | ||
} finally { | ||
try { | ||
if (!_n && _i["return"] != null) _i["return"](); | ||
} finally { | ||
if (_d) throw _e; | ||
} | ||
} | ||
return _arr; | ||
} | ||
function _arrayWithHoles(arr) { | ||
if (Array.isArray(arr)) return arr; | ||
} | ||
function ownKeys(object, enumerableOnly) { | ||
var keys = Object.keys(object); | ||
if (Object.getOwnPropertySymbols) { | ||
var symbols = Object.getOwnPropertySymbols(object); | ||
if (enumerableOnly) | ||
symbols = symbols.filter(function(sym) { | ||
return Object.getOwnPropertyDescriptor(object, sym).enumerable; | ||
}); | ||
keys.push.apply(keys, symbols); | ||
} | ||
return keys; | ||
} | ||
function _objectSpread(target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i] != null ? arguments[i] : {}; | ||
if (i % 2) { | ||
ownKeys(Object(source), true).forEach(function(key) { | ||
_defineProperty(target, key, source[key]); | ||
}); | ||
} else if (Object.getOwnPropertyDescriptors) { | ||
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); | ||
} else { | ||
ownKeys(Object(source)).forEach(function(key) { | ||
Object.defineProperty( | ||
target, | ||
key, | ||
Object.getOwnPropertyDescriptor(source, key) | ||
); | ||
}); | ||
} | ||
} | ||
return target; | ||
} | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
const AbstractConsumer = require("./AbstractConsumer"); | ||
@@ -166,21 +19,16 @@ | ||
const _require = require("./constants"), | ||
FIRST_COLUMN = _require.FIRST_COLUMN, | ||
FIRST_LINE = _require.FIRST_LINE, | ||
GREATEST_LOWER_BOUND = _require.GREATEST_LOWER_BOUND, | ||
EMPTY_POSITION = _require.EMPTY_POSITION, | ||
lookupBiasToString = _require.lookupBiasToString; | ||
const { | ||
FIRST_COLUMN, | ||
FIRST_LINE, | ||
GREATEST_LOWER_BOUND, | ||
EMPTY_POSITION, | ||
lookupBiasToString | ||
} = require("./constants"); | ||
const _require2 = require("./search"), | ||
greatestLowerBound = _require2.greatestLowerBound; | ||
const { greatestLowerBound } = require("./search"); | ||
const _require3 = require("ob1"), | ||
add = _require3.add, | ||
get0 = _require3.get0, | ||
add0 = _require3.add0, | ||
sub = _require3.sub, | ||
inc = _require3.inc; | ||
const { add, get0, add0, sub, inc } = require("ob1"); | ||
const _require4 = require("vlq"), | ||
decodeVlq = _require4.decode; | ||
const { decode: decodeVlq } = require("vlq"); | ||
/** | ||
@@ -190,3 +38,2 @@ * A source map consumer that supports "basic" source maps (that have a | ||
*/ | ||
class MappingsConsumer extends AbstractConsumer { | ||
@@ -201,7 +48,6 @@ constructor(sourceMap) { | ||
originalPositionFor(generatedPosition) { | ||
const line = generatedPosition.line, | ||
column = generatedPosition.column; | ||
const { line, column } = generatedPosition; | ||
if (line == null || column == null) { | ||
return _objectSpread({}, EMPTY_POSITION); | ||
return { ...EMPTY_POSITION }; | ||
} | ||
@@ -248,3 +94,3 @@ | ||
return _objectSpread({}, EMPTY_POSITION); | ||
return { ...EMPTY_POSITION }; | ||
} | ||
@@ -262,5 +108,3 @@ | ||
const _this$_sourceMap = this._sourceMap, | ||
mappingsRaw = _this$_sourceMap.mappings, | ||
names = _this$_sourceMap.names; | ||
const { mappings: mappingsRaw, names } = this._sourceMap; | ||
let next; | ||
@@ -303,11 +147,9 @@ const vlqCache = new Map(); | ||
invariant(Array.isArray(decodedVlqValues), "Decoding VLQ tuple failed"); | ||
const _decodedVlqValues = decodedVlqValues, | ||
_decodedVlqValues2 = _slicedToArray(_decodedVlqValues, 5), | ||
generatedColumnDelta = _decodedVlqValues2[0], | ||
sourceIndexDelta = _decodedVlqValues2[1], | ||
originalLineDelta = _decodedVlqValues2[2], | ||
originalColumnDelta = _decodedVlqValues2[3], | ||
nameIndexDelta = _decodedVlqValues2[4]; | ||
const [ | ||
generatedColumnDelta, | ||
sourceIndexDelta, | ||
originalLineDelta, | ||
originalColumnDelta, | ||
nameIndexDelta | ||
] = decodedVlqValues; | ||
decodeVlq(mappingRaw); | ||
@@ -357,3 +199,3 @@ invariant(generatedColumnDelta != null, "Invalid generated column delta"); | ||
if (!this._decodedMappings) { | ||
this._decodedMappings = _toConsumableArray(this._decodeMappings()); | ||
this._decodedMappings = [...this._decodeMappings()]; | ||
} | ||
@@ -383,3 +225,3 @@ | ||
const sourcesContent = this._sourceMap.sourcesContent; | ||
const { sourcesContent } = this._sourceMap; | ||
@@ -386,0 +228,0 @@ if (!sourcesContent) { |
@@ -15,3 +15,3 @@ /** | ||
function normalizeSourcePath(sourceInput, map) { | ||
const sourceRoot = map.sourceRoot; | ||
const { sourceRoot } = map; | ||
let source = sourceInput; | ||
@@ -18,0 +18,0 @@ source = String(source); // Some source maps produce relative source paths like "./foo.js" instead of |
@@ -12,69 +12,10 @@ /** | ||
function ownKeys(object, enumerableOnly) { | ||
var keys = Object.keys(object); | ||
const { add, neg } = require("ob1"); | ||
if (Object.getOwnPropertySymbols) { | ||
var symbols = Object.getOwnPropertySymbols(object); | ||
if (enumerableOnly) | ||
symbols = symbols.filter(function(sym) { | ||
return Object.getOwnPropertyDescriptor(object, sym).enumerable; | ||
}); | ||
keys.push.apply(keys, symbols); | ||
} | ||
return keys; | ||
} | ||
function _objectSpread(target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i] != null ? arguments[i] : {}; | ||
if (i % 2) { | ||
ownKeys(Object(source), true).forEach(function(key) { | ||
_defineProperty(target, key, source[key]); | ||
}); | ||
} else if (Object.getOwnPropertyDescriptors) { | ||
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); | ||
} else { | ||
ownKeys(Object(source)).forEach(function(key) { | ||
Object.defineProperty( | ||
target, | ||
key, | ||
Object.getOwnPropertyDescriptor(source, key) | ||
); | ||
}); | ||
} | ||
} | ||
return target; | ||
} | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
const _require = require("ob1"), | ||
add = _require.add, | ||
neg = _require.neg; | ||
function shiftPositionByOffset(pos, offset) { | ||
return _objectSpread( | ||
_objectSpread({}, pos), | ||
{}, | ||
{ | ||
line: pos.line != null ? add(pos.line, offset.lines) : null, | ||
column: pos.column != null ? add(pos.column, offset.columns) : null | ||
} | ||
); | ||
return { | ||
...pos, | ||
line: pos.line != null ? add(pos.line, offset.lines) : null, | ||
column: pos.column != null ? add(pos.column, offset.columns) : null | ||
}; | ||
} | ||
@@ -81,0 +22,0 @@ |
@@ -12,125 +12,2 @@ /** | ||
function ownKeys(object, enumerableOnly) { | ||
var keys = Object.keys(object); | ||
if (Object.getOwnPropertySymbols) { | ||
var symbols = Object.getOwnPropertySymbols(object); | ||
if (enumerableOnly) | ||
symbols = symbols.filter(function(sym) { | ||
return Object.getOwnPropertyDescriptor(object, sym).enumerable; | ||
}); | ||
keys.push.apply(keys, symbols); | ||
} | ||
return keys; | ||
} | ||
function _objectSpread(target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i] != null ? arguments[i] : {}; | ||
if (i % 2) { | ||
ownKeys(Object(source), true).forEach(function(key) { | ||
_defineProperty(target, key, source[key]); | ||
}); | ||
} else if (Object.getOwnPropertyDescriptors) { | ||
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); | ||
} else { | ||
ownKeys(Object(source)).forEach(function(key) { | ||
Object.defineProperty( | ||
target, | ||
key, | ||
Object.getOwnPropertyDescriptor(source, key) | ||
); | ||
}); | ||
} | ||
} | ||
return target; | ||
} | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
function _slicedToArray(arr, i) { | ||
return ( | ||
_arrayWithHoles(arr) || | ||
_iterableToArrayLimit(arr, i) || | ||
_unsupportedIterableToArray(arr, i) || | ||
_nonIterableRest() | ||
); | ||
} | ||
function _nonIterableRest() { | ||
throw new TypeError( | ||
"Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method." | ||
); | ||
} | ||
function _unsupportedIterableToArray(o, minLen) { | ||
if (!o) return; | ||
if (typeof o === "string") return _arrayLikeToArray(o, minLen); | ||
var n = Object.prototype.toString.call(o).slice(8, -1); | ||
if (n === "Object" && o.constructor) n = o.constructor.name; | ||
if (n === "Map" || n === "Set") return Array.from(o); | ||
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) | ||
return _arrayLikeToArray(o, minLen); | ||
} | ||
function _arrayLikeToArray(arr, len) { | ||
if (len == null || len > arr.length) len = arr.length; | ||
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; | ||
return arr2; | ||
} | ||
function _iterableToArrayLimit(arr, i) { | ||
if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) | ||
return; | ||
var _arr = []; | ||
var _n = true; | ||
var _d = false; | ||
var _e = undefined; | ||
try { | ||
for ( | ||
var _i = arr[Symbol.iterator](), _s; | ||
!(_n = (_s = _i.next()).done); | ||
_n = true | ||
) { | ||
_arr.push(_s.value); | ||
if (i && _arr.length === i) break; | ||
} | ||
} catch (err) { | ||
_d = true; | ||
_e = err; | ||
} finally { | ||
try { | ||
if (!_n && _i["return"] != null) _i["return"](); | ||
} finally { | ||
if (_d) throw _e; | ||
} | ||
} | ||
return _arr; | ||
} | ||
function _arrayWithHoles(arr) { | ||
if (Array.isArray(arr)) return arr; | ||
} | ||
const AbstractConsumer = require("./AbstractConsumer"); | ||
@@ -140,20 +17,10 @@ | ||
const _require = require("./constants"), | ||
FIRST_COLUMN = _require.FIRST_COLUMN, | ||
FIRST_LINE = _require.FIRST_LINE, | ||
EMPTY_POSITION = _require.EMPTY_POSITION; | ||
const { FIRST_COLUMN, FIRST_LINE, EMPTY_POSITION } = require("./constants"); | ||
const _require2 = require("./positionMath"), | ||
subtractOffsetFromPosition = _require2.subtractOffsetFromPosition; | ||
const { subtractOffsetFromPosition } = require("./positionMath"); | ||
const _require3 = require("./search"), | ||
greatestLowerBound = _require3.greatestLowerBound; | ||
const { greatestLowerBound } = require("./search"); | ||
const _require4 = require("ob1"), | ||
add = _require4.add, | ||
get0 = _require4.get0, | ||
get1 = _require4.get1, | ||
add0 = _require4.add0, | ||
sub1 = _require4.sub1, | ||
sub = _require4.sub; | ||
const { add, get0, get1, add0, sub1, sub } = require("ob1"); | ||
/** | ||
@@ -163,3 +30,2 @@ * A source map consumer that supports "indexed" source maps (that have a | ||
*/ | ||
class SectionsConsumer extends AbstractConsumer { | ||
@@ -179,6 +45,4 @@ constructor(sourceMap) { | ||
originalPositionFor(generatedPosition) { | ||
const _ref = this._consumerForPosition(generatedPosition) || [], | ||
_ref2 = _slicedToArray(_ref, 2), | ||
generatedOffset = _ref2[0], | ||
consumer = _ref2[1]; | ||
const [generatedOffset, consumer] = | ||
this._consumerForPosition(generatedPosition) || []; | ||
@@ -195,7 +59,3 @@ if (!consumer) { | ||
*generatedMappings() { | ||
for (const _ref3 of this._consumers) { | ||
var _ref4 = _slicedToArray(_ref3, 2); | ||
const generatedOffset = _ref4[0]; | ||
const consumer = _ref4[1]; | ||
for (const [generatedOffset, consumer] of this._consumers) { | ||
let first = true; | ||
@@ -219,13 +79,7 @@ | ||
first = false; | ||
yield _objectSpread( | ||
_objectSpread({}, mapping), | ||
{}, | ||
{ | ||
generatedLine: add(mapping.generatedLine, generatedOffset.lines), | ||
generatedColumn: add( | ||
mapping.generatedColumn, | ||
generatedOffset.columns | ||
) | ||
} | ||
); | ||
yield { | ||
...mapping, | ||
generatedLine: add(mapping.generatedLine, generatedOffset.lines), | ||
generatedColumn: add(mapping.generatedColumn, generatedOffset.columns) | ||
}; | ||
} | ||
@@ -236,4 +90,3 @@ } | ||
_consumerForPosition(generatedPosition) { | ||
const line = generatedPosition.line, | ||
column = generatedPosition.column; | ||
const { line, column } = generatedPosition; | ||
@@ -247,6 +100,3 @@ if (line == null || column == null) { | ||
generatedPosition, | ||
(position, _ref5) => { | ||
let _ref6 = _slicedToArray(_ref5, 1), | ||
offset = _ref6[0]; | ||
(position, [offset]) => { | ||
const line0 = sub1(line); | ||
@@ -266,7 +116,3 @@ const column0 = column; | ||
sourceContentFor(source, nullOnMissing) { | ||
for (const _ref7 of this._consumers) { | ||
var _ref8 = _slicedToArray(_ref7, 2); | ||
const _ = _ref8[0]; | ||
const consumer = _ref8[1]; | ||
for (const [_, consumer] of this._consumers) { | ||
const content = consumer.sourceContentFor(source, nullOnMissing); | ||
@@ -273,0 +119,0 @@ |
@@ -17,102 +17,5 @@ /** | ||
function _interopRequireDefault(obj) { | ||
return obj && obj.__esModule | ||
? obj | ||
: { | ||
default: obj | ||
}; | ||
return obj && obj.__esModule ? obj : { default: obj }; | ||
} | ||
function _slicedToArray(arr, i) { | ||
return ( | ||
_arrayWithHoles(arr) || | ||
_iterableToArrayLimit(arr, i) || | ||
_unsupportedIterableToArray(arr, i) || | ||
_nonIterableRest() | ||
); | ||
} | ||
function _nonIterableRest() { | ||
throw new TypeError( | ||
"Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method." | ||
); | ||
} | ||
function _iterableToArrayLimit(arr, i) { | ||
if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) | ||
return; | ||
var _arr = []; | ||
var _n = true; | ||
var _d = false; | ||
var _e = undefined; | ||
try { | ||
for ( | ||
var _i = arr[Symbol.iterator](), _s; | ||
!(_n = (_s = _i.next()).done); | ||
_n = true | ||
) { | ||
_arr.push(_s.value); | ||
if (i && _arr.length === i) break; | ||
} | ||
} catch (err) { | ||
_d = true; | ||
_e = err; | ||
} finally { | ||
try { | ||
if (!_n && _i["return"] != null) _i["return"](); | ||
} finally { | ||
if (_d) throw _e; | ||
} | ||
} | ||
return _arr; | ||
} | ||
function _arrayWithHoles(arr) { | ||
if (Array.isArray(arr)) return arr; | ||
} | ||
function _toConsumableArray(arr) { | ||
return ( | ||
_arrayWithoutHoles(arr) || | ||
_iterableToArray(arr) || | ||
_unsupportedIterableToArray(arr) || | ||
_nonIterableSpread() | ||
); | ||
} | ||
function _nonIterableSpread() { | ||
throw new TypeError( | ||
"Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method." | ||
); | ||
} | ||
function _unsupportedIterableToArray(o, minLen) { | ||
if (!o) return; | ||
if (typeof o === "string") return _arrayLikeToArray(o, minLen); | ||
var n = Object.prototype.toString.call(o).slice(8, -1); | ||
if (n === "Object" && o.constructor) n = o.constructor.name; | ||
if (n === "Map" || n === "Set") return Array.from(o); | ||
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) | ||
return _arrayLikeToArray(o, minLen); | ||
} | ||
function _iterableToArray(iter) { | ||
if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) | ||
return Array.from(iter); | ||
} | ||
function _arrayWithoutHoles(arr) { | ||
if (Array.isArray(arr)) return _arrayLikeToArray(arr); | ||
} | ||
function _arrayLikeToArray(arr, len) { | ||
if (len == null || len > arr.length) len = arr.length; | ||
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; | ||
return arr2; | ||
} | ||
const B64Builder = require("./B64Builder"); | ||
@@ -125,2 +28,3 @@ | ||
const t = require("@babel/types"); | ||
/** | ||
@@ -134,3 +38,2 @@ * Generate a map of source positions to function names. The names are meant to | ||
*/ | ||
function generateFunctionMap(ast, context) { | ||
@@ -199,3 +102,3 @@ const encoder = new MappingEncoder(); | ||
if (top) { | ||
const loc = top.loc; | ||
const { loc } = top; | ||
advanceToPos(loc.end); | ||
@@ -243,5 +146,3 @@ nameStack.shift(); | ||
function getNameForPath(path) { | ||
const node = path.node, | ||
parent = path.parent, | ||
parentPath = path.parentPath; | ||
const { node, parent, parentPath } = path; | ||
@@ -252,4 +153,3 @@ if ((0, _types.isProgram)(node)) { | ||
let _ref = path, | ||
id = _ref.id; // has an `id` so we don't need to infer one | ||
let { id } = path; // has an `id` so we don't need to infer one | ||
@@ -305,4 +205,5 @@ if (node.id) { | ||
} else if ((0, _types.isJSXAttribute)(grandParentNode)) { | ||
var _parentPath$parentPat2, _parentPath$parentPat3; // <foo bar={function () {}} /> | ||
var _parentPath$parentPat2, _parentPath$parentPat3; | ||
// <foo bar={function () {}} /> | ||
const openingElement = | ||
@@ -479,6 +380,3 @@ parentPath === null || parentPath === void 0 | ||
if (objectName.length) { | ||
return [].concat( | ||
_toConsumableArray(objectName), | ||
_toConsumableArray(propertyName) | ||
); | ||
return [...objectName, ...propertyName]; | ||
} else { | ||
@@ -507,7 +405,4 @@ return propertyName; | ||
const shortenedName = name.substr(namePrefix.length); | ||
const [delimiterMatch] = shortenedName.match(DELIMITER_START_RE) || []; | ||
const _ref2 = shortenedName.match(DELIMITER_START_RE) || [], | ||
_ref3 = _slicedToArray(_ref2, 1), | ||
delimiterMatch = _ref3[0]; | ||
if (delimiterMatch) { | ||
@@ -561,6 +456,3 @@ return shortenedName.substr(delimiterMatch.length) || name; | ||
push(_ref4) { | ||
let name = _ref4.name, | ||
start = _ref4.start; | ||
push({ name, start }) { | ||
let nameIndex = this._namesMap.get(name); | ||
@@ -597,5 +489,3 @@ | ||
class RelativeValue { | ||
constructor() { | ||
let value = | ||
arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; | ||
constructor(value = 0) { | ||
this.reset(value); | ||
@@ -610,5 +500,3 @@ } | ||
reset() { | ||
let value = | ||
arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; | ||
reset(value = 0) { | ||
this._value = value; | ||
@@ -615,0 +503,0 @@ } |
@@ -12,57 +12,4 @@ /** | ||
function ownKeys(object, enumerableOnly) { | ||
var keys = Object.keys(object); | ||
const B64Builder = require("./B64Builder"); | ||
if (Object.getOwnPropertySymbols) { | ||
var symbols = Object.getOwnPropertySymbols(object); | ||
if (enumerableOnly) | ||
symbols = symbols.filter(function(sym) { | ||
return Object.getOwnPropertyDescriptor(object, sym).enumerable; | ||
}); | ||
keys.push.apply(keys, symbols); | ||
} | ||
return keys; | ||
} | ||
function _objectSpread(target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i] != null ? arguments[i] : {}; | ||
if (i % 2) { | ||
ownKeys(Object(source), true).forEach(function(key) { | ||
_defineProperty(target, key, source[key]); | ||
}); | ||
} else if (Object.getOwnPropertyDescriptors) { | ||
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); | ||
} else { | ||
ownKeys(Object(source)).forEach(function(key) { | ||
Object.defineProperty( | ||
target, | ||
key, | ||
Object.getOwnPropertyDescriptor(source, key) | ||
); | ||
}); | ||
} | ||
} | ||
return target; | ||
} | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
const B64Builder = require("./B64Builder"); | ||
/** | ||
@@ -79,3 +26,2 @@ * Generates a source map from raw mappings. | ||
*/ | ||
class Generator { | ||
@@ -207,20 +153,15 @@ constructor() { | ||
return _objectSpread( | ||
_objectSpread( | ||
_objectSpread( | ||
{ | ||
version: 3, | ||
file, | ||
sources: this.sources.slice() | ||
}, | ||
content | ||
), | ||
sourcesMetadata | ||
), | ||
{}, | ||
{ | ||
names: this.names.items(), | ||
mappings: this.builder.toString() | ||
} | ||
); | ||
return { | ||
version: 3, | ||
file, | ||
sources: this.sources.slice(), | ||
...content, | ||
/* $FlowFixMe(>=0.111.0 site=react_native_fb) This comment suppresses an | ||
* error found when Flow v0.111 was deployed. To see the error, delete | ||
* this comment and run Flow. */ | ||
...sourcesMetadata, | ||
names: this.names.items(), | ||
mappings: this.builder.toString() | ||
}; | ||
} | ||
@@ -227,0 +168,0 @@ /** |
@@ -12,38 +12,2 @@ /** | ||
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { | ||
try { | ||
var info = gen[key](arg); | ||
var value = info.value; | ||
} catch (error) { | ||
reject(error); | ||
return; | ||
} | ||
if (info.done) { | ||
resolve(value); | ||
} else { | ||
Promise.resolve(value).then(_next, _throw); | ||
} | ||
} | ||
function _asyncToGenerator(fn) { | ||
return function() { | ||
var self = this, | ||
args = arguments; | ||
return new Promise(function(resolve, reject) { | ||
var gen = fn.apply(self, args); | ||
function _next(value) { | ||
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); | ||
} | ||
function _throw(err) { | ||
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); | ||
} | ||
_next(undefined); | ||
}); | ||
}; | ||
} | ||
const Consumer = require("./Consumer"); | ||
@@ -53,4 +17,5 @@ | ||
const SourceMap = require("source-map"); // We need to export this for `metro-symbolicate` | ||
const SourceMap = require("source-map"); | ||
// We need to export this for `metro-symbolicate` | ||
const normalizeSourcePath = require("./Consumer/normalizeSourcePath"); | ||
@@ -60,8 +25,5 @@ | ||
const _require = require("./BundleBuilder"), | ||
createIndexMap = _require.createIndexMap, | ||
BundleBuilder = _require.BundleBuilder; | ||
const { createIndexMap, BundleBuilder } = require("./BundleBuilder"); | ||
const _require2 = require("./generateFunctionMap"), | ||
generateFunctionMap = _require2.generateFunctionMap; | ||
const { generateFunctionMap } = require("./generateFunctionMap"); | ||
@@ -79,4 +41,3 @@ function fromRawMappingsImpl(isBlocking, onDone, modules, offsetLines) { | ||
const mod = modulesToProcess.shift(); | ||
const code = mod.code, | ||
map = mod.map; | ||
const { code, map } = mod; | ||
@@ -133,5 +94,3 @@ if (Array.isArray(map)) { | ||
function fromRawMappings(modules) { | ||
let offsetLines = | ||
arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; | ||
function fromRawMappings(modules, offsetLines = 0) { | ||
let generator; | ||
@@ -154,4 +113,6 @@ fromRawMappingsImpl( | ||
function fromRawMappingsNonBlocking(_x) { | ||
return _fromRawMappingsNonBlocking.apply(this, arguments); | ||
async function fromRawMappingsNonBlocking(modules, offsetLines = 0) { | ||
return new Promise(resolve => { | ||
fromRawMappingsImpl(false, resolve, modules, offsetLines); | ||
}); | ||
} | ||
@@ -163,13 +124,2 @@ /** | ||
function _fromRawMappingsNonBlocking() { | ||
_fromRawMappingsNonBlocking = _asyncToGenerator(function*(modules) { | ||
let offsetLines = | ||
arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; | ||
return new Promise(resolve => { | ||
fromRawMappingsImpl(false, resolve, modules, offsetLines); | ||
}); | ||
}); | ||
return _fromRawMappingsNonBlocking.apply(this, arguments); | ||
} | ||
function toBabelSegments(sourceMap) { | ||
@@ -195,7 +145,4 @@ const rawMappings = []; | ||
function toSegmentTuple(mapping) { | ||
const _mapping$generated = mapping.generated, | ||
column = _mapping$generated.column, | ||
line = _mapping$generated.line; | ||
const name = mapping.name, | ||
original = mapping.original; | ||
const { column, line } = mapping.generated; | ||
const { name, original } = mapping; | ||
@@ -202,0 +149,0 @@ if (original == null) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
113383
1808
+ Addedmetro-symbolicate@0.65.0(transitive)
+ Addedob1@0.65.0(transitive)
- Removedmetro-symbolicate@0.64.0(transitive)
- Removedob1@0.64.0(transitive)
Updatedmetro-symbolicate@0.65.0
Updatedob1@0.65.0