Skip to content

build: rm tsx, use --experimental-transform-types#6007

Closed
longlho wants to merge 1 commit intomainfrom
01-31-build_rm_tsx_use_--experimental-transform-types
Closed

build: rm tsx, use --experimental-transform-types#6007
longlho wants to merge 1 commit intomainfrom
01-31-build_rm_tsx_use_--experimental-transform-types

Conversation

@longlho
Copy link
Member

@longlho longlho commented Jan 31, 2026

TL;DR

Migrate codebase to use native TypeScript ESM imports with import.meta.dirname instead of __dirname

What changed?

  • Replaced __dirname with import.meta.dirname throughout the codebase
  • Updated import statements to use ESM-compatible syntax
  • Changed * as module imports to default imports where appropriate
  • Replaced require.main === module checks with import.meta.filename === process.argv[1]
  • Added proper type annotations for dynamic imports
  • Removed dependency on tsx package
  • Updated Node.js options to use --experimental-transform-types instead of tsx
  • Added rewriteRelativeImportExtensions: true to tsconfig

How to test?

  1. Run the test suite to ensure all functionality works as expected
  2. Verify that scripts can be executed directly with Node.js using the --experimental-transform-types flag
  3. Check that all imports resolve correctly in both development and production environments

Why make this change?

This change modernizes the codebase to use native ESM features in TypeScript, improving compatibility with the Node.js ESM loader. By removing the dependency on the tsx package and using Node.js's built-in TypeScript support via the --experimental-transform-types flag, the project reduces external dependencies and aligns with modern JavaScript practices. This approach provides better long-term maintainability and prepares the codebase for future Node.js versions where ESM is the standard module system.

@longlho longlho marked this pull request as ready for review January 31, 2026 20:13
Copy link
Member Author

longlho commented Jan 31, 2026


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • main - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has required the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@longlho longlho force-pushed the 01-31-build_rm_tsx_use_--experimental-transform-types branch from 69de4cb to 385db87 Compare January 31, 2026 20:17
@claude
Copy link

claude bot commented Jan 31, 2026

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

@claude
Copy link

claude bot commented Jan 31, 2026


Code review

No issues found. Checked for bugs and CLAUDE.md compliance.


1 similar comment
@claude
Copy link

claude bot commented Jan 31, 2026


Code review

No issues found. Checked for bugs and CLAUDE.md compliance.


@graphite-app
Copy link

graphite-app bot commented Feb 1, 2026

Merge activity

  • Feb 1, 2:41 AM UTC: longlho added this pull request to the Graphite merge queue.
  • Feb 1, 2:42 AM UTC: CI is running for this pull request on a draft pull request (#6008) due to your merge queue CI optimization settings.
  • Feb 1, 2:45 AM UTC: Merged by the Graphite merge queue via draft PR: #6008.

graphite-app bot pushed a commit that referenced this pull request Feb 1, 2026
### TL;DR

Migrate codebase to use native TypeScript ESM imports with import.meta.dirname instead of __dirname

### What changed?

- Replaced `__dirname` with `import.meta.dirname` throughout the codebase
- Updated import statements to use ESM-compatible syntax
- Changed `* as module` imports to default imports where appropriate
- Replaced `require.main === module` checks with `import.meta.filename === process.argv[1]`
- Added proper type annotations for dynamic imports
- Removed dependency on `tsx` package
- Updated Node.js options to use `--experimental-transform-types` instead of tsx
- Added `rewriteRelativeImportExtensions: true` to tsconfig

### How to test?

1. Run the test suite to ensure all functionality works as expected
2. Verify that scripts can be executed directly with Node.js using the `--experimental-transform-types` flag
3. Check that all imports resolve correctly in both development and production environments

### Why make this change?

This change modernizes the codebase to use native ESM features in TypeScript, improving compatibility with the Node.js ESM loader. By removing the dependency on the `tsx` package and using Node.js's built-in TypeScript support via the `--experimental-transform-types` flag, the project reduces external dependencies and aligns with modern JavaScript practices. This approach provides better long-term maintainability and prepares the codebase for future Node.js versions where ESM is the standard module system.
@graphite-app graphite-app bot closed this Feb 1, 2026
@graphite-app graphite-app bot deleted the 01-31-build_rm_tsx_use_--experimental-transform-types branch February 1, 2026 02:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant