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

@google-cloud/debug-agent

Package Overview
Dependencies
Maintainers
1
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@google-cloud/debug-agent - npm Package Compare versions

Comparing version 5.2.2 to 5.2.3

36

build/src/agent/io/sourcemapper.d.ts
import * as sourceMap from 'source-map';
/** Represents one source map file. */
export interface MapInfoInput {

@@ -13,2 +14,8 @@ outputFile: string;

}
export declare class MultiFileMatchError implements Error {
readonly files: string[];
readonly name = "MultiFileMatchError";
readonly message = "Error: matching multiple files";
constructor(files: string[]);
}
export declare class SourceMapper {

@@ -30,23 +37,18 @@ infoMap: Map<string, MapInfoInput>;

*
* @param inputPath The (possibly relative) path to the original source file.
* @return The `MapInfoInput` object that describes the transpiled file
* associated with the specified input path. `null` is returned if either
* zero files are associated with the input path or if more than one file
* could possibly be associated with the given input path.
*/
private getMappingInfo;
/**
* Used to determine if the source file specified by the given path has
* a .map file and an output file associated with it.
* If there are more than one matches, throw the error to include all the
* matched candidates.
*
* If there is no such mapping, it could be because the input file is not
* the input to a transpilation process or it is the input to a transpilation
* process but its corresponding .map file was not given to the constructor
* of this mapper.
* process but its corresponding .map file was not given to the constructor of
* this mapper.
*
* @param {string} inputPath The path to an input file that could
* possibly be the input to a transpilation process. The path should be
* relative to the process's current working directory.
* @param inputPath The path to an input file that could possibly be the input
* to a transpilation process.
* The path can be relative to the process's current working directory.
* @return The `MapInfoInput` object that describes the transpiled file
* associated with the specified input path. `null` is returned if there is
* no files that are associated with the input path.
*/
hasMappingInfo(inputPath: string): boolean;
getMapInfoInput(inputPath: string): MapInfoInput | null;
/**

@@ -71,4 +73,4 @@ * @param {string} inputPath The path to an input file that could possibly

*/
mappingInfo(inputPath: string, lineNumber: number, colNumber: number): MapInfoOutput | null;
getMapInfoOutput(inputPath: string, lineNumber: number, colNumber: number, entry: MapInfoInput): MapInfoOutput | null;
}
export declare function create(sourcemapPaths: string[]): Promise<SourceMapper>;

@@ -16,3 +16,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.create = exports.SourceMapper = void 0;
exports.create = exports.SourceMapper = exports.MultiFileMatchError = void 0;
const fs = require("fs");

@@ -28,2 +28,10 @@ const pLimit = require("p-limit");

/** @define {string} */ const MAP_EXT = '.map';
class MultiFileMatchError {
constructor(files) {
this.files = files;
this.name = 'MultiFileMatchError';
this.message = 'Error: matching multiple files';
}
}
exports.MultiFileMatchError = MultiFileMatchError;
/**

@@ -139,9 +147,18 @@ * @param {!Map} infoMap The map that maps input source files to

*
* @param inputPath The (possibly relative) path to the original source file.
* If there are more than one matches, throw the error to include all the
* matched candidates.
*
* If there is no such mapping, it could be because the input file is not
* the input to a transpilation process or it is the input to a transpilation
* process but its corresponding .map file was not given to the constructor of
* this mapper.
*
* @param inputPath The path to an input file that could possibly be the input
* to a transpilation process.
* The path can be relative to the process's current working directory.
* @return The `MapInfoInput` object that describes the transpiled file
* associated with the specified input path. `null` is returned if either
* zero files are associated with the input path or if more than one file
* could possibly be associated with the given input path.
* associated with the specified input path. `null` is returned if there is
* no files that are associated with the input path.
*/
getMappingInfo(inputPath) {
getMapInfoInput(inputPath) {
if (this.infoMap.has(path.normalize(inputPath))) {

@@ -154,21 +171,8 @@ return this.infoMap.get(inputPath);

}
if (matches.length > 1) {
throw new MultiFileMatchError(matches);
}
return null;
}
/**
* Used to determine if the source file specified by the given path has
* a .map file and an output file associated with it.
*
* If there is no such mapping, it could be because the input file is not
* the input to a transpilation process or it is the input to a transpilation
* process but its corresponding .map file was not given to the constructor
* of this mapper.
*
* @param {string} inputPath The path to an input file that could
* possibly be the input to a transpilation process. The path should be
* relative to the process's current working directory.
*/
hasMappingInfo(inputPath) {
return this.getMappingInfo(inputPath) !== null;
}
/**
* @param {string} inputPath The path to an input file that could possibly

@@ -192,9 +196,5 @@ * be the input to a transpilation process. The path should be relative to

*/
mappingInfo(inputPath, lineNumber, colNumber) {
getMapInfoOutput(inputPath, lineNumber, colNumber, entry) {
var _a;
inputPath = path.normalize(inputPath);
const entry = this.getMappingInfo(inputPath);
if (entry === null) {
return null;
}
const relPath = path

@@ -201,0 +201,0 @@ .relative(path.dirname(entry.mapFile), inputPath)

@@ -11,2 +11,2 @@ import * as estree from 'estree';

*/
export declare function isValid(node: estree.Node): boolean;
export declare function isValid(node: estree.Node | null): boolean;

@@ -22,2 +22,3 @@ "use strict";

const status_message_1 = require("../../client/stackdriver/status-message");
const sourcemapper_1 = require("../io/sourcemapper");
const state = require("../state/inspector-state");

@@ -103,3 +104,16 @@ const utils = require("../util/utils");

const baseScriptPath = path.normalize(breakpoint.location.path);
if (!this.sourcemapper.hasMappingInfo(baseScriptPath)) {
let mapInfoInput = null;
try {
mapInfoInput = this.sourcemapper.getMapInfoInput(baseScriptPath);
}
catch (error) {
if (error instanceof sourcemapper_1.MultiFileMatchError) {
this.logger.warn(`Unable to unambiguously find ${baseScriptPath}. Multiple matches: ${error.files}`);
return utils.setErrorStatusAndCallback(cb, breakpoint, status_message_1.StatusMessage.BREAKPOINT_SOURCE_LOCATION, utils.messages.SOURCE_FILE_AMBIGUOUS);
}
else {
throw error;
}
}
if (mapInfoInput === null) {
const extension = path.extname(baseScriptPath);

@@ -114,3 +128,3 @@ if (!this.config.javascriptFileExtensions.includes(extension)) {

const column = 0;
const mapInfo = this.sourcemapper.mappingInfo(baseScriptPath, line, column);
const mapInfo = this.sourcemapper.getMapInfoOutput(baseScriptPath, line, column, mapInfoInput);
const compile = utils.getBreakpointCompiler(breakpoint);

@@ -117,0 +131,0 @@ if (breakpoint.condition && compile) {

@@ -87,3 +87,4 @@ "use strict";

const baseScriptPath = path.normalize(breakpoint.location.path);
if (!this.sourcemapper.hasMappingInfo(baseScriptPath)) {
const mapInfoInput = this.sourcemapper.getMapInfoInput(baseScriptPath);
if (mapInfoInput === null) {
const extension = path.extname(baseScriptPath);

@@ -98,3 +99,3 @@ if (!this.config.javascriptFileExtensions.includes(extension)) {

const column = 0;
const mapInfo = this.sourcemapper.mappingInfo(baseScriptPath, line, column);
const mapInfo = this.sourcemapper.getMapInfoOutput(baseScriptPath, line, column, mapInfoInput);
const compile = utils.getBreakpointCompiler(breakpoint);

@@ -101,0 +102,0 @@ if (breakpoint.condition && compile) {

{
"name": "@google-cloud/debug-agent",
"version": "5.2.2",
"version": "5.2.3",
"author": "Google Inc.",

@@ -44,5 +44,3 @@ "description": "Stackdriver Debug Agent for Node.js",

"clean": "gts clean",
"precompile": "gts clean",
"api-extractor": "api-extractor run --local",
"api-documenter": "api-documenter yaml --input-folder=temp"
"precompile": "gts clean"
},

@@ -66,3 +64,3 @@ "dependencies": {

"@types/console-log-level": "^1.4.0",
"@types/estree": "0.0.45",
"@types/estree": "0.0.48",
"@types/extend": "^3.0.0",

@@ -91,6 +89,4 @@ "@types/mocha": "^8.0.0",

"typescript": "^3.8.3",
"uuid": "^8.0.0",
"@microsoft/api-documenter": "^7.8.10",
"@microsoft/api-extractor": "^7.8.10"
"uuid": "^8.0.0"
}
}

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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