@arkenv/vite-plugin 0.0.10 → 0.0.12
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 +22 -37
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# `@arkenv/vite-plugin`
|
|
2
2
|
|
|
3
|
-
|
|
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
|
-
-
|
|
31
|
-
-
|
|
32
|
-
-
|
|
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
|
-
|
|
36
|
+
Simply add the plugin to your Vite config and define your environment variables:
|
|
38
37
|
|
|
39
38
|
```typescript
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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
|
-
|
|
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://
|
|
88
|
-
- [ArkType](https://arktype.io/) -
|
|
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.
|
|
3
|
+
"version": "0.0.12",
|
|
4
4
|
"author": "Yam Borodetsky <yam@yam.codes>",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -9,17 +9,17 @@
|
|
|
9
9
|
"main": "./dist/index.cjs",
|
|
10
10
|
"module": "./dist/index.js",
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"arkenv": "0.7.
|
|
12
|
+
"arkenv": "0.7.2"
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
|
-
"@types/react": "^19.
|
|
16
|
-
"@types/react-dom": "^19.
|
|
17
|
-
"@vitejs/plugin-react": "^5.0.
|
|
18
|
-
"react": "^19.
|
|
19
|
-
"react-dom": "^19.
|
|
15
|
+
"@types/react": "^19.2.0",
|
|
16
|
+
"@types/react-dom": "^19.2.0",
|
|
17
|
+
"@vitejs/plugin-react": "^5.0.4",
|
|
18
|
+
"react": "^19.2.0",
|
|
19
|
+
"react-dom": "^19.2.0",
|
|
20
20
|
"tsup": "^8.5.0",
|
|
21
|
-
"typescript": "^5.9.
|
|
22
|
-
"vite": "^7.1.
|
|
21
|
+
"typescript": "^5.9.3",
|
|
22
|
+
"vite": "^7.1.9",
|
|
23
23
|
"vitest": "^3.2.4"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|