tt-minigame-ide-cli 2.0.15 → 2.0.16

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.
@@ -207,6 +207,7 @@ export declare const SLARDAR_EVENT: {
207
207
  readonly IDE_AI_AGENT_GENERATE: "IDE_AI_AGENT_GENERATE";
208
208
  readonly IDE_AI_AGENT_DIFF_ACTION: "IDE_AI_AGENT_DIFF_ACTION";
209
209
  readonly IDE_AI_AGENT_GEN_UI: "IDE_AI_AGENT_GEN_UI";
210
+ readonly IDE_OPERATOR_TIME: "IDE_OPERATOR_TIME";
210
211
  readonly IDE_LOADER_IO_ERROR: string;
211
212
  readonly IDE_LOADER_INSTALL_RECOVER_ERROR: string;
212
213
  readonly IDE_LOADER_START_FROM_ENTRY: string;
@@ -369,3 +370,7 @@ export declare const FRONT_PAGE_EVENT: {
369
370
  VELA_SCHEMA_DOWNLOAD_MINICODE: string;
370
371
  VELA_SCHEMA_DOWNLOAD_MINICODE_FAIL: string;
371
372
  };
373
+ export declare const PROJECT_TECH_TYPE: {
374
+ PLAYABLE_GAME: number;
375
+ GAME: number;
376
+ };
@@ -1,5 +1,7 @@
1
1
  export declare enum CompilerPlugin {
2
- TYPESCRIPT = "typescript"
2
+ TYPESCRIPT = "typescript",
3
+ LESS = "less",
4
+ SASS = "sass"
3
5
  }
4
6
  export declare enum PACK_TYPE {
5
7
  FILE = "file",
@@ -26,6 +26,7 @@ export interface IApp extends BaseApp {
26
26
  version?: string;
27
27
  provider?: string;
28
28
  }>;
29
+ enableIOSHighPerformanceMode?: boolean;
29
30
  enableIOSHighPerformanceModePlus?: boolean;
30
31
  }
31
32
  /**
@@ -102,8 +102,8 @@ export interface IProjectConfig extends IProject {
102
102
  * microgame 属于 game 类型
103
103
  * live-plugin 为直播间互动插件
104
104
  */
105
- declare type TechType = 'app' | 'game' | 'unity' | 'liveplugin';
106
- declare type IDEAppTechType = 'microapp' | 'microgame' | 'microapp-minicode' | 'plugin' | 'plugin-minicode' | 'microgame-minicode' | 'liveplugin-minicode' | 'unity' | 'liveplugin' | 'microapp-plugin' | 'microapp-plugin-minicode' | '';
105
+ declare type TechType = 'app' | 'game' | 'unity' | 'liveplugin' | 'playablegame';
106
+ declare type IDEAppTechType = 'microapp' | 'microgame' | 'microapp-minicode' | 'plugin' | 'plugin-minicode' | 'microgame-minicode' | 'liveplugin-minicode' | 'unity' | 'liveplugin' | 'microapp-plugin' | 'microapp-plugin-minicode' | 'playablegame' | 'playablegame-minicode' | '';
107
107
  export declare const PROJECT_TYPE_MAP: Record<string, TechType>;
108
108
  export declare function setIDEAppTechType(type: IDEAppTechType): void;
109
109
  export declare function getIDEAppTechType(): IDEAppTechType;
@@ -21,6 +21,8 @@ export interface ICommonParams {
21
21
  isSandbox?: string;
22
22
  frameworkType?: string;
23
23
  workbenchMode?: string;
24
+ mixType?: number;
25
+ isMixed?: '0' | '1';
24
26
  }
25
27
  export declare function commonParams2Context(commonParams: ICommonParams, globalDevAppId?: string, globalTechType?: string, globalExtAppId?: string): {
26
28
  user_id: string;
@@ -45,6 +47,8 @@ export declare function commonParams2Context(commonParams: ICommonParams, global
45
47
  e2e_scene: string;
46
48
  cpu_model: string;
47
49
  system_memory: string;
50
+ is_mixed: string;
51
+ mix_type: number;
48
52
  };
49
53
  export declare function getHref(): string;
50
54
  /**
@@ -16,3 +16,4 @@ export declare function getFileHash(path: string, fullString?: boolean, algorith
16
16
  export declare function getDirHash(root: string, ignore?: string[], algorithm?: string): Promise<{
17
17
  [file: string]: string;
18
18
  }>;
19
+ export declare const getBufferMd5: (buffer: Buffer) => string;
@@ -19,5 +19,6 @@ export declare function isRealToyId(appid: string): Promise<boolean>;
19
19
  export declare function fetchMeta({ appid, isGame }: MetaOption): Promise<any>;
20
20
  export declare function getAppVersions(appId: string, isPlugin?: boolean): Promise<{
21
21
  audit_version: string;
22
+ plugin_base_library_version: string;
22
23
  }>;
23
24
  export {};
@@ -0,0 +1,103 @@
1
+ import { ServerSize } from '@byted/miniprogram-utils/typings/project';
2
+ import { ProjectInfo, QrcodeInfo } from '../../types';
3
+ import { IMetrics } from '../../utils/metrics';
4
+ import { IDEConfig, MakeSchemaOption } from '../../utils/qrcode';
5
+ export declare type ProjectQRCode = {
6
+ expireTime: number;
7
+ shortUrl: string;
8
+ originSchema: string;
9
+ qrcodeSVG?: string;
10
+ qrcodeFilePath?: string;
11
+ useCache: boolean;
12
+ } & Pick<CompileProgressResult, 'metrics' | 'passJson'>;
13
+ export declare enum MixType {
14
+ Cocos = 1,
15
+ WebGl = 2,
16
+ Native = 3
17
+ }
18
+ declare type CompileProgressResult = {
19
+ success: boolean;
20
+ /** error code */
21
+ error: number;
22
+ done: boolean;
23
+ msg: string;
24
+ metrics?: IMetrics;
25
+ errLink?: string;
26
+ passJson: {
27
+ packageSize?: ServerSize;
28
+ } & Record<string, any>;
29
+ };
30
+ export declare type PreviewOption = Pick<ProjectToQRCodeOption, 'project' | 'page' | 'qrcode' | 'cache' | 'copyToClipboard' | 'extraInfoJson' | 'localCompileVersion' | 'ideConfig' | 'mixType'>;
31
+ /**
32
+ * 预览上传(功能入口)
33
+ * @param options
34
+ * @returns
35
+ */
36
+ export declare function preview(options: PreviewOption): Promise<ProjectQRCode>;
37
+ export declare type UploadOption = Pick<ProjectToQRCodeOption, 'project' | 'qrcode' | 'copyToClipboard' | 'extraInfoJson' | 'localCompileVersion' | 'ideConfig' | 'updateStatus' | 'setCheckResult' | 'isNewPlatform' | 'mixType'> & {
38
+ version: string;
39
+ changeLog: string;
40
+ needUploadSourcemap?: boolean;
41
+ extraCheckInfoJson?: string;
42
+ channel?: string;
43
+ };
44
+ /**
45
+ * 发布上传(功能入口)
46
+ * @param options
47
+ * @returns
48
+ */
49
+ export declare function upload(options: UploadOption): Promise<ProjectQRCode>;
50
+ export declare type ProjectToQRCodeOption = {
51
+ project: ProjectInfo;
52
+ page: {
53
+ path: string;
54
+ query: string;
55
+ scene: string;
56
+ launchFrom: string;
57
+ location: string;
58
+ } & Pick<MakeSchemaOption, 'referrerInfo'>;
59
+ qrcode: QrcodeInfo;
60
+ cache: boolean;
61
+ copyToClipboard: boolean;
62
+ uploadOptions?: {
63
+ version: string;
64
+ changeLog: string;
65
+ needUploadSourcemap: boolean;
66
+ extraCheckInfoJson?: string;
67
+ channel?: string;
68
+ };
69
+ extraInfoJson?: string;
70
+ localCompileVersion?: string;
71
+ ideConfig?: IDEConfig;
72
+ debug?: {
73
+ query: {
74
+ gtoken: string;
75
+ roomid: string;
76
+ session: string;
77
+ };
78
+ };
79
+ uploadCache?: boolean;
80
+ supportSourcemap?: boolean;
81
+ enableHotRestartCache?: boolean;
82
+ updateStatus?: (status: {
83
+ upload: number;
84
+ check: number;
85
+ compile: number;
86
+ uploadSuccess?: boolean;
87
+ }) => any;
88
+ setCheckResult?: (result: any) => any;
89
+ isNewPlatform?: (value: boolean) => void;
90
+ mixType: MixType;
91
+ };
92
+ export declare function projectToQRCode(options: ProjectToQRCodeOption): Promise<ProjectQRCode>;
93
+ export declare function getChannelLimit(appid: string): Promise<{
94
+ limit_num: number;
95
+ } | null>;
96
+ export declare function checkChannel(appid: string, channel: string): Promise<void>;
97
+ export declare const previewForCli: (options: PreviewOption & {
98
+ useAndroidNative?: boolean;
99
+ }) => Promise<ProjectQRCode>;
100
+ export declare const uploadForCli: (options: UploadOption & {
101
+ useAndroidNative?: boolean;
102
+ }) => Promise<ProjectQRCode>;
103
+ export {};
@@ -0,0 +1,4 @@
1
+ export * from './mixed-cloud-compile';
2
+ export * from './utils/mixed-package';
3
+ export * from './meta';
4
+ export * from './utils/mixed-constant';
@@ -0,0 +1,8 @@
1
+ export declare const NATIVE_RELATIVE_PATH = "native";
2
+ export declare const NATIVE_FULL_APK_NAME = "full.apk";
3
+ export declare const NATIVE_IL2CPP_NAME = "il2cpp.zip";
4
+ export declare const NATIVE_APK_NAME = "intermediate.apk";
5
+ export declare const UNITY_PLUGIN_PROVIDER = "tt674511f8f84ea91612";
6
+ export declare const UNITY_CACHE_DIR = ".dy-game-cache";
7
+ export declare const WEBGL_SYMBOLS_NAME = "webgl.symbols.json";
8
+ export declare const WEBGL_STREAMING_ASSETS_NAME = "StreamingAssets";
@@ -0,0 +1,73 @@
1
+ /// <reference types="node" />
2
+ import { PassThrough, Stream } from 'stream';
3
+ import { NATIVE_FULL_APK_NAME, NATIVE_APK_NAME, NATIVE_IL2CPP_NAME } from './mixed-constant';
4
+ import { SizeLimitConfig } from './source.type';
5
+ import { checkAppId, getAppId } from './package';
6
+ /** 不参与体积计算的 glob pattern */
7
+ export declare const PKG_SIZE_IGNORE_GLOBS: string[];
8
+ export declare const getSizeLimitConfig: (appId: string) => Promise<Omit<SizeLimitConfig, "demo">>;
9
+ /**
10
+ * @description: 目前小游戏分包大小有以下限制:
11
+ 整个小游戏所有主包+分包大小不超过 30M
12
+ 主包不超过 4M
13
+ 单个普通分包不限制大小
14
+ * @return {*}
15
+ */
16
+ export declare function verifyPkgSize(devAppid: string, projectPath: string, options?: {
17
+ withNative: boolean;
18
+ isUpload: boolean;
19
+ }): Promise<string>;
20
+ declare type NativeFileName = typeof NATIVE_APK_NAME | typeof NATIVE_FULL_APK_NAME | typeof NATIVE_IL2CPP_NAME;
21
+ export declare function getProjectSize(projectPath: string, options?: {
22
+ withNative: boolean;
23
+ isUpload: boolean;
24
+ }): Promise<{
25
+ main: number;
26
+ subPkgs: {
27
+ subs: Array<[
28
+ string,
29
+ number
30
+ ]>;
31
+ total: number;
32
+ };
33
+ openData: number;
34
+ total: number;
35
+ native?: {
36
+ il2cpp: number;
37
+ apk: number;
38
+ };
39
+ }>;
40
+ declare type ReturnTypeOfFolderToZipStream = Partial<Record<NativeFileName, Stream>> & {
41
+ zipStream: PassThrough;
42
+ };
43
+ /**
44
+ * @description: 将项目打包为 zip,如果是native,则一起返回native产物
45
+ * @param {string} folderPath
46
+ * @return {ReturnTypeOfFolderToZipStream}
47
+ */
48
+ export declare function folderToZipStream(folderPath: string, options?: {
49
+ withNative: boolean;
50
+ isUpload: boolean;
51
+ }): Promise<ReturnTypeOfFolderToZipStream>;
52
+ /**
53
+ * @description: 压缩文件
54
+ * @return {Buffer | PassThrough}
55
+ */
56
+ export declare const compress: ({ entries, rootPath, }: {
57
+ entries: string[];
58
+ rootPath: string;
59
+ }) => Promise<PassThrough>;
60
+ export { getAppId, checkAppId };
61
+ export declare const validateAppId: (appId: string) => Promise<void>;
62
+ /**
63
+ * @description: for 混合引擎小游戏,计算项目 hash:
64
+ * StreamingAssets下面所有文件均计算
65
+ * native 预览只计算full.apk
66
+ * 除去 native 和StreamingAssets的文件按白名单计算
67
+ * 最后把三个hash拼起来作为最终的hash
68
+ * 目前上传不需要计算hash(上传不做缓存,预览才做)
69
+ * @param {string} projectPath
70
+ * @param {boolean} withNative
71
+ * @return {string}
72
+ */
73
+ export declare const getMixedProjectHash: (projectPath: string, withNative: boolean) => Promise<string>;
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * 小游戏源码、打包相关
3
3
  */
4
+ import { SizeLimitConfig } from './source.type';
4
5
  import { ProjectConfig } from '@byted/miniprogram-utils/dist/data/project';
5
6
  /** 不参与体积计算的 glob pattern */
6
7
  export declare const PKG_SIZE_IGNORE_GLOBS: string[];
@@ -9,13 +10,7 @@ export declare const PKG_HASH_IGNORE_LIST: string[];
9
10
  /**
10
11
  * 获取上传预览 Settings 配置,支持白名单处理,兜底默认
11
12
  */
12
- export declare const getSizeLimitConfig: (appId: string) => Promise<{
13
- normalTotal: number;
14
- subMain: number;
15
- subPkg: number;
16
- subTotal: number;
17
- openData: number;
18
- }>;
13
+ export declare const getSizeLimitConfig: (appId: string) => Promise<SizeLimitConfig>;
19
14
  /**
20
15
  * 校验包体大小,支持白名单逻辑,具体限制以 Settings 下发为准
21
16
  * 默认:普通包最大 8MB,开放数据域 & 分包主包最大 4MB,子包不限制,总包 20MB
@@ -31,3 +26,16 @@ export declare const checkUCAppId: (appId: string) => boolean;
31
26
  export declare const checkAppId: (appId: string) => boolean;
32
27
  export declare const getAppId: (projectPath: string) => Promise<string>;
33
28
  export declare const validateAppId: (appId: string) => Promise<void>;
29
+ export declare const getTechType: (appId: string) => Promise<number>;
30
+ export declare const isPlayableGame: (appId: string) => Promise<boolean>;
31
+ export declare const getConfigUrl: (appid: string) => Promise<{
32
+ makeSchema: string;
33
+ compileProgress: string;
34
+ preview: string;
35
+ upload: string;
36
+ versionInfo: string;
37
+ sizeLimit: string;
38
+ unityCompileProgress: string;
39
+ unityPreview: string;
40
+ getChannelNumber: string;
41
+ }>;
@@ -28,6 +28,10 @@ export declare type SizeLimitConfig = {
28
28
  subTotal: number;
29
29
  /** 开放数据域包最大 MB 数 */
30
30
  openData: number;
31
+ /** 试玩游戏最大 MB 数 */
32
+ demo: number;
33
+ apkSource?: number;
34
+ il2cppSource?: number;
31
35
  };
32
36
  export declare type TmgSdkInfo = {
33
37
  latestSDKUrl: string;
@@ -27,3 +27,4 @@ export * as microgame from './features/microgame';
27
27
  export { getProjectHash, setProjectHashFn } from './utils/hash';
28
28
  export { getProjectToQRCodeStepReporterDesc } from './utils/util';
29
29
  export { PROJECT_TO_QR_CODE_STEP } from './utils/constants';
30
+ export * as mixedGame from './features/microgame/mixed-index';
@@ -33,6 +33,20 @@ export interface TMACliConfig {
33
33
  unityCompileProgress: string;
34
34
  unityPreview: string;
35
35
  getChannelNumber: string;
36
+ uploadMixed: string;
37
+ previewMixed: string;
38
+ compileProgressMixed: string;
39
+ };
40
+ playablegameUrl: {
41
+ makeSchema: string;
42
+ compileProgress: string;
43
+ preview: string;
44
+ upload: string;
45
+ versionInfo: string;
46
+ sizeLimit: string;
47
+ unityCompileProgress: string;
48
+ unityPreview: string;
49
+ getChannelNumber: string;
36
50
  };
37
51
  env: {
38
52
  type: 'online' | 'ppe' | 'boe';
@@ -2,4 +2,4 @@ export declare const ALLOWED_MICROGAME_EXTS_REG: RegExp;
2
2
  export declare function getWhiteList(isGame?: boolean, options?: {
3
3
  isLivePlugin?: boolean;
4
4
  isMicroappPlugin?: boolean;
5
- }): string[];
5
+ }, projectPath?: string): Promise<string[]>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tt-minigame-ide-cli",
3
- "version": "2.0.15",
3
+ "version": "2.0.16",
4
4
  "description": "Command line interface for micro app development",
5
5
  "license": "ISC",
6
6
  "main": "dist/index.js",
@@ -61,4 +61,4 @@
61
61
  "publishConfig": {
62
62
  "registry": "https://registry.npmjs.org"
63
63
  }
64
- }
64
+ }