@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
|
@@ -28,7 +28,8 @@ export declare function unscopedName(name: string): string;
|
|
|
28
28
|
*
|
|
29
29
|
* @param name - e.g. a `productName`
|
|
30
30
|
* @returns `name` lowercased, with runs of non-`[a-z0-9]` collapsed to a
|
|
31
|
-
* single `-` and trimmed from both ends
|
|
31
|
+
* single `-` and trimmed from both ends; `"app"` for a name that holds
|
|
32
|
+
* none of those characters
|
|
32
33
|
*/
|
|
33
34
|
export declare function slugify(name: string): string;
|
|
34
35
|
/**
|
package/dist/config/loader.d.mts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { WindowConfig } from './types.mts';
|
|
1
2
|
/** `entry`/`outDir` only — what `build()`/`dev()` need, with no `package.json` requirement. */
|
|
2
3
|
export interface ResolvedBuildConfig {
|
|
3
4
|
/** Absolute path, if `inca.config.ts` set one. */
|
|
@@ -14,9 +15,21 @@ export interface ResolvedAppConfig extends ResolvedBuildConfig {
|
|
|
14
15
|
version: string;
|
|
15
16
|
/** Absolute path, if the app declared one. */
|
|
16
17
|
icon?: string;
|
|
18
|
+
/** What the app declared about its window, if anything. */
|
|
19
|
+
window?: WindowConfig;
|
|
17
20
|
/** package.json's `"inca"` key is deprecated; callers warn when this is true. */
|
|
18
21
|
usedPackageJsonKey: boolean;
|
|
19
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* What a built app carries for its host to read: the name the platform
|
|
25
|
+
* shows it under, the id it is known by, and its window. Each field is
|
|
26
|
+
* absent unless the app's config sets it.
|
|
27
|
+
*/
|
|
28
|
+
export interface RuntimeConfig {
|
|
29
|
+
name?: string;
|
|
30
|
+
identifier?: string;
|
|
31
|
+
window?: WindowConfig;
|
|
32
|
+
}
|
|
20
33
|
/**
|
|
21
34
|
* Loads just `entry`/`outDir` from `inca.config.ts`, with derived defaults.
|
|
22
35
|
* Never touches `package.json`.
|
|
@@ -35,3 +48,19 @@ export declare function resolveBuildConfig(cwd: string): Promise<ResolvedBuildCo
|
|
|
35
48
|
* `productName`, or an `icon` doesn't resolve to a real file
|
|
36
49
|
*/
|
|
37
50
|
export declare function resolveAppConfig(cwd: string): Promise<ResolvedAppConfig>;
|
|
51
|
+
/**
|
|
52
|
+
* Narrows a full config down to what a build carries for the host.
|
|
53
|
+
*
|
|
54
|
+
* @param config - a config {@link resolveAppConfig} returned
|
|
55
|
+
* @returns its name, id and window
|
|
56
|
+
*/
|
|
57
|
+
export declare function runtimeConfigOf(config: ResolvedAppConfig): RuntimeConfig;
|
|
58
|
+
/**
|
|
59
|
+
* Loads {@link RuntimeConfig} for an app that may name itself nowhere.
|
|
60
|
+
* An app with no `package.json`, or none that gives it a name, still gets
|
|
61
|
+
* whatever window settings it declared.
|
|
62
|
+
*
|
|
63
|
+
* @param cwd - the app's root directory
|
|
64
|
+
* @returns the config, or `undefined` when the app declares none of it
|
|
65
|
+
*/
|
|
66
|
+
export declare function resolveRuntimeConfig(cwd: string): Promise<RuntimeConfig | undefined>;
|
package/dist/config/types.d.mts
CHANGED
|
@@ -32,4 +32,35 @@ export interface IncaConfig {
|
|
|
32
32
|
* @default "dist"
|
|
33
33
|
*/
|
|
34
34
|
outDir?: string;
|
|
35
|
+
/** The window the app opens in. */
|
|
36
|
+
window?: WindowConfig;
|
|
37
|
+
}
|
|
38
|
+
/** What an app declares about its window — see {@link IncaConfig.window}. */
|
|
39
|
+
export interface WindowConfig {
|
|
40
|
+
/**
|
|
41
|
+
* Initial width, in pixels. Falls back to the width the app's root
|
|
42
|
+
* element declares, then to this default.
|
|
43
|
+
* @default 800
|
|
44
|
+
*/
|
|
45
|
+
width?: number;
|
|
46
|
+
/**
|
|
47
|
+
* Initial height, in pixels. Falls back to the height the app's root
|
|
48
|
+
* element declares, then to this default.
|
|
49
|
+
* @default 600
|
|
50
|
+
*/
|
|
51
|
+
height?: number;
|
|
52
|
+
/**
|
|
53
|
+
* The window's title.
|
|
54
|
+
* @default the app's productName
|
|
55
|
+
*/
|
|
56
|
+
title?: string;
|
|
57
|
+
/**
|
|
58
|
+
* Whether a user can resize the window.
|
|
59
|
+
* @default false
|
|
60
|
+
*/
|
|
61
|
+
resizable?: boolean;
|
|
62
|
+
/** Smallest width the window can be, in pixels. It opens at least this wide. */
|
|
63
|
+
minWidth?: number;
|
|
64
|
+
/** Smallest height the window can be, in pixels. It opens at least this tall. */
|
|
65
|
+
minHeight?: number;
|
|
35
66
|
}
|
package/dist/config.js
CHANGED
|
@@ -44,8 +44,14 @@ export declare class HostClient {
|
|
|
44
44
|
* binary doesn't exist).
|
|
45
45
|
*/
|
|
46
46
|
start(): Promise<void>;
|
|
47
|
-
/**
|
|
48
|
-
|
|
47
|
+
/**
|
|
48
|
+
* Sends a request and resolves with its result once the host answers.
|
|
49
|
+
* With `timeoutMs`, rejects once that much time passes with no answer —
|
|
50
|
+
* the host answers on the same thread that runs the app's JS, so a
|
|
51
|
+
* wedged app leaves a call pending forever otherwise (PROTOCOL.md:
|
|
52
|
+
* "every response a client waits for needs a deadline").
|
|
53
|
+
*/
|
|
54
|
+
call(method: string, params?: unknown, timeoutMs?: number): Promise<unknown>;
|
|
49
55
|
/**
|
|
50
56
|
* Asks the host to `shutdown` and waits for the child to actually exit —
|
|
51
57
|
* that exit is the real acknowledgement, not the response. Kills it once
|
package/dist/dev.d.mts
CHANGED
|
@@ -9,7 +9,10 @@ export interface DevOptions {
|
|
|
9
9
|
entry?: string;
|
|
10
10
|
/** Overrides the bundler — see {@link defaultBundler} for what's wired in by default. */
|
|
11
11
|
bundler?: Bundler;
|
|
12
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* Overrides host binary resolution. On macOS this is the binary the
|
|
14
|
+
* app bundle wraps; elsewhere it is launched directly.
|
|
15
|
+
*/
|
|
13
16
|
hostBin?: string;
|
|
14
17
|
/** Defaults to `process.stdout`. */
|
|
15
18
|
stdout?: NodeJS.WritableStream;
|
package/dist/index.d.mts
CHANGED
|
@@ -0,0 +1,47 @@
|
|
|
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>;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@incajs/cli",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.0.5",
|
|
4
|
+
"description": "Dev server, bundler, and packager for Incarnative.js apps.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bundler",
|
|
7
7
|
"cli",
|
|
@@ -68,9 +68,9 @@
|
|
|
68
68
|
}
|
|
69
69
|
},
|
|
70
70
|
"optionalDependencies": {
|
|
71
|
-
"@incajs/host-darwin-arm64": "0.0.
|
|
72
|
-
"@incajs/host-linux-arm64": "0.0.
|
|
73
|
-
"@incajs/host-linux-x64": "0.0.
|
|
71
|
+
"@incajs/host-darwin-arm64": "0.0.5",
|
|
72
|
+
"@incajs/host-linux-arm64": "0.0.5",
|
|
73
|
+
"@incajs/host-linux-x64": "0.0.5"
|
|
74
74
|
},
|
|
75
75
|
"engines": {
|
|
76
76
|
"node": ">=22.18"
|