@@ -7,15 +7,11 @@ import type * as unified from 'unified'
77import type { HasCwd } from './cwd.js'
88import type { DataCache } from './DataCache.js'
99import type { SourceFetchDataError , SourceProvideSchemaError } from './errors.js'
10- import type { SchemaDef , StackbitExtension } from './schema/index.js'
10+ import type { ExtensionsRoot } from './extensions.js'
11+ import type { SchemaDef } from './schema/index.js'
1112
1213export type SourcePluginType = LiteralUnion < 'local' | 'contentful' | 'sanity' , string >
1314
14- export type PluginExtensions = {
15- // TODO decentralized extension definitions + logic
16- stackbit ?: StackbitExtension . Config
17- }
18-
1915export type PluginOptions = {
2016 markdown : MarkdownOptions | MarkdownUnifiedBuilderCallback | undefined
2117 mdx : MDXOptions | undefined
@@ -99,12 +95,13 @@ export type SourcePlugin = {
9995 fetchData : FetchData
10096} & {
10197 options : PluginOptions
102- extensions : PluginExtensions
98+ extensions : Partial < ExtensionsRoot >
10399}
104100
105- export type ProvideSchema = (
106- esbuildHash : string ,
107- ) => T . Effect < OT . HasTracer & HasConsole , SourceProvideSchemaError , SchemaDef >
101+ export type ProvideSchema = ( _ : {
102+ esbuildHash : string
103+ extensionProperties ?: string [ ]
104+ } ) => T . Effect < OT . HasTracer & HasConsole , SourceProvideSchemaError , SchemaDef >
108105export type FetchData = ( _ : {
109106 schemaDef : SchemaDef
110107 verbose : boolean
@@ -127,7 +124,6 @@ export type PartialArgs = {
127124 mdx ?: MarkdownOptions | undefined
128125 date ?: DateOptions | undefined
129126 fieldOptions ?: Partial < FieldOptions >
130- extensions ?: PluginExtensions
131127 disableImportAliasWarning ?: boolean
132128}
133129
@@ -139,11 +135,10 @@ export const defaultFieldOptions: FieldOptions = {
139135export const processArgs = async < TArgs extends PartialArgs > (
140136 argsOrArgsThunk : TArgs | Thunk < TArgs > | Thunk < Promise < TArgs > > ,
141137) : Promise < {
142- extensions : PluginExtensions
143138 options : PluginOptions
144- restArgs : Omit < TArgs , 'extensions' | ' fieldOptions' | 'markdown' | 'mdx' | 'date' | 'disableImportAliasWarning' >
139+ restArgs : Omit < TArgs , 'fieldOptions' | 'markdown' | 'mdx' | 'date' | 'disableImportAliasWarning' >
145140} > => {
146- const { extensions , fieldOptions, markdown, mdx, date, disableImportAliasWarning, ...restArgs } =
141+ const { fieldOptions, markdown, mdx, date, disableImportAliasWarning, ...restArgs } =
147142 typeof argsOrArgsThunk === 'function' ? await argsOrArgsThunk ( ) : argsOrArgsThunk
148143
149144 const options : PluginOptions = {
@@ -157,5 +152,5 @@ export const processArgs = async <TArgs extends PartialArgs>(
157152 disableImportAliasWarning : disableImportAliasWarning ?? false ,
158153 }
159154
160- return { extensions : extensions ?? { } , options, restArgs }
155+ return { options, restArgs }
161156}
0 commit comments