@alttiri/util-node-js
Advanced tools
Comparing version 2.0.13-20240531 to 2.0.15-20240606
{ | ||
"name": "@alttiri/util-node-js", | ||
"version": "2.0.13-20240531", | ||
"version": "2.0.15-20240606", | ||
"description": "Some Node.js util functions for personal use", | ||
@@ -32,3 +32,3 @@ "keywords": [ | ||
"@types/node": "20.12.12", | ||
"typescript": "5.4.5" | ||
"typescript": "5.5.1-rc" | ||
}, | ||
@@ -35,0 +35,0 @@ "scripts": { |
@@ -1,2 +0,1 @@ | ||
/// <reference types="node" /> | ||
import { Stats } from "fs"; | ||
@@ -3,0 +2,0 @@ export declare function exists(path: string, followSymbol?: boolean): Promise<boolean>; |
@@ -1,2 +0,1 @@ | ||
/// <reference types="node" /> | ||
import { Dirent } from "node:fs"; | ||
@@ -3,0 +2,0 @@ import { ListEntryBaseEx, ListEntryDirent, ListEntryDirentError, ListEntryDirentLink, ListEntryStats, ListEntryStatsAny } from "./types/ListEntry"; |
@@ -1,2 +0,1 @@ | ||
/// <reference types="node" /> | ||
import { Dirent } from "node:fs"; | ||
@@ -3,0 +2,0 @@ import { ListEntryDirent } from "./types/ListEntry"; |
@@ -1,2 +0,1 @@ | ||
/// <reference types="node" /> | ||
import { Dirent, BigIntStats, Stats } from "node:fs"; | ||
@@ -3,0 +2,0 @@ import { IOError } from "./IOError"; |
@@ -1,2 +0,2 @@ | ||
type ConstructorOpts = { | ||
export type ConstructorOpts = { | ||
printSuccess?: boolean; | ||
@@ -7,3 +7,3 @@ testOnly?: number[]; | ||
}; | ||
type TestOpts = { | ||
export type TestOpts = { | ||
result: any; | ||
@@ -17,3 +17,3 @@ expect: any; | ||
}; | ||
type TesterMethods = { | ||
export type TesterMethods = { | ||
/** @deprecated */ | ||
@@ -41,2 +41,6 @@ eq(name: string, result: any, expect: any): void; | ||
} | ||
export {}; | ||
export type LineNumType = { | ||
filename?: string; | ||
lineNum?: string; | ||
column?: string; | ||
}; |
@@ -30,3 +30,3 @@ import { ANSI_BLUE, ANSI_GRAY, ANSI_GREEN_BOLD, ANSI_RED_BOLD } from "./console-colors.js"; | ||
const { result, expect, stackDeep, name = "", printLink = true, autoReport = this.autoReport, printSuccess = this.printSuccess, } = opt; | ||
const { filename, lineNum } = getLineNum(2 + (stackDeep ?? this.stackDeep)); | ||
const { filename, lineNum = 0, column = 0 } = getLineNum(2 + (stackDeep ?? this.stackDeep)); | ||
this.num++; | ||
@@ -53,3 +53,3 @@ if (this.testOnly.length && !this.testOnly.includes(this.num)) { | ||
console.log(ANSI_GRAY("result: "), ANSI_RED_BOLD(result)); | ||
printLink && console.log(`file:///./${filename}:${lineNum}`); // Expects work dir === file location | ||
printLink && console.log(`file:///./${filename}:${lineNum}:${column}`); // Expects work dir === file location | ||
this.failed.push(this.num); | ||
@@ -75,4 +75,4 @@ console.log(ANSI_GRAY("---")); | ||
/** | ||
* @param {number} stackDeep | ||
* @return {{filename?: string, line?: string, column?: string}} | ||
* @param {number} [stackDeep = 2] | ||
* @return {LineNumType} | ||
*/ | ||
@@ -84,3 +84,3 @@ function getLineNum(stackDeep = 2) { | ||
} | ||
const fileLine = errorLines[stackDeep]?.split("/").pop(); | ||
const fileLine = errorLines[stackDeep]?.split(/[\\\/]/).pop(); | ||
const { filename, line, column } = fileLine?.match(/(?<filename>.+):(?<line>\d+):(?<column>\d+)/)?.groups || {}; | ||
@@ -87,0 +87,0 @@ return { filename, lineNum: line, column }; |
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
32989