nuxtseo-shared 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/content.d.mts
CHANGED
|
@@ -25,7 +25,7 @@ declare function withEditor<T extends ZodTypeAny>(schema: T, config: ContentEdit
|
|
|
25
25
|
* Only use for fields that genuinely don't work in a form (freeform JSON, deeply nested arrays).
|
|
26
26
|
*/
|
|
27
27
|
declare function withEditorHidden<T extends ZodTypeAny>(schema: T): T;
|
|
28
|
-
interface DefineContentSchemaConfig<TSchema extends ZodTypeAny> {
|
|
28
|
+
interface DefineContentSchemaConfig<TSchema extends ZodTypeAny, TDefineOptions extends ContentSchemaOptions = ContentSchemaOptions> {
|
|
29
29
|
/**
|
|
30
30
|
* The field name used in frontmatter (e.g. 'robots', 'sitemap', 'ogImage').
|
|
31
31
|
*/
|
|
@@ -43,6 +43,11 @@ interface DefineContentSchemaConfig<TSchema extends ZodTypeAny> {
|
|
|
43
43
|
* Documentation URL for migration guidance.
|
|
44
44
|
*/
|
|
45
45
|
docsUrl?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Hook called when `defineSchema()` is invoked. Use for validation or
|
|
48
|
+
* registering module-specific side effects (e.g. sitemap filter/onUrl).
|
|
49
|
+
*/
|
|
50
|
+
onDefineSchema?: (options: TDefineOptions) => void;
|
|
46
51
|
}
|
|
47
52
|
/**
|
|
48
53
|
* Factory for creating a module's `define*Schema()` and deprecated `as*Collection()` exports.
|
|
@@ -66,8 +71,8 @@ interface DefineContentSchemaConfig<TSchema extends ZodTypeAny> {
|
|
|
66
71
|
*
|
|
67
72
|
* export { defineSchema as defineRobotsSchema, asCollection as asRobotsCollection, schema }
|
|
68
73
|
*/
|
|
69
|
-
declare function createContentSchemaFactory<TSchema extends ZodTypeAny>(config: DefineContentSchemaConfig<TSchema>, defaultZ: ZodInstance): {
|
|
70
|
-
defineSchema: (options?:
|
|
74
|
+
declare function createContentSchemaFactory<TSchema extends ZodTypeAny, TDefineOptions extends ContentSchemaOptions = ContentSchemaOptions>(config: DefineContentSchemaConfig<TSchema, TDefineOptions>, defaultZ: ZodInstance): {
|
|
75
|
+
defineSchema: (options?: TDefineOptions) => TSchema;
|
|
71
76
|
asCollection: <T>(collection: any) => T;
|
|
72
77
|
schema: z.ZodObject<{
|
|
73
78
|
[x: string]: TSchema;
|
package/dist/content.mjs
CHANGED
|
@@ -37,10 +37,11 @@ function withEditorHidden(schema) {
|
|
|
37
37
|
* export { defineSchema as defineRobotsSchema, asCollection as asRobotsCollection, schema }
|
|
38
38
|
*/
|
|
39
39
|
function createContentSchemaFactory(config, defaultZ) {
|
|
40
|
-
const { fieldName, buildSchema, label, docsUrl } = config;
|
|
40
|
+
const { fieldName, buildSchema, label, docsUrl, onDefineSchema } = config;
|
|
41
41
|
const defaultSchema = buildSchema(defaultZ);
|
|
42
42
|
const schemaObject = defaultZ.object({ [fieldName]: defaultSchema });
|
|
43
43
|
function defineSchema(options) {
|
|
44
|
+
if (options && onDefineSchema) onDefineSchema(options);
|
|
44
45
|
const _z = options?.z ?? defaultZ;
|
|
45
46
|
if (_z === defaultZ) return defaultSchema;
|
|
46
47
|
return buildSchema(_z);
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import { createResolver } from '@nuxt/kit'
|
|
2
|
+
|
|
3
|
+
const { resolve } = createResolver(import.meta.url)
|
|
4
|
+
|
|
1
5
|
export default defineNuxtConfig({
|
|
2
6
|
ssr: false,
|
|
3
7
|
|
|
@@ -6,7 +10,7 @@ export default defineNuxtConfig({
|
|
|
6
10
|
'@nuxt/ui',
|
|
7
11
|
],
|
|
8
12
|
|
|
9
|
-
css: ['./assets/css/global.css'],
|
|
13
|
+
css: [resolve('./assets/css/global.css')],
|
|
10
14
|
|
|
11
15
|
fonts: {
|
|
12
16
|
families: [
|