diff --git a/app/srv/package.json b/app/srv/package.json index 7979c789..e58a57d8 100644 --- a/app/srv/package.json +++ b/app/srv/package.json @@ -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", diff --git a/app/srv/ws/sync/actions-def.ts b/app/srv/ws/sync/actions-def.ts index 0c588fe7..357ef278 100644 --- a/app/srv/ws/sync/actions-def.ts +++ b/app/srv/ws/sync/actions-def.ts @@ -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" }; diff --git a/app/srv/ws/sync/actions.ts b/app/srv/ws/sync/actions.ts index d32dd23b..a6286bdf 100644 --- a/app/srv/ws/sync/actions.ts +++ b/app/srv/ws/sync/actions.ts @@ -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, }, }; diff --git a/app/srv/ws/sync/actions/index.ts b/app/srv/ws/sync/actions/index.ts index 0fe4ab44..e01dcae8 100644 --- a/app/srv/ws/sync/actions/index.ts +++ b/app/srv/ws/sync/actions/index.ts @@ -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"; \ No newline at end of file +export * from "./client_info"; +export * from "./swc_parse"; \ No newline at end of file diff --git a/app/srv/ws/sync/actions/swc_parse.ts b/app/srv/ws/sync/actions/swc_parse.ts new file mode 100644 index 00000000..6f1f486a --- /dev/null +++ b/app/srv/ws/sync/actions/swc_parse.ts @@ -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>; + return result; +}; diff --git a/app/web/src/nova/ed/logic/ed-route.ts b/app/web/src/nova/ed/logic/ed-route.ts index 8660accd..295ce83a 100644 --- a/app/web/src/nova/ed/logic/ed-route.ts +++ b/app/web/src/nova/ed/logic/ed-route.ts @@ -91,4 +91,3 @@ export const edRoute = async (p: PG) => { } } }; - diff --git a/app/web/src/nova/ed/logic/tree/build.tsx b/app/web/src/nova/ed/logic/tree/build.tsx index 58d6a23a..8d6ca891 100644 --- a/app/web/src/nova/ed/logic/tree/build.tsx +++ b/app/web/src/nova/ed/logic/tree/build.tsx @@ -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(); + } }; diff --git a/bun.lockb b/bun.lockb index 74ee5f56..82cde963 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index e5dcd9a9..0e3d9d17 100644 --- a/package.json +++ b/package.json @@ -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" } }