@arkenv/vite-plugin 0.0.10 → 0.0.11

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.
Files changed (2) hide show
  1. package/README.md +22 -37
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # `@arkenv/vite-plugin`
2
2
 
3
- A Vite plugin for using ArkEnv to validate environment variables at build time.
3
+ [Vite](https://vite.dev/) plugin to validate environment variables at build-time with ArkEnv.
4
4
 
5
5
  ## Installation
6
6
 
@@ -27,29 +27,29 @@ export default defineConfig({
27
27
 
28
28
  ## Features
29
29
 
30
- - 🔒 **Build-time validation**: Catch missing or invalid environment variables during build
31
- - 🚀 **TypeScript support**: Full type inference for your environment variables
32
- - 💪 **Powered by ArkType**: Leverage ArkType's powerful type system
33
- - ⚡ **Zero runtime overhead**: Validation happens at build time only
30
+ - Build-time validation - app won't start if environment variables are invalid
31
+ - Typesafe environment variables backed by TypeScript
32
+ - Access to ArkType's powerful type system
34
33
 
35
34
  ## Usage
36
35
 
37
- The plugin validates environment variables that start with `VITE_` (Vite's convention for client-side environment variables). Define your schema in the plugin configuration:
36
+ Simply add the plugin to your Vite config and define your environment variables:
38
37
 
39
38
  ```typescript
40
- arkenv({
41
- // Required string
42
- VITE_API_URL: "string",
43
-
44
- // String literal union
45
- VITE_NODE_ENV: "'development' | 'production' | 'test'",
46
-
47
- // Optional with default
48
- "VITE_DEBUG?": 'boolean = false',
49
-
50
- // Array of strings
51
- "VITE_ALLOWED_ORIGINS?": 'string[] = []'
52
- })
39
+ // vite.config.ts
40
+ import arkenv from "@arkenv/vite-plugin";
41
+ import { defineConfig } from "vite";
42
+
43
+ export default defineConfig({
44
+ plugins: [
45
+ arkenv({
46
+ VITE_API_URL: "string",
47
+ VITE_NODE_ENV: "'development' | 'production' | 'test'",
48
+ "VITE_DEBUG?": 'boolean = false',
49
+ "VITE_ALLOWED_ORIGINS?": 'string[] = []'
50
+ }),
51
+ ],
52
+ });
53
53
  ```
54
54
 
55
55
  ## Environment Variables
@@ -63,26 +63,11 @@ VITE_DEBUG=true
63
63
  VITE_ALLOWED_ORIGINS=http://localhost:3000,https://example.com
64
64
  ```
65
65
 
66
- ## TypeScript Integration
67
-
68
- The plugin automatically provides type information for `import.meta.env`:
69
-
70
- ```typescript
71
- // TypeScript knows the exact types!
72
- console.log(import.meta.env.VITE_API_URL); // string
73
- console.log(import.meta.env.VITE_NODE_ENV); // "development" | "production" | "test"
74
- console.log(import.meta.env.VITE_DEBUG); // boolean
75
- ```
76
-
77
66
  ## Examples
78
67
 
79
- See the [with-vite-react-ts example](https://github.com/yamcodes/arkenv/tree/main/examples/with-vite-react-ts) for a complete working setup.
80
-
81
- ## Documentation
82
-
83
- For detailed documentation and more examples, visit the [ArkEnv documentation site](https://arkenv.js.org/docs).
68
+ * [with-vite-react-ts](https://github.com/yamcodes/arkenv/tree/main/examples/with-vite-react-ts)
84
69
 
85
70
  ## Related
86
71
 
87
- - [ArkEnv](https://github.com/yamcodes/arkenv) - The core library
88
- - [ArkType](https://arktype.io/) - The underlying validator / type system
72
+ - [ArkEnv](https://arkenv.js.org) - Core library and docs
73
+ - [ArkType](https://arktype.io/) - Underlying validator / type system
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arkenv/vite-plugin",
3
- "version": "0.0.10",
3
+ "version": "0.0.11",
4
4
  "author": "Yam Borodetsky <yam@yam.codes>",
5
5
  "repository": {
6
6
  "type": "git",
@@ -9,7 +9,7 @@
9
9
  "main": "./dist/index.cjs",
10
10
  "module": "./dist/index.js",
11
11
  "dependencies": {
12
- "arkenv": "0.7.0"
12
+ "arkenv": "0.7.1"
13
13
  },
14
14
  "devDependencies": {
15
15
  "@types/react": "^19.1.12",