Skip to content
This repository was archived by the owner on Apr 27, 2026. It is now read-only.

perf(astro-markflow): reduce redundant file reads and preprocessing in vite plugin - #173

Open
jp-knj wants to merge 6 commits into
mainfrom
perf/vite-plugin-reduce-redundant-work
Open

perf(astro-markflow): reduce redundant file reads and preprocessing in vite plugin#173
jp-knj wants to merge 6 commits into
mainfrom
perf/vite-plugin-reduce-redundant-work

Conversation

@jp-knj

@jp-knj jp-knj commented Feb 1, 2026

Copy link
Copy Markdown
Member

Summary

  • resolveIdCache: Cache readFile + preprocess results from resolveId for reuse in load(), eliminating duplicate file reads in dev mode
  • detectionCache: Cache detectProblematicMdxPatterns results from buildStart for reuse in load(), avoiding redundant detection runs
  • catch block optimization: Use processedSourceCache in catch blocks instead of re-reading and re-preprocessing files

Test plan

  • pnpm --dir packages/astro-markflow test — 295 tests pass
  • pnpm --dir crates/napi test — 32 tests pass
  • pnpm --dir packages/astro-markflow run typecheck — pass

🤖 Generated with Claude Code

jp-knj and others added 6 commits February 1, 2026 11:46
…n vite plugin

Cache resolveId's readFile + preprocess results for reuse in load(), cache
detectProblematicMdxPatterns results from buildStart, and use processedSourceCache
in catch blocks instead of re-reading files.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…peline to plugin init

Moved normalizeStarlightComponents (3→1 call) and createPipeline (3→1 call)
out of per-file transform/load hooks into the configResolved hook, since
their results are invariant across files.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…ng scans in transforms

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…tml highlighting, and update bench script

- collectImportedNames: add skipCodeFences option and early termination at first non-import line
- stripScanNoise: consolidate 3 chained .replace() into single regex pass
- rewriteAstroSetHtml: collect all set:html blocks then highlight in parallel via Promise.all
- bench-pipeline.mjs: use compileBatch production path instead of parseBlocks+blocksToJsx
- orchestrator: add pipeline profiling support (MARKFLOW_PIPELINE_PROFILE=1)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…regex

The getHeadings branch in RE_SCAN_NOISE expected multi-line format with
`\n}` on its own line. For single-line output from blocksToJsx/wrapHtmlInJsxModule,
`[\s\S]*?\n}` would scan past the closing `}` and match the next `\n}` in the file,
stripping the entire JSX body and silently dropping component imports.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…plugin-reduce-redundant-work

# Conflicts:
#	packages/astro-markflow/src/transforms/inject-components.ts
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant