sanity-default-plugins

द्वारा sanity-io

मोनोरिपो के डिफ़ॉल्ट प्लगइन कन्वेंशन का उपयोग करके Sanity कोर प्लगइन बनाएं और वायर करें। इसका उपयोग तब करें जब … के अंतर्गत प्लगइन जोड़ना, संशोधित करना, या समीक्षा करना हो।

npx skills add https://github.com/sanity-io/sanity --skill sanity-default-plugins

Sanity Core Plugin

Start Here

Before adding a core plugin, read the sanity-plugin-authoring skill at ../sanity-plugin-authoring/SKILL.md to understand the general Sanity plugin API and what plugins can provide. Then inspect nearby plugins and these files:

  • packages/sanity/src/core/config/resolveDefaultPlugins.ts
  • packages/sanity/src/core/config/types.ts
  • packages/sanity/src/core/config/studio/types.ts
  • A similar plugin under packages/sanity/src/core/*/plugin/

The new plugin should be added inside core so it can be imported into the default plugins.

Prefer local patterns over new abstractions.

Plugin Shape

Use definePlugin and export a stable internal name constant:

import {definePlugin} from '../../config/definePlugin'

export const FEATURE_NAME = 'sanity/feature'

export const feature = definePlugin({
  name: FEATURE_NAME,
  studio: {
    components: {
      layout: FeatureStudioLayout,
    },
  },
  i18n: {
    bundles: [featureUsEnglishLocaleBundle],
  },
})

Use ../../config/definePlugin when matching existing internal plugin files. ../../config is also available in some folders.

Locale Resources

Default core plugins that render UI text should add a locale resource bundle. Follow the pattern from packages/sanity/src/core/singleDocRelease:

  • packages/sanity/src/core/<feature>/i18n/index.ts: exports the locale namespace, US English bundle, and resource key type.
  • packages/sanity/src/core/<feature>/i18n/resources.ts: exports default locale strings and keyof resource type.
  • packages/sanity/src/core/<feature>/plugin/index.ts: imports the bundle and registers it under i18n.bundles.

Example i18n/index.ts:

import {type LocaleResourceBundle} from '../../i18n'

export const featureNamespace: 'feature' = 'feature'

export const featureUsEnglishLocaleBundle: LocaleResourceBundle = {
  locale: 'en-US',
  namespace: featureNamespace,
  resources: () => import('./resources'),
}

export type {FeatureLocaleResourceKeys} from './resources'

Example i18n/resources.ts:

const featureLocaleStrings = {
  'action.example': 'Example',
}

export type FeatureLocaleResourceKeys = keyof typeof featureLocaleStrings

export default featureLocaleStrings

Example plugin registration:

import {featureUsEnglishLocaleBundle} from '../i18n'

export const feature = definePlugin({
  name: FEATURE_NAME,
  i18n: {
    bundles: [featureUsEnglishLocaleBundle],
  },
})

Default Plugin Wiring

Default core plugins are listed in resolveDefaultPlugins.ts.

  1. Import the plugin and its name constant.
  2. Add the plugin to defaultPlugins(options) in the desired composition order.
  3. If gated, add a plugin.name === FEATURE_NAME branch in getDefaultPlugins.
  4. Add any required options to DefaultPluginsWorkspaceOptions in types.ts.
  5. In getDefaultPluginsOptions, build default plugin options directly from workspace config defaults and spreads. Do not call config property reducers here; reducers belong to resolved source/workspace config, while default plugin options are a lightweight workspace-level input for plugin insertion.
  6. Update packages/sanity/src/core/config/__tests__/resolveConfig.test.ts with focused default plugin tests:
    • The plugin is not added by default.
    • The plugin is added when the proper config flag is enabled.
  7. Add ordering coverage when plugin order affects UI composition.

Example default option shape:

variants: {
  enabled: false,
  ...workspace.beta?.variants,
}

Remember: user plugins are appended before default plugins in prepareConfig.tsx, then the component middleware chain reverses flattened config order. Check the existing chain before relying on wrapper order.

Verification

For default plugin changes, run:

pnpm vitest run --project=sanity packages/sanity/src/core/config/__tests__/resolveConfig.test.ts

Also run lint/read diagnostics for edited files. Add component-level tests only when the plugin changes runtime rendering beyond insertion.

sanity-io की और Skills

tdd
sanity-io
लाल-हरा-रीफैक्टर लूप के साथ परीक्षण-संचालित विकास। उपयोग तब करें जब उपयोगकर्ता TDD का उपयोग करके सुविधाएँ बनाना या बग ठीक करना चाहता है, "लाल-हरा-रीफैक्टर" का उल्लेख करता है, चाहता है…
performance-optimization
sanity-io
एप्लिकेशन के प्रदर्शन को अनुकूलित करता है। इसका उपयोग तब करें जब प्रदर्शन आवश्यकताएं हों, जब आपको प्रदर्शन में गिरावट का संदेह हो, या जब कोर वेब वाइटल्स या लोड समय...
content-experimentation-best-practices
sanity-io
सामग्री प्रयोगों को डिज़ाइन करने, निष्पादित करने और विश्लेषण करने के लिए संरचित मार्गदर्शन, जो रूपांतरण और जुड़ाव को बेहतर बनाने में सहायक हो। इसमें परिकल्पना ढाँचे, मीट्रिक चयन, नमूना आकार गणना, और A/B तथा बहुभिन्नरूपी प्रयोगों में सांख्यिकीय महत्व परीक्षण शामिल है। p-मान, विश्वास अंतराल, शक्ति विश्लेषण, और परिणामों की व्याख्या के लिए बायेसियन विधियों पर विस्तृत संसाधन प्रदान करता है। फ़ील्ड स्तर पर वे
content-modeling-best-practices
sanity-io
संरचित सामग्री मॉडलिंग मार्गदर्शन: स्कीमा डिज़ाइन, पुन: प्रयोज्यता और बहु-चैनल वितरण के लिए। मुख्य सिद्धांतों को शामिल करता है: सामग्री को पृष्ठों के बजाय डेटा के रूप में मानना, एकल स्रोत सत्य बनाए रखना, भविष्य के चैनलों के लिए डिज़ाइन करना और संपादक वर्कफ़्लो को अनुकूलित करना। संदर्भ बनाम एम्बेडेड ऑब्जेक्ट, चिंताओं का पृथक्करण और सामग्री पुन: उपयोग पैटर्न के लिए निर्ण
portable-text-conversion
sanity-io
HTML और Markdown सामग्री को Sanity के लिए Portable Text ब्लॉक में बदलें। लीगेसी CMS से सामग्री माइग्रेट करते समय, Sanity में HTML या Markdown आयात करते समय उपयोग करें,…
portable-text-serialization
sanity-io
पोर्टेबल टेक्स्ट को React, Svelte, Vue, Astro, HTML, Markdown और सादे टेक्स्ट में रेंडर और सीरियलाइज़ करें। किसी भी फ्रंटएंड में पोर्टेबल टेक्स्ट रेंडरिंग लागू करते समय उपयोग करें…
sanity-best-practices
sanity-io
Sanity CMS विकास के लिए विभिन्न फ्रेमवर्क और विषयों पर व्यापक सर्वोत्तम अभ्यास और एकीकरण गाइड। Next.js, Nuxt, Astro, Remix, SvelteKit और Angular सहित 10+ फ्रेमवर्क एकीकरण को कवर करता है, जिसमें फ्रेमवर्क-विशिष्ट पैटर्न और सेटअप मार्गदर्शन शामिल है। स्कीमा डिज़ाइन, GROQ क्वेरी ऑप्टिमाइज़ेशन, विज़ुअल एडिटिंग, पोर्टेबल टेक्स्ट, इमेज, TypeGen, लोकलाइज़ेशन और कंटेंट माइग्रेशन के लिए विषय ग
sanity-migration
sanity-io
अन्य CMS और सामग्री प्रणालियों से Sanity में माइग्रेशन की योजना बनाता है, उन्हें कार्यान्वित करता है और उनकी समीक्षा करता है। AEM, Adobe Experience Manager, Contentful, Strapi, Webflow, WordPress, Payload, Drupal, Markdown/MDX/frontmatter फ़ाइलों, WXR/XML निर्यात, CMS API, डेटाबेस डंप, स्थिर HTML से Sanity में माइग्रेट या रीप्लेटफ़ॉर्म करते समय, या निष्कर्षण, रूपांतरण, Portable Text रूपांतरण, एसेट माइग्रेशन, रीडायरेक्ट, सत्यापन और कटओवर वर्कफ़्लो डिज़
data-analysisdatabasedevelopment