@weapp-tailwindcss/env 0.1.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 +30 -6
- package/README.zh-CN.md +30 -6
- package/dist/index.cjs +488 -101
- package/dist/index.d.cts +35 -15
- package/dist/index.d.ts +35 -15
- package/dist/index.js +484 -100
- package/package.json +1 -1
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 {
|
|
@@ -11,6 +10,12 @@ interface UniPlatformInfo {
|
|
|
11
10
|
isMp: boolean;
|
|
12
11
|
isWeb: boolean;
|
|
13
12
|
}
|
|
13
|
+
type CanonicalPlatform = 'mp-weixin' | 'mp-alipay' | 'mp-baidu' | 'mp-jd' | 'mp-qq' | 'mp-toutiao' | 'mp-dingtalk' | 'web' | 'app' | 'app-plus' | 'app-android' | 'app-ios' | 'app-harmony';
|
|
14
|
+
interface PlatformIdentityInfo {
|
|
15
|
+
raw: string | undefined;
|
|
16
|
+
normalized: string | undefined;
|
|
17
|
+
canonical: CanonicalPlatform | undefined;
|
|
18
|
+
}
|
|
14
19
|
interface HBuilderXRuntimeHints {
|
|
15
20
|
cwd?: string | undefined;
|
|
16
21
|
env?: FrameworkEnv | undefined;
|
|
@@ -68,17 +73,30 @@ interface DetectAppTypeOptions {
|
|
|
68
73
|
*/
|
|
69
74
|
hbuilderxVite?: boolean | undefined;
|
|
70
75
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
76
|
+
/** 框架识别实际命中的配置、文件或环境信号。 */
|
|
77
|
+
interface AppTypeDetectionEvidence {
|
|
78
|
+
source: 'manifest' | 'dependency' | 'script' | 'package-field' | 'marker' | 'env' | 'hbuilderx';
|
|
79
|
+
key: string;
|
|
80
|
+
path?: string | undefined;
|
|
81
|
+
value?: string | undefined;
|
|
82
|
+
}
|
|
83
|
+
/** 同一框架在首次命中阶段的全部证据。 */
|
|
84
|
+
interface AppTypeDetectionCandidate {
|
|
85
|
+
appType: DetectableAppType;
|
|
86
|
+
evidence: AppTypeDetectionEvidence[];
|
|
87
|
+
}
|
|
88
|
+
/** 当前识别决定的解释;不扫描被优先阶段遮蔽的项目。 */
|
|
89
|
+
interface AppTypeDetectionReport {
|
|
90
|
+
appType: DetectableAppType | undefined;
|
|
91
|
+
candidates: AppTypeDetectionCandidate[];
|
|
92
|
+
conflicts: DetectableAppType[];
|
|
93
|
+
}
|
|
94
|
+
interface EnvironmentDetectionOptions {
|
|
74
95
|
cwd?: string | undefined;
|
|
75
96
|
hbuilderxVite?: boolean | undefined;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
//#region src/hbuilderx.d.ts
|
|
97
|
+
}
|
|
98
|
+
export declare function detectAppTypeFromEnv(env?: FrameworkEnv, options?: EnvironmentDetectionOptions): DetectableAppType | undefined;
|
|
79
99
|
export declare function isRunningInHBuilderX(options?: HBuilderXRuntimeHints): boolean;
|
|
80
|
-
//#endregion
|
|
81
|
-
//#region src/package.d.ts
|
|
82
100
|
export declare function isWeappVitePackage(pkg: PackageJsonLike): boolean;
|
|
83
101
|
export declare function isMpxPackage(pkg: PackageJsonLike): boolean;
|
|
84
102
|
export declare function isTaroPackage(pkg: PackageJsonLike): boolean;
|
|
@@ -87,11 +105,13 @@ export declare function isUniAppXPackage(pkg: PackageJsonLike): boolean;
|
|
|
87
105
|
export declare function isUniAppPackage(pkg: PackageJsonLike): boolean;
|
|
88
106
|
export declare function isUniAppXManifest(manifest: UniAppManifestLike | undefined): boolean;
|
|
89
107
|
export declare function detectAppTypeFromPackageJson(pkg: PackageJsonLike): DetectableAppType | undefined;
|
|
90
|
-
//#endregion
|
|
91
|
-
//#region src/platform.d.ts
|
|
92
108
|
export declare function resolvePlatform(value: string | undefined): UniPlatformInfo;
|
|
93
109
|
export declare function resolveTaroPlatform(value?: string | undefined): UniPlatformInfo;
|
|
110
|
+
/** 读取 Taro 环境快照;省略快照时才使用调用时的进程环境。 */
|
|
111
|
+
export declare function resolveTaroPlatformFromEnv(env?: FrameworkEnv): UniPlatformInfo;
|
|
94
112
|
export declare function resolveMpxPlatform(value?: string | undefined): UniPlatformInfo;
|
|
113
|
+
/** 读取 MPX 环境快照,保留 current mode 的空字符串优先级。 */
|
|
114
|
+
export declare function resolveMpxPlatformFromEnv(env?: FrameworkEnv): UniPlatformInfo;
|
|
95
115
|
export declare function resolveUniPlatform(value?: string | undefined): UniPlatformInfo;
|
|
96
116
|
export declare function resolveUniUtsPlatform(value?: string | undefined): UniPlatformInfo;
|
|
97
117
|
export declare function resolveUniAppXPlatform(value?: string | undefined): UniPlatformInfo;
|
|
@@ -101,8 +121,8 @@ export declare function resolveUniPlatformsFromEnv(env?: FrameworkEnv): {
|
|
|
101
121
|
uniUtsPlatform: UniPlatformInfo;
|
|
102
122
|
};
|
|
103
123
|
export declare function normalizeFrameworkStylePlatform(platform: string | undefined, appType: string | undefined): string | undefined;
|
|
104
|
-
|
|
105
|
-
//#region src/project.d.ts
|
|
124
|
+
export declare function resolvePlatformIdentity(platform: string | undefined, appType?: DetectableAppType): PlatformIdentityInfo;
|
|
106
125
|
export declare function detectAppType(options?: DetectAppTypeOptions): DetectableAppType | undefined;
|
|
107
|
-
|
|
108
|
-
export
|
|
126
|
+
/** 解释首次命中阶段的框架候选与冲突,不扩大项目搜索范围。 */
|
|
127
|
+
export declare function detectAppTypeReport(options?: DetectAppTypeOptions): AppTypeDetectionReport;
|
|
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 {
|
|
@@ -11,6 +10,12 @@ interface UniPlatformInfo {
|
|
|
11
10
|
isMp: boolean;
|
|
12
11
|
isWeb: boolean;
|
|
13
12
|
}
|
|
13
|
+
type CanonicalPlatform = 'mp-weixin' | 'mp-alipay' | 'mp-baidu' | 'mp-jd' | 'mp-qq' | 'mp-toutiao' | 'mp-dingtalk' | 'web' | 'app' | 'app-plus' | 'app-android' | 'app-ios' | 'app-harmony';
|
|
14
|
+
interface PlatformIdentityInfo {
|
|
15
|
+
raw: string | undefined;
|
|
16
|
+
normalized: string | undefined;
|
|
17
|
+
canonical: CanonicalPlatform | undefined;
|
|
18
|
+
}
|
|
14
19
|
interface HBuilderXRuntimeHints {
|
|
15
20
|
cwd?: string | undefined;
|
|
16
21
|
env?: FrameworkEnv | undefined;
|
|
@@ -68,17 +73,30 @@ interface DetectAppTypeOptions {
|
|
|
68
73
|
*/
|
|
69
74
|
hbuilderxVite?: boolean | undefined;
|
|
70
75
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
76
|
+
/** 框架识别实际命中的配置、文件或环境信号。 */
|
|
77
|
+
interface AppTypeDetectionEvidence {
|
|
78
|
+
source: 'manifest' | 'dependency' | 'script' | 'package-field' | 'marker' | 'env' | 'hbuilderx';
|
|
79
|
+
key: string;
|
|
80
|
+
path?: string | undefined;
|
|
81
|
+
value?: string | undefined;
|
|
82
|
+
}
|
|
83
|
+
/** 同一框架在首次命中阶段的全部证据。 */
|
|
84
|
+
interface AppTypeDetectionCandidate {
|
|
85
|
+
appType: DetectableAppType;
|
|
86
|
+
evidence: AppTypeDetectionEvidence[];
|
|
87
|
+
}
|
|
88
|
+
/** 当前识别决定的解释;不扫描被优先阶段遮蔽的项目。 */
|
|
89
|
+
interface AppTypeDetectionReport {
|
|
90
|
+
appType: DetectableAppType | undefined;
|
|
91
|
+
candidates: AppTypeDetectionCandidate[];
|
|
92
|
+
conflicts: DetectableAppType[];
|
|
93
|
+
}
|
|
94
|
+
interface EnvironmentDetectionOptions {
|
|
74
95
|
cwd?: string | undefined;
|
|
75
96
|
hbuilderxVite?: boolean | undefined;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
//#region src/hbuilderx.d.ts
|
|
97
|
+
}
|
|
98
|
+
export declare function detectAppTypeFromEnv(env?: FrameworkEnv, options?: EnvironmentDetectionOptions): DetectableAppType | undefined;
|
|
79
99
|
export declare function isRunningInHBuilderX(options?: HBuilderXRuntimeHints): boolean;
|
|
80
|
-
//#endregion
|
|
81
|
-
//#region src/package.d.ts
|
|
82
100
|
export declare function isWeappVitePackage(pkg: PackageJsonLike): boolean;
|
|
83
101
|
export declare function isMpxPackage(pkg: PackageJsonLike): boolean;
|
|
84
102
|
export declare function isTaroPackage(pkg: PackageJsonLike): boolean;
|
|
@@ -87,11 +105,13 @@ export declare function isUniAppXPackage(pkg: PackageJsonLike): boolean;
|
|
|
87
105
|
export declare function isUniAppPackage(pkg: PackageJsonLike): boolean;
|
|
88
106
|
export declare function isUniAppXManifest(manifest: UniAppManifestLike | undefined): boolean;
|
|
89
107
|
export declare function detectAppTypeFromPackageJson(pkg: PackageJsonLike): DetectableAppType | undefined;
|
|
90
|
-
//#endregion
|
|
91
|
-
//#region src/platform.d.ts
|
|
92
108
|
export declare function resolvePlatform(value: string | undefined): UniPlatformInfo;
|
|
93
109
|
export declare function resolveTaroPlatform(value?: string | undefined): UniPlatformInfo;
|
|
110
|
+
/** 读取 Taro 环境快照;省略快照时才使用调用时的进程环境。 */
|
|
111
|
+
export declare function resolveTaroPlatformFromEnv(env?: FrameworkEnv): UniPlatformInfo;
|
|
94
112
|
export declare function resolveMpxPlatform(value?: string | undefined): UniPlatformInfo;
|
|
113
|
+
/** 读取 MPX 环境快照,保留 current mode 的空字符串优先级。 */
|
|
114
|
+
export declare function resolveMpxPlatformFromEnv(env?: FrameworkEnv): UniPlatformInfo;
|
|
95
115
|
export declare function resolveUniPlatform(value?: string | undefined): UniPlatformInfo;
|
|
96
116
|
export declare function resolveUniUtsPlatform(value?: string | undefined): UniPlatformInfo;
|
|
97
117
|
export declare function resolveUniAppXPlatform(value?: string | undefined): UniPlatformInfo;
|
|
@@ -101,8 +121,8 @@ export declare function resolveUniPlatformsFromEnv(env?: FrameworkEnv): {
|
|
|
101
121
|
uniUtsPlatform: UniPlatformInfo;
|
|
102
122
|
};
|
|
103
123
|
export declare function normalizeFrameworkStylePlatform(platform: string | undefined, appType: string | undefined): string | undefined;
|
|
104
|
-
|
|
105
|
-
//#region src/project.d.ts
|
|
124
|
+
export declare function resolvePlatformIdentity(platform: string | undefined, appType?: DetectableAppType): PlatformIdentityInfo;
|
|
106
125
|
export declare function detectAppType(options?: DetectAppTypeOptions): DetectableAppType | undefined;
|
|
107
|
-
|
|
108
|
-
export
|
|
126
|
+
/** 解释首次命中阶段的框架候选与冲突,不扩大项目搜索范围。 */
|
|
127
|
+
export declare function detectAppTypeReport(options?: DetectAppTypeOptions): AppTypeDetectionReport;
|
|
128
|
+
export type { AppTypeDetectionCandidate, AppTypeDetectionEvidence, AppTypeDetectionReport, CanonicalPlatform, DetectAppTypeOptions, DetectableAppType, FrameworkEnv, HBuilderXRuntimeHints, PackageJsonLike, PlatformIdentityInfo, UniAppManifestLike, UniPlatformInfo };
|