Skip to content

replace tsx by jiti#7261

Merged
schiller-manuel merged 3 commits intomainfrom
jiti
Apr 25, 2026
Merged

replace tsx by jiti#7261
schiller-manuel merged 3 commits intomainfrom
jiti

Conversation

@schiller-manuel
Copy link
Copy Markdown
Contributor

@schiller-manuel schiller-manuel commented Apr 25, 2026

Summary by CodeRabbit

  • Chores
    • Updated router generator to use jiti instead of tsx for loading virtual route configuration files.
    • Added a patch-level changeset for the router-generator release.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 25, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8cb64e4e-ef27-4d54-864f-f99a0f390065

📥 Commits

Reviewing files that changed from the base of the PR and between 5adc75c and a718228.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (3)
  • .changeset/bright-jars-relax.md
  • packages/router-generator/package.json
  • packages/router-generator/src/filesystem/virtual/loadConfigFile.ts
✅ Files skipped from review due to trivial changes (2)
  • .changeset/bright-jars-relax.md
  • packages/router-generator/package.json
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/router-generator/src/filesystem/virtual/loadConfigFile.ts

📝 Walkthrough

Walkthrough

Replaces tsx with jiti in the router-generator package, updates loadConfigFile() to import config modules via jiti.import() instead of tsx/esm/api's tsImport, and adds a changeset documenting the patch release.

Changes

Cohort / File(s) Summary
Changeset Documentation
​.changeset/bright-jars-relax.md
Adds a new changeset recording a patch release for @tanstack/router-generator and noting the switch from tsx to jiti for virtual route config loading.
Dependency Update
packages/router-generator/package.json
Removes tsx from dependencies and adds jiti@^2.6.1.
Implementation Refactor
packages/router-generator/src/filesystem/virtual/loadConfigFile.ts
Reworks loadConfigFile(filePath) to create and use a jiti instance and call jiti.import(filePath) instead of constructing file:// URLs and calling tsx/esm/api tsImport. Exported signature unchanged.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 I swapped a tsx hat for jiti's cap,
Hopped through files without a map,
Importing configs with nimble feet,
Patch released—our build's complete! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'replace tsx by jiti' directly and clearly describes the main change: replacing the tsx dependency with jiti throughout the codebase.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch jiti

Comment @coderabbitai help to get the list of available commands and usage tips.

@nx-cloud
Copy link
Copy Markdown
Contributor

nx-cloud Bot commented Apr 25, 2026

View your CI Pipeline Execution ↗ for commit 85784a0

Command Status Duration Result
nx affected --targets=test:eslint,test:unit,tes... ❌ Failed 5m 19s View ↗
nx run-many --target=build --exclude=examples/*... ✅ Succeeded 1s View ↗

☁️ Nx Cloud last updated this comment at 2026-04-25 17:29:33 UTC

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 25, 2026

🚀 Changeset Version Preview

2 package(s) bumped directly, 10 bumped as dependents.

🟩 Patch bumps

Package Version Reason
@tanstack/router-generator 1.166.34 → 1.166.35 Changeset
@tanstack/solid-router 1.168.21 → 1.168.22 Changeset
@tanstack/react-start 1.167.48 → 1.167.49 Dependent
@tanstack/react-start-rsc 0.0.27 → 0.0.28 Dependent
@tanstack/router-cli 1.166.35 → 1.166.36 Dependent
@tanstack/router-plugin 1.167.26 → 1.167.27 Dependent
@tanstack/router-vite-plugin 1.166.41 → 1.166.42 Dependent
@tanstack/solid-start 1.167.43 → 1.167.44 Dependent
@tanstack/solid-start-client 1.166.38 → 1.166.39 Dependent
@tanstack/solid-start-server 1.166.39 → 1.166.40 Dependent
@tanstack/start-plugin-core 1.169.4 → 1.169.5 Dependent
@tanstack/vue-start 1.167.42 → 1.167.43 Dependent

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
packages/router-generator/src/filesystem/virtual/loadConfigFile.ts (1)

5-7: Avoid any in loadConfigFile result typing.

Line 6 uses jiti.import<any>(filePath), which bypasses strict typing. Prefer unknown (or a constrained generic) and narrow at call sites.

Suggested type-safe adjustment
-export async function loadConfigFile(filePath: string) {
-  const loaded = await jiti.import<any>(filePath)
+export async function loadConfigFile<TModule = unknown>(
+  filePath: string,
+): Promise<TModule> {
+  const loaded = await jiti.import<TModule>(filePath)
   return loaded
 }

As per coding guidelines: **/*.{ts,tsx}: Use TypeScript strict mode with extensive type safety.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/router-generator/src/filesystem/virtual/loadConfigFile.ts` around
lines 5 - 7, The function loadConfigFile currently calls
jiti.import<any>(filePath) which uses any; change the import to
jiti.import<unknown>(filePath) and update loadConfigFile's signature to return
Promise<unknown> (or a constrained generic like Promise<TConfig=unknown>) so
callers must narrow/cast the shape explicitly; keep narrowing/validation at each
call site that consumes loadConfigFile results (or add a small type-guard
helper) and update references to the loadConfigFile function to handle the
unknown type.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@packages/router-generator/src/filesystem/virtual/loadConfigFile.ts`:
- Around line 5-7: The function loadConfigFile currently calls
jiti.import<any>(filePath) which uses any; change the import to
jiti.import<unknown>(filePath) and update loadConfigFile's signature to return
Promise<unknown> (or a constrained generic like Promise<TConfig=unknown>) so
callers must narrow/cast the shape explicitly; keep narrowing/validation at each
call site that consumes loadConfigFile results (or add a small type-guard
helper) and update references to the loadConfigFile function to handle the
unknown type.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7737b8be-d040-404e-b948-1acdda687ee4

📥 Commits

Reviewing files that changed from the base of the PR and between d20c878 and 5adc75c.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (3)
  • .changeset/bright-jars-relax.md
  • packages/router-generator/package.json
  • packages/router-generator/src/filesystem/virtual/loadConfigFile.ts

nx-cloud[bot]

This comment was marked as outdated.

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Apr 25, 2026

Merging this PR will not alter performance

✅ 6 untouched benchmarks


Comparing jiti (85784a0) with main (d20c878)

Open in CodSpeed

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 25, 2026

Bundle Size Benchmarks

  • Commit: d20c87813559
  • Measured at: 2026-04-25T17:25:03.648Z
  • Baseline source: history:d20c87813559
  • Dashboard: bundle-size history
Scenario Current (gzip) Delta vs baseline Raw Brotli Trend
react-router.minimal 87.35 KiB 0 B (0.00%) 274.60 KiB 75.97 KiB ▅▅▅▅▅▅▅▅▅▅▅
react-router.full 90.77 KiB 0 B (0.00%) 286.11 KiB 78.90 KiB ▁▁▁▁▁██████
solid-router.minimal 35.55 KiB 0 B (0.00%) 106.71 KiB 31.96 KiB ▅▅▅▅▅▅▅▅▅▅▅
solid-router.full 40.25 KiB 0 B (0.00%) 120.79 KiB 36.11 KiB ▁▁▁▁▁▆▆▆▆██
vue-router.minimal 53.30 KiB 0 B (0.00%) 152.01 KiB 47.88 KiB ▅▅▅▅▅▅▅▅▅▅▅
vue-router.full 58.44 KiB 0 B (0.00%) 168.19 KiB 52.34 KiB ▁▁▁▁▁██████
react-start.minimal 101.92 KiB 0 B (0.00%) 322.77 KiB 88.18 KiB ▁▁▁▁▁██████
react-start.full 105.35 KiB 0 B (0.00%) 333.10 KiB 91.02 KiB ▁▁▁▁▁██████
react-start.rsbuild.minimal 101.43 KiB 0 B (0.00%) 325.62 KiB 87.12 KiB ▁███
react-start.rsbuild.full 104.74 KiB 0 B (0.00%) 336.31 KiB 89.93 KiB ▅▅▅▅
solid-start.minimal 49.54 KiB 0 B (0.00%) 152.54 KiB 43.67 KiB ▁▁▁▁▁██████
solid-start.full 55.30 KiB 0 B (0.00%) 169.31 KiB 48.61 KiB ▁▁▁▁▁▆▆▆▆██

Trend sparkline is historical gzip bytes ending with this PR measurement; lower is better.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 25, 2026

More templates

@tanstack/arktype-adapter

npm i https://pkg.pr.new/@tanstack/arktype-adapter@7261

@tanstack/eslint-plugin-router

npm i https://pkg.pr.new/@tanstack/eslint-plugin-router@7261

@tanstack/eslint-plugin-start

npm i https://pkg.pr.new/@tanstack/eslint-plugin-start@7261

@tanstack/history

npm i https://pkg.pr.new/@tanstack/history@7261

@tanstack/nitro-v2-vite-plugin

npm i https://pkg.pr.new/@tanstack/nitro-v2-vite-plugin@7261

@tanstack/react-router

npm i https://pkg.pr.new/@tanstack/react-router@7261

@tanstack/react-router-devtools

npm i https://pkg.pr.new/@tanstack/react-router-devtools@7261

@tanstack/react-router-ssr-query

npm i https://pkg.pr.new/@tanstack/react-router-ssr-query@7261

@tanstack/react-start

npm i https://pkg.pr.new/@tanstack/react-start@7261

@tanstack/react-start-client

npm i https://pkg.pr.new/@tanstack/react-start-client@7261

@tanstack/react-start-rsc

npm i https://pkg.pr.new/@tanstack/react-start-rsc@7261

@tanstack/react-start-server

npm i https://pkg.pr.new/@tanstack/react-start-server@7261

@tanstack/router-cli

npm i https://pkg.pr.new/@tanstack/router-cli@7261

@tanstack/router-core

npm i https://pkg.pr.new/@tanstack/router-core@7261

@tanstack/router-devtools

npm i https://pkg.pr.new/@tanstack/router-devtools@7261

@tanstack/router-devtools-core

npm i https://pkg.pr.new/@tanstack/router-devtools-core@7261

@tanstack/router-generator

npm i https://pkg.pr.new/@tanstack/router-generator@7261

@tanstack/router-plugin

npm i https://pkg.pr.new/@tanstack/router-plugin@7261

@tanstack/router-ssr-query-core

npm i https://pkg.pr.new/@tanstack/router-ssr-query-core@7261

@tanstack/router-utils

npm i https://pkg.pr.new/@tanstack/router-utils@7261

@tanstack/router-vite-plugin

npm i https://pkg.pr.new/@tanstack/router-vite-plugin@7261

@tanstack/solid-router

npm i https://pkg.pr.new/@tanstack/solid-router@7261

@tanstack/solid-router-devtools

npm i https://pkg.pr.new/@tanstack/solid-router-devtools@7261

@tanstack/solid-router-ssr-query

npm i https://pkg.pr.new/@tanstack/solid-router-ssr-query@7261

@tanstack/solid-start

npm i https://pkg.pr.new/@tanstack/solid-start@7261

@tanstack/solid-start-client

npm i https://pkg.pr.new/@tanstack/solid-start-client@7261

@tanstack/solid-start-server

npm i https://pkg.pr.new/@tanstack/solid-start-server@7261

@tanstack/start-client-core

npm i https://pkg.pr.new/@tanstack/start-client-core@7261

@tanstack/start-fn-stubs

npm i https://pkg.pr.new/@tanstack/start-fn-stubs@7261

@tanstack/start-plugin-core

npm i https://pkg.pr.new/@tanstack/start-plugin-core@7261

@tanstack/start-server-core

npm i https://pkg.pr.new/@tanstack/start-server-core@7261

@tanstack/start-static-server-functions

npm i https://pkg.pr.new/@tanstack/start-static-server-functions@7261

@tanstack/start-storage-context

npm i https://pkg.pr.new/@tanstack/start-storage-context@7261

@tanstack/valibot-adapter

npm i https://pkg.pr.new/@tanstack/valibot-adapter@7261

@tanstack/virtual-file-routes

npm i https://pkg.pr.new/@tanstack/virtual-file-routes@7261

@tanstack/vue-router

npm i https://pkg.pr.new/@tanstack/vue-router@7261

@tanstack/vue-router-devtools

npm i https://pkg.pr.new/@tanstack/vue-router-devtools@7261

@tanstack/vue-router-ssr-query

npm i https://pkg.pr.new/@tanstack/vue-router-ssr-query@7261

@tanstack/vue-start

npm i https://pkg.pr.new/@tanstack/vue-start@7261

@tanstack/vue-start-client

npm i https://pkg.pr.new/@tanstack/vue-start-client@7261

@tanstack/vue-start-server

npm i https://pkg.pr.new/@tanstack/vue-start-server@7261

@tanstack/zod-adapter

npm i https://pkg.pr.new/@tanstack/zod-adapter@7261

commit: 85784a0

nx-cloud[bot]

This comment was marked as outdated.

nx-cloud[bot]

This comment was marked as outdated.

Copy link
Copy Markdown
Contributor

@nx-cloud nx-cloud Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nx Cloud has identified a possible root cause for your failed CI:

We investigated the failing E2E HMR tests (tanstack-react-start-e2e-hmr) and confirmed they are pre-existing failures also present on the main branch, unrelated to the tsxjiti migration in @tanstack/router-generator. No changes from this PR are responsible for the failures.

No code changes were suggested for this issue.

Trigger a rerun:

Rerun CI

Nx Cloud View detailed reasoning on Nx Cloud ↗


🎓 Learn more about Self-Healing CI on nx.dev

@schiller-manuel schiller-manuel merged commit a2ad394 into main Apr 25, 2026
15 of 16 checks passed
@schiller-manuel schiller-manuel deleted the jiti branch April 25, 2026 17:30
@msalsbery
Copy link
Copy Markdown

@schiller-manuel

Thank you for this, it certainly fixed my issue 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants