@incajs/cli 0.0.1 → 0.0.2

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.
@@ -0,0 +1,44 @@
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" | "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
32
+ */
33
+ export declare function slugify(name: string): string;
34
+ /**
35
+ * @param pkgName - `package.json`'s own `"name"`, if it has one
36
+ * @returns the `productName` a plain `package.json` implies — its name with
37
+ * any scope stripped — or `undefined` if it has none
38
+ */
39
+ export declare function defaultProductName(pkgName: string | undefined): string | undefined;
40
+ /**
41
+ * @param productName - the app's resolved display name
42
+ * @returns a generated `identifier`, e.g. `org.inca.click-counter`
43
+ */
44
+ export declare function defaultIdentifier(productName: string): string;
@@ -0,0 +1,18 @@
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, the same way `defineConfig` from `vite` or `vitest/config` works.
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: import('c12').DefineConfig<IncaConfig, import('c12').ConfigLayerMeta>;
@@ -0,0 +1,37 @@
1
+ /** `entry`/`outDir` only — what `build()`/`dev()` need, with no `package.json` requirement. */
2
+ export interface ResolvedBuildConfig {
3
+ /** Absolute path, if `inca.config.ts` set one. */
4
+ entry?: string;
5
+ /** Absolute path. */
6
+ outDir: string;
7
+ }
8
+ /** An app's full config, as `inca package` needs it. */
9
+ export interface ResolvedAppConfig extends ResolvedBuildConfig {
10
+ productName: string;
11
+ identifier: string;
12
+ /** True when `identifier` was generated rather than set explicitly. */
13
+ identifierIsDefault: boolean;
14
+ version: string;
15
+ /** Absolute path, if the app declared one. */
16
+ icon?: string;
17
+ /** package.json's `"inca"` key is deprecated; callers warn when this is true. */
18
+ usedPackageJsonKey: boolean;
19
+ }
20
+ /**
21
+ * Loads just `entry`/`outDir` from `inca.config.ts`, with derived defaults.
22
+ * Never touches `package.json`.
23
+ *
24
+ * @param cwd - the app's root directory
25
+ * @returns `entry`/`outDir`, resolved to absolute paths
26
+ */
27
+ export declare function resolveBuildConfig(cwd: string): Promise<ResolvedBuildConfig>;
28
+ /**
29
+ * Loads an app's full config for `inca package`: `inca.config.ts` over
30
+ * `package.json`'s `"inca"` key over derived defaults.
31
+ *
32
+ * @param cwd - the app's root directory
33
+ * @returns the resolved config
34
+ * @throws if `package.json` is missing, has neither a `name` nor a
35
+ * `productName`, or an `icon` doesn't resolve to a real file
36
+ */
37
+ export declare function resolveAppConfig(cwd: string): Promise<ResolvedAppConfig>;
@@ -0,0 +1,35 @@
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 relative to this config file's own 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`, or
27
+ * `src/App.vue` wrapped in a synthesized one
28
+ */
29
+ entry?: string;
30
+ /**
31
+ * Where a build's output is written.
32
+ * @default "dist"
33
+ */
34
+ outDir?: string;
35
+ }
package/dist/config.js ADDED
@@ -0,0 +1,5 @@
1
+ import { a as e, t } from "./chunks/defaults-EWjAFeZ3.js";
2
+ //#region src/config/index.mts
3
+ var n = e();
4
+ //#endregion
5
+ export { t as defaultConfig, n as defineConfig };
package/dist/index.d.mts CHANGED
@@ -1 +1,2 @@
1
1
  export type { BuildOptions, BuildOutput, Bundler, BundlerOptions, Watcher, } from './adapter/types.mts';
2
+ export type { ResolvedAppConfig } from './config/loader.mts';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@incajs/cli",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "The inca CLI: watches an app's entry point through a bundler adapter, starts inca-host once the first bundle lands, and reloads it on every rebuild.",
5
5
  "keywords": [
6
6
  "bundler",
@@ -15,6 +15,7 @@
15
15
  "quickjs",
16
16
  "vite"
17
17
  ],
18
+ "homepage": "https://tom96da.github.io/incajs/",
18
19
  "license": "(MIT OR Apache-2.0)",
19
20
  "repository": {
20
21
  "type": "git",
@@ -36,25 +37,30 @@
36
37
  ".": {
37
38
  "types": "./dist/index.d.mts",
38
39
  "import": "./dist/index.js"
40
+ },
41
+ "./config": {
42
+ "types": "./dist/config/index.d.mts",
43
+ "import": "./dist/config.js"
39
44
  }
40
45
  },
41
46
  "publishConfig": {
42
47
  "access": "public"
43
48
  },
44
49
  "dependencies": {
45
- "@vitejs/plugin-vue": "^6.0.8",
46
- "vite": "^8.2.2"
50
+ "@vitejs/plugin-vue": "^6.0.9",
51
+ "vite": "^8.3.0"
47
52
  },
48
53
  "devDependencies": {
49
- "@types/node": "^26.4.1",
50
- "@vue/runtime-core": "^3.5.42",
51
- "oxfmt": "^0.66.0",
52
- "oxlint": "^1.81.0",
53
- "rolldown": "~1.2.4",
54
- "vue": "^3.5.42"
54
+ "@types/node": "^26.6.2",
55
+ "@vue/runtime-core": "^3.5.43",
56
+ "c12": "4.0.0-rc.1",
57
+ "oxfmt": "^0.68.0",
58
+ "oxlint": "^1.83.0",
59
+ "rolldown": "~1.2.9",
60
+ "vue": "^3.5.43"
55
61
  },
56
62
  "peerDependencies": {
57
- "vue": "^3.5.42"
63
+ "vue": "^3.5.43"
58
64
  },
59
65
  "peerDependenciesMeta": {
60
66
  "vue": {
@@ -62,12 +68,12 @@
62
68
  }
63
69
  },
64
70
  "optionalDependencies": {
65
- "@incajs/host-darwin-arm64": "0.0.1",
66
- "@incajs/host-linux-arm64": "0.0.1",
67
- "@incajs/host-linux-x64": "0.0.1"
71
+ "@incajs/host-darwin-arm64": "0.0.2",
72
+ "@incajs/host-linux-arm64": "0.0.2",
73
+ "@incajs/host-linux-x64": "0.0.2"
68
74
  },
69
75
  "engines": {
70
- "node": ">=22"
76
+ "node": ">=22.18"
71
77
  },
72
78
  "scripts": {
73
79
  "build": "vite build",
@@ -1,30 +0,0 @@
1
- /** An app's identity and version, for `inca package` to stamp onto the application it emits. */
2
- export interface AppMetadata {
3
- /** Shown to the user — the app's display name. */
4
- productName: string;
5
- /** A reverse-DNS-style unique id — e.g. macOS's `CFBundleIdentifier`. */
6
- identifier: string;
7
- /** True when `identifier` was derived rather than set by the app. */
8
- identifierIsDefault: boolean;
9
- /** The packaged app's version. */
10
- version: string;
11
- /** Absolute path to an icon file, if the app declared one. */
12
- icon?: string;
13
- }
14
- /**
15
- * Turns a display name into a filesystem/URL-safe slug — lowercased, with
16
- * anything outside `[a-z0-9]` collapsed into a single `-`. Used for the
17
- * default `identifier` and for the Linux packaged-app directory name.
18
- */
19
- export declare function slugify(name: string): string;
20
- /**
21
- * Reads an app's package metadata for `inca package`: `productName`,
22
- * `identifier`, `version`, and an optional `icon`. Everything is derived
23
- * from the app's own `package.json` — its `name`/`version` fields, and an
24
- * optional `"inca"` key overriding any of them:
25
- * `{ "inca": { "productName", "identifier", "icon" } }`.
26
- *
27
- * @throws if `package.json` is missing, has neither a `name` nor a
28
- * `"inca".productName`, or `"inca".icon` doesn't resolve to a real file.
29
- */
30
- export declare function readAppMetadata(cwd: string): Promise<AppMetadata>;