mirror of
https://github.com/badlogic/pi-mono.git
synced 2026-11-05 23:37:25 +00:00
feat: build with TypeScript 7 and run sources with plain node
Replace the tsgo native preview with typescript@7.0.2 and port the check scripts to the TS 7 API. Target ES2024, drop useDefineForClassFields: false and unused decorator options, and enable verbatimModuleSyntax. Replace tsx with node plus the source resolver hook, passed to --import as a file URL. closes #9965
This commit is contained in:
parent
49681e1b71
commit
ca7460d16b
46 changed files with 543 additions and 240 deletions
|
|
@ -20,15 +20,16 @@ interface AllocationProfileResult {
|
|||
const execFileAsync = promisify(execFile);
|
||||
const packageRoot = fileURLToPath(new URL("../..", import.meta.url));
|
||||
const workerPath = fileURLToPath(new URL("./allocation-profile-worker.ts", import.meta.url));
|
||||
const tsconfigPath = fileURLToPath(new URL("../tsconfig.json", import.meta.url));
|
||||
// Resolve workspace packages to their sources, matching the root tsconfig paths.
|
||||
const sourceResolverUrl = new URL("../../../coding-agent/src/experimental/source-resolver.ts", import.meta.url).href;
|
||||
const results: AllocationProfileResult[] = [];
|
||||
|
||||
for (const target of storageBenchmarkTargets) {
|
||||
for (const dataset of STORAGE_BENCHMARK_DATASETS) {
|
||||
const { stdout } = await execFileAsync(
|
||||
process.execPath,
|
||||
["--import", "tsx", workerPath, target.name, dataset.name],
|
||||
{ cwd: packageRoot, env: { ...process.env, TSX_TSCONFIG_PATH: tsconfigPath } },
|
||||
["--import", sourceResolverUrl, workerPath, target.name, dataset.name],
|
||||
{ cwd: packageRoot },
|
||||
);
|
||||
results.push(JSON.parse(stdout) as AllocationProfileResult);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,8 @@ interface LoadedFootprintResult {
|
|||
const execFileAsync = promisify(execFile);
|
||||
const packageRoot = fileURLToPath(new URL("../..", import.meta.url));
|
||||
const workerPath = fileURLToPath(new URL("./loaded-footprint-worker.ts", import.meta.url));
|
||||
const tsconfigPath = fileURLToPath(new URL("../tsconfig.json", import.meta.url));
|
||||
// Resolve workspace packages to their sources, matching the root tsconfig paths.
|
||||
const sourceResolverUrl = new URL("../../../coding-agent/src/experimental/source-resolver.ts", import.meta.url).href;
|
||||
const results: LoadedFootprintResult[] = [];
|
||||
|
||||
for (const target of storageBenchmarkTargets) {
|
||||
|
|
@ -26,12 +27,12 @@ for (const target of storageBenchmarkTargets) {
|
|||
[
|
||||
"--expose-gc",
|
||||
"--import",
|
||||
"tsx",
|
||||
sourceResolverUrl,
|
||||
workerPath,
|
||||
target.name,
|
||||
dataset.name,
|
||||
],
|
||||
{ cwd: packageRoot, env: { ...process.env, TSX_TSCONFIG_PATH: tsconfigPath } },
|
||||
{ cwd: packageRoot },
|
||||
);
|
||||
results.push(JSON.parse(stdout) as LoadedFootprintResult);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,10 @@
|
|||
{
|
||||
"extends": "../../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"baseUrl": "../../..",
|
||||
"noEmit": true,
|
||||
"paths": {
|
||||
"@earendil-works/pi-ai": ["packages/ai/src/index.ts"],
|
||||
"@earendil-works/pi-ai/*": ["packages/ai/src/*"]
|
||||
"@earendil-works/pi-ai": ["../../ai/src/index.ts"],
|
||||
"@earendil-works/pi-ai/*": ["../../ai/src/*"]
|
||||
}
|
||||
},
|
||||
"include": ["./**/*.ts", "../src/**/*.ts"]
|
||||
|
|
|
|||
|
|
@ -48,10 +48,10 @@
|
|||
"clean": "shx rm -rf dist",
|
||||
"generate-telemetry-docs": "node scripts/generate-telemetry-docs.ts",
|
||||
"check:telemetry-docs": "node scripts/generate-telemetry-docs.ts --check",
|
||||
"build": "tsgo -p tsconfig.build.json",
|
||||
"build": "tsc -p tsconfig.build.json",
|
||||
"bench:session:timing": "vitest bench --config vitest.benchmark.config.ts",
|
||||
"bench:session:memory": "tsx --tsconfig benchmark/tsconfig.json benchmark/session/loaded-footprint.ts",
|
||||
"bench:session:allocations": "tsx --tsconfig benchmark/tsconfig.json benchmark/session/allocation-profile.ts",
|
||||
"bench:session:memory": "node --import ../coding-agent/src/experimental/source-resolver.ts benchmark/session/loaded-footprint.ts",
|
||||
"bench:session:allocations": "node --import ../coding-agent/src/experimental/source-resolver.ts benchmark/session/allocation-profile.ts",
|
||||
"test": "vitest --run",
|
||||
"test:harness": "vitest --run --config vitest.harness.config.ts",
|
||||
"test:session:conformance": "vitest --run --config vitest.harness.config.ts test/harness/memory-conformance.test.ts",
|
||||
|
|
@ -87,7 +87,6 @@
|
|||
"devDependencies": {
|
||||
"@types/node": "22.19.19",
|
||||
"@vitest/coverage-v8": "4.1.9",
|
||||
"typescript": "5.9.3",
|
||||
"vitest": "4.1.9"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue