@incajs/cli 0.0.9 → 0.0.10

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.
@@ -4,7 +4,7 @@
4
4
  * deprecated — this file wins where both are present.
5
5
  */
6
6
  export interface IncaConfig {
7
- /** Path to an icon file, resolved relative to this config file's own directory. */
7
+ /** Path to an icon file, resolved from the app's root directory. */
8
8
  icon?: string;
9
9
  /**
10
10
  * A reverse-DNS-style unique id — e.g. macOS's `CFBundleIdentifier`.
package/dist/config.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as e, t } from "./chunks/defaults-Bl2pge8b.js";
1
+ import { a as e, t } from "./chunks/defaults-CKuLLRFh.js";
2
2
  //#region src/config/index.mts
3
3
  var n = e();
4
4
  //#endregion
package/dist/dev.d.mts CHANGED
@@ -31,9 +31,15 @@ export interface DevOptions {
31
31
  * reloads it on every rebuild — until `options.signal` aborts or the host
32
32
  * exits on its own.
33
33
  *
34
- * @throws if another `inca dev` is already running for this app, or if the
35
- * host binary can't be resolved or isn't a file. Both stop it before any build.
36
- * Also throws if the host exits before it is ready, or exits non-zero or by
37
- * a signal other than SIGINT/SIGTERM afterwards.
34
+ * A config or entry that can't be used before the first build is printed as
35
+ * `build failed`. `dev` then retries after the next edit to the config or the
36
+ * entry.
37
+ *
38
+ * @throws if another `inca dev` is already running for this app.
39
+ * @throws if the host binary can't be resolved or isn't a file.
40
+ * @throws if `experimentalHmr` is set and the bundler has no HMR support.
41
+ * @throws if the operating system refuses a file watcher.
42
+ * @throws if the host exits before it is ready, or exits non-zero or by a
43
+ * signal other than SIGINT/SIGTERM afterwards.
38
44
  */
39
45
  export declare function dev(options: DevOptions): Promise<void>;
package/dist/error.d.mts CHANGED
@@ -6,6 +6,10 @@
6
6
  */
7
7
  export declare class IncaError extends Error {
8
8
  readonly code: string;
9
+ /** A file whose creation or change may resolve the error. */
10
+ readonly path?: string | undefined;
9
11
  readonly name = "IncaError";
10
- constructor(code: string, message: string);
12
+ constructor(code: string, message: string,
13
+ /** A file whose creation or change may resolve the error. */
14
+ path?: string | undefined);
11
15
  }
package/dist/log.d.mts CHANGED
@@ -3,6 +3,10 @@ export interface LogOptions {
3
3
  /** Prefixes the line with `HH:MM:SS`, the way Vite's dev server stamps its own. */
4
4
  timestamp?: boolean;
5
5
  }
6
+ /** `inca dev` stamps its lines the way Vite's dev server does. */
7
+ export declare const STAMPED: {
8
+ readonly timestamp: true;
9
+ };
6
10
  /** Writes one `[inca] <message>` line to `stream`. */
7
11
  export declare function log(stream: NodeJS.WritableStream, message: string, options?: LogOptions): void;
8
12
  /** A failure reduced to the message and stack worth printing. */
@@ -0,0 +1,32 @@
1
+ import { EditWatch } from './watchForEdit.mts';
2
+ /** Options for {@link retryOnEdit}. */
3
+ export interface RetryOnEditOptions<T> {
4
+ /** The app's root directory. */
5
+ cwd: string;
6
+ /** Aborting ends the wait. */
7
+ signal: AbortSignal;
8
+ /** Receives the progress lines. */
9
+ stdout: NodeJS.WritableStream;
10
+ /** Receives each failure. */
11
+ stderr: NodeJS.WritableStream;
12
+ /** How long edits must stay quiet before the next attempt. Defaults to 100. */
13
+ debounceMs?: number;
14
+ /**
15
+ * One try. A thrown value is printed and the attempt repeats after the
16
+ * next relevant edit. `watch` is live for the whole try.
17
+ */
18
+ attempt(watch: EditWatch): Promise<T>;
19
+ }
20
+ /**
21
+ * Runs `attempt` until it succeeds. A failure is printed as `build failed`,
22
+ * then the call waits for an edit to a file that may fix it and tries again.
23
+ * An `IncaError` that names a `path` adds that file to the watch. When that
24
+ * file already exists, the call retries once at once and prints nothing. A
25
+ * second failure in a row is printed and waits for an edit.
26
+ *
27
+ * @param options - the attempt and where to report
28
+ * @returns the value of the first attempt that succeeds, or `undefined` when `signal` aborts first
29
+ * @throws if the operating system refuses a watcher. The failure that led to
30
+ * a refused `add` is printed first.
31
+ */
32
+ export declare function retryOnEdit<T>(options: RetryOnEditOptions<T>): Promise<T | undefined>;
@@ -0,0 +1,27 @@
1
+ /** A watch that resolves once, when a file that could fix a failed start is saved. */
2
+ export interface EditWatch {
3
+ /** Resolves once, after a relevant change has been quiet for the debounce. */
4
+ readonly edited: Promise<void>;
5
+ /** Also watches `file`, which may be missing. A change to that file counts. */
6
+ add(file: string): void;
7
+ /** Stops every watcher and timer. Safe to call more than once. */
8
+ close(): void;
9
+ }
10
+ /**
11
+ * Watches the files that decide whether an app can start: `inca.config.*`
12
+ * and `package.json` in `cwd`, `src/main.mts` and `src/App.vue`, and every
13
+ * file passed to {@link EditWatch.add}. Creating, deleting, changing or
14
+ * renaming one of them counts as an edit. Edits to other files are ignored.
15
+ *
16
+ * The watchers are live when this returns, so a save made while the caller
17
+ * is working counts. An edit made before the caller awaits
18
+ * `edited` keeps it resolved.
19
+ *
20
+ * @param cwd - the app's root directory
21
+ * @param options.debounceMs - how long changes must stay quiet before `edited` resolves. Defaults to 100.
22
+ * @returns the watch. Call `close()` when done with it.
23
+ * @throws if the operating system refuses a watcher, for example when it is out of file handles
24
+ */
25
+ export declare function watchForEdit(cwd: string, options?: {
26
+ debounceMs?: number;
27
+ }): EditWatch;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@incajs/cli",
3
- "version": "0.0.9",
3
+ "version": "0.0.10",
4
4
  "description": "Dev server, bundler, and packager for Incarnative.js apps.",
5
5
  "keywords": [
6
6
  "bundler",
@@ -70,10 +70,10 @@
70
70
  }
71
71
  },
72
72
  "optionalDependencies": {
73
- "@incajs/host-darwin-arm64": "0.0.9",
74
- "@incajs/host-darwin-x64": "0.0.9",
75
- "@incajs/host-linux-arm64": "0.0.9",
76
- "@incajs/host-linux-x64": "0.0.9"
73
+ "@incajs/host-darwin-arm64": "0.0.10",
74
+ "@incajs/host-darwin-x64": "0.0.10",
75
+ "@incajs/host-linux-arm64": "0.0.10",
76
+ "@incajs/host-linux-x64": "0.0.10"
77
77
  },
78
78
  "engines": {
79
79
  "node": ">=22.18"
@@ -1,46 +0,0 @@
1
- import { n as e, t } from "./_format-BKs7bsc4.js";
2
- //#region \0rolldown/runtime.js
3
- var n = Object.defineProperty, r = (e, t) => {
4
- let r = {};
5
- for (var i in e) n(r, i, {
6
- get: e[i],
7
- enumerable: !0
8
- });
9
- return t || n(r, Symbol.toStringTag, { value: "Module" }), r;
10
- }, i = Symbol("singleComment"), a = Symbol("multiComment"), o = () => "", s = (e, t, n) => e.slice(t, n).replace(/[^ \t\r\n]/g, " "), c = (e, t) => {
11
- let n = t - 1, r = 0;
12
- for (; e[n] === "\\";) --n, r += 1;
13
- return !!(r % 2);
14
- };
15
- function l(e, { whitespace: t = !0, trailingCommas: n = !1 } = {}) {
16
- if (typeof e != "string") throw TypeError(`Expected argument \`jsonString\` to be a \`string\`, got \`${typeof e}\``);
17
- let r = t ? s : o, l = !1, u = !1, d = 0, f = "", p = "", m = -1;
18
- for (let t = 0; t < e.length; t++) {
19
- let o = e[t], s = e[t + 1];
20
- if (!u && o === "\"" && (c(e, t) || (l = !l)), !l) {
21
- if (!u && o + s === "//") f += e.slice(d, t), d = t, u = i, t++;
22
- else if (u === i && o + s === "\r\n") {
23
- t++, u = !1, f += r(e, d, t), d = t;
24
- continue;
25
- } else if (u === i && o === "\n") u = !1, f += r(e, d, t), d = t;
26
- else if (!u && o + s === "/*") {
27
- f += e.slice(d, t), d = t, u = a, t++;
28
- continue;
29
- } else if (u === a && o + s === "*/") {
30
- t++, u = !1, f += r(e, d, t + 1), d = t + 1;
31
- continue;
32
- } else n && !u && (m === -1 ? o === "," && (p += f + e.slice(d, t), f = "", d = t, m = t) : o === "}" || o === "]" ? (f += e.slice(d, t), p += r(f, 0, 1) + f.slice(1), f = "", d = t, m = -1) : o !== " " && o !== " " && o !== "\r" && o !== "\n" && (f += e.slice(d, t), d = t, m = -1));
33
- }
34
- }
35
- let h = u === i ? r(e, d) : e.slice(d);
36
- return p + f + h;
37
- }
38
- //#endregion
39
- //#region ../../node_modules/.pnpm/confbox@0.3.1/node_modules/confbox/dist/jsonc.mjs
40
- var u = /* @__PURE__ */ r({ parseJSONC: () => d });
41
- function d(n, r) {
42
- let i = JSON.parse(l(t(n), { trailingCommas: r?.allowTrailingComma }));
43
- return e(n, i, r), i;
44
- }
45
- //#endregion
46
- export { u as n, d as t };