Skip to content

feat: fold sanity-plugin-latex-input into monorepo#905

Merged
bjoerge merged 85 commits into
mainfrom
copilot/fold-latex-input-repo
May 27, 2026
Merged

feat: fold sanity-plugin-latex-input into monorepo#905
bjoerge merged 85 commits into
mainfrom
copilot/fold-latex-input-repo

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 27, 2026

Migrates sanity-plugin-latex-input into this monorepo using pnpm generate "copy plugin" with git subtree to preserve commit history.

Generator fix (prerequisite)

  • turbo/generators was building ESM (.mjs) output, but turbo gen loads config in a CJS context — import.meta.url becomes undefined, crashing createRequire. Fixed by switching tsdown output to format: ['cjs'].

Plugin migration

  • LatexPreview.tsx: replaced broken useMemo(fn, deps) pattern (sets state during render → infinite loop flagged by linter) with proper derived computation; switched from default KaTeX import to named renderToString; removed unused React import
  • schema.ts: fixed ObjectDefinition to use type import; moved module augmentation from @sanity/typessanity (matches other plugins in this repo)
  • Added src/css.d.ts to declare the katex/dist/katex.min.css side-effect import
  • Moved @types/katex from dependenciesdevDependencies
  • Updated README, normalized CHANGELOG header, added entry to root plugin table
  • Major changeset: migration enforces React 19.2+, Sanity v5+, ESM-only, React Compiler

@bjoerge bjoerge enabled auto-merge (squash) May 27, 2026 10:25
@bjoerge bjoerge disabled auto-merge May 27, 2026 10:25
@bjoerge bjoerge enabled auto-merge (rebase) May 27, 2026 10:25
@bjoerge bjoerge disabled auto-merge May 27, 2026 10:26
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR migrates sanity-plugin-latex-input into the plugins monorepo (preserving history via git subtree) and adjusts the turbo generator build output so turbo gen can load the generator config in a CommonJS context.

Changes:

  • Switch turbo/generators build output to CJS and update the runtime re-export to load the CJS artifact.
  • Add the sanity-plugin-latex-input workspace with schema, preview component, package exports test, and monorepo package scaffolding (pkg-utils config, TS configs, Knip entry).
  • Wire the plugin into the dev test studio and add documentation + changeset entries.

Reviewed changes

Copilot reviewed 21 out of 23 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
turbo/generators/tsdown.config.mts Forces CJS output for generator build artifacts to match turbo gen’s loading context.
turbo/generators/config.ts Updates re-export to load the generated CJS config artifact.
README.md Adds sanity-plugin-latex-input to the root plugin table.
pnpm-lock.yaml Adds the new workspace and updates lockfile state for new deps/resolutions.
plugins/sanity-plugin-latex-input/vitest.config.ts Adds Vitest config for the plugin workspace (package-exports test setup).
plugins/sanity-plugin-latex-input/tsconfig.json Adds typecheck TS config for the plugin workspace.
plugins/sanity-plugin-latex-input/tsconfig.build.json Adds build TS config for the plugin workspace.
plugins/sanity-plugin-latex-input/src/schema.ts Introduces the latex schema type and Sanity module augmentation for intrinsic defs.
plugins/sanity-plugin-latex-input/src/plugin.tsx Defines the latexInput plugin that registers the schema type.
plugins/sanity-plugin-latex-input/src/index.ts Public exports for the plugin, preview component, and schema types.
plugins/sanity-plugin-latex-input/src/index.test.ts Adds an exports-manifest test to validate published API surface.
plugins/sanity-plugin-latex-input/src/css.d.ts Declares the KaTeX CSS side-effect import for TypeScript.
plugins/sanity-plugin-latex-input/src/components/LatexPreview.tsx Implements the KaTeX-based preview renderer used by the schema preview component.
plugins/sanity-plugin-latex-input/README.md Adds plugin-specific README content (usage/install/docs).
plugins/sanity-plugin-latex-input/package.json Adds package metadata, exports map, deps/peers, and build scripts for publishing.
plugins/sanity-plugin-latex-input/package.config.ts Enables React Compiler for this package via pkg-utils config.
plugins/sanity-plugin-latex-input/CHANGELOG.md Brings the upstream changelog into the monorepo package directory.
plugins/@sanity/document-internationalization/src/schema/translation/metadata.ts Reformats the default export function signature.
knip.jsonc Registers the new plugin workspace for Knip.
dev/test-studio/src/latex-input/index.tsx Adds a test-studio example schema/plugin setup for LaTeX blocks and inline math.
dev/test-studio/sanity.config.ts Registers the new latex-input example plugin in the test studio config.
dev/test-studio/package.json Adds sanity-plugin-latex-input as a dependency of the dev test studio.
.changeset/fold-latex-input.md Adds a major changeset documenting migration and breaking changes.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread plugins/sanity-plugin-latex-input/README.md
Comment thread plugins/sanity-plugin-latex-input/README.md Outdated
Comment thread plugins/sanity-plugin-latex-input/package.json Outdated
bjoerge and others added 3 commits May 27, 2026 12:48
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@bjoerge bjoerge merged commit a677340 into main May 27, 2026
12 checks passed
@bjoerge bjoerge deleted the copilot/fold-latex-input-repo branch May 27, 2026 13:44
@squiggler-app squiggler-app Bot mentioned this pull request May 27, 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.