wip fix swc parser
This commit is contained in:
parent
0b0494c9a4
commit
bb8b0b2630
|
|
@ -8,8 +8,6 @@
|
|||
"@paralleldrive/cuid2": "^2.2.2",
|
||||
"@types/mime-types": "^2.1.2",
|
||||
"esbuild": "^0.19.4",
|
||||
"@swc/core": "^1.3.96",
|
||||
"woodpile": "^0.0.5",
|
||||
"lmdb": "^2.8.5",
|
||||
"mime-types": "^2.1.35",
|
||||
"msgpackr": "^1.9.9",
|
||||
|
|
|
|||
|
|
@ -24,6 +24,9 @@ export const SyncActionDefinition = {
|
|||
"activity": "14",
|
||||
"client": {
|
||||
"info": "15"
|
||||
},
|
||||
"swc": {
|
||||
"parse": "16"
|
||||
}
|
||||
};
|
||||
export const SyncActionPaths = {
|
||||
|
|
@ -42,5 +45,6 @@ export const SyncActionPaths = {
|
|||
"12": "yjs.diff_local",
|
||||
"13": "yjs.sv_remote",
|
||||
"14": "activity",
|
||||
"15": "client.info"
|
||||
"15": "client.info",
|
||||
"16": "swc.parse"
|
||||
};
|
||||
|
|
|
|||
|
|
@ -91,8 +91,8 @@ export const SyncActions = {
|
|||
swc: {
|
||||
parse: async (
|
||||
arg:
|
||||
| { page_id: string; item_id?: string }
|
||||
| { comp_id: string; item_id?: string }
|
||||
| { type: "page", page_id: string; item_id?: string }
|
||||
| { type: "comp", comp_id: string; item_id?: string }
|
||||
) => ({}) as Record<string, string>,
|
||||
},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -13,4 +13,5 @@ export * from "./yjs_sv_local";
|
|||
export * from "./yjs_diff_local";
|
||||
export * from "./yjs_sv_remote";
|
||||
export * from "./activity";
|
||||
export * from "./client_info";
|
||||
export * from "./client_info";
|
||||
export * from "./swc_parse";
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
import { IContent } from "../../../../web/src/utils/types/general";
|
||||
import { SAction } from "../actions";
|
||||
import { docs } from "../entity/docs";
|
||||
import { SyncConnection } from "../type";
|
||||
|
||||
export const swc_parse: SAction["swc"]["parse"] = async function (
|
||||
this: SyncConnection,
|
||||
arg
|
||||
) {
|
||||
if (arg.type === "page") {
|
||||
let ydoc = docs.page[arg.page_id];
|
||||
if (ydoc) {
|
||||
const item = ydoc.doc.getMap("map").get("root")?.toJSON() as IContent;
|
||||
}
|
||||
}
|
||||
|
||||
let result = null as unknown as Awaited<ReturnType<SAction["swc"]["parse"]>>;
|
||||
return result;
|
||||
};
|
||||
|
|
@ -91,4 +91,3 @@ export const edRoute = async (p: PG) => {
|
|||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -62,10 +62,12 @@ export const treeRebuild = async (p: PG, arg?: { note?: string }) => {
|
|||
}
|
||||
}
|
||||
});
|
||||
await p.sync.swc.parse({ type: "page", page_id: p.page.cur.id });
|
||||
|
||||
p.page.building = false;
|
||||
p.render();
|
||||
p.page.render();
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "bun run --hot ./pkgs/core/index.ts dev",
|
||||
"clean": "m -rf app/static && rm -rf app/web/.parcel-cache",
|
||||
"clean": "rm -rf app/static && rm -rf app/web/.parcel-cache",
|
||||
"build": "bun run --silent ./pkgs/core/build.ts",
|
||||
"build-site": "bun run --silent ./pkgs/core/build-site.ts",
|
||||
"db-pull": "bun run ./pkgs/crm -rf data && rore/db-pull.ts",
|
||||
|
|
@ -27,6 +27,7 @@
|
|||
"dependencies": {
|
||||
"brotli-wasm": "^2.0.1",
|
||||
"fdir": "^6.1.0",
|
||||
"oxc-parser": "^0.2.0",
|
||||
"typescript": "^5.2.2"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue