node-opcua-debug
Advanced tools
Comparing version 2.52.0 to 2.55.0
@@ -0,0 +0,0 @@ const fs = require("fs"); |
@@ -1,2 +0,2 @@ | ||
export declare function dump(obj: any): void; | ||
export declare function dumpIf(condition: boolean, obj: any): void; | ||
export declare function dump(obj: unknown): void; | ||
export declare function dumpIf(condition: boolean, obj: unknown): void; |
/// <reference types="node" /> | ||
export declare function inlineText(f: any): string; | ||
export declare function makeBufferFromTrace(func: string | Function): Buffer; | ||
export declare function inlineText(f: { | ||
toString(): string; | ||
}): string; | ||
export declare function makeBufferFromTrace(func: string | (() => void)): Buffer; |
@@ -11,4 +11,4 @@ "use strict"; | ||
.toString() | ||
.replace(/^[^\/]+\/\*!?/, "") | ||
.replace(/\*\/[^\/]+$/, ""); | ||
.replace(/^[^/]+\/\*!?/, "") | ||
.replace(/\*\/[^/]+$/, ""); | ||
k = k | ||
@@ -22,6 +22,6 @@ .split("\n") | ||
function hexString(str) { | ||
let hexline = ""; | ||
let hexLine = ""; | ||
let lines = str.split("\n"); | ||
if (lines.length === 0) { | ||
return hexline; | ||
return hexLine; | ||
} | ||
@@ -32,3 +32,3 @@ while (lines.length && lines[0].length === 0) { | ||
// find prefix | ||
const prefixLength = lines[0].match(/[0-9a-fA-F:]*\ +/)[0].length; | ||
const prefixLength = lines[0].match(/[0-9a-fA-F:]* +/)[0].length; | ||
for (let line of lines) { | ||
@@ -38,14 +38,14 @@ line = line.trim(); | ||
line = line.substr(10, 98).trim(); | ||
hexline = hexline ? hexline + " " + line : line; | ||
hexLine = hexLine ? hexLine + " " + line : line; | ||
} | ||
else if (line.length > 60) { | ||
line = line.substr(7, 48).trim(); | ||
hexline = hexline ? hexline + " " + line : line; | ||
hexLine = hexLine ? hexLine + " " + line : line; | ||
} | ||
else if (line.length > prefixLength) { | ||
line = line.substr(prefixLength, prefixLength + 48).trim(); | ||
hexline = hexline ? hexline + " " + line : line; | ||
hexLine = hexLine ? hexLine + " " + line : line; | ||
} | ||
} | ||
return hexline; | ||
return hexLine; | ||
} | ||
@@ -52,0 +52,0 @@ // tslint:disable:ban-types |
/// <reference types="node" /> | ||
/** | ||
* @module node-opcua-debug | ||
*/ | ||
import { EventEmitter } from "events"; | ||
@@ -15,3 +18,3 @@ export declare function setDebugFlag(scriptFullPath: string, flag: boolean): void; | ||
constructor(); | ||
on(eventName: "warningMessage" | "errorMessage", eventHandler: any): this; | ||
on(eventName: "warningMessage" | "errorMessage", eventHandler: () => void): this; | ||
} | ||
@@ -18,0 +21,0 @@ export declare const messageLogger: MessageLogger; |
@@ -8,6 +8,5 @@ "use strict"; | ||
// tslint:disable:no-console | ||
const chalk = require("chalk"); | ||
const events_1 = require("events"); | ||
const path_1 = require("path"); | ||
const util_1 = require("util"); | ||
const chalk = require("chalk"); | ||
const debugFlags = {}; | ||
@@ -17,5 +16,5 @@ const sTraceFlag = process.env && process.env.DEBUG; | ||
if (process.env && false) { | ||
// this code can be activated to help detecting | ||
// when a external module overwrite one of the | ||
// environement variable that we may be using as well. | ||
// this code can be activated to help detecting | ||
// when a external module overwrite one of the | ||
// environment variable that we may be using as well. | ||
const old = Object.assign({}, process.env); | ||
@@ -38,3 +37,4 @@ const handler = { | ||
function extractBasename(name) { | ||
return (0, path_1.basename)(name).replace(/\.(js|ts)$/, ""); | ||
// return basename(name).replace(/\.(js|ts)$/, ""); | ||
return name.replace(/(.*[\\|/])?/g, "").replace(/\.(js|ts)$/, ""); | ||
} | ||
@@ -56,3 +56,3 @@ function w(str, l) { | ||
let doDebug = debugFlags[filename]; | ||
if (sTraceFlag && !debugFlags.hasOwnProperty(filename)) { | ||
if (sTraceFlag && !Object.prototype.hasOwnProperty.call(debugFlags, filename)) { | ||
doDebug = sTraceFlag.indexOf(filename) >= 0 || sTraceFlag.indexOf("ALL") >= 0; | ||
@@ -92,3 +92,3 @@ setDebugFlag(filename, doDebug); | ||
const a2 = Object.values(args1); | ||
const output = util_1.format.apply(null, a2); | ||
const output = (0, util_1.format)(...a2); | ||
let a1 = [buildPrefix(mode)]; | ||
@@ -98,3 +98,3 @@ let i = 0; | ||
const lineArguments = [].concat(a1, [line]); | ||
console.log.apply(console, lineArguments); | ||
console.log(...lineArguments); | ||
a1 = [continuation]; | ||
@@ -104,3 +104,3 @@ i = i + 1; | ||
const a3 = a1.concat([" .... TRUNCATED ....."]); | ||
console.log.apply(console, a3); | ||
console.log(...a3); | ||
break; | ||
@@ -107,0 +107,0 @@ } |
export * from "./distNodeJS"; |
{ | ||
"name": "node-opcua-debug", | ||
"version": "2.52.0", | ||
"version": "2.55.0", | ||
"description": "pure nodejs OPCUA SDK - module -debug", | ||
@@ -12,4 +12,4 @@ "scripts": { | ||
"hexy": "^0.3.2", | ||
"node-opcua-assert": "2.52.0", | ||
"node-opcua-buffer-utils": "2.52.0" | ||
"node-opcua-assert": "2.55.0", | ||
"node-opcua-buffer-utils": "2.55.0" | ||
}, | ||
@@ -37,3 +37,3 @@ "devDependencies": { | ||
"homepage": "http://node-opcua.github.io/", | ||
"gitHead": "3ec6296e8fd4df0e05b9d887f0b7dd20113a9ce1" | ||
"gitHead": "28fdbfe1c5306fd0e69758ccacfa2c6d1722115c" | ||
} |
@@ -0,0 +0,0 @@ /** |
export { getTempFilename } from "./get_temp_filename"; | ||
export { redirectToFile } from "./redirect_to_file"; |
@@ -0,0 +0,0 @@ /** |
@@ -7,6 +7,6 @@ /** | ||
export function dump(obj: any) { | ||
export function dump(obj: unknown): void { | ||
console.log("\n", inspect(JSON.parse(JSON.stringify(obj)), { colors: true, depth: 10 })); | ||
} | ||
export function dumpIf(condition: boolean, obj: any) { | ||
export function dumpIf(condition: boolean, obj: unknown): void { | ||
if (condition) { | ||
@@ -13,0 +13,0 @@ dump(obj); |
@@ -6,3 +6,3 @@ /** | ||
const hexy = require("hexy"); | ||
export function hexDump(buffer: Buffer | null, width: number = 32, maxSize: number = 1024): string { | ||
export function hexDump(buffer: Buffer | null, width = 32, maxSize = 1024): string { | ||
if (!buffer) { | ||
@@ -9,0 +9,0 @@ return "<>"; |
@@ -0,0 +0,0 @@ /** |
@@ -6,7 +6,7 @@ /** | ||
export function inlineText(f: any): string { | ||
export function inlineText(f: { toString(): string}): string { | ||
let k = f | ||
.toString() | ||
.replace(/^[^\/]+\/\*!?/, "") | ||
.replace(/\*\/[^\/]+$/, ""); | ||
.replace(/^[^/]+\/\*!?/, "") | ||
.replace(/\*\/[^/]+$/, ""); | ||
k = k | ||
@@ -20,6 +20,6 @@ .split("\n") | ||
function hexString(str: string): string { | ||
let hexline: string = ""; | ||
let hexLine = ""; | ||
let lines = str.split("\n"); | ||
if (lines.length === 0) { | ||
return hexline; | ||
return hexLine; | ||
} | ||
@@ -30,3 +30,3 @@ while (lines.length && lines[0]!.length === 0) { | ||
// find prefix | ||
const prefixLength = lines[0]!.match(/[0-9a-fA-F:]*\ +/)![0].length; | ||
const prefixLength = lines[0]!.match(/[0-9a-fA-F:]* +/)![0].length; | ||
@@ -37,16 +37,16 @@ for (let line of lines) { | ||
line = line.substr(10, 98).trim(); | ||
hexline = hexline ? hexline + " " + line : line; | ||
hexLine = hexLine ? hexLine + " " + line : line; | ||
} else if (line.length > 60) { | ||
line = line.substr(7, 48).trim(); | ||
hexline = hexline ? hexline + " " + line : line; | ||
hexLine = hexLine ? hexLine + " " + line : line; | ||
} else if (line.length > prefixLength) { | ||
line = line.substr(prefixLength, prefixLength + 48).trim(); | ||
hexline = hexline ? hexline + " " + line : line; | ||
hexLine = hexLine ? hexLine + " " + line : line; | ||
} | ||
} | ||
return hexline; | ||
return hexLine; | ||
} | ||
// tslint:disable:ban-types | ||
export function makeBufferFromTrace(func: string | Function): Buffer { | ||
export function makeBufferFromTrace(func: string | (()=>void)): Buffer { | ||
if (typeof func === "string") { | ||
@@ -53,0 +53,0 @@ return makeBuffer(hexString(func as string)); |
@@ -5,16 +5,15 @@ /** | ||
// tslint:disable:no-console | ||
import * as chalk from "chalk"; | ||
import { EventEmitter } from "events"; | ||
import { basename } from "path"; | ||
import { format } from "util"; | ||
import * as chalk from "chalk"; | ||
const debugFlags: { [id: string]: boolean } = {}; | ||
const sTraceFlag = process.env && process.env.DEBUG as string; | ||
const sTraceFlag = process.env && (process.env.DEBUG as string); | ||
// istanbul ignore next | ||
if (process.env && false) { | ||
// this code can be activated to help detecting | ||
// when a external module overwrite one of the | ||
// environement variable that we may be using as well. | ||
// this code can be activated to help detecting | ||
// when a external module overwrite one of the | ||
// environment variable that we may be using as well. | ||
const old = { ...process.env }; | ||
@@ -26,7 +25,7 @@ const handler = { | ||
set: function (obj: any, prop: string, value: any) { | ||
console.log("setting process.env = prop " + prop) | ||
console.log("setting process.env = prop " + prop); | ||
old[prop] = value; | ||
return true; | ||
} | ||
} | ||
}; | ||
process.env = new Proxy(old, handler); | ||
@@ -40,3 +39,4 @@ } | ||
function extractBasename(name: string): string { | ||
return basename(name).replace(/\.(js|ts)$/, ""); | ||
// return basename(name).replace(/\.(js|ts)$/, ""); | ||
return name.replace(/(.*[\\|/])?/g, "").replace(/\.(js|ts)$/, ""); | ||
} | ||
@@ -48,12 +48,7 @@ | ||
export function setDebugFlag(scriptFullPath: string, flag: boolean) { | ||
export function setDebugFlag(scriptFullPath: string, flag: boolean): void { | ||
const filename = extractBasename(scriptFullPath); | ||
if (sTraceFlag && sTraceFlag.length > 1 && flag) { | ||
const decoratedFilename = chalk.yellow(w(filename, 60)); | ||
console.log( | ||
" Setting debug for ", | ||
decoratedFilename, | ||
" to ", | ||
(flag ? chalk.cyan : chalk.red)(flag.toString(), sTraceFlag) | ||
); | ||
console.log(" Setting debug for ", decoratedFilename, " to ", (flag ? chalk.cyan : chalk.red)(flag.toString(), sTraceFlag)); | ||
} | ||
@@ -66,3 +61,3 @@ debugFlags[filename] = flag; | ||
let doDebug: boolean = debugFlags[filename]; | ||
if (sTraceFlag && !debugFlags.hasOwnProperty(filename)) { | ||
if (sTraceFlag && !Object.prototype.hasOwnProperty.call(debugFlags, filename)) { | ||
doDebug = sTraceFlag.indexOf(filename) >= 0 || sTraceFlag.indexOf("ALL") >= 0; | ||
@@ -103,3 +98,3 @@ setDebugFlag(filename, doDebug); | ||
const a2 = Object.values(args1) as [string, ...string[]]; | ||
const output = format.apply(null, a2); | ||
const output = format(...a2); | ||
let a1 = [buildPrefix(mode)]; | ||
@@ -110,3 +105,3 @@ | ||
const lineArguments = ([] as string[]).concat(a1, [line]) as [string, ...string[]]; | ||
console.log.apply(console, lineArguments); | ||
console.log(...lineArguments); | ||
a1 = [continuation]; | ||
@@ -116,3 +111,3 @@ i = i + 1; | ||
const a3 = a1.concat([" .... TRUNCATED ....."]); | ||
console.log.apply(console, a3 as [string, ...string[]]); | ||
console.log(...(a3 as [string, ...string[]])); | ||
break; | ||
@@ -147,3 +142,3 @@ } | ||
} | ||
public on(eventName: "warningMessage" | "errorMessage", eventHandler: any): this { | ||
public on(eventName: "warningMessage" | "errorMessage", eventHandler: () => void): this { | ||
return super.on(eventName, eventHandler); | ||
@@ -150,0 +145,0 @@ } |
@@ -0,0 +0,0 @@ const nonTextReg = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g; |
@@ -0,0 +0,0 @@ { |
@@ -0,0 +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 not supported yet
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
46944
+ Addednode-opcua-assert@2.55.0(transitive)
+ Addednode-opcua-buffer-utils@2.55.0(transitive)
- Removedansi-regex@2.1.1(transitive)
- Removedboolbase@1.0.0(transitive)
- Removedcss-select@4.3.0(transitive)
- Removedcss-what@6.1.0(transitive)
- Removeddom-converter@0.2.0(transitive)
- Removeddom-serializer@1.4.1(transitive)
- Removeddomelementtype@2.3.0(transitive)
- Removeddomhandler@4.3.1(transitive)
- Removeddomutils@2.8.0(transitive)
- Removedentities@2.2.0(transitive)
- Removedhtmlparser2@6.1.0(transitive)
- Removedlodash@4.17.21(transitive)
- Removednode-opcua-assert@2.52.0(transitive)
- Removednode-opcua-buffer-utils@2.52.0(transitive)
- Removednth-check@2.1.1(transitive)
- Removedpretty-error@3.0.4(transitive)
- Removedrenderkid@2.0.7(transitive)
- Removedstrip-ansi@3.0.1(transitive)
- Removedutila@0.4.0(transitive)
Updatednode-opcua-assert@2.55.0