@jxsuite/server 4.4.5 → 4.5.1
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 +10 -10
- package/src/ai-api.ts +8 -4
- package/src/build.ts +6 -6
- package/src/code-api.ts +29 -16
- package/src/collab.ts +9 -5
- package/src/data-api.ts +190 -137
- package/src/dev-vars.ts +28 -4
- package/src/dev.ts +3 -0
- package/src/extension-catalog.ts +62 -32
- package/src/import-api.ts +95 -53
- package/src/jx-mounts.ts +30 -33
- package/src/live-preview.ts +16 -10
- package/src/oauth-loopback.ts +23 -18
- package/src/packages.ts +26 -36
- package/src/problem.ts +3 -6
- package/src/project-server.ts +34 -4
- package/src/refactor/apply.ts +3 -2
- package/src/refactor/find-refs.ts +0 -0
- package/src/refactor/fs-events.ts +14 -15
- package/src/refactor/paths.ts +11 -3
- package/src/refactor/refs.ts +60 -63
- package/src/refactor/scan.ts +13 -19
- package/src/refactor/watcher.ts +5 -5
- package/src/resolve.ts +235 -83
- package/src/server.ts +51 -29
- package/src/site-output.ts +11 -5
- package/src/sse.ts +16 -2
- package/src/studio-api.ts +264 -115
- package/src/types.ts +17 -7
- package/src/watch.ts +8 -6
package/src/types.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { JsonValue } from "@jxsuite/schema/types";
|
|
2
|
+
|
|
1
3
|
export interface BuildEntry {
|
|
2
4
|
entrypoints: string[];
|
|
3
5
|
outdir: string;
|
|
@@ -16,11 +18,12 @@ export interface ClassJsonField {
|
|
|
16
18
|
access?: string;
|
|
17
19
|
scope?: string;
|
|
18
20
|
identifier?: string;
|
|
19
|
-
initializer?:
|
|
20
|
-
default?:
|
|
21
|
-
|
|
21
|
+
initializer?: JsonValue;
|
|
22
|
+
default?: JsonValue;
|
|
23
|
+
/** A JSON Schema fragment; only an object (or array) form is merged into the studio schema. */
|
|
24
|
+
type?: JsonValue;
|
|
22
25
|
description?: string;
|
|
23
|
-
examples?:
|
|
26
|
+
examples?: JsonValue[];
|
|
24
27
|
}
|
|
25
28
|
|
|
26
29
|
export interface ClassJsonMethod {
|
|
@@ -31,21 +34,28 @@ export interface ClassJsonMethod {
|
|
|
31
34
|
getter?: { body: string };
|
|
32
35
|
setter?: { parameters?: ClassJsonParam[]; body: string };
|
|
33
36
|
parameters?: ClassJsonParam[];
|
|
34
|
-
returns?:
|
|
37
|
+
returns?: JsonValue;
|
|
38
|
+
/** Where a format-extension capability method may run (`compiler`, `server`, `client`). */
|
|
39
|
+
timing?: string[];
|
|
35
40
|
}
|
|
36
41
|
|
|
37
42
|
export interface ClassJsonParameterDef {
|
|
38
43
|
identifier?: string;
|
|
39
|
-
|
|
44
|
+
/** A JSON Schema fragment; only an object (or array) form is merged into the studio schema. */
|
|
45
|
+
type?: JsonValue;
|
|
40
46
|
format?: string;
|
|
41
47
|
description?: string;
|
|
42
|
-
examples?:
|
|
48
|
+
examples?: JsonValue[];
|
|
43
49
|
}
|
|
44
50
|
|
|
45
51
|
export interface ClassJsonDef {
|
|
46
52
|
title?: string;
|
|
47
53
|
description?: string;
|
|
48
54
|
$implementation?: string;
|
|
55
|
+
/** A format extension's format block, surfaced to the studio verbatim. */
|
|
56
|
+
format?: JsonValue;
|
|
57
|
+
/** Studio presentation hints, surfaced verbatim. */
|
|
58
|
+
$studio?: JsonValue;
|
|
49
59
|
extends?: { $ref?: string };
|
|
50
60
|
$defs?: {
|
|
51
61
|
fields?: Record<string, ClassJsonField>;
|
package/src/watch.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/** Watch.js — File watcher + SSE live reload */
|
|
2
2
|
|
|
3
|
-
import { watch
|
|
3
|
+
import { watch } from "chokidar";
|
|
4
4
|
import { relative } from "node:path";
|
|
5
|
+
import { errorMessage } from "@jxsuite/schema/parse";
|
|
5
6
|
import { rebuild } from "./build.ts";
|
|
6
7
|
import { coalesceFsEvents, toFsEvent } from "./refactor/fs-events.ts";
|
|
7
8
|
import { createWatchIgnore } from "./watch-policy.ts";
|
|
@@ -109,7 +110,7 @@ export function createWatcher(
|
|
|
109
110
|
let fsTimer: ReturnType<typeof setTimeout> | null = null;
|
|
110
111
|
let fsBuffer: FsEventPayload[] = [];
|
|
111
112
|
const fsDebounceMs = 40;
|
|
112
|
-
const watcher =
|
|
113
|
+
const watcher = watch(root, {
|
|
113
114
|
awaitWriteFinish: {
|
|
114
115
|
pollInterval: 10,
|
|
115
116
|
stabilityThreshold: debounceMs,
|
|
@@ -152,7 +153,7 @@ export function createWatcher(
|
|
|
152
153
|
try {
|
|
153
154
|
await preReload(filename);
|
|
154
155
|
} catch (error) {
|
|
155
|
-
console.error(`[watch] preReload failed: ${(error
|
|
156
|
+
console.error(`[watch] preReload failed: ${errorMessage(error)}`);
|
|
156
157
|
}
|
|
157
158
|
}
|
|
158
159
|
if (builds.length > 0) {
|
|
@@ -174,11 +175,12 @@ export function createWatcher(
|
|
|
174
175
|
|
|
175
176
|
// Gracefully handle watch errors (e.g. EINVAL on transient Bun test dirs).
|
|
176
177
|
watcher.on("error", (err) => {
|
|
177
|
-
|
|
178
|
-
|
|
178
|
+
// Chokidar forwards the fs watcher's own errors, which are Error instances carrying a message.
|
|
179
|
+
const message = err instanceof Error ? err.message : undefined;
|
|
180
|
+
if (message?.includes("EINVAL")) {
|
|
179
181
|
return;
|
|
180
182
|
}
|
|
181
|
-
console.error("[watch] chokidar error:",
|
|
183
|
+
console.error("[watch] chokidar error:", message ?? err);
|
|
182
184
|
});
|
|
183
185
|
|
|
184
186
|
return { broadcast, broadcastEvent, handleSSE, watcher };
|