@uni-helper/uni-env 0.1.2 → 0.1.3

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # @uni-helper/uni-env
2
2
 
3
- 在 uni-app 中优雅的判断当前环境
3
+ 在 uni-app 中优雅地判断当前环境。
4
4
 
5
5
  [![npm version][npm-version-src]][npm-version-href]
6
6
  [![npm downloads][npm-downloads-src]][npm-downloads-href]
package/dist/index.cjs CHANGED
@@ -2,30 +2,28 @@
2
2
 
3
3
  const stdEnv = require('std-env');
4
4
 
5
- const builtInPlatforms = [
6
- "app",
7
- "app-plus",
8
- "h5",
9
- "mp-360",
10
- "mp-alipay",
11
- "mp-baidu",
12
- "mp-jd",
13
- "mp-kuaishou",
14
- "mp-lark",
15
- "mp-qq",
16
- "mp-toutiao",
17
- "mp-weixin",
18
- "quickapp-webview",
19
- "quickapp-webview-huawei",
20
- "quickapp-webview-union"
21
- ];
5
+ function toBoolean(val) {
6
+ return val ? val !== "false" : false;
7
+ }
8
+ function parseJSON(val) {
9
+ let obj;
10
+ try {
11
+ obj = JSON.parse(val || "{}");
12
+ } catch (error) {
13
+ obj = {};
14
+ }
15
+ return obj;
16
+ }
22
17
 
18
+ 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"];
23
19
  const platform = stdEnv.env.UNI_PLATFORM;
24
- const utsPlatform = stdEnv.env.UNI_UTS_PLATFORM;
25
20
  const appPlatform = stdEnv.env.UNI_APP_PLATFORM;
26
21
  const subPlatform = stdEnv.env.UNI_SUB_PLATFORM;
22
+ const utsPlatform = stdEnv.env.UNI_UTS_PLATFORM;
27
23
  const isH5 = platform === "h5";
24
+ const isWeb = platform === "web";
28
25
  const isApp = platform === "app";
26
+ const isAppPlus = platform === "app-plus";
29
27
  const isAppAndroid = appPlatform === "android" || utsPlatform === "app-android";
30
28
  const isAppIOS = appPlatform === "ios" || utsPlatform === "app-ios";
31
29
  const isMp = /^mp-/i.test(platform);
@@ -38,47 +36,76 @@ const isMpToutiao = platform === "mp-toutiao";
38
36
  const isQuickapp = /^quickapp-webview/i.test(platform);
39
37
  const isQuickappUnion = platform === "quickapp-webview-union";
40
38
  const isQuickappHuawei = platform === "quickapp-webview-huawei";
41
-
42
- function toBoolean(val) {
43
- return val ? val !== "false" : false;
44
- }
45
- function parseJSON(val) {
46
- let obj;
47
- try {
48
- obj = JSON.parse(val || "{}");
49
- } catch (error) {
50
- obj = {};
51
- }
52
- return obj;
53
- }
54
-
55
- const hasDarkMode = toBoolean(stdEnv.env.VUE_APP_DARK_MODE);
56
- const hasSourcemap = toBoolean(stdEnv.env.SOURCEMAP);
39
+ const utsJsCodeFormat = stdEnv.env.UNI_UTS_JS_CODE_FORMAT;
40
+ const utsModuleType = stdEnv.env.UNI_UTS_MODULE_TYPE;
41
+ const utsModulePrefix = stdEnv.env.UNI_UTS_MODULE_PREFIX;
42
+ const utsTargetLanguage = stdEnv.env.UNI_UTS_TARGET_LANGUAGE;
43
+ const inputDir = stdEnv.env.UNI_INPUT_DIR;
44
+ const outputDir = stdEnv.env.UNI_OUTPUT_DIR;
45
+ const cliContext = stdEnv.env.UNI_CLI_CONTEXT;
46
+ const subpackage = stdEnv.env.UNI_SUBPACKAGE;
47
+ const mpPlugin = stdEnv.env.UNI_MP_PLUGIN;
57
48
  const isMpPlugin = toBoolean(stdEnv.env.UNI_MP_PLUGIN);
58
- const isMinimize = toBoolean(stdEnv.env.UNI_MINIMIZE);
59
- const isSSRClient = toBoolean(stdEnv.env.UNI_SSR_CLIENT);
60
- const isSSRServer = toBoolean(stdEnv.env.UNI_SSR_SERVER);
61
-
62
- const compiler = stdEnv.env.UNI_COMPILER;
63
- const nvueCompiler = stdEnv.env.UNI_NVUE_COMPILER;
64
- const nvueStyleCompiler = stdEnv.env.UNI_NVUE_STYLE_COMPILER;
65
49
  const compilerVersion = stdEnv.env.UNI_COMPILER_VERSION;
66
50
  const compilerVersionType = stdEnv.env.UNI_COMPILER_VERSION_TYPE;
67
-
68
- const cliContext = stdEnv.env.UNI_CLI_CONTEXT;
69
- const inputDir = stdEnv.env.UNI_INPUT_DIR;
70
- const outputDir = stdEnv.env.UNI_OUTPUT_DIR;
71
- const statTitleJson = parseJSON(
72
- stdEnv.env.STAT_TITLE_JSON
73
- );
74
- const customContext = stdEnv.env.UNI_CUSTOM_CONTEXT;
51
+ const hbuilderxPlugins = stdEnv.env.UNI_HBUILDERX_PLUGINS;
52
+ const renderer = stdEnv.env.UNI_RENDERER;
53
+ const nvueCompiler = stdEnv.env.UNI_NVUE_COMPILER;
54
+ const nvueStyleCompiler = stdEnv.env.UNI_NVUE_STYLE_COMPILER;
55
+ const appCodeSpliting = stdEnv.env.UNI_APP_CODE_SPLITING;
56
+ const automatorWsEndpoint = stdEnv.env.UNI_AUTOMATOR_WS_ENDPOINT;
57
+ const automatorAppWebview = stdEnv.env.UNI_AUTOMATOR_APP_WEBVIEW;
58
+ const automatorAppWebviewSrc = stdEnv.env.UNI_AUTOMATOR_APP_WEBVIEW_SRC;
59
+ const h5Base = stdEnv.env.UNI_H5_BASE;
60
+ const h5Browser = stdEnv.env.UNI_H5_BROWSER;
75
61
  const customScript = stdEnv.env.UNI_CUSTOM_SCRIPT;
76
62
  const customDefine = stdEnv.env.UNI_CUSTOM_DEFINE;
77
- const subpackage = stdEnv.env.UNI_SUBPACKAGE;
78
- const renderer = stdEnv.env.UNI_RENDERER;
63
+ const customContext = stdEnv.env.UNI_CUSTOM_CONTEXT;
64
+ const minimize = stdEnv.env.UNI_MINIMIZE;
65
+ const isMinimize = toBoolean(stdEnv.env.UNI_MINIMIZE);
66
+ const uvue = stdEnv.env.UNI_UVUE;
67
+ const isUVue = toBoolean(stdEnv.env.UNI_MINIMIZE);
68
+ const uvueTargetLanguage = stdEnv.env.UNI_UVUE_TARGET_LANGUAGE;
69
+ const compiler = stdEnv.env.UNI_COMPILER;
79
70
  const rendererNative = stdEnv.env.UNI_RENDERER_NATIVE;
71
+ const nvueAppStyles = stdEnv.env.UNI_NVUE_APP_STYLES;
72
+ const appChangedFiles = stdEnv.env.UNI_APP_CHANGED_FILES;
73
+ const appChangedPages = stdEnv.env.UNI_APP_CHANGED_PAGES;
74
+ const darkMode = stdEnv.env.VUE_APP_DARK_MODE;
75
+ const hasDarkMode = toBoolean(stdEnv.env.VUE_APP_DARK_MODE);
76
+ const hxUseBaseType = stdEnv.env.HX_USE_BASE_TYPE;
77
+ const hxDependenciesDir = stdEnv.env.HX_DEPENDENCIES_DIR;
78
+ const appX = stdEnv.env.UNI_APP_X;
79
+ const isAppX = toBoolean(stdEnv.env.UNI_APP_X);
80
+ const appXCacheDir = stdEnv.env.UNI_APP_X_CACHE_DIR;
81
+ const hxVersion = stdEnv.env.HX_VERSION;
82
+ const appXPageCount = stdEnv.env.UNI_APP_X_PAGE_COUNT;
83
+ const appXTsc = stdEnv.env.UNI_APP_X_TSC;
84
+ const appXSingleThread = stdEnv.env.UNI_APP_X_SINGLE_THREAD;
85
+ const appXSetup = stdEnv.env.UNI_APP_X_SETUP;
86
+ const appXUVueScriptEngine = stdEnv.env.UNI_APP_X_UVUE_SCRIPT_ENGINE;
87
+ const statTitleJson = parseJSON(stdEnv.env.STAT_TITLE_JSON);
88
+ const sourcemap = stdEnv.env.SOURCEMAP;
89
+ const hasSourcemap = toBoolean(stdEnv.env.SOURCEMAP);
90
+ const ssrClient = stdEnv.env.UNI_SSR_CLIENT;
91
+ const isSSRClient = toBoolean(stdEnv.env.UNI_SSR_CLIENT);
92
+ const ssrServer = stdEnv.env.UNI_SSR_SERVER;
93
+ const isSSRServer = toBoolean(stdEnv.env.UNI_SSR_SERVER);
80
94
 
95
+ exports.appChangedFiles = appChangedFiles;
96
+ exports.appChangedPages = appChangedPages;
97
+ exports.appCodeSpliting = appCodeSpliting;
81
98
  exports.appPlatform = appPlatform;
99
+ exports.appX = appX;
100
+ exports.appXCacheDir = appXCacheDir;
101
+ exports.appXPageCount = appXPageCount;
102
+ exports.appXSetup = appXSetup;
103
+ exports.appXSingleThread = appXSingleThread;
104
+ exports.appXTsc = appXTsc;
105
+ exports.appXUVueScriptEngine = appXUVueScriptEngine;
106
+ exports.automatorAppWebview = automatorAppWebview;
107
+ exports.automatorAppWebviewSrc = automatorAppWebviewSrc;
108
+ exports.automatorWsEndpoint = automatorWsEndpoint;
82
109
  exports.builtInPlatforms = builtInPlatforms;
83
110
  exports.cliContext = cliContext;
84
111
  exports.compiler = compiler;
@@ -87,12 +114,21 @@ exports.compilerVersionType = compilerVersionType;
87
114
  exports.customContext = customContext;
88
115
  exports.customDefine = customDefine;
89
116
  exports.customScript = customScript;
117
+ exports.darkMode = darkMode;
118
+ exports.h5Base = h5Base;
119
+ exports.h5Browser = h5Browser;
90
120
  exports.hasDarkMode = hasDarkMode;
91
121
  exports.hasSourcemap = hasSourcemap;
122
+ exports.hbuilderxPlugins = hbuilderxPlugins;
123
+ exports.hxDependenciesDir = hxDependenciesDir;
124
+ exports.hxUseBaseType = hxUseBaseType;
125
+ exports.hxVersion = hxVersion;
92
126
  exports.inputDir = inputDir;
93
127
  exports.isApp = isApp;
94
128
  exports.isAppAndroid = isAppAndroid;
95
129
  exports.isAppIOS = isAppIOS;
130
+ exports.isAppPlus = isAppPlus;
131
+ exports.isAppX = isAppX;
96
132
  exports.isH5 = isH5;
97
133
  exports.isMinimize = isMinimize;
98
134
  exports.isMp = isMp;
@@ -108,13 +144,27 @@ exports.isQuickappHuawei = isQuickappHuawei;
108
144
  exports.isQuickappUnion = isQuickappUnion;
109
145
  exports.isSSRClient = isSSRClient;
110
146
  exports.isSSRServer = isSSRServer;
147
+ exports.isUVue = isUVue;
148
+ exports.isWeb = isWeb;
149
+ exports.minimize = minimize;
150
+ exports.mpPlugin = mpPlugin;
151
+ exports.nvueAppStyles = nvueAppStyles;
111
152
  exports.nvueCompiler = nvueCompiler;
112
153
  exports.nvueStyleCompiler = nvueStyleCompiler;
113
154
  exports.outputDir = outputDir;
114
155
  exports.platform = platform;
115
156
  exports.renderer = renderer;
116
157
  exports.rendererNative = rendererNative;
158
+ exports.sourcemap = sourcemap;
159
+ exports.ssrClient = ssrClient;
160
+ exports.ssrServer = ssrServer;
117
161
  exports.statTitleJson = statTitleJson;
118
162
  exports.subPlatform = subPlatform;
119
163
  exports.subpackage = subpackage;
164
+ exports.utsJsCodeFormat = utsJsCodeFormat;
165
+ exports.utsModulePrefix = utsModulePrefix;
166
+ exports.utsModuleType = utsModuleType;
120
167
  exports.utsPlatform = utsPlatform;
168
+ exports.utsTargetLanguage = utsTargetLanguage;
169
+ exports.uvue = uvue;
170
+ exports.uvueTargetLanguage = uvueTargetLanguage;