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