@incajs/cli 0.0.21 → 0.0.23

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.
Files changed (69) hide show
  1. package/README.md +5 -6
  2. package/dist/chunks/_format-CFy6_BQd.js +1 -0
  3. package/dist/chunks/defaults-DfHXv1fN.js +1 -0
  4. package/dist/chunks/dist-B-B_PlmU.js +1 -0
  5. package/dist/chunks/dist-BTWvruNB.js +1 -0
  6. package/dist/chunks/json5-BcF68iGq.js +14 -0
  7. package/dist/chunks/jsonc-DJWoCi14.js +4 -0
  8. package/dist/chunks/ohash-DUMW2FP0.js +1 -0
  9. package/dist/chunks/rolldown-runtime-DT7IzrpZ.js +1 -0
  10. package/dist/chunks/toml-n3nLqi2g.js +5 -0
  11. package/dist/chunks/types-Dz2aIWaI.d.ts +84 -0
  12. package/dist/chunks/yaml-DtBxpt6z.js +38 -0
  13. package/dist/{cli.d.mts → cli.d.ts} +1 -1
  14. package/dist/cli.js +22 -2181
  15. package/dist/config.d.ts +35 -0
  16. package/dist/config.js +1 -5
  17. package/dist/index.d.ts +27 -0
  18. package/dist/index.js +1 -0
  19. package/dist/vite-runtime.d.ts +28 -0
  20. package/dist/vite-runtime.js +7 -1179
  21. package/package.json +8 -26
  22. package/dist/adapterCore.d.mts +0 -11
  23. package/dist/build.d.mts +0 -28
  24. package/dist/chunks/__vite-optional-peer-dep_dotenv_c12-CxKvRg9-.js +0 -3
  25. package/dist/chunks/__vite-optional-peer-dep_giget_c12-BYcrHYBM.js +0 -5
  26. package/dist/chunks/__vite-optional-peer-dep_jiti_c12-DZVJNj6v.js +0 -5
  27. package/dist/chunks/_format-BKs7bsc4.js +0 -98
  28. package/dist/chunks/defaults-Ct95BSBl.js +0 -23
  29. package/dist/chunks/dist-C64iuQVW.js +0 -730
  30. package/dist/chunks/dist-DrnNGO2a.js +0 -114
  31. package/dist/chunks/json5-RapVXICN.js +0 -711
  32. package/dist/chunks/jsonc-BDHXk_1o.js +0 -40
  33. package/dist/chunks/ohash-Cc4pJh84.js +0 -231
  34. package/dist/chunks/rolldown-runtime-Dy4uBu1J.js +0 -11
  35. package/dist/chunks/toml-CgS7wGvD.js +0 -416
  36. package/dist/chunks/yaml-U_oPOIGK.js +0 -2123
  37. package/dist/config/defaults.d.mts +0 -45
  38. package/dist/config/index.d.mts +0 -18
  39. package/dist/config/loader.d.mts +0 -82
  40. package/dist/config/types.d.mts +0 -73
  41. package/dist/defaultBundler.d.mts +0 -7
  42. package/dist/dev-client/hostBin.d.mts +0 -15
  43. package/dist/dev-client/hostClient.d.mts +0 -70
  44. package/dist/dev-client/hostError.d.mts +0 -6
  45. package/dist/dev-client/index.d.mts +0 -4
  46. package/dist/dev-client/protocol.d.mts +0 -39
  47. package/dist/dev.d.mts +0 -45
  48. package/dist/devLock.d.mts +0 -11
  49. package/dist/entry.d.mts +0 -23
  50. package/dist/error.d.mts +0 -15
  51. package/dist/index.d.mts +0 -1
  52. package/dist/log.d.mts +0 -36
  53. package/dist/macosApp.d.mts +0 -47
  54. package/dist/package.d.mts +0 -50
  55. package/dist/plist.d.mts +0 -4
  56. package/dist/printConfig.d.mts +0 -20
  57. package/dist/retryOnEdit.d.mts +0 -32
  58. package/dist/types.d.mts +0 -136
  59. package/dist/vite/build.d.mts +0 -6
  60. package/dist/vite/captureOutput.d.mts +0 -17
  61. package/dist/vite/config.d.mts +0 -45
  62. package/dist/vite/createBundler.d.mts +0 -7
  63. package/dist/vite/emitConfig.d.mts +0 -17
  64. package/dist/vite/hmr.d.mts +0 -37
  65. package/dist/vite/index.d.mts +0 -1
  66. package/dist/vite/logger.d.mts +0 -8
  67. package/dist/vite/unsupported.d.mts +0 -24
  68. package/dist/vite/watch.d.mts +0 -7
  69. package/dist/watchForEdit.d.mts +0 -27
@@ -1,45 +0,0 @@
1
- import { IncaConfig } from './types.mts';
2
- /**
3
- * The `IncaConfig` fields whose default is a fixed value rather than one
4
- * derived from `package.json` or the filesystem. Importable alongside
5
- * `defineConfig` for an app that wants to inherit or reference them.
6
- *
7
- * @example
8
- * ```ts
9
- * import { defaultConfig, defineConfig } from "@incajs/cli/config";
10
- *
11
- * export default defineConfig({
12
- * ...defaultConfig,
13
- * outDir: "build",
14
- * });
15
- * ```
16
- */
17
- export declare const defaultConfig: Required<Pick<IncaConfig, "outDir" | "sourcemap" | "version">>;
18
- /**
19
- * Strips an npm scope off a package name.
20
- *
21
- * @param name - a `package.json` `"name"`, e.g. `@incajs/cli` or `incajs`
22
- * @returns the name with its scope removed, e.g. `cli`; an unscoped name
23
- * passes through unchanged
24
- */
25
- export declare function unscopedName(name: string): string;
26
- /**
27
- * Turns a display name into a filesystem/URL-safe slug.
28
- *
29
- * @param name - e.g. a `productName`
30
- * @returns `name` lowercased, with runs of non-`[a-z0-9]` collapsed to a
31
- * single `-` and trimmed from both ends; `"app"` for a name that holds
32
- * none of those characters
33
- */
34
- export declare function slugify(name: string): string;
35
- /**
36
- * @param pkgName - `package.json`'s own `"name"`, if it has one
37
- * @returns the `productName` a plain `package.json` implies: its name with
38
- * any scope stripped, or `undefined` if it has none
39
- */
40
- export declare function defaultProductName(pkgName: string | undefined): string | undefined;
41
- /**
42
- * @param productName - the app's resolved display name
43
- * @returns a generated `identifier`, e.g. `org.inca.click-counter`
44
- */
45
- export declare function defaultIdentifier(productName: string): string;
@@ -1,18 +0,0 @@
1
- import { IncaConfig } from './types.mts';
2
- export { defaultConfig } from './defaults.mts';
3
- export type { IncaConfig } from './types.mts';
4
- /**
5
- * Type-completion helper for `inca.config.ts`. An identity function at
6
- * runtime.
7
- *
8
- * @example
9
- * ```ts
10
- * import { defineConfig } from "@incajs/cli/config";
11
- *
12
- * export default defineConfig({
13
- * productName: "Click Counter",
14
- * identifier: "com.example.click-counter",
15
- * });
16
- * ```
17
- */
18
- export declare const defineConfig: (config: IncaConfig) => IncaConfig;
@@ -1,82 +0,0 @@
1
- import { WindowConfig } from './types.mts';
2
- /** `entry`/`outDir` only: what `build()`/`dev()` need, with no `package.json` requirement. */
3
- export interface ResolvedBuildConfig {
4
- /** Absolute path, if `inca.config.ts` set one. */
5
- entry?: string;
6
- /** Absolute path. */
7
- outDir: string;
8
- /** Whether `build`/`package` write `bundle.js.map`. */
9
- sourcemap: boolean;
10
- }
11
- /** An app's full config, as `inca package` needs it. */
12
- export interface ResolvedAppConfig extends ResolvedBuildConfig {
13
- productName: string;
14
- identifier: string;
15
- /** True when `identifier` was generated rather than set explicitly. */
16
- identifierIsDefault: boolean;
17
- version: string;
18
- /** Absolute path, if the app declared one. */
19
- icon?: string;
20
- /** What the app declared about its window, if anything. */
21
- window?: WindowConfig;
22
- /** package.json's `"inca"` key is deprecated; callers warn when this is true. */
23
- usedPackageJsonKey: boolean;
24
- }
25
- /**
26
- * What a built app carries for its host to read: the name the platform
27
- * shows it under, the id it is known by, and its window. Each field is
28
- * absent unless the app's config sets it.
29
- */
30
- export interface RuntimeConfig {
31
- name?: string;
32
- identifier?: string;
33
- window?: WindowConfig;
34
- }
35
- /**
36
- * Refuses an `outDir` that would hold the app's own sources. `inca dev` and
37
- * `inca build` delete whatever a build didn't write under `outDir`. Symlinks
38
- * are followed on both sides of the comparison.
39
- *
40
- * @param cwd - the app's root directory
41
- * @param outDir - the `outDir`, absolute or relative to `cwd`
42
- * @param entry - the resolved entry, if any
43
- * @throws if it is, or contains, the app's root, `src/`, `node_modules/`, or
44
- * the entry, or if a symlink on the way can't be resolved
45
- */
46
- export declare function assertOutDir(cwd: string, outDir: string, entry?: string): void;
47
- /**
48
- * Loads just `entry`/`outDir` from `inca.config.ts`, with derived defaults.
49
- * Never touches `package.json`.
50
- *
51
- * @param cwd - the app's root directory
52
- * @returns `entry`/`outDir`, resolved to absolute paths
53
- */
54
- export declare function resolveBuildConfig(cwd: string): Promise<ResolvedBuildConfig>;
55
- /**
56
- * Loads an app's full config for `inca package`: `inca.config.ts` over
57
- * `package.json`'s `"inca"` key over derived defaults.
58
- *
59
- * @param cwd - the app's root directory
60
- * @returns the resolved config
61
- * @throws if `package.json` is missing, holds malformed JSON, has neither a `name` nor a
62
- * `productName`, an `icon` doesn't resolve to a real file, or `outDir`
63
- * would hold the app's own files
64
- */
65
- export declare function resolveAppConfig(cwd: string): Promise<ResolvedAppConfig>;
66
- /**
67
- * Narrows a full config down to what a build carries for the host.
68
- *
69
- * @param config - a config {@link resolveAppConfig} returned
70
- * @returns its name, id and window
71
- */
72
- export declare function runtimeConfigOf(config: ResolvedAppConfig): RuntimeConfig;
73
- /**
74
- * Loads {@link RuntimeConfig} for an app that may name itself nowhere.
75
- * An app with no `package.json`, or none that gives it a name, still gets
76
- * whatever window settings it declared.
77
- *
78
- * @param cwd - the app's root directory
79
- * @returns the config, or `undefined` when the app declares none of it
80
- * @throws if `package.json` exists and holds malformed JSON
81
- */
82
- export declare function resolveRuntimeConfig(cwd: string): Promise<RuntimeConfig | undefined>;
@@ -1,73 +0,0 @@
1
- /**
2
- * An app's own `inca.config.ts` (or `.js`/`.json`), loaded by `@incajs/cli`.
3
- * `package.json`'s `"inca"` key still works as a fallback, but is
4
- * deprecated. This file wins where both are present.
5
- */
6
- export interface IncaConfig {
7
- /** Path to an icon file, resolved from the app's root directory. */
8
- icon?: string;
9
- /**
10
- * A reverse-DNS-style unique id, e.g. macOS's `CFBundleIdentifier`.
11
- * @default a generated `org.inca.<slug>`
12
- */
13
- identifier?: string;
14
- /**
15
- * The app's display name.
16
- * @default package.json's "name", with any npm scope stripped
17
- */
18
- productName?: string;
19
- /**
20
- * The packaged app's version.
21
- * @default package.json's own "version"
22
- */
23
- version?: string;
24
- /**
25
- * The app's entry point.
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
29
- */
30
- entry?: string;
31
- /**
32
- * Where a build's output is written.
33
- * @default "dist"
34
- */
35
- outDir?: string;
36
- /**
37
- * Whether `inca build` and `inca package` write `bundle.js.map` beside
38
- * the bundle. `inca dev` always writes it.
39
- * @default false
40
- */
41
- sourcemap?: boolean;
42
- /** The window the app opens in. */
43
- window?: WindowConfig;
44
- }
45
- /** What an app declares about its window. See {@link IncaConfig.window}. */
46
- export interface WindowConfig {
47
- /**
48
- * Initial width, in pixels. Falls back to the width the app's root
49
- * element declares, then to this default.
50
- * @default 800
51
- */
52
- width?: number;
53
- /**
54
- * Initial height, in pixels. Falls back to the height the app's root
55
- * element declares, then to this default.
56
- * @default 600
57
- */
58
- height?: number;
59
- /**
60
- * The window's title.
61
- * @default the app's productName
62
- */
63
- title?: string;
64
- /**
65
- * Whether a user can resize the window.
66
- * @default false
67
- */
68
- resizable?: boolean;
69
- /** Smallest width the window can be, in pixels. It opens at least this wide. */
70
- minWidth?: number;
71
- /** Smallest height the window can be, in pixels. It opens at least this tall. */
72
- minHeight?: number;
73
- }
@@ -1,7 +0,0 @@
1
- import { Bundler } from './types.mts';
2
- /**
3
- * `vite/` wired in as the one adapter `dev` and `build` share by
4
- * default: a single place to swap bundlers. Compiled `.vue` templates import
5
- * their helpers from `incajs/vue/runtime`.
6
- */
7
- export declare const defaultBundler: Bundler;
@@ -1,15 +0,0 @@
1
- /**
2
- * Where `inca-host` itself lives: `INCA_HOST_BIN` if set, otherwise the
3
- * per-platform npm package for this OS/arch (`@incajs/host-<os>-<arch>`, an
4
- * `optionalDependency` of this package).
5
- * @throws if neither resolves: no override is set, and either this
6
- * platform has no published binary, or the optional dependency carrying
7
- * it failed to install.
8
- */
9
- export declare function resolveHostBin(): string;
10
- /**
11
- * Checks that a host binary is a file.
12
- * @param bin - the path to check
13
- * @throws if nothing is a file at `bin`
14
- */
15
- export declare function assertHostBin(bin: string): void;
@@ -1,70 +0,0 @@
1
- import { AppErrorParams } from './protocol.mts';
2
- export interface HostClientOptions {
3
- /** The entry module passed to the host as `--dev <entryFile>`. */
4
- entryFile: string;
5
- /** Overrides which `inca-host` binary gets spawned, in place of automatic resolution. */
6
- hostBin?: string;
7
- /** The environment the host starts with. Defaults to this process's own. */
8
- env?: NodeJS.ProcessEnv;
9
- /**
10
- * Every diagnostic line the transport itself produces: the host's real
11
- * stderr, a stray stdout line, and a `ready` protocol mismatch. Defaults
12
- * to this process's own stderr.
13
- */
14
- onStderr?: (line: string) => void;
15
- /**
16
- * The window is open and the first bundle's evaluation has ended: its
17
- * top-level `await` settled, or 2 seconds passed with it pending. A failed
18
- * load the app reported keeps the window closed. The host speaks the
19
- * protocol revision this package was built for.
20
- */
21
- onReady?: () => void;
22
- /** An app's event listener threw, or the app threw or rejected while the host loaded it. */
23
- onAppError?: (error: AppErrorParams) => void;
24
- /**
25
- * The host exited on its own, or was stopped over a protocol mismatch.
26
- * Not called for the exit `stop()` asks for.
27
- */
28
- onExit?: (code: number | null, signal: NodeJS.Signals | null) => void;
29
- /**
30
- * Handlers for notification `method`s this package doesn't implement
31
- * itself (e.g. a future Vite integration), keyed by method name.
32
- * `params` are forwarded untouched.
33
- */
34
- integrations?: Record<string, (params: unknown) => void>;
35
- }
36
- /**
37
- * Spawns `inca-host --dev <entryFile>` and speaks newline-delimited
38
- * JSON-RPC 2.0 on its stdin/stdout. One instance owns exactly one child
39
- * process for its whole lifetime. A reload is a `reload` call on that child.
40
- */
41
- export declare class HostClient {
42
- #private;
43
- constructor(options: HostClientOptions);
44
- /**
45
- * Starts the child and wires up its streams. Resolves once the process
46
- * has spawned. Rejects with `ERR_INCA_HOST_BIN_NOT_FOUND` if no file
47
- * exists at the host binary's path, or with the spawn error if the
48
- * process can't start.
49
- */
50
- start(): Promise<void>;
51
- /**
52
- * Sends a request and resolves with its result once the host answers.
53
- * With `timeoutMs`, rejects once that much time passes with no answer.
54
- * The host answers on the same thread that runs the app's JS, so a
55
- * wedged app never answers.
56
- */
57
- call(method: string, params?: unknown, timeoutMs?: number): Promise<unknown>;
58
- /**
59
- * Sends a fire-and-forget notification: no `id`, so no reply is ever
60
- * awaited. Used for traffic a bundler integration owns (e.g. Vite's HMR
61
- * payloads).
62
- */
63
- notify(method: string, params?: unknown): void;
64
- /**
65
- * Asks the host to `shutdown` and waits for the child to actually exit.
66
- * That exit is the acknowledgement. Kills it once `timeoutMs` passes without
67
- * that, so a wedged app can't block teardown.
68
- */
69
- stop(timeoutMs?: number): Promise<void>;
70
- }
@@ -1,6 +0,0 @@
1
- /** A fault the host answered a request with, carrying its JSON-RPC code. */
2
- export declare class HostError extends Error {
3
- readonly code: number;
4
- readonly hostStack: string | null;
5
- constructor(message: string, code: number, hostStack?: string | null);
6
- }
@@ -1,4 +0,0 @@
1
- export { assertHostBin, resolveHostBin } from './hostBin.mts';
2
- export { HostError } from './hostError.mts';
3
- export { HostClient } from './hostClient.mts';
4
- export type { HostClientOptions } from './hostClient.mts';
@@ -1,39 +0,0 @@
1
- export declare const JSONRPC = "2.0";
2
- /**
3
- * The host method-set revision this package expects, checked against
4
- * `ready`'s `params.protocol`: a mismatch means an incompatible host
5
- * build.
6
- */
7
- export declare const HOST_PROTOCOL_VERSION = 0;
8
- /** `ready`'s notification params. */
9
- export interface ReadyParams {
10
- protocol: number;
11
- }
12
- /** `appError`'s notification params. */
13
- export interface AppErrorParams {
14
- message: string;
15
- stack: string | null;
16
- }
17
- export interface RpcResult {
18
- jsonrpc: typeof JSONRPC;
19
- id: number;
20
- result: unknown;
21
- }
22
- export interface RpcFailure {
23
- jsonrpc: typeof JSONRPC;
24
- /** `null` when the host fails before any call could be answered. */
25
- id: number | null;
26
- error: {
27
- code: number;
28
- message: string;
29
- data?: {
30
- stack: string | null;
31
- };
32
- };
33
- }
34
- export interface RpcNotification {
35
- jsonrpc: typeof JSONRPC;
36
- method: string;
37
- params: unknown;
38
- }
39
- export declare function isRpcMessage(value: unknown): value is RpcResult | RpcFailure | RpcNotification;
package/dist/dev.d.mts DELETED
@@ -1,45 +0,0 @@
1
- import { Bundler } from './types.mts';
2
- export interface DevOptions {
3
- /** The app's root directory. Defaults to `process.cwd()`. */
4
- cwd?: string;
5
- /**
6
- * The app's entry point. Defaults to resolving it automatically: a
7
- * committed `src/main.mts`, `src/main.ts` or `src/main.js`, or `src/App.vue` wrapped in a synthesized one.
8
- */
9
- entry?: string;
10
- /** Overrides the bundler. See {@link defaultBundler} for what's wired in by default. */
11
- bundler?: Bundler;
12
- /**
13
- * Delivers module-granular updates instead of a full reload on every
14
- * change, over `bundler.hmr`. See `--experimental-hmr`.
15
- */
16
- experimentalHmr?: boolean;
17
- /**
18
- * Overrides host binary resolution. On macOS this is the binary the
19
- * app bundle wraps; elsewhere it is launched directly.
20
- */
21
- hostBin?: string;
22
- /** Defaults to `process.stdout`. */
23
- stdout?: NodeJS.WritableStream;
24
- /** Defaults to `process.stderr`. */
25
- stderr?: NodeJS.WritableStream;
26
- /** Aborting tears the host and the bundler watcher down and resolves `dev()`. */
27
- signal: AbortSignal;
28
- }
29
- /**
30
- * Builds the app, starts the host once the first build lands (at once under
31
- * `experimentalHmr`), and reloads it on every rebuild until `options.signal`
32
- * aborts or the host exits on its own.
33
- *
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.
44
- */
45
- export declare function dev(options: DevOptions): Promise<void>;
@@ -1,11 +0,0 @@
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, or that an earlier run of this process left behind, is taken over.
6
- *
7
- * @param cwd - the app directory to claim
8
- * @returns a function releasing the lock, safe to call more than once.
9
- * @throws if another live `inca dev` holds `cwd`.
10
- */
11
- export declare function acquireDevLock(cwd: string): Promise<() => Promise<void>>;
package/dist/entry.d.mts DELETED
@@ -1,23 +0,0 @@
1
- export declare const MAIN_FILES: string[];
2
- /**
3
- * The directory Vite takes as the app's root: `src` for the entry
4
- * {@link resolveEntry} writes for `src/App.vue`, and the entry's own
5
- * directory for any other entry.
6
- * @param cwd - the app's root directory
7
- * @param entry - the app's entry file
8
- * @returns the directory
9
- */
10
- export declare function entryRoot(cwd: string, entry: string): string;
11
- /**
12
- * Resolves an app's entry point. A `src/main.mts`, `src/main.ts` or
13
- * `src/main.js` committed by the app wins outright, in that order, and is
14
- * used verbatim for full control over bootstrapping. Otherwise
15
- * `src/App.vue` is wrapped in a synthesized entry equivalent to
16
- * `createIncaApp(App).mount()`, so a plain `.vue` file is a whole app
17
- * with no configuration at all.
18
- *
19
- * @param cwd - the app's root directory
20
- * @returns the path of the entry file
21
- * @throws if none of the main files and no `src/App.vue` exists
22
- */
23
- export declare function resolveEntry(cwd: string): Promise<string>;
package/dist/error.d.mts DELETED
@@ -1,15 +0,0 @@
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
- /** A file whose creation or change may resolve the error. */
10
- readonly path?: string | undefined;
11
- readonly name = "IncaError";
12
- constructor(code: string, message: string,
13
- /** A file whose creation or change may resolve the error. */
14
- path?: string | undefined);
15
- }
package/dist/index.d.mts DELETED
@@ -1 +0,0 @@
1
- export type { ResolvedAppConfig } from './config/loader.mts';
package/dist/log.d.mts DELETED
@@ -1,36 +0,0 @@
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
- /** `inca dev` stamps its lines the way Vite's dev server does. */
7
- export declare const STAMPED: {
8
- readonly timestamp: true;
9
- };
10
- /** Writes one `[inca] <message>` line to `stream`. */
11
- export declare function log(stream: NodeJS.WritableStream, message: string, options?: LogOptions): void;
12
- /** Writes one `[inca] <message>` line to `stream`, with the tag in yellow. */
13
- export declare function warn(stream: NodeJS.WritableStream, message: string, options?: LogOptions): void;
14
- /** A failure reduced to the message and stack worth printing. */
15
- export interface Fault {
16
- message: string;
17
- stack: string | null;
18
- /** An `ERR_INCA_*` identifier, when the failure has one to look up. */
19
- code?: string | null;
20
- }
21
- /**
22
- * Reduces an error a bundler re-wrapped: its text is kept whole. The
23
- * excerpt a compiler points at is the useful part, while the error class
24
- * and any `ERR_INCA_*` marker are lifted off the first line, the latter
25
- * into the fault's code.
26
- */
27
- export declare function bundlerFault(message: string): Fault;
28
- /** Reduces a thrown value to a {@link Fault}. A `HostError` carries the host process's stack. */
29
- export declare function toFault(error: unknown): Fault;
30
- /**
31
- * Writes the stack (when there is one) followed by `[inca] <label>
32
- * (<code>): <message>` to `stream`. The code appears only when the failure
33
- * carries one. The tagged line goes last so it stays the thing visible
34
- * without scrolling back through the stack above it.
35
- */
36
- export declare function printFault(stream: NodeJS.WritableStream, label: string, fault: Fault, options?: LogOptions): void;
@@ -1,47 +0,0 @@
1
- /** The app metadata a `.app` bundle's `Info.plist` carries. */
2
- export interface MacosAppMetadata {
3
- /** The name macOS shows in the Dock, the menu bar and the Finder. */
4
- productName: string;
5
- /** A reverse-DNS-style unique id, written as `CFBundleIdentifier`. */
6
- identifier: string;
7
- /** The app's version, written as both `CFBundleVersion` and `CFBundleShortVersionString`. */
8
- version: string;
9
- /** Absolute path to an icon file, copied into `Contents/Resources`. */
10
- icon?: string;
11
- }
12
- /** Options for {@link writeMacosApp}. */
13
- export interface WriteMacosAppOptions {
14
- /** Where the `.app` directory is written. An existing one there is replaced. */
15
- appPath: string;
16
- /** What the bundle's `Info.plist` describes. */
17
- metadata: MacosAppMetadata;
18
- /** The `inca-host` binary the bundle's executable is made from. */
19
- hostBin: string;
20
- /**
21
- * Hard-links the executable to `hostBin` rather than copying it, and
22
- * copies when the two paths are on different filesystems. Set it where
23
- * the bundle is rebuilt often and holds no files of its own.
24
- */
25
- link?: boolean;
26
- }
27
- /** The paths {@link writeMacosApp} created. */
28
- export interface MacosApp {
29
- /** The `.app` directory itself. */
30
- appPath: string;
31
- /** The bundle's executable, at `Contents/MacOS/<productName>`. */
32
- executablePath: string;
33
- /** `Contents/Resources`, where an app's own files belong. */
34
- resourcesDir: string;
35
- }
36
- /**
37
- * Writes a macOS `.app` bundle around the `inca-host` binary:
38
- * `Contents/MacOS` holding the executable, `Contents/Resources` left empty
39
- * apart from the icon, and `Info.plist`/`PkgInfo` beside them. macOS reads
40
- * the app's name, icon and identifier from the bundle, so an executable
41
- * launched from one carries them wherever the platform shows an app.
42
- *
43
- * @param options - where to write, what to describe, and which binary to use
44
- * @returns the bundle's own path, its executable, and its resources directory
45
- * @throws if any part of the bundle can't be written
46
- */
47
- export declare function writeMacosApp(options: WriteMacosAppOptions): Promise<MacosApp>;
@@ -1,50 +0,0 @@
1
- import { Bundler } from './types.mts';
2
- /** A platform `inca package` can emit a distributable application for. */
3
- export type PackageTarget = "macos" | "linux";
4
- /** Options for {@link packageApp}. */
5
- export interface PackageAppOptions {
6
- /** The app's root directory. Defaults to `process.cwd()`. */
7
- cwd?: string;
8
- /**
9
- * The app's entry point. Defaults to resolving it the same way `inca
10
- * dev`/`build` do: a committed `src/main.mts`, `src/main.ts` or `src/main.js`, or `src/App.vue` wrapped
11
- * in a synthesized one.
12
- */
13
- entry?: string;
14
- /** Overrides the bundler. See {@link build}'s default. */
15
- bundler?: Bundler;
16
- /**
17
- * Overrides which `inca-host` binary gets embedded in the packaged
18
- * app, in place of automatic resolution (`INCA_HOST_BIN`, then the
19
- * per-platform `@incajs/host-*` package. See {@link resolveHostBin}).
20
- */
21
- hostBin?: string;
22
- /** Writes `bundle.js.map` beside the bundle. Overrides the config's `sourcemap` when set. */
23
- sourcemap?: boolean;
24
- /**
25
- * The platform to package for. Defaults to whichever one the current
26
- * process is running on.
27
- */
28
- target?: PackageTarget;
29
- /** Where progress notes and the bundler's own output go. Defaults to `process.stdout`. */
30
- stdout?: NodeJS.WritableStream;
31
- /** Where the bundler's warnings and errors go. Defaults to `process.stderr`. */
32
- stderr?: NodeJS.WritableStream;
33
- }
34
- /** The result of a successful {@link packageApp} call. */
35
- export interface PackageResult {
36
- /** The packaged app's path: a `.app` directory on macOS, a plain directory on Linux. */
37
- appPath: string;
38
- }
39
- /**
40
- * Builds the app and pairs it with the prebuilt `inca-host` into a
41
- * distributable, platform-native application: a `.app` on macOS, a plain
42
- * directory on Linux, written alongside the build output, under the
43
- * app's own `dist/`. The app launches with no arguments and no terminal,
44
- * since `inca-host` finds its own bundle beside its executable.
45
- *
46
- * @throws if the app's metadata can't be read, the build fails, no
47
- * `inca-host` binary can be resolved for the target platform, or no file
48
- * exists at the resolved path.
49
- */
50
- export declare function packageApp(options?: PackageAppOptions): Promise<PackageResult>;
package/dist/plist.d.mts DELETED
@@ -1,4 +0,0 @@
1
- /** A macOS `Info.plist`'s value types. These are the only ones `inca package` writes. */
2
- export type PlistValue = string | boolean;
3
- /** Encodes a flat key/value dict as an `Info.plist` XML document. */
4
- export declare function encodePlist(dict: Record<string, PlistValue>): string;
@@ -1,20 +0,0 @@
1
- export interface PrintConfigOptions {
2
- /** The app's root directory. Defaults to `process.cwd()`. */
3
- cwd?: string;
4
- /** Overrides host binary resolution. */
5
- hostBin?: string;
6
- /** Receives the settings. Defaults to `process.stdout`. */
7
- stdout?: NodeJS.WritableStream;
8
- /** Receives the host's own report when it names no setting. Defaults to `process.stderr`. */
9
- stderr?: NodeJS.WritableStream;
10
- }
11
- /**
12
- * Prints the settings the host applies to the app as JSON. The host reads the app's config from
13
- * `node_modules/.inca/config/inca.json`, written as a build writes it beside the bundle.
14
- *
15
- * @returns the host's exit code: 0 after printing, non-zero when the host refused the config
16
- * with a report that names no setting, written to `stderr`
17
- * @throws if the config can't be loaded, a setting holds a value the host can't use, or the
18
- * host binary can't be resolved, isn't a file or can't be started
19
- */
20
- export declare function printConfig(options?: PrintConfigOptions): Promise<number>;