@vtj/core 0.19.22 → 0.20.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/dist/index.cjs +3 -3
- package/dist/index.mjs +495 -323
- package/package.json +1 -1
- package/types/models/project.d.ts +7 -0
- package/types/protocols/schemas/file.d.ts +8 -0
- package/types/protocols/service.d.ts +1 -1
- package/types/tools/file.d.ts +20 -0
- package/types/tools/index.d.ts +1 -0
- package/types/version.d.ts +2 -2
package/package.json
CHANGED
|
@@ -4,6 +4,7 @@ export interface ProjectModelEvent {
|
|
|
4
4
|
model: ProjectModel;
|
|
5
5
|
type: ModelEventType;
|
|
6
6
|
data: any;
|
|
7
|
+
previous?: PageFile | BlockFile;
|
|
7
8
|
}
|
|
8
9
|
/**
|
|
9
10
|
* 项目信息更新时触发事件
|
|
@@ -169,6 +170,7 @@ export declare class ProjectModel {
|
|
|
169
170
|
* @returns
|
|
170
171
|
*/
|
|
171
172
|
existBlockName(name: string, excludes?: string[]): boolean;
|
|
173
|
+
existBlockFilePath(path: string, excludes?: string[]): boolean;
|
|
172
174
|
/**
|
|
173
175
|
* 检测是否存在名称的页面
|
|
174
176
|
* @param name
|
|
@@ -176,6 +178,11 @@ export declare class ProjectModel {
|
|
|
176
178
|
* @returns
|
|
177
179
|
*/
|
|
178
180
|
existPageName(name: string, excludes?: string[]): boolean;
|
|
181
|
+
existPageFilePath(path: string, excludes?: string[]): boolean;
|
|
182
|
+
existRoutePath(path: string, excludes?: string[]): boolean;
|
|
183
|
+
private validatePagePath;
|
|
184
|
+
private validateBlockPath;
|
|
185
|
+
private createUniquePath;
|
|
179
186
|
/**
|
|
180
187
|
* 新增或更新api
|
|
181
188
|
* @param item
|
|
@@ -22,6 +22,10 @@ export interface BlockFile {
|
|
|
22
22
|
* 唯一标识
|
|
23
23
|
*/
|
|
24
24
|
id: string;
|
|
25
|
+
/**
|
|
26
|
+
* 相对源码根目录的文件路径,不包含.vue后缀
|
|
27
|
+
*/
|
|
28
|
+
filePath?: string;
|
|
25
29
|
/**
|
|
26
30
|
* 文件名
|
|
27
31
|
*/
|
|
@@ -66,6 +70,10 @@ export interface BlockFile {
|
|
|
66
70
|
* 页面描述
|
|
67
71
|
*/
|
|
68
72
|
export interface PageFile extends BlockFile {
|
|
73
|
+
/**
|
|
74
|
+
* Web、H5页面路由
|
|
75
|
+
*/
|
|
76
|
+
routePath?: string;
|
|
69
77
|
/**
|
|
70
78
|
* 是否目录
|
|
71
79
|
*/
|
|
@@ -113,7 +113,7 @@ export declare abstract class Service {
|
|
|
113
113
|
* @param file
|
|
114
114
|
* @param project
|
|
115
115
|
*/
|
|
116
|
-
abstract removeRawPage(id: string, project?: ProjectSchema): Promise<boolean>;
|
|
116
|
+
abstract removeRawPage(id: string, project?: ProjectSchema, file?: PageFile | BlockFile): Promise<boolean>;
|
|
117
117
|
/**
|
|
118
118
|
* 上传静态文件
|
|
119
119
|
* @param file
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { BlockFile, PageFile, PlatformType, ProjectSchema } from '../protocols';
|
|
2
|
+
export type ProjectFile = BlockFile | PageFile;
|
|
3
|
+
export interface ProjectFileIndex {
|
|
4
|
+
byId: Map<string, ProjectFile>;
|
|
5
|
+
blockIdByImportPath: Map<string, string>;
|
|
6
|
+
blockIdBySourcePath: Map<string, string>;
|
|
7
|
+
pageIdBySourcePath: Map<string, string>;
|
|
8
|
+
}
|
|
9
|
+
export declare function normalizeFilePath(value?: string): string;
|
|
10
|
+
export declare function normalizeRoutePath(value?: string): string;
|
|
11
|
+
export declare function getFilePath(file: ProjectFile): string;
|
|
12
|
+
export declare function getPageNamePath(name: string): string;
|
|
13
|
+
export declare function getSourceFilePath(file: ProjectFile, platform?: PlatformType): string;
|
|
14
|
+
export declare function getBlockImportPath(block: BlockFile): string;
|
|
15
|
+
export declare function getPageRoutePath(page: PageFile, prefix?: string, routeName?: string): string;
|
|
16
|
+
export declare function getUniPagePath(page: PageFile): string;
|
|
17
|
+
export declare function flattenPages(pages?: PageFile[]): PageFile[];
|
|
18
|
+
export declare function createProjectFileIndex(project: Pick<ProjectSchema, 'pages' | 'blocks' | 'platform'>): ProjectFileIndex;
|
|
19
|
+
export declare function isValidFilePath(value?: string): boolean;
|
|
20
|
+
export declare function isValidRoutePath(value?: string): boolean;
|
package/types/tools/index.d.ts
CHANGED
package/types/version.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) 2026, VTJ.PRO All rights reserved.
|
|
3
3
|
* @name @vtj/core
|
|
4
4
|
* @author CHC chenhuachun1549@dingtalk.com
|
|
5
|
-
* @version 0.19.
|
|
5
|
+
* @version 0.19.23-alpha.0
|
|
6
6
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
|
7
7
|
*/
|
|
8
|
-
export declare const version = "0.19.
|
|
8
|
+
export declare const version = "0.19.23-alpha.0";
|