From 3f24faba181523ce5605d365c14811142ff3c568 Mon Sep 17 00:00:00 2001 From: openhands Date: Mon, 16 Mar 2026 06:35:05 +0000 Subject: [PATCH] fix: package.json missing 'type': 'module' inconsistent with AGENTS.md (#850) Update tsconfig.json to use NodeNext module system (fixes CJS/ESM conflict), enable ts-node ESM mode, and add .js extensions to relative imports so the built output and ts-node dev script both work correctly with "type":"module". --- tools/push3-transpiler/src/index.ts | 4 ++-- tools/push3-transpiler/src/transpiler.ts | 2 +- tools/push3-transpiler/tsconfig.json | 10 +++++++--- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/tools/push3-transpiler/src/index.ts b/tools/push3-transpiler/src/index.ts index f8d9423..654a83d 100644 --- a/tools/push3-transpiler/src/index.ts +++ b/tools/push3-transpiler/src/index.ts @@ -10,8 +10,8 @@ import * as fs from 'fs'; import * as path from 'path'; -import { parse } from './parser'; -import { transpile } from './transpiler'; +import { parse } from './parser.js'; +import { transpile } from './transpiler.js'; function main(): void { const args = process.argv.slice(2); diff --git a/tools/push3-transpiler/src/transpiler.ts b/tools/push3-transpiler/src/transpiler.ts index d6da0de..198561a 100644 --- a/tools/push3-transpiler/src/transpiler.ts +++ b/tools/push3-transpiler/src/transpiler.ts @@ -8,7 +8,7 @@ * Only the subset of instructions used in optimizer_v3.push3 is implemented. */ -import { Node } from './parser'; +import { Node } from './parser.js'; interface TranspilerState { dStack: string[]; // DYADIC stack (Solidity expressions) diff --git a/tools/push3-transpiler/tsconfig.json b/tools/push3-transpiler/tsconfig.json index f63bd2d..efe4d9d 100644 --- a/tools/push3-transpiler/tsconfig.json +++ b/tools/push3-transpiler/tsconfig.json @@ -1,8 +1,9 @@ { "compilerOptions": { - "target": "ES2020", - "module": "commonjs", - "lib": ["ES2020"], + "target": "ES2022", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "lib": ["ES2022"], "outDir": "dist", "rootDir": "src", "strict": true, @@ -10,6 +11,9 @@ "skipLibCheck": true, "resolveJsonModule": true }, + "ts-node": { + "esm": true + }, "include": ["src/**/*"], "exclude": ["node_modules", "dist"] }