Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

metro-symbolicate

Package Overview
Dependencies
Maintainers
2
Versions
88
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

metro-symbolicate - npm Package Compare versions

Comparing version 0.60.0 to 0.61.0

src.real/__tests__/__fixtures__/directory/foo.js.map

4

package.json
{
"name": "metro-symbolicate",
"version": "0.60.0",
"version": "0.61.0",
"description": "A tool to find the source location from JS bundles and stack traces.",

@@ -24,3 +24,3 @@ "license": "MIT",

"invariant": "^2.2.4",
"metro-source-map": "0.60.0",
"metro-source-map": "0.61.0",
"source-map": "^0.5.6",

@@ -27,0 +27,0 @@ "through2": "^2.0.1",

@@ -7,102 +7,37 @@ /**

*
*
* @flow
* @format
*/
"use strict";
function _slicedToArray(arr, i) {
return (
_arrayWithHoles(arr) ||
_iterableToArrayLimit(arr, i) ||
_unsupportedIterableToArray(arr, i) ||
_nonIterableRest()
);
}
'use strict';
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."
);
}
const vlq = require('vlq');
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;
}
const {normalizeSourcePath} = require('metro-source-map');
function _arrayWithHoles(arr) {
if (Array.isArray(arr)) return arr;
}
import type {
MixedSourceMap,
FBSourcesArray,
FBSourceFunctionMap,
FBSourceMetadata,
BasicSourceMap,
IndexMap,
} from 'metro-source-map';
function _toConsumableArray(arr) {
return (
_arrayWithoutHoles(arr) ||
_iterableToArray(arr) ||
_unsupportedIterableToArray(arr) ||
_nonIterableSpread()
);
}
const METADATA_FIELD_FUNCTIONS = 0;
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."
);
}
type Position = {
+line: number,
+column: number,
...
};
type FunctionMapping = {
+line: number,
+column: number,
+name: string,
...
};
type SourceNameNormalizer = (string, {+sourceRoot?: ?string, ...}) => string;
type MetadataMap = {[source: string]: ?FBSourceMetadata, ...};
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 vlq = require("vlq");
const _require = require("metro-source-map"),
normalizeSourcePath = _require.normalizeSourcePath;
const METADATA_FIELD_FUNCTIONS = 0;
/**

@@ -123,7 +58,6 @@ * Consumes the `x_facebook_sources` metadata field from a source map and

class SourceMetadataMapConsumer {
constructor(map) {
let normalizeSourceFn =
arguments.length > 1 && arguments[1] !== undefined
? arguments[1]
: normalizeSourcePath;
constructor(
map: MixedSourceMap,
normalizeSourceFn: SourceNameNormalizer = normalizeSourcePath,
) {
this._sourceMap = map;

@@ -134,2 +68,7 @@ this._decodedFunctionMapCache = new Map();

_sourceMap: MixedSourceMap;
_decodedFunctionMapCache: Map<string, ?$ReadOnlyArray<FunctionMapping>>;
_normalizeSource: SourceNameNormalizer;
_metadataBySource: ?MetadataMap;
/**

@@ -143,16 +82,11 @@ * Retrieves a human-readable name for the function enclosing a particular

*/
functionNameFor(_ref) {
let line = _ref.line,
column = _ref.column,
source = _ref.source;
functionNameFor({
line,
column,
source,
}: Position & {+source: ?string, ...}): ?string {
if (source && line != null && column != null) {
const mappings = this._getFunctionMappings(source);
if (mappings) {
const mapping = findEnclosingMapping(mappings, {
line,
column
});
const mapping = findEnclosingMapping(mappings, {line, column});
if (mapping) {

@@ -163,5 +97,5 @@ return mapping.name;

}
return null;
}
/**

@@ -174,22 +108,18 @@ * Returns this map's source metadata as a new array with the same order as

*/
toArray(sources) {
toArray(sources: $ReadOnlyArray<string>): FBSourcesArray {
const metadataBySource = this._getMetadataBySource();
const encoded = [];
for (const source of sources) {
encoded.push(metadataBySource[source] || null);
}
return encoded;
}
/**
* Prepares and caches a lookup table of metadata by source name.
*/
_getMetadataBySource() {
_getMetadataBySource(): MetadataMap {
if (!this._metadataBySource) {
this._metadataBySource = this._getMetadataObjectsBySourceNames(
this._sourceMap
this._sourceMap,
);

@@ -200,2 +130,3 @@ }

}
/**

@@ -205,12 +136,8 @@ * Decodes the function name mappings for the given source if needed, and

*/
_getFunctionMappings(source) {
_getFunctionMappings(source: string): ?$ReadOnlyArray<FunctionMapping> {
if (this._decodedFunctionMapCache.has(source)) {
return this._decodedFunctionMapCache.get(source);
}
let parsedFunctionMap = null;
const metadataBySource = this._getMetadataBySource();
if (Object.prototype.hasOwnProperty.call(metadataBySource, source)) {

@@ -220,7 +147,6 @@ const metadata = metadataBySource[source] || [];

}
this._decodedFunctionMapCache.set(source, parsedFunctionMap);
return parsedFunctionMap;
}
/**

@@ -235,25 +161,19 @@ * Collects source metadata from the given map using the current source name

*/
_getMetadataObjectsBySourceNames(map) {
_getMetadataObjectsBySourceNames(map: MixedSourceMap): MetadataMap {
// eslint-disable-next-line lint/strictly-null
if (map.mappings === undefined) {
const indexMap = map;
return Object.assign.apply(
Object,
[{}].concat(
_toConsumableArray(
indexMap.sections.map(section =>
this._getMetadataObjectsBySourceNames(section.map)
)
)
)
const indexMap: IndexMap = map;
return Object.assign(
{},
...indexMap.sections.map(section =>
this._getMetadataObjectsBySourceNames(section.map),
),
);
}
if ("x_facebook_sources" in map) {
const basicMap = map;
if ('x_facebook_sources' in map) {
const basicMap: BasicSourceMap = map;
return (basicMap.x_facebook_sources || []).reduce(
(acc, metadata, index) => {
let source = basicMap.sources[index];
if (source != null) {

@@ -263,9 +183,7 @@ source = this._normalizeSource(source, basicMap);

}
return acc;
},
{}
{},
);
}
return {};

@@ -275,37 +193,28 @@ }

function decodeFunctionMap(functionMap) {
function decodeFunctionMap(
functionMap: ?FBSourceFunctionMap,
): $ReadOnlyArray<FunctionMapping> {
if (!functionMap) {
return [];
}
const parsed = [];
let line = 1;
let nameIndex = 0;
for (const lineMappings of functionMap.mappings.split(";")) {
for (const lineMappings of functionMap.mappings.split(';')) {
let column = 0;
for (const mapping of lineMappings.split(",")) {
const _vlq$decode = vlq.decode(mapping),
_vlq$decode2 = _slicedToArray(_vlq$decode, 3),
columnDelta = _vlq$decode2[0],
nameDelta = _vlq$decode2[1],
_vlq$decode2$ = _vlq$decode2[2],
lineDelta = _vlq$decode2$ === void 0 ? 0 : _vlq$decode2$;
for (const mapping of lineMappings.split(',')) {
const [columnDelta, nameDelta, lineDelta = 0] = vlq.decode(mapping);
line += lineDelta;
nameIndex += nameDelta;
column += columnDelta;
parsed.push({
line,
column,
name: functionMap.names[nameIndex]
});
parsed.push({line, column, name: functionMap.names[nameIndex]});
}
}
return parsed;
}
function findEnclosingMapping(mappings, target) {
function findEnclosingMapping(
mappings: $ReadOnlyArray<FunctionMapping>,
target: Position,
): ?FunctionMapping {
let first = 0;

@@ -315,3 +224,2 @@ let it = 0;

let step;
while (count > 0) {

@@ -321,3 +229,2 @@ it = first;

it += step;
if (comparePositions(target, mappings[it]) >= 0) {

@@ -330,11 +237,9 @@ first = ++it;

}
return first ? mappings[first - 1] : null;
}
function comparePositions(a, b) {
function comparePositions(a: Position, b: Position): number {
if (a.line === b.line) {
return a.column - b.column;
}
return a.line - b.line;

@@ -341,0 +246,0 @@ }

#!/usr/bin/env node
/**

@@ -9,5 +8,6 @@ * Copyright (c) Facebook, Inc. and its affiliates.

*
*
* @flow strict-local
* @format
*/
// Symbolicates a JavaScript stack trace using a source map.

@@ -20,248 +20,184 @@ // In our first form, we read a stack trace from stdin and symbolicate it via

// optionally a column.
"use strict"; // flowlint-next-line untyped-import:off
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);
}
}
'use strict';
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);
});
};
}
// flowlint-next-line untyped-import:off
const SourceMapConsumer = require('source-map').SourceMapConsumer;
const Symbolication = require('./Symbolication.js');
const SourceMapConsumer = require("source-map").SourceMapConsumer;
const fs = require('fs');
// flowlint-next-line untyped-import:off
const through2 = require('through2');
const Symbolication = require("./Symbolication.js");
async function main(
argvInput: Array<string> = process.argv.slice(2),
{
stdin,
stderr,
stdout,
}: {
stdin: stream$Readable | tty$ReadStream,
stderr: stream$Writable,
stdout: stream$Writable,
...
} = process,
): Promise<number> {
const argv = argvInput.slice();
function checkAndRemoveArg(arg, valuesPerArg = 0) {
let values = null;
for (let idx = argv.indexOf(arg); idx !== -1; idx = argv.indexOf(arg)) {
argv.splice(idx, 1);
values = values || [];
values.push(argv.splice(idx, valuesPerArg));
}
return values;
}
const fs = require("fs"); // flowlint-next-line untyped-import:off
function checkAndRemoveArgWithValue(arg) {
const values = checkAndRemoveArg(arg, 1);
return values ? values[0][0] : null;
}
try {
const noFunctionNames = checkAndRemoveArg('--no-function-names');
const isHermesCrash = checkAndRemoveArg('--hermes-crash');
const inputLineStart = Number.parseInt(
checkAndRemoveArgWithValue('--input-line-start') || '1',
10,
);
const inputColumnStart = Number.parseInt(
checkAndRemoveArgWithValue('--input-column-start') || '0',
10,
);
const outputLineStart = Number.parseInt(
checkAndRemoveArgWithValue('--output-line-start') || '1',
10,
);
const outputColumnStart = Number.parseInt(
checkAndRemoveArgWithValue('--output-column-start') || '0',
10,
);
const through2 = require("through2");
if (argv.length < 1 || argv.length > 4) {
/* eslint no-path-concat: "off" */
function main() {
return _main.apply(this, arguments);
}
function _main() {
_main = _asyncToGenerator(function*() {
let argvInput =
arguments.length > 0 && arguments[0] !== undefined
? arguments[0]
: process.argv.slice(2);
let _ref =
arguments.length > 1 && arguments[1] !== undefined
? arguments[1]
: process,
stdin = _ref.stdin,
stderr = _ref.stderr,
stdout = _ref.stdout;
const argv = argvInput.slice();
function checkAndRemoveArg(arg) {
let valuesPerArg =
arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
let values = null;
for (let idx = argv.indexOf(arg); idx !== -1; idx = argv.indexOf(arg)) {
argv.splice(idx, 1);
values = values || [];
values.push(argv.splice(idx, valuesPerArg));
}
return values;
const usages = [
'Usage: ' + __filename + ' <source-map-file>',
' ' + __filename + ' <source-map-file> <line> [column]',
' ' +
__filename +
' <source-map-file> <moduleId>.js <line> [column]',
' ' + __filename + ' <source-map-file> <mapfile>.profmap',
' ' +
__filename +
' <source-map-file> --attribution < in.jsonl > out.jsonl',
' ' + __filename + ' <source-map-file> <tracefile>.cpuprofile',
' Optional flags:',
' --no-function-names',
' --hermes-crash',
' --input-line-start <line> (default: 1)',
' --input-column-start <column> (default: 0)',
' --output-line-start <line> (default: 1)',
' --output-column-start <column> (default: 0)',
];
console.error(usages.join('\n'));
return 1;
}
function checkAndRemoveArgWithValue(arg) {
const values = checkAndRemoveArg(arg, 1);
return values ? values[0][0] : null;
}
try {
const noFunctionNames = checkAndRemoveArg("--no-function-names");
const isHermesCrash = checkAndRemoveArg("--hermes-crash");
const inputLineStart = Number.parseInt(
checkAndRemoveArgWithValue("--input-line-start") || "1",
10
// Read the source map.
const sourceMapFileName = argv.shift();
const options = {
nameSource: noFunctionNames ? 'identifier_names' : 'function_names',
inputLineStart,
inputColumnStart,
outputLineStart,
outputColumnStart,
};
let context;
if (fs.lstatSync(sourceMapFileName).isDirectory()) {
context = Symbolication.unstable_createDirectoryContext(
SourceMapConsumer,
sourceMapFileName,
options,
);
const inputColumnStart = Number.parseInt(
checkAndRemoveArgWithValue("--input-column-start") || "0",
10
} else {
const content = fs.readFileSync(sourceMapFileName, 'utf8');
context = Symbolication.createContext(
SourceMapConsumer,
content,
options,
);
const outputLineStart = Number.parseInt(
checkAndRemoveArgWithValue("--output-line-start") || "1",
10
);
const outputColumnStart = Number.parseInt(
checkAndRemoveArgWithValue("--output-column-start") || "0",
10
);
if (argv.length < 1 || argv.length > 4) {
/* eslint no-path-concat: "off" */
const usages = [
"Usage: " + __filename + " <source-map-file>",
" " + __filename + " <source-map-file> <line> [column]",
" " +
__filename +
" <source-map-file> <moduleId>.js <line> [column]",
" " + __filename + " <source-map-file> <mapfile>.profmap",
" " +
__filename +
" <source-map-file> --attribution < in.jsonl > out.jsonl",
" " + __filename + " <source-map-file> <tracefile>.cpuprofile",
" Optional flags:",
" --no-function-names",
" --hermes-crash",
" --input-line-start <line> (default: 1)",
" --input-column-start <column> (default: 0)",
" --output-line-start <line> (default: 1)",
" --output-column-start <column> (default: 0)"
];
console.error(usages.join("\n"));
return 1;
} // Read the source map.
const sourceMapFileName = argv.shift();
const options = {
nameSource: noFunctionNames ? "identifier_names" : "function_names",
inputLineStart,
inputColumnStart,
outputLineStart,
outputColumnStart
};
let context;
if (fs.lstatSync(sourceMapFileName).isDirectory()) {
context = Symbolication.unstable_createDirectoryContext(
SourceMapConsumer,
sourceMapFileName,
options
}
if (argv.length === 0) {
const stackTrace = await readAll(stdin);
if (isHermesCrash) {
const stackTraceJSON = JSON.parse(stackTrace);
const symbolicatedTrace = context.symbolicateHermesMinidumpTrace(
stackTraceJSON,
);
stdout.write(JSON.stringify(symbolicatedTrace));
} else {
const content = fs.readFileSync(sourceMapFileName, "utf8");
context = Symbolication.createContext(
SourceMapConsumer,
content,
options
);
stdout.write(context.symbolicate(stackTrace));
}
if (argv.length === 0) {
const stackTrace = yield readAll(stdin);
if (isHermesCrash) {
const stackTraceJSON = JSON.parse(stackTrace);
const symbolicatedTrace = context.symbolicateHermesMinidumpTrace(
stackTraceJSON
);
stdout.write(JSON.stringify(symbolicatedTrace));
} else {
stdout.write(context.symbolicate(stackTrace));
}
} else if (argv[0].endsWith(".profmap")) {
stdout.write(context.symbolicateProfilerMap(argv[0]));
} else if (argv[0] === "--attribution") {
let buffer = "";
yield waitForStream(
stdin
.pipe(
through2(function(data, enc, callback) {
// Take arbitrary strings, output single lines
buffer += data;
const lines = buffer.split("\n");
for (let i = 0, e = lines.length - 1; i < e; i++) {
this.push(lines[i]);
}
buffer = lines[lines.length - 1];
callback();
})
)
.pipe(
through2.obj(function(data, enc, callback) {
// This is JSONL, so each line is a separate JSON object
const obj = JSON.parse(data);
context.symbolicateAttribution(obj);
this.push(JSON.stringify(obj) + "\n");
callback();
})
)
.pipe(stdout)
);
} else if (argv[0].endsWith(".cpuprofile")) {
// NOTE: synchronous
context.symbolicateChromeTrace(argv[0], {
stdout,
stderr
});
} else if (argv[0].endsWith('.profmap')) {
stdout.write(context.symbolicateProfilerMap(argv[0]));
} else if (argv[0] === '--attribution') {
let buffer = '';
await waitForStream(
stdin
.pipe(
through2(function(data, enc, callback) {
// Take arbitrary strings, output single lines
buffer += data;
const lines = buffer.split('\n');
for (let i = 0, e = lines.length - 1; i < e; i++) {
this.push(lines[i]);
}
buffer = lines[lines.length - 1];
callback();
}),
)
.pipe(
through2.obj(function(data, enc, callback) {
// This is JSONL, so each line is a separate JSON object
const obj = JSON.parse(data);
context.symbolicateAttribution(obj);
this.push(JSON.stringify(obj) + '\n');
callback();
}),
)
.pipe(stdout),
);
} else if (argv[0].endsWith('.cpuprofile')) {
// NOTE: synchronous
context.symbolicateChromeTrace(argv[0], {stdout, stderr});
} else {
// read-from-argv form.
let moduleIds;
if (argv[0].endsWith('.js')) {
moduleIds = context.parseFileName(argv[0]);
argv.shift();
} else {
var _original$source, _original$line, _original$name;
// read-from-argv form.
let moduleIds;
if (argv[0].endsWith(".js")) {
moduleIds = context.parseFileName(argv[0]);
argv.shift();
} else {
moduleIds = null;
}
const lineNumber = argv.shift();
const columnNumber = argv.shift() || 0;
const original = context.getOriginalPositionFor(
+lineNumber,
+columnNumber, // $FlowFixMe context is a union here and so this parameter is a union
moduleIds
);
stdout.write(
[
(_original$source = original.source) !== null &&
_original$source !== void 0
? _original$source
: "null",
(_original$line = original.line) !== null &&
_original$line !== void 0
? _original$line
: "null",
(_original$name = original.name) !== null &&
_original$name !== void 0
? _original$name
: "null"
].join(":") + "\n"
);
moduleIds = null;
}
} catch (error) {
stderr.write(error + "\n");
return 1;
const lineNumber = argv.shift();
const columnNumber = argv.shift() || 0;
const original = context.getOriginalPositionFor(
+lineNumber,
+columnNumber,
// $FlowFixMe context is a union here and so this parameter is a union
moduleIds,
);
stdout.write(
[
original.source ?? 'null',
original.line ?? 'null',
original.name ?? 'null',
].join(':') + '\n',
);
}
return 0;
});
return _main.apply(this, arguments);
} catch (error) {
stderr.write(error + '\n');
return 1;
}
return 0;
}

@@ -271,4 +207,3 @@

return new Promise(resolve => {
let data = "";
let data = '';
if (stream.isTTY === true) {

@@ -279,6 +214,6 @@ resolve(data);

stream.setEncoding("utf8");
stream.on("readable", () => {
let chunk; // flowlint-next-line sketchy-null-string:off
stream.setEncoding('utf8');
stream.on('readable', () => {
let chunk;
// flowlint-next-line sketchy-null-string:off
while ((chunk = stream.read())) {

@@ -288,3 +223,3 @@ data += chunk.toString();

});
stream.on("end", () => {
stream.on('end', () => {
resolve(data);

@@ -297,3 +232,3 @@ });

return new Promise(resolve => {
stream.on("finish", resolve);
stream.on('finish', resolve);
});

@@ -300,0 +235,0 @@ }

@@ -7,71 +7,106 @@ /**

*
*
* @flow
* @format
*/
"use strict";
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;
}
'use strict';
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;
}
const SourceMetadataMapConsumer = require('./SourceMetadataMapConsumer');
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 fs = require('fs');
const invariant = require('invariant');
const path = require('path');
const SourceMetadataMapConsumer = require("./SourceMetadataMapConsumer");
import type {MixedSourceMap, HermesFunctionOffsets} from 'metro-source-map';
// flowlint-next-line untyped-type-import:off
import {typeof SourceMapConsumer} from 'source-map';
const fs = require("fs");
type SingleMapModuleIds = {
segmentId: number,
localId: ?number,
...
};
const invariant = require("invariant");
type ContextOptionsInput = {
+nameSource?: 'function_names' | 'identifier_names',
+inputLineStart?: number,
+inputColumnStart?: number,
+outputLineStart?: number,
+outputColumnStart?: number,
...
};
const path = require("path");
type SizeAttributionMap = {
location: {
file: ?string,
filename?: string,
bytecodeSize?: number,
virtualOffset?: number,
line: ?number,
column: ?number,
},
...
};
const UNKNOWN_MODULE_IDS = {
type ChromeTraceEntry = {
column: number,
funcColumn: number,
funcLine: number,
funcVirtAddr: number,
line: number,
name: string,
offset: number,
};
type ChromeTrace = {
stackFrames: {[string]: ChromeTraceEntry},
};
type HermesMinidumpCrashInfo = {
+callstack: $ReadOnlyArray<HermesMinidumpStackFrame | NativeCodeStackFrame>,
...
};
type HermesMinidumpStackFrame = $ReadOnly<{|
ByteCodeOffset: number,
FunctionID: number,
CJSModuleOffset: number,
SourceURL: string,
StackFrameRegOffs: string,
SourceLocation?: string,
|}>;
type NativeCodeStackFrame = $ReadOnly<{|
NativeCode: true,
StackFrameRegOffs: string,
|}>;
type SymbolicatedStackTrace = $ReadOnlyArray<
SymbolicatedStackFrame | NativeCodeStackFrame,
>;
type SymbolicatedStackFrame = $ReadOnly<{|
line: ?number,
column: ?number,
source: ?string,
functionName: ?string,
name: ?string,
|}>;
const UNKNOWN_MODULE_IDS: SingleMapModuleIds = {
segmentId: 0,
localId: undefined
localId: undefined,
};
class SymbolicationContext {
constructor(options) {
class SymbolicationContext<ModuleIdsT> {
+options: {
+nameSource: 'function_names' | 'identifier_names',
+inputLineStart: number,
+inputColumnStart: number,
+outputLineStart: number,
+outputColumnStart: number,
...
};
constructor(options: ContextOptionsInput) {
this.options = {

@@ -82,11 +117,10 @@ inputLineStart: 1,

outputColumnStart: 0,
nameSource: "function_names"
nameSource: 'function_names',
};
if (options) {
for (const option of [
"inputLineStart",
"inputColumnStart",
"outputLineStart",
"outputColumnStart"
'inputLineStart',
'inputColumnStart',
'outputLineStart',
'outputColumnStart',
]) {

@@ -97,3 +131,2 @@ if (options[option] != null) {

}
if (options.nameSource != null) {

@@ -103,3 +136,5 @@ this.options.nameSource = options.nameSource;

}
} // parse stack trace with String.replace
}
// parse stack trace with String.replace
// replace the matched part of stack trace to symbolicated result

@@ -114,38 +149,27 @@ // sample stack trace:

// IOS: foo.js:57:foo, Android: bar.js:75:bar
symbolicate(stackTrace) {
symbolicate(stackTrace: string): string {
return stackTrace.replace(
/(?:([^@: \n(]+)(@|:))?(?:(?:([^@: \n(]+):)?(\d+):(\d+)|\[native code\])/g,
(match, func, delimiter, fileName, line, column) => {
var _original$source, _original$line, _original$name;
if (delimiter === ":" && func && !fileName) {
if (delimiter === ':' && func && !fileName) {
fileName = func;
func = null;
}
const original = this.getOriginalPositionFor(
line,
column,
this.parseFileName(fileName || "")
this.parseFileName(fileName || ''),
);
return (
((_original$source = original.source) !== null &&
_original$source !== void 0
? _original$source
: "null") +
":" +
((_original$line = original.line) !== null &&
_original$line !== void 0
? _original$line
: "null") +
":" +
((_original$name = original.name) !== null &&
_original$name !== void 0
? _original$name
: "null")
(original.source ?? 'null') +
':' +
(original.line ?? 'null') +
':' +
(original.name ?? 'null')
);
}
},
);
} // Taking in a map like
}
// Taking in a map like
// trampoline offset (optional js function name)

@@ -159,9 +183,9 @@ // JS_0158_xxxxxxxxxxxxxxxxxxxxxx fe 91081

symbolicateProfilerMap(mapFile) {
symbolicateProfilerMap(mapFile: string): string {
return fs
.readFileSync(mapFile, "utf8")
.split("\n")
.readFileSync(mapFile, 'utf8')
.split('\n')
.slice(0, -1)
.map(line => {
const line_list = line.split(" ");
const line_list = line.split(' ');
const trampoline = line_list[0];

@@ -172,3 +196,3 @@ const js_name = line_list[1];

if (!offset) {
return trampoline + " " + trampoline;
return trampoline + ' ' + trampoline;
}

@@ -178,16 +202,17 @@

this.options.inputLineStart,
offset
offset,
);
return (
trampoline +
" " +
' ' +
(original.name || js_name) +
"::" +
[original.source, original.line, original.column].join(":")
'::' +
[original.source, original.line, original.column].join(':')
);
})
.join("\n");
.join('\n');
}
symbolicateAttribution(obj) {
symbolicateAttribution(obj: SizeAttributionMap): void {
const loc = obj.location;

@@ -198,2 +223,3 @@ const line = loc.line != null ? loc.line : this.options.inputLineStart;

let original = this.getOriginalPositionFor(line, column, file);
const isBytecodeRange =

@@ -204,3 +230,5 @@ loc.bytecodeSize != null &&

const virtualOffset = Number(loc.virtualOffset);
const bytecodeSize = Number(loc.bytecodeSize); // Functions compiled from Metro-bundled modules will often have a little bit
const bytecodeSize = Number(loc.bytecodeSize);
// Functions compiled from Metro-bundled modules will often have a little bit
// of unmapped wrapper code right at the beginning - which is where we query.

@@ -213,3 +241,2 @@ // Let's attribute them to where the inner module code originates instead.

// happen for function bodies that never throw (generally very short).
while (

@@ -226,28 +253,34 @@ isBytecodeRange &&

line: original.line,
column: original.column
column: original.column,
};
} // Symbolicate chrome trace "stackFrames" section.
}
// Symbolicate chrome trace "stackFrames" section.
// Each frame in it has three fields: name, funcVirtAddr(optional), offset(optional).
// funcVirtAddr and offset are only available if trace is generated from
// hbc bundle without debug info.
symbolicateChromeTrace(traceFile, _ref) {
let stdout = _ref.stdout,
stderr = _ref.stderr;
const content = JSON.parse(fs.readFileSync(traceFile, "utf8"));
symbolicateChromeTrace(
traceFile: string,
{
stdout,
stderr,
}: {
stdout: stream$Writable,
stderr: stream$Writable,
...
},
): void {
const content: ChromeTrace = JSON.parse(fs.readFileSync(traceFile, 'utf8'));
if (content.stackFrames == null) {
throw new Error("Unable to locate `stackFrames` section in trace.");
throw new Error('Unable to locate `stackFrames` section in trace.');
}
const keys = Object.keys(content.stackFrames);
stdout.write("Processing " + keys.length + " frames\n");
stdout.write('Processing ' + keys.length + ' frames\n');
keys.forEach(key => {
var _addressOriginal$sour, _addressOriginal$line, _addressOriginal$colu;
const entry = content.stackFrames[key];
let line;
let column; // Function entrypoint line/column; used for symbolicating function name
let column;
// Function entrypoint line/column; used for symbolicating function name
// with legacy source maps (or when --no-function-names is set).
let funcLine;

@@ -259,5 +292,5 @@ let funcColumn;

const funcVirtAddr = parseInt(entry.funcVirtAddr, 10);
const offsetInFunction = parseInt(entry.offset, 10); // Main bundle always use hard-coded line value 1.
const offsetInFunction = parseInt(entry.offset, 10);
// Main bundle always use hard-coded line value 1.
// TODO: support multiple bundle/module.
line = this.options.inputLineStart;

@@ -274,2 +307,3 @@ column = funcVirtAddr + offsetInFunction;

column = entry.column;
funcLine = entry.funcLine;

@@ -280,18 +314,18 @@ funcColumn = entry.funcColumn;

return;
} // Symbolicate original file/line/column.
}
// Symbolicate original file/line/column.
const addressOriginal = this.getOriginalPositionDetailsFor(line, column);
let frameName;
if (addressOriginal.functionName) {
frameName = addressOriginal.functionName;
} else {
frameName = entry.name; // Symbolicate function name.
frameName = entry.name;
// Symbolicate function name.
if (funcLine != null && funcColumn != null) {
const funcOriginal = this.getOriginalPositionFor(
funcLine,
funcColumn
funcColumn,
);
if (funcOriginal.name != null) {

@@ -303,30 +337,23 @@ frameName = funcOriginal.name;

(stderr || stdout).write(
"Warning: no function prolog line/column info; name may be wrong\n"
'Warning: no function prolog line/column info; name may be wrong\n',
);
}
} // Output format is: funcName(file:line:column)
}
// Output format is: funcName(file:line:column)
entry.name = [
frameName,
"(",
'(',
[
(_addressOriginal$sour = addressOriginal.source) !== null &&
_addressOriginal$sour !== void 0
? _addressOriginal$sour
: "null",
(_addressOriginal$line = addressOriginal.line) !== null &&
_addressOriginal$line !== void 0
? _addressOriginal$line
: "null",
(_addressOriginal$colu = addressOriginal.column) !== null &&
_addressOriginal$colu !== void 0
? _addressOriginal$colu
: "null"
].join(":"),
")"
].join("");
addressOriginal.source ?? 'null',
addressOriginal.line ?? 'null',
addressOriginal.column ?? 'null',
].join(':'),
')',
].join('');
});
stdout.write("Writing to " + traceFile + "\n");
stdout.write('Writing to ' + traceFile + '\n');
fs.writeFileSync(traceFile, JSON.stringify(content));
}
/*

@@ -336,8 +363,16 @@ * A helper function to return a mapping {line, column} object for a given input

*/
getOriginalPositionFor(lineNumber, columnNumber, moduleIds) {
getOriginalPositionFor(
lineNumber: ?number,
columnNumber: ?number,
moduleIds: ?ModuleIdsT,
): {|
line: ?number,
column: ?number,
source: ?string,
name: ?string,
|} {
const position = this.getOriginalPositionDetailsFor(
lineNumber,
columnNumber,
moduleIds
moduleIds,
);

@@ -348,5 +383,6 @@ return {

source: position.source,
name: position.functionName ? position.functionName : position.name
name: position.functionName ? position.functionName : position.name,
};
}
/*

@@ -356,6 +392,8 @@ * Symbolicates the JavaScript stack trace extracted from the minidump

*/
symbolicateHermesMinidumpTrace(
crashInfo: HermesMinidumpCrashInfo,
): SymbolicatedStackTrace {
throw new Error('Not implemented');
}
symbolicateHermesMinidumpTrace(crashInfo) {
throw new Error("Not implemented");
}
/*

@@ -366,26 +404,42 @@ * An internal helper function similar to getOriginalPositionFor. This one

*/
getOriginalPositionDetailsFor(lineNumber, columnNumber, moduleIds) {
throw new Error("Not implemented");
getOriginalPositionDetailsFor(
lineNumber: ?number,
columnNumber: ?number,
moduleIds: ?ModuleIdsT,
): SymbolicatedStackFrame {
throw new Error('Not implemented');
}
parseFileName(str) {
throw new Error("Not implemented");
parseFileName(str: string): ModuleIdsT {
throw new Error('Not implemented');
}
}
class SingleMapSymbolicationContext extends SymbolicationContext {
constructor(SourceMapConsumer, sourceMapContent) {
let options =
arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
class SingleMapSymbolicationContext extends SymbolicationContext<SingleMapModuleIds> {
+_segments: {
+[id: string]: {|
+consumer: SourceMapConsumer,
+moduleOffsets: $ReadOnlyArray<number>,
+sourceFunctionsConsumer: ?SourceMetadataMapConsumer,
+hermesOffsets: ?HermesFunctionOffsets,
|},
...,
};
+_hasLegacySegments: boolean;
+_SourceMapConsumer: SourceMapConsumer;
constructor(
SourceMapConsumer: SourceMapConsumer,
sourceMapContent: string | MixedSourceMap,
options: ContextOptionsInput = {},
) {
super(options);
this._SourceMapConsumer = SourceMapConsumer;
const sourceMapJson =
typeof sourceMapContent === "string"
? JSON.parse(sourceMapContent.replace(/^\)\]\}'/, ""))
const sourceMapJson: MixedSourceMap =
typeof sourceMapContent === 'string'
? JSON.parse(sourceMapContent.replace(/^\)\]\}'/, ''))
: sourceMapContent;
const segments = {
"0": this._initSegment(sourceMapJson)
'0': this._initSegment(sourceMapJson),
};
if (sourceMapJson.x_facebook_segments) {

@@ -397,3 +451,2 @@ for (const key of Object.keys(sourceMapJson.x_facebook_segments)) {

}
this._hasLegacySegments = sourceMapJson.x_facebook_segments != null;

@@ -404,29 +457,27 @@ this._segments = segments;

_initSegment(map) {
const useFunctionNames = this.options.nameSource === "function_names";
const SourceMapConsumer = this._SourceMapConsumer;
const useFunctionNames = this.options.nameSource === 'function_names';
const {_SourceMapConsumer: SourceMapConsumer} = this;
return {
get consumer() {
Object.defineProperty(this, "consumer", {
value: new SourceMapConsumer(map)
Object.defineProperty(this, 'consumer', {
value: new SourceMapConsumer(map),
});
return this.consumer;
},
moduleOffsets: map.x_facebook_offsets || [],
get sourceFunctionsConsumer() {
Object.defineProperty(this, "sourceFunctionsConsumer", {
value: useFunctionNames ? new SourceMetadataMapConsumer(map) : null
Object.defineProperty(this, 'sourceFunctionsConsumer', {
value: useFunctionNames ? new SourceMetadataMapConsumer(map) : null,
});
return this.sourceFunctionsConsumer;
},
hermesOffsets: map.x_hermes_function_offsets
hermesOffsets: map.x_hermes_function_offsets,
};
}
symbolicateHermesMinidumpTrace(crashInfo) {
symbolicateHermesMinidumpTrace(
crashInfo: HermesMinidumpCrashInfo,
): SymbolicatedStackTrace {
const symbolicatedTrace = [];
const callstack = crashInfo.callstack;
const {callstack} = crashInfo;
if (callstack != null) {

@@ -437,6 +488,8 @@ for (const stackItem of callstack) {

} else {
const CJSModuleOffset = stackItem.CJSModuleOffset,
SourceURL = stackItem.SourceURL,
FunctionID = stackItem.FunctionID,
localOffset = stackItem.ByteCodeOffset;
const {
CJSModuleOffset,
SourceURL,
FunctionID,
ByteCodeOffset: localOffset,
} = stackItem;
const moduleInformation = this._hasLegacySegments

@@ -446,12 +499,6 @@ ? this.parseFileName(SourceURL)

const generatedLine = CJSModuleOffset + this.options.inputLineStart;
const segment = this._segments[
moduleInformation.segmentId.toString()
];
const hermesOffsets =
segment === null || segment === void 0
? void 0
: segment.hermesOffsets;
const hermesOffsets = segment?.hermesOffsets;
if (!hermesOffsets) {

@@ -463,3 +510,3 @@ symbolicatedTrace.push({

functionName: null,
name: null
name: null,
});

@@ -475,3 +522,3 @@ } else {

generatedColumn,
moduleInformation
moduleInformation,
);

@@ -483,5 +530,5 @@ symbolicatedTrace.push(originalPosition);

}
return symbolicatedTrace;
}
/*

@@ -492,4 +539,7 @@ * An internal helper function similar to getOriginalPositionFor. This one

*/
getOriginalPositionDetailsFor(lineNumber, columnNumber, moduleIds) {
getOriginalPositionDetailsFor(
lineNumber: ?number,
columnNumber: ?number,
moduleIds: ?SingleMapModuleIds,
): SymbolicatedStackFrame {
// Adjust arguments to source-map's input coordinates

@@ -510,28 +560,21 @@ lineNumber =

let moduleLineOffset = 0;
const metadata = this._segments[moduleIds.segmentId + ""];
const _moduleIds = moduleIds,
localId = _moduleIds.localId;
const metadata = this._segments[moduleIds.segmentId + ''];
const {localId} = moduleIds;
if (localId != null) {
const moduleOffsets = metadata.moduleOffsets;
const {moduleOffsets} = metadata;
if (!moduleOffsets) {
throw new Error(
"Module ID given for a source map that does not have " +
"an x_facebook_offsets field"
'Module ID given for a source map that does not have ' +
'an x_facebook_offsets field',
);
}
if (moduleOffsets[localId] == null) {
throw new Error("Unknown module ID: " + localId);
throw new Error('Unknown module ID: ' + localId);
}
moduleLineOffset = moduleOffsets[localId];
}
const original = metadata.consumer.originalPositionFor({
line: Number(lineNumber) + moduleLineOffset,
column: Number(columnNumber)
column: Number(columnNumber),
});
if (metadata.sourceFunctionsConsumer) {

@@ -543,20 +586,16 @@ original.functionName =

}
return _objectSpread(
_objectSpread({}, original),
{},
{
line:
original.line != null
? original.line - 1 + this.options.outputLineStart
: original.line,
column:
original.column != null
? original.column - 0 + this.options.outputColumnStart
: original.column
}
);
return {
...original,
line:
original.line != null
? original.line - 1 + this.options.outputLineStart
: original.line,
column:
original.column != null
? original.column - 0 + this.options.outputColumnStart
: original.column,
};
}
parseFileName(str) {
parseFileName(str: string): SingleMapModuleIds {
return parseSingleMapFileName(str);

@@ -566,6 +605,12 @@ }

class DirectorySymbolicationContext extends SymbolicationContext {
constructor(SourceMapConsumer, rootDir) {
let options =
arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
class DirectorySymbolicationContext extends SymbolicationContext<string> {
+_fileMaps: Map<string, SingleMapSymbolicationContext>;
+_rootDir: string;
+_SourceMapConsumer: SourceMapConsumer;
constructor(
SourceMapConsumer: SourceMapConsumer,
rootDir: string,
options: ContextOptionsInput = {},
) {
super(options);

@@ -577,22 +622,19 @@ this._fileMaps = new Map();

_loadMap(mapFilename) {
_loadMap(mapFilename: string): SingleMapSymbolicationContext {
invariant(
fs.existsSync(mapFilename),
`Could not read source map from '${mapFilename}'`
`Could not read source map from '${mapFilename}'`,
);
let fileMap = this._fileMaps.get(mapFilename);
if (fileMap == null) {
fileMap = new SingleMapSymbolicationContext(
this._SourceMapConsumer,
fs.readFileSync(mapFilename, "utf8"),
this.options
fs.readFileSync(mapFilename, 'utf8'),
this.options,
);
this._fileMaps.set(mapFilename, fileMap);
}
return fileMap;
}
/*

@@ -603,10 +645,12 @@ * An internal helper function similar to getOriginalPositionFor. This one

*/
getOriginalPositionDetailsFor(lineNumber, columnNumber, filename) {
getOriginalPositionDetailsFor(
lineNumber: ?number,
columnNumber: ?number,
filename: ?string,
): SymbolicatedStackFrame {
invariant(
filename != null,
"filename is required for DirectorySymbolicationContext"
'filename is required for DirectorySymbolicationContext',
);
const mapFilename = path.join(this._rootDir, filename + ".map");
const mapFilename = path.join(this._rootDir, filename + '.map');
if (!fs.existsSync(mapFilename)) {

@@ -626,2 +670,3 @@ // Adjust arguments to the output coordinates

: columnNumber;
return {

@@ -632,16 +677,16 @@ line: lineNumber,

name: null,
functionName: null
functionName: null,
};
}
return this._loadMap(mapFilename).getOriginalPositionDetailsFor(
lineNumber,
columnNumber
columnNumber,
);
}
parseFileName(str) {
parseFileName(str: string): string {
return str;
}
}
/*

@@ -657,64 +702,85 @@ * If the file name of a stack frame is numeric (+ ".js"), we assume it's a

*/
function parseSingleMapFileName(str) {
function parseSingleMapFileName(str: string): SingleMapModuleIds {
const modMatch = str.match(/^(\d+).js$/);
if (modMatch != null) {
return {
segmentId: 0,
localId: Number(modMatch[1])
};
return {segmentId: 0, localId: Number(modMatch[1])};
}
const segMatch = str.match(/^seg-(\d+)(?:_(\d+))?.js$/);
if (segMatch != null) {
return {
segmentId: Number(segMatch[1]),
localId: segMatch[2] ? Number(segMatch[2]) : null
localId: segMatch[2] ? Number(segMatch[2]) : null,
};
}
return UNKNOWN_MODULE_IDS;
}
function createContext(SourceMapConsumer, sourceMapContent) {
let options =
arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
function createContext(
SourceMapConsumer: SourceMapConsumer,
sourceMapContent: string | MixedSourceMap,
options: ContextOptionsInput = {},
): SingleMapSymbolicationContext {
return new SingleMapSymbolicationContext(
SourceMapConsumer,
sourceMapContent,
options
options,
);
}
function unstable_createDirectoryContext(SourceMapConsumer, rootDir) {
let options =
arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
function unstable_createDirectoryContext(
SourceMapConsumer: SourceMapConsumer,
rootDir: string,
options: ContextOptionsInput = {},
): DirectorySymbolicationContext {
return new DirectorySymbolicationContext(SourceMapConsumer, rootDir, options);
}
function getOriginalPositionFor(lineNumber, columnNumber, moduleIds, context) {
function getOriginalPositionFor<ModuleIdsT>(
lineNumber: ?number,
columnNumber: ?number,
moduleIds: ?ModuleIdsT,
context: SymbolicationContext<ModuleIdsT>,
): {|
line: ?number,
column: ?number,
source: ?string,
name: ?string,
|} {
return context.getOriginalPositionFor(lineNumber, columnNumber, moduleIds);
}
function symbolicate(stackTrace, context) {
function symbolicate<ModuleIdsT>(
stackTrace: string,
context: SymbolicationContext<ModuleIdsT>,
): string {
return context.symbolicate(stackTrace);
}
function symbolicateProfilerMap(mapFile, context) {
function symbolicateProfilerMap<ModuleIdsT>(
mapFile: string,
context: SymbolicationContext<ModuleIdsT>,
): string {
return context.symbolicateProfilerMap(mapFile);
}
function symbolicateAttribution(obj, context) {
function symbolicateAttribution<ModuleIdsT>(
obj: SizeAttributionMap,
context: SymbolicationContext<ModuleIdsT>,
): void {
context.symbolicateAttribution(obj);
}
function symbolicateChromeTrace(traceFile, _ref2, context) {
let stdout = _ref2.stdout,
stderr = _ref2.stderr;
return context.symbolicateChromeTrace(traceFile, {
function symbolicateChromeTrace<ModuleIdsT>(
traceFile: string,
{
stdout,
stderr
});
stderr,
}: {
stdout: stream$Writable,
stderr: stream$Writable,
...
},
context: SymbolicationContext<ModuleIdsT>,
): void {
return context.symbolicateChromeTrace(traceFile, {stdout, stderr});
}

@@ -731,3 +797,3 @@

symbolicateChromeTrace,
SourceMetadataMapConsumer
SourceMetadataMapConsumer,
};

@@ -34,3 +34,2 @@ /**

var _e = undefined;
try {

@@ -43,3 +42,2 @@ for (

_arr.push(_s.value);
if (i && _arr.length === i) break;

@@ -57,3 +55,2 @@ }

}
return _arr;

@@ -102,5 +99,3 @@ }

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;

@@ -115,2 +110,3 @@ }

const METADATA_FIELD_FUNCTIONS = 0;
/**

@@ -130,3 +126,2 @@ * Consumes the `x_facebook_sources` metadata field from a source map and

*/
class SourceMetadataMapConsumer {

@@ -142,2 +137,3 @@ constructor(map) {

}
/**

@@ -151,3 +147,2 @@ * Retrieves a human-readable name for the function enclosing a particular

*/
functionNameFor(_ref) {

@@ -154,0 +149,0 @@ let line = _ref.line,

@@ -29,3 +29,2 @@ #!/usr/bin/env node

}
if (info.done) {

@@ -44,11 +43,8 @@ resolve(value);

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);

@@ -227,4 +223,5 @@ });

} else {
var _original$source, _original$line, _original$name; // read-from-argv form.
var _original$source, _original$line, _original$name;
// read-from-argv form.
let moduleIds;

@@ -231,0 +228,0 @@

@@ -14,3 +14,2 @@ /**

var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {

@@ -24,3 +23,2 @@ var symbols = Object.getOwnPropertySymbols(object);

}
return keys;

@@ -32,3 +30,2 @@ }

var source = arguments[i] != null ? arguments[i] : {};
if (i % 2) {

@@ -50,3 +47,2 @@ ownKeys(Object(source), true).forEach(function(key) {

}
return target;

@@ -66,3 +62,2 @@ }

}
return obj;

@@ -69,0 +64,0 @@ }

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc