@incajs/cli 0.0.8 → 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.
- package/README.md +2 -2
- package/dist/adapter/types.d.mts +10 -21
- package/dist/adapter/vite/build.d.mts +2 -1
- package/dist/adapter/vite/captureOutput.d.mts +2 -1
- package/dist/adapter/vite/config.d.mts +3 -1
- package/dist/adapter/vite/createBundler.d.mts +4 -0
- package/dist/adapter/vite/hmr.d.mts +25 -2
- package/dist/adapter/vite/index.d.mts +1 -3
- package/dist/adapter/vite/unsupported.d.mts +2 -1
- package/dist/adapter/vite/watch.d.mts +2 -1
- package/dist/adapterCore.d.mts +10 -0
- package/dist/chunks/{defaults-DNvHueCI.js → defaults-CKuLLRFh.js} +342 -266
- package/dist/chunks/{dist-BvTGFq3F.js → dist-AuwuGWnE.js} +28 -28
- package/dist/chunks/jsonc-BDHXk_1o.js +40 -0
- package/dist/chunks/{ohash-CHaRSTtv.js → ohash-Cc4pJh84.js} +1 -1
- package/dist/chunks/rolldown-runtime-Dy4uBu1J.js +11 -0
- package/dist/cli.js +487 -376
- package/dist/config/types.d.mts +1 -1
- package/dist/config.js +1 -1
- package/dist/dev-client/hostClient.d.mts +2 -0
- package/dist/dev.d.mts +10 -4
- package/dist/error.d.mts +5 -1
- package/dist/hmr-runtime.js +114 -112
- package/dist/log.d.mts +4 -0
- package/dist/retryOnEdit.d.mts +32 -0
- package/dist/watchForEdit.d.mts +27 -0
- package/package.json +11 -10
- package/dist/chunks/jsonc-BdzClvC8.js +0 -46
|
@@ -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.
|
|
3
|
+
"version": "0.0.10",
|
|
4
4
|
"description": "Dev server, bundler, and packager for Incarnative.js apps.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bundler",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"quickjs",
|
|
16
16
|
"vite"
|
|
17
17
|
],
|
|
18
|
-
"homepage": "https://tom96da.
|
|
18
|
+
"homepage": "https://incajs.tom96da.com/",
|
|
19
19
|
"license": "(MIT OR Apache-2.0)",
|
|
20
20
|
"repository": {
|
|
21
21
|
"type": "git",
|
|
@@ -50,14 +50,14 @@
|
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"@vitejs/plugin-vue": "^6.0.9",
|
|
53
|
-
"vite": "~8.3.
|
|
53
|
+
"vite": "~8.3.1"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@types/node": "^26.6.
|
|
56
|
+
"@types/node": "^26.6.3",
|
|
57
57
|
"@vue/runtime-core": "^3.5.43",
|
|
58
|
-
"c12": "4.0.0-rc.
|
|
59
|
-
"oxfmt": "^0.
|
|
60
|
-
"oxlint": "^1.
|
|
58
|
+
"c12": "4.0.0-rc.2",
|
|
59
|
+
"oxfmt": "^0.71.0",
|
|
60
|
+
"oxlint": "^1.86.0",
|
|
61
61
|
"rolldown": "~1.2.9",
|
|
62
62
|
"vue": "^3.5.43"
|
|
63
63
|
},
|
|
@@ -70,9 +70,10 @@
|
|
|
70
70
|
}
|
|
71
71
|
},
|
|
72
72
|
"optionalDependencies": {
|
|
73
|
-
"@incajs/host-darwin-arm64": "0.0.
|
|
74
|
-
"@incajs/host-
|
|
75
|
-
"@incajs/host-linux-
|
|
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"
|
|
76
77
|
},
|
|
77
78
|
"engines": {
|
|
78
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 };
|