transone-cli 0.2.0 → 0.3.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/dist/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  // @bun
2
2
  import {
3
+ MP_TARGET_TYPES,
3
4
  MpTarget,
4
5
  PlaceholderTarget,
5
6
  TARGET_TYPES,
@@ -8,6 +9,7 @@ import {
8
9
  build,
9
10
  createProject,
10
11
  defineConfig,
12
+ isMpTargetType,
11
13
  isTargetType,
12
14
  mpAlipayTarget,
13
15
  mpBytedanceTarget,
@@ -15,9 +17,10 @@ import {
15
17
  resolveConfig,
16
18
  startDevServer,
17
19
  targetRegistry
18
- } from "./index-5bdznb52.js";
20
+ } from "./index-rjvspt2q.js";
19
21
  import"./index-yb2wsc7f.js";
20
22
  export {
23
+ MP_TARGET_TYPES,
21
24
  MpTarget,
22
25
  PlaceholderTarget,
23
26
  TARGET_TYPES,
@@ -26,6 +29,7 @@ export {
26
29
  build,
27
30
  createProject,
28
31
  defineConfig,
32
+ isMpTargetType,
29
33
  isTargetType,
30
34
  mpAlipayTarget,
31
35
  mpBytedanceTarget,
@@ -35,5 +39,5 @@ export {
35
39
  targetRegistry
36
40
  };
37
41
 
38
- //# debugId=B257A9D91B04A1AB64756E2164756E21
42
+ //# debugId=D783ECE5FAECBB3864756E2164756E21
39
43
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -4,6 +4,6 @@
4
4
  "sourcesContent": [
5
5
  ],
6
6
  "mappings": "",
7
- "debugId": "B257A9D91B04A1AB64756E2164756E21",
7
+ "debugId": "D783ECE5FAECBB3864756E2164756E21",
8
8
  "names": []
9
9
  }
@@ -13,6 +13,10 @@ import type { BuildOptions, BuildResult } from '../types';
13
13
  export declare const TARGET_TYPES: readonly ["web", "mp-weixin", "mp-alipay", "mp-bytedance", "app-ios", "app-android", "app-harmony"];
14
14
  export type TargetType = (typeof TARGET_TYPES)[number];
15
15
  export declare function isTargetType(value: unknown): value is TargetType;
16
+ /** 小程序目标端类型(mp-*),config.mp 按平台分组时使用。 */
17
+ export declare const MP_TARGET_TYPES: readonly ["mp-weixin", "mp-alipay", "mp-bytedance"];
18
+ export type MpTargetType = (typeof MP_TARGET_TYPES)[number];
19
+ export declare function isMpTargetType(value: unknown): value is MpTargetType;
16
20
  /**
17
21
  * 编译目标抽象:每个端一个实现,编译器按 Target 分发构建。
18
22
  *
package/dist/types.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import type { TargetType } from './target/types';
2
- export type { TargetType } from './target/types';
3
- export { TARGET_TYPES, isTargetType } from './target/types';
1
+ import type { MpTargetType, TargetType } from './target/types';
2
+ export type { MpTargetType, TargetType } from './target/types';
3
+ export { MP_TARGET_TYPES, isMpTargetType, isTargetType, TARGET_TYPES, } from './target/types';
4
4
  export interface ProxyOptions {
5
5
  target: string;
6
6
  changeOrigin?: boolean;
@@ -44,6 +44,14 @@ export interface ResolvedMiniProgramConfig {
44
44
  publicDir: string;
45
45
  globalData?: Record<string, unknown>;
46
46
  }
47
+ /** 按小程序平台分组的目标端配置:{ 'mp-weixin': {...}, 'mp-alipay': {...} }。 */
48
+ export type MiniProgramConfigMap = Partial<Record<MpTargetType, MiniProgramConfig>>;
49
+ /**
50
+ * mp 字段的两种写法:
51
+ * - 单一 `MiniProgramConfig`:作用于任意小程序目标(向后兼容,微信单端推荐);
52
+ * - `MiniProgramConfigMap`:按平台分组,构建时只取当前 target 对应的那份。
53
+ */
54
+ export type UserMiniProgramConfig = MiniProgramConfig | MiniProgramConfigMap;
47
55
  export interface ServerConfig {
48
56
  host?: string;
49
57
  port?: number;
@@ -91,8 +99,8 @@ export interface UserConfig {
91
99
  server?: ServerConfig;
92
100
  build?: BuildConfig;
93
101
  library?: LibraryConfig;
94
- /** 微信小程序目标端配置(--target mp-weixin)。 */
95
- mp?: MiniProgramConfig;
102
+ /** 小程序目标端配置:单一配置(作用于所有 mp 目标)或按平台分组('mp-weixin' / 'mp-alipay' / 'mp-bytedance')。 */
103
+ mp?: UserMiniProgramConfig;
96
104
  }
97
105
  export interface ResolveConfigOptions {
98
106
  root?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "transone-cli",
3
- "version": "0.2.0",
3
+ "version": "0.3.1",
4
4
  "description": "Bun-native multi-target compiler CLI for TransOne applications: 一份 TypeScript 源码,按 Target 静态转换为 Web 与多端小程序原生工程",
5
5
  "type": "module",
6
6
  "exports": {
@@ -19,7 +19,7 @@
19
19
  "test": "bun test"
20
20
  },
21
21
  "dependencies": {
22
- "transone": "0.2.0",
22
+ "transone": "0.4.0",
23
23
  "typescript": "^5.3.3"
24
24
  },
25
25
  "files": [
@@ -32,7 +32,7 @@
32
32
  "access": "public",
33
33
  "registry": "https://registry.npmjs.org/"
34
34
  },
35
- "homepage": "https://github.com/geektech-team/transone/tree/main/packages/transone-cli",
35
+ "homepage": "https://geektech-team.github.io/transone/cli/",
36
36
  "engines": {
37
37
  "bun": ">=1.3.0"
38
38
  }