@uni-helper/uni-env 0.2.2 → 0.3.0
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 +21 -6
- package/dist/index.cjs +402 -64
- package/dist/index.d.cts +401 -91
- package/dist/index.d.mts +401 -91
- package/dist/index.mjs +354 -64
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
<a href="https://uni-helper.js.org/uni-env"><img src="./banner.svg" alt="banner" width="100%"/></a>
|
|
2
2
|
|
|
3
|
-
<
|
|
4
|
-
<a href="https://github.com/uni-helper/uni-env/stargazers"><img src="https://img.shields.io/github/stars/uni-helper/uni-env?colorA=005947&colorB=eee&style=for-the-badge"></a>
|
|
5
|
-
<a href="https://www.npmjs.com/package/@uni-helper/uni-env"><img src="https://img.shields.io/npm/dm/@uni-helper/uni-env?colorA=005947&colorB=eee&style=for-the-badge"></a>
|
|
6
|
-
<a href="https://www.npmjs.com/package/@uni-helper/uni-env"><img src="https://img.shields.io/npm/v/@uni-helper/uni-env?colorA=005947&colorB=eee&style=for-the-badge"></a>
|
|
3
|
+
<p style="text-align: center">
|
|
4
|
+
<a href="https://github.com/uni-helper/uni-env/stargazers"><img src="https://img.shields.io/github/stars/uni-helper/uni-env?colorA=005947&colorB=eee&style=for-the-badge" alt="stars"></a>
|
|
5
|
+
<a href="https://www.npmjs.com/package/@uni-helper/uni-env"><img src="https://img.shields.io/npm/dm/@uni-helper/uni-env?colorA=005947&colorB=eee&style=for-the-badge" alt="downloads"></a>
|
|
6
|
+
<a href="https://www.npmjs.com/package/@uni-helper/uni-env"><img src="https://img.shields.io/npm/v/@uni-helper/uni-env?colorA=005947&colorB=eee&style=for-the-badge" alt="version"></a>
|
|
7
|
+
</p>
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
<p style="text-align: center">
|
|
10
|
+
<a href="https://deepwiki.com/uni-helper/uni-env"><img src="https://deepwiki.com/badge.svg" alt="deepwiki"></a>
|
|
11
|
+
</p>
|
|
9
12
|
|
|
10
13
|
在 uni-app 中优雅地判断当前环境。
|
|
11
14
|
|
|
@@ -20,5 +23,17 @@ pnpm i @uni-helper/uni-env
|
|
|
20
23
|
📖 **请阅读[完整文档](https://uni-helper.js.org/uni-env)了解完整使用方法!**
|
|
21
24
|
|
|
22
25
|
```ts
|
|
23
|
-
import { isMpWeixin } from '@uni-helper/uni-env'
|
|
26
|
+
import { isMpWeixin, platform, appId } from '@uni-helper/uni-env'
|
|
24
27
|
```
|
|
28
|
+
|
|
29
|
+
:::tip 构建期而非运行时
|
|
30
|
+
本库读取的是 uni-app 在**构建期**注入的环境值(通过 Vite `define` 静态替换 `process.env.*`),不是运行时条件编译。要做条件编译请使用官方的 [跨端兼容 - 条件编译](https://uniapp.dcloud.net.cn/tutorial/platform.html#preprocessor) 或 [unplugin-preprocessor-directives](https://github.com/KeJunMao/unplugin-preprocessor-directives)。
|
|
31
|
+
:::
|
|
32
|
+
|
|
33
|
+
## 参与贡献
|
|
34
|
+
|
|
35
|
+
环境变量读取规则等开发约定见 [CONTRIBUTING.md](./CONTRIBUTING.md)。
|
|
36
|
+
|
|
37
|
+
## 许可
|
|
38
|
+
|
|
39
|
+
MIT
|