@deepseek-ai/dsh-client-hmr 0.0.1-rc.2 → 0.0.1-rc.3
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/lib/index.js +9 -9
- package/lib/types/index.d.ts +1 -1
- package/package.json +9 -9
package/lib/index.js
CHANGED
|
@@ -24,7 +24,7 @@ const EVENTS_ENDPOINT = "/plugins/events";
|
|
|
24
24
|
/** Cordis plugin name. */
|
|
25
25
|
const name = "client-hmr";
|
|
26
26
|
/** Required services: the web plugin table and the route registry. */
|
|
27
|
-
const inject = ["
|
|
27
|
+
const inject = ["clientModules", "webServer"];
|
|
28
28
|
const Config = z.object({ pollIntervalMs: z.number().step(1).min(1).default(500) });
|
|
29
29
|
/** Serialize one frame as an SSE data line. */
|
|
30
30
|
function sseData(frame) {
|
|
@@ -32,7 +32,7 @@ function sseData(frame) {
|
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
34
34
|
* Mount the dev chain: bundle watches, rebuilt reporting, and the SSE channel.
|
|
35
|
-
* @param ctx - host plugin context carrying clientModuleHost and
|
|
35
|
+
* @param ctx - host plugin context carrying clientModuleHost and webServer.
|
|
36
36
|
* @param config - validated {@link Config}.
|
|
37
37
|
*/
|
|
38
38
|
function apply(ctx, config) {
|
|
@@ -40,7 +40,7 @@ function apply(ctx, config) {
|
|
|
40
40
|
const watched = /* @__PURE__ */ new Map();
|
|
41
41
|
const rehash = (id, watch, current) => {
|
|
42
42
|
try {
|
|
43
|
-
ctx.
|
|
43
|
+
ctx.clientModules.rebuilt(id);
|
|
44
44
|
} catch (error) {
|
|
45
45
|
if (error.code === "ENOENT") {
|
|
46
46
|
watch.dirty = true;
|
|
@@ -91,8 +91,8 @@ function apply(ctx, config) {
|
|
|
91
91
|
};
|
|
92
92
|
const syncWatches = () => {
|
|
93
93
|
const rows = /* @__PURE__ */ new Map();
|
|
94
|
-
for (const row of ctx.
|
|
95
|
-
const path = ctx.
|
|
94
|
+
for (const row of ctx.clientModules.graph().entries) {
|
|
95
|
+
const path = ctx.clientModules.clientPath(row.id);
|
|
96
96
|
if (path !== void 0) rows.set(row.id, path);
|
|
97
97
|
}
|
|
98
98
|
for (const [id, watch] of watched) {
|
|
@@ -103,7 +103,7 @@ function apply(ctx, config) {
|
|
|
103
103
|
};
|
|
104
104
|
ctx.effect(() => {
|
|
105
105
|
syncWatches();
|
|
106
|
-
const unsubscribe = ctx.
|
|
106
|
+
const unsubscribe = ctx.clientModules.onGraphChanged(syncWatches);
|
|
107
107
|
const timer = setInterval(pollWatches, pollIntervalMs);
|
|
108
108
|
timer.unref();
|
|
109
109
|
return () => {
|
|
@@ -122,7 +122,7 @@ function apply(ctx, config) {
|
|
|
122
122
|
res.write(": connected\n\n");
|
|
123
123
|
res.write(sseData({
|
|
124
124
|
type: "graph",
|
|
125
|
-
graph: ctx.
|
|
125
|
+
graph: ctx.clientModules.graph()
|
|
126
126
|
}));
|
|
127
127
|
connections.add(res);
|
|
128
128
|
res.on("close", () => {
|
|
@@ -130,7 +130,7 @@ function apply(ctx, config) {
|
|
|
130
130
|
});
|
|
131
131
|
};
|
|
132
132
|
ctx.effect(() => {
|
|
133
|
-
const disposeRoute = ctx.
|
|
133
|
+
const disposeRoute = ctx.webServer.register({
|
|
134
134
|
kind: "exact",
|
|
135
135
|
path: EVENTS_ENDPOINT,
|
|
136
136
|
handler: (req, res) => {
|
|
@@ -142,7 +142,7 @@ function apply(ctx, config) {
|
|
|
142
142
|
connect(res);
|
|
143
143
|
}
|
|
144
144
|
});
|
|
145
|
-
const unsubscribe = ctx.
|
|
145
|
+
const unsubscribe = ctx.clientModules.onRebuilt((id, rev) => {
|
|
146
146
|
const line = sseData({
|
|
147
147
|
type: "rebuilt",
|
|
148
148
|
id,
|
package/lib/types/index.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export interface Config {
|
|
|
14
14
|
export declare const Config: z<Config>;
|
|
15
15
|
/**
|
|
16
16
|
* Mount the dev chain: bundle watches, rebuilt reporting, and the SSE channel.
|
|
17
|
-
* @param ctx - host plugin context carrying clientModuleHost and
|
|
17
|
+
* @param ctx - host plugin context carrying clientModuleHost and webServer.
|
|
18
18
|
* @param config - validated {@link Config}.
|
|
19
19
|
*/
|
|
20
20
|
export declare function apply(ctx: Context, config: Config): void;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepseek-ai/dsh-client-hmr",
|
|
3
3
|
"description": "Dev-only hot-reload driver for script-loaded client entries: SSE rebuilt frames → invalidate/prefetch → fiber swap through the vendored Loader entry",
|
|
4
|
-
"version": "0.0.1-rc.
|
|
4
|
+
"version": "0.0.1-rc.3",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "restricted"
|
|
7
7
|
},
|
|
@@ -41,18 +41,18 @@
|
|
|
41
41
|
"@deepseek-ai/schemastery": "^3.18.1-rc.1"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
|
+
"@deepseek-ai/dsh-client-modules": "^0.0.1-rc.3",
|
|
44
45
|
"@deepseek-ai/cordis-plugin-loader": "^1.0.1-rc.1",
|
|
45
|
-
"@deepseek-ai/dsh-
|
|
46
|
-
"@deepseek-ai/
|
|
47
|
-
"@deepseek-ai/dsh-
|
|
48
|
-
"@deepseek-ai/cordis": "^4.0.1-rc.1"
|
|
46
|
+
"@deepseek-ai/dsh-invariants": "^0.0.1-rc.3",
|
|
47
|
+
"@deepseek-ai/cordis": "^4.0.1-rc.1",
|
|
48
|
+
"@deepseek-ai/dsh-host-webserver": "^0.0.1-rc.3"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@deepseek-ai/cordis-plugin-loader": "^1.0.1-rc.1",
|
|
52
|
-
"@deepseek-ai/dsh-
|
|
53
|
-
"@deepseek-ai/dsh-
|
|
54
|
-
"@deepseek-ai/
|
|
55
|
-
"@deepseek-ai/
|
|
52
|
+
"@deepseek-ai/dsh-host-webserver": "^0.0.1-rc.3",
|
|
53
|
+
"@deepseek-ai/dsh-client-modules": "^0.0.1-rc.3",
|
|
54
|
+
"@deepseek-ai/dsh-invariants": "^0.0.1-rc.3",
|
|
55
|
+
"@deepseek-ai/cordis": "^4.0.1-rc.1"
|
|
56
56
|
},
|
|
57
57
|
"files": [
|
|
58
58
|
"lib/index.js",
|