@uni-helper/uni-env 0.1.3 → 0.1.5
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/dist/index.cjs +72 -62
- package/dist/index.d.cts +116 -72
- package/dist/index.d.mts +116 -72
- package/dist/index.d.ts +116 -72
- package/dist/index.mjs +67 -63
- package/package.json +16 -9
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { env } from 'std-env';
|
|
2
|
-
|
|
3
1
|
function toBoolean(val) {
|
|
4
2
|
return val ? val !== "false" : false;
|
|
5
3
|
}
|
|
@@ -13,15 +11,16 @@ function parseJSON(val) {
|
|
|
13
11
|
return obj;
|
|
14
12
|
}
|
|
15
13
|
|
|
16
|
-
const builtInPlatforms = ["h5", "web", "app", "app-plus", "mp-360", "mp-alipay", "mp-baidu", "mp-qq", "mp-toutiao", "mp-weixin", "mp-kuaishou", "mp-lark", "mp-jd", "mp-xhs", "quickapp-webview", "quickapp-webview-huawei", "quickapp-webview-union"];
|
|
17
|
-
const platform = env.UNI_PLATFORM;
|
|
18
|
-
const appPlatform = env.UNI_APP_PLATFORM;
|
|
19
|
-
const subPlatform = env.UNI_SUB_PLATFORM;
|
|
20
|
-
const utsPlatform = env.UNI_UTS_PLATFORM;
|
|
14
|
+
const builtInPlatforms = ["h5", "web", "app", "app-plus", "app-harmony", "mp-360", "mp-alipay", "mp-baidu", "mp-qq", "mp-toutiao", "mp-weixin", "mp-kuaishou", "mp-lark", "mp-jd", "mp-xhs", "quickapp-webview", "quickapp-webview-huawei", "quickapp-webview-union"];
|
|
15
|
+
const platform = process.env.UNI_PLATFORM;
|
|
16
|
+
const appPlatform = process.env.UNI_APP_PLATFORM;
|
|
17
|
+
const subPlatform = process.env.UNI_SUB_PLATFORM;
|
|
18
|
+
const utsPlatform = process.env.UNI_UTS_PLATFORM;
|
|
21
19
|
const isH5 = platform === "h5";
|
|
22
20
|
const isWeb = platform === "web";
|
|
23
21
|
const isApp = platform === "app";
|
|
24
22
|
const isAppPlus = platform === "app-plus";
|
|
23
|
+
const isAppHarmony = platform === "app-harmony";
|
|
25
24
|
const isAppAndroid = appPlatform === "android" || utsPlatform === "app-android";
|
|
26
25
|
const isAppIOS = appPlatform === "ios" || utsPlatform === "app-ios";
|
|
27
26
|
const isMp = /^mp-/i.test(platform);
|
|
@@ -34,60 +33,65 @@ const isMpToutiao = platform === "mp-toutiao";
|
|
|
34
33
|
const isQuickapp = /^quickapp-webview/i.test(platform);
|
|
35
34
|
const isQuickappUnion = platform === "quickapp-webview-union";
|
|
36
35
|
const isQuickappHuawei = platform === "quickapp-webview-huawei";
|
|
37
|
-
const utsJsCodeFormat = env.UNI_UTS_JS_CODE_FORMAT;
|
|
38
|
-
const utsModuleType = env.UNI_UTS_MODULE_TYPE;
|
|
39
|
-
const utsModulePrefix = env.UNI_UTS_MODULE_PREFIX;
|
|
40
|
-
const utsTargetLanguage = env.UNI_UTS_TARGET_LANGUAGE;
|
|
41
|
-
const inputDir = env.UNI_INPUT_DIR;
|
|
42
|
-
const outputDir = env.UNI_OUTPUT_DIR;
|
|
43
|
-
const cliContext = env.UNI_CLI_CONTEXT;
|
|
44
|
-
const subpackage = env.UNI_SUBPACKAGE;
|
|
45
|
-
const mpPlugin = env.UNI_MP_PLUGIN;
|
|
46
|
-
const isMpPlugin = toBoolean(env.UNI_MP_PLUGIN);
|
|
47
|
-
const compilerVersion = env.UNI_COMPILER_VERSION;
|
|
48
|
-
const compilerVersionType = env.UNI_COMPILER_VERSION_TYPE;
|
|
49
|
-
const hbuilderxPlugins = env.UNI_HBUILDERX_PLUGINS;
|
|
50
|
-
const renderer = env.UNI_RENDERER;
|
|
51
|
-
const nvueCompiler = env.UNI_NVUE_COMPILER;
|
|
52
|
-
const nvueStyleCompiler = env.UNI_NVUE_STYLE_COMPILER;
|
|
53
|
-
const appCodeSpliting = env.UNI_APP_CODE_SPLITING;
|
|
54
|
-
const automatorWsEndpoint = env.UNI_AUTOMATOR_WS_ENDPOINT;
|
|
55
|
-
const automatorAppWebview = env.UNI_AUTOMATOR_APP_WEBVIEW;
|
|
56
|
-
const automatorAppWebviewSrc = env.UNI_AUTOMATOR_APP_WEBVIEW_SRC;
|
|
57
|
-
const h5Base = env.UNI_H5_BASE;
|
|
58
|
-
const h5Browser = env.UNI_H5_BROWSER;
|
|
59
|
-
const customScript = env.UNI_CUSTOM_SCRIPT;
|
|
60
|
-
const customDefine = env.UNI_CUSTOM_DEFINE;
|
|
61
|
-
const customContext = env.UNI_CUSTOM_CONTEXT;
|
|
62
|
-
const minimize = env.UNI_MINIMIZE;
|
|
63
|
-
const isMinimize = toBoolean(env.UNI_MINIMIZE);
|
|
64
|
-
const uvue = env.UNI_UVUE;
|
|
65
|
-
const isUVue = toBoolean(env.UNI_MINIMIZE);
|
|
66
|
-
const uvueTargetLanguage = env.UNI_UVUE_TARGET_LANGUAGE;
|
|
67
|
-
const compiler = env.UNI_COMPILER;
|
|
68
|
-
const rendererNative = env.UNI_RENDERER_NATIVE;
|
|
69
|
-
const nvueAppStyles = env.UNI_NVUE_APP_STYLES;
|
|
70
|
-
const appChangedFiles = env.UNI_APP_CHANGED_FILES;
|
|
71
|
-
const appChangedPages = env.UNI_APP_CHANGED_PAGES;
|
|
72
|
-
const darkMode = env.VUE_APP_DARK_MODE;
|
|
73
|
-
const hasDarkMode = toBoolean(env.VUE_APP_DARK_MODE);
|
|
74
|
-
const hxUseBaseType = env.HX_USE_BASE_TYPE;
|
|
75
|
-
const hxDependenciesDir = env.HX_DEPENDENCIES_DIR;
|
|
76
|
-
const appX = env.UNI_APP_X;
|
|
77
|
-
const isAppX = toBoolean(env.UNI_APP_X);
|
|
78
|
-
const appXCacheDir = env.UNI_APP_X_CACHE_DIR;
|
|
79
|
-
const hxVersion = env.HX_VERSION;
|
|
80
|
-
const appXPageCount = env.UNI_APP_X_PAGE_COUNT;
|
|
81
|
-
const appXTsc = env.UNI_APP_X_TSC;
|
|
82
|
-
const appXSingleThread = env.UNI_APP_X_SINGLE_THREAD;
|
|
83
|
-
const appXSetup = env.UNI_APP_X_SETUP;
|
|
84
|
-
const appXUVueScriptEngine = env.UNI_APP_X_UVUE_SCRIPT_ENGINE;
|
|
85
|
-
const
|
|
86
|
-
const
|
|
87
|
-
const
|
|
88
|
-
const
|
|
89
|
-
const
|
|
90
|
-
const
|
|
91
|
-
const
|
|
36
|
+
const utsJsCodeFormat = process.env.UNI_UTS_JS_CODE_FORMAT;
|
|
37
|
+
const utsModuleType = process.env.UNI_UTS_MODULE_TYPE;
|
|
38
|
+
const utsModulePrefix = process.env.UNI_UTS_MODULE_PREFIX;
|
|
39
|
+
const utsTargetLanguage = process.env.UNI_UTS_TARGET_LANGUAGE;
|
|
40
|
+
const inputDir = process.env.UNI_INPUT_DIR;
|
|
41
|
+
const outputDir = process.env.UNI_OUTPUT_DIR;
|
|
42
|
+
const cliContext = process.env.UNI_CLI_CONTEXT;
|
|
43
|
+
const subpackage = process.env.UNI_SUBPACKAGE;
|
|
44
|
+
const mpPlugin = process.env.UNI_MP_PLUGIN;
|
|
45
|
+
const isMpPlugin = toBoolean(process.env.UNI_MP_PLUGIN);
|
|
46
|
+
const compilerVersion = process.env.UNI_COMPILER_VERSION;
|
|
47
|
+
const compilerVersionType = process.env.UNI_COMPILER_VERSION_TYPE;
|
|
48
|
+
const hbuilderxPlugins = process.env.UNI_HBUILDERX_PLUGINS;
|
|
49
|
+
const renderer = process.env.UNI_RENDERER;
|
|
50
|
+
const nvueCompiler = process.env.UNI_NVUE_COMPILER;
|
|
51
|
+
const nvueStyleCompiler = process.env.UNI_NVUE_STYLE_COMPILER;
|
|
52
|
+
const appCodeSpliting = process.env.UNI_APP_CODE_SPLITING;
|
|
53
|
+
const automatorWsEndpoint = process.env.UNI_AUTOMATOR_WS_ENDPOINT;
|
|
54
|
+
const automatorAppWebview = process.env.UNI_AUTOMATOR_APP_WEBVIEW;
|
|
55
|
+
const automatorAppWebviewSrc = process.env.UNI_AUTOMATOR_APP_WEBVIEW_SRC;
|
|
56
|
+
const h5Base = process.env.UNI_H5_BASE;
|
|
57
|
+
const h5Browser = process.env.UNI_H5_BROWSER;
|
|
58
|
+
const customScript = process.env.UNI_CUSTOM_SCRIPT;
|
|
59
|
+
const customDefine = process.env.UNI_CUSTOM_DEFINE;
|
|
60
|
+
const customContext = process.env.UNI_CUSTOM_CONTEXT;
|
|
61
|
+
const minimize = process.env.UNI_MINIMIZE;
|
|
62
|
+
const isMinimize = toBoolean(process.env.UNI_MINIMIZE);
|
|
63
|
+
const uvue = process.env.UNI_UVUE;
|
|
64
|
+
const isUVue = toBoolean(process.env.UNI_MINIMIZE);
|
|
65
|
+
const uvueTargetLanguage = process.env.UNI_UVUE_TARGET_LANGUAGE;
|
|
66
|
+
const compiler = process.env.UNI_COMPILER;
|
|
67
|
+
const rendererNative = process.env.UNI_RENDERER_NATIVE;
|
|
68
|
+
const nvueAppStyles = process.env.UNI_NVUE_APP_STYLES;
|
|
69
|
+
const appChangedFiles = process.env.UNI_APP_CHANGED_FILES;
|
|
70
|
+
const appChangedPages = process.env.UNI_APP_CHANGED_PAGES;
|
|
71
|
+
const darkMode = process.env.VUE_APP_DARK_MODE;
|
|
72
|
+
const hasDarkMode = toBoolean(process.env.VUE_APP_DARK_MODE);
|
|
73
|
+
const hxUseBaseType = process.env.HX_USE_BASE_TYPE;
|
|
74
|
+
const hxDependenciesDir = process.env.HX_DEPENDENCIES_DIR;
|
|
75
|
+
const appX = process.env.UNI_APP_X;
|
|
76
|
+
const isAppX = toBoolean(process.env.UNI_APP_X);
|
|
77
|
+
const appXCacheDir = process.env.UNI_APP_X_CACHE_DIR;
|
|
78
|
+
const hxVersion = process.env.HX_VERSION;
|
|
79
|
+
const appXPageCount = process.env.UNI_APP_X_PAGE_COUNT;
|
|
80
|
+
const appXTsc = process.env.UNI_APP_X_TSC;
|
|
81
|
+
const appXSingleThread = process.env.UNI_APP_X_SINGLE_THREAD;
|
|
82
|
+
const appXSetup = process.env.UNI_APP_X_SETUP;
|
|
83
|
+
const appXUVueScriptEngine = process.env.UNI_APP_X_UVUE_SCRIPT_ENGINE;
|
|
84
|
+
const compileTarget = process.env.UNI_COMPILE_TARGET;
|
|
85
|
+
const compileCloudDir = process.env.UNI_COMPILE_CLOUD_DIR;
|
|
86
|
+
const modulesEncryptCacheDir = process.env.UNI_MODULES_ENCRYPT_CACHE_DIR;
|
|
87
|
+
const appPackType = process.env.UNI_APP_PACK_TYPE;
|
|
88
|
+
const appHarmonyProjectPath = process.env.UNI_APP_HARMONY_PROJECT_PATH;
|
|
89
|
+
const statTitleJson = parseJSON(process.env.STAT_TITLE_JSON);
|
|
90
|
+
const sourcemap = process.env.SOURCEMAP;
|
|
91
|
+
const hasSourcemap = toBoolean(process.env.SOURCEMAP);
|
|
92
|
+
const ssrClient = process.env.UNI_SSR_CLIENT;
|
|
93
|
+
const isSSRClient = toBoolean(process.env.UNI_SSR_CLIENT);
|
|
94
|
+
const ssrServer = process.env.UNI_SSR_SERVER;
|
|
95
|
+
const isSSRServer = toBoolean(process.env.UNI_SSR_SERVER);
|
|
92
96
|
|
|
93
|
-
export { appChangedFiles, appChangedPages, appCodeSpliting, appPlatform, appX, appXCacheDir, appXPageCount, appXSetup, appXSingleThread, appXTsc, appXUVueScriptEngine, automatorAppWebview, automatorAppWebviewSrc, automatorWsEndpoint, builtInPlatforms, cliContext, compiler, compilerVersion, compilerVersionType, customContext, customDefine, customScript, darkMode, h5Base, h5Browser, hasDarkMode, hasSourcemap, hbuilderxPlugins, hxDependenciesDir, hxUseBaseType, hxVersion, inputDir, isApp, isAppAndroid, isAppIOS, isAppPlus, isAppX, isH5, isMinimize, isMp, isMpAlipay, isMpBaidu, isMpKuaishou, isMpPlugin, isMpQQ, isMpToutiao, isMpWeixin, isQuickapp, isQuickappHuawei, isQuickappUnion, isSSRClient, isSSRServer, isUVue, isWeb, minimize, mpPlugin, nvueAppStyles, nvueCompiler, nvueStyleCompiler, outputDir, platform, renderer, rendererNative, sourcemap, ssrClient, ssrServer, statTitleJson, subPlatform, subpackage, utsJsCodeFormat, utsModulePrefix, utsModuleType, utsPlatform, utsTargetLanguage, uvue, uvueTargetLanguage };
|
|
97
|
+
export { appChangedFiles, appChangedPages, appCodeSpliting, appHarmonyProjectPath, appPackType, appPlatform, appX, appXCacheDir, appXPageCount, appXSetup, appXSingleThread, appXTsc, appXUVueScriptEngine, automatorAppWebview, automatorAppWebviewSrc, automatorWsEndpoint, builtInPlatforms, cliContext, compileCloudDir, compileTarget, compiler, compilerVersion, compilerVersionType, customContext, customDefine, customScript, darkMode, h5Base, h5Browser, hasDarkMode, hasSourcemap, hbuilderxPlugins, hxDependenciesDir, hxUseBaseType, hxVersion, inputDir, isApp, isAppAndroid, isAppHarmony, isAppIOS, isAppPlus, isAppX, isH5, isMinimize, isMp, isMpAlipay, isMpBaidu, isMpKuaishou, isMpPlugin, isMpQQ, isMpToutiao, isMpWeixin, isQuickapp, isQuickappHuawei, isQuickappUnion, isSSRClient, isSSRServer, isUVue, isWeb, minimize, modulesEncryptCacheDir, mpPlugin, nvueAppStyles, nvueCompiler, nvueStyleCompiler, outputDir, platform, renderer, rendererNative, sourcemap, ssrClient, ssrServer, statTitleJson, subPlatform, subpackage, utsJsCodeFormat, utsModulePrefix, utsModuleType, utsPlatform, utsTargetLanguage, uvue, uvueTargetLanguage };
|
package/package.json
CHANGED
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uni-helper/uni-env",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1.
|
|
5
|
-
"description": "",
|
|
4
|
+
"version": "0.1.5",
|
|
5
|
+
"description": "在 uni-app 中优雅地判断当前环境。",
|
|
6
6
|
"author": "KeJun",
|
|
7
|
+
"maintainers": [
|
|
8
|
+
{
|
|
9
|
+
"email": "wurui.dev@gmail.com",
|
|
10
|
+
"name": "ModyQyW",
|
|
11
|
+
"url": "https://modyqyw.top"
|
|
12
|
+
}
|
|
13
|
+
],
|
|
7
14
|
"license": "MIT",
|
|
8
15
|
"homepage": "https://github.com/uni-helper/uni-env#readme",
|
|
9
16
|
"repository": {
|
|
@@ -38,14 +45,14 @@
|
|
|
38
45
|
"std-env": "^3.7.0"
|
|
39
46
|
},
|
|
40
47
|
"devDependencies": {
|
|
41
|
-
"@antfu/eslint-config": "^
|
|
42
|
-
"@types/node": "^20.
|
|
43
|
-
"bumpp": "^9.
|
|
44
|
-
"eslint": "^
|
|
45
|
-
"esno": "^4.
|
|
46
|
-
"typescript": "^5.
|
|
48
|
+
"@antfu/eslint-config": "^3.8.0",
|
|
49
|
+
"@types/node": "^20.17.1",
|
|
50
|
+
"bumpp": "^9.7.1",
|
|
51
|
+
"eslint": "^9.13.0",
|
|
52
|
+
"esno": "^4.8.0",
|
|
53
|
+
"typescript": "^5.6.3",
|
|
47
54
|
"unbuild": "^2.0.0",
|
|
48
|
-
"vitest": "^1.
|
|
55
|
+
"vitest": "^2.1.3"
|
|
49
56
|
},
|
|
50
57
|
"scripts": {
|
|
51
58
|
"build": "unbuild",
|