@cocos/cocos-cli-types 0.0.1-alpha.17.1 → 0.0.1-alpha.17.2

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/package.json CHANGED
@@ -2,9 +2,17 @@
2
2
  "name": "@cocos/cocos-cli-types",
3
3
  "description": "types for cocos cli",
4
4
  "author": "cocos cli",
5
- "version": "0.0.1-alpha.17.1",
5
+ "version": "0.0.1-alpha.17.2",
6
6
  "main": "index.d.ts",
7
7
  "types": "index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./index.d.ts"
11
+ },
12
+ "./*": {
13
+ "types": "./*.d.ts"
14
+ }
15
+ },
8
16
  "files": [
9
17
  "*.d.ts"
10
18
  ]
package/project.d.ts CHANGED
@@ -1,9 +1,197 @@
1
1
  declare function close_2(): Promise<void>;
2
2
  export { close_2 as close };
3
3
 
4
+ export declare function get(): Promise<Project>;
5
+
6
+ export declare function getInfo(): Promise<ProjectInfo>;
7
+
4
8
  export declare function init(projectPath: string): Promise<void>;
5
9
 
10
+ declare interface IProject {
11
+ /**
12
+ * Gets the project directory path
13
+ *
14
+ * @returns {string} The project directory path
15
+ */
16
+ get path(): string;
17
+ /**
18
+ * Gets the project type (2d or 3d)
19
+ *
20
+ * @returns {'2d' | '3d'} The project type
21
+ */
22
+ get type(): '2d' | '3d';
23
+ /**
24
+ * Gets the package.json file path
25
+ *
26
+ * @returns {string} The path to package.json file
27
+ */
28
+ get pkgPath(): string;
29
+ /**
30
+ * Gets the temp directory path
31
+ *
32
+ * @returns {string} The path to the temporary directory
33
+ */
34
+ get tmpDir(): string;
35
+ /**
36
+ * Gets the library directory path
37
+ *
38
+ * @returns {string} The path to the library directory
39
+ */
40
+ get libraryDir(): string;
41
+ /**
42
+ * Opens the project and loads project information
43
+ *
44
+ * @returns {Promise<boolean>} Returns true if the project was opened successfully, false otherwise
45
+ */
46
+ open(projectPath: string): Promise<boolean>;
47
+ /**
48
+ * Closes the project and saves current project information
49
+ *
50
+ * @returns {Promise<boolean>} Returns true if the project was closed successfully, false otherwise
51
+ */
52
+ close(): Promise<boolean>;
53
+ /**
54
+ * Gets the complete project information
55
+ *
56
+ * @returns {ProjectInfo} The complete project information object
57
+ */
58
+ getInfo(): ProjectInfo;
59
+ /**
60
+ * Gets specific project information by key path
61
+ *
62
+ * @param {string} key - The key path to access nested properties (e.g., 'creator.version')
63
+ * @returns {any} The value at the specified key path, or null if not found
64
+ */
65
+ getInfo(key: string): any;
66
+ /**
67
+ * Gets project information with optional key path
68
+ *
69
+ * @param {string} [key] - Optional key path to access nested properties
70
+ * @returns {ProjectInfo | any} Project information or specific value
71
+ */
72
+ getInfo(key?: string): ProjectInfo | any;
73
+ /**
74
+ * Updates specific project information by key path or complete info
75
+ *
76
+ * @param {string | ProjectInfo} keyOrValue - Either a key path string or complete ProjectInfo object
77
+ * @param {ProjectInfo} [value] - The value to set when using key path (required if keyOrValue is string)
78
+ * @returns {Promise<boolean>} Returns true if update was successful, false otherwise
79
+ */
80
+ updateInfo<T>(keyOrValue: string | ProjectInfo, value?: T): Promise<boolean>;
81
+ }
82
+
6
83
  declare function open_2(projectPath: string): Promise<void>;
7
84
  export { open_2 as open };
8
85
 
86
+ declare class Project implements IProject {
87
+ /**
88
+ * The version of the Project
89
+ */
90
+ static readonly version = '4.0.0';
91
+ private _projectPath;
92
+ private _type;
93
+ private _pkgPath;
94
+ private _tmpDir;
95
+ private _libraryDir;
96
+ private _info;
97
+ get path(): string;
98
+ get type(): '2d' | '3d';
99
+ static getPackageJsonPath(projectPath: string): string;
100
+ get pkgPath(): string;
101
+ get tmpDir(): string;
102
+ get libraryDir(): string;
103
+ static create(projectPath: string, type?: ProjectType): Promise<boolean>;
104
+ getInfo(): ProjectInfo;
105
+ getInfo(key: string): any;
106
+ updateInfo<T>(keyOrValue: string | ProjectInfo, value?: T): Promise<boolean>;
107
+ open(projectPath: string): Promise<boolean>;
108
+ close(): Promise<boolean>;
109
+ /**
110
+ * Generates project information object
111
+ *
112
+ * @param {string} projectPath - The project directory path
113
+ * @param {ProjectType} type - The project type (2d or 3d)
114
+ * @returns {ProjectInfo} Generated project information
115
+ */
116
+ private static generateProjectInfo;
117
+ /**
118
+ * Validates if the project information is valid
119
+ *
120
+ * @param {ProjectInfo} info - The project information to validate
121
+ * @returns {boolean} Returns true if the project info is valid, false otherwise
122
+ */
123
+ private isValid;
124
+ }
125
+
126
+ /**
127
+ * Project creator information
128
+ */
129
+ declare interface ProjectCreatorInfo {
130
+ /**
131
+ * Version of the tool or engine used to create the project
132
+ */
133
+ version: string;
134
+
135
+ /**
136
+ * Dependencies of the project
137
+ * - key: package name
138
+ * - value: version number
139
+ */
140
+ dependencies?: {
141
+ [name: string]: string,
142
+ };
143
+
144
+ /**
145
+ * Registry configuration for package management
146
+ */
147
+ registry?: {
148
+ /**
149
+ * Remote repository configuration (e.g., npm, private registry)
150
+ */
151
+ remote?: {};
152
+ };
153
+ }
154
+
155
+ /**
156
+ * Project information
157
+ */
158
+ declare interface ProjectInfo {
159
+ /**
160
+ * Project name
161
+ */
162
+ name: string;
163
+
164
+ /**
165
+ * Project type ('2d' or '3d')
166
+ */
167
+ type: ProjectType;
168
+
169
+ /**
170
+ * Project version
171
+ */
172
+ version: string;
173
+
174
+ /**
175
+ * Unique identifier (UUID) of the project
176
+ */
177
+ uuid: string;
178
+
179
+ /**
180
+ * Information about the creator of the project
181
+ */
182
+ creator: ProjectCreatorInfo;
183
+
184
+ /**
185
+ * Other additional properties (flexible extension)
186
+ */
187
+ [key: string]: any;
188
+ }
189
+
190
+ /**
191
+ * Project type
192
+ * - '2d': 2D Project
193
+ * - '3d': 3D Project
194
+ */
195
+ declare type ProjectType = '2d' | '3d';
196
+
9
197
  export { };
package/scripting.d.ts CHANGED
@@ -1,3 +1,38 @@
1
+ export declare interface FilterPluginOptions {
2
+ loadPluginInEditor?: boolean;
3
+ loadPluginInWeb?: boolean;
4
+ loadPluginInNative?: boolean;
5
+ loadPluginInMiniGame?: boolean;
6
+ }
7
+
1
8
  export declare function init(projectPath: string): Promise<void>;
2
9
 
10
+ export declare interface IPluginScriptInfo extends PluginScriptInfo {
11
+ url: string;
12
+ }
13
+
14
+ declare interface PluginScriptInfo {
15
+ /**
16
+ * 脚本文件。
17
+ */
18
+ file: string;
19
+ uuid: string;
20
+ }
21
+
22
+ export declare interface SharedSettings {
23
+ useDefineForClassFields: boolean;
24
+ allowDeclareFields: boolean;
25
+ loose: boolean;
26
+ guessCommonJsExports: boolean;
27
+ exportsConditions: string[];
28
+ preserveSymlinks: boolean;
29
+ importMap?: {
30
+ json: {
31
+ imports?: Record<string, string>;
32
+ scopes?: Record<string, Record<string, string>>;
33
+ };
34
+ url: string;
35
+ };
36
+ }
37
+
3
38
  export { };