@ark/attest 0.44.5 → 0.44.7
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/out/cli/shared.d.ts +1 -1
- package/out/cli/shared.js +1 -1
- package/out/cli/trace.js +36 -30
- package/package.json +3 -3
package/out/cli/shared.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const baseDiagnosticTscCmd = "
|
|
1
|
+
export declare const baseDiagnosticTscCmd = "npx --package=typescript --no-install tsc --noEmit --extendedDiagnostics --incremental false --tsBuildInfoFile null";
|
package/out/cli/shared.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const baseDiagnosticTscCmd = "
|
|
1
|
+
export const baseDiagnosticTscCmd = "npx --package=typescript --no-install tsc --noEmit --extendedDiagnostics --incremental false --tsBuildInfoFile null";
|
package/out/cli/trace.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { ensureDir, readJson, writeFile } from "@ark/fs";
|
|
2
|
-
import { execSync } from "child_process";
|
|
1
|
+
import { ensureDir, getShellOutput, readJson, writeFile } from "@ark/fs";
|
|
3
2
|
import { existsSync } from "node:fs";
|
|
4
3
|
import { basename, join, relative } from "node:path";
|
|
5
4
|
import { resolve } from "path";
|
|
@@ -34,37 +33,44 @@ export const trace = async (args) => {
|
|
|
34
33
|
ensureDir(traceDir);
|
|
35
34
|
let tracingOutput = "";
|
|
36
35
|
outputCapture.clear();
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
finally {
|
|
45
|
-
outputCapture.write(`⏳ Analyzing type trace data for ${packageDir}...`);
|
|
46
|
-
analyzeTypeInstantiations(traceDir);
|
|
47
|
-
// Write summary file containing our messages followed by compiler output
|
|
48
|
-
// This ensures the initial message comes first in the file
|
|
49
|
-
const summaryPath = join(traceDir, "summary.txt");
|
|
50
|
-
const summaryContent = outputCapture.getBuffer().split("\n")[0] +
|
|
51
|
-
"\n" +
|
|
52
|
-
tracingOutput +
|
|
53
|
-
"\n" +
|
|
54
|
-
outputCapture.getBuffer().split("\n").slice(1).join("\n");
|
|
55
|
-
writeFile(summaryPath, summaryContent);
|
|
36
|
+
outputCapture.write(`⏳ Gathering type trace data for ${packageDir}...`);
|
|
37
|
+
tracingOutput = generateTraceData(traceDir, config.tsconfig, packageDir);
|
|
38
|
+
const traceFile = join(traceDir, "trace.json");
|
|
39
|
+
if (!existsSync(traceFile)) {
|
|
40
|
+
outputCapture.write(`❌ No trace data found (expected a file at ${join(traceDir, "trace.json")})`);
|
|
41
|
+
return;
|
|
56
42
|
}
|
|
43
|
+
outputCapture.write(`⏳ Analyzing type trace data for ${packageDir}...`);
|
|
44
|
+
analyzeTypeInstantiations(traceDir);
|
|
45
|
+
// Write summary file containing our messages followed by compiler output
|
|
46
|
+
// This ensures the initial message comes first in the file
|
|
47
|
+
const summaryPath = join(traceDir, "summary.txt");
|
|
48
|
+
const summaryContent = outputCapture.getBuffer().split("\n")[0] +
|
|
49
|
+
"\n" +
|
|
50
|
+
tracingOutput +
|
|
51
|
+
"\n" +
|
|
52
|
+
outputCapture.getBuffer().split("\n").slice(1).join("\n");
|
|
53
|
+
writeFile(summaryPath, summaryContent);
|
|
57
54
|
};
|
|
58
55
|
const generateTraceData = (traceDir, tsconfigPath, packageDir) => {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
cwd: packageDir
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
56
|
+
try {
|
|
57
|
+
// Capture the output instead of just displaying it
|
|
58
|
+
const output = getShellOutput(`${baseDiagnosticTscCmd} --project ${tsconfigPath} --generateTrace ${traceDir}`, { cwd: packageDir });
|
|
59
|
+
// Display the output to the console as before
|
|
60
|
+
process.stdout.write(output);
|
|
61
|
+
return output;
|
|
62
|
+
}
|
|
63
|
+
catch (_) {
|
|
64
|
+
// even if tsc returns a non-zero exit code,
|
|
65
|
+
// we can still proceed as long as the trace.json
|
|
66
|
+
// file was generated
|
|
67
|
+
const e = _;
|
|
68
|
+
const output = e.stdout ?? "";
|
|
69
|
+
const errorOutput = e.stderr ?? "";
|
|
70
|
+
process.stdout.write(output);
|
|
71
|
+
process.stderr.write(errorOutput);
|
|
72
|
+
return `${output}\n${errorOutput}`;
|
|
73
|
+
}
|
|
68
74
|
};
|
|
69
75
|
const initializeAnalysisContext = (traceDir) => {
|
|
70
76
|
const tsServer = TsServer.instance;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ark/attest",
|
|
3
|
-
"version": "0.44.
|
|
3
|
+
"version": "0.44.7",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "David Blass",
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"@typescript/vfs": "1.6.0",
|
|
38
38
|
"prettier": "3.4.2",
|
|
39
39
|
"@ark/fs": "0.44.5",
|
|
40
|
-
"
|
|
41
|
-
"
|
|
40
|
+
"@ark/util": "0.44.5",
|
|
41
|
+
"arktype": "2.1.9"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"typescript": "5.8.2"
|