@xessa/cli 0.0.0-stage → 0.1.1
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/LICENSE +21 -0
- package/README.md +42 -2
- package/dist/args.d.ts +43 -0
- package/dist/args.d.ts.map +1 -0
- package/dist/args.js +202 -0
- package/dist/args.js.map +1 -0
- package/dist/commands/build.d.ts +44 -0
- package/dist/commands/build.d.ts.map +1 -0
- package/dist/commands/build.js +533 -0
- package/dist/commands/build.js.map +1 -0
- package/dist/commands/check.d.ts +11 -0
- package/dist/commands/check.d.ts.map +1 -0
- package/dist/commands/check.js +35 -0
- package/dist/commands/check.js.map +1 -0
- package/dist/commands/clean.d.ts +12 -0
- package/dist/commands/clean.d.ts.map +1 -0
- package/dist/commands/clean.js +140 -0
- package/dist/commands/clean.js.map +1 -0
- package/dist/commands/format.d.ts +41 -0
- package/dist/commands/format.d.ts.map +1 -0
- package/dist/commands/format.js +127 -0
- package/dist/commands/format.js.map +1 -0
- package/dist/commands/watch.d.ts +38 -0
- package/dist/commands/watch.d.ts.map +1 -0
- package/dist/commands/watch.js +338 -0
- package/dist/commands/watch.js.map +1 -0
- package/dist/compiler.d.ts +20 -0
- package/dist/compiler.d.ts.map +1 -0
- package/dist/compiler.js +57 -0
- package/dist/compiler.js.map +1 -0
- package/dist/config.d.ts +93 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +331 -0
- package/dist/config.js.map +1 -0
- package/dist/formatter.d.ts +21 -0
- package/dist/formatter.d.ts.map +1 -0
- package/dist/formatter.js +38 -0
- package/dist/formatter.js.map +1 -0
- package/dist/glob.d.ts +52 -0
- package/dist/glob.d.ts.map +1 -0
- package/dist/glob.js +214 -0
- package/dist/glob.js.map +1 -0
- package/dist/index.d.ts +34 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +114 -0
- package/dist/index.js.map +1 -0
- package/dist/manifest.d.ts +56 -0
- package/dist/manifest.d.ts.map +1 -0
- package/dist/manifest.js +138 -0
- package/dist/manifest.js.map +1 -0
- package/dist/paths.d.ts +24 -0
- package/dist/paths.d.ts.map +1 -0
- package/dist/paths.js +42 -0
- package/dist/paths.js.map +1 -0
- package/dist/project.d.ts +44 -0
- package/dist/project.d.ts.map +1 -0
- package/dist/project.js +92 -0
- package/dist/project.js.map +1 -0
- package/dist/report.d.ts +128 -0
- package/dist/report.d.ts.map +1 -0
- package/dist/report.js +128 -0
- package/dist/report.js.map +1 -0
- package/dist/setup.d.ts +58 -0
- package/dist/setup.d.ts.map +1 -0
- package/dist/setup.js +181 -0
- package/dist/setup.js.map +1 -0
- package/dist/writer.d.ts +32 -0
- package/dist/writer.d.ts.map +1 -0
- package/dist/writer.js +93 -0
- package/dist/writer.js.map +1 -0
- package/package.json +40 -4
- package/src/args.ts +246 -0
- package/src/commands/build.ts +682 -0
- package/src/commands/check.ts +45 -0
- package/src/commands/clean.ts +168 -0
- package/src/commands/format.ts +169 -0
- package/src/commands/watch.ts +366 -0
- package/src/compiler-api.d.ts +261 -0
- package/src/compiler.ts +65 -0
- package/src/config.ts +443 -0
- package/src/formatter.ts +56 -0
- package/src/glob.ts +230 -0
- package/src/index.ts +137 -0
- package/src/manifest.ts +176 -0
- package/src/paths.ts +50 -0
- package/src/project.ts +122 -0
- package/src/report.ts +230 -0
- package/src/setup.ts +218 -0
- package/src/writer.ts +102 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Marky
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,43 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @xessa/cli
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The Xessa command line interface: `xessa build`, `xessa watch`, `xessa check`, `xessa format` and
|
|
4
|
+
`xessa clean`. It uses the same `@xessa/compiler` as the API and the VS Code extension.
|
|
5
|
+
|
|
6
|
+
Source files use the `.cssx` extension (ADR-0013). The command, configuration file
|
|
7
|
+
(`xessa.config.json`) and diagnostic codes (`XESSA####`) keep the Xessa name.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
**0.1.1** is the first Xessa release (2026-11-27), prepared for publication; publish with
|
|
12
|
+
`docs/release.md`. Once published, install it with:
|
|
13
|
+
|
|
14
|
+
```sh
|
|
15
|
+
npm install --global @xessa/cli
|
|
16
|
+
# or run it without installing
|
|
17
|
+
npx @xessa/cli build
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
The packaged `bin` entry is the built `dist/index.js`, so `npx @xessa/cli` / `bunx xessa` no longer
|
|
21
|
+
need a TypeScript loader. The source and built entry use the `#!/usr/bin/env node` shebang, so the
|
|
22
|
+
CLI runs on a Node-only machine (Bun executes the same file).
|
|
23
|
+
|
|
24
|
+
## Commands
|
|
25
|
+
|
|
26
|
+
| Command | Purpose |
|
|
27
|
+
|---|---|
|
|
28
|
+
| `xessa build [file]` | Build one entry or the project from `xessa.config.json`. |
|
|
29
|
+
| `xessa watch [file]` | Rebuild affected entries on change. |
|
|
30
|
+
| `xessa check [file]` | Validate without writing. |
|
|
31
|
+
| `xessa format [file] [--check]` | Format source files or verify formatting. |
|
|
32
|
+
| `xessa clean` | Delete manifest-owned, unmodified generated files. |
|
|
33
|
+
|
|
34
|
+
Exit codes: `0` success, `1` compile/validation error, `2` invocation or configuration error.
|
|
35
|
+
|
|
36
|
+
## Documentation
|
|
37
|
+
|
|
38
|
+
The repository `README.md`, `docs/configuration.md`, `docs/release.md` and `CHANGELOG.md` describe
|
|
39
|
+
configuration, precedence, output safety and known gaps.
|
|
40
|
+
|
|
41
|
+
## License
|
|
42
|
+
|
|
43
|
+
MIT. See `LICENSE` in this package.
|
package/dist/args.d.ts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Command-line argument parsing for `xessa`.
|
|
3
|
+
*
|
|
4
|
+
* Parsing is strict: unknown flags, missing flag values, extra positional
|
|
5
|
+
* arguments and a missing command all fail with exit code 2 (invocation error).
|
|
6
|
+
* `--help` and `--version` short-circuit every other rule.
|
|
7
|
+
*/
|
|
8
|
+
/** Commands the CLI dispatches. */
|
|
9
|
+
export type CommandName = "build" | "check" | "watch" | "clean" | "format" | "help";
|
|
10
|
+
/** Parsed CLI invocation. */
|
|
11
|
+
export interface CliInvocation {
|
|
12
|
+
/** Selected command; `help` when only `--help`/`--version` was requested. */
|
|
13
|
+
readonly command: CommandName;
|
|
14
|
+
/** Optional source file for single-entry build/check/watch. */
|
|
15
|
+
readonly file?: string;
|
|
16
|
+
/** Explicit `--config` path, absolute or relative to the working directory. */
|
|
17
|
+
readonly configPath?: string;
|
|
18
|
+
/** Emit machine-readable JSON (build/check/clean) or NDJSON (watch). */
|
|
19
|
+
readonly json: boolean;
|
|
20
|
+
/** Report planned work without writing or deleting. */
|
|
21
|
+
readonly dryRun: boolean;
|
|
22
|
+
/** `true` for `--minify`, `false` for `--no-minify`, `undefined` when unset. */
|
|
23
|
+
readonly minify?: boolean;
|
|
24
|
+
/** `true` for `--check`: report files that `format` would change, write nothing. */
|
|
25
|
+
readonly check?: boolean;
|
|
26
|
+
}
|
|
27
|
+
/** Parse outcome for {@link parseArgs}. */
|
|
28
|
+
export type ParseOutcome = {
|
|
29
|
+
readonly ok: true;
|
|
30
|
+
readonly invocation: CliInvocation;
|
|
31
|
+
readonly help: boolean;
|
|
32
|
+
readonly version: boolean;
|
|
33
|
+
} | {
|
|
34
|
+
readonly ok: false;
|
|
35
|
+
readonly message: string;
|
|
36
|
+
/** Whether `--json` was seen before the failure, so callers can emit JSON. */
|
|
37
|
+
readonly json: boolean;
|
|
38
|
+
};
|
|
39
|
+
/** Usage text written by `--help`. */
|
|
40
|
+
export declare const USAGE = "xessa \u2014 compile Xessa stylesheets\n\nUsage:\n xessa build [file] [flags]\n xessa check [file] [flags]\n xessa watch [file] [flags]\n xessa clean [flags]\n xessa format [file] [flags]\n xessa --help\n xessa --version\n\nCommands:\n build Compile the project (config include globs) or one file and write outputs\n check Report diagnostics and planned outputs without writing anything\n watch Rebuild changed entries until interrupted\n clean Delete compiler-owned outputs that were not modified since generation\n format Format sources canonically (with --check to report without writing)\n\nFlags:\n --config <path> Use a specific xessa.config.json instead of the nearest one\n --json Print machine-readable results\n --dry-run Report planned work without writing files or deleting them\n --minify Emit compact CSS\n --no-minify Emit expanded CSS\n --check With format: list files that would change; write nothing\n -h, --help Show this help\n -v, --version Print the CLI version\n\nExit codes:\n 0 success\n 1 compile, validation or formatting errors (or --check found changes)\n 2 invocation or configuration errors\n";
|
|
41
|
+
/** Parse process arguments (without `node`/script) into an invocation. */
|
|
42
|
+
export declare function parseArgs(argv: readonly string[]): Par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SAAS,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,YAAY,CAsJ/D"}
|
package/dist/args.js
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Command-line argument parsing for `xessa`.
|
|
3
|
+
*
|
|
4
|
+
* Parsing is strict: unknown flags, missing flag values, extra positional
|
|
5
|
+
* arguments and a missing command all fail with exit code 2 (invocation error).
|
|
6
|
+
* `--help` and `--version` short-circuit every other rule.
|
|
7
|
+
*/
|
|
8
|
+
/** Usage text written by `--help`. */
|
|
9
|
+
export const USAGE = `xessa — compile Xessa stylesheets
|
|
10
|
+
|
|
11
|
+
Usage:
|
|
12
|
+
xessa build [file] [flags]
|
|
13
|
+
xessa check [file] [flags]
|
|
14
|
+
xessa watch [file] [flags]
|
|
15
|
+
xessa clean [flags]
|
|
16
|
+
xessa format [file] [flags]
|
|
17
|
+
xessa --help
|
|
18
|
+
xessa --version
|
|
19
|
+
|
|
20
|
+
Commands:
|
|
21
|
+
build Compile the project (config include globs) or one file and write outputs
|
|
22
|
+
check Report diagnostics and planned outputs without writing anything
|
|
23
|
+
watch Rebuild changed entries until interrupted
|
|
24
|
+
clean Delete compiler-owned outputs that were not modified since generation
|
|
25
|
+
format Format sources canonically (with --check to report without writing)
|
|
26
|
+
|
|
27
|
+
Flags:
|
|
28
|
+
--config <path> Use a specific xessa.config.json instead of the nearest one
|
|
29
|
+
--json Print machine-readable results
|
|
30
|
+
--dry-run Report planned work without writing files or deleting them
|
|
31
|
+
--minify Emit compact CSS
|
|
32
|
+
--no-minify Emit expanded CSS
|
|
33
|
+
--check With format: list files that would change; write nothing
|
|
34
|
+
-h, --help Show this help
|
|
35
|
+
-v, --version Print the CLI version
|
|
36
|
+
|
|
37
|
+
Exit codes:
|
|
38
|
+
0 success
|
|
39
|
+
1 compile, validation or formatting errors (or --check found changes)
|
|
40
|
+
2 invocation or configuration errors
|
|
41
|
+
`;
|
|
42
|
+
const COMMANDS = new Set([
|
|
43
|
+
"build",
|
|
44
|
+
"check",
|
|
45
|
+
"watch",
|
|
46
|
+
"clean",
|
|
47
|
+
"format",
|
|
48
|
+
"help",
|
|
49
|
+
]);
|
|
50
|
+
const VALUE_FLAGS = new Set(["--config"]);
|
|
51
|
+
/** Parse process arguments (without `node`/script) into an invocation. */
|
|
52
|
+
export function parseArgs(argv) {
|
|
53
|
+
let command;
|
|
54
|
+
const positionals = [];
|
|
55
|
+
let configPath;
|
|
56
|
+
let json = false;
|
|
57
|
+
let dryRun = false;
|
|
58
|
+
let minify;
|
|
59
|
+
let check = false;
|
|
60
|
+
let help = false;
|
|
61
|
+
let version = false;
|
|
62
|
+
let flagsEnded = false;
|
|
63
|
+
let index = 0;
|
|
64
|
+
while (index < argv.length) {
|
|
65
|
+
const raw = argv[index];
|
|
66
|
+
index += 1;
|
|
67
|
+
if (raw === undefined)
|
|
68
|
+
break;
|
|
69
|
+
if (!flagsEnded && raw === "--") {
|
|
70
|
+
flagsEnded = true;
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
if (!flagsEnded && raw.startsWith("-") && raw !== "-") {
|
|
74
|
+
const equals = raw.indexOf("=");
|
|
75
|
+
const name = equals < 0 ? raw : raw.slice(0, equals);
|
|
76
|
+
const inlineValue = equals < 0 ? undefined : raw.slice(equals + 1);
|
|
77
|
+
if (name === "-h" || name === "--help") {
|
|
78
|
+
help = true;
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
if (name === "-v" || name === "--version") {
|
|
82
|
+
version = true;
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
if (name === "--json") {
|
|
86
|
+
if (inlineValue !== undefined)
|
|
87
|
+
return fail("--json does not take a value.", json);
|
|
88
|
+
json = true;
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
if (name === "--dry-run") {
|
|
92
|
+
if (inlineValue !== undefined)
|
|
93
|
+
return fail("--dry-run does not take a value.", json);
|
|
94
|
+
dryRun = true;
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
if (name === "--minify") {
|
|
98
|
+
if (inlineValue !== undefined)
|
|
99
|
+
return fail("--minify does not take a value.", json);
|
|
100
|
+
minify = true;
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
103
|
+
if (name === "--no-minify") {
|
|
104
|
+
if (inlineValue !== undefined)
|
|
105
|
+
return fail("--no-minify does not take a value.", json);
|
|
106
|
+
minify = false;
|
|
107
|
+
continue;
|
|
108
|
+
}
|
|
109
|
+
if (name === "--check") {
|
|
110
|
+
if (inlineValue !== undefined)
|
|
111
|
+
return fail("--check does not take a value.", json);
|
|
112
|
+
check = true;
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
if (VALUE_FLAGS.has(name)) {
|
|
116
|
+
// A value flag never consumes another option as its value: `--config
|
|
117
|
+
// --json` is a missing path, not a configuration named `--json`. A bare
|
|
118
|
+
// `-` is a legal value (standard input / literal dash).
|
|
119
|
+
if (inlineValue === undefined) {
|
|
120
|
+
const next = argv[index];
|
|
121
|
+
if (next === undefined || next === "" || (next.startsWith("-") && next !== "-")) {
|
|
122
|
+
return fail(`${name} requires a path.`, json);
|
|
123
|
+
}
|
|
124
|
+
index += 1;
|
|
125
|
+
if (name === "--config") {
|
|
126
|
+
if (configPath !== undefined)
|
|
127
|
+
return fail("--config may be given only once.", json);
|
|
128
|
+
configPath = next;
|
|
129
|
+
}
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
if (inlineValue === "")
|
|
133
|
+
return fail(`${name} requires a path.`, json);
|
|
134
|
+
if (name === "--config") {
|
|
135
|
+
if (configPath !== undefined)
|
|
136
|
+
return fail("--config may be given only once.", json);
|
|
137
|
+
configPath = inlineValue;
|
|
138
|
+
}
|
|
139
|
+
continue;
|
|
140
|
+
}
|
|
141
|
+
return fail(`Unknown option "${raw}".`, json);
|
|
142
|
+
}
|
|
143
|
+
if (command === undefined) {
|
|
144
|
+
if (!COMMANDS.has(raw))
|
|
145
|
+
return fail(`Unknown command "${raw}".`, json);
|
|
146
|
+
command = raw;
|
|
147
|
+
continue;
|
|
148
|
+
}
|
|
149
|
+
positionals.push(raw);
|
|
150
|
+
}
|
|
151
|
+
if (help || version) {
|
|
152
|
+
return {
|
|
153
|
+
ok: true,
|
|
154
|
+
invocation: {
|
|
155
|
+
command: "help",
|
|
156
|
+
...(configPath === undefined ? {} : { configPath }),
|
|
157
|
+
json,
|
|
158
|
+
dryRun,
|
|
159
|
+
...(minify === undefined ? {} : { minify }),
|
|
160
|
+
...(check ? { check: true } : {}),
|
|
161
|
+
},
|
|
162
|
+
help,
|
|
163
|
+
version,
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
if (command === undefined) {
|
|
167
|
+
return fail("Missing command. Run xessa --help for usage.", json);
|
|
168
|
+
}
|
|
169
|
+
if (check && command !== "format") {
|
|
170
|
+
return fail("--check is only valid for xessa format.", json);
|
|
171
|
+
}
|
|
172
|
+
// `check` never writes, so `--dry-run` cannot change its behaviour; accepting
|
|
173
|
+
// it silently made the JSON report contradict the invocation (CSSX-T12).
|
|
174
|
+
if (dryRun && command === "check") {
|
|
175
|
+
return fail("--dry-run is not valid for xessa check.", json);
|
|
176
|
+
}
|
|
177
|
+
const maxPositionals = command === "clean" ? 0 : 1;
|
|
178
|
+
if (positionals.length > maxPositionals) {
|
|
179
|
+
return fail(maxPositionals === 0
|
|
180
|
+
? `xessa ${command} does not take a file argument.`
|
|
181
|
+
: `xessa ${command} accepts at most one file argument.`, json);
|
|
182
|
+
}
|
|
183
|
+
const file = positionals[0];
|
|
184
|
+
return {
|
|
185
|
+
ok: true,
|
|
186
|
+
invocation: {
|
|
187
|
+
command,
|
|
188
|
+
...(file === undefined ? {} : { file }),
|
|
189
|
+
...(configPath === undefined ? {} : { configPath }),
|
|
190
|
+
json,
|
|
191
|
+
dryRun,
|
|
192
|
+
...(minify === undefined ? {} : { minify }),
|
|
193
|
+
...(check ? { check: true } : {}),
|
|
194
|
+
},
|
|
195
|
+
help: false,
|
|
196
|
+
version: false,
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
function fail(message, json) {
|
|
200
|
+
return { ok: false, message, json };
|
|
201
|
+
}
|
|
202
|
+
//# sourceMappingURL=args.js.map
|
package/dist/args.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"args.js","sourceRoot":"","sources":["../src/args.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAsCH,sCAAsC;AACtC,MAAM,CAAC,MAAM,KAAK,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgCpB,CAAC;AAEF,MAAM,QAAQ,GAAwB,IAAI,GAAG,CAAC;IAC5C,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,QAAQ;IACR,MAAM;CACP,CAAC,CAAC;AAEH,MAAM,WAAW,GAAwB,IAAI,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC;AAE/D,0EAA0E;AAC1E,MAAM,UAAU,SAAS,CAAC,IAAuB;IAC/C,IAAI,OAAgC,CAAC;IACrC,MAAM,WAAW,GAAa,EAAE,CAAC;IACjC,IAAI,UAA8B,CAAC;IACnC,IAAI,IAAI,GAAG,KAAK,CAAC;IACjB,IAAI,MAAM,GAAG,KAAK,CAAC;IACnB,IAAI,MAA2B,CAAC;IAChC,IAAI,KAAK,GAAG,KAAK,CAAC;IAClB,IAAI,IAAI,GAAG,KAAK,CAAC;IACjB,IAAI,OAAO,GAAG,KAAK,CAAC;IACpB,IAAI,UAAU,GAAG,KAAK,CAAC;IACvB,IAAI,KAAK,GAAG,CAAC,CAAC;IAEd,OAAO,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;QAC3B,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;QACxB,KAAK,IAAI,CAAC,CAAC;QACX,IAAI,GAAG,KAAK,SAAS;YAAE,MAAM;QAE7B,IAAI,CAAC,UAAU,IAAI,GAAG,K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IAAI,EAAE,CAAC;AACtC,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build engine shared by `xessa build` and `xessa check`.
|
|
3
|
+
*
|
|
4
|
+
* Entries are planned with the public `planOutputs` API (mirroring the plan the
|
|
5
|
+
* compiler builds internally), compiled together with `compileProject`, and
|
|
6
|
+
* written per-file atomically. Errors keep the last successful outputs and skip
|
|
7
|
+
* every write for the affected entry.
|
|
8
|
+
*/
|
|
9
|
+
import type { CliInvocation } from "../args.js";
|
|
10
|
+
import { type ProjectContext } from "../project.js";
|
|
11
|
+
import { type BuildReport, type JsonBuildReport } from "../report.js";
|
|
12
|
+
/** Options for one build/check run. */
|
|
13
|
+
export interface ExecuteBuildOptions {
|
|
14
|
+
/** Resolved project inputs. */
|
|
15
|
+
readonly context: ProjectContext;
|
|
16
|
+
/** Write artifacts; `false` makes the run a check. */
|
|
17
|
+
readonly write: boolean;
|
|
18
|
+
/** Plan and compile but do not touch the disk. */
|
|
19
|
+
readonly dryRun: boolean;
|
|
20
|
+
/** Remove obsolete owned outputs after a fully successful project build. */
|
|
21
|
+
readonly prune: boolean;
|
|
22
|
+
/** `--minify` / `--no-minify` override. */
|
|
23
|
+
readonly minify?: boolean;
|
|
24
|
+
/** Returns `false` when a newer build generation superseded this one. */
|
|
25
|
+
readonly isCurrent?: () => boolean;
|
|
26
|
+
}
|
|
27
|
+
/** Result of {@link executeBuild}. */
|
|
28
|
+
export interface ExecuteBuildResult {
|
|
29
|
+
/** Structured report for text or JSON output. */
|
|
30
|
+
readonly report: BuildReport;
|
|
31
|
+
/** Whether the run was discarded because a newer generation started. */
|
|
32
|
+
readonly stale: boolean;
|
|
33
|
+
}
|
|
34
|
+
/** Run one build or check and return the structured report. */
|
|
35
|
+
export declare function executeBuild(options: ExecuteBuildOptions): Promise<ExecuteBuildResult>;
|
|
36
|
+
/** `xessa build` command entry point. */
|
|
37
|
+
export declare function runBuild(invocation: CliInvocation, cwd: string): Promise<number>;
|
|
38
|
+
/** Convert a report into its machine-readable shape. */
|
|
39
|
+
export declare function toJsonReport(report: BuildReport): JsonBuildReport;
|
|
40
|
+
/** Print a report as text or JSON. */
|
|
41
|
+
export declare function emitReport(report: BuildReport, json: boolean): void;
|
|
42
|
+
/** Exit code for a completed report: 1 when any error exists. */
|
|
43
|
+
export declare function reportExitCode(report: BuildReport): number;
|
|
44
|
+
//# sourceMappingURL=build.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAaH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAKhD,OAAO,EAAE,KAAK,cAAc,EAAkB,MAAM,eAAe,CAAC;AACpE,OAAO,EACL,KAAK,WAAW,EAIhB,KAAK,eAAe,EASrB,MAAM,cAAc,CAAC;AAItB,uCAAuC;AACvC,MAAM,WAAW,mBAAmB;IAClC,+BAA+B;IAC/B,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;IACjC,sDAAsD;IACtD,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,kDAAkD;IAClD,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,4EAA4E;IAC5E,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,2CAA2C;IAC3C,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B,yEAAyE;IACzE,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,OAAO,CAAC;CACpC;AAED,sCAAsC;AACtC,MAAM,WAAW,kBAAkB;IACjC,iDAAiD;IACjD,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,wEAAwE;IACxE,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB;AAeD,+DAA+D;AAC/D,wBAAsB,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,C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