diffs

Use when an app uses @pierre/diffs to render or edit code files, diffs, patches, merge conflicts, or CodeView review surfaces, including React, vanilla JavaScript, SSR, workers, annotations, selection, and custom Shiki languages or themes.

Install
npx skills add 'https://github.com/pierrecomputer/pierre/tree/main/skills/diffs'
Download bundle ↓
main · 1831817Scanned 2026-09-15

Contributors

GitHub-linked commit authors for this SKILL.md at the saved revision. Co-authors and history before file renames are not included.

File history ↗
View on GitHub
← Back to SKILL.md

Worker API

This reference lists every export from @pierre/diffs/worker, every public WorkerPoolManager member, and both worker script entries.

Runtime exports

ExportKindPurpose
WorkerPoolManagerClassRuns file and diff highlighting across a worker pool.
getOrCreateWorkerPoolSingletonFunctionGets or creates the module-wide worker pool.
terminateWorkerPoolSingletonFunctionTerminates and clears the module-wide worker pool.

WorkerPoolManager members

MemberPurpose
new WorkerPoolManager(options, renderOptions)Creates a worker pool.
initialize(languages?)Starts workers and loads languages.
isInitialized()Reports whether initialization finished.
isWorkingPool()Reports whether workers can accept work.
setRenderOptions(options)Updates theme and render settings in each worker.
getFileRenderOptions()Gets active file render options.
getDiffRenderOptions()Gets active diff render options.
highlightFileAST(instance, file)Queues a highlighted file result for an instance.
highlightDiffAST(instance, diff)Queues a highlighted diff result for an instance.
primeFileHighlightCache(file)Preloads one highlighted file result.
primeDiffHighlightCache(diff)Preloads one highlighted diff result.
getFileResultCache(file)Gets one cached file result.
getDiffResultCache(diff)Gets one cached diff result.
getPlainFileAST(file, start, total, lines?)Gets a plain-text file result.
getPlainDiffAST(diff, start, total, expansions?, threshold?)Gets a plain-text diff result.
inspectCaches()Gets both result caches.
evictFileFromCache(cacheKey)Removes one file cache entry.
evictDiffFromCache(cacheKey)Removes one diff cache entry.
subscribeToThemeChanges(instance)Subscribes a render instance to theme changes.
unsubscribeToThemeChanges(instance)Removes a theme subscription.
subscribeToStatChanges(callback)Subscribes to worker statistics.
cleanUpTasks(instance)Removes queued and active tasks for an instance.
getStats()Gets worker and cache statistics.
terminate()Stops workers and clears pool resources.

Configuration and state types

ExportPurpose
SetupWorkerPoolPropsCombines pool and highlighter options for the singleton.
WorkerPoolOptionsDefines the worker factory, pool size, and cache size.
WorkerInitializationRenderOptionsDefines initial languages, theme, highlighter, and diff settings.
WorkerRenderingOptionsDefines the complete worker render settings.
WorkerStatsDescribes pool state, work counts, subscribers, and cache sizes.
WorkerRequestIdIdentifies one worker request.
ResolvedLanguageHolds a resolved language registration.
FileRendererInstanceDefines callbacks for a file render consumer.
DiffRendererInstanceDefines callbacks for a diff render consumer.

Request and response types

ExportPurpose
WorkerRequestRepresents any request sent to a worker.
InitializeWorkerRequestStarts a worker with themes, languages, and options.
SetRenderOptionsWorkerRequestUpdates render options and themes.
RenderFileRequestRequests one file render.
RenderDiffRequestRequests one diff render.
SubmitRequestRepresents a file or diff request before ID assignment.
WorkerResponseRepresents any worker response.
InitializeSuccessResponseConfirms worker initialization.
RegisterThemeSuccessResponseConfirms a render-option and theme update.
RenderSuccessResponseRepresents a successful file or diff render.
RenderFileSuccessResponseReturns one file render result.
RenderDiffSuccessResponseReturns one diff render result.
RenderErrorResponseReturns a serialized worker error.

Task types

ExportPurpose
AllWorkerTasksRepresents any manager task.
InitializeWorkerTaskTracks one initialization request.
SetRenderOptionsWorkerTaskTracks one render-option update.
RenderFileTaskTracks one file render request and its consumers.
RenderDiffTaskTracks one diff render request and its consumers.
RenderTaskCallbacksResolves or rejects one render task consumer.

Worker script entries

ImportPurpose
@pierre/diffs/worker/worker.jsSupplies the module worker that uses package dependencies.
@pierre/diffs/worker/worker-portable.jsSupplies a bundled module worker.
Referenced from SKILL.md