Launch Week Day 5: Introducing Reachability for PHP.Learn More
Socket
Book a DemoSign in
Socket

@tapjs/processinfo

Package Overview
Dependencies
Maintainers
2
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tapjs/processinfo - npm Package Compare versions

Comparing version
3.1.4
to
3.1.5
+1
-1
dist/commonjs/find-source-map-safe.d.ts.map

@@ -1,1 +0,1 @@

{"version":3,"file":"find-source-map-safe.d.ts","sourceRoot":"","sources":["../../src/find-source-map-safe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,SAAS,EAAE,MAAM,QAAQ,CAAA;AAKjD,eAAO,MAAM,iBAAiB,MACzB,MAAM,GAAG,GAAG,KACd,KAAK,GAAG,SAAS,GAAG,SAetB,CAAA"}
{"version":3,"file":"find-source-map-safe.d.ts","sourceRoot":"","sources":["../../src/find-source-map-safe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,SAAS,EAAE,MAAM,QAAQ,CAAA;AAKjD,eAAO,MAAM,iBAAiB,MACzB,MAAM,GAAG,GAAG,KACd,KAAK,GAAG,SAAS,GAAG,SAkBtB,CAAA"}

@@ -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

@@ -1,1 +0,1 @@

{"version":3,"file":"find-source-map-safe.js","sourceRoot":"","sources":["../../src/find-source-map-safe.ts"],"names":[],"mappings":";;;AAAA,mCAAiD;AACjD,qDAA4C;AAE5C,MAAM,UAAU,GAAG,IAAI,GAAG,EAAqB,CAAA;AAExC,MAAM,iBAAiB,GAAG,CAC/B,CAAe,EACgB,EAAE;IACjC,gEAAgE;IAChE,mEAAmE;IACnE,MAAM,GAAG,GAAG,IAAA,0BAAS,EAAC,CAAC,CAAC,CAAA;IACxB,MAAM,CAAC,GAAG,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IAC7B,IAAI,CAAC;QAAE,OAAO,CAAC,CAAA;IAEf,oEAAoE;IACpE,IAAI;QACF,MAAM,EAAE,GAAG,IAAA,sBAAa,EAAC,GAAG,CAAC,CAAA;QAC7B,IAAI,EAAE;YAAE,UAAU,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,CAAC,CAAA;QAC/B,OAAO,EAAE,CAAA;KACV;IAAC,MAAM;QACN,OAAO,KAAK,CAAA;KACb;AACH,CAAC,CAAA;AAjBY,QAAA,iBAAiB,qBAiB7B","sourcesContent":["import { findSourceMap, SourceMap } from 'module'\nimport { pathToURL } from './path-to-url.js'\n\nconst sourceMaps = new Map<string, SourceMap>()\n\nexport const findSourceMapSafe = (\n s: string | URL\n): false | undefined | SourceMap => {\n // Have to look up by URL, because the ?tapmock param will be in\n // the internal key used by node, as those are \"different\" modules.\n const mod = pathToURL(s)\n const c = sourceMaps.get(mod)\n if (c) return c\n\n // this can throw in some cases, eg if the sourcemap file is missing\n try {\n const sm = findSourceMap(mod)\n if (sm) sourceMaps.set(mod, sm)\n return sm\n } catch {\n return false\n }\n}\n"]}
{"version":3,"file":"find-source-map-safe.js","sourceRoot":"","sources":["../../src/find-source-map-safe.ts"],"names":[],"mappings":";;;AAAA,mCAAiD;AACjD,qDAA4C;AAE5C,MAAM,UAAU,GAAG,IAAI,GAAG,EAAqB,CAAA;AAExC,MAAM,iBAAiB,GAAG,CAC/B,CAAe,EACgB,EAAE;IACjC,gEAAgE;IAChE,mEAAmE;IACnE,MAAM,GAAG,GAAG,IAAA,0BAAS,EAAC,CAAC,CAAC,CAAA;IACxB,MAAM,CAAC,GAAG,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IAC7B,IAAI,CAAC;QAAE,OAAO,CAAC,CAAA;IAEf,oEAAoE;IACpE,IAAI;QACF,MAAM,EAAE,GAAG,IAAA,sBAAa,EAAC,GAAG,CAAC,CAAA;QAC7B,IAAI,EAAE;YAAE,UAAU,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,CAAC,CAAA;QAC/B,OAAO,EAAE,CAAA;QACT,yBAAyB;QACzB,qBAAqB;KACtB;IAAC,MAAM;QACN,OAAO,KAAK,CAAA;KACb;IACD,oBAAoB;AACtB,CAAC,CAAA;AApBY,QAAA,iBAAiB,qBAoB7B","sourcesContent":["import { findSourceMap, SourceMap } from 'module'\nimport { pathToURL } from './path-to-url.js'\n\nconst sourceMaps = new Map<string, SourceMap>()\n\nexport const findSourceMapSafe = (\n s: string | URL\n): false | undefined | SourceMap => {\n // Have to look up by URL, because the ?tapmock param will be in\n // the internal key used by node, as those are \"different\" modules.\n const mod = pathToURL(s)\n const c = sourceMaps.get(mod)\n if (c) return c\n\n // this can throw in some cases, eg if the sourcemap file is missing\n try {\n const sm = findSourceMap(mod)\n if (sm) sourceMaps.set(mod, sm)\n return sm\n // only throws on node 20\n /* c8 ignore start */\n } catch {\n return false\n }\n /* c8 ignore stop */\n}\n"]}

@@ -1,1 +0,1 @@

{"version":3,"file":"line-lengths.d.ts","sourceRoot":"","sources":["../../src/line-lengths.ts"],"names":[],"mappings":";AAYA,eAAO,MAAM,eAAe,aAChB,MAAM,YACN,MAAM,GAAG,MAAM,SAe1B,CAAA;AAED,eAAO,MAAM,cAAc,aAAc,MAAM,yBAG9C,CAAA"}
{"version":3,"file":"line-lengths.d.ts","sourceRoot":"","sources":["../../src/line-lengths.ts"],"names":[],"mappings":";AAYA,eAAO,MAAM,eAAe,aAChB,MAAM,YACN,MAAM,GAAG,MAAM,SAa1B,CAAA;AAED,eAAO,MAAM,cAAc,aAAc,MAAM,yBAG9C,CAAA"}

@@ -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 @@ };

@@ -1,1 +0,1 @@

{"version":3,"file":"line-lengths.js","sourceRoot":"","sources":["../../src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,QAAQ,GAAG,IAAA,mBAAa,EAAC,QAAQ,CAAC,CAAA;IACtE,OAAO,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;AAC5B,CAAC,CAAA;AAHY,QAAA,cAAc,kBAG1B","sourcesContent":["// TODO: Refactor once https://github.com/nodejs/node/issues/48460 fixed\n\nimport { fileURLToPath } from 'url'\n\nconst kLLC = Symbol.for('@tapjs/processinfo lineLength cache')\nconst g = global as {\n [kLLC]?: Map<string, number[]>\n}\nconst cache = g[kLLC] || new Map<string, number[]>()\ng[kLLC] = cache\n\nconst sourceMapComment = '//# sourceMappingURL='\nexport const saveLineLengths = (\n filename: string,\n content?: string | Buffer\n) => {\n if (content === undefined) return\n if (typeof content === 'object') content = String(content)\n if (filename.startsWith('file://')) filename = fileURLToPath(filename)\n // no need if it's not sourcemapped\n // don't cache an empty array, though, because ts-node files will show\n // up first as source, and then as their built content.\n const last = content.trimEnd().split('\\n').pop()\n if (cache.has(filename) || !last?.startsWith(sourceMapComment)) return\n const ll = content\n .split(/\\n|\\u2028|\\u2029/)\n .map(l => l.length)\n\n cache.set(filename, ll)\n}\n\nexport const getLineLengths = (filename: string) => {\n if (filename.startsWith('file://')) filename = fileURLToPath(filename)\n return cache.get(filename)\n}\n"]}
{"version":3,"file":"line-lengths.js","sourceRoot":"","sources":["../../src/line-lengths.ts"],"names":[],"mappings":";AAAA,wEAAwE;;;AAExE,6BAAmC;AAEnC,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAA;AAC9D,MAAM,CAAC,GAAG,MAET,CAAA;AACD,MAAM,KAAK,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,IAAI,GAAG,EAAoB,CAAA;AACpD,CAAC,CAAC,IAAI,CAAC,GAAG,KAAK,CAAA;AAEf,MAAM,gBAAgB,GAAG,uBAAuB,CAAA;AACzC,MAAM,eAAe,GAAG,CAC7B,QAAgB,EAChB,OAAyB,EACzB,EAAE;IACF,IAAI,OAAO,KAAK,SAAS;QAAE,OAAM;IACjC,IAAI,OAAO,OAAO,KAAK,QAAQ;QAAE,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,CAAA;IAC1D,IAAI,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC;QAAE,QAAQ,GAAG,IAAA,mBAAa,EAAC,QAAQ,CAAC,CAAA;IACtE,mCAAmC;IACnC,sEAAsE;IACtE,uDAAuD;IACvD,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,CAAA;IAChD,IAAI,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,CAAC,gBAAgB,CAAC;QAAE,OAAM;IACtE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAA;IAE/D,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAA;AACzB,CAAC,CAAA;AAfY,QAAA,eAAe,mBAe3B;AAEM,MAAM,cAAc,GAAG,CAAC,QAAgB,EAAE,EAAE;IACjD,IAAI,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC;QAAE,QAAQ,GAAG,IAAA,mBAAa,EAAC,QAAQ,CAAC,CAAA;IACtE,OAAO,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;AAC5B,CAAC,CAAA;AAHY,QAAA,cAAc,kBAG1B","sourcesContent":["// TODO: Refactor once https://github.com/nodejs/node/issues/48460 fixed\n\nimport { fileURLToPath } from 'url'\n\nconst kLLC = Symbol.for('@tapjs/processinfo lineLength cache')\nconst g = global as {\n [kLLC]?: Map<string, number[]>\n}\nconst cache = g[kLLC] || new Map<string, number[]>()\ng[kLLC] = cache\n\nconst sourceMapComment = '//# sourceMappingURL='\nexport const saveLineLengths = (\n filename: string,\n content?: string | Buffer\n) => {\n if (content === undefined) return\n if (typeof content === 'object') content = String(content)\n if (filename.startsWith('file://')) filename = fileURLToPath(filename)\n // no need if it's not sourcemapped\n // don't cache an empty array, though, because ts-node files will show\n // up first as source, and then as their built content.\n const last = content.trimEnd().split('\\n').pop()\n if (cache.has(filename) || !last?.startsWith(sourceMapComment)) return\n const ll = content.split(/\\n|\\u2028|\\u2029/).map(l => l.length)\n\n cache.set(filename, ll)\n}\n\nexport const getLineLengths = (filename: string) => {\n if (filename.startsWith('file://')) filename = fileURLToPath(filename)\n return cache.get(filename)\n}\n"]}
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

@@ -1,1 +0,1 @@

{"version":3,"file":"lookup-sources.d.ts","sourceRoot":"","sources":["../../src/lookup-sources.ts"],"names":[],"mappings":"AAqBA,eAAO,MAAM,YAAY,uBAA8B,CAAA;AAEvD,eAAO,MAAM,qBAAqB,YAgBjC,CAAA;AAED,eAAO,MAAM,aAAa,QAAS,MAAM,yBAA0B,CAAA;AAEnE,eAAO,MAAM,UAAU,6BAGtB,CAAA;AAED,eAAO,MAAM,kBAAkB,QAAS,MAAM,SAG7C,CAAA"}
{"version":3,"file":"lookup-sources.d.ts","sourceRoot":"","sources":["../../src/lookup-sources.ts"],"names":[],"mappings":"AAqBA,eAAO,MAAM,YAAY,uBAA8B,CAAA;AAEvD,eAAO,MAAM,qBAAqB,YAmBjC,CAAA;AAED,eAAO,MAAM,aAAa,QAAS,MAAM,eAAe,OAAO,yBAC9B,CAAA;AAGjC,eAAO,MAAM,UAAU,gBAAgB,OAAO,0BAM7C,CAAA;AAED,eAAO,MAAM,kBAAkB,QAAS,MAAM,SAG7C,CAAA"}

@@ -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 @@ };

@@ -1,1 +0,1 @@

{"version":3,"file":"lookup-sources.js","sourceRoot":"","sources":["../../src/lookup-sources.ts"],"names":[],"mappings":";AAAA,0EAA0E;AAC1E,2EAA2E;AAC3E,yEAAyE;AACzE,sBAAsB;AACtB,EAAE;AACF,uEAAuE;AACvE,uEAAuE;AACvE,gEAAgE;AAChE,EAAE;AACF,oEAAoE;AACpE,sEAAsE;AACtE,wEAAwE;AACxE,qEAAqE;AACrE,uEAAuE;AACvE,0EAA0E;AAC1E,oDAAoD;;;AAEpD,uEAA6D;AAE7D,mDAAmD;AACnD,MAAM,OAAO,GAAG,IAAI,GAAG,EAAU,CAAA;AACpB,QAAA,YAAY,GAAG,IAAI,GAAG,EAAoB,CAAA;AAEhD,MAAM,qBAAqB,GAAG,GAAG,EAAE;IACxC,KAAK,MAAM,GAAG,IAAI,OAAO,EAAE;QACzB,MAAM,EAAE,GAAG,IAAA,2CAAiB,EAAC,GAAG,CAAC,CAAA;QACjC,IAAI,EAAE,KAAK,KAAK,EAAE;YAChB,sEAAsE;YACtE,mEAAmE;YACnE,mDAAmD;YACnD,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;SACpB;aAAM;YACL,MAAM,OAAO,GAAG,EAAE,EAAE,OAAO,EAAE,OAAO,CAAA;YACpC,IAAI,OAAO,EAAE;gBACX,oBAAY,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;gBAC9B,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;aACpB;SACF;KACF;AACH,CAAC,CAAA;AAhBY,QAAA,qBAAqB,yBAgBjC;AAEM,MAAM,aAAa,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,IAAA,kBAAU,GAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;AAAtD,QAAA,aAAa,iBAAyC;AAE5D,MAAM,UAAU,GAAG,GAAG,EAAE;IAC7B,IAAI,OAAO,CAAC,IAAI;QAAE,IAAA,6BAAqB,GAAE,CAAA;IACzC,OAAO,oBAAY,CAAA;AACrB,CAAC,CAAA;AAHY,QAAA,UAAU,cAGtB;AAEM,MAAM,kBAAkB,GAAG,CAAC,GAAW,EAAE,EAAE;IAChD,IAAI,CAAC,oBAAY,CAAC,GAAG,CAAC,GAAG,CAAC;QAAE,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IAC5C,IAAA,6BAAqB,GAAE,CAAA;AACzB,CAAC,CAAA;AAHY,QAAA,kBAAkB,sBAG9B","sourcesContent":["// For some reason that is very mysterious as of the time of writing this,\n// node sporadically will in rare cases hang and fail to gracefully exit if\n// a sufficiently large number of findSourceMap calls are made during the\n// process exit event.\n//\n// However, we cannot look up source maps until *after* the module load\n// event is completely finished and the module is about to be executed,\n// because that is when the source map is added to node's cache.\n//\n// To work around this, every time a module is loaded, we attempt to\n// determine whether it likely has the magic sourceMappingURL comment.\n// If so, then we put it in a list, and at each message, attempt to load\n// the sources for all modules in the list. Then, on process exit, if\n// there's anything still pending that likely has a source map, we only\n// have to look up at most one module (ie, if the last module loaded had a\n// source map), which seems to not trigger the hang.\n\nimport { findSourceMapSafe } from './find-source-map-safe.js'\n\n// the list of modules that likely have source maps\nconst maybeSM = new Set<string>()\nexport const sourcesCache = new Map<string, string[]>()\n\nexport const loadPendingSourceMaps = () => {\n for (const url of maybeSM) {\n const sm = findSourceMapSafe(url)\n if (sm === false) {\n // can only happen if node found the SM comment, and tried to load it,\n // but got an error creating the sourcemap, because it's invalid or\n // the file is not present. No need to keep trying.\n maybeSM.delete(url)\n } else {\n const sources = sm?.payload?.sources\n if (sources) {\n sourcesCache.set(url, sources)\n maybeSM.delete(url)\n }\n }\n }\n}\n\nexport const lookupSources = (url: string) => getSources().get(url)\n\nexport const getSources = () => {\n if (maybeSM.size) loadPendingSourceMaps()\n return sourcesCache\n}\n\nexport const likelyHasSourceMap = (url: string) => {\n if (!sourcesCache.has(url)) maybeSM.add(url)\n loadPendingSourceMaps()\n}\n"]}
{"version":3,"file":"lookup-sources.js","sourceRoot":"","sources":["../../src/lookup-sources.ts"],"names":[],"mappings":";AAAA,0EAA0E;AAC1E,2EAA2E;AAC3E,yEAAyE;AACzE,sBAAsB;AACtB,EAAE;AACF,uEAAuE;AACvE,uEAAuE;AACvE,gEAAgE;AAChE,EAAE;AACF,oEAAoE;AACpE,sEAAsE;AACtE,wEAAwE;AACxE,qEAAqE;AACrE,uEAAuE;AACvE,0EAA0E;AAC1E,oDAAoD;;;AAEpD,uEAA6D;AAE7D,mDAAmD;AACnD,MAAM,OAAO,GAAG,IAAI,GAAG,EAAU,CAAA;AACpB,QAAA,YAAY,GAAG,IAAI,GAAG,EAAoB,CAAA;AAEhD,MAAM,qBAAqB,GAAG,GAAG,EAAE;IACxC,KAAK,MAAM,GAAG,IAAI,OAAO,EAAE;QACzB,MAAM,EAAE,GAAG,IAAA,2CAAiB,EAAC,GAAG,CAAC,CAAA;QACjC,4BAA4B;QAC5B,qBAAqB;QACrB,IAAI,EAAE,KAAK,KAAK,EAAE;YAChB,sEAAsE;YACtE,mEAAmE;YACnE,mDAAmD;YACnD,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;SACpB;aAAM;YACL,oBAAoB;YACpB,MAAM,OAAO,GAAG,EAAE,EAAE,OAAO,EAAE,OAAO,CAAA;YACpC,IAAI,OAAO,EAAE;gBACX,oBAAY,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;gBAC9B,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;aACpB;SACF;KACF;AACH,CAAC,CAAA;AAnBY,QAAA,qBAAqB,yBAmBjC;AAEM,MAAM,aAAa,GAAG,CAAC,GAAW,EAAE,UAAoB,EAAE,EAAE,CACjE,IAAA,kBAAU,EAAC,UAAU,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;AADpB,QAAA,aAAa,iBACO;AAEjC,IAAI,qBAAqB,GAAG,KAAK,CAAA;AAC1B,MAAM,UAAU,GAAG,CAAC,aAAsB,KAAK,EAAE,EAAE;IACxD,IAAI,OAAO,CAAC,IAAI,IAAI,CAAC,CAAC,UAAU,IAAI,CAAC,qBAAqB,CAAC,EAAE;QAC3D,IAAI,UAAU;YAAE,qBAAqB,GAAG,IAAI,CAAA;QAC5C,IAAA,6BAAqB,GAAE,CAAA;KACxB;IACD,OAAO,oBAAY,CAAA;AACrB,CAAC,CAAA;AANY,QAAA,UAAU,cAMtB;AAEM,MAAM,kBAAkB,GAAG,CAAC,GAAW,EAAE,EAAE;IAChD,IAAI,CAAC,oBAAY,CAAC,GAAG,CAAC,GAAG,CAAC;QAAE,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IAC5C,IAAA,6BAAqB,GAAE,CAAA;AACzB,CAAC,CAAA;AAHY,QAAA,kBAAkB,sBAG9B","sourcesContent":["// For some reason that is very mysterious as of the time of writing this,\n// node sporadically will in rare cases hang and fail to gracefully exit if\n// a sufficiently large number of findSourceMap calls are made during the\n// process exit event.\n//\n// However, we cannot look up source maps until *after* the module load\n// event is completely finished and the module is about to be executed,\n// because that is when the source map is added to node's cache.\n//\n// To work around this, every time a module is loaded, we attempt to\n// determine whether it likely has the magic sourceMappingURL comment.\n// If so, then we put it in a list, and at each message, attempt to load\n// the sources for all modules in the list. Then, on process exit, if\n// there's anything still pending that likely has a source map, we only\n// have to look up at most one module (ie, if the last module loaded had a\n// source map), which seems to not trigger the hang.\n\nimport { findSourceMapSafe } from './find-source-map-safe.js'\n\n// the list of modules that likely have source maps\nconst maybeSM = new Set<string>()\nexport const sourcesCache = new Map<string, string[]>()\n\nexport const loadPendingSourceMaps = () => {\n for (const url of maybeSM) {\n const sm = findSourceMapSafe(url)\n // only possible on node 19+\n /* c8 ignore start */\n if (sm === false) {\n // can only happen if node found the SM comment, and tried to load it,\n // but got an error creating the sourcemap, because it's invalid or\n // the file is not present. No need to keep trying.\n maybeSM.delete(url)\n } else {\n /* c8 ignore stop */\n const sources = sm?.payload?.sources\n if (sources) {\n sourcesCache.set(url, sources)\n maybeSM.delete(url)\n }\n }\n }\n}\n\nexport const lookupSources = (url: string, processEnd?: boolean) =>\n getSources(processEnd).get(url)\n\nlet didFinalLookupAttempt = false\nexport const getSources = (processEnd: boolean = false) => {\n if (maybeSM.size && (!processEnd || !didFinalLookupAttempt)) {\n if (processEnd) didFinalLookupAttempt = true\n loadPendingSourceMaps()\n }\n return sourcesCache\n}\n\nexport const likelyHasSourceMap = (url: string) => {\n if (!sourcesCache.has(url)) maybeSM.add(url)\n loadPendingSourceMaps()\n}\n"]}

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

@@ -1,1 +0,1 @@

{"version":3,"file":"register-coverage.js","sourceRoot":"","sources":["../../src/register-coverage.ts"],"names":[],"mappings":";;;AAAA,sDAAsD;AACtD,8DAA8D;AAC9D,MAAM,CAAC,GAAG,OAAO,CAAA;A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qEAAqE;YACrE,mEAAmE;YACnE,MAAM,CAAC,GAAG,IAAA,2CAAiB,EAAC,GAAG,CAAC,GAAG,CAAC,CAAA;YACpC,MAAM,EAAE,OAAO,EAAE,GAAG,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAA;YAC1C,IAAI,OAAO,EAAE;gBACX,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;oBAC3D,qBAAqB;oBACrB,qDAAqD;oBACrD,YAAY;oBACZ,WAAW,EAAE,CAAC,EAAE,WAAW,IAAI,IAAA,gCAAc,EAAC,CAAC,CAAC;oBAChD,oBAAoB;oBACpB,IAAI,EAAE,OAAO;iBACd,CAAC,CAAA;aACH;YACD,OAAO,IAAI,CAAA;QACb,CAAC,CAAC,CAAA;QAEF,IAAA,uBAAa,EAAC,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,EAAE,MAAM,CAAC,CAAA;QAC7D,qBAAqB;IACvB,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA;AArEY,QAAA,oBAAoB,wBAqEhC;AACD,oBAAoB","sourcesContent":["// start tracking coverage, unless disabled explicltly\n// export so that we know to collect at the end of the process\nconst p = process\nconst enabled = p.env._TAPJS_PROCESSINFO_COVERAGE_ !== '0'\nimport { mkdirSync, writeFileSync } from 'node:fs'\nimport { Session } from 'node:inspector'\nimport { SourceMapPayload } from 'node:module'\nimport { resolve } from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport { findSourceMapSafe } from './find-source-map-safe.js'\nimport { getExclude } from './get-exclude.js'\nimport { getLineLengths } from './line-lengths.js'\nimport { lookupSources } from './lookup-sources.js'\nimport { ProcessInfoNodeData } from './process-info-node.js'\n\nexport let SESSION: Session | undefined = undefined\n\n// This is a \\n delimited list of files to show coverage for\n// If not set, or empty, then coverage is included for all files\n// that pass the exclusion RegExp filter. If included in this list,\n// then coverage will be recorded, even if it matches exclude.\nconst cfEnv = p.env._TAPJS_PROCESSINFO_COV_FILES_ || ''\nconst coveredFiles: string[] = cfEnv\n .trim()\n .split('\\n')\n .filter(f => !!f)\n\n// NB: coverage exclusion is in addition to processinfo\n// exclusion. Only show coverage for a file we care\n// about at least somewhat, but coverage is a subset.\nconst cxEnv = p.env._TAPJS_PROCESSINFO_COV_EXCLUDE_FILES_ || ''\nconst uncoveredFiles: string[] = cxEnv\n .trim()\n .split('\\n')\n .filter(f => !!f)\n\nconst exclude = p.env._TAPJS_PROCESSINFO_COV_EXCLUDE_\n ? getExclude('_TAPJS_PROCESSINFO_COV_EXCLUDE_', false)\n : undefined\n\nconst fileCovered = (\n f: string,\n sources: string[] = [],\n files: string[] = []\n) => {\n const testFiles = [f]\n for (const src of sources || []) {\n testFiles.push(\n resolve(src.startsWith('file://') ? fileURLToPath(src) : src)\n )\n }\n\n // never include coverage if the file is fully ignored.\n if (!testFiles.some(f => files.includes(f))) return false\n\n // if at least one of them are explicitly covered, then include it,\n // otherwise omit if we explicitly listed\n if (coveredFiles.length) {\n return testFiles.some(f => coveredFiles.includes(f))\n }\n\n // if any of the filenames are explicitly excluded, no coverage\n // otherwise, it is covered\n return !testFiles.some(\n f => uncoveredFiles.includes(f) || exclude?.test(f)\n )\n}\n\n// C8 can't see that this function runs, best theory is that it\n// collides with what it's doing with the coverage it's collecting\n// This ignore can possibly be removed once this is being tested\n// with a version of tap that uses this library, but it might just\n// be an unresolveable bootstrap problem.\n// The test does verify that it ran, because otherwise, there would\n// be no coverage, and it verifies that it gets the expected coverage.\n/* c8 ignore start */\nexport const register = () => {\n if (!enabled) return\n p.env._TAPJS_PROCESSINFO_COVERAGE_ = '1'\n\n SESSION = new Session()\n SESSION.connect()\n SESSION.post('Profiler.enable')\n SESSION.post('Runtime.enable')\n SESSION.post('Profiler.startPreciseCoverage', {\n callCount: true,\n detailed: true,\n })\n}\n/* c8 ignore stop */\n\nexport const coverageOnProcessEnd = (\n cwd: string,\n processInfo: ProcessInfoNodeData\n) => {\n // Similar to the coverage tracking bootstrap problem above, c8\n // doesn't see that this function runs, even though it DOES see\n // that the function defined below runs, which is weird.\n /* c8 ignore start */\n if (!SESSION) return\n const session = SESSION\n\n const f = `${cwd}/.tap/coverage/${processInfo.uuid}.json`\n mkdirSync(`${cwd}/.tap/coverage`, { recursive: true })\n\n session.post('Profiler.takePreciseCoverage', (er, cov) => {\n session.post('Profiler.stopPreciseCoverage')\n /* c8 ignore stop */\n\n // something very strange and bad happened\n /* c8 ignore start */\n if (er) {\n throw er\n }\n /* c8 ignore stop */\n\n // Create a source-map-cache that c8 uses in report generation\n const sourceMapCache: {\n [k: string]: {\n lineLengths: number[]\n data: SourceMapPayload\n }\n } = {}\n Object.assign(cov, {\n 'source-map-cache': sourceMapCache,\n })\n\n cov.result = cov.result.filter(obj => {\n if (!/^file:/.test(obj.url)) {\n return false\n }\n const f = fileURLToPath(obj.url)\n // see if it has a source map\n // need to look up via the url, not the file path, because mocks\n // attach a tapmock search param, which is in node's internal key.\n const sources = lookupSources(obj.url)\n if (!fileCovered(f, sources, processInfo.files)) {\n return false\n }\n // Most of the time this will be cached at the time of recording, but\n // if it's the last module loaded, or transpiled in-place by ts-node,\n // the sourcemap won't be pre-loaded and will have to be looked up.\n const s = findSourceMapSafe(obj.url)\n const { payload } = s || { payload: null }\n if (payload) {\n sourceMapCache[obj.url] = Object.assign(Object.create(null), {\n /* c8 ignore start */\n // node's SourceMap objects provide this as of 20.5.0\n //@ts-ignore\n lineLengths: s?.lineLengths || getLineLengths(f),\n /* c8 ignore stop */\n data: payload,\n })\n }\n return true\n })\n\n writeFileSync(f, JSON.stringify(cov, null, 2) + '\\n', 'utf8')\n /* c8 ignore start */\n })\n}\n/* c8 ignore stop */\n"]}
{"version":3,"file":"register-coverage.js","sourceRoot":"","sources":["../../src/register-coverage.ts"],"names":[],"mappings":";;;AAAA,sDAAsD;AACtD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AAC,EAAE;gBAC/C,OAAO,KAAK,CAAA;aACb;YACD,qEAAqE;YACrE,qEAAqE;YACrE,mEAAmE;YACnE,MAAM,CAAC,GAAG,IAAA,2CAAiB,EAAC,GAAG,CAAC,GAAG,CAAC,CAAA;YACpC,MAAM,EAAE,OAAO,EAAE,GAAG,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAA;YAC1C,IAAI,OAAO,EAAE;gBACX,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;oBAC3D,qBAAqB;oBACrB,qDAAqD;oBACrD,YAAY;oBACZ,WAAW,EAAE,CAAC,EAAE,WAAW,IAAI,IAAA,gCAAc,EAAC,CAAC,CAAC;oBAChD,oBAAoB;oBACpB,IAAI,EAAE,OAAO;iBACd,CAAC,CAAA;aACH;YACD,OAAO,IAAI,CAAA;QACb,CAAC,CAAC,CAAA;QAEF,IAAA,uBAAa,EAAC,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,EAAE,MAAM,CAAC,CAAA;QAC7D,qBAAqB;IACvB,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA;AArEY,QAAA,oBAAoB,wBAqEhC;AACD,oBAAoB","sourcesContent":["// start tracking coverage, unless disabled explicltly\n// export so that we know to collect at the end of the process\nconst p = process\nconst enabled = p.env._TAPJS_PROCESSINFO_COVERAGE_ !== '0'\nimport { mkdirSync, writeFileSync } from 'node:fs'\nimport { Session } from 'node:inspector'\nimport { SourceMapPayload } from 'node:module'\nimport { resolve } from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport { findSourceMapSafe } from './find-source-map-safe.js'\nimport { getExclude } from './get-exclude.js'\nimport { getLineLengths } from './line-lengths.js'\nimport { lookupSources } from './lookup-sources.js'\nimport { ProcessInfoNodeData } from './process-info-node.js'\n\nexport let SESSION: Session | undefined = undefined\n\n// This is a \\n delimited list of files to show coverage for\n// If not set, or empty, then coverage is included for all files\n// that pass the exclusion RegExp filter. If included in this list,\n// then coverage will be recorded, even if it matches exclude.\nconst cfEnv = p.env._TAPJS_PROCESSINFO_COV_FILES_ || ''\nconst coveredFiles: string[] = cfEnv\n .trim()\n .split('\\n')\n .filter(f => !!f)\n\n// NB: coverage exclusion is in addition to processinfo\n// exclusion. Only show coverage for a file we care\n// about at least somewhat, but coverage is a subset.\nconst cxEnv = p.env._TAPJS_PROCESSINFO_COV_EXCLUDE_FILES_ || ''\nconst uncoveredFiles: string[] = cxEnv\n .trim()\n .split('\\n')\n .filter(f => !!f)\n\nconst exclude = p.env._TAPJS_PROCESSINFO_COV_EXCLUDE_\n ? getExclude('_TAPJS_PROCESSINFO_COV_EXCLUDE_', false)\n : undefined\n\nconst fileCovered = (\n f: string,\n sources: string[] = [],\n files: string[] = []\n) => {\n const testFiles = [f]\n for (const src of sources || []) {\n testFiles.push(\n resolve(src.startsWith('file://') ? fileURLToPath(src) : src)\n )\n }\n\n // never include coverage if the file is fully ignored.\n if (!testFiles.some(f => files.includes(f))) return false\n\n // if at least one of them are explicitly covered, then include it,\n // otherwise omit if we explicitly listed\n if (coveredFiles.length) {\n return testFiles.some(f => coveredFiles.includes(f))\n }\n\n // if any of the filenames are explicitly excluded, no coverage\n // otherwise, it is covered\n return !testFiles.some(\n f => uncoveredFiles.includes(f) || exclude?.test(f)\n )\n}\n\n// C8 can't see that this function runs, best theory is that it\n// collides with what it's doing with the coverage it's collecting\n// This ignore can possibly be removed once this is being tested\n// with a version of tap that uses this library, but it might just\n// be an unresolveable bootstrap problem.\n// The test does verify that it ran, because otherwise, there would\n// be no coverage, and it verifies that it gets the expected coverage.\n/* c8 ignore start */\nexport const register = () => {\n if (!enabled) return\n p.env._TAPJS_PROCESSINFO_COVERAGE_ = '1'\n\n SESSION = new Session()\n SESSION.connect()\n SESSION.post('Profiler.enable')\n SESSION.post('Runtime.enable')\n SESSION.post('Profiler.startPreciseCoverage', {\n callCount: true,\n detailed: true,\n })\n}\n/* c8 ignore stop */\n\nexport const coverageOnProcessEnd = (\n cwd: string,\n processInfo: ProcessInfoNodeData\n) => {\n // Similar to the coverage tracking bootstrap problem above, c8\n // doesn't see that this function runs, even though it DOES see\n // that the function defined below runs, which is weird.\n /* c8 ignore start */\n if (!SESSION) return\n const session = SESSION\n\n const f = `${cwd}/.tap/coverage/${processInfo.uuid}.json`\n mkdirSync(`${cwd}/.tap/coverage`, { recursive: true })\n\n session.post('Profiler.takePreciseCoverage', (er, cov) => {\n session.post('Profiler.stopPreciseCoverage')\n /* c8 ignore stop */\n\n // something very strange and bad happened\n /* c8 ignore start */\n if (er) {\n throw er\n }\n /* c8 ignore stop */\n\n // Create a source-map-cache that c8 uses in report generation\n const sourceMapCache: {\n [k: string]: {\n lineLengths: number[]\n data: SourceMapPayload\n }\n } = {}\n Object.assign(cov, {\n 'source-map-cache': sourceMapCache,\n })\n\n cov.result = cov.result.filter(obj => {\n if (!/^file:/.test(obj.url)) {\n return false\n }\n const f = fileURLToPath(obj.url)\n // see if it has a source map\n // need to look up via the url, not the file path, because mocks\n // attach a tapmock search param, which is in node's internal key.\n const sources = lookupSources(obj.url, true)\n if (!fileCovered(f, sources, processInfo.files)) {\n return false\n }\n // Most of the time this will be cached at the time of recording, but\n // if it's the last module loaded, or transpiled in-place by ts-node,\n // the sourcemap won't be pre-loaded and will have to be looked up.\n const s = findSourceMapSafe(obj.url)\n const { payload } = s || { payload: null }\n if (payload) {\n sourceMapCache[obj.url] = Object.assign(Object.create(null), {\n /* c8 ignore start */\n // node's SourceMap objects provide this as of 20.5.0\n //@ts-ignore\n lineLengths: s?.lineLengths || getLineLengths(f),\n /* c8 ignore stop */\n data: payload,\n })\n }\n return true\n })\n\n writeFileSync(f, JSON.stringify(cov, null, 2) + '\\n', 'utf8')\n /* c8 ignore start */\n })\n}\n/* c8 ignore stop */\n"]}

@@ -1,1 +0,1 @@

{"version":3,"file":"find-source-map-safe.d.ts","sourceRoot":"","sources":["../../src/find-source-map-safe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,SAAS,EAAE,MAAM,QAAQ,CAAA;AAKjD,eAAO,MAAM,iBAAiB,MACzB,MAAM,GAAG,GAAG,KACd,KAAK,GAAG,SAAS,GAAG,SAetB,CAAA"}
{"version":3,"file":"find-source-map-safe.d.ts","sourceRoot":"","sources":["../../src/find-source-map-safe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,SAAS,EAAE,MAAM,QAAQ,CAAA;AAKjD,eAAO,MAAM,iBAAiB,MACzB,MAAM,GAAG,GAAG,KACd,KAAK,GAAG,SAAS,GAAG,SAkBtB,CAAA"}

@@ -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

@@ -1,1 +0,1 @@

{"version":3,"file":"find-source-map-safe.js","sourceRoot":"","sources":["../../src/find-source-map-safe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAa,MAAM,QAAQ,CAAA;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAE5C,MAAM,UAAU,GAAG,IAAI,GAAG,EAAqB,CAAA;AAE/C,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,CAAe,EACgB,EAAE;IACjC,gEAAgE;IAChE,mEAAmE;IACnE,MAAM,GAAG,GAAG,SAAS,CAAC,CAAC,CAAC,CAAA;IACxB,MAAM,CAAC,GAAG,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IAC7B,IAAI,CAAC;QAAE,OAAO,CAAC,CAAA;IAEf,oEAAoE;IACpE,IAAI;QACF,MAAM,EAAE,GAAG,aAAa,CAAC,GAAG,CAAC,CAAA;QAC7B,IAAI,EAAE;YAAE,UAAU,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,CAAC,CAAA;QAC/B,OAAO,EAAE,CAAA;KACV;IAAC,MAAM;QACN,OAAO,KAAK,CAAA;KACb;AACH,CAAC,CAAA","sourcesContent":["import { findSourceMap, SourceMap } from 'module'\nimport { pathToURL } from './path-to-url.js'\n\nconst sourceMaps = new Map<string, SourceMap>()\n\nexport const findSourceMapSafe = (\n s: string | URL\n): false | undefined | SourceMap => {\n // Have to look up by URL, because the ?tapmock param will be in\n // the internal key used by node, as those are \"different\" modules.\n const mod = pathToURL(s)\n const c = sourceMaps.get(mod)\n if (c) return c\n\n // this can throw in some cases, eg if the sourcemap file is missing\n try {\n const sm = findSourceMap(mod)\n if (sm) sourceMaps.set(mod, sm)\n return sm\n } catch {\n return false\n }\n}\n"]}
{"version":3,"file":"find-source-map-safe.js","sourceRoot":"","sources":["../../src/find-source-map-safe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAa,MAAM,QAAQ,CAAA;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAE5C,MAAM,UAAU,GAAG,IAAI,GAAG,EAAqB,CAAA;AAE/C,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,CAAe,EACgB,EAAE;IACjC,gEAAgE;IAChE,mEAAmE;IACnE,MAAM,GAAG,GAAG,SAAS,CAAC,CAAC,CAAC,CAAA;IACxB,MAAM,CAAC,GAAG,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IAC7B,IAAI,CAAC;QAAE,OAAO,CAAC,CAAA;IAEf,oEAAoE;IACpE,IAAI;QACF,MAAM,EAAE,GAAG,aAAa,CAAC,GAAG,CAAC,CAAA;QAC7B,IAAI,EAAE;YAAE,UAAU,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,CAAC,CAAA;QAC/B,OAAO,EAAE,CAAA;QACT,yBAAyB;QACzB,qBAAqB;KACtB;IAAC,MAAM;QACN,OAAO,KAAK,CAAA;KACb;IACD,oBAAoB;AACtB,CAAC,CAAA","sourcesContent":["import { findSourceMap, SourceMap } from 'module'\nimport { pathToURL } from './path-to-url.js'\n\nconst sourceMaps = new Map<string, SourceMap>()\n\nexport const findSourceMapSafe = (\n s: string | URL\n): false | undefined | SourceMap => {\n // Have to look up by URL, because the ?tapmock param will be in\n // the internal key used by node, as those are \"different\" modules.\n const mod = pathToURL(s)\n const c = sourceMaps.get(mod)\n if (c) return c\n\n // this can throw in some cases, eg if the sourcemap file is missing\n try {\n const sm = findSourceMap(mod)\n if (sm) sourceMaps.set(mod, sm)\n return sm\n // only throws on node 20\n /* c8 ignore start */\n } catch {\n return false\n }\n /* c8 ignore stop */\n}\n"]}

@@ -6,5 +6,5 @@ //@ts-ignore - added in node 20.6

import { MessageChannel } from 'node:worker_threads';
import { getImportMetaURL } from './get-import-meta-url.js';
import { getProcessInfo } from './get-process-info.js';
import { saveLineLengths } from './line-lengths.js';
import { getImportMetaURL } from './get-import-meta-url.js';
import { likelyHasSourceMap } from './lookup-sources.js';

@@ -11,0 +11,0 @@ const { port1, port2 } = new MessageChannel();

@@ -1,1 +0,1 @@

{"version":3,"file":"import.mjs","sourceRoot":"","sources":["../../src/import.mts"],"names":[],"mappings":"AAAA,iCAAiC;AACjC,wEAAwE;AACxE,4DAA4D;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAC3D,OAAO,EAAC,kBAAkB,EAAC,MAAM,qBAAqB,CAAA;AAEtD,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,IAAI,cAAc,EAAE,CAAA;AAE7C,+BAA+B;AAC/B,0CAA0C;AAC1C,MAAM,WAAW,GAAG,cAAc,EAAE,CAAA;AACpC,KAAK,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE;IACjD,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;IAChC,eAAe,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;IAClC,IAAI,GAAG;QAAE,kBAAkB,CAAC,GAAG,CAAC,CAAA;AAClC,CAAC,CAAC,CAAA;AAEF,KAAK,CAAC,KAAK,EAAE,CAAA;AACb,KAAK,CAAC,KAAK,EAAE,CAAA;AAEb,QAAQ,CAAC,gBAAgB,CAAC,cAAc,CAAC,EAAE;IACzC,SAAS,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG;IAC1B,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE;IACrB,YAAY,EAAE,CAAC,KAAK,CAAC;CACtB,CAAC,CAAA","sourcesContent":["//@ts-ignore - added in node 20.6\n// this is the argument for --import, which does the initial main-thread\n// work, and then registers the loader without globalPreload\nimport { register } from 'node:module'\nimport { MessageChannel } from 'node:worker_threads'\nimport { getProcessInfo } from './get-process-info.js'\nimport { saveLineLengths } from './line-lengths.js'\nimport { getImportMetaURL } from './get-import-meta-url.js'\nimport {likelyHasSourceMap} from './lookup-sources.js'\n\nconst { port1, port2 } = new MessageChannel()\n\n// must be called eagerly here.\n// this does all the registration as well.\nconst processInfo = getProcessInfo()\nport1.on('message', ({ filename, content, url }) => {\n processInfo.files.push(filename)\n saveLineLengths(filename, content)\n if (url) likelyHasSourceMap(url)\n})\n\nport1.unref()\nport2.unref()\n\nregister(getImportMetaURL(`./loader.mjs`), {\n parentURL: import.meta.url,\n data: { port: port2 },\n transferList: [port2],\n})\n"]}
{"version":3,"file":"import.mjs","sourceRoot":"","sources":["../../src/import.mts"],"names":[],"mappings":"AAAA,iCAAiC;AACjC,wEAAwE;AACxE,4DAA4D;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAExD,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,IAAI,cAAc,EAAE,CAAA;AAE7C,+BAA+B;AAC/B,0CAA0C;AAC1C,MAAM,WAAW,GAAG,cAAc,EAAE,CAAA;AACpC,KAAK,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE;IACjD,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;IAChC,eAAe,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;IAClC,IAAI,GAAG;QAAE,kBAAkB,CAAC,GAAG,CAAC,CAAA;AAClC,CAAC,CAAC,CAAA;AAEF,KAAK,CAAC,KAAK,EAAE,CAAA;AACb,KAAK,CAAC,KAAK,EAAE,CAAA;AAEb,QAAQ,CAAC,gBAAgB,CAAC,cAAc,CAAC,EAAE;IACzC,SAAS,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG;IAC1B,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE;IACrB,YAAY,EAAE,CAAC,KAAK,CAAC;CACtB,CAAC,CAAA","sourcesContent":["//@ts-ignore - added in node 20.6\n// this is the argument for --import, which does the initial main-thread\n// work, and then registers the loader without globalPreload\nimport { register } from 'node:module'\nimport { MessageChannel } from 'node:worker_threads'\nimport { getImportMetaURL } from './get-import-meta-url.js'\nimport { getProcessInfo } from './get-process-info.js'\nimport { saveLineLengths } from './line-lengths.js'\nimport { likelyHasSourceMap } from './lookup-sources.js'\n\nconst { port1, port2 } = new MessageChannel()\n\n// must be called eagerly here.\n// this does all the registration as well.\nconst processInfo = getProcessInfo()\nport1.on('message', ({ filename, content, url }) => {\n processInfo.files.push(filename)\n saveLineLengths(filename, content)\n if (url) likelyHasSourceMap(url)\n})\n\nport1.unref()\nport2.unref()\n\nregister(getImportMetaURL(`./loader.mjs`), {\n parentURL: import.meta.url,\n data: { port: port2 },\n transferList: [port2],\n})\n"]}

@@ -1,1 +0,1 @@

{"version":3,"file":"line-lengths.d.ts","sourceRoot":"","sources":["../../src/line-lengths.ts"],"names":[],"mappings":";AAYA,eAAO,MAAM,eAAe,aAChB,MAAM,YACN,MAAM,GAAG,MAAM,SAe1B,CAAA;AAED,eAAO,MAAM,cAAc,aAAc,MAAM,yBAG9C,CAAA"}
{"version":3,"file":"line-lengths.d.ts","sourceRoot":"","sources":["../../src/line-lengths.ts"],"names":[],"mappings":";AAYA,eAAO,MAAM,eAAe,aAChB,MAAM,YACN,MAAM,GAAG,MAAM,SAa1B,CAAA;AAED,eAAO,MAAM,cAAc,aAAc,MAAM,yBAG9C,CAAA"}

@@ -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 @@ };

@@ -1,1 +0,1 @@

{"version":3,"file":"line-lengths.js","sourceRoot":"","sources":["../../src/line-lengths.ts"],"names":[],"mappings":"AAAA,wEAAwE;AAExE,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAA;AAEnC,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAA;AAC9D,MAAM,CAAC,GAAG,MAET,CAAA;AACD,MAAM,KAAK,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,IAAI,GAAG,EAAoB,CAAA;AACpD,CAAC,CAAC,IAAI,CAAC,GAAG,KAAK,CAAA;AAEf,MAAM,gBAAgB,GAAG,uBAAuB,CAAA;AAChD,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,QAAgB,EAChB,OAAyB,EACzB,EAAE;IACF,IAAI,OAAO,KAAK,SAAS;QAAE,OAAM;IACjC,IAAI,OAAO,OAAO,KAAK,QAAQ;QAAE,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,CAAA;IAC1D,IAAI,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC;QAAE,QAAQ,GAAG,aAAa,CAAC,QAAQ,CAAC,CAAA;IACtE,mCAAmC;IACnC,sEAAsE;IACtE,uDAAuD;IACvD,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,CAAA;IAChD,IAAI,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,CAAC,gBAAgB,CAAC;QAAE,OAAM;IACtE,MAAM,EAAE,GAAG,OAAO;SACf,KAAK,CAAC,kBAAkB,CAAC;SACzB,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAA;IAErB,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAA;AACzB,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,QAAgB,EAAE,EAAE;IACjD,IAAI,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC;QAAE,QAAQ,GAAG,aAAa,CAAC,QAAQ,CAAC,CAAA;IACtE,OAAO,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;AAC5B,CAAC,CAAA","sourcesContent":["// TODO: Refactor once https://github.com/nodejs/node/issues/48460 fixed\n\nimport { fileURLToPath } from 'url'\n\nconst kLLC = Symbol.for('@tapjs/processinfo lineLength cache')\nconst g = global as {\n [kLLC]?: Map<string, number[]>\n}\nconst cache = g[kLLC] || new Map<string, number[]>()\ng[kLLC] = cache\n\nconst sourceMapComment = '//# sourceMappingURL='\nexport const saveLineLengths = (\n filename: string,\n content?: string | Buffer\n) => {\n if (content === undefined) return\n if (typeof content === 'object') content = String(content)\n if (filename.startsWith('file://')) filename = fileURLToPath(filename)\n // no need if it's not sourcemapped\n // don't cache an empty array, though, because ts-node files will show\n // up first as source, and then as their built content.\n const last = content.trimEnd().split('\\n').pop()\n if (cache.has(filename) || !last?.startsWith(sourceMapComment)) return\n const ll = content\n .split(/\\n|\\u2028|\\u2029/)\n .map(l => l.length)\n\n cache.set(filename, ll)\n}\n\nexport const getLineLengths = (filename: string) => {\n if (filename.startsWith('file://')) filename = fileURLToPath(filename)\n return cache.get(filename)\n}\n"]}
{"version":3,"file":"line-lengths.js","sourceRoot":"","sources":["../../src/line-lengths.ts"],"names":[],"mappings":"AAAA,wEAAwE;AAExE,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAA;AAEnC,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAA;AAC9D,MAAM,CAAC,GAAG,MAET,CAAA;AACD,MAAM,KAAK,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,IAAI,GAAG,EAAoB,CAAA;AACpD,CAAC,CAAC,IAAI,CAAC,GAAG,KAAK,CAAA;AAEf,MAAM,gBAAgB,GAAG,uBAAuB,CAAA;AAChD,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,QAAgB,EAChB,OAAyB,EACzB,EAAE;IACF,IAAI,OAAO,KAAK,SAAS;QAAE,OAAM;IACjC,IAAI,OAAO,OAAO,KAAK,QAAQ;QAAE,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,CAAA;IAC1D,IAAI,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC;QAAE,QAAQ,GAAG,aAAa,CAAC,QAAQ,CAAC,CAAA;IACtE,mCAAmC;IACnC,sEAAsE;IACtE,uDAAuD;IACvD,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,CAAA;IAChD,IAAI,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,CAAC,gBAAgB,CAAC;QAAE,OAAM;IACtE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAA;IAE/D,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAA;AACzB,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,QAAgB,EAAE,EAAE;IACjD,IAAI,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC;QAAE,QAAQ,GAAG,aAAa,CAAC,QAAQ,CAAC,CAAA;IACtE,OAAO,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;AAC5B,CAAC,CAAA","sourcesContent":["// TODO: Refactor once https://github.com/nodejs/node/issues/48460 fixed\n\nimport { fileURLToPath } from 'url'\n\nconst kLLC = Symbol.for('@tapjs/processinfo lineLength cache')\nconst g = global as {\n [kLLC]?: Map<string, number[]>\n}\nconst cache = g[kLLC] || new Map<string, number[]>()\ng[kLLC] = cache\n\nconst sourceMapComment = '//# sourceMappingURL='\nexport const saveLineLengths = (\n filename: string,\n content?: string | Buffer\n) => {\n if (content === undefined) return\n if (typeof content === 'object') content = String(content)\n if (filename.startsWith('file://')) filename = fileURLToPath(filename)\n // no need if it's not sourcemapped\n // don't cache an empty array, though, because ts-node files will show\n // up first as source, and then as their built content.\n const last = content.trimEnd().split('\\n').pop()\n if (cache.has(filename) || !last?.startsWith(sourceMapComment)) return\n const ll = content.split(/\\n|\\u2028|\\u2029/).map(l => l.length)\n\n cache.set(filename, ll)\n}\n\nexport const getLineLengths = (filename: string) => {\n if (filename.startsWith('file://')) filename = fileURLToPath(filename)\n return cache.get(filename)\n}\n"]}
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

@@ -1,1 +0,1 @@

{"version":3,"file":"lookup-sources.d.ts","sourceRoot":"","sources":["../../src/lookup-sources.ts"],"names":[],"mappings":"AAqBA,eAAO,MAAM,YAAY,uBAA8B,CAAA;AAEvD,eAAO,MAAM,qBAAqB,YAgBjC,CAAA;AAED,eAAO,MAAM,aAAa,QAAS,MAAM,yBAA0B,CAAA;AAEnE,eAAO,MAAM,UAAU,6BAGtB,CAAA;AAED,eAAO,MAAM,kBAAkB,QAAS,MAAM,SAG7C,CAAA"}
{"version":3,"file":"lookup-sources.d.ts","sourceRoot":"","sources":["../../src/lookup-sources.ts"],"names":[],"mappings":"AAqBA,eAAO,MAAM,YAAY,uBAA8B,CAAA;AAEvD,eAAO,MAAM,qBAAqB,YAmBjC,CAAA;AAED,eAAO,MAAM,aAAa,QAAS,MAAM,eAAe,OAAO,yBAC9B,CAAA;AAGjC,eAAO,MAAM,UAAU,gBAAgB,OAAO,0BAM7C,CAAA;AAED,eAAO,MAAM,kBAAkB,QAAS,MAAM,SAG7C,CAAA"}

@@ -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 @@ };

@@ -1,1 +0,1 @@

{"version":3,"file":"lookup-sources.js","sourceRoot":"","sources":["../../src/lookup-sources.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,2EAA2E;AAC3E,yEAAyE;AACzE,sBAAsB;AACtB,EAAE;AACF,uEAAuE;AACvE,uEAAuE;AACvE,gEAAgE;AAChE,EAAE;AACF,oEAAoE;AACpE,sEAAsE;AACtE,wEAAwE;AACxE,qEAAqE;AACrE,uEAAuE;AACvE,0EAA0E;AAC1E,oDAAoD;AAEpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAE7D,mDAAmD;AACnD,MAAM,OAAO,GAAG,IAAI,GAAG,EAAU,CAAA;AACjC,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,GAAG,EAAoB,CAAA;AAEvD,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,EAAE;IACxC,KAAK,MAAM,GAAG,IAAI,OAAO,EAAE;QACzB,MAAM,EAAE,GAAG,iBAAiB,CAAC,GAAG,CAAC,CAAA;QACjC,IAAI,EAAE,KAAK,KAAK,EAAE;YAChB,sEAAsE;YACtE,mEAAmE;YACnE,mDAAmD;YACnD,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;SACpB;aAAM;YACL,MAAM,OAAO,GAAG,EAAE,EAAE,OAAO,EAAE,OAAO,CAAA;YACpC,IAAI,OAAO,EAAE;gBACX,YAAY,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;gBAC9B,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;aACpB;SACF;KACF;AACH,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,UAAU,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;AAEnE,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,EAAE;IAC7B,IAAI,OAAO,CAAC,IAAI;QAAE,qBAAqB,EAAE,CAAA;IACzC,OAAO,YAAY,CAAA;AACrB,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,GAAW,EAAE,EAAE;IAChD,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC;QAAE,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IAC5C,qBAAqB,EAAE,CAAA;AACzB,CAAC,CAAA","sourcesContent":["// For some reason that is very mysterious as of the time of writing this,\n// node sporadically will in rare cases hang and fail to gracefully exit if\n// a sufficiently large number of findSourceMap calls are made during the\n// process exit event.\n//\n// However, we cannot look up source maps until *after* the module load\n// event is completely finished and the module is about to be executed,\n// because that is when the source map is added to node's cache.\n//\n// To work around this, every time a module is loaded, we attempt to\n// determine whether it likely has the magic sourceMappingURL comment.\n// If so, then we put it in a list, and at each message, attempt to load\n// the sources for all modules in the list. Then, on process exit, if\n// there's anything still pending that likely has a source map, we only\n// have to look up at most one module (ie, if the last module loaded had a\n// source map), which seems to not trigger the hang.\n\nimport { findSourceMapSafe } from './find-source-map-safe.js'\n\n// the list of modules that likely have source maps\nconst maybeSM = new Set<string>()\nexport const sourcesCache = new Map<string, string[]>()\n\nexport const loadPendingSourceMaps = () => {\n for (const url of maybeSM) {\n const sm = findSourceMapSafe(url)\n if (sm === false) {\n // can only happen if node found the SM comment, and tried to load it,\n // but got an error creating the sourcemap, because it's invalid or\n // the file is not present. No need to keep trying.\n maybeSM.delete(url)\n } else {\n const sources = sm?.payload?.sources\n if (sources) {\n sourcesCache.set(url, sources)\n maybeSM.delete(url)\n }\n }\n }\n}\n\nexport const lookupSources = (url: string) => getSources().get(url)\n\nexport const getSources = () => {\n if (maybeSM.size) loadPendingSourceMaps()\n return sourcesCache\n}\n\nexport const likelyHasSourceMap = (url: string) => {\n if (!sourcesCache.has(url)) maybeSM.add(url)\n loadPendingSourceMaps()\n}\n"]}
{"version":3,"file":"lookup-sources.js","sourceRoot":"","sources":["../../src/lookup-sources.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,2EAA2E;AAC3E,yEAAyE;AACzE,sBAAsB;AACtB,EAAE;AACF,uEAAuE;AACvE,uEAAuE;AACvE,gEAAgE;AAChE,EAAE;AACF,oEAAoE;AACpE,sEAAsE;AACtE,wEAAwE;AACxE,qEAAqE;AACrE,uEAAuE;AACvE,0EAA0E;AAC1E,oDAAoD;AAEpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAE7D,mDAAmD;AACnD,MAAM,OAAO,GAAG,IAAI,GAAG,EAAU,CAAA;AACjC,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,GAAG,EAAoB,CAAA;AAEvD,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,EAAE;IACxC,KAAK,MAAM,GAAG,IAAI,OAAO,EAAE;QACzB,MAAM,EAAE,GAAG,iBAAiB,CAAC,GAAG,CAAC,CAAA;QACjC,4BAA4B;QAC5B,qBAAqB;QACrB,IAAI,EAAE,KAAK,KAAK,EAAE;YAChB,sEAAsE;YACtE,mEAAmE;YACnE,mDAAmD;YACnD,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;SACpB;aAAM;YACL,oBAAoB;YACpB,MAAM,OAAO,GAAG,EAAE,EAAE,OAAO,EAAE,OAAO,CAAA;YACpC,IAAI,OAAO,EAAE;gBACX,YAAY,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;gBAC9B,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;aACpB;SACF;KACF;AACH,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,GAAW,EAAE,UAAoB,EAAE,EAAE,CACjE,UAAU,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;AAEjC,IAAI,qBAAqB,GAAG,KAAK,CAAA;AACjC,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,aAAsB,KAAK,EAAE,EAAE;IACxD,IAAI,OAAO,CAAC,IAAI,IAAI,CAAC,CAAC,UAAU,IAAI,CAAC,qBAAqB,CAAC,EAAE;QAC3D,IAAI,UAAU;YAAE,qBAAqB,GAAG,IAAI,CAAA;QAC5C,qBAAqB,EAAE,CAAA;KACxB;IACD,OAAO,YAAY,CAAA;AACrB,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,GAAW,EAAE,EAAE;IAChD,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC;QAAE,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IAC5C,qBAAqB,EAAE,CAAA;AACzB,CAAC,CAAA","sourcesContent":["// For some reason that is very mysterious as of the time of writing this,\n// node sporadically will in rare cases hang and fail to gracefully exit if\n// a sufficiently large number of findSourceMap calls are made during the\n// process exit event.\n//\n// However, we cannot look up source maps until *after* the module load\n// event is completely finished and the module is about to be executed,\n// because that is when the source map is added to node's cache.\n//\n// To work around this, every time a module is loaded, we attempt to\n// determine whether it likely has the magic sourceMappingURL comment.\n// If so, then we put it in a list, and at each message, attempt to load\n// the sources for all modules in the list. Then, on process exit, if\n// there's anything still pending that likely has a source map, we only\n// have to look up at most one module (ie, if the last module loaded had a\n// source map), which seems to not trigger the hang.\n\nimport { findSourceMapSafe } from './find-source-map-safe.js'\n\n// the list of modules that likely have source maps\nconst maybeSM = new Set<string>()\nexport const sourcesCache = new Map<string, string[]>()\n\nexport const loadPendingSourceMaps = () => {\n for (const url of maybeSM) {\n const sm = findSourceMapSafe(url)\n // only possible on node 19+\n /* c8 ignore start */\n if (sm === false) {\n // can only happen if node found the SM comment, and tried to load it,\n // but got an error creating the sourcemap, because it's invalid or\n // the file is not present. No need to keep trying.\n maybeSM.delete(url)\n } else {\n /* c8 ignore stop */\n const sources = sm?.payload?.sources\n if (sources) {\n sourcesCache.set(url, sources)\n maybeSM.delete(url)\n }\n }\n }\n}\n\nexport const lookupSources = (url: string, processEnd?: boolean) =>\n getSources(processEnd).get(url)\n\nlet didFinalLookupAttempt = false\nexport const getSources = (processEnd: boolean = false) => {\n if (maybeSM.size && (!processEnd || !didFinalLookupAttempt)) {\n if (processEnd) didFinalLookupAttempt = true\n loadPendingSourceMaps()\n }\n return sourcesCache\n}\n\nexport const likelyHasSourceMap = (url: string) => {\n if (!sourcesCache.has(url)) maybeSM.add(url)\n loadPendingSourceMaps()\n}\n"]}

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

@@ -1,1 +0,1 @@

{"version":3,"file":"register-coverage.js","sourceRoot":"","sources":["../../src/register-coverage.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,8DAA8D;AAC9D,MAAM,CAAC,GAAG,OAAO,CAAA;AACjB,MAAM,OAAO,GAAG,CAAC,CAAC,GAAG,CAAC,4BAA4B,KAAK,GAAG,CAAA;AAC1D,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAExC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAGnD,MAAM,CAAC,IAAI,OAAO,GAAwB,SAAS,CAAA;AAEnD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AC,MAAM,CAAC,IAAI,CAAC,EAAE;oBAC3D,qBAAqB;oBACrB,qDAAqD;oBACrD,YAAY;oBACZ,WAAW,EAAE,CAAC,EAAE,WAAW,IAAI,cAAc,CAAC,CAAC,CAAC;oBAChD,oBAAoB;oBACpB,IAAI,EAAE,OAAO;iBACd,CAAC,CAAA;aACH;YACD,OAAO,IAAI,CAAA;QACb,CAAC,CAAC,CAAA;QAEF,aAAa,CAAC,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,EAAE,MAAM,CAAC,CAAA;QAC7D,qBAAqB;IACvB,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA;AACD,oBAAoB","sourcesContent":["// start tracking coverage, unless disabled explicltly\n// export so that we know to collect at the end of the process\nconst p = process\nconst enabled = p.env._TAPJS_PROCESSINFO_COVERAGE_ !== '0'\nimport { mkdirSync, writeFileSync } from 'node:fs'\nimport { Session } from 'node:inspector'\nimport { SourceMapPayload } from 'node:module'\nimport { resolve } from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport { findSourceMapSafe } from './find-source-map-safe.js'\nimport { getExclude } from './get-exclude.js'\nimport { getLineLengths } from './line-lengths.js'\nimport { lookupSources } from './lookup-sources.js'\nimport { ProcessInfoNodeData } from './process-info-node.js'\n\nexport let SESSION: Session | undefined = undefined\n\n// This is a \\n delimited list of files to show coverage for\n// If not set, or empty, then coverage is included for all files\n// that pass the exclusion RegExp filter. If included in this list,\n// then coverage will be recorded, even if it matches exclude.\nconst cfEnv = p.env._TAPJS_PROCESSINFO_COV_FILES_ || ''\nconst coveredFiles: string[] = cfEnv\n .trim()\n .split('\\n')\n .filter(f => !!f)\n\n// NB: coverage exclusion is in addition to processinfo\n// exclusion. Only show coverage for a file we care\n// about at least somewhat, but coverage is a subset.\nconst cxEnv = p.env._TAPJS_PROCESSINFO_COV_EXCLUDE_FILES_ || ''\nconst uncoveredFiles: string[] = cxEnv\n .trim()\n .split('\\n')\n .filter(f => !!f)\n\nconst exclude = p.env._TAPJS_PROCESSINFO_COV_EXCLUDE_\n ? getExclude('_TAPJS_PROCESSINFO_COV_EXCLUDE_', false)\n : undefined\n\nconst fileCovered = (\n f: string,\n sources: string[] = [],\n files: string[] = []\n) => {\n const testFiles = [f]\n for (const src of sources || []) {\n testFiles.push(\n resolve(src.startsWith('file://') ? fileURLToPath(src) : src)\n )\n }\n\n // never include coverage if the file is fully ignored.\n if (!testFiles.some(f => files.includes(f))) return false\n\n // if at least one of them are explicitly covered, then include it,\n // otherwise omit if we explicitly listed\n if (coveredFiles.length) {\n return testFiles.some(f => coveredFiles.includes(f))\n }\n\n // if any of the filenames are explicitly excluded, no coverage\n // otherwise, it is covered\n return !testFiles.some(\n f => uncoveredFiles.includes(f) || exclude?.test(f)\n )\n}\n\n// C8 can't see that this function runs, best theory is that it\n// collides with what it's doing with the coverage it's collecting\n// This ignore can possibly be removed once this is being tested\n// with a version of tap that uses this library, but it might just\n// be an unresolveable bootstrap problem.\n// The test does verify that it ran, because otherwise, there would\n// be no coverage, and it verifies that it gets the expected coverage.\n/* c8 ignore start */\nexport const register = () => {\n if (!enabled) return\n p.env._TAPJS_PROCESSINFO_COVERAGE_ = '1'\n\n SESSION = new Session()\n SESSION.connect()\n SESSION.post('Profiler.enable')\n SESSION.post('Runtime.enable')\n SESSION.post('Profiler.startPreciseCoverage', {\n callCount: true,\n detailed: true,\n })\n}\n/* c8 ignore stop */\n\nexport const coverageOnProcessEnd = (\n cwd: string,\n processInfo: ProcessInfoNodeData\n) => {\n // Similar to the coverage tracking bootstrap problem above, c8\n // doesn't see that this function runs, even though it DOES see\n // that the function defined below runs, which is weird.\n /* c8 ignore start */\n if (!SESSION) return\n const session = SESSION\n\n const f = `${cwd}/.tap/coverage/${processInfo.uuid}.json`\n mkdirSync(`${cwd}/.tap/coverage`, { recursive: true })\n\n session.post('Profiler.takePreciseCoverage', (er, cov) => {\n session.post('Profiler.stopPreciseCoverage')\n /* c8 ignore stop */\n\n // something very strange and bad happened\n /* c8 ignore start */\n if (er) {\n throw er\n }\n /* c8 ignore stop */\n\n // Create a source-map-cache that c8 uses in report generation\n const sourceMapCache: {\n [k: string]: {\n lineLengths: number[]\n data: SourceMapPayload\n }\n } = {}\n Object.assign(cov, {\n 'source-map-cache': sourceMapCache,\n })\n\n cov.result = cov.result.filter(obj => {\n if (!/^file:/.test(obj.url)) {\n return false\n }\n const f = fileURLToPath(obj.url)\n // see if it has a source map\n // need to look up via the url, not the file path, because mocks\n // attach a tapmock search param, which is in node's internal key.\n const sources = lookupSources(obj.url)\n if (!fileCovered(f, sources, processInfo.files)) {\n return false\n }\n // Most of the time this will be cached at the time of recording, but\n // if it's the last module loaded, or transpiled in-place by ts-node,\n // the sourcemap won't be pre-loaded and will have to be looked up.\n const s = findSourceMapSafe(obj.url)\n const { payload } = s || { payload: null }\n if (payload) {\n sourceMapCache[obj.url] = Object.assign(Object.create(null), {\n /* c8 ignore start */\n // node's SourceMap objects provide this as of 20.5.0\n //@ts-ignore\n lineLengths: s?.lineLengths || getLineLengths(f),\n /* c8 ignore stop */\n data: payload,\n })\n }\n return true\n })\n\n writeFileSync(f, JSON.stringify(cov, null, 2) + '\\n', 'utf8')\n /* c8 ignore start */\n })\n}\n/* c8 ignore stop */\n"]}
{"version":3,"file":"register-coverage.js","sourceRoot":"","sources":["../../src/register-coverage.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,8DAA8D;AAC9D,MAAM,CAAC,GAAG,OAAO,CAAA;AACjB,MAAM,OAAO,GAAG,CAAC,CAAC,GAAG,CAAC,4BAA4B,KAAK,GAAG,CAAA;AAC1D,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAExC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACxC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ACrE,mEAAmE;YACnE,MAAM,CAAC,GAAG,iBAAiB,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;YACpC,MAAM,EAAE,OAAO,EAAE,GAAG,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAA;YAC1C,IAAI,OAAO,EAAE;gBACX,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;oBAC3D,qBAAqB;oBACrB,qDAAqD;oBACrD,YAAY;oBACZ,WAAW,EAAE,CAAC,EAAE,WAAW,IAAI,cAAc,CAAC,CAAC,CAAC;oBAChD,oBAAoB;oBACpB,IAAI,EAAE,OAAO;iBACd,CAAC,CAAA;aACH;YACD,OAAO,IAAI,CAAA;QACb,CAAC,CAAC,CAAA;QAEF,aAAa,CAAC,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,EAAE,MAAM,CAAC,CAAA;QAC7D,qBAAqB;IACvB,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA;AACD,oBAAoB","sourcesContent":["// start tracking coverage, unless disabled explicltly\n// export so that we know to collect at the end of the process\nconst p = process\nconst enabled = p.env._TAPJS_PROCESSINFO_COVERAGE_ !== '0'\nimport { mkdirSync, writeFileSync } from 'node:fs'\nimport { Session } from 'node:inspector'\nimport { SourceMapPayload } from 'node:module'\nimport { resolve } from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport { findSourceMapSafe } from './find-source-map-safe.js'\nimport { getExclude } from './get-exclude.js'\nimport { getLineLengths } from './line-lengths.js'\nimport { lookupSources } from './lookup-sources.js'\nimport { ProcessInfoNodeData } from './process-info-node.js'\n\nexport let SESSION: Session | undefined = undefined\n\n// This is a \\n delimited list of files to show coverage for\n// If not set, or empty, then coverage is included for all files\n// that pass the exclusion RegExp filter. If included in this list,\n// then coverage will be recorded, even if it matches exclude.\nconst cfEnv = p.env._TAPJS_PROCESSINFO_COV_FILES_ || ''\nconst coveredFiles: string[] = cfEnv\n .trim()\n .split('\\n')\n .filter(f => !!f)\n\n// NB: coverage exclusion is in addition to processinfo\n// exclusion. Only show coverage for a file we care\n// about at least somewhat, but coverage is a subset.\nconst cxEnv = p.env._TAPJS_PROCESSINFO_COV_EXCLUDE_FILES_ || ''\nconst uncoveredFiles: string[] = cxEnv\n .trim()\n .split('\\n')\n .filter(f => !!f)\n\nconst exclude = p.env._TAPJS_PROCESSINFO_COV_EXCLUDE_\n ? getExclude('_TAPJS_PROCESSINFO_COV_EXCLUDE_', false)\n : undefined\n\nconst fileCovered = (\n f: string,\n sources: string[] = [],\n files: string[] = []\n) => {\n const testFiles = [f]\n for (const src of sources || []) {\n testFiles.push(\n resolve(src.startsWith('file://') ? fileURLToPath(src) : src)\n )\n }\n\n // never include coverage if the file is fully ignored.\n if (!testFiles.some(f => files.includes(f))) return false\n\n // if at least one of them are explicitly covered, then include it,\n // otherwise omit if we explicitly listed\n if (coveredFiles.length) {\n return testFiles.some(f => coveredFiles.includes(f))\n }\n\n // if any of the filenames are explicitly excluded, no coverage\n // otherwise, it is covered\n return !testFiles.some(\n f => uncoveredFiles.includes(f) || exclude?.test(f)\n )\n}\n\n// C8 can't see that this function runs, best theory is that it\n// collides with what it's doing with the coverage it's collecting\n// This ignore can possibly be removed once this is being tested\n// with a version of tap that uses this library, but it might just\n// be an unresolveable bootstrap problem.\n// The test does verify that it ran, because otherwise, there would\n// be no coverage, and it verifies that it gets the expected coverage.\n/* c8 ignore start */\nexport const register = () => {\n if (!enabled) return\n p.env._TAPJS_PROCESSINFO_COVERAGE_ = '1'\n\n SESSION = new Session()\n SESSION.connect()\n SESSION.post('Profiler.enable')\n SESSION.post('Runtime.enable')\n SESSION.post('Profiler.startPreciseCoverage', {\n callCount: true,\n detailed: true,\n })\n}\n/* c8 ignore stop */\n\nexport const coverageOnProcessEnd = (\n cwd: string,\n processInfo: ProcessInfoNodeData\n) => {\n // Similar to the coverage tracking bootstrap problem above, c8\n // doesn't see that this function runs, even though it DOES see\n // that the function defined below runs, which is weird.\n /* c8 ignore start */\n if (!SESSION) return\n const session = SESSION\n\n const f = `${cwd}/.tap/coverage/${processInfo.uuid}.json`\n mkdirSync(`${cwd}/.tap/coverage`, { recursive: true })\n\n session.post('Profiler.takePreciseCoverage', (er, cov) => {\n session.post('Profiler.stopPreciseCoverage')\n /* c8 ignore stop */\n\n // something very strange and bad happened\n /* c8 ignore start */\n if (er) {\n throw er\n }\n /* c8 ignore stop */\n\n // Create a source-map-cache that c8 uses in report generation\n const sourceMapCache: {\n [k: string]: {\n lineLengths: number[]\n data: SourceMapPayload\n }\n } = {}\n Object.assign(cov, {\n 'source-map-cache': sourceMapCache,\n })\n\n cov.result = cov.result.filter(obj => {\n if (!/^file:/.test(obj.url)) {\n return false\n }\n const f = fileURLToPath(obj.url)\n // see if it has a source map\n // need to look up via the url, not the file path, because mocks\n // attach a tapmock search param, which is in node's internal key.\n const sources = lookupSources(obj.url, true)\n if (!fileCovered(f, sources, processInfo.files)) {\n return false\n }\n // Most of the time this will be cached at the time of recording, but\n // if it's the last module loaded, or transpiled in-place by ts-node,\n // the sourcemap won't be pre-loaded and will have to be looked up.\n const s = findSourceMapSafe(obj.url)\n const { payload } = s || { payload: null }\n if (payload) {\n sourceMapCache[obj.url] = Object.assign(Object.create(null), {\n /* c8 ignore start */\n // node's SourceMap objects provide this as of 20.5.0\n //@ts-ignore\n lineLengths: s?.lineLengths || getLineLengths(f),\n /* c8 ignore stop */\n data: payload,\n })\n }\n return true\n })\n\n writeFileSync(f, JSON.stringify(cov, null, 2) + '\\n', 'utf8')\n /* c8 ignore start */\n })\n}\n/* c8 ignore stop */\n"]}
{
"name": "@tapjs/processinfo",
"version": "3.1.4",
"version": "3.1.5",
"files": [

@@ -5,0 +5,0 @@ "dist"