@tapjs/processinfo 3.1.10 → 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.
- package/dist/esm/hooks.d.mts +3 -0
- package/dist/esm/hooks.d.mts.map +1 -1
- package/dist/esm/hooks.mjs +31 -7
- package/dist/esm/hooks.mjs.map +1 -1
- package/dist/esm/import.mjs +35 -18
- package/dist/esm/import.mjs.map +1 -1
- package/package.json +4 -5
package/dist/esm/hooks.d.mts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import type { MessagePort } from 'node:worker_threads';
|
|
2
|
+
import { LoadHookSync, ModuleSource } from 'node:module';
|
|
2
3
|
export declare const globalPreload: (context: {
|
|
3
4
|
port?: MessagePort;
|
|
4
5
|
}) => string;
|
|
5
6
|
export declare const initialize: ({ port }: {
|
|
6
7
|
port: MessagePort;
|
|
7
8
|
}) => void;
|
|
9
|
+
export declare const record: (url: string, content?: ModuleSource, originSource?: string) => void;
|
|
10
|
+
export declare const loadSync: LoadHookSync;
|
|
8
11
|
export declare const load: (url: string, context: any, nextLoad: Function) => Promise<any>;
|
|
9
12
|
export declare const reset: () => void;
|
|
10
13
|
//# sourceMappingURL=hooks.d.mts.map
|
package/dist/esm/hooks.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.mts","sourceRoot":"","sources":["../../src/hooks.mts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hooks.d.mts","sourceRoot":"","sources":["../../src/hooks.mts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAWtD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAQxD,eAAO,MAAM,aAAa,GAAI,SAAS;IAAE,IAAI,CAAC,EAAE,WAAW,CAAA;CAAE,WA0B5D,CAAA;AAED,eAAO,MAAM,UAAU,GAAI,UAAU;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE,SAEzD,CAAA;AAED,eAAO,MAAM,MAAM,GACjB,KAAK,MAAM,EACX,UAAU,YAAY,EACtB,eAAe,MAAM,SAqCtB,CAAA;AAGD,eAAO,MAAM,QAAQ,EAAE,YAmBtB,CAAA;AAED,eAAO,MAAM,IAAI,GACf,KAAK,MAAM,EACX,SAAS,GAAG,EACZ,UAAU,QAAQ,iBA2BnB,CAAA;AAGD,eAAO,MAAM,KAAK,YAGjB,CAAA"}
|
package/dist/esm/hooks.mjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
// hooks used by loader-legacy.mjs and loader.mjs
|
|
2
|
-
import { readFile } from 'node:fs/promises';
|
|
3
2
|
import { parse } from 'node:path';
|
|
4
3
|
import { fileURLToPath } from 'node:url';
|
|
5
4
|
import { getExclude } from './get-exclude.js';
|
|
@@ -8,6 +7,7 @@ import { fakeMains } from './get-main.js';
|
|
|
8
7
|
import { getProcessInfo as _getProcessInfo, reset as processInfoReset, } from './get-process-info.js';
|
|
9
8
|
import { saveLineLengths } from './line-lengths.js';
|
|
10
9
|
import { likelyHasSourceMap } from './lookup-sources.js';
|
|
10
|
+
import { readFileSync } from 'node:fs';
|
|
11
11
|
let getProcessInfo = _getProcessInfo;
|
|
12
12
|
let PORT = undefined;
|
|
13
13
|
const exclude = getExclude('_TAPJS_PROCESSINFO_EXCLUDE_', false);
|
|
@@ -42,7 +42,7 @@ if (typeof port !== 'undefined') {
|
|
|
42
42
|
export const initialize = ({ port }) => {
|
|
43
43
|
PORT = port;
|
|
44
44
|
};
|
|
45
|
-
const record =
|
|
45
|
+
export const record = (url, content, originSource) => {
|
|
46
46
|
const filename = url.startsWith('file://') ? fileURLToPath(url) : url;
|
|
47
47
|
if (exclude.test(filename)) {
|
|
48
48
|
return;
|
|
@@ -55,8 +55,12 @@ const record = async (url, content, originSource) => {
|
|
|
55
55
|
(content === undefined && url.startsWith('file://'))) {
|
|
56
56
|
// try to read the file, fall back to the content we have, or ''
|
|
57
57
|
// if any source maps anywhere, flag it as possibly having one
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
try {
|
|
59
|
+
originSource ??= readFileSync(filename, 'utf8') ?? '';
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
originSource = String(content ?? '');
|
|
63
|
+
}
|
|
60
64
|
}
|
|
61
65
|
maybeSM = smMagicComment.test(originSource);
|
|
62
66
|
if (PORT) {
|
|
@@ -69,11 +73,31 @@ const record = async (url, content, originSource) => {
|
|
|
69
73
|
else {
|
|
70
74
|
// call lazily so we don't double-register
|
|
71
75
|
getProcessInfo().files.push(filename);
|
|
72
|
-
saveLineLengths(filename, content);
|
|
76
|
+
saveLineLengths(filename, String(content));
|
|
73
77
|
if (maybeSM)
|
|
74
78
|
likelyHasSourceMap(url);
|
|
75
79
|
}
|
|
76
80
|
};
|
|
81
|
+
// Used by synchronous module.registerHooks
|
|
82
|
+
export const loadSync = (url, context, nextLoad) => {
|
|
83
|
+
if (url.startsWith('file://')) {
|
|
84
|
+
const filename = fileURLToPath(url);
|
|
85
|
+
const { ext } = parse(filename);
|
|
86
|
+
if (!ext) {
|
|
87
|
+
record(url);
|
|
88
|
+
return {
|
|
89
|
+
...context,
|
|
90
|
+
format: 'commonjs',
|
|
91
|
+
shortCircuit: true,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
// get line lengths from final source
|
|
96
|
+
// if origin source doesn't match, check for possible source map
|
|
97
|
+
const ret = nextLoad(url, context);
|
|
98
|
+
record(url, ret.source);
|
|
99
|
+
return ret;
|
|
100
|
+
};
|
|
77
101
|
export const load = async (url, context, nextLoad) => {
|
|
78
102
|
if (url.startsWith('file://')) {
|
|
79
103
|
const filename = fileURLToPath(url);
|
|
@@ -85,7 +109,7 @@ export const load = async (url, context, nextLoad) => {
|
|
|
85
109
|
// TODO: should we just let this fail? It fails *without* the loader,
|
|
86
110
|
// after all.
|
|
87
111
|
if (!ext) {
|
|
88
|
-
|
|
112
|
+
record(url);
|
|
89
113
|
return {
|
|
90
114
|
...context,
|
|
91
115
|
format: 'commonjs',
|
|
@@ -97,7 +121,7 @@ export const load = async (url, context, nextLoad) => {
|
|
|
97
121
|
// if origin source doesn't match, check for possible source map
|
|
98
122
|
const originSource = context.source;
|
|
99
123
|
const ret = await nextLoad(url, context);
|
|
100
|
-
|
|
124
|
+
record(url, ret.source, originSource);
|
|
101
125
|
return ret;
|
|
102
126
|
};
|
|
103
127
|
// just for testing purposes
|
package/dist/esm/hooks.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.mjs","sourceRoot":"","sources":["../../src/hooks.mts"],"names":[],"mappings":"AAAA,iDAAiD;
|
|
1
|
+
{"version":3,"file":"hooks.mjs","sourceRoot":"","sources":["../../src/hooks.mts"],"names":[],"mappings":"AAAA,iDAAiD;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAA;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAExC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AACzC,OAAO,EACL,cAAc,IAAI,eAAe,EACjC,KAAK,IAAI,gBAAgB,GAC1B,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAGtC,IAAI,cAAc,GAAG,eAAe,CAAA;AACpC,IAAI,IAAI,GAA4B,SAAS,CAAA;AAE7C,MAAM,OAAO,GAAG,UAAU,CAAC,6BAA6B,EAAE,KAAK,CAAC,CAAA;AAChE,MAAM,cAAc,GAAG,oCAAoC,CAAA;AAE3D,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;IACF,IAAI,GAAG,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;QAC9B,MAAM,QAAQ,GAAG,aAAa,CAAC,GAAG,CAAC,CAAA;QACnC,MAAM,EAAE,GAAG,EAAE,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAA;QAC/B,+DAA+D;QAC/D,gEAAgE;QAChE,kEAAkE;QAClE,2BAA2B;QAC3B,qEAAqE;QACrE,aAAa;QACb,IAAI,CAAC,GAAG,EAAE,CAAC;YACT,MAAM,CAAC,GAAG,CAAC,CAAA;YACX,OAAO;gBACL,GAAG,OAAO;gBACV,MAAM,EAAE,UAAU;gBAClB,YAAY,EAAE,IAAI;aACnB,CAAA;QACH,CAAC;IACH,CAAC;IAED,qCAAqC;IACrC,gEAAgE;IAChE,MAAM,YAAY,GAAG,OAAO,CAAC,MAAM,CAAA;IACnC,MAAM,GAAG,GAAG,MAAM,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;IACxC,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAA;IACrC,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA;AAED,4BAA4B;AAC5B,MAAM,CAAC,MAAM,KAAK,GAAG,GAAG,EAAE;IACxB,IAAI,GAAG,SAAS,CAAA;IAChB,cAAc,GAAG,gBAAgB,EAAE,CAAC,cAAc,CAAA;AACpD,CAAC,CAAA","sourcesContent":["// hooks used by loader-legacy.mjs and loader.mjs\nimport { parse } from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport type { MessagePort } from 'node:worker_threads'\nimport { getExclude } from './get-exclude.js'\nimport { getImportMetaURL } from './get-import-meta-url.js'\nimport { fakeMains } from './get-main.js'\nimport {\n getProcessInfo as _getProcessInfo,\n reset as processInfoReset,\n} from './get-process-info.js'\nimport { saveLineLengths } from './line-lengths.js'\nimport { likelyHasSourceMap } from './lookup-sources.js'\nimport { readFileSync } from 'node:fs'\nimport { LoadHookSync, ModuleSource } from 'node:module'\n\nlet getProcessInfo = _getProcessInfo\nlet PORT: undefined | MessagePort = undefined\n\nconst exclude = getExclude('_TAPJS_PROCESSINFO_EXCLUDE_', false)\nconst smMagicComment = /\\/[*\\/]#\\s+sourceMappingURL=[^\\s]+/\n\nexport const globalPreload = (context: { port?: MessagePort }) => {\n // this will be something like path/to/dist/esm/lib/esm.mjs\n // but we need path/to/dist/commonjs/cjs.js\n const base = getImportMetaURL('../commonjs/[global preload].js')\n const { port } = context || {}\n PORT = port\n return `\nif (typeof port !== 'undefined') {\n const { createRequire } = getBuiltin('module')\n const { fileURLToPath } = getBuiltin('url')\n const require = createRequire(${JSON.stringify(base)})\n const { getProcessInfo } = require('./get-process-info.js')\n const { saveLineLengths } = require('./line-lengths.js')\n const { likelyHasSourceMap } = require('./lookup-sources.js')\n // must be called eagerly here.\n // this does all the registration as well.\n const processInfo = getProcessInfo()\n port.onmessage = (e) => {\n const { filename, content, url } = e.data\n processInfo.files.push(filename)\n saveLineLengths(filename, content)\n if (url) likelyHasSourceMap(url)\n }\n port.unref()\n}\n`\n}\n\nexport const initialize = ({ port }: { port: MessagePort }) => {\n PORT = port\n}\n\nexport const record = (\n url: string,\n content?: ModuleSource,\n originSource?: string,\n) => {\n const filename = url.startsWith('file://') ? fileURLToPath(url) : url\n if (exclude.test(filename)) {\n return\n }\n if (fakeMains.includes(filename)) {\n return\n }\n\n let maybeSM = false\n if (\n originSource !== content ||\n (content === undefined && url.startsWith('file://'))\n ) {\n // try to read the file, fall back to the content we have, or ''\n // if any source maps anywhere, flag it as possibly having one\n try {\n originSource ??= readFileSync(filename, 'utf8') ?? ''\n } catch {\n originSource = String(content ?? '')\n }\n }\n maybeSM = smMagicComment.test(originSource as string)\n\n if (PORT) {\n PORT.postMessage({\n filename,\n content,\n ...(maybeSM && { url }),\n })\n } else {\n // call lazily so we don't double-register\n getProcessInfo().files.push(filename)\n saveLineLengths(filename, String(content))\n if (maybeSM) likelyHasSourceMap(url)\n }\n}\n\n// Used by synchronous module.registerHooks\nexport const loadSync: LoadHookSync = (url, context, nextLoad) => {\n if (url.startsWith('file://')) {\n const filename = fileURLToPath(url)\n const { ext } = parse(filename)\n if (!ext) {\n record(url)\n return {\n ...context,\n format: 'commonjs',\n shortCircuit: true,\n }\n }\n }\n\n // get line lengths from final source\n // if origin source doesn't match, check for possible source map\n const ret = nextLoad(url, context)\n record(url, ret.source)\n return ret\n}\n\nexport const load = async (\n url: string,\n context: any,\n nextLoad: Function,\n) => {\n if (url.startsWith('file://')) {\n const filename = fileURLToPath(url)\n const { ext } = parse(filename)\n // Package bins will sometimes have an extensionless bin script\n // instead of just naming their extensioned file and letting npm\n // symlink it for them. Don't blow up when this happens, just tell\n // node that it's commonjs.\n // TODO: should we just let this fail? It fails *without* the loader,\n // after all.\n if (!ext) {\n record(url)\n return {\n ...context,\n format: 'commonjs',\n shortCircuit: true,\n }\n }\n }\n\n // get line lengths from final source\n // if origin source doesn't match, check for possible source map\n const originSource = context.source\n const ret = await nextLoad(url, context)\n record(url, ret.source, originSource)\n return ret\n}\n\n// just for testing purposes\nexport const reset = () => {\n PORT = undefined\n getProcessInfo = processInfoReset().getProcessInfo\n}\n"]}
|
package/dist/esm/import.mjs
CHANGED
|
@@ -1,27 +1,44 @@
|
|
|
1
1
|
//@ts-ignore - added in node 20.6
|
|
2
2
|
// this is the argument for --import, which does the initial main-thread
|
|
3
3
|
// work, and then registers the loader without globalPreload
|
|
4
|
-
import
|
|
4
|
+
import MODULE from 'node:module';
|
|
5
5
|
import { MessageChannel } from 'node:worker_threads';
|
|
6
6
|
import { getImportMetaURL } from './get-import-meta-url.js';
|
|
7
7
|
import { getProcessInfo } from './get-process-info.js';
|
|
8
8
|
import { saveLineLengths } from './line-lengths.js';
|
|
9
9
|
import { likelyHasSourceMap } from './lookup-sources.js';
|
|
10
|
-
|
|
11
|
-
//
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
});
|
|
10
|
+
import { loadSync } from './hooks.mjs';
|
|
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) {
|
|
23
|
+
MODULE.registerHooks({ load: loadSync });
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
const { port1, port2 } = new MessageChannel();
|
|
27
|
+
// must be called eagerly here.
|
|
28
|
+
// this does all the registration as well.
|
|
29
|
+
const processInfo = getProcessInfo();
|
|
30
|
+
port1.on('message', ({ filename, content, url }) => {
|
|
31
|
+
processInfo.files.push(filename);
|
|
32
|
+
saveLineLengths(filename, content);
|
|
33
|
+
if (url)
|
|
34
|
+
likelyHasSourceMap(url);
|
|
35
|
+
});
|
|
36
|
+
port1.unref();
|
|
37
|
+
port2.unref();
|
|
38
|
+
MODULE.register(getImportMetaURL(`./loader.mjs`), {
|
|
39
|
+
parentURL: import.meta.url,
|
|
40
|
+
data: { port: port2 },
|
|
41
|
+
transferList: [port2],
|
|
42
|
+
});
|
|
43
|
+
}
|
|
27
44
|
//# sourceMappingURL=import.mjs.map
|
package/dist/esm/import.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"import.mjs","sourceRoot":"","sources":["../../src/import.mts"],"names":[],"mappings":"AAAA,iCA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AM,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.
|
|
3
|
+
"version": "3.1.12",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist"
|
|
6
6
|
],
|
|
@@ -52,8 +52,8 @@
|
|
|
52
52
|
"prepare": "tshy",
|
|
53
53
|
"pretest": "npm run prepare",
|
|
54
54
|
"presnap": "npm run prepare",
|
|
55
|
-
"test": "
|
|
56
|
-
"snap": "
|
|
55
|
+
"test": "tap",
|
|
56
|
+
"snap": "tap",
|
|
57
57
|
"format": "prettier --write . --log-level warn",
|
|
58
58
|
"typedoc": "typedoc --tsconfig .tshy/esm.json ./src/*.ts ./src/*.mts"
|
|
59
59
|
},
|
|
@@ -85,11 +85,10 @@
|
|
|
85
85
|
"license": "BlueOak-1.0.0",
|
|
86
86
|
"devDependencies": {
|
|
87
87
|
"@npmcli/promise-spawn": "^2.0.1",
|
|
88
|
-
"@types/node": "^
|
|
88
|
+
"@types/node": "^25.7.0",
|
|
89
89
|
"@types/npmcli__promise-spawn": "^6.0.0",
|
|
90
90
|
"@types/tap": "^15.0.8",
|
|
91
91
|
"@types/uuid": "^9.0.1",
|
|
92
|
-
"c8": "^7.13.0",
|
|
93
92
|
"diff": "^5.0.0",
|
|
94
93
|
"prettier": "^3.6.2",
|
|
95
94
|
"sync-content": "^1.0.2",
|