unplugin-env 0.1.8 → 1.0.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/LICENSE +1 -1
- package/README.md +68 -2
- package/README.zh-CN.md +236 -0
- package/dist/{chunk-FG4FU2UV.js → chunk-ELYQVJHH.js} +1 -1
- package/dist/chunk-QWCQIGEO.js +6319 -0
- package/dist/{chunk-D7PHTHAC.js → chunk-Y45ERLIW.js} +1 -1
- package/dist/esbuild.cjs +636 -29696
- package/dist/esbuild.js +1 -1
- package/dist/index.cjs +636 -29696
- package/dist/index.js +3 -3
- package/dist/nuxt.cjs +638 -29698
- package/dist/nuxt.d.cts +1 -1
- package/dist/nuxt.d.ts +1 -1
- package/dist/nuxt.js +4 -4
- package/dist/rollup.cjs +636 -29696
- package/dist/rollup.js +1 -1
- package/dist/vite.cjs +636 -29696
- package/dist/vite.js +2 -2
- package/dist/webpack.cjs +636 -29696
- package/dist/webpack.js +2 -2
- package/package.json +32 -26
- package/dist/chunk-HSFO6KAC.js +0 -35380
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2021 Anthony Fu <https://github.com/
|
|
3
|
+
Copyright (c) 2021 Anthony Fu <https://github.com/nikkolast88>
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
package/README.md
CHANGED
|
@@ -4,12 +4,25 @@
|
|
|
4
4
|
|
|
5
5
|
Starter template for [unplugin](https://github.com/unjs/unplugin).
|
|
6
6
|
|
|
7
|
+
English | [简体中文](./README.zh-CN.md)
|
|
8
|
+
|
|
9
|
+
## Requirements
|
|
10
|
+
|
|
11
|
+
- **Node.js**: `^20.19.0 || >=22.12.0`
|
|
12
|
+
- **Package Manager**: `pnpm >= 9.0.0` (recommended)
|
|
13
|
+
- **Browsers**:
|
|
14
|
+
- Chrome >= 109
|
|
15
|
+
- Firefox >= 115
|
|
16
|
+
- Safari >= 15.6
|
|
17
|
+
- Edge >= 109
|
|
18
|
+
- No IE 11 support
|
|
19
|
+
|
|
7
20
|
## Template Usage
|
|
8
21
|
|
|
9
22
|
To use this template, clone it down using:
|
|
10
23
|
|
|
11
24
|
```bash
|
|
12
|
-
npx degit
|
|
25
|
+
npx degit nikkolast88/unplugin-env my-unplugin
|
|
13
26
|
```
|
|
14
27
|
|
|
15
28
|
And do a global replace of `unplugin-env` with your plugin name.
|
|
@@ -21,10 +34,24 @@ To release a new version, run: `pnpm run release`
|
|
|
21
34
|
|
|
22
35
|
## Install
|
|
23
36
|
|
|
37
|
+
> **Note**: Requires Node.js `^20.19.0` or `>=22.12.0`
|
|
38
|
+
|
|
24
39
|
```bash
|
|
25
40
|
npm i unplugin-env
|
|
26
41
|
```
|
|
27
42
|
|
|
43
|
+
### Using pnpm (Recommended)
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
pnpm add unplugin-env
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Using yarn
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
yarn add unplugin-env
|
|
53
|
+
```
|
|
54
|
+
|
|
28
55
|
<details>
|
|
29
56
|
<summary>Vite</summary><br>
|
|
30
57
|
|
|
@@ -59,7 +86,6 @@ export default {
|
|
|
59
86
|
|
|
60
87
|
<br></details>
|
|
61
88
|
|
|
62
|
-
|
|
63
89
|
<details>
|
|
64
90
|
<summary>Webpack</summary><br>
|
|
65
91
|
|
|
@@ -121,3 +147,43 @@ build({
|
|
|
121
147
|
```
|
|
122
148
|
|
|
123
149
|
<br></details>
|
|
150
|
+
|
|
151
|
+
## System Requirements
|
|
152
|
+
|
|
153
|
+
### Runtime Environment
|
|
154
|
+
|
|
155
|
+
| Environment | Minimum Version | Recommended |
|
|
156
|
+
|------------|-----------------|-------------|
|
|
157
|
+
| Node.js | `^20.19.0` or `>=22.12.0` | Latest LTS |
|
|
158
|
+
| pnpm | `>=9.0.0` | `9.15.4+` |
|
|
159
|
+
| npm | `>=9.0.0` | Latest |
|
|
160
|
+
| yarn | `>=3.0.0` | Latest |
|
|
161
|
+
|
|
162
|
+
### Browser Support
|
|
163
|
+
|
|
164
|
+
This plugin generates code that runs in modern browsers:
|
|
165
|
+
|
|
166
|
+
- ✅ Chrome/Edge >= 109
|
|
167
|
+
- ✅ Firefox >= 115
|
|
168
|
+
- ✅ Safari >= 15.6
|
|
169
|
+
- ❌ Internet Explorer 11 (not supported)
|
|
170
|
+
|
|
171
|
+
### Build Tool Compatibility
|
|
172
|
+
|
|
173
|
+
| Tool | Version | Status |
|
|
174
|
+
|------|---------|--------|
|
|
175
|
+
| Vite | `>=5.0.0` | ✅ Fully supported |
|
|
176
|
+
| Webpack | `^4` or `^5` | ✅ Fully supported |
|
|
177
|
+
| Rollup | `>=3.0.0` | ✅ Fully supported |
|
|
178
|
+
| esbuild | `>=0.15.0` | ✅ Fully supported |
|
|
179
|
+
| Nuxt | `^3` or `^4` | ✅ Fully supported |
|
|
180
|
+
|
|
181
|
+
### Why These Requirements?
|
|
182
|
+
|
|
183
|
+
- **Node.js 20.19+**: Required by Vite 7 and ESLint 9
|
|
184
|
+
- **Modern Browsers**: Plugin uses ES6+ features (no transpilation for IE11)
|
|
185
|
+
- **pnpm 9+**: Optimized for Node.js 20 with better performance and workspace support
|
|
186
|
+
|
|
187
|
+
## License
|
|
188
|
+
|
|
189
|
+
MIT License © 2023-PRESENT [Nikkolast88]
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
# unplugin-env
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/unplugin-env)
|
|
4
|
+
|
|
5
|
+
[unplugin](https://github.com/unjs/unplugin) 的入门模板。
|
|
6
|
+
|
|
7
|
+
[English](./README.md) | 简体中文
|
|
8
|
+
|
|
9
|
+
## 系统要求
|
|
10
|
+
|
|
11
|
+
- **Node.js**: `^20.19.0 || >=22.12.0`
|
|
12
|
+
- **包管理器**: `pnpm >= 9.0.0` (推荐)
|
|
13
|
+
- **浏览器支持**:
|
|
14
|
+
- Chrome >= 109
|
|
15
|
+
- Firefox >= 115
|
|
16
|
+
- Safari >= 15.6
|
|
17
|
+
- Edge >= 109
|
|
18
|
+
- 不支持 IE 11
|
|
19
|
+
|
|
20
|
+
## 模板使用
|
|
21
|
+
|
|
22
|
+
使用以下命令克隆此模板:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npx degit nikkolast88/unplugin-env my-unplugin
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
然后全局替换 `unplugin-env` 为你的插件名称。
|
|
29
|
+
|
|
30
|
+
接下来你就可以开始开发你的 unplugin 了 🔥
|
|
31
|
+
|
|
32
|
+
测试插件,运行:`pnpm run dev`
|
|
33
|
+
发布新版本,运行:`pnpm run release`
|
|
34
|
+
|
|
35
|
+
## 安装
|
|
36
|
+
|
|
37
|
+
> **注意**: 需要 Node.js `^20.19.0` 或 `>=22.12.0`
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
npm i unplugin-env
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### 使用 pnpm(推荐)
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
pnpm add unplugin-env
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### 使用 yarn
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
yarn add unplugin-env
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## 使用方法
|
|
56
|
+
|
|
57
|
+
<details>
|
|
58
|
+
<summary>Vite</summary><br>
|
|
59
|
+
|
|
60
|
+
```ts
|
|
61
|
+
// vite.config.ts
|
|
62
|
+
import Starter from 'unplugin-env/vite'
|
|
63
|
+
|
|
64
|
+
export default defineConfig({
|
|
65
|
+
plugins: [
|
|
66
|
+
Starter({ /* 选项 */ }),
|
|
67
|
+
],
|
|
68
|
+
})
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
示例:[`playground/`](./playground/)
|
|
72
|
+
|
|
73
|
+
<br></details>
|
|
74
|
+
|
|
75
|
+
<details>
|
|
76
|
+
<summary>Rollup</summary><br>
|
|
77
|
+
|
|
78
|
+
```ts
|
|
79
|
+
// rollup.config.js
|
|
80
|
+
import Starter from 'unplugin-env/rollup'
|
|
81
|
+
|
|
82
|
+
export default {
|
|
83
|
+
plugins: [
|
|
84
|
+
Starter({ /* 选项 */ }),
|
|
85
|
+
],
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
<br></details>
|
|
90
|
+
|
|
91
|
+
<details>
|
|
92
|
+
<summary>Webpack</summary><br>
|
|
93
|
+
|
|
94
|
+
```ts
|
|
95
|
+
// webpack.config.js
|
|
96
|
+
module.exports = {
|
|
97
|
+
/* ... */
|
|
98
|
+
plugins: [
|
|
99
|
+
require('unplugin-env/webpack')({ /* 选项 */ })
|
|
100
|
+
]
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
<br></details>
|
|
105
|
+
|
|
106
|
+
<details>
|
|
107
|
+
<summary>Nuxt</summary><br>
|
|
108
|
+
|
|
109
|
+
```ts
|
|
110
|
+
// nuxt.config.js
|
|
111
|
+
export default {
|
|
112
|
+
buildModules: [
|
|
113
|
+
['unplugin-env/nuxt', { /* 选项 */ }],
|
|
114
|
+
],
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
> 此模块同时支持 Nuxt 2 和 [Nuxt Vite](https://github.com/nuxt/vite)
|
|
119
|
+
|
|
120
|
+
<br></details>
|
|
121
|
+
|
|
122
|
+
<details>
|
|
123
|
+
<summary>Vue CLI</summary><br>
|
|
124
|
+
|
|
125
|
+
```ts
|
|
126
|
+
// vue.config.js
|
|
127
|
+
module.exports = {
|
|
128
|
+
configureWebpack: {
|
|
129
|
+
plugins: [
|
|
130
|
+
require('unplugin-env/webpack')({ /* 选项 */ }),
|
|
131
|
+
],
|
|
132
|
+
},
|
|
133
|
+
}
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
<br></details>
|
|
137
|
+
|
|
138
|
+
<details>
|
|
139
|
+
<summary>esbuild</summary><br>
|
|
140
|
+
|
|
141
|
+
```ts
|
|
142
|
+
// esbuild.config.js
|
|
143
|
+
import { build } from 'esbuild'
|
|
144
|
+
import Starter from 'unplugin-env/esbuild'
|
|
145
|
+
|
|
146
|
+
build({
|
|
147
|
+
plugins: [Starter()],
|
|
148
|
+
})
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
<br></details>
|
|
152
|
+
|
|
153
|
+
## 系统要求详情
|
|
154
|
+
|
|
155
|
+
### 运行环境
|
|
156
|
+
|
|
157
|
+
| 环境 | 最低版本 | 推荐版本 |
|
|
158
|
+
|------|---------|---------|
|
|
159
|
+
| Node.js | `^20.19.0` 或 `>=22.12.0` | 最新 LTS 版本 |
|
|
160
|
+
| pnpm | `>=9.0.0` | `9.15.4+` |
|
|
161
|
+
| npm | `>=9.0.0` | 最新版本 |
|
|
162
|
+
| yarn | `>=3.0.0` | 最新版本 |
|
|
163
|
+
|
|
164
|
+
### 浏览器支持
|
|
165
|
+
|
|
166
|
+
此插件生成的代码可在现代浏览器中运行:
|
|
167
|
+
|
|
168
|
+
- ✅ Chrome/Edge >= 109
|
|
169
|
+
- ✅ Firefox >= 115
|
|
170
|
+
- ✅ Safari >= 15.6
|
|
171
|
+
- ❌ Internet Explorer 11(不支持)
|
|
172
|
+
|
|
173
|
+
### 构建工具兼容性
|
|
174
|
+
|
|
175
|
+
| 工具 | 版本 | 状态 |
|
|
176
|
+
|------|------|------|
|
|
177
|
+
| Vite | `>=5.0.0` | ✅ 完全支持 |
|
|
178
|
+
| Webpack | `^4` 或 `^5` | ✅ 完全支持 |
|
|
179
|
+
| Rollup | `>=3.0.0` | ✅ 完全支持 |
|
|
180
|
+
| esbuild | `>=0.15.0` | ✅ 完全支持 |
|
|
181
|
+
| Nuxt | `^3` 或 `^4` | ✅ 完全支持 |
|
|
182
|
+
|
|
183
|
+
### 为什么有这些要求?
|
|
184
|
+
|
|
185
|
+
- **Node.js 20.19+**:Vite 7 和 ESLint 9 的必需版本
|
|
186
|
+
- **现代浏览器**:插件使用 ES6+ 特性(不对 IE11 进行转译)
|
|
187
|
+
- **pnpm 9+**:针对 Node.js 20 优化,具有更好的性能和 workspace 支持
|
|
188
|
+
|
|
189
|
+
## 开发指南
|
|
190
|
+
|
|
191
|
+
### 开发环境设置
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
# 克隆仓库
|
|
195
|
+
git clone https://github.com/nikkolast88/unplugin-env.git
|
|
196
|
+
cd unplugin-env
|
|
197
|
+
|
|
198
|
+
# 安装依赖(推荐使用 pnpm)
|
|
199
|
+
pnpm install
|
|
200
|
+
|
|
201
|
+
# 启动开发模式
|
|
202
|
+
pnpm run dev
|
|
203
|
+
|
|
204
|
+
# 在 playground 中测试
|
|
205
|
+
pnpm run play
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
### 可用脚本
|
|
209
|
+
|
|
210
|
+
- `pnpm run build` - 构建生产版本
|
|
211
|
+
- `pnpm run dev` - 启动开发模式(监听文件变化)
|
|
212
|
+
- `pnpm run play` - 在 playground 中测试插件
|
|
213
|
+
- `pnpm run lint` - 运行代码检查
|
|
214
|
+
- `pnpm run test` - 运行测试
|
|
215
|
+
- `pnpm run release` - 发布新版本
|
|
216
|
+
|
|
217
|
+
### 项目结构
|
|
218
|
+
|
|
219
|
+
```
|
|
220
|
+
unplugin-env/
|
|
221
|
+
├── src/ # 源代码
|
|
222
|
+
│ ├── core/ # 核心功能
|
|
223
|
+
│ ├── index.ts # 主入口
|
|
224
|
+
│ ├── vite.ts # Vite 插件
|
|
225
|
+
│ ├── webpack.ts # Webpack 插件
|
|
226
|
+
│ ├── rollup.ts # Rollup 插件
|
|
227
|
+
│ ├── esbuild.ts # esbuild 插件
|
|
228
|
+
│ └── nuxt.ts # Nuxt 模块
|
|
229
|
+
├── playground/ # 测试项目
|
|
230
|
+
├── test/ # 测试文件
|
|
231
|
+
└── dist/ # 构建输出
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
## 许可证
|
|
235
|
+
|
|
236
|
+
MIT License © 2023-PRESENT [Nikkolast88]
|