@luckystack/devkit 0.13.0 → 0.15.0
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/AGENTS.md +1 -1
- package/CHANGELOG.md +27 -0
- package/dist/chunk-FWE6YJ3G.js +17 -0
- package/dist/chunk-FWE6YJ3G.js.map +1 -0
- package/dist/devServerRestart.d.ts +12 -0
- package/dist/index.js +157 -118
- package/dist/index.js.map +1 -1
- package/dist/supervisor.d.ts +5 -0
- package/dist/supervisor.js +17 -2
- package/dist/supervisor.js.map +1 -1
- package/dist/templateInjector.d.ts +5 -1
- package/dist/templates/api.template.ts +2 -1
- package/dist/templates/page_dashboard.template.tsx +3 -7
- package/dist/templates/page_plain.template.tsx +4 -9
- package/dist/templates/sync_client.template.ts +3 -2
- package/dist/templates/sync_client_paired.template.ts +2 -1
- package/dist/templates/sync_client_standalone.template.ts +2 -1
- package/dist/templates/sync_server.template.ts +2 -1
- package/docs/hot-reload.md +2 -2
- package/docs/supervisor.md +1 -1
- package/package.json +2 -2
package/AGENTS.md
CHANGED
|
@@ -6,4 +6,4 @@ Generated route contracts must preserve transport-safe types. A source file miss
|
|
|
6
6
|
|
|
7
7
|
The one deliberate diagnostics exception — an absent optional sync side — must stay scoped to that side's own field and run after the thrown-extraction check (ADR 0057). Server-backed sync routes share the API side's auth/rate-limit extractors and schema converter so the test-runner can sweep them (ADR 0064). See `docs/type-map-generation.md`.
|
|
8
8
|
|
|
9
|
-
Hot reload
|
|
9
|
+
Hot reload does pause request handling while it builds the TypeScript Program and regenerates the type map: that work is synchronous, and deferring it only lets the current event finish. The pause is accepted for development; keep its duration logged and keep generation off the boot path so the server listens first. Do not describe it as non-blocking (see `docs/hot-reload.md`). Avoid invalidating the shared Program on initial population without cause; do invalidate when source changes. Consumer-owned template overrides intentionally outlive the installed devkit's bundled defaults; do not overwrite them on upgrade.
|
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,33 @@ All notable changes to `@luckystack/devkit` are documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.15.0] - 2026-10-19
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
|
|
12
|
+
- **Editing a file that a route imports restarts the supervised dev server** (`npm run server`), so the new code actually runs; connected clients reconnect (ADR 0079). Before, the route was re-imported but kept running the old dependency code. The supervisor now starts the dev server with an IPC channel for this (Node; Bun on Linux and macOS). Without the supervisor, a warning says a restart is needed. Editing a route file itself still reloads it in place.
|
|
13
|
+
- **Hot reload logs how long type-map regeneration and each route reload took.** The docs now say the dev server answers no requests during that time (ADR 0080).
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
|
|
17
|
+
- **The dev server starts, and type generation runs, when a `.test.ts` or `.spec.ts` file sits next to a route.**
|
|
18
|
+
- **A project checked out under a folder named `_api` or `_sync` boots again.** Route naming is validated relative to the source folder.
|
|
19
|
+
- **The duplicate-route check reports a root sync** (`src/_sync/x_server_v1.ts`) that collides with `src/system/_sync/x_server_v1.ts`, as it already did for APIs.
|
|
20
|
+
- **Deleting a sync `_server` file moves the real `clientInput` type into the paired client** instead of an empty placeholder, and that client rewrite is no longer lost when another sync file is saved within the reload debounce window.
|
|
21
|
+
- **Helpers in a private folder under `_api`/`_sync`** (for example `_api/_lib/helpers.ts`) **and test files next to routes are no longer treated as misnamed routes:** a new empty helper gets no guidance comment written into it, there is no false "ignored by route loading" warning, and editing a helper regenerates types and reloads the routes that use it.
|
|
22
|
+
- **The paired-sync rewrite writes the correct `PagePath`** when the project lives under a folder named `src`, uses a different source folder, or uses a custom sync marker.
|
|
23
|
+
- **A fully commented-out route or page file that arrives by rename, move, `git checkout` or `stash pop` is no longer overwritten with the starter template.** Only empty files, or files that still hold only the injector's guidance line, receive a template.
|
|
24
|
+
- **Route reloads after a dependency change honour a custom source folder and custom route markers.**
|
|
25
|
+
- **Writing the generated Zod schema file no longer triggers a second full type-map generation.**
|
|
26
|
+
- **Saving a watched file while the supervisor waits to restart a crashed server no longer starts two server processes.**
|
|
27
|
+
|
|
28
|
+
## [0.14.0] - 2026-10-16
|
|
29
|
+
|
|
30
|
+
### Fixed
|
|
31
|
+
|
|
32
|
+
- **Injected route and page files no longer start with a blanket `eslint-disable`.** The dev watcher copied the template's own lint-disable header into each new file, which silenced all lint there and, once the file was clean, failed lint as an unused directive. The header is now dropped on injection, for the bundled templates and for project copies in `.luckystack/templates/`; the template files keep it, and a template saved with a byte-order mark loses it too. Files injected earlier keep their header until you delete those two lines.
|
|
33
|
+
- **Injected route and page files pass the scaffold's lint.** Without the header the template bodies failed it: an empty `({ })` parameter, an `async` sync handler without `await`, unused page props, a stray `@ts-ignore` in the page templates and untranslated placeholder text. `main` now takes no parameters (a comment shows what to destructure), the legacy `sync_client` template returns `MaybePromise`, pages take no props until they need them. The empty `{}` input/output shapes stay, because the type generator and the sync-pairing rewrite read them; the scaffold's ESLint config allows them in `_api` and `_sync` files (`create-luckystack-app` 0.14.0). In an existing project, `npx luckystack update` brings the new `.luckystack/templates/` copies and `eslint.official.config.js` (an edited copy gets a `.new` sidecar to merge).
|
|
34
|
+
|
|
8
35
|
## [0.12.0] - 2026-10-15
|
|
9
36
|
|
|
10
37
|
### Changed
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// src/devServerRestart.ts
|
|
2
|
+
var DEV_RESTART_MESSAGE_TYPE = "luckystack:dev-restart";
|
|
3
|
+
var isDevRestartMessage = (value) => typeof value === "object" && value !== null && "type" in value && value.type === DEV_RESTART_MESSAGE_TYPE && "reason" in value && typeof value.reason === "string";
|
|
4
|
+
var requestDevServerRestart = (reason) => {
|
|
5
|
+
if (process.env.LUCKYSTACK_CORE_SUPERVISED !== "true") return false;
|
|
6
|
+
if (typeof process.send !== "function" || !process.connected) return false;
|
|
7
|
+
const message = { type: DEV_RESTART_MESSAGE_TYPE, reason };
|
|
8
|
+
return process.send(message, void 0, void 0, (error) => {
|
|
9
|
+
if (error) console.log(`[HotReload] Could not ask the supervisor to restart: ${String(error)}`, "red");
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export {
|
|
14
|
+
isDevRestartMessage,
|
|
15
|
+
requestDevServerRestart
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=chunk-FWE6YJ3G.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/devServerRestart.ts"],"sourcesContent":["//? Restart request from the dev server (child) to the supervisor (parent).\n//?\n//? Why a restart and not a reload: hot reload re-imports a route with a `?v=`\n//? query, but the ESM loader caches the route's own imports by their plain URL.\n//? After a helper the route imports changes, the re-imported route still links\n//? to the cached OLD helper, so only a fresh process runs the new code. No\n//? loader hook can carry the query down the import graph under both tsx and\n//? Bun, so the supervisor restarts the child, the same way it does for a\n//? `config.ts` edit.\n//?\n//? This module is bundled into the supervisor entry, so it must import nothing\n//? from `@luckystack/core` (see the env invariant in `supervisor.ts`).\n\nexport const DEV_RESTART_MESSAGE_TYPE = 'luckystack:dev-restart';\n\nexport interface DevRestartMessage {\n type: typeof DEV_RESTART_MESSAGE_TYPE;\n reason: string;\n}\n\nexport const isDevRestartMessage = (value: unknown): value is DevRestartMessage =>\n typeof value === 'object'\n && value !== null\n && 'type' in value\n && value.type === DEV_RESTART_MESSAGE_TYPE\n && 'reason' in value\n && typeof value.reason === 'string';\n\n/**\n * Ask the supervisor to restart this dev server. Returns false when nothing\n * can restart it (started without the supervisor, or no IPC channel), so the\n * caller can tell the developer to restart by hand.\n */\nexport const requestDevServerRestart = (reason: string): boolean => {\n if (process.env.LUCKYSTACK_CORE_SUPERVISED !== 'true') return false;\n if (typeof process.send !== 'function' || !process.connected) return false;\n\n const message: DevRestartMessage = { type: DEV_RESTART_MESSAGE_TYPE, reason };\n //? The callback keeps a failed send from surfacing as an unhandled 'error'.\n return process.send(message, undefined, undefined, (error: Error | null) => {\n if (error) console.log(`[HotReload] Could not ask the supervisor to restart: ${String(error)}`, 'red');\n });\n};\n"],"mappings":";AAaO,IAAM,2BAA2B;AAOjC,IAAM,sBAAsB,CAAC,UAClC,OAAO,UAAU,YACd,UAAU,QACV,UAAU,SACV,MAAM,SAAS,4BACf,YAAY,SACZ,OAAO,MAAM,WAAW;AAOtB,IAAM,0BAA0B,CAAC,WAA4B;AAClE,MAAI,QAAQ,IAAI,+BAA+B,OAAQ,QAAO;AAC9D,MAAI,OAAO,QAAQ,SAAS,cAAc,CAAC,QAAQ,UAAW,QAAO;AAErE,QAAM,UAA6B,EAAE,MAAM,0BAA0B,OAAO;AAE5E,SAAO,QAAQ,KAAK,SAAS,QAAW,QAAW,CAAC,UAAwB;AAC1E,QAAI,MAAO,SAAQ,IAAI,wDAAwD,OAAO,KAAK,CAAC,IAAI,KAAK;AAAA,EACvG,CAAC;AACH;","names":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const DEV_RESTART_MESSAGE_TYPE = "luckystack:dev-restart";
|
|
2
|
+
export interface DevRestartMessage {
|
|
3
|
+
type: typeof DEV_RESTART_MESSAGE_TYPE;
|
|
4
|
+
reason: string;
|
|
5
|
+
}
|
|
6
|
+
export declare const isDevRestartMessage: (value: unknown) => value is DevRestartMessage;
|
|
7
|
+
/**
|
|
8
|
+
* Ask the supervisor to restart this dev server. Returns false when nothing
|
|
9
|
+
* can restart it (started without the supervisor, or no IPC channel), so the
|
|
10
|
+
* caller can tell the developer to restart by hand.
|
|
11
|
+
*/
|
|
12
|
+
export declare const requestDevServerRestart: (reason: string) => boolean;
|