@incajs/cli 0.0.2 → 0.0.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/config.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as e, t } from "./chunks/defaults-EWjAFeZ3.js";
1
+ import { a as e, t } from "./chunks/defaults-D_1rymg4.js";
2
2
  //#region src/config/index.mts
3
3
  var n = e();
4
4
  //#endregion
@@ -17,6 +17,11 @@ export interface HostClientOptions {
17
17
  onReady?: () => void;
18
18
  /** An app's own event listener threw; the host caught it and kept rendering. */
19
19
  onAppError?: (error: AppErrorParams) => void;
20
+ /**
21
+ * The host exited on its own — its window was closed, or it crashed.
22
+ * Not called for the exit `stop()` asks for.
23
+ */
24
+ onExit?: (code: number | null, signal: NodeJS.Signals | null) => void;
20
25
  /**
21
26
  * Handlers for notification `method`s this package doesn't implement
22
27
  * itself (e.g. a future Vite integration), keyed by method name —
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Claims `cwd` for this process. Two `inca dev`s on one app watch the same
3
+ * files and interleave their output on one terminal, and an orphan left by
4
+ * an earlier run stays invisible until this says so. A lock whose pid is
5
+ * gone is taken over.
6
+ *
7
+ * @returns a function releasing the lock.
8
+ * @throws if another live `inca dev` holds `cwd`.
9
+ */
10
+ export declare function acquireDevLock(cwd: string): Promise<() => Promise<void>>;
package/dist/dev.d.mts CHANGED
@@ -20,6 +20,9 @@ export interface DevOptions {
20
20
  }
21
21
  /**
22
22
  * Builds the app, starts `inca-host` once the first build lands, and
23
- * reloads it on every rebuild — until `options.signal` aborts.
23
+ * reloads it on every rebuild — until `options.signal` aborts or the host
24
+ * exits on its own.
25
+ *
26
+ * @throws if another `inca dev` is already running for this app.
24
27
  */
25
28
  export declare function dev(options: DevOptions): Promise<void>;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * A failure the CLI raises itself, identified by an `ERR_INCA_*` code the
3
+ * way Node's own errors carry one. The code is what a user searches for
4
+ * and what `printFault` names alongside the message, so every distinct
5
+ * cause gets its own.
6
+ */
7
+ export declare class IncaError extends Error {
8
+ readonly code: string;
9
+ readonly name = "IncaError";
10
+ constructor(code: string, message: string);
11
+ }
package/dist/log.d.mts ADDED
@@ -0,0 +1,28 @@
1
+ /** Shared by {@link log} and {@link printFault}. */
2
+ export interface LogOptions {
3
+ /** Prefixes the line with `HH:MM:SS`, the way Vite's dev server stamps its own. */
4
+ timestamp?: boolean;
5
+ }
6
+ /** Writes one `[inca] <message>` line to `stream`. */
7
+ export declare function log(stream: NodeJS.WritableStream, message: string, options?: LogOptions): void;
8
+ /** A failure reduced to the message and stack worth printing. */
9
+ export interface Fault {
10
+ message: string;
11
+ stack: string | null;
12
+ /** An `ERR_INCA_*` identifier, when the failure has one to look up. */
13
+ code?: string | null;
14
+ }
15
+ /**
16
+ * Reduces an error a bundler re-wrapped: its text is kept whole — the
17
+ * excerpt a compiler points at is the useful part — while the error class
18
+ * and any `ERR_INCA_*` marker are lifted off the first line, the latter
19
+ * into the fault's code.
20
+ */
21
+ export declare function bundlerFault(message: string): Fault;
22
+ /** Reduces a thrown value to a {@link Fault}. A `HostError` carries the host process's stack. */
23
+ export declare function toFault(error: unknown): Fault;
24
+ /**
25
+ * Writes `[inca] <label> (<code>): <message>` to `stream` — the code only
26
+ * when the failure carries one — followed by the stack when there is one.
27
+ */
28
+ export declare function printFault(stream: NodeJS.WritableStream, label: string, fault: Fault, options?: LogOptions): void;
@@ -24,8 +24,10 @@ export interface PackageAppOptions {
24
24
  * process is running on.
25
25
  */
26
26
  target?: PackageTarget;
27
- /** Where progress notes go. Defaults to `process.stdout`. */
27
+ /** Where progress notes and the bundler's own output go. Defaults to `process.stdout`. */
28
28
  stdout?: NodeJS.WritableStream;
29
+ /** Where the bundler's warnings and errors go. Defaults to `process.stderr`. */
30
+ stderr?: NodeJS.WritableStream;
29
31
  }
30
32
  /** The result of a successful {@link packageApp} call. */
31
33
  export interface PackageResult {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@incajs/cli",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "description": "The inca CLI: watches an app's entry point through a bundler adapter, starts inca-host once the first bundle lands, and reloads it on every rebuild.",
5
5
  "keywords": [
6
6
  "bundler",
@@ -68,9 +68,9 @@
68
68
  }
69
69
  },
70
70
  "optionalDependencies": {
71
- "@incajs/host-darwin-arm64": "0.0.2",
72
- "@incajs/host-linux-arm64": "0.0.2",
73
- "@incajs/host-linux-x64": "0.0.2"
71
+ "@incajs/host-darwin-arm64": "0.0.3",
72
+ "@incajs/host-linux-arm64": "0.0.3",
73
+ "@incajs/host-linux-x64": "0.0.3"
74
74
  },
75
75
  "engines": {
76
76
  "node": ">=22.18"
package/dist/fault.d.mts DELETED
@@ -1,6 +0,0 @@
1
- export interface Fault {
2
- message: string;
3
- stack: string | null;
4
- }
5
- export declare function toFault(error: unknown): Fault;
6
- export declare function printFault(stream: NodeJS.WritableStream, label: string, fault: Fault): void;