@weapp-tailwindcss/env 0.2.0 → 0.2.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/README.md CHANGED
@@ -36,6 +36,8 @@ An explicit `env` object is an isolated snapshot: missing fields never inherit p
36
36
 
37
37
  `resolvePlatformIdentity(platform, appType?)` preserves the raw input, trims and lowercases `normalized`, and provides a known `canonical` identity. Taro `weapp`, MPX `wx` and uni-app `mp-weixin` resolve to `mp-weixin`; `h5` and `web` resolve to `web`. MPX-specific `ali` and `dd` resolve only when `appType` is `mpx`.
38
38
 
39
+ Taro's `harmony-hybrid` is a WebView target: its Taro platform resolvers set `isWeb` to `true`, and its canonical identity is `web` when `appType` is `taro`. This alias does not apply to native `harmony` or to other frameworks.
40
+
39
41
  The canonical identities are `mp-weixin`, `mp-alipay`, `mp-baidu`, `mp-qq`, `mp-toutiao`, `mp-jd`, `mp-dingtalk`, `web`, `app`, `app-plus`, `app-android`, `app-ios` and `app-harmony`. Unknown or empty input has an `undefined` canonical identity. `app` and `app-plus` remain distinct. The existing platform resolvers retain their return shape, including `raw`, `normalized` and classification flags; a canonical identity does not select a compiler target or declare host support.
40
42
 
41
43
  ## Detection reports
package/README.zh-CN.md CHANGED
@@ -36,6 +36,8 @@ const mpxPlatform = resolveMpxPlatformFromEnv({ MPX_CLI_MODE: 'wx' })
36
36
 
37
37
  `resolvePlatformIdentity(platform, appType?)` 保留原始输入,将去除首尾空格并转为小写的值放在 `normalized`,通过 `canonical` 提供已知平台的统一身份。Taro 的 `weapp`、MPX 的 `wx` 和 uni-app 的 `mp-weixin` 都得到 `mp-weixin`;`h5` 与 `web` 都得到 `web`。MPX 专用的 `ali`、`dd` 仅在 `appType` 为 `mpx` 时映射。
38
38
 
39
+ Taro 的 `harmony-hybrid` 使用 WebView:Taro 平台函数将其 `isWeb` 标记为 `true`,`appType` 为 `taro` 时的统一身份为 `web`。该别名不适用于原生 `harmony` 或其他框架。
40
+
39
41
  统一身份包括 `mp-weixin`、`mp-alipay`、`mp-baidu`、`mp-qq`、`mp-toutiao`、`mp-jd`、`mp-dingtalk`、`web`、`app`、`app-plus`、`app-android`、`app-ios`、`app-harmony`。未知或空输入的 `canonical` 为 `undefined`,`app` 与 `app-plus` 保持区别。既有平台函数保持原有的 `raw`、`normalized` 和分类标记返回形状;统一身份不负责选择编译 target 或声明宿主支持范围。
40
42
 
41
43
  ## 检测报告
package/dist/index.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- //#region \0rolldown/runtime.js
2
+ // \0rolldown/runtime.js
3
3
  var __create = Object.create;
4
4
  var __defProp = Object.defineProperty;
5
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -20,13 +20,12 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
20
20
  value: mod,
21
21
  enumerable: true
22
22
  }) : target, mod));
23
- //#endregion
24
23
  let node_process = require("node:process");
25
24
  node_process = __toESM(node_process, 1);
26
25
  let node_path = require("node:path");
27
26
  node_path = __toESM(node_path, 1);
28
27
  let node_fs = require("node:fs");
29
- //#region src/environment.ts
28
+ // src/environment.ts
30
29
  function getProcessEnv() {
31
30
  return {
32
31
  MPX_CLI_MODE: node_process.default.env["MPX_CLI_MODE"],
@@ -39,8 +38,7 @@ function getProcessEnv() {
39
38
  WEAPP_TW_TARGET: node_process.default.env["WEAPP_TW_TARGET"]
40
39
  };
41
40
  }
42
- //#endregion
43
- //#region src/hbuilderx.ts
41
+ // src/hbuilderx.ts
44
42
  const KNOWN_MAC_HBUILDERX_PLUGIN_DIRS = ["/Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli-vite", "/Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli"];
45
43
  const HBUILDERX_PLUGIN_CWD_RE = /[\\/]HBuilderX(?:\.[^\\/]*)?(?:[\\/]Contents[\\/]HBuilderX)?[\\/]plugins[\\/]uniapp-cli(?:-vite)?(?:[\\/]|$)/i;
46
44
  function hasKnownHBuilderXPluginPrefix(normalizedCwd) {
@@ -61,8 +59,7 @@ function isRunningInHBuilderX(options = {}) {
61
59
  if (!(nodePath == null || nodePath.trim().length === 0)) return false;
62
60
  return matchesHBuilderXPluginCwd(options.cwd ?? node_process.default.cwd());
63
61
  }
64
- //#endregion
65
- //#region src/matching.ts
62
+ // src/matching.ts
66
63
  function evidence(source, key, value, file) {
67
64
  return {
68
65
  source,
@@ -98,8 +95,7 @@ function detectionReport(candidates) {
98
95
  conflicts: appType === void 0 ? [] : unique.filter((candidate) => family(candidate.appType) !== family(appType)).map((candidate) => candidate.appType)
99
96
  };
100
97
  }
101
- //#endregion
102
- //#region src/platform.ts
98
+ // src/platform.ts
103
99
  const MPX_TO_UNI_PLATFORM = /* @__PURE__ */ new Map([
104
100
  ["ali", "mp-alipay"],
105
101
  ["dd", "mp-dingtalk"],
@@ -109,6 +105,7 @@ const MPX_TO_UNI_PLATFORM = /* @__PURE__ */ new Map([
109
105
  ["tt", "mp-toutiao"],
110
106
  ["wx", "mp-weixin"]
111
107
  ]);
108
+ const TARO_TO_CANONICAL_PLATFORM = /* @__PURE__ */ new Map([["harmony-hybrid", "web"]]);
112
109
  const MINI_PROGRAM_PLATFORMS = new Map([
113
110
  ...[...MPX_TO_UNI_PLATFORM].filter(([alias]) => alias !== "ali" && alias !== "dd"),
114
111
  ["alipay", "mp-alipay"],
@@ -142,18 +139,18 @@ function resolvePlatformInfo(value, appType) {
142
139
  isAppHarmony,
143
140
  isAppIos,
144
141
  isMp: normalized?.startsWith("mp-") === true || (normalized ? MINI_PROGRAM_PLATFORMS.has(normalized) || appType === "mpx" && MPX_TO_UNI_PLATFORM.has(normalized) : false),
145
- isWeb: normalized?.startsWith("web") === true || normalized === "h5"
142
+ isWeb: normalized?.startsWith("web") === true || normalized === "h5" || appType === "taro" && normalized !== void 0 && TARO_TO_CANONICAL_PLATFORM.get(normalized) === "web"
146
143
  };
147
144
  }
148
145
  function resolvePlatform(value) {
149
146
  return resolvePlatformInfo(value);
150
147
  }
151
148
  function resolveTaroPlatform(value = getProcessEnv().TARO_ENV) {
152
- return resolvePlatform(value);
149
+ return resolvePlatformInfo(value, "taro");
153
150
  }
154
151
  /** 读取 Taro 环境快照;省略快照时才使用调用时的进程环境。 */
155
152
  function resolveTaroPlatformFromEnv(env = getProcessEnv()) {
156
- return resolvePlatform(env.TARO_ENV);
153
+ return resolvePlatformInfo(env.TARO_ENV, "taro");
157
154
  }
158
155
  function resolveMpxPlatformValue(env = getProcessEnv()) {
159
156
  return env.MPX_CURRENT_TARGET_MODE ?? env.MPX_CLI_MODE;
@@ -192,11 +189,10 @@ function resolvePlatformIdentity(platform, appType) {
192
189
  return {
193
190
  raw: platform,
194
191
  normalized,
195
- canonical: normalized ? (appType === "mpx" ? MPX_TO_UNI_PLATFORM.get(normalized) : void 0) ?? MINI_PROGRAM_PLATFORMS.get(normalized) ?? CANONICAL_PLATFORMS.get(normalized) : void 0
192
+ canonical: normalized ? (appType === "mpx" ? MPX_TO_UNI_PLATFORM.get(normalized) : void 0) ?? (appType === "taro" ? TARO_TO_CANONICAL_PLATFORM.get(normalized) : void 0) ?? MINI_PROGRAM_PLATFORMS.get(normalized) ?? CANONICAL_PLATFORMS.get(normalized) : void 0
196
193
  };
197
194
  }
198
- //#endregion
199
- //#region src/detect-env.ts
195
+ // src/detect-env.ts
200
196
  function* matchEnvironment(env, options = {}) {
201
197
  for (const key of ["WEAPP_TW_TARGET", "WEAPP_TAILWINDCSS_TARGET"]) {
202
198
  const value = env[key];
@@ -237,8 +233,7 @@ function* matchEnvironment(env, options = {}) {
237
233
  function detectAppTypeFromEnv(env = getProcessEnv(), options = {}) {
238
234
  return collectMatches(matchEnvironment(env, options), false)[0]?.appType;
239
235
  }
240
- //#endregion
241
- //#region src/script-command.ts
236
+ // src/script-command.ts
242
237
  const ASSIGNMENT_RE = /^[A-Z_]\w*=/iu;
243
238
  const COMMAND_TYPES = /* @__PURE__ */ new Map([
244
239
  ["mpx", "mpx"],
@@ -441,8 +436,7 @@ function detectFrameworkCommands(script) {
441
436
  collectCommands(script, detected);
442
437
  return [...detected];
443
438
  }
444
- //#endregion
445
- //#region src/package.ts
439
+ // src/package.ts
446
440
  const FRAMEWORK_PRIORITY = [
447
441
  "weapp-vite",
448
442
  "mpx",
@@ -529,8 +523,7 @@ function isUniAppXManifest(manifest) {
529
523
  function detectAppTypeFromPackageJson(pkg) {
530
524
  return collectMatches(matchPackageJson(pkg, false), false)[0]?.appType;
531
525
  }
532
- //#endregion
533
- //#region src/manifest.ts
526
+ // src/manifest.ts
534
527
  /** 仅移除字符串外的注释,其余语法仍交给严格 JSON 解析。 */
535
528
  function parseManifestJson(source) {
536
529
  const characters = source.split("");
@@ -569,8 +562,7 @@ function parseManifestJson(source) {
569
562
  }
570
563
  return JSON.parse(characters.join(""));
571
564
  }
572
- //#endregion
573
- //#region src/project.ts
565
+ // src/project.ts
574
566
  const PACKAGE_JSON_FILE = "package.json";
575
567
  const MANIFEST_JSON_FILE = "manifest.json";
576
568
  const MPX_MARKERS = [["src", "app.mpx"], ["app.mpx"]];
@@ -644,7 +636,6 @@ function detectAppType(options = {}) {
644
636
  function detectAppTypeReport(options = {}) {
645
637
  return detectionReport(matchAppType(options, true));
646
638
  }
647
- //#endregion
648
639
  exports.detectAppType = detectAppType;
649
640
  exports.detectAppTypeFromEnv = detectAppTypeFromEnv;
650
641
  exports.detectAppTypeFromPackageJson = detectAppTypeFromPackageJson;
package/dist/index.d.cts CHANGED
@@ -1,4 +1,3 @@
1
- //#region src/types.d.ts
2
1
  type DetectableAppType = 'mpx' | 'taro' | 'uni-app' | 'uni-app-vite' | 'uni-app-x' | 'weapp-vite';
3
2
  type FrameworkEnv = Record<string, string | undefined> & Partial<Record<'MPX_CLI_MODE' | 'MPX_CURRENT_TARGET_MODE' | 'NODE_PATH' | 'TARO_ENV' | 'UNI_PLATFORM' | 'UNI_UTS_PLATFORM' | 'WEAPP_TAILWINDCSS_TARGET' | 'WEAPP_TW_TARGET', string | undefined>>;
4
3
  interface UniPlatformInfo {
@@ -92,18 +91,12 @@ interface AppTypeDetectionReport {
92
91
  candidates: AppTypeDetectionCandidate[];
93
92
  conflicts: DetectableAppType[];
94
93
  }
95
- //#endregion
96
- //#region src/detect-env.d.ts
97
94
  interface EnvironmentDetectionOptions {
98
95
  cwd?: string | undefined;
99
96
  hbuilderxVite?: boolean | undefined;
100
97
  }
101
98
  export declare function detectAppTypeFromEnv(env?: FrameworkEnv, options?: EnvironmentDetectionOptions): DetectableAppType | undefined;
102
- //#endregion
103
- //#region src/hbuilderx.d.ts
104
99
  export declare function isRunningInHBuilderX(options?: HBuilderXRuntimeHints): boolean;
105
- //#endregion
106
- //#region src/package.d.ts
107
100
  export declare function isWeappVitePackage(pkg: PackageJsonLike): boolean;
108
101
  export declare function isMpxPackage(pkg: PackageJsonLike): boolean;
109
102
  export declare function isTaroPackage(pkg: PackageJsonLike): boolean;
@@ -112,8 +105,6 @@ export declare function isUniAppXPackage(pkg: PackageJsonLike): boolean;
112
105
  export declare function isUniAppPackage(pkg: PackageJsonLike): boolean;
113
106
  export declare function isUniAppXManifest(manifest: UniAppManifestLike | undefined): boolean;
114
107
  export declare function detectAppTypeFromPackageJson(pkg: PackageJsonLike): DetectableAppType | undefined;
115
- //#endregion
116
- //#region src/platform.d.ts
117
108
  export declare function resolvePlatform(value: string | undefined): UniPlatformInfo;
118
109
  export declare function resolveTaroPlatform(value?: string | undefined): UniPlatformInfo;
119
110
  /** 读取 Taro 环境快照;省略快照时才使用调用时的进程环境。 */
@@ -131,10 +122,7 @@ export declare function resolveUniPlatformsFromEnv(env?: FrameworkEnv): {
131
122
  };
132
123
  export declare function normalizeFrameworkStylePlatform(platform: string | undefined, appType: string | undefined): string | undefined;
133
124
  export declare function resolvePlatformIdentity(platform: string | undefined, appType?: DetectableAppType): PlatformIdentityInfo;
134
- //#endregion
135
- //#region src/project.d.ts
136
125
  export declare function detectAppType(options?: DetectAppTypeOptions): DetectableAppType | undefined;
137
126
  /** 解释首次命中阶段的框架候选与冲突,不扩大项目搜索范围。 */
138
127
  export declare function detectAppTypeReport(options?: DetectAppTypeOptions): AppTypeDetectionReport;
139
- //#endregion
140
128
  export type { AppTypeDetectionCandidate, AppTypeDetectionEvidence, AppTypeDetectionReport, CanonicalPlatform, DetectAppTypeOptions, DetectableAppType, FrameworkEnv, HBuilderXRuntimeHints, PackageJsonLike, PlatformIdentityInfo, UniAppManifestLike, UniPlatformInfo };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- //#region src/types.d.ts
2
1
  type DetectableAppType = 'mpx' | 'taro' | 'uni-app' | 'uni-app-vite' | 'uni-app-x' | 'weapp-vite';
3
2
  type FrameworkEnv = Record<string, string | undefined> & Partial<Record<'MPX_CLI_MODE' | 'MPX_CURRENT_TARGET_MODE' | 'NODE_PATH' | 'TARO_ENV' | 'UNI_PLATFORM' | 'UNI_UTS_PLATFORM' | 'WEAPP_TAILWINDCSS_TARGET' | 'WEAPP_TW_TARGET', string | undefined>>;
4
3
  interface UniPlatformInfo {
@@ -92,18 +91,12 @@ interface AppTypeDetectionReport {
92
91
  candidates: AppTypeDetectionCandidate[];
93
92
  conflicts: DetectableAppType[];
94
93
  }
95
- //#endregion
96
- //#region src/detect-env.d.ts
97
94
  interface EnvironmentDetectionOptions {
98
95
  cwd?: string | undefined;
99
96
  hbuilderxVite?: boolean | undefined;
100
97
  }
101
98
  export declare function detectAppTypeFromEnv(env?: FrameworkEnv, options?: EnvironmentDetectionOptions): DetectableAppType | undefined;
102
- //#endregion
103
- //#region src/hbuilderx.d.ts
104
99
  export declare function isRunningInHBuilderX(options?: HBuilderXRuntimeHints): boolean;
105
- //#endregion
106
- //#region src/package.d.ts
107
100
  export declare function isWeappVitePackage(pkg: PackageJsonLike): boolean;
108
101
  export declare function isMpxPackage(pkg: PackageJsonLike): boolean;
109
102
  export declare function isTaroPackage(pkg: PackageJsonLike): boolean;
@@ -112,8 +105,6 @@ export declare function isUniAppXPackage(pkg: PackageJsonLike): boolean;
112
105
  export declare function isUniAppPackage(pkg: PackageJsonLike): boolean;
113
106
  export declare function isUniAppXManifest(manifest: UniAppManifestLike | undefined): boolean;
114
107
  export declare function detectAppTypeFromPackageJson(pkg: PackageJsonLike): DetectableAppType | undefined;
115
- //#endregion
116
- //#region src/platform.d.ts
117
108
  export declare function resolvePlatform(value: string | undefined): UniPlatformInfo;
118
109
  export declare function resolveTaroPlatform(value?: string | undefined): UniPlatformInfo;
119
110
  /** 读取 Taro 环境快照;省略快照时才使用调用时的进程环境。 */
@@ -131,10 +122,7 @@ export declare function resolveUniPlatformsFromEnv(env?: FrameworkEnv): {
131
122
  };
132
123
  export declare function normalizeFrameworkStylePlatform(platform: string | undefined, appType: string | undefined): string | undefined;
133
124
  export declare function resolvePlatformIdentity(platform: string | undefined, appType?: DetectableAppType): PlatformIdentityInfo;
134
- //#endregion
135
- //#region src/project.d.ts
136
125
  export declare function detectAppType(options?: DetectAppTypeOptions): DetectableAppType | undefined;
137
126
  /** 解释首次命中阶段的框架候选与冲突,不扩大项目搜索范围。 */
138
127
  export declare function detectAppTypeReport(options?: DetectAppTypeOptions): AppTypeDetectionReport;
139
- //#endregion
140
128
  export type { AppTypeDetectionCandidate, AppTypeDetectionEvidence, AppTypeDetectionReport, CanonicalPlatform, DetectAppTypeOptions, DetectableAppType, FrameworkEnv, HBuilderXRuntimeHints, PackageJsonLike, PlatformIdentityInfo, UniAppManifestLike, UniPlatformInfo };
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import process from "node:process";
2
2
  import path from "node:path";
3
3
  import { existsSync, readFileSync } from "node:fs";
4
- //#region src/environment.ts
4
+ // src/environment.ts
5
5
  function getProcessEnv() {
6
6
  return {
7
7
  MPX_CLI_MODE: process.env["MPX_CLI_MODE"],
@@ -14,8 +14,7 @@ function getProcessEnv() {
14
14
  WEAPP_TW_TARGET: process.env["WEAPP_TW_TARGET"]
15
15
  };
16
16
  }
17
- //#endregion
18
- //#region src/hbuilderx.ts
17
+ // src/hbuilderx.ts
19
18
  const KNOWN_MAC_HBUILDERX_PLUGIN_DIRS = ["/Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli-vite", "/Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli"];
20
19
  const HBUILDERX_PLUGIN_CWD_RE = /[\\/]HBuilderX(?:\.[^\\/]*)?(?:[\\/]Contents[\\/]HBuilderX)?[\\/]plugins[\\/]uniapp-cli(?:-vite)?(?:[\\/]|$)/i;
21
20
  function hasKnownHBuilderXPluginPrefix(normalizedCwd) {
@@ -36,8 +35,7 @@ function isRunningInHBuilderX(options = {}) {
36
35
  if (!(nodePath == null || nodePath.trim().length === 0)) return false;
37
36
  return matchesHBuilderXPluginCwd(options.cwd ?? process.cwd());
38
37
  }
39
- //#endregion
40
- //#region src/matching.ts
38
+ // src/matching.ts
41
39
  function evidence(source, key, value, file) {
42
40
  return {
43
41
  source,
@@ -73,8 +71,7 @@ function detectionReport(candidates) {
73
71
  conflicts: appType === void 0 ? [] : unique.filter((candidate) => family(candidate.appType) !== family(appType)).map((candidate) => candidate.appType)
74
72
  };
75
73
  }
76
- //#endregion
77
- //#region src/platform.ts
74
+ // src/platform.ts
78
75
  const MPX_TO_UNI_PLATFORM = /* @__PURE__ */ new Map([
79
76
  ["ali", "mp-alipay"],
80
77
  ["dd", "mp-dingtalk"],
@@ -84,6 +81,7 @@ const MPX_TO_UNI_PLATFORM = /* @__PURE__ */ new Map([
84
81
  ["tt", "mp-toutiao"],
85
82
  ["wx", "mp-weixin"]
86
83
  ]);
84
+ const TARO_TO_CANONICAL_PLATFORM = /* @__PURE__ */ new Map([["harmony-hybrid", "web"]]);
87
85
  const MINI_PROGRAM_PLATFORMS = new Map([
88
86
  ...[...MPX_TO_UNI_PLATFORM].filter(([alias]) => alias !== "ali" && alias !== "dd"),
89
87
  ["alipay", "mp-alipay"],
@@ -117,18 +115,18 @@ function resolvePlatformInfo(value, appType) {
117
115
  isAppHarmony,
118
116
  isAppIos,
119
117
  isMp: normalized?.startsWith("mp-") === true || (normalized ? MINI_PROGRAM_PLATFORMS.has(normalized) || appType === "mpx" && MPX_TO_UNI_PLATFORM.has(normalized) : false),
120
- isWeb: normalized?.startsWith("web") === true || normalized === "h5"
118
+ isWeb: normalized?.startsWith("web") === true || normalized === "h5" || appType === "taro" && normalized !== void 0 && TARO_TO_CANONICAL_PLATFORM.get(normalized) === "web"
121
119
  };
122
120
  }
123
121
  function resolvePlatform(value) {
124
122
  return resolvePlatformInfo(value);
125
123
  }
126
124
  function resolveTaroPlatform(value = getProcessEnv().TARO_ENV) {
127
- return resolvePlatform(value);
125
+ return resolvePlatformInfo(value, "taro");
128
126
  }
129
127
  /** 读取 Taro 环境快照;省略快照时才使用调用时的进程环境。 */
130
128
  function resolveTaroPlatformFromEnv(env = getProcessEnv()) {
131
- return resolvePlatform(env.TARO_ENV);
129
+ return resolvePlatformInfo(env.TARO_ENV, "taro");
132
130
  }
133
131
  function resolveMpxPlatformValue(env = getProcessEnv()) {
134
132
  return env.MPX_CURRENT_TARGET_MODE ?? env.MPX_CLI_MODE;
@@ -167,11 +165,10 @@ function resolvePlatformIdentity(platform, appType) {
167
165
  return {
168
166
  raw: platform,
169
167
  normalized,
170
- canonical: normalized ? (appType === "mpx" ? MPX_TO_UNI_PLATFORM.get(normalized) : void 0) ?? MINI_PROGRAM_PLATFORMS.get(normalized) ?? CANONICAL_PLATFORMS.get(normalized) : void 0
168
+ canonical: normalized ? (appType === "mpx" ? MPX_TO_UNI_PLATFORM.get(normalized) : void 0) ?? (appType === "taro" ? TARO_TO_CANONICAL_PLATFORM.get(normalized) : void 0) ?? MINI_PROGRAM_PLATFORMS.get(normalized) ?? CANONICAL_PLATFORMS.get(normalized) : void 0
171
169
  };
172
170
  }
173
- //#endregion
174
- //#region src/detect-env.ts
171
+ // src/detect-env.ts
175
172
  function* matchEnvironment(env, options = {}) {
176
173
  for (const key of ["WEAPP_TW_TARGET", "WEAPP_TAILWINDCSS_TARGET"]) {
177
174
  const value = env[key];
@@ -212,8 +209,7 @@ function* matchEnvironment(env, options = {}) {
212
209
  function detectAppTypeFromEnv(env = getProcessEnv(), options = {}) {
213
210
  return collectMatches(matchEnvironment(env, options), false)[0]?.appType;
214
211
  }
215
- //#endregion
216
- //#region src/script-command.ts
212
+ // src/script-command.ts
217
213
  const ASSIGNMENT_RE = /^[A-Z_]\w*=/iu;
218
214
  const COMMAND_TYPES = /* @__PURE__ */ new Map([
219
215
  ["mpx", "mpx"],
@@ -416,8 +412,7 @@ function detectFrameworkCommands(script) {
416
412
  collectCommands(script, detected);
417
413
  return [...detected];
418
414
  }
419
- //#endregion
420
- //#region src/package.ts
415
+ // src/package.ts
421
416
  const FRAMEWORK_PRIORITY = [
422
417
  "weapp-vite",
423
418
  "mpx",
@@ -504,8 +499,7 @@ function isUniAppXManifest(manifest) {
504
499
  function detectAppTypeFromPackageJson(pkg) {
505
500
  return collectMatches(matchPackageJson(pkg, false), false)[0]?.appType;
506
501
  }
507
- //#endregion
508
- //#region src/manifest.ts
502
+ // src/manifest.ts
509
503
  /** 仅移除字符串外的注释,其余语法仍交给严格 JSON 解析。 */
510
504
  function parseManifestJson(source) {
511
505
  const characters = source.split("");
@@ -544,8 +538,7 @@ function parseManifestJson(source) {
544
538
  }
545
539
  return JSON.parse(characters.join(""));
546
540
  }
547
- //#endregion
548
- //#region src/project.ts
541
+ // src/project.ts
549
542
  const PACKAGE_JSON_FILE = "package.json";
550
543
  const MANIFEST_JSON_FILE = "manifest.json";
551
544
  const MPX_MARKERS = [["src", "app.mpx"], ["app.mpx"]];
@@ -619,5 +612,4 @@ function detectAppType(options = {}) {
619
612
  function detectAppTypeReport(options = {}) {
620
613
  return detectionReport(matchAppType(options, true));
621
614
  }
622
- //#endregion
623
615
  export { detectAppType, detectAppTypeFromEnv, detectAppTypeFromPackageJson, detectAppTypeReport, isMpxPackage, isRunningInHBuilderX, isTaroPackage, isUniAppPackage, isUniAppVitePackage, isUniAppXManifest, isUniAppXPackage, isWeappVitePackage, normalizeFrameworkStylePlatform, resolveMpxPlatform, resolveMpxPlatformFromEnv, resolvePlatform, resolvePlatformIdentity, resolveTaroPlatform, resolveTaroPlatformFromEnv, resolveUniAppXPlatform, resolveUniPlatform, resolveUniPlatformsFromEnv, resolveUniUtsPlatform };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@weapp-tailwindcss/env",
3
3
  "type": "module",
4
- "version": "0.2.0",
4
+ "version": "0.2.1",
5
5
  "description": "构建期的环境、框架与平台识别工具。",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",