@tapjs/processinfo 3.1.11 → 3.1.12

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.
@@ -8,7 +8,18 @@ import { getProcessInfo } from './get-process-info.js';
8
8
  import { saveLineLengths } from './line-lengths.js';
9
9
  import { likelyHasSourceMap } from './lookup-sources.js';
10
10
  import { loadSync } from './hooks.mjs';
11
- if (MODULE.registerHooks) {
11
+ // sync hooks not stable until 24.13.1
12
+ const version = (globalThis.process?.versions?.node ?? '0.0.0')
13
+ .split('.')
14
+ .map(n => parseInt(n, 10));
15
+ // if we ONLY have registerHooks, use that. otherwise, version detect.
16
+ // registerHooks was present but very buggy in earlier versions
17
+ const useSyncHooks = typeof MODULE.registerHooks === 'function' &&
18
+ (!MODULE.register ||
19
+ version[0] > 25 ||
20
+ (version[0] === 25 && version[1] >= 1) ||
21
+ (version[0] === 24 && version[1] >= 13));
22
+ if (useSyncHooks) {
12
23
  MODULE.registerHooks({ load: loadSync });
13
24
  }
14
25
  else {
@@ -1 +1 @@
1
- {"version":3,"file":"import.mjs","sourceRoot":"","sources":["../../src/import.mts"],"names":[],"mappings":"AAAA,iCAAiC;AACjC,wEAAwE;AACxE,4DAA4D;AAC5D,OAAO,MAAM,MAAM,aAAa,CAAA;AAChC,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;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAEtC,IAAK,MAAiC,CAAC,aAAa,EAAE,CAAC;IACrD,MAAM,CAAC,aAAa,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAA;AAC1C,CAAC;KAAM,CAAC;IACN,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,IAAI,cAAc,EAAE,CAAA;IAE7C,+BAA+B;IAC/B,0CAA0C;IAC1C,MAAM,WAAW,GAAG,cAAc,EAAE,CAAA;IACpC,KAAK,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE;QACjD,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QAChC,eAAe,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;QAClC,IAAI,GAAG;YAAE,kBAAkB,CAAC,GAAG,CAAC,CAAA;IAClC,CAAC,CAAC,CAAA;IAEF,KAAK,CAAC,KAAK,EAAE,CAAA;IACb,KAAK,CAAC,KAAK,EAAE,CAAA;IACb,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAAC,cAAc,CAAC,EAAE;QAChD,SAAS,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG;QAC1B,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE;QACrB,YAAY,EAAE,CAAC,KAAK,CAAC;KACtB,CAAC,CAAA;AACJ,CAAC","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 MODULE 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'\nimport { loadSync } from './hooks.mjs'\n\nif ((MODULE as Partial<typeof MODULE>).registerHooks) {\n MODULE.registerHooks({ load: loadSync })\n} else {\n const { port1, port2 } = new MessageChannel()\n\n // must be called eagerly here.\n // this does all the registration as well.\n const processInfo = getProcessInfo()\n port1.on('message', ({ filename, content, url }) => {\n processInfo.files.push(filename)\n saveLineLengths(filename, content)\n if (url) likelyHasSourceMap(url)\n })\n\n port1.unref()\n port2.unref()\n MODULE.register(getImportMetaURL(`./loader.mjs`), {\n parentURL: import.meta.url,\n data: { port: port2 },\n transferList: [port2],\n })\n}\n"]}
1
+ {"version":3,"file":"import.mjs","sourceRoot":"","sources":["../../src/import.mts"],"names":[],"mappings":"AAAA,iCAAiC;AACjC,wEAAwE;AACxE,4DAA4D;AAC5D,OAAO,MAAM,MAAM,aAAa,CAAA;AAChC,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;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAEtC,sCAAsC;AACtC,MAAM,OAAO,GAAG,CAAC,UAAU,CAAC,OAAO,EAAE,QAAQ,EAAE,IAAI,IAAI,OAAO,CAAC;KAC5D,KAAK,CAAC,GAAG,CAAC;KACV,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,EAAE,CAAC,CAA6B,CAAA;AAExD,sEAAsE;AACtE,+DAA+D;AAC/D,MAAM,YAAY,GAChB,OAAO,MAAM,CAAC,aAAa,KAAK,UAAU;IAC1C,CAAC,CAAC,MAAM,CAAC,QAAQ;QACf,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE;QACf,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,EAAE,IAAI,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QACtC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,EAAE,IAAI,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAA;AAE5C,IAAI,YAAY,EAAE,CAAC;IACjB,MAAM,CAAC,aAAa,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAA;AAC1C,CAAC;KAAM,CAAC;IACN,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,IAAI,cAAc,EAAE,CAAA;IAE7C,+BAA+B;IAC/B,0CAA0C;IAC1C,MAAM,WAAW,GAAG,cAAc,EAAE,CAAA;IACpC,KAAK,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE;QACjD,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QAChC,eAAe,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;QAClC,IAAI,GAAG;YAAE,kBAAkB,CAAC,GAAG,CAAC,CAAA;IAClC,CAAC,CAAC,CAAA;IAEF,KAAK,CAAC,KAAK,EAAE,CAAA;IACb,KAAK,CAAC,KAAK,EAAE,CAAA;IACb,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAAC,cAAc,CAAC,EAAE;QAChD,SAAS,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG;QAC1B,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE;QACrB,YAAY,EAAE,CAAC,KAAK,CAAC;KACtB,CAAC,CAAA;AACJ,CAAC","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 MODULE 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'\nimport { loadSync } from './hooks.mjs'\n\n// sync hooks not stable until 24.13.1\nconst version = (globalThis.process?.versions?.node ?? '0.0.0')\n .split('.')\n .map(n => parseInt(n, 10)) as [number, number, number]\n\n// if we ONLY have registerHooks, use that. otherwise, version detect.\n// registerHooks was present but very buggy in earlier versions\nconst useSyncHooks =\n typeof MODULE.registerHooks === 'function' &&\n (!MODULE.register ||\n version[0] > 25 ||\n (version[0] === 25 && version[1] >= 1) ||\n (version[0] === 24 && version[1] >= 13))\n\nif (useSyncHooks) {\n MODULE.registerHooks({ load: loadSync })\n} else {\n const { port1, port2 } = new MessageChannel()\n\n // must be called eagerly here.\n // this does all the registration as well.\n const processInfo = getProcessInfo()\n port1.on('message', ({ filename, content, url }) => {\n processInfo.files.push(filename)\n saveLineLengths(filename, content)\n if (url) likelyHasSourceMap(url)\n })\n\n port1.unref()\n port2.unref()\n MODULE.register(getImportMetaURL(`./loader.mjs`), {\n parentURL: import.meta.url,\n data: { port: port2 },\n transferList: [port2],\n })\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tapjs/processinfo",
3
- "version": "3.1.11",
3
+ "version": "3.1.12",
4
4
  "files": [
5
5
  "dist"
6
6
  ],