nuxtseo-shared 5.1.0 → 5.1.1

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.mjs CHANGED
@@ -8,21 +8,26 @@ function withEditorHidden(schema) {
8
8
  }
9
9
  function createContentSchemaFactory(config, defaultZ) {
10
10
  const { fieldName, buildSchema, label, docsUrl, onDefineSchema } = config;
11
- const defaultSchema = buildSchema(defaultZ);
12
- const schemaObject = defaultZ.object({ [fieldName]: defaultSchema });
11
+ const schemaObject = defaultZ.object({ [fieldName]: buildSchema(defaultZ) });
13
12
  function defineSchema(options) {
14
13
  if (options && onDefineSchema)
15
14
  onDefineSchema(options);
16
15
  const _z = options?.z ?? defaultZ;
17
- if (_z === defaultZ)
18
- return defaultSchema;
19
16
  return buildSchema(_z);
20
17
  }
21
18
  function asCollection(collection) {
22
19
  const migrationHint = docsUrl ? ` See ${docsUrl}` : "";
23
20
  console.warn(`[${label}] \`as${capitalize(label)}Collection()\` is deprecated. Use \`define${capitalize(label)}Schema()\` in your collection schema instead.${migrationHint}`);
24
21
  if (collection.type === "page") {
25
- collection.schema = collection.schema ? schemaObject.extend(collection.schema.shape) : schemaObject;
22
+ try {
23
+ collection.schema = collection.schema ? schemaObject.extend(collection.schema.shape) : schemaObject;
24
+ } catch (e) {
25
+ console.warn(
26
+ `[${label}] Failed to apply ${label} schema to collection. This is likely a Zod version mismatch.`,
27
+ `Pass your Zod instance explicitly: \`define${capitalize(label)}Schema({ z })\`.${migrationHint}`,
28
+ `Error: ${e.message}`
29
+ );
30
+ }
26
31
  }
27
32
  return collection;
28
33
  }
@@ -30,7 +35,7 @@ function createContentSchemaFactory(config, defaultZ) {
30
35
  defineSchema,
31
36
  asCollection,
32
37
  schema: schemaObject,
33
- fieldSchema: defaultSchema
38
+ fieldSchema: buildSchema(defaultZ)
34
39
  };
35
40
  }
36
41
  function capitalize(s) {
package/dist/module.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": ">=3.16.0"
6
6
  },
7
- "version": "5.1.0",
7
+ "version": "5.1.1",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "1.0.2",
10
10
  "unbuild": "3.6.1"
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nuxtseo-shared",
3
3
  "type": "module",
4
- "version": "5.1.0",
4
+ "version": "5.1.1",
5
5
  "description": "Shared utilities for Nuxt SEO modules.",
6
6
  "author": {
7
7
  "name": "Harlan Wilton",
@@ -22,35 +22,35 @@
22
22
  "exports": {
23
23
  ".": {
24
24
  "types": "./dist/types.d.mts",
25
- "import": "./dist/module.mjs"
25
+ "default": "./dist/module.mjs"
26
26
  },
27
27
  "./content": {
28
28
  "types": "./dist/content.d.mts",
29
- "import": "./dist/content.mjs"
29
+ "default": "./dist/content.mjs"
30
30
  },
31
31
  "./kit": {
32
32
  "types": "./dist/kit.d.mts",
33
- "import": "./dist/kit.mjs"
33
+ "default": "./dist/kit.mjs"
34
34
  },
35
35
  "./devtools": {
36
36
  "types": "./dist/devtools.d.mts",
37
- "import": "./dist/devtools.mjs"
37
+ "default": "./dist/devtools.mjs"
38
38
  },
39
39
  "./i18n": {
40
40
  "types": "./dist/i18n.d.mts",
41
- "import": "./dist/i18n.mjs"
41
+ "default": "./dist/i18n.mjs"
42
42
  },
43
43
  "./pro": {
44
44
  "types": "./dist/pro.d.mts",
45
- "import": "./dist/pro.mjs"
45
+ "default": "./dist/pro.mjs"
46
46
  },
47
47
  "./utils": {
48
48
  "types": "./dist/utils.d.mts",
49
- "import": "./dist/utils.mjs"
49
+ "default": "./dist/utils.mjs"
50
50
  },
51
51
  "./const": {
52
52
  "types": "./dist/const.d.mts",
53
- "import": "./dist/const.mjs"
53
+ "default": "./dist/const.mjs"
54
54
  },
55
55
  "./package.json": "./package.json"
56
56
  },
@@ -75,12 +75,12 @@
75
75
  }
76
76
  },
77
77
  "dependencies": {
78
- "@clack/prompts": "^1.1.0",
78
+ "@clack/prompts": "^1.2.0",
79
79
  "@nuxt/devtools-kit": "4.0.0-alpha.3",
80
80
  "@nuxt/kit": "^4.4.2",
81
81
  "birpc": "^4.0.0",
82
82
  "consola": "^3.4.2",
83
- "defu": "^6.1.4",
83
+ "defu": "^6.1.7",
84
84
  "ofetch": "^1.5.1",
85
85
  "pathe": "^2.0.3",
86
86
  "pkg-types": "^2.3.0",
@@ -90,13 +90,14 @@
90
90
  "ufo": "^1.6.3"
91
91
  },
92
92
  "devDependencies": {
93
+ "@arethetypeswrong/cli": "^0.18.2",
93
94
  "@nuxt/module-builder": "^1.0.2",
94
95
  "@nuxt/schema": "^4.4.2",
95
96
  "@nuxtjs/i18n": "^10.2.4",
96
97
  "nuxt-site-config": "^4.0.7",
97
98
  "typescript": "^6.0.2",
98
- "vitest": "^4.1.2",
99
- "vue": "^3.5.31",
99
+ "vitest": "^4.1.3",
100
+ "vue": "^3.5.32",
100
101
  "vue-tsc": "^3.2.6"
101
102
  },
102
103
  "scripts": {
@@ -105,6 +106,7 @@
105
106
  "stub": "nuxt-module-build build --stub",
106
107
  "test": "vitest",
107
108
  "test:run": "vitest run",
109
+ "test:attw": "attw --pack --profile esm-only",
108
110
  "typecheck": "vue-tsc --noEmit"
109
111
  }
110
112
  }