Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/PengBoUESTC/vite-plugin-envtype-patch
gen dts for import.meta.env
https://github.com/PengBoUESTC/vite-plugin-envtype-patch
Last synced: 19 days ago
JSON representation
gen dts for import.meta.env
- Host: GitHub
- URL: https://github.com/PengBoUESTC/vite-plugin-envtype-patch
- Owner: PengBoUESTC
- License: mit
- Created: 2024-08-26T10:17:15.000Z (6 months ago)
- Default Branch: master
- Last Pushed: 2024-09-09T06:49:46.000Z (5 months ago)
- Last Synced: 2024-12-22T20:21:29.514Z (about 2 months ago)
- Language: HTML
- Size: 132 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- trackawesomelist - vite-plugin-envtype-patch (⭐1) - Generate `type` info for `import.meta.env`. (Recently Updated / [Oct 01, 2024](/content/2024/10/01/README.md))
- awesome-vite - vite-plugin-envtype-patch - Generate `type` info for `import.meta.env`. (Plugins / Framework-agnostic Plugins)
- fucking-awesome-vite - vite-plugin-envtype-patch - Generate `type` info for `import.meta.env`. (Plugins / Framework-agnostic Plugins)
README
# vite-plugin-envtype-patch
## Basic
gen dts file for import.meat.env;
Get all env values in `configResolved` hook, **zero** dependency.
```typescript
///
interface ImportMetaEnv {
VITE_XXX: string
// and so on
};```
## How to use
```typescript
import { envTypePatch } from 'vite-plugin-envtype-patch'{
plugins: [
envTypePatch({})
]
}
```## What's more
- convert simple type for `javascript` value
```typescript
import { TypeConvert } from 'vite-plugin-envtype-patch'const typeConvert = new TypeConvert({ once: false })
typeConvert.genSimpleType({
a: 100,
})// call toString
const output = `${typeConvert}
```