Skip to content
Source
Sign inSign up
TanStack/intent

perf: import already-loaded modules statically #327

MergedLadyBluenotes(GitHub profile, opens in a new tab)merged 3 commits intomain fromrefs/pull/327/headmerged by LadyBluenotes(GitHub profile, opens in a new tab)

🎯 Changes

  • Three dynamic imports in validate and one in the target resolution for stale asked for modules (yaml, shared/utils, setup/workspace-patterns) that the same files already load through static imports, so they deferred nothing.
  • Each one made the bundler emit a small facade chunk that Node loaded as an extra file, and import('yaml') requested the whole yaml namespace, which kept every yaml export in the bundle.
  • These modules are now imported statically.
  • The built package goes from 744,550 to 728,853 bytes (15,697 fewer; 4,441 fewer gzipped) and from 63 files to 60.
  • A cold intent list --json --no-notices process, the call the session hook makes, is about 1.5 ms faster (57.9 ms to 56.5 ms at the 25th percentile of 30 runs), because it loads fewer files and 15 kB less code. The warm benchmarks are unchanged, except validate, which is 2.6% faster.
  • Command output and exit codes do not change.
  • Adds a patch changeset.

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested this code locally with pnpm run test:pr (run pnpm build:all first).

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).

Summary by CodeRabbit

  • Improvements
    • Reduced the installed package size by 16 kB.
    • The intent validate and intent stale commands load fewer files, with no change to their behavior.
    1. 🦋 Changeset detected

      Latest commit: 36cba8d314945cfe84855c06cb21d1995f01d79f

      The changes in this PR will be included in the next version bump.

      This PR includes changesets to release 1 package
      NameType
      @tanstack/intentPatch

      Not sure what this means? Click here to learn what changesets are.

      Click here if you're a maintainer who wants to add another changeset to this PR

    2. Review in Change Stack →

      Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

      Note

      Currently processing new changes in this PR. This may take a few minutes, please wait...

      ⚙️ Run configuration
      • Configuration used: defaults
      • Review profile: CHILL
      • Plan: Advanced
      • Run ID: e0f99f33-49f1-420e-a577-6cd7591d9b31
      📥 Commits

      Reviewing files that changed from the base of the PR and between cd5a024a59fbc5c72eace6469b4b0442adc06916 and 36cba8d314945cfe84855c06cb21d1995f01d79f.

      📒 Files selected for processing (3)
      • .changeset/static-imports-already-loaded.md
      • packages/intent/src/commands/support.ts
      • packages/intent/src/commands/validate.ts
       ______________________________________________________
      < Plot twist: Your tests were the real bugs all along. >
       ------------------------------------------------------
        \
         \   (\__/)
             (•ㅅ•)
             /   づ
      ✨ Finishing Touches
      📝 Generate docstrings
      • Commit to this branch
      • Create a new PR
      🧪 Generate unit tests (beta)
      • Commit to this branch
      • Create a new PR
      • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

      Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

      ❤️ Share
      Comment `@coderabbitai help` to get the list of available commands.
    3. View your CI Pipeline Execution ↗ for commit 36cba8d314945cfe84855c06cb21d1995f01d79f

      CommandStatusDurationResult
      nx affected --targets=test:eslint,test:sherif,t...✅ Succeeded1m 1sView ↗
      nx run-many --targets=build✅ Succeeded2sView ↗

      ☁️ Nx Cloud last updated this comment at 2026-10-04 22:56:20 UTC

    4. Open in StackBlitz

      npm i https://pkg.pr.new/@tanstack/intent@327

      commit: 36cba8d

    5. Merging this PR will not alter performance

      ✅ 12 untouched benchmarks


      Comparing perf/static-imports-already-loaded (36cba8d) with main (cd5a024) Open in CodSpeed

Sign in to join this conversation.