@incajs/cli 0.0.3 → 0.0.5
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 +12 -6
- package/dist/adapter/types.d.mts +18 -27
- package/dist/adapter/vite/build.d.mts +1 -2
- package/dist/adapter/vite/captureOutput.d.mts +3 -0
- package/dist/adapter/vite/config.d.mts +3 -1
- package/dist/adapter/vite/emitConfig.d.mts +11 -0
- package/dist/adapter/vite/watch.d.mts +0 -1
- package/dist/build.d.mts +3 -1
- package/dist/chunks/{defaults-D_1rymg4.js → defaults-DNvHueCI.js} +10 -8
- package/dist/chunks/{dist-DZ5asakr.js → dist-BvTGFq3F.js} +1 -1
- package/dist/cli.js +372 -273
- package/dist/config/defaults.d.mts +2 -1
- package/dist/config/loader.d.mts +29 -0
- package/dist/config/types.d.mts +31 -0
- package/dist/config.js +1 -1
- package/dist/dev-client/hostClient.d.mts +8 -2
- package/dist/dev.d.mts +4 -1
- package/dist/index.d.mts +0 -1
- package/dist/macos-app.d.mts +47 -0
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -43,7 +43,7 @@ export default defineConfig({
|
|
|
43
43
|
productName: "Click Counter",
|
|
44
44
|
// macOS's CFBundleIdentifier or equivalent
|
|
45
45
|
identifier: "com.example.click-counter",
|
|
46
|
-
// the
|
|
46
|
+
// the app's icon file
|
|
47
47
|
icon: "assets/icon.icns",
|
|
48
48
|
});
|
|
49
49
|
```
|
|
@@ -51,13 +51,19 @@ export default defineConfig({
|
|
|
51
51
|
An `identifier` should be world-unique, so `inca package` prints a note
|
|
52
52
|
when it falls back to the generated one rather than using it silently.
|
|
53
53
|
|
|
54
|
+
On macOS, `inca dev` launches the app under its `productName`, `icon` and
|
|
55
|
+
`identifier`, so the Dock and the menu bar show the same app they will
|
|
56
|
+
once it is packaged.
|
|
57
|
+
|
|
54
58
|
## Requirements
|
|
55
59
|
|
|
56
|
-
|
|
57
|
-
optional dependency
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
60
|
+
A prebuilt binary is pulled in automatically as a platform-specific
|
|
61
|
+
optional dependency — neither Cargo nor Rust are needed. See
|
|
62
|
+
[Host binary](https://tom96da.github.io/incajs/guide/#host-binary) for
|
|
63
|
+
per-platform support.
|
|
64
|
+
|
|
65
|
+
Set `INCA_HOST_BIN` to use a specific binary instead, e.g. on a
|
|
66
|
+
platform with no published one yet, or a custom build.
|
|
61
67
|
|
|
62
68
|
## How it works
|
|
63
69
|
|
package/dist/adapter/types.d.mts
CHANGED
|
@@ -3,39 +3,17 @@ export interface Watcher {
|
|
|
3
3
|
/** Stops watching and releases the underlying build process. */
|
|
4
4
|
close(): Promise<void>;
|
|
5
5
|
}
|
|
6
|
-
/** Options for {@link Bundler.watch}. */
|
|
7
|
-
export interface BundlerOptions {
|
|
8
|
-
/** The app's own entry point — may import `.vue` files. */
|
|
9
|
-
entry: string;
|
|
10
|
-
/** Where the build's output is written. */
|
|
11
|
-
outDir: string;
|
|
12
|
-
/** `"development"` keeps a framework's own warnings; `"production"` strips them. */
|
|
13
|
-
mode: "development" | "production";
|
|
14
|
-
/** Called after each successful (re)build, with what it wrote. */
|
|
15
|
-
onBuild: (output: BuildOutput) => void;
|
|
16
|
-
/** Called instead of `onBuild` when a (re)build fails. */
|
|
17
|
-
onError: (error: {
|
|
18
|
-
message: string;
|
|
19
|
-
stack: string | null;
|
|
20
|
-
code?: string | null;
|
|
21
|
-
}) => void;
|
|
22
|
-
/** Where the bundler's own output goes. Defaults to `process.stdout`. */
|
|
23
|
-
stdout?: NodeJS.WritableStream;
|
|
24
|
-
/** Where the bundler's warnings and errors go. Defaults to `process.stderr`. */
|
|
25
|
-
stderr?: NodeJS.WritableStream;
|
|
26
|
-
/**
|
|
27
|
-
* Drops the bundler's progress output and size report, leaving the
|
|
28
|
-
* per-build summary. Set it when the build has to stay silent: part of
|
|
29
|
-
* that output goes to the process's own stdout, not to `stdout` above.
|
|
30
|
-
*/
|
|
31
|
-
quiet?: boolean;
|
|
32
|
-
}
|
|
33
6
|
/** Options for {@link Bundler.build}. */
|
|
34
7
|
export interface BuildOptions {
|
|
35
8
|
/** The app's own entry point — may import `.vue` files. */
|
|
36
9
|
entry: string;
|
|
37
10
|
/** Where the build's output is written. */
|
|
38
11
|
outDir: string;
|
|
12
|
+
/**
|
|
13
|
+
* Values the built app carries for `inca-host` to read — its name, id
|
|
14
|
+
* and window. Any JSON-serializable object.
|
|
15
|
+
*/
|
|
16
|
+
runtimeConfig?: unknown;
|
|
39
17
|
/** Where the bundler's own output goes. Defaults to `process.stdout`. */
|
|
40
18
|
stdout?: NodeJS.WritableStream;
|
|
41
19
|
/** Where the bundler's warnings and errors go. Defaults to `process.stderr`. */
|
|
@@ -47,6 +25,19 @@ export interface BuildOptions {
|
|
|
47
25
|
*/
|
|
48
26
|
quiet?: boolean;
|
|
49
27
|
}
|
|
28
|
+
/** Options for {@link Bundler.watch}. */
|
|
29
|
+
export interface BundlerOptions extends BuildOptions {
|
|
30
|
+
/** `"development"` keeps a framework's own warnings; `"production"` strips them. */
|
|
31
|
+
mode: "development" | "production";
|
|
32
|
+
/** Called after each successful (re)build, with what it wrote. */
|
|
33
|
+
onBuild: (output: BuildOutput) => void;
|
|
34
|
+
/** Called instead of `onBuild` when a (re)build fails. */
|
|
35
|
+
onError: (error: {
|
|
36
|
+
message: string;
|
|
37
|
+
stack: string | null;
|
|
38
|
+
code?: string | null;
|
|
39
|
+
}) => void;
|
|
40
|
+
}
|
|
50
41
|
/** What a build wrote — the result of {@link Bundler.build}, and every {@link BundlerOptions.onBuild} call. */
|
|
51
42
|
export interface BuildOutput {
|
|
52
43
|
/** Directory holding every file this build emitted. */
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { BuildOptions, BuildOutput } from '../types.mts';
|
|
2
|
-
export type { BuildOptions, BuildOutput } from '../types.mts';
|
|
3
2
|
/**
|
|
4
3
|
* Builds `entry` into a minified, production build under `outDir` once, and
|
|
5
4
|
* rejects on failure rather than reporting it through a callback. Never
|
|
6
5
|
* starts or talks to `inca-host` — that's `dev.mts`'s job.
|
|
7
6
|
*/
|
|
8
|
-
export declare function build({ entry, outDir, stdout, stderr, quiet, }: BuildOptions): Promise<BuildOutput>;
|
|
7
|
+
export declare function build({ entry, outDir, runtimeConfig, stdout, stderr, quiet, }: BuildOptions): Promise<BuildOutput>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Plugin } from 'vite';
|
|
2
|
+
import { BuildOutput } from '../types.mts';
|
|
2
3
|
/** What one (re)build actually wrote, relative to its own `outDir`. */
|
|
3
4
|
export interface CapturedOutput {
|
|
4
5
|
/** The emitted chunk marked as this build's entry. */
|
|
@@ -6,6 +7,8 @@ export interface CapturedOutput {
|
|
|
6
7
|
/** Every emitted file, as the bundler reported it. */
|
|
7
8
|
files: readonly string[];
|
|
8
9
|
}
|
|
10
|
+
/** Resolves `captured`'s paths against `outDir` into a {@link BuildOutput}. */
|
|
11
|
+
export declare function toBuildOutput(outDir: string, captured: CapturedOutput, changed?: BuildOutput["changed"]): BuildOutput;
|
|
9
12
|
/**
|
|
10
13
|
* A Vite plugin reporting `sink` the files a build wrote once they land on
|
|
11
14
|
* disk, via `writeBundle` — the one hook that fires uniformly for a
|
|
@@ -18,6 +18,8 @@ export interface ResolveConfigOptions {
|
|
|
18
18
|
stderr: NodeJS.WritableStream;
|
|
19
19
|
/** Silences the bundler's progress output — see the `quiet` option in `../types.mts`. */
|
|
20
20
|
quiet: boolean;
|
|
21
|
+
/** Written beside the entry — see the `runtimeConfig` option in `../types.mts`. */
|
|
22
|
+
runtimeConfig?: unknown;
|
|
21
23
|
}
|
|
22
24
|
/**
|
|
23
25
|
* Builds the Vite config shared by `watch` and `build`, compiling `.vue`
|
|
@@ -29,4 +31,4 @@ export interface ResolveConfigOptions {
|
|
|
29
31
|
* the entry, named by `chunkFileNames`/`assetFileNames` below, rather than
|
|
30
32
|
* failing the build.
|
|
31
33
|
*/
|
|
32
|
-
export declare function resolveViteConfig({ entry, outDir, mode, watch, onOutput, stdout, stderr, quiet, }: ResolveConfigOptions): InlineConfig;
|
|
34
|
+
export declare function resolveViteConfig({ entry, outDir, mode, watch, onOutput, stdout, stderr, quiet, runtimeConfig, }: ResolveConfigOptions): InlineConfig;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Plugin } from 'vite';
|
|
2
|
+
/** The file a build writes its app's config to, beside the entry. */
|
|
3
|
+
export declare const CONFIG_FILE_NAME = "inca.json";
|
|
4
|
+
/**
|
|
5
|
+
* Writes `config` to `inca.json` beside the entry, for `inca-host` to read
|
|
6
|
+
* when it starts the app.
|
|
7
|
+
*
|
|
8
|
+
* @param config - any JSON-serializable value; no file is written for
|
|
9
|
+
* `undefined` or an object with no keys
|
|
10
|
+
*/
|
|
11
|
+
export declare function emitConfig(config: unknown): Plugin;
|
package/dist/build.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Bundler, BuildOutput } from './adapter/types.mts';
|
|
2
|
-
import { ResolvedBuildConfig } from './config/loader.mts';
|
|
2
|
+
import { ResolvedBuildConfig, RuntimeConfig } from './config/loader.mts';
|
|
3
3
|
export interface BuildAppOptions {
|
|
4
4
|
/** The app's root directory. Defaults to `process.cwd()`. */
|
|
5
5
|
cwd?: string;
|
|
@@ -12,6 +12,8 @@ export interface BuildAppOptions {
|
|
|
12
12
|
bundler?: Bundler;
|
|
13
13
|
/** An already-resolved config — lets `packageApp` avoid loading it twice. */
|
|
14
14
|
config?: ResolvedBuildConfig;
|
|
15
|
+
/** What the build carries for `inca-host` to read. Resolved from the app's config when absent. */
|
|
16
|
+
runtimeConfig?: RuntimeConfig;
|
|
15
17
|
/** Where the bundler's own output goes. Defaults to `process.stdout`. */
|
|
16
18
|
stdout?: NodeJS.WritableStream;
|
|
17
19
|
/** Where the bundler's warnings and errors go. Defaults to `process.stderr`. */
|
|
@@ -1002,7 +1002,7 @@ async function Wt(e) {
|
|
|
1002
1002
|
name: e.rcFile,
|
|
1003
1003
|
dir: e.cwd
|
|
1004
1004
|
})), e.globalRc) {
|
|
1005
|
-
let { findWorkspaceDir: t } = await import("./dist-
|
|
1005
|
+
let { findWorkspaceDir: t } = await import("./dist-BvTGFq3F.js"), r = await t(e.cwd).catch(() => {});
|
|
1006
1006
|
r && n.push(Z({
|
|
1007
1007
|
name: e.rcFile,
|
|
1008
1008
|
dir: r
|
|
@@ -1014,7 +1014,7 @@ async function Wt(e) {
|
|
|
1014
1014
|
r.rc = t({}, ...n);
|
|
1015
1015
|
}
|
|
1016
1016
|
if (e.packageJson) {
|
|
1017
|
-
let n = (Array.isArray(e.packageJson) ? e.packageJson : [typeof e.packageJson == "string" ? e.packageJson : e.name]).filter((e) => e && typeof e == "string"), { readPackageJSON: i } = await import("./dist-
|
|
1017
|
+
let n = (Array.isArray(e.packageJson) ? e.packageJson : [typeof e.packageJson == "string" ? e.packageJson : e.name]).filter((e) => e && typeof e == "string"), { readPackageJSON: i } = await import("./dist-BvTGFq3F.js"), a = await i(e.cwd).catch(() => {});
|
|
1018
1018
|
r.packageJson = t({}, ...n.map((e) => a?.[e]));
|
|
1019
1019
|
}
|
|
1020
1020
|
let a = {};
|
|
@@ -1171,14 +1171,16 @@ function Qt(e) {
|
|
|
1171
1171
|
let t = e.indexOf("/");
|
|
1172
1172
|
return e.startsWith("@") && t !== -1 ? e.slice(t + 1) : e;
|
|
1173
1173
|
}
|
|
1174
|
-
|
|
1175
|
-
return e.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
1176
|
-
}
|
|
1174
|
+
var $t = "app";
|
|
1177
1175
|
function en(e) {
|
|
1178
|
-
|
|
1176
|
+
let t = e.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
1177
|
+
return t === "" ? $t : t;
|
|
1179
1178
|
}
|
|
1180
1179
|
function tn(e) {
|
|
1181
|
-
return
|
|
1180
|
+
return e ? Qt(e) : void 0;
|
|
1181
|
+
}
|
|
1182
|
+
function nn(e) {
|
|
1183
|
+
return `org.inca.${en(e)}`;
|
|
1182
1184
|
}
|
|
1183
1185
|
//#endregion
|
|
1184
|
-
export { Xt as a, T as c, x as d, C as f,
|
|
1186
|
+
export { Xt as a, T as c, x as d, C as f, en as i, w as l, nn as n, Wt as o, tn as r, at as s, Zt as t, S as u };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as e } from "./jsonc-BdzClvC8.js";
|
|
2
|
-
import { c as t, d as n, f as r, l as i, s as a, u as o } from "./defaults-
|
|
2
|
+
import { c as t, d as n, f as r, l as i, s as a, u as o } from "./defaults-DNvHueCI.js";
|
|
3
3
|
import { n as s, t as c } from "./_format-BKs7bsc4.js";
|
|
4
4
|
import { promises as l, statSync as u } from "node:fs";
|
|
5
5
|
import "node:fs/promises";
|