Repository navigation
Fix/starlight components auto allow imports - #152
Conversation
…ules - Replace duplicate type definitions with imports from vite-plugin/types.ts - Replace duplicate function definitions with imports from extracted modules (binding-loader, jsx-module, directive-rewriter) - Replace duplicate path utilities with imports from utils/paths.ts - Add normalize-config.ts with normalizeStarlightComponents helper - Add shiki-highlighter.ts with createShikiHighlighter function - Update vite-plugin/index.ts to export new modules Reduces vite-plugin.ts from 1267 to 673 lines (~47% reduction). Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Import stripHeadingsMeta from utils/validation.ts instead of defining it locally in transforms/inject-components.ts. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Remove duplicate DEFAULT_EXTENSIONS from vite-plugin/types.ts (use utils/paths.ts) - Remove duplicate ShikiHighlighter type from vite-plugin/shiki-highlighter.ts (use transforms/shiki.ts) - Remove duplicate parse5 types from transforms/shiki.ts (use vite-plugin/types.ts) - Use sanitizeHtmlForJsx function instead of inline brace escaping in blocks-to-jsx.ts Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Remove deprecated constants from config.ts and inject-components.ts: - STARLIGHT_COMPONENTS, STARLIGHT_COMPONENTS_MODULE - EXPRESSIVE_CODE_COMPONENT, EXPRESSIVE_CODE_MODULE - ASTRO_COMPONENTS, ASTRO_COMPONENTS_MODULE These were deprecated in favor of using registry libraries directly from markflow/registry. Tests now derive expected values from the libraries. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Conflict resolution accidentally removed required imports for esbuild and rollup types in vite-plugin.ts. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Phase 1 - Measurement Infrastructure: - Add debug timing logs (MARKFLOW_DEBUG_TIMING=1) in vite-plugin.ts - Add Criterion benchmarks for to_blocks, smartypants, slugify, jsx_normalize Phase 2 - Quick Wins: - Add Shiki early skip when no <pre> tags exist (avoids parse5 overhead) - Optimize regex in inject-components.ts: O(n) -> O(1) compilation - Add code block early detection to skip shiki for files without code blocks Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
… is enabled When using `starlightComponents: true` directly (without a preset), the default Starlight allow import patterns are now automatically applied. This ensures imports like `@astrojs/starlight/components` don't trigger fallback to @mdx-js/mdx. Previously, only using `starlightPreset()` would set up allowImports, but the shorthand `starlightComponents: true` option left mdx undefined, causing all imports to be treated as disallowed. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add hoisted_exports support in Rust codegen for user-defined exports - Enhance MDX pattern detection to return detailed results (exports, imports) - Add fallback statistics logging (exports count, disallowed imports count) - Log top disallowed import sources when many files fallback - Add STARLIGHT_DEFAULT_ALLOW_IMPORTS constant with common patterns - Support allowImports option in starlightPreset for custom patterns Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Code reviewI found one issue during the review: Unused function and unpopulated fieldFiles affected:
Issue: This means the statistics tracking code in Impact:
Suggested fix:
Code references:
Summary: 1 issue found. Checked for bugs and CLAUDE.md compliance. |
… functions - Remove unused MdxPatternDetectionResult type import from vite-plugin - Remove deprecated transformInjectAstroComponents and transformInjectStarlightComponents (replaced by transformInjectComponentsFromRegistry) - Remove corresponding tests for deprecated functions - Remove unused exports tracking from mdx-detection (exports are now handled by Rust via hoisting) - Remove extractExportStatements function and exports field from interface Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Summary
Linked Issues
Tasks from TODO.md
Performance Evidence
Verification Steps
npm install && npm run build:napinode scripts/smoke-napi.mjs samples/large.mdChecklist
cargo fmtexecuted?cargo clippypassed?