@tapjs/processinfo
Advanced tools
Comparing version 3.1.4 to 3.1.5
@@ -20,2 +20,4 @@ "use strict"; | ||
return sm; | ||
// only throws on node 20 | ||
/* c8 ignore start */ | ||
} | ||
@@ -25,4 +27,5 @@ catch { | ||
} | ||
/* c8 ignore stop */ | ||
}; | ||
exports.findSourceMapSafe = findSourceMapSafe; | ||
//# sourceMappingURL=find-source-map-safe.js.map |
@@ -24,5 +24,3 @@ "use strict"; | ||
return; | ||
const ll = content | ||
.split(/\n|\u2028|\u2029/) | ||
.map(l => l.length); | ||
const ll = content.split(/\n|\u2028|\u2029/).map(l => l.length); | ||
cache.set(filename, ll); | ||
@@ -29,0 +27,0 @@ }; |
export declare const sourcesCache: Map<string, string[]>; | ||
export declare const loadPendingSourceMaps: () => void; | ||
export declare const lookupSources: (url: string) => string[] | undefined; | ||
export declare const getSources: () => Map<string, string[]>; | ||
export declare const lookupSources: (url: string, processEnd?: boolean) => string[] | undefined; | ||
export declare const getSources: (processEnd?: boolean) => Map<string, string[]>; | ||
export declare const likelyHasSourceMap: (url: string) => void; | ||
//# sourceMappingURL=lookup-sources.d.ts.map |
@@ -27,2 +27,4 @@ "use strict"; | ||
const sm = (0, find_source_map_safe_js_1.findSourceMapSafe)(url); | ||
// only possible on node 19+ | ||
/* c8 ignore start */ | ||
if (sm === false) { | ||
@@ -35,2 +37,3 @@ // can only happen if node found the SM comment, and tried to load it, | ||
else { | ||
/* c8 ignore stop */ | ||
const sources = sm?.payload?.sources; | ||
@@ -45,7 +48,11 @@ if (sources) { | ||
exports.loadPendingSourceMaps = loadPendingSourceMaps; | ||
const lookupSources = (url) => (0, exports.getSources)().get(url); | ||
const lookupSources = (url, processEnd) => (0, exports.getSources)(processEnd).get(url); | ||
exports.lookupSources = lookupSources; | ||
const getSources = () => { | ||
if (maybeSM.size) | ||
let didFinalLookupAttempt = false; | ||
const getSources = (processEnd = false) => { | ||
if (maybeSM.size && (!processEnd || !didFinalLookupAttempt)) { | ||
if (processEnd) | ||
didFinalLookupAttempt = true; | ||
(0, exports.loadPendingSourceMaps)(); | ||
} | ||
return exports.sourcesCache; | ||
@@ -52,0 +59,0 @@ }; |
@@ -109,3 +109,3 @@ "use strict"; | ||
// attach a tapmock search param, which is in node's internal key. | ||
const sources = (0, lookup_sources_js_1.lookupSources)(obj.url); | ||
const sources = (0, lookup_sources_js_1.lookupSources)(obj.url, true); | ||
if (!fileCovered(f, sources, processInfo.files)) { | ||
@@ -112,0 +112,0 @@ return false; |
@@ -17,2 +17,4 @@ import { findSourceMap } from 'module'; | ||
return sm; | ||
// only throws on node 20 | ||
/* c8 ignore start */ | ||
} | ||
@@ -22,3 +24,4 @@ catch { | ||
} | ||
/* c8 ignore stop */ | ||
}; | ||
//# sourceMappingURL=find-source-map-safe.js.map |
@@ -21,5 +21,3 @@ // TODO: Refactor once https://github.com/nodejs/node/issues/48460 fixed | ||
return; | ||
const ll = content | ||
.split(/\n|\u2028|\u2029/) | ||
.map(l => l.length); | ||
const ll = content.split(/\n|\u2028|\u2029/).map(l => l.length); | ||
cache.set(filename, ll); | ||
@@ -26,0 +24,0 @@ }; |
export declare const sourcesCache: Map<string, string[]>; | ||
export declare const loadPendingSourceMaps: () => void; | ||
export declare const lookupSources: (url: string) => string[] | undefined; | ||
export declare const getSources: () => Map<string, string[]>; | ||
export declare const lookupSources: (url: string, processEnd?: boolean) => string[] | undefined; | ||
export declare const getSources: (processEnd?: boolean) => Map<string, string[]>; | ||
export declare const likelyHasSourceMap: (url: string) => void; | ||
//# sourceMappingURL=lookup-sources.d.ts.map |
@@ -24,2 +24,4 @@ // For some reason that is very mysterious as of the time of writing this, | ||
const sm = findSourceMapSafe(url); | ||
// only possible on node 19+ | ||
/* c8 ignore start */ | ||
if (sm === false) { | ||
@@ -32,2 +34,3 @@ // can only happen if node found the SM comment, and tried to load it, | ||
else { | ||
/* c8 ignore stop */ | ||
const sources = sm?.payload?.sources; | ||
@@ -41,6 +44,10 @@ if (sources) { | ||
}; | ||
export const lookupSources = (url) => getSources().get(url); | ||
export const getSources = () => { | ||
if (maybeSM.size) | ||
export const lookupSources = (url, processEnd) => getSources(processEnd).get(url); | ||
let didFinalLookupAttempt = false; | ||
export const getSources = (processEnd = false) => { | ||
if (maybeSM.size && (!processEnd || !didFinalLookupAttempt)) { | ||
if (processEnd) | ||
didFinalLookupAttempt = true; | ||
loadPendingSourceMaps(); | ||
} | ||
return sourcesCache; | ||
@@ -47,0 +54,0 @@ }; |
@@ -105,3 +105,3 @@ // start tracking coverage, unless disabled explicltly | ||
// attach a tapmock search param, which is in node's internal key. | ||
const sources = lookupSources(obj.url); | ||
const sources = lookupSources(obj.url, true); | ||
if (!fileCovered(f, sources, processInfo.files)) { | ||
@@ -108,0 +108,0 @@ return false; |
{ | ||
"name": "@tapjs/processinfo", | ||
"version": "3.1.4", | ||
"version": "3.1.5", | ||
"files": [ | ||
@@ -5,0 +5,0 @@ "dist" |
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
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
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
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
393883
3152