@jxsuite/server 2.2.5 → 2.2.7
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 +12 -12
- package/src/studio-api.ts +9 -68
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jxsuite/server",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.7",
|
|
4
4
|
"description": "Jx development server with live reload, server-side proxy, and studio integration",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -38,21 +38,21 @@
|
|
|
38
38
|
"upgrade": "bunx npm-check-updates -u && bun install"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@jxsuite/collab": "^0.8.
|
|
42
|
-
"@jxsuite/compiler": "^2.0.
|
|
43
|
-
"@jxsuite/create": "^1.3.
|
|
44
|
-
"@jxsuite/import": "^0.39.
|
|
45
|
-
"@jxsuite/protocol": "^1.2.
|
|
46
|
-
"@jxsuite/runtime": "^2.0.
|
|
47
|
-
"@jxsuite/schema": "^1.8.
|
|
48
|
-
"@jxsuite/starters": "^1.6.
|
|
41
|
+
"@jxsuite/collab": "^0.8.2",
|
|
42
|
+
"@jxsuite/compiler": "^2.0.7",
|
|
43
|
+
"@jxsuite/create": "^1.3.6",
|
|
44
|
+
"@jxsuite/import": "^0.39.7",
|
|
45
|
+
"@jxsuite/protocol": "^1.2.1",
|
|
46
|
+
"@jxsuite/runtime": "^2.0.5",
|
|
47
|
+
"@jxsuite/schema": "^1.8.1",
|
|
48
|
+
"@jxsuite/starters": "^1.6.3",
|
|
49
49
|
"chokidar": "^5.0.0",
|
|
50
50
|
"kysely": "^0.29.5",
|
|
51
51
|
"zod": "^4.4.3"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@jxsuite/auth": "^0.5.
|
|
55
|
-
"@jxsuite/connector": "^0.5.
|
|
56
|
-
"@jxsuite/parser": "^1.5.
|
|
54
|
+
"@jxsuite/auth": "^0.5.4",
|
|
55
|
+
"@jxsuite/connector": "^0.5.4",
|
|
56
|
+
"@jxsuite/parser": "^1.5.5"
|
|
57
57
|
}
|
|
58
58
|
}
|
package/src/studio-api.ts
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { basename, dirname, extname, isAbsolute, join, relative, resolve } from "node:path";
|
|
11
|
+
import { componentMetaFrom } from "@jxsuite/schema/component-meta";
|
|
11
12
|
import { errorMessage } from "@jxsuite/schema/parse";
|
|
12
13
|
import { mkdir, readFile, readdir, rename, stat, unlink, writeFile } from "node:fs/promises";
|
|
13
14
|
import { existsSync, readFileSync, statSync, unlinkSync } from "node:fs";
|
|
@@ -93,38 +94,6 @@ interface ComponentDoc {
|
|
|
93
94
|
[key: string]: unknown;
|
|
94
95
|
}
|
|
95
96
|
|
|
96
|
-
interface SlotDef {
|
|
97
|
-
name: string;
|
|
98
|
-
fallback?: unknown[];
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Collect slot definitions (name + fallback children) from a parsed component tree. Whitespace-only
|
|
103
|
-
* names count as unnamed (""). Only static children arrays are walked.
|
|
104
|
-
*/
|
|
105
|
-
function collectSlotDefs(node: unknown, out: SlotDef[] = []): SlotDef[] {
|
|
106
|
-
if (!node || typeof node !== "object" || Array.isArray(node)) {
|
|
107
|
-
return out;
|
|
108
|
-
}
|
|
109
|
-
const el = node as Record<string, unknown>;
|
|
110
|
-
if (el.tagName === "slot") {
|
|
111
|
-
const attrs = el.attributes as Record<string, unknown> | undefined;
|
|
112
|
-
const rawName = attrs?.name;
|
|
113
|
-
const name = typeof rawName === "string" ? rawName.trim() : "";
|
|
114
|
-
const { children } = el;
|
|
115
|
-
out.push({
|
|
116
|
-
name,
|
|
117
|
-
...(Array.isArray(children) && children.length > 0 ? { fallback: children } : {}),
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
if (Array.isArray(el.children)) {
|
|
121
|
-
for (const c of el.children) {
|
|
122
|
-
collectSlotDefs(c, out);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
return out;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
97
|
// ─── Extension registry (per project root, invalidated on project.json change) ──
|
|
129
98
|
|
|
130
99
|
const extensionRegistryCache = new Map<string, { mtime: number; registry: ExtensionRegistry }>();
|
|
@@ -792,42 +761,14 @@ export async function handleStudioApi(
|
|
|
792
761
|
const source = await readFile(fp, "utf8");
|
|
793
762
|
content = (await entry.call("parse", source)) as ComponentDoc;
|
|
794
763
|
}
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
if (d == null) {
|
|
804
|
-
return false;
|
|
805
|
-
}
|
|
806
|
-
// Shorthand: "key": "value" or "key": 0 etc.
|
|
807
|
-
if (typeof d !== "object") {
|
|
808
|
-
return true;
|
|
809
|
-
}
|
|
810
|
-
// Full form: skip computed/handler/prototype entries
|
|
811
|
-
const obj = d as Record<string, unknown>;
|
|
812
|
-
return !obj.$prototype && !obj.$handler && !obj.$compute;
|
|
813
|
-
})
|
|
814
|
-
.map(([name, d]) => {
|
|
815
|
-
if (typeof d !== "object" || d === null) {
|
|
816
|
-
// Shorthand: infer type from value
|
|
817
|
-
return { default: d, name, type: typeof d };
|
|
818
|
-
}
|
|
819
|
-
const obj = d as Record<string, unknown>;
|
|
820
|
-
return {
|
|
821
|
-
default: obj.default,
|
|
822
|
-
format: obj.format,
|
|
823
|
-
name,
|
|
824
|
-
type: obj.type,
|
|
825
|
-
};
|
|
826
|
-
}),
|
|
827
|
-
...(slotDefs.length > 0 ? { slots: slotDefs } : {}),
|
|
828
|
-
source: "jx",
|
|
829
|
-
tagName: content.tagName,
|
|
830
|
-
});
|
|
764
|
+
/* The metadata rules live in @jxsuite/schema/component-meta because THREE backends need
|
|
765
|
+
the same answer — this one, the desktop session, and now the cloud adapter, which can
|
|
766
|
+
discover JSON components precisely because deriving them executes nothing. Two copies
|
|
767
|
+
had already drifted apart in wording; a third would have made "which state entries are
|
|
768
|
+
props" a question with three answers. */
|
|
769
|
+
const meta = componentMetaFrom(content, fwd(match));
|
|
770
|
+
if (meta) {
|
|
771
|
+
components.push({ ...meta, source: "jx" });
|
|
831
772
|
}
|
|
832
773
|
} catch {} // Skip non-JSON or parse errors
|
|
833
774
|
}
|