tt-minigame-ide-cli 2.0.5 → 2.0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -10,7 +10,6 @@ export declare const SLARDAR_EVENT: {
10
10
  readonly VELA_UPLOAD_TIME: "VELA_UPLOAD_TIME";
11
11
  readonly VELA_COMPILE_FIRST_END: "VELA_COMPILE_FIRST_END";
12
12
  readonly VELA_COMPILE_TIME: "VELA_COMPILE_TIME";
13
- readonly PUCK_COMPILE_ERROR: "PUCK_COMPILE_ERROR";
14
13
  readonly IDE_COMPILE_PERFORMANCE: "IDE_COMPILE_PERFORMANCE";
15
14
  readonly IDE_COMPILE_RESULT: "IDE_COMPILE_RESULT";
16
15
  readonly VELA_SIMULATOR_RENDER_TIME: "VELA_SIMULATOR_RENDER_TIME";
@@ -61,6 +60,7 @@ export declare const SLARDAR_EVENT: {
61
60
  readonly IDE_REQUEST_START: "IDE_REQUEST_START";
62
61
  readonly IDE_REQUEST_FAIL: "IDE_REQUEST_FAIL";
63
62
  readonly IDE_COLOR_THEME: "IDE_COLOR_THEME";
63
+ readonly IDE_CODE_WINDOW_ERROR: "IDE_CODE_WINDOW_ERROR";
64
64
  readonly IDE_HELP_DEVELOPER_COMMUNITY: "IDE_HELP_DEVELOPER_COMMUNITY";
65
65
  readonly IDE_MESSAGE_EXPAND_CLICK: "IDE_MESSAGE_EXPAND_CLICK";
66
66
  readonly IDE_MODULE_CLICK: "IDE_MODULE_CLICK";
@@ -80,7 +80,9 @@ export declare const SLARDAR_EVENT: {
80
80
  readonly IDE_SCENE_END: "IDE_SCENE_END";
81
81
  readonly IDE_APPID_SELECT: "IDE_APPID_SELECT";
82
82
  readonly IDE_APPID_CHANGE: "IDE_APPID_CHANGE";
83
+ readonly IDE_FMP_BREAKDOWN: "IDE_FMP_BREAKDOWN";
83
84
  readonly IDE_JS_LONG_TASK: "IDE_JS_LONG_TASK";
85
+ readonly IDE_INP_INFO: "IDE_INP_INFO";
84
86
  readonly IDE_LOW_FPS: "IDE_LOW_FPS";
85
87
  readonly IDE_LOW_MEMORY: "IDE_LOW_MEMORY";
86
88
  readonly IDE_FETCH_ADMIN_XCONFIG_TMAR: "IDE_FETCH_ADMIN_XCONFIG_TMAR";
@@ -93,6 +95,7 @@ export declare const SLARDAR_EVENT: {
93
95
  readonly IDE_DETAIL_PANEL_CLOSED: "IDE_DETAIL_PANEL_CLOSED";
94
96
  readonly IDE_SETTING_PAGE_SHOW: "IDE_SETTING_PAGE_SHOW";
95
97
  readonly IDE_SETTING_PAGE_OPERATION: "IDE_SETTING_PAGE_OPERATION";
98
+ readonly IDE_SETTING_CHANGE_LITE_MODE: "IDE_SETTING_CHANGE_LITE_MODE:";
96
99
  readonly IDE_MODULE_CLICK_AUTH_REG: "IDE_MODULE_CLICK_AUTH_REG";
97
100
  readonly IDE_MODULE_CLICK_AUTH_UNREGPOP_REG: "IDE_MODULE_CLICK_AUTH_UNREGPOP_REG";
98
101
  readonly IDE_MODULE_CLICK_AUTH_UNREGPOP_CANCEL: "IDE_MODULE_CLICK_AUTH_UNREGPOP_CANCEL";
@@ -130,6 +133,20 @@ export declare const SLARDAR_EVENT: {
130
133
  readonly IDE_DECODE_QRCODE: "IDE_DECODE_QRCODE";
131
134
  readonly IDE_DECODE_URL: "IDE_DECODE_URL";
132
135
  readonly IDE_MAIN_HELPER_FORK_TIME: "IDE_MAIN_HELPER_FORK_TIME";
136
+ readonly IDE_INSTALL_PATH: "IDE_INSTALL_PATH";
137
+ readonly IDE_SWITCH_WORKBENCH_MODE: "IDE_SWITCH_WORKBENCH_MODE";
138
+ readonly IDE_TOGGLE_REMOTE_VIEW: "IDE_TOGGLE_REMOTE_VIEW";
139
+ readonly IDE_SIMULATOR_PAUSE_MINIAPP: "IDE_SIMULATOR_PAUSE_MINIAPP";
140
+ readonly IDE_SIMULATOR_REFRESH_MINIAPP: "IDE_SIMULATOR_REFRESH_MINIAPP";
141
+ readonly IDE_SIMULATOR_REFRESH: "IDE_SIMULATOR_REFRESH";
142
+ readonly IDE_SIMULATOR_CLICK_LITE_BANNER: "IDE_SIMULATOR_CLICK_LITE_BANNER";
143
+ readonly IDE_LITE_MODE_ENTER: "IDE_LITE_MODE_ENTER";
144
+ readonly IDE_LITE_NOTICE_MODAL_SHOW: "IDE_LITE_NOTICE_MODAL_SHOW";
145
+ readonly IDE_LITE_NOTICE_MODAL_CLICK: "IDE_LITE_NOTICE_MODAL_CLICK";
146
+ readonly IDE_WB_SCENE_START: "IDE_WB_SCENE_START";
147
+ readonly IDE_WB_SCENE_END: "IDE_WB_SCENE_END";
148
+ readonly IDE_GECKO_ERROR: "IDE_GECKO_ERROR";
149
+ readonly PUCK_COMPILE_ERROR: "PUCK_COMPILE_ERROR";
133
150
  readonly IDE_LOADER_IO_ERROR: string;
134
151
  readonly IDE_LOADER_INSTALL_RECOVER_ERROR: string;
135
152
  readonly IDE_LOADER_START_FROM_ENTRY: string;
@@ -186,6 +203,7 @@ export declare const IDE_MODULES: {
186
203
  export declare const IDE_TIMELINE_NAMES: {
187
204
  readonly SIMULATOR_FIRST_LOADING_END: "SIMULATOR_FIRST_LOADING_END";
188
205
  readonly SIMULATOR_LOADING: "SIMULATOR_LOADING";
206
+ readonly LOCAL_COMPILE: "LOCAL_COMPILE";
189
207
  readonly LOGIN: "LOGIN";
190
208
  readonly MESSAGE: "MESSAGE";
191
209
  readonly SIMULATOR: "SIMULATOR";
@@ -15,8 +15,8 @@ export interface IApp extends BaseApp {
15
15
  };
16
16
  path?: string;
17
17
  };
18
- industrySDK?: boolean;
19
18
  openDataContext?: string;
19
+ deviceOrientation?: 'landscape' | 'portrait';
20
20
  }
21
21
  /**
22
22
  * JSON object wrapper for `app.json`
@@ -41,7 +41,7 @@ export interface IProjectConfig extends IProject {
41
41
  minified: boolean;
42
42
  newFeature: boolean;
43
43
  autoCompile?: boolean;
44
- mockUpdate?: boolean;
44
+ compileHotReLoad?: boolean;
45
45
  scripts?: boolean;
46
46
  localPlugins?: boolean;
47
47
  nodeModules?: boolean;
@@ -92,6 +92,7 @@ export declare class ProjectConfig extends JSONContainer<Partial<IProjectConfig>
92
92
  static getKeyPathList(): string[];
93
93
  private static generateList;
94
94
  static from(projectPath: string): Promise<ProjectConfig>;
95
+ static fromJson(json: Record<string, any>, projectPath: string): ProjectConfig;
95
96
  static getMergedConfig(publicConfig: Partial<IProjectConfig>, privateConfig: Partial<IProjectPrivate>): Partial<IProjectConfig>;
96
97
  update<K extends keyof IProjectConfig>(key: K, value: IProjectConfig[K], write?: boolean): Promise<void>;
97
98
  /**
@@ -116,6 +117,7 @@ export declare class ProjectConfig extends JSONContainer<Partial<IProjectConfig>
116
117
  getScripts(): IProjectConfig['scripts'];
117
118
  getConditionData(conditionKeyName: keyof NonNullable<IProjectConfig['condition']>): ConditionData;
118
119
  getAutoCompileSetting(): boolean;
120
+ getCompileHotReloadSetting(): boolean;
119
121
  getLocalPluginsSetting(): boolean;
120
122
  getAfterOpenScript(): string;
121
123
  getBeforeCompileScript(): string;
@@ -5,6 +5,7 @@ import type { ProjectConfig } from '@byted/miniprogram-utils/dist/data/project';
5
5
  import { ProjectSize } from '@byted/miniprogram-utils/typings/project';
6
6
  import archiver from 'archiver';
7
7
  import fg from 'fast-glob';
8
+ import { IApp } from '@byted/miniprogram-utils/dist/data/app';
8
9
  /**
9
10
  * 计算给定文件夹下面的文件体积总值
10
11
  * @param folderPath directory path
@@ -12,7 +13,7 @@ import fg from 'fast-glob';
12
13
  * @param options pass to fast-glob
13
14
  * @returns
14
15
  */
15
- export declare function getFolderSize(folderPath: string, useTypeScript: boolean, options: fg.Options, isGame: boolean): Promise<number>;
16
+ export declare function getFolderSize(folderPath: string, useTypeScript: boolean, options: fg.Options, isGame: boolean, gameFiles?: string[]): Promise<number>;
16
17
  /**
17
18
  * 以文件夹为单位的包体积统计,不适用于依赖分析
18
19
  *
@@ -21,7 +22,7 @@ export declare function getFolderSize(folderPath: string, useTypeScript: boolean
21
22
  * @param projectPath
22
23
  * @param isGame
23
24
  */
24
- export declare function getProjectSize(projectConfig: ProjectConfig, appJson: any, projectPath: string, isGame: boolean): Promise<ProjectSize>;
25
+ export declare function getProjectSize(projectConfig: ProjectConfig, appJson: IApp, projectPath: string, isGame: boolean): Promise<ProjectSize>;
25
26
  /**
26
27
  * 校验当前项目的分包体积是否符合要求
27
28
  * 若有错误,会抛出 promise 异常
@@ -39,12 +40,6 @@ declare type FolderToZipStreamOption = {
39
40
  * @param dir path to folder
40
41
  */
41
42
  export declare function folderToZipStream(dir: string, { whiteList, useTypeScript }: FolderToZipStreamOption, isGame: boolean): Promise<archiver.Archiver>;
42
- /**
43
- *
44
- * @param dir path to microapp project
45
- * @returns
46
- */
47
- export declare function getProjectHash(dir: string, isGame: boolean): Promise<string>;
48
43
  /**
49
44
  * For cli only
50
45
  * @param input
@@ -31,10 +31,12 @@ declare type PreviewOption = Pick<ProjectToQRCodeOption, 'project' | 'page' | 'q
31
31
  * @returns
32
32
  */
33
33
  export declare function preview(options: PreviewOption): Promise<ProjectQRCode>;
34
- declare type UploadOption = Pick<ProjectToQRCodeOption, 'project' | 'qrcode' | 'copyToClipboard' | 'extraInfoJson' | 'localCompileVersion' | 'ideConfig' | 'interactGame' | 'penetrateMapJson'> & {
34
+ export declare type UploadOption = Pick<ProjectToQRCodeOption, 'project' | 'qrcode' | 'copyToClipboard' | 'extraInfoJson' | 'localCompileVersion' | 'ideConfig' | 'interactGame' | 'penetrateMapJson'> & {
35
35
  version: string;
36
36
  changeLog: string;
37
37
  needUploadSourcemap?: boolean;
38
+ needUploadCheck?: boolean;
39
+ extraCheckInfoJson?: string;
38
40
  };
39
41
  /**
40
42
  * 发布上传(功能入口)
@@ -58,6 +60,8 @@ export declare type ProjectToQRCodeOption = {
58
60
  version: string;
59
61
  changeLog: string;
60
62
  needUploadSourcemap: boolean;
63
+ needUploadCheck: boolean;
64
+ extraCheckInfoJson?: string;
61
65
  };
62
66
  extraInfoJson?: string;
63
67
  localCompileVersion?: string;
@@ -76,6 +80,13 @@ export declare type ProjectToQRCodeOption = {
76
80
  supportSourcemap?: boolean;
77
81
  enableHotRestartCache?: boolean;
78
82
  penetrateMapJson?: Record<string, unknown>;
83
+ traceVersion?: number;
84
+ updateStatus?: (status: {
85
+ upload: number;
86
+ check: number;
87
+ compile: number;
88
+ }) => any;
89
+ setCheckResult?: (result: any) => any;
79
90
  };
80
- export declare function projectToQRCode(options: ProjectToQRCodeOption): Promise<ProjectQRCode>;
91
+ export declare function projectToQRCode(options: ProjectToQRCodeOption, hashTimeout?: number): Promise<ProjectQRCode>;
81
92
  export {};
@@ -3,7 +3,7 @@ import { getConfig, setConfig } from './features/config';
3
3
  import { createProject } from './features/create';
4
4
  import { checkSession, loginByEmail, loginByPhone, logout, sendVerificationCodeToPhone } from './features/login';
5
5
  import { getProjectSize, verifySubPackageSize } from './features/packages';
6
- import { checkProjectMatchAppid, ProjectToQRCodeOption, preview, ProjectQRCode, projectToQRCode, upload } from './features/preview';
6
+ import { checkProjectMatchAppid, ProjectToQRCodeOption, preview, ProjectQRCode, projectToQRCode, UploadOption } from './features/preview';
7
7
  import { detectValidExtApp, INVALID_EXTAPP_REASON } from './features/third-party';
8
8
  import { ProjectInfo } from './types';
9
9
  import { setCookieFn } from './utils/cookie';
@@ -15,8 +15,11 @@ declare function open(options: {
15
15
  declare function buildNpmFunc(options: {
16
16
  project: ProjectInfo;
17
17
  }): Promise<import("./features/npm").BuildNpmResult>;
18
+ declare function upload(options: UploadOption): Promise<ProjectQRCode>;
18
19
  export { ProjectQRCode, ProjectToQRCodeOption };
19
20
  export { open, setConfig, createProject as create, loginByEmail, loginByPhone, logout, sendVerificationCodeToPhone, checkSession, audit, getAuditHostsList, buildNpmFunc as buildNpm, preview, upload, projectToQRCode, setCookieFn, getConfig, detectValidExtApp, getProjectSize, verifySubPackageSize, checkProjectMatchAppid, INVALID_EXTAPP_REASON, IDEConfig, makeSchema, MakeSchemaOption, MakeSchemaResult, IDESandboxConfig, };
20
21
  export * from './features/meta';
22
+ export { folderToZipStream } from './features/packages';
21
23
  export * from './utils/metrics';
22
24
  export * as microgame from './features/microgame';
25
+ export { getProjectHash, setProjectHashFn } from './utils/hash';
@@ -6,7 +6,9 @@ export declare class CliMonitor {
6
6
  private static _instance;
7
7
  private _didReportLaunch;
8
8
  private readonly _commonParams;
9
+ private _commonData;
9
10
  private constructor();
11
+ static updateCommonParams(newParams: Record<string, string | number | boolean>): void;
10
12
  static getInstance(config: CLIMonitorConfigOptions): CliMonitor;
11
13
  shouldReport(eventName: string): boolean;
12
14
  report(eventName: string, params?: Record<string, string | number | boolean>): void;
@@ -6,4 +6,5 @@ export declare const CLI_EVENTS: {
6
6
  IDE_CLI_UPLOAD_SUCCESS: string;
7
7
  IDE_CLI_UPLOAD_FAIL: string;
8
8
  IDE_CLI_ERROR: string;
9
+ IDE_LITE_MODE_ENTER: string;
9
10
  };
@@ -11,6 +11,7 @@ export interface TMACliConfig {
11
11
  compileProgress: string;
12
12
  preview: string;
13
13
  upload: string;
14
+ check: string;
14
15
  emailLogin: string;
15
16
  mobileLogin: string;
16
17
  sendLoginCode: string;
@@ -1,6 +1,7 @@
1
1
  declare type GetCookieFunction = () => Promise<string>;
2
2
  export declare let getUserCookies: GetCookieFunction;
3
- export declare function saveUserCookies(cookies: string[]): void;
3
+ export declare const getUserId: () => string;
4
+ export declare function saveUserCookies(cookies: string[], userId: string): void;
4
5
  export declare function removeUserCookies(): void;
5
6
  export declare function setCookieFn(fn: GetCookieFunction): void;
6
7
  export {};
@@ -0,0 +1,11 @@
1
+ /**
2
+ *
3
+ * @param dir path to microapp project
4
+ * @param timeout 预留给worker进程hash逻辑使用参数
5
+ * @returns
6
+ */
7
+ export declare let getProjectHash: (dir: string, isGame: boolean, timeout?: number) => Promise<string>;
8
+ /**
9
+ * IDE workbench 中调用该函数,最终会在MainHelperWindow中计算hash
10
+ */
11
+ export declare function setProjectHashFn(fn: typeof getProjectHash): Promise<void>;
@@ -15,6 +15,12 @@ interface BDPLog {
15
15
  location: string;
16
16
  }
17
17
  export declare type IDEConfig = IDEBaseConfig & IDESandboxConfig;
18
+ export declare type IDEExtraInfo = {
19
+ ip?: string;
20
+ subnet?: string;
21
+ local_room_service_url?: string;
22
+ packages_token?: string;
23
+ };
18
24
  export interface IDEBaseConfig {
19
25
  previewScene: 'live' | 'default';
20
26
  ideVersion: string;
@@ -25,14 +31,12 @@ export interface IDEBaseConfig {
25
31
  inspectPlatform?: DevicePlatform;
26
32
  iOSDebugVersion?: string;
27
33
  connectType?: 'push' | 'scan';
28
- localDebug?: 'true' | 'false';
34
+ localDebug?: boolean;
29
35
  dycloudConfig?: {
30
36
  callContainer: string | null;
31
37
  websocket: string | null;
32
38
  };
33
- extraInfo?: {
34
- [k: string]: string;
35
- };
39
+ extraInfo?: IDEExtraInfo;
36
40
  }
37
41
  export interface IDESandboxConfig {
38
42
  isSandbox?: boolean;
@@ -62,6 +66,7 @@ export declare type MakeSchemaOption = {
62
66
  hotRestartHash?: string;
63
67
  type: string;
64
68
  penetrateMapJson?: Record<string, unknown>;
69
+ traceVersion?: number;
65
70
  };
66
71
  export declare function makeSchema(options: MakeSchemaOption): Promise<MakeSchemaResult>;
67
72
  export declare function toQRCodeSVG(str: string): Promise<string>;
@@ -54,3 +54,4 @@ export declare function getMD5Stream(source: archiver.Archiver): Promise<Transfo
54
54
  __md5: string;
55
55
  }>;
56
56
  export declare const getNextVersion: (version: string) => string;
57
+ export declare const isGameFileValid: (pattern: string) => boolean;
@@ -1 +1,2 @@
1
+ export declare const ALLOWED_MICROGAME_EXTS_REG: RegExp;
1
2
  export declare function getWhiteList(isGame?: boolean): string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tt-minigame-ide-cli",
3
- "version": "2.0.5",
3
+ "version": "2.0.6",
4
4
  "description": "Command line interface for micro app development",
5
5
  "license": "ISC",
6
6
  "main": "dist/index.js",