@jay-framework/dev-server 0.15.2 → 0.15.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/dist/index.d.ts +5 -0
- package/dist/index.js +18 -6
- package/package.json +14 -14
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { JayRoute } from '@jay-framework/stack-route-scanner';
|
|
|
3
3
|
import { RequestHandler } from 'express-serve-static-core';
|
|
4
4
|
import { JayRollupConfig } from '@jay-framework/rollup-plugin';
|
|
5
5
|
import { LogLevel } from '@jay-framework/logger';
|
|
6
|
+
import { Server } from 'node:http';
|
|
6
7
|
import { ProjectClientInitInfo, PluginWithInit, ActionRegistry } from '@jay-framework/stack-server-runtime';
|
|
7
8
|
import { RequestHandler as RequestHandler$1 } from 'express';
|
|
8
9
|
import { JayRollupConfig as JayRollupConfig$1 } from '@jay-framework/compiler-jay-stack';
|
|
@@ -34,6 +35,8 @@ interface DevServerOptions {
|
|
|
34
35
|
* Controls both Jay logging and Vite logging.
|
|
35
36
|
*/
|
|
36
37
|
logLevel?: LogLevel;
|
|
38
|
+
/** HTTP server for HMR WebSocket attachment (avoids default port 24678 collision) */
|
|
39
|
+
httpServer?: Server;
|
|
37
40
|
}
|
|
38
41
|
|
|
39
42
|
/**
|
|
@@ -182,6 +185,8 @@ interface CreateViteServerOptions {
|
|
|
182
185
|
logLevel?: 'info' | 'warn' | 'error' | 'silent';
|
|
183
186
|
/** Whether to clear screen on rebuild */
|
|
184
187
|
clearScreen?: boolean;
|
|
188
|
+
/** HTTP server for HMR WebSocket (avoids default port 24678 collision) */
|
|
189
|
+
httpServer?: Server;
|
|
185
190
|
}
|
|
186
191
|
/**
|
|
187
192
|
* Creates a Vite server configured for Jay Stack.
|
package/dist/index.js
CHANGED
|
@@ -16,7 +16,7 @@ import { createRequire as createRequire$1 } from "node:module";
|
|
|
16
16
|
import * as fs from "node:fs";
|
|
17
17
|
import crypto from "node:crypto";
|
|
18
18
|
import { scanRoutes, routeToExpressRoute } from "@jay-framework/stack-route-scanner";
|
|
19
|
-
import { discoverPluginsWithInit, sortPluginsByDependencies, executePluginServerInits, runInitCallbacks, actionRegistry, discoverAndRegisterActions, discoverAllPluginActions, runShutdownCallbacks, clearLifecycleCallbacks, clearServiceRegistry, clearClientInitData, DevSlowlyChangingPhase, SlowRenderCache, preparePluginClientInits,
|
|
19
|
+
import { discoverPluginsWithInit, sortPluginsByDependencies, executePluginServerInits, runInitCallbacks, actionRegistry, discoverAndRegisterActions, discoverAllPluginActions, runShutdownCallbacks, clearLifecycleCallbacks, clearServiceRegistry, clearClientInitData, DevSlowlyChangingPhase, SlowRenderCache, preparePluginClientInits, clearServerElementCache, getServiceRegistry, materializeContracts, loadPageParts, renderFastChangingData, generateClientScript, getClientInitData, generateSSRPageHtml, validateForEachInstances, slowRenderInstances } from "@jay-framework/stack-server-runtime";
|
|
20
20
|
import fs$1 from "node:fs/promises";
|
|
21
21
|
import { pathToFileURL } from "node:url";
|
|
22
22
|
const s$1 = createRequire(import.meta.url), e$1 = s$1("typescript"), c$1 = new Proxy(e$1, {
|
|
@@ -1363,13 +1363,18 @@ async function createViteServer(options) {
|
|
|
1363
1363
|
base,
|
|
1364
1364
|
jayRollupConfig = { tsConfigFilePath: path__default.join(projectRoot, "tsconfig.json") },
|
|
1365
1365
|
logLevel = "info",
|
|
1366
|
-
clearScreen = true
|
|
1366
|
+
clearScreen = true,
|
|
1367
|
+
httpServer
|
|
1367
1368
|
} = options;
|
|
1368
1369
|
const instanceId = crypto.randomBytes(4).toString("hex");
|
|
1369
1370
|
const cacheDir = path__default.join(projectRoot, "node_modules", `.vite-${instanceId}`);
|
|
1370
1371
|
const vite = await createServer({
|
|
1371
1372
|
// Don't start HTTP server - we use middleware mode
|
|
1372
|
-
server: {
|
|
1373
|
+
server: {
|
|
1374
|
+
middlewareMode: true,
|
|
1375
|
+
hmr: httpServer ? { server: httpServer } : void 0,
|
|
1376
|
+
watch: { ignored: ["**/build/**"] }
|
|
1377
|
+
},
|
|
1373
1378
|
// Use Jay Stack compiler for .jay-html and other custom transforms
|
|
1374
1379
|
plugins: [...jayStackCompiler(jayRollupConfig)],
|
|
1375
1380
|
// Custom app type (no default middleware)
|
|
@@ -1857,7 +1862,8 @@ function defaults(options) {
|
|
|
1857
1862
|
jayRollupConfig: {
|
|
1858
1863
|
...options.jayRollupConfig || {},
|
|
1859
1864
|
tsConfigFilePath
|
|
1860
|
-
}
|
|
1865
|
+
},
|
|
1866
|
+
httpServer: options.httpServer
|
|
1861
1867
|
};
|
|
1862
1868
|
}
|
|
1863
1869
|
function handleOtherResponseCodes(res, renderedResult) {
|
|
@@ -2443,7 +2449,8 @@ async function mkDevServer(rawOptions) {
|
|
|
2443
2449
|
pagesRoot: pagesRootFolder,
|
|
2444
2450
|
base: publicBaseUrlPath,
|
|
2445
2451
|
jayRollupConfig,
|
|
2446
|
-
logLevel: viteLogLevel
|
|
2452
|
+
logLevel: viteLogLevel,
|
|
2453
|
+
httpServer: options.httpServer
|
|
2447
2454
|
});
|
|
2448
2455
|
lifecycleManager.setViteServer(vite);
|
|
2449
2456
|
await lifecycleManager.initialize();
|
|
@@ -2520,28 +2527,33 @@ function setupSlowRenderCacheInvalidation(vite, cache, pagesRootFolder) {
|
|
|
2520
2527
|
return;
|
|
2521
2528
|
}
|
|
2522
2529
|
if (changedPath.endsWith(".jay-html")) {
|
|
2523
|
-
|
|
2530
|
+
clearServerElementCache();
|
|
2524
2531
|
cache.invalidate(changedPath).then(() => {
|
|
2525
2532
|
getLogger().info(`[SlowRender] Cache invalidated for ${changedPath}`);
|
|
2533
|
+
vite.ws.send({ type: "full-reload" });
|
|
2526
2534
|
});
|
|
2527
2535
|
return;
|
|
2528
2536
|
}
|
|
2529
2537
|
if (changedPath.endsWith("page.ts")) {
|
|
2530
2538
|
const dir = path__default.dirname(changedPath);
|
|
2531
2539
|
const jayHtmlPath = path__default.join(dir, "page.jay-html");
|
|
2540
|
+
clearServerElementCache();
|
|
2532
2541
|
cache.invalidate(jayHtmlPath).then(() => {
|
|
2533
2542
|
getLogger().info(
|
|
2534
2543
|
`[SlowRender] Cache invalidated for ${jayHtmlPath} (page.ts changed)`
|
|
2535
2544
|
);
|
|
2545
|
+
vite.ws.send({ type: "full-reload" });
|
|
2536
2546
|
});
|
|
2537
2547
|
return;
|
|
2538
2548
|
}
|
|
2539
2549
|
if (changedPath.endsWith(".jay-contract")) {
|
|
2540
2550
|
const jayHtmlPath = changedPath.replace(".jay-contract", ".jay-html");
|
|
2551
|
+
clearServerElementCache();
|
|
2541
2552
|
cache.invalidate(jayHtmlPath).then(() => {
|
|
2542
2553
|
getLogger().info(
|
|
2543
2554
|
`[SlowRender] Cache invalidated for ${jayHtmlPath} (contract changed)`
|
|
2544
2555
|
);
|
|
2556
|
+
vite.ws.send({ type: "full-reload" });
|
|
2545
2557
|
});
|
|
2546
2558
|
return;
|
|
2547
2559
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jay-framework/dev-server",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -23,22 +23,22 @@
|
|
|
23
23
|
"test:watch": "vitest"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@jay-framework/compiler-jay-stack": "^0.15.
|
|
27
|
-
"@jay-framework/compiler-shared": "^0.15.
|
|
28
|
-
"@jay-framework/component": "^0.15.
|
|
29
|
-
"@jay-framework/fullstack-component": "^0.15.
|
|
30
|
-
"@jay-framework/logger": "^0.15.
|
|
31
|
-
"@jay-framework/runtime": "^0.15.
|
|
32
|
-
"@jay-framework/stack-client-runtime": "^0.15.
|
|
33
|
-
"@jay-framework/stack-route-scanner": "^0.15.
|
|
34
|
-
"@jay-framework/stack-server-runtime": "^0.15.
|
|
35
|
-
"@jay-framework/view-state-merge": "^0.15.
|
|
26
|
+
"@jay-framework/compiler-jay-stack": "^0.15.3",
|
|
27
|
+
"@jay-framework/compiler-shared": "^0.15.3",
|
|
28
|
+
"@jay-framework/component": "^0.15.3",
|
|
29
|
+
"@jay-framework/fullstack-component": "^0.15.3",
|
|
30
|
+
"@jay-framework/logger": "^0.15.3",
|
|
31
|
+
"@jay-framework/runtime": "^0.15.3",
|
|
32
|
+
"@jay-framework/stack-client-runtime": "^0.15.3",
|
|
33
|
+
"@jay-framework/stack-route-scanner": "^0.15.3",
|
|
34
|
+
"@jay-framework/stack-server-runtime": "^0.15.3",
|
|
35
|
+
"@jay-framework/view-state-merge": "^0.15.3",
|
|
36
36
|
"vite": "^5.0.11"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@jay-framework/dev-environment": "^0.15.
|
|
40
|
-
"@jay-framework/jay-cli": "^0.15.
|
|
41
|
-
"@jay-framework/stack-client-runtime": "^0.15.
|
|
39
|
+
"@jay-framework/dev-environment": "^0.15.3",
|
|
40
|
+
"@jay-framework/jay-cli": "^0.15.3",
|
|
41
|
+
"@jay-framework/stack-client-runtime": "^0.15.3",
|
|
42
42
|
"@playwright/test": "^1.58.2",
|
|
43
43
|
"@types/express": "^5.0.2",
|
|
44
44
|
"@types/node": "^22.15.21",
|