Skip to content

Migrate remark-code-blocks to TypeScript with globalThis promise caching#3

Closed
tbjers wants to merge 6 commits into
mainfrom
refactor/remark-code-blocks-ts
Closed

Migrate remark-code-blocks to TypeScript with globalThis promise caching#3
tbjers wants to merge 6 commits into
mainfrom
refactor/remark-code-blocks-ts

Conversation

@tbjers

@tbjers tbjers commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Converts remark-code-blocks.js (JSDoc + // @ts-check) to native TypeScript (remark-code-blocks.ts)
  • Fixes repeated Shiki initialization warnings during build by caching the createHighlighter() Promise on globalThis instead of the resolved Highlighter — eliminating the race where all concurrent .svx processors saw an uninitialized singleton and each triggered a new instantiation
  • Updates the import in svelte.config.js to use the .ts extension (required because Node's ESM resolver does not fall back from .js to .ts; Vite handles .ts imports from config files natively)

Test plan

  • pnpm check — 0 errors, 0 warnings
  • pnpm build — verify no repeated Shiki initialization warnings in output
  • pnpm dev — verify hot-reload does not re-initialize the highlighter on subsequent module evaluations

🤖 Generated with Claude Code

Converts the JSDoc-annotated .js plugin to native TypeScript and fixes
repeated Shiki initializer warnings during build by caching the
createHighlighter() Promise on globalThis instead of the resolved value,
eliminating the race where concurrent .svx processors each triggered a
new instantiation.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 1, 2026

Copy link
Copy Markdown

Deploying coveragetracker-dev with  Cloudflare Pages  Cloudflare Pages

Latest commit: 9f6045a
Status:🚫  Build failed.

View logs

tbjers and others added 5 commits July 1, 2026 17:34
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Renames to svelte.config.ts, removes the JSDoc @type annotation, and
adds native TypeScript types for Config and PreprocessorGroup.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@tbjers tbjers closed this Jul 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant