nuxt-safe-runtime-config 0.0.1 → 0.0.2

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/README.md CHANGED
@@ -7,8 +7,6 @@
7
7
 
8
8
  Validate Nuxt runtime config at build time using **Zod**, **Valibot**, **ArkType**, or any Standard Schema compatible library.
9
9
 
10
- - [✨  Release Notes](/CHANGELOG.md)
11
-
12
10
  ## Features
13
11
 
14
12
  - 🔒  Validate runtime config at build time with **Zod**, **Valibot**, **ArkType**, and more
@@ -37,7 +35,8 @@ export default defineNuxtConfig({
37
35
 
38
36
  2. Define your runtime config schema using **Valibot**, **Zod**, **ArkType**, or any other Standard Schema compatible library:
39
37
 
40
- ### With Valibot
38
+ <details>
39
+ <summary>With Valibot</summary>
41
40
 
42
41
  ```typescript
43
42
  import { number, object, optional, string } from 'valibot'
@@ -53,7 +52,10 @@ const runtimeConfigSchema = object({
53
52
  })
54
53
  ```
55
54
 
56
- ### With Zod
55
+ </details>
56
+
57
+ <details>
58
+ <summary>With Zod</summary>
57
59
 
58
60
  ```typescript
59
61
  import { z } from 'zod'
@@ -69,7 +71,10 @@ const runtimeConfigSchema = z.object({
69
71
  })
70
72
  ```
71
73
 
72
- ### With ArkType
74
+ </details>
75
+
76
+ <details>
77
+ <summary>With ArkType</summary>
73
78
 
74
79
  ```typescript
75
80
  import { type } from 'arktype'
@@ -85,6 +90,8 @@ const runtimeConfigSchema = type({
85
90
  })
86
91
  ```
87
92
 
93
+ </details>
94
+
88
95
  3. Configure your Nuxt app:
89
96
 
90
97
  ```typescript
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nuxt-safe-runtime-config",
3
3
  "configKey": "safeRuntimeConfig",
4
- "version": "0.0.1",
4
+ "version": "0.0.2",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.1",
7
7
  "unbuild": "3.5.0"
package/dist/module.mjs CHANGED
@@ -52,7 +52,7 @@ function isStandardSchema(schema) {
52
52
  return schema && typeof schema === "object" && "~standard" in schema && typeof schema["~standard"] === "object" && typeof schema["~standard"].validate === "function";
53
53
  }
54
54
  function formatIssue(issue) {
55
- const path = issue.path ? issue.path.map((p) => p.key || p).join(".") : "root";
55
+ const path = issue.path ? issue.path.map((p) => p && typeof p === "object" && "key" in p ? p.key : p).join(".") : "root";
56
56
  return `${path}: ${issue.message || "Validation error"}`;
57
57
  }
58
58
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nuxt-safe-runtime-config",
3
3
  "type": "module",
4
- "version": "0.0.1",
4
+ "version": "0.0.2",
5
5
  "description": "Validate Nuxt runtime config with Standard Schema at build time",
6
6
  "author": {
7
7
  "name": "onmax"