feat: fold sanity-plugin-latex-input into monorepo#905
Merged
Conversation
BREAKING CHANGE: this version does not work in Studio V2
bjoerge
approved these changes
May 27, 2026
Contributor
There was a problem hiding this comment.
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/generatorsbuild output to CJS and update the runtime re-export to load the CJS artifact. - Add the
sanity-plugin-latex-inputworkspace 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.
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>
f8d1c21 to
4229fb3
Compare
pedrobonamin
approved these changes
May 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Migrates
sanity-plugin-latex-inputinto this monorepo usingpnpm generate "copy plugin"withgit subtreeto preserve commit history.Generator fix (prerequisite)
turbo/generatorswas building ESM (.mjs) output, but turbo gen loads config in a CJS context —import.meta.urlbecomesundefined, crashingcreateRequire. Fixed by switching tsdown output toformat: ['cjs'].Plugin migration
LatexPreview.tsx: replaced brokenuseMemo(fn, deps)pattern (sets state during render → infinite loop flagged by linter) with proper derived computation; switched from defaultKaTeXimport to namedrenderToString; removed unusedReactimportschema.ts: fixedObjectDefinitionto usetypeimport; moved module augmentation from@sanity/types→sanity(matches other plugins in this repo)src/css.d.tsto declare thekatex/dist/katex.min.cssside-effect import@types/katexfromdependencies→devDependencies