optimize file format

This commit is contained in:
codetypes committed 2025-03-18 09:12:46 +08:00
1 parent e8ae056461
commit 53c1912fa0
9 files changed
+162 -215

No files matched your search

+4 -6
View File
@@ -51,12 +51,10 @@ export interface TreeModel {
name: string;
desc?: string;
export?: boolean;
firstid?: number;
group?: string[];
declare?: {
imports?: string[];
vars?: VarDef[];
};
firstid: number;
group: string[];
import: string[];
declvar: VarDef[];
root: NodeModel;
}
+6 -2
View File
@@ -700,6 +700,10 @@ export const createFileData = (data: TreeGraphData, includeSubtree?: boolean) =>
export const createNewTree = (path: string) => {
const tree: TreeModel = {
name: Path.basenameWithoutExt(path),
firstid: 1,
group: [],
import: [],
declvar: [],
root: {
id: 1,
name: "Sequence",
@@ -729,8 +733,8 @@ export const loadVarDef = (list: ImportDef[]) => {
filter.set(path, true);
try {
const model: TreeModel = readTree(`${workdir}/${path}`);
model.declare?.vars?.forEach((v) => vars.push(v));
model.declare?.imports?.forEach((v) => load(v));
model.declvar.forEach((v) => vars.push(v));
model.import.forEach((v) => load(v));
} catch (e) {
alertError(`parsing error: ${path}`);
}