@incajs/cli 0.0.9 → 0.0.11
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 +1 -1
- 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 +7 -3
- package/dist/adapter/vite/createBundler.d.mts +8 -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/build.d.mts +1 -1
- package/dist/chunks/defaults-TOBTBbDy.js +22 -0
- package/dist/chunks/dist-Bc5Uk6dY.js +733 -0
- package/dist/chunks/{dist-DAXzdDML.js → dist-Bp_FYhnk.js} +33 -33
- package/dist/chunks/jsonc-BDHXk_1o.js +40 -0
- package/dist/chunks/rolldown-runtime-Dy4uBu1J.js +11 -0
- package/dist/cli.js +1031 -419
- package/dist/config/index.d.mts +1 -1
- package/dist/config/loader.d.mts +2 -1
- package/dist/config/types.d.mts +4 -3
- package/dist/config.js +3 -3
- package/dist/defaultBundler.d.mts +2 -1
- package/dist/dev.d.mts +11 -5
- package/dist/entry.d.mts +9 -3
- package/dist/error.d.mts +5 -1
- package/dist/log.d.mts +4 -0
- package/dist/package.d.mts +1 -1
- package/dist/retryOnEdit.d.mts +32 -0
- package/dist/watchForEdit.d.mts +27 -0
- package/package.json +5 -5
- package/dist/chunks/defaults-Bl2pge8b.js +0 -1262
- package/dist/chunks/jsonc-BdzClvC8.js +0 -46
- /package/dist/{dev-lock.d.mts → devLock.d.mts} +0 -0
- /package/dist/{macos-app.d.mts → macosApp.d.mts} +0 -0
package/dist/config/index.d.mts
CHANGED
package/dist/config/loader.d.mts
CHANGED
|
@@ -56,7 +56,7 @@ export declare function resolveBuildConfig(cwd: string): Promise<ResolvedBuildCo
|
|
|
56
56
|
*
|
|
57
57
|
* @param cwd - the app's root directory
|
|
58
58
|
* @returns the resolved config
|
|
59
|
-
* @throws if `package.json` is missing, has neither a `name` nor a
|
|
59
|
+
* @throws if `package.json` is missing, holds malformed JSON, has neither a `name` nor a
|
|
60
60
|
* `productName`, an `icon` doesn't resolve to a real file, or `outDir`
|
|
61
61
|
* would hold the app's own files
|
|
62
62
|
*/
|
|
@@ -75,5 +75,6 @@ export declare function runtimeConfigOf(config: ResolvedAppConfig): RuntimeConfi
|
|
|
75
75
|
*
|
|
76
76
|
* @param cwd - the app's root directory
|
|
77
77
|
* @returns the config, or `undefined` when the app declares none of it
|
|
78
|
+
* @throws if `package.json` exists and holds malformed JSON
|
|
78
79
|
*/
|
|
79
80
|
export declare function resolveRuntimeConfig(cwd: string): Promise<RuntimeConfig | undefined>;
|
package/dist/config/types.d.mts
CHANGED
|
@@ -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
|
|
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`.
|
|
@@ -23,8 +23,9 @@ export interface IncaConfig {
|
|
|
23
23
|
version?: string;
|
|
24
24
|
/**
|
|
25
25
|
* The app's entry point.
|
|
26
|
-
* @default resolved automatically — a committed `src/main.mts`,
|
|
27
|
-
* `src/App.vue` wrapped in a
|
|
26
|
+
* @default resolved automatically — a committed `src/main.mts`,
|
|
27
|
+
* `src/main.ts` or `src/main.js`, or `src/App.vue` wrapped in a
|
|
28
|
+
* synthesized one
|
|
28
29
|
*/
|
|
29
30
|
entry?: string;
|
|
30
31
|
/**
|
package/dist/config.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as e } from "./chunks/defaults-TOBTBbDy.js";
|
|
2
2
|
//#region src/config/index.mts
|
|
3
|
-
var
|
|
3
|
+
var t = (e) => e;
|
|
4
4
|
//#endregion
|
|
5
|
-
export {
|
|
5
|
+
export { e as defaultConfig, t as defineConfig };
|
|
@@ -2,6 +2,7 @@ import { Bundler } from './adapter/types.mts';
|
|
|
2
2
|
/**
|
|
3
3
|
* `adapter/vite` wired in as the one adapter `dev` and `build` share by
|
|
4
4
|
* default — a single place to swap bundlers, and the reason they can't
|
|
5
|
-
* drift onto different ones.
|
|
5
|
+
* drift onto different ones. Compiled `.vue` templates import their helpers
|
|
6
|
+
* from `incajs/vue/runtime`.
|
|
6
7
|
*/
|
|
7
8
|
export declare const defaultBundler: Bundler;
|
package/dist/dev.d.mts
CHANGED
|
@@ -4,7 +4,7 @@ export interface DevOptions {
|
|
|
4
4
|
cwd?: string;
|
|
5
5
|
/**
|
|
6
6
|
* The app's entry point. Defaults to resolving it automatically: a
|
|
7
|
-
* committed `src/main.mts`, or `src/App.vue` wrapped in a synthesized one.
|
|
7
|
+
* committed `src/main.mts`, `src/main.ts` or `src/main.js`, or `src/App.vue` wrapped in a synthesized one.
|
|
8
8
|
*/
|
|
9
9
|
entry?: string;
|
|
10
10
|
/** Overrides the bundler — see {@link defaultBundler} for what's wired in by default. */
|
|
@@ -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
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
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/entry.d.mts
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
|
+
export declare const MAIN_FILES: string[];
|
|
1
2
|
/**
|
|
2
|
-
* Resolves an app's entry point. `src/main.mts`,
|
|
3
|
-
*
|
|
4
|
-
*
|
|
3
|
+
* Resolves an app's entry point. A `src/main.mts`, `src/main.ts` or
|
|
4
|
+
* `src/main.js` committed by the app wins outright, in that order, and is
|
|
5
|
+
* used verbatim for full control over bootstrapping. Otherwise
|
|
6
|
+
* `src/App.vue` is wrapped in a synthesized entry equivalent to
|
|
5
7
|
* `createIncaApp(App).mount()`, so a plain `.vue` file is a whole app
|
|
6
8
|
* with no configuration at all.
|
|
9
|
+
*
|
|
10
|
+
* @param cwd - the app's root directory
|
|
11
|
+
* @returns the path of the entry file
|
|
12
|
+
* @throws if none of the main files and no `src/App.vue` exists
|
|
7
13
|
*/
|
|
8
14
|
export declare function resolveEntry(cwd: string): Promise<string>;
|
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. */
|
package/dist/package.d.mts
CHANGED
|
@@ -7,7 +7,7 @@ export interface PackageAppOptions {
|
|
|
7
7
|
cwd?: string;
|
|
8
8
|
/**
|
|
9
9
|
* The app's entry point. Defaults to resolving it the same way `inca
|
|
10
|
-
* dev`/`build` do: a committed `src/main.mts`, or `src/App.vue` wrapped
|
|
10
|
+
* dev`/`build` do: a committed `src/main.mts`, `src/main.ts` or `src/main.js`, or `src/App.vue` wrapped
|
|
11
11
|
* in a synthesized one.
|
|
12
12
|
*/
|
|
13
13
|
entry?: string;
|
|
@@ -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`, `src/main.ts`, `src/main.js` 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.11",
|
|
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.
|
|
74
|
-
"@incajs/host-darwin-x64": "0.0.
|
|
75
|
-
"@incajs/host-linux-arm64": "0.0.
|
|
76
|
-
"@incajs/host-linux-x64": "0.0.
|
|
73
|
+
"@incajs/host-darwin-arm64": "0.0.11",
|
|
74
|
+
"@incajs/host-darwin-x64": "0.0.11",
|
|
75
|
+
"@incajs/host-linux-arm64": "0.0.11",
|
|
76
|
+
"@incajs/host-linux-x64": "0.0.11"
|
|
77
77
|
},
|
|
78
78
|
"engines": {
|
|
79
79
|
"node": ">=22.18"
|