@tapjs/processinfo 2.0.0 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/mjs/esm.d.mts +1 -8
- package/dist/mjs/esm.d.mts.map +1 -1
- package/dist/mjs/esm.mjs +20 -22
- package/dist/mjs/esm.mjs.map +1 -1
- package/package.json +3 -3
- package/dist/cjs/x.d.ts +0 -2
- package/dist/cjs/x.d.ts.map +0 -1
- package/dist/cjs/x.js +0 -5
- package/dist/cjs/x.js.map +0 -1
- package/dist/mjs/x.d.ts +0 -2
- package/dist/mjs/x.d.ts.map +0 -1
- package/dist/mjs/x.js +0 -2
- package/dist/mjs/x.js.map +0 -1
package/dist/mjs/esm.d.mts
CHANGED
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
import type { Serializable } from 'worker_threads';
|
|
3
1
|
export * from './index.js';
|
|
4
|
-
|
|
5
|
-
postMessage: (x: Serializable) => any;
|
|
6
|
-
};
|
|
7
|
-
export declare const globalPreload: (context: {
|
|
8
|
-
port?: GPPort;
|
|
9
|
-
}) => string;
|
|
2
|
+
export declare const globalPreload: () => string;
|
|
10
3
|
export declare const load: (url: string, context: any, nextLoad: Function) => Promise<any>;
|
|
11
4
|
//# sourceMappingURL=esm.d.mts.map
|
package/dist/mjs/esm.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"esm.d.mts","sourceRoot":"","sources":["../../lib/esm.mts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"esm.d.mts","sourceRoot":"","sources":["../../lib/esm.mts"],"names":[],"mappings":"AAOA,cAAc,YAAY,CAAA;AAa1B,eAAO,MAAM,aAAa,cAczB,CAAA;AAGD,eAAO,MAAM,IAAI,QACV,MAAM,WACF,GAAG,YACF,QAAQ,iBASnB,CAAA"}
|
package/dist/mjs/esm.mjs
CHANGED
|
@@ -1,29 +1,33 @@
|
|
|
1
1
|
// usage: node '--loader=@tapjs/processinfo/esm' foo.mjs
|
|
2
2
|
import { fileURLToPath } from 'url';
|
|
3
3
|
import { getExclude } from './get-exclude.js';
|
|
4
|
-
import { getProcessInfo } from './get-process-info.js';
|
|
5
4
|
import { resolve } from './require-resolve.js';
|
|
6
5
|
// copy main module so that we can --loader=@tapjs/processinfo and use
|
|
7
6
|
// this as the entry point as well.
|
|
8
7
|
export * from './index.js';
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
import { channel } from 'diagnostics_channel';
|
|
9
|
+
const PORT = channel('@tapjs/processinfo.files-loaded');
|
|
10
|
+
// on Node v20, loaders are executed in a separate isolated environment
|
|
11
|
+
// As a result, to register coverage and track files, we need to act in
|
|
12
|
+
// the globalPreload function. The load() method posts a message with the
|
|
13
|
+
// filename being loaded, because any registrations that happen in the
|
|
14
|
+
// loader thread will not have any effect.
|
|
15
|
+
// Using diagnostics channel means that this will keep working in all
|
|
16
|
+
// the versions supported, and easily be transferrable to an --import
|
|
17
|
+
// argument that attaches the loaders at run-time.
|
|
18
|
+
export const globalPreload = () => {
|
|
11
19
|
// this will be something like path/to/dist/mjs/lib/esm.mjs
|
|
12
20
|
// but we need path/to/dist/cjs/cjs.js
|
|
13
21
|
const base = resolve('../cjs/cjs.js');
|
|
14
|
-
const { port } = context || {};
|
|
15
|
-
PORT = port;
|
|
16
22
|
return `
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
port.unref()
|
|
26
|
-
}
|
|
23
|
+
const { createRequire } = getBuiltin('module')
|
|
24
|
+
const require = createRequire(${JSON.stringify(base)})
|
|
25
|
+
const { getProcessInfo } = require('./get-process-info.js')
|
|
26
|
+
const processInfo = getProcessInfo()
|
|
27
|
+
const { channel, subscribe } = require('diagnostics_channel')
|
|
28
|
+
subscribe('@tapjs/processinfo.files-loaded',
|
|
29
|
+
(e) => processInfo.files.push(e)
|
|
30
|
+
)
|
|
27
31
|
`;
|
|
28
32
|
};
|
|
29
33
|
const exclude = getExclude('_TAPJS_PROCESSINFO_EXCLUDE_');
|
|
@@ -31,13 +35,7 @@ export const load = async (url, context, nextLoad) => {
|
|
|
31
35
|
if (/^file:/.test(url)) {
|
|
32
36
|
const filename = fileURLToPath(url);
|
|
33
37
|
if (!exclude.test(filename)) {
|
|
34
|
-
|
|
35
|
-
PORT.postMessage(filename);
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
// call lazily so we don't double-register
|
|
39
|
-
getProcessInfo().files.push(filename);
|
|
40
|
-
}
|
|
38
|
+
PORT.publish(filename);
|
|
41
39
|
}
|
|
42
40
|
}
|
|
43
41
|
return nextLoad(url, context);
|
package/dist/mjs/esm.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"esm.mjs","sourceRoot":"","sources":["../../lib/esm.mts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"esm.mjs","sourceRoot":"","sources":["../../lib/esm.mts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAA;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAE9C,sEAAsE;AACtE,mCAAmC;AACnC,cAAc,YAAY,CAAA;AAE1B,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAC7C,MAAM,IAAI,GAAG,OAAO,CAAC,iCAAiC,CAAC,CAAA;AAEvD,uEAAuE;AACvE,uEAAuE;AACvE,yEAAyE;AACzE,sEAAsE;AACtE,0CAA0C;AAC1C,qEAAqE;AACrE,qEAAqE;AACrE,kDAAkD;AAClD,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,EAAE;IAChC,2DAA2D;IAC3D,sCAAsC;IACtC,MAAM,IAAI,GAAG,OAAO,CAAC,eAAe,CAAC,CAAA;IACrC,OAAO;;gCAEuB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;;;;;;;CAOnD,CAAA;AACD,CAAC,CAAA;AAED,MAAM,OAAO,GAAG,UAAU,CAAC,6BAA6B,CAAC,CAAA;AACzD,MAAM,CAAC,MAAM,IAAI,GAAG,KAAK,EACvB,GAAW,EACX,OAAY,EACZ,QAAkB,EAClB,EAAE;IACF,IAAI,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;QACtB,MAAM,QAAQ,GAAG,aAAa,CAAC,GAAG,CAAC,CAAA;QACnC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;YAC3B,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;SACvB;KACF;IACD,OAAO,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;AAC/B,CAAC,CAAA","sourcesContent":["// usage: node '--loader=@tapjs/processinfo/esm' foo.mjs\nimport { fileURLToPath } from 'url'\nimport { getExclude } from './get-exclude.js'\nimport { resolve } from './require-resolve.js'\n\n// copy main module so that we can --loader=@tapjs/processinfo and use\n// this as the entry point as well.\nexport * from './index.js'\n\nimport { channel } from 'diagnostics_channel'\nconst PORT = channel('@tapjs/processinfo.files-loaded')\n\n// on Node v20, loaders are executed in a separate isolated environment\n// As a result, to register coverage and track files, we need to act in\n// the globalPreload function. The load() method posts a message with the\n// filename being loaded, because any registrations that happen in the\n// loader thread will not have any effect.\n// Using diagnostics channel means that this will keep working in all\n// the versions supported, and easily be transferrable to an --import\n// argument that attaches the loaders at run-time.\nexport const globalPreload = () => {\n // this will be something like path/to/dist/mjs/lib/esm.mjs\n // but we need path/to/dist/cjs/cjs.js\n const base = resolve('../cjs/cjs.js')\n return `\nconst { createRequire } = getBuiltin('module')\nconst require = createRequire(${JSON.stringify(base)})\nconst { getProcessInfo } = require('./get-process-info.js')\nconst processInfo = getProcessInfo()\nconst { channel, subscribe } = require('diagnostics_channel')\nsubscribe('@tapjs/processinfo.files-loaded',\n (e) => processInfo.files.push(e)\n)\n`\n}\n\nconst exclude = getExclude('_TAPJS_PROCESSINFO_EXCLUDE_')\nexport const load = async (\n url: string,\n context: any,\n nextLoad: Function\n) => {\n if (/^file:/.test(url)) {\n const filename = fileURLToPath(url)\n if (!exclude.test(filename)) {\n PORT.publish(filename)\n }\n }\n return nextLoad(url, context)\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tapjs/processinfo",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"main": "./dist/cjs/index.js",
|
|
5
5
|
"types": "./dist/cjs/index.d.ts",
|
|
6
6
|
"module": "./dist/mjs/esm.mjs",
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
"exports": {
|
|
11
11
|
".": {
|
|
12
12
|
"import": {
|
|
13
|
-
"types": "./dist/mjs/esm.d.
|
|
14
|
-
"default": "./dist/mjs/esm.
|
|
13
|
+
"types": "./dist/mjs/esm.d.mts",
|
|
14
|
+
"default": "./dist/mjs/esm.mjs"
|
|
15
15
|
},
|
|
16
16
|
"require": {
|
|
17
17
|
"types": "./dist/cjs/index.d.ts",
|
package/dist/cjs/x.d.ts
DELETED
package/dist/cjs/x.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"x.d.ts","sourceRoot":"","sources":["../../lib/x.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,GAAG,QAAQ,CAAA"}
|
package/dist/cjs/x.js
DELETED
package/dist/cjs/x.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"x.js","sourceRoot":"","sources":["../../lib/x.ts"],"names":[],"mappings":";;;AAAa,QAAA,GAAG,GAAG,KAAK,CAAA","sourcesContent":["export const foo = 'bar'\n"]}
|
package/dist/mjs/x.d.ts
DELETED
package/dist/mjs/x.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"x.d.ts","sourceRoot":"","sources":["../../lib/x.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,GAAG,QAAQ,CAAA"}
|
package/dist/mjs/x.js
DELETED
package/dist/mjs/x.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"x.js","sourceRoot":"","sources":["../../lib/x.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,GAAG,GAAG,KAAK,CAAA","sourcesContent":["export const foo = 'bar'\n"]}
|