Skip to content
Source
Sign inSign up
TanStack/intent

perf: split jsonc-parser edit and format out of project-context #343

MergedLadyBluenotes(GitHub profile, opens in a new tab)merged 1 commit intomain fromrefs/pull/343/headmerged by LadyBluenotes(GitHub profile, opens in a new tab)

🎯 Changes

  • workspace-patterns.ts imported parse from 'jsonc-parser', which tsdown.config.ts aliased to jsonc-parser/lib/esm/main.js. Because main.js also imports ./impl/edit and ./impl/format (used by install and maintainer), Rolldown bundled the entire jsonc-parser module graph (scanner.js, string-intern.js, format.js, parser.js, edit.js, main.js) into the shared dist/project-context-*.mjs chunk, which is loaded on startup by intent list, intent load, intent stale, and intent validate.
  • Point workspace-patterns.ts's jsonc-parser/lib/esm/main.js import at jsonc-parser/lib/esm/impl/parser.js in tsdown.config.ts, so edit.js, format.js, string-intern.js (which eagerly allocates 1,220 whitespace strings at module evaluation time), and main.js move into a separate chunk (dist/main-*.mjs) loaded only by install and maintainer.
  • dist/project-context-*.mjs shrinks from 54.14 kB raw (11.82 kB gzip) to 34.21 kB raw (7.83 kB gzip) — -19.93 kB raw (-3.99 kB gzip) on every read-only CLI command.
  • Command output, Deno workspace parsing, and exit codes do not change.
Metric (tsdown v0.22.14 / rolldown v1.2.12)main (cb45f14)PR (9a61b1e)Change
dist/project-context-*.mjs (raw)54.14 kB (54,141 B)34.21 kB (34,213 B)-19.93 kB (-36.8%)
dist/project-context-*.mjs (gzip)11.82 kB7.83 kB-3.99 kB (-33.8%)

✅ 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).
    1. 🦋 Changeset detected

      Latest commit: 9a61b1e361c83aaf8d7dd2c9669ef6ac8433342a

      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 →

      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: 58396e9c-cfe3-469a-8b4e-126a6a2ca918
      📥 Commits

      Reviewing files that changed from the base of the PR and between 9400b3ea5ad5c378f04993fa197cacfe7c1c05ac and 9a61b1e361c83aaf8d7dd2c9669ef6ac8433342a.

      📒 Files selected for processing: 3
      • .changeset/split-jsonc-parser-edit.md
      • packages/intent/src/setup/workspace-patterns.ts
      • packages/intent/tsdown.config.ts
      +------------------------------------------------------------+
      | To infinity and beyond! Scouring your code for pesky bugs. |
      +------------------------------------------------------------+
        \
         \   (\__/)
             (•ㅅ•)
             /   づ
      ✨ Finishing Touches
      📝 Generate docstrings
      • Commit to this branch
      • Create a new PR
      🧪 Generate unit tests (beta)
      • Commit to this branch
      • Create a new PR
      • Autofix · 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 9a61b1e361c83aaf8d7dd2c9669ef6ac8433342a

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

      ☁️ Nx Cloud last updated this comment at 2026-10-19 01:19:29 UTC

    4. Open in StackBlitz

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

      commit: 9a61b1e

    5. Merging this PR will not alter performance

      :warning: 8 benchmarks spent significant time in system calls

      System calls cannot be consistently instrumented, so they are not included in the measure, which understates the real cost. Please switch to the Walltime instrument to accurately measure system calls.

      Measurement and system calls

      :information_source: 7 benchmarks have no flame graph

      The flamegraph could not be generated because too much time was spent in runtime internals, making the visualization not useful for performance analysis.

      ✅ 12 untouched benchmarks


      Comparing perf/jsonc-parser-split (9a61b1e) with main (9400b3e) Open in CodSpeed

Sign in to join this conversation.