@incajs/cli 0.0.22 → 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 -2229
  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 -51
  48. package/dist/devLock.d.mts +0 -11
  49. package/dist/entry.d.mts +0 -29
  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,32 +0,0 @@
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>;
package/dist/types.d.mts DELETED
@@ -1,136 +0,0 @@
1
- /** A running build watch. {@link Bundler.watch} resolves to this value. */
2
- export interface Watcher {
3
- /** Stops watching and releases the underlying build process. */
4
- close(): Promise<void>;
5
- }
6
- /** Options for {@link Bundler.build}. */
7
- export interface BuildOptions {
8
- /** The app's own entry point. It may import `.vue` files. */
9
- entry: string;
10
- /** The app's root directory for Vite. `envDir` and `publicDir` default to locations under it. Defaults to the entry's directory. */
11
- root?: string;
12
- /** The directory Vite reads `.env*` files from. Defaults to `root`. */
13
- envDir?: string;
14
- /** The directory of static files Vite serves and copies. Defaults to `public` under `root`. */
15
- publicDir?: string;
16
- /** Where the build's output is written. */
17
- outDir: string;
18
- /** Writes `bundle.js.map` beside the bundle. Defaults to `false`. */
19
- sourcemap?: boolean;
20
- /**
21
- * Values the built app carries for `inca-host` to read: its name, id
22
- * and window. Any JSON-serializable object.
23
- */
24
- runtimeConfig?: unknown;
25
- /** Where the bundler's own output goes. Defaults to `process.stdout`. */
26
- stdout?: NodeJS.WritableStream;
27
- /** Where the bundler's warnings and errors go. Defaults to `process.stderr`. */
28
- stderr?: NodeJS.WritableStream;
29
- /**
30
- * Drops the bundler's progress output and size report, leaving the
31
- * per-build summary. Set it when the build has to stay silent: part of
32
- * that output goes to the process's own stdout, not to `stdout` above.
33
- */
34
- quiet?: boolean;
35
- }
36
- /** Options for {@link Bundler.watch}. */
37
- export interface BundlerOptions extends BuildOptions {
38
- /** `"development"` keeps a framework's own warnings; `"production"` strips them. */
39
- mode: "development" | "production";
40
- /** Called after each successful (re)build, with what it wrote. */
41
- onBuild: (output: BuildOutput) => void;
42
- /** Called instead of `onBuild` when a (re)build fails. */
43
- onError: (error: BuildFailure) => void;
44
- }
45
- /** A failed build or HMR update, in the one shape every bundler adapter reports. */
46
- export interface BuildFailure {
47
- message: string;
48
- /** The stack, plus any further detail worth printing under it. */
49
- stack: string | null;
50
- /** An `ERR_INCA_*` identifier, when the failure has one to look up. */
51
- code?: string | null;
52
- }
53
- /**
54
- * What a build wrote. It is the result of {@link Bundler.build} and of every
55
- * {@link BundlerOptions.onBuild} call.
56
- */
57
- export interface BuildOutput {
58
- /** Directory holding every file this build emitted. */
59
- outDir: string;
60
- /** Absolute path to the entry module `inca-host` evaluates. */
61
- entryFile: string;
62
- /**
63
- * Every file this build emitted, relative to `outDir`. It may include chunks and assets besides
64
- * the entry itself.
65
- */
66
- files: readonly string[];
67
- /** The change that triggered this rebuild. Absent from a one-shot build and a watch's first build. */
68
- changed?: {
69
- file: string;
70
- at: number;
71
- };
72
- }
73
- /** Options for {@link Bundler.hmr}. */
74
- export interface HmrOptions {
75
- /** The app's own entry point. It may import `.vue` files. */
76
- entry: string;
77
- /** The directory the app's module urls are relative to. Defaults to the entry's directory. */
78
- root?: string;
79
- /** The directory Vite reads `.env*` files from. Defaults to `root`. */
80
- envDir?: string;
81
- /** The directory of static files Vite serves. Defaults to `public` under `root`. */
82
- publicDir?: string;
83
- /** The app's root directory, where its dev-only scratch files are written. */
84
- cwd: string;
85
- /**
86
- * Values the built app carries for `inca-host` to read: its name, id
87
- * and window. Any JSON-serializable object.
88
- */
89
- runtimeConfig?: unknown;
90
- /** Overrides where the synthesized entry imports `vite-runtime.js` from. Test-only. */
91
- runtimePath?: string;
92
- /** Where the bundler's own output goes. Defaults to `process.stdout`. */
93
- stdout?: NodeJS.WritableStream;
94
- /** Where the bundler's warnings and errors go. Defaults to `process.stderr`. */
95
- stderr?: NodeJS.WritableStream;
96
- /** Drops per-update/reload logging; warnings and errors still surface. */
97
- quiet?: boolean;
98
- /** Delivers a bundler payload to the running app over the dev channel. */
99
- notify: (payload: unknown) => void;
100
- /**
101
- * Called in place of forwarding a whole-app reload payload to the app, with
102
- * the edit that caused it when one was waiting.
103
- */
104
- reload: (changed?: {
105
- file: string;
106
- at: number;
107
- }) => void;
108
- /** Called when an update the app fetched failed to compile. */
109
- onError: (error: BuildFailure) => void;
110
- /** Called after a successful update, with the file that changed and how long it took. */
111
- onUpdate?: (info: {
112
- file: string;
113
- took: number;
114
- }) => void;
115
- }
116
- /** A running HMR session. {@link Bundler.hmr} resolves to this value. */
117
- export interface HmrChannel extends Watcher {
118
- /** The synthesized entry `inca-host` evaluates for this session. */
119
- entryFile: string;
120
- /** Feeds a payload the running app sent back into the bundler's dev server. */
121
- dispatch: (payload: unknown) => void;
122
- }
123
- /**
124
- * The contract a bundler adapter satisfies. Supporting another bundler
125
- * means adding a sibling adapter module and injecting its `Bundler` here.
126
- */
127
- export interface Bundler {
128
- watch(options: BundlerOptions): Promise<Watcher>;
129
- /** One-shot production build, used by `inca build`. Rejects on failure. */
130
- build(options: BuildOptions): Promise<BuildOutput>;
131
- /**
132
- * Module-granular dev updates, used by `inca dev --experimental-hmr`.
133
- * Optional: omit it when the adapter has no HMR support.
134
- */
135
- hmr?(options: HmrOptions): Promise<HmrChannel>;
136
- }
@@ -1,6 +0,0 @@
1
- import { AdapterCore, BuildOptions, BuildOutput } from '../adapterCore.mts';
2
- /**
3
- * Builds `entry` into a minified, production build under `outDir` once, and
4
- * rejects on failure. Never starts or talks to `inca-host`.
5
- */
6
- export declare function build(core: AdapterCore, runtimeModuleName: string, { entry, root, envDir, publicDir, outDir, sourcemap, runtimeConfig, stdout, stderr, quiet, }: BuildOptions): Promise<BuildOutput>;
@@ -1,17 +0,0 @@
1
- import { Plugin } from 'vite';
2
- import { AdapterCore, BuildOutput } from '../adapterCore.mts';
3
- /** What one (re)build actually wrote, relative to its own `outDir`. */
4
- export interface CapturedOutput {
5
- /** The emitted chunk marked as this build's entry. */
6
- entryFile: string;
7
- /** Every emitted file, as the bundler reported it. */
8
- files: readonly string[];
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;
12
- /**
13
- * A Vite plugin reporting `sink` the files a build wrote once they land on
14
- * disk, via `writeBundle`, the one hook that fires uniformly for a
15
- * one-shot build and every watch rebuild.
16
- */
17
- export declare function captureOutput(core: AdapterCore, sink: (output: CapturedOutput) => void): Plugin;
@@ -1,45 +0,0 @@
1
- import { InlineConfig } from 'vite';
2
- import { AdapterCore } from '../adapterCore.mts';
3
- import { CapturedOutput } from './captureOutput.mts';
4
- export declare const BUNDLE_FILE_NAME = "bundle.js";
5
- export interface ResolveConfigOptions {
6
- core: AdapterCore;
7
- /** The module compiled `.vue` templates import their helpers from. */
8
- runtimeModuleName: string;
9
- /** The app's own entry point. It may import `.vue` files. */
10
- entry: string;
11
- /** See the `root` option in `../types.mts`. Defaults to the entry's directory. */
12
- root?: string;
13
- /** See the `envDir` option in `../types.mts`. Defaults to `root`. */
14
- envDir?: string;
15
- /** See the `publicDir` option in `../types.mts`. Defaults to `public` under `root`. */
16
- publicDir?: string;
17
- /** Where the build's output is written. */
18
- outDir: string;
19
- /** `"development"` keeps `@vue/runtime-core`'s own warnings; `"production"` strips them. */
20
- mode: "development" | "production";
21
- /** Writes the map in a production build too. Development always writes it. */
22
- sourcemap?: boolean;
23
- /** Whether Vite should keep rebuilding on file changes. */
24
- watch: boolean;
25
- /** Called with what each successful (re)build wrote. */
26
- onOutput: (output: CapturedOutput) => void;
27
- /** Where Vite's own build output goes. */
28
- stdout: NodeJS.WritableStream;
29
- /** Where Vite's warnings and errors go. */
30
- stderr: NodeJS.WritableStream;
31
- /** Silences the bundler's progress output. See the `quiet` option in `../types.mts`. */
32
- quiet: boolean;
33
- /** Written beside the entry. See the `runtimeConfig` option in `../types.mts`. */
34
- runtimeConfig?: unknown;
35
- }
36
- /**
37
- * Builds the Vite config shared by `watch` and `build`, compiling `.vue`
38
- * files via `@vitejs/plugin-vue`. Compiled templates import their helpers
39
- * from `runtimeModuleName`.
40
- *
41
- * An import the entry doesn't inline (a dynamic `import()`, or a `.vue`
42
- * file's own `<style>` block) lands as its own chunk or asset alongside
43
- * the entry, named by `chunkFileNames`/`assetFileNames` below.
44
- */
45
- export declare function resolveViteConfig({ core, runtimeModuleName, entry, root, envDir, publicDir, outDir, mode, sourcemap, watch, onOutput, stdout, stderr, quiet, runtimeConfig, }: ResolveConfigOptions): InlineConfig;
@@ -1,7 +0,0 @@
1
- import { AdapterCore, Bundler } from '../adapterCore.mts';
2
- /**
3
- * The Vite adapter.
4
- * @param core - the CLI logic the adapter uses
5
- * @param runtimeModuleName - the module compiled `.vue` templates import their helpers from
6
- */
7
- export declare function createViteBundler(core: AdapterCore, runtimeModuleName: string): Bundler;
@@ -1,17 +0,0 @@
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
- * Serializes `config` the way `inca.json` is written: `undefined` for
6
- * anything that shouldn't produce a file: `undefined` itself, or an
7
- * object with no keys.
8
- */
9
- export declare function serializeConfig(config: unknown): string | undefined;
10
- /**
11
- * Writes `config` to `inca.json` beside the entry, for `inca-host` to read
12
- * when it starts the app.
13
- *
14
- * @param config - any JSON-serializable value; no file is written for
15
- * `undefined` or an object with no keys
16
- */
17
- export declare function emitConfig(config: unknown): Plugin;
@@ -1,37 +0,0 @@
1
- import { AdapterCore, BuildFailure, HmrChannel, HmrOptions } from '../adapterCore.mts';
2
- /**
3
- * A failed update's detail: the same fields a Rollup/Vite plugin
4
- * error carries beyond `message`/`stack`, when it has them.
5
- */
6
- interface UpdateError {
7
- message: string;
8
- stack?: string | null;
9
- plugin?: string | null;
10
- id?: string | null;
11
- frame?: string | null;
12
- loc?: {
13
- line: number;
14
- column: number;
15
- } | null;
16
- }
17
- /**
18
- * Reduces a failed update to a {@link BuildFailure}, with the message and
19
- * `code` a failed rebuild reports. Plugin, file and frame detail from Vite's
20
- * `buildErrorMessage` follows the stack.
21
- */
22
- export declare function faultOfUpdate(core: AdapterCore, error: UpdateError): BuildFailure;
23
- /**
24
- * The `define` entries set on `globalThis` in the development window, as values: those whose
25
- * key is a plain identifier and whose code is a JSON literal. A string value is code, and any
26
- * other value is read as its JSON form.
27
- * @param define - the development server's resolved `define`
28
- * @returns the values by key
29
- */
30
- export declare function globalsOfDefine(define: Record<string, unknown> | undefined): Record<string, unknown>;
31
- /**
32
- * Starts a Vite dev server driving the app over its dev channel instead of
33
- * a browser: a `"client"` environment with a custom {@link HotChannel}
34
- * standing in for the WebSocket server `server.ws: false` disables.
35
- */
36
- export declare function hmr(core: AdapterCore, runtimeModuleName: string, { entry, root, envDir, publicDir, cwd, runtimeConfig, runtimePath, stdout, stderr, quiet, notify, reload, onError, onUpdate, }: HmrOptions): Promise<HmrChannel>;
37
- export {};
@@ -1 +0,0 @@
1
- export { createViteBundler } from './createBundler.mts';
@@ -1,8 +0,0 @@
1
- import { Logger } from 'vite';
2
- /**
3
- * A Vite {@link Logger} writing to the given streams: `info` to `stdout`,
4
- * `warn`/`error` to `stderr`, all unfiltered by Vite's own `LogOptions`. A
5
- * custom logger bypasses those. `quiet` drops `info` only; `warn`/`error`
6
- * still write, since they report something broken, not just what changed.
7
- */
8
- export declare function streamLogger(stdout: NodeJS.WritableStream, stderr: NodeJS.WritableStream, quiet?: boolean): Logger;
@@ -1,24 +0,0 @@
1
- import { Plugin } from 'vite';
2
- import { AdapterCore } from '../adapterCore.mts';
3
- /** Something an app can write that the engine can't run yet. */
4
- export interface UnsupportedFeature {
5
- /** The `ERR_INCA_*` identifier this failure is looked up by. */
6
- code: string;
7
- /** The feature, named as the app's author would recognise it. */
8
- name: string;
9
- /** Whether a module id is a use of the feature. */
10
- matches: (id: string) => boolean;
11
- /** What happens instead, and what to reach for. Appended to the error. */
12
- hint: string;
13
- }
14
- /**
15
- * Every feature a build refuses. Add an entry when the engine is found to
16
- * ignore something standard, so an app hits a build error instead of a
17
- * silent no-op at runtime; drop it again once the engine handles it.
18
- */
19
- export declare const UNSUPPORTED: readonly UnsupportedFeature[];
20
- /**
21
- * Fails the build on the first module that uses an unsupported feature,
22
- * naming the file that used it.
23
- */
24
- export declare function rejectUnsupported(core: AdapterCore, features?: readonly UnsupportedFeature[]): Plugin;
@@ -1,7 +0,0 @@
1
- import { AdapterCore, BundlerOptions, Watcher } from '../adapterCore.mts';
2
- /**
3
- * Builds `entry` into a build under `outDir` and rebuilds it on every
4
- * change, calling `onBuild` with what each rebuild wrote. Never starts,
5
- * reloads, or talks to `inca-host`.
6
- */
7
- export declare function watch(core: AdapterCore, runtimeModuleName: string, { onBuild, onError, stdout, stderr, quiet, ...buildOptions }: BundlerOptions): Promise<Watcher>;
@@ -1,27 +0,0 @@
1
- /** A watch that resolves once, when a file that decides the app's config or entry changes. */
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 how an app starts: `inca.config.*` and `package.json` in `cwd`,
12
- * `src/main.mts`, `src/main.ts`, `src/main.js` and `src/App.vue`, and every file passed to
13
- * {@link EditWatch.add}. Creating, deleting, changing or renaming one of them counts as an edit.
14
- * 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;