@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.
Files changed (89) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +42 -2
  3. package/dist/args.d.ts +43 -0
  4. package/dist/args.d.ts.map +1 -0
  5. package/dist/args.js +202 -0
  6. package/dist/args.js.map +1 -0
  7. package/dist/commands/build.d.ts +44 -0
  8. package/dist/commands/build.d.ts.map +1 -0
  9. package/dist/commands/build.js +533 -0
  10. package/dist/commands/build.js.map +1 -0
  11. package/dist/commands/check.d.ts +11 -0
  12. package/dist/commands/check.d.ts.map +1 -0
  13. package/dist/commands/check.js +35 -0
  14. package/dist/commands/check.js.map +1 -0
  15. package/dist/commands/clean.d.ts +12 -0
  16. package/dist/commands/clean.d.ts.map +1 -0
  17. package/dist/commands/clean.js +140 -0
  18. package/dist/commands/clean.js.map +1 -0
  19. package/dist/commands/format.d.ts +41 -0
  20. package/dist/commands/format.d.ts.map +1 -0
  21. package/dist/commands/format.js +127 -0
  22. package/dist/commands/format.js.map +1 -0
  23. package/dist/commands/watch.d.ts +38 -0
  24. package/dist/commands/watch.d.ts.map +1 -0
  25. package/dist/commands/watch.js +338 -0
  26. package/dist/commands/watch.js.map +1 -0
  27. package/dist/compiler.d.ts +20 -0
  28. package/dist/compiler.d.ts.map +1 -0
  29. package/dist/compiler.js +57 -0
  30. package/dist/compiler.js.map +1 -0
  31. package/dist/config.d.ts +93 -0
  32. package/dist/config.d.ts.map +1 -0
  33. package/dist/config.js +331 -0
  34. package/dist/config.js.map +1 -0
  35. package/dist/formatter.d.ts +21 -0
  36. package/dist/formatter.d.ts.map +1 -0
  37. package/dist/formatter.js +38 -0
  38. package/dist/formatter.js.map +1 -0
  39. package/dist/glob.d.ts +52 -0
  40. package/dist/glob.d.ts.map +1 -0
  41. package/dist/glob.js +214 -0
  42. package/dist/glob.js.map +1 -0
  43. package/dist/index.d.ts +34 -0
  44. package/dist/index.d.ts.map +1 -0
  45. package/dist/index.js +114 -0
  46. package/dist/index.js.map +1 -0
  47. package/dist/manifest.d.ts +56 -0
  48. package/dist/manifest.d.ts.map +1 -0
  49. package/dist/manifest.js +138 -0
  50. package/dist/manifest.js.map +1 -0
  51. package/dist/paths.d.ts +24 -0
  52. package/dist/paths.d.ts.map +1 -0
  53. package/dist/paths.js +42 -0
  54. package/dist/paths.js.map +1 -0
  55. package/dist/project.d.ts +44 -0
  56. package/dist/project.d.ts.map +1 -0
  57. package/dist/project.js +92 -0
  58. package/dist/project.js.map +1 -0
  59. package/dist/report.d.ts +128 -0
  60. package/dist/report.d.ts.map +1 -0
  61. package/dist/report.js +128 -0
  62. package/dist/report.js.map +1 -0
  63. package/dist/setup.d.ts +58 -0
  64. package/dist/setup.d.ts.map +1 -0
  65. package/dist/setup.js +181 -0
  66. package/dist/setup.js.map +1 -0
  67. package/dist/writer.d.ts +32 -0
  68. package/dist/writer.d.ts.map +1 -0
  69. package/dist/writer.js +93 -0
  70. package/dist/writer.js.map +1 -0
  71. package/package.json +40 -4
  72. package/src/args.ts +246 -0
  73. package/src/commands/build.ts +682 -0
  74. package/src/commands/check.ts +45 -0
  75. package/src/commands/clean.ts +168 -0
  76. package/src/commands/format.ts +169 -0
  77. package/src/commands/watch.ts +366 -0
  78. package/src/compiler-api.d.ts +261 -0
  79. package/src/compiler.ts +65 -0
  80. package/src/config.ts +443 -0
  81. package/src/formatter.ts +56 -0
  82. package/src/glob.ts +230 -0
  83. package/src/index.ts +137 -0
  84. package/src/manifest.ts +176 -0
  85. package/src/paths.ts +50 -0
  86. package/src/project.ts +122 -0
  87. package/src/report.ts +230 -0
  88. package/src/setup.ts +218 -0
  89. package/src/writer.ts +102 -0
package/dist/config.js ADDED
@@ -0,0 +1,331 @@
1
+ /**
2
+ * `xessa.config.json` discovery, loading and schema validation.
3
+ *
4
+ * The document format is frozen by SPECIFICATION.md §10. Keys are camelCase in
5
+ * JSON while source `@setup` keys stay kebab-case:
6
+ *
7
+ * | `@setup` key | JSON key | Where |
8
+ * |---|---|---|
9
+ * | `prefix` | `classes.prefix` | `classes` |
10
+ * | `css-dir` | `output.cssDir` | `output` |
11
+ * | `css-name` | `output.cssName` | `output` |
12
+ * | `map-dir` | `output.mapDir` | `output` |
13
+ * | `map-name` | `output.mapName` | `output` |
14
+ * | `emit-css` | `output.emitCss` | `output` |
15
+ * | `emit-map` | `output.emitMap` | `output` |
16
+ * | `map-types` | `output.mapTypes` | `output` |
17
+ * | `emit-types` | `output.emitTypes` | `output` |
18
+ * | `source-map` | `output.sourceMap` | `output` |
19
+ * | `minify` | `output.minify` | `output` |
20
+ * | `map-inherit` | `output.mapInherit` | `output` |
21
+ * | `import-css` | `output.importCss` | `output` |
22
+ * | `media-grouping` | `compiler.mediaGrouping` | `compiler` |
23
+ *
24
+ * `output.prefix` is deliberately rejected: class naming lives under `classes`
25
+ * so strategy and prefix stay together.
26
+ *
27
+ * Unknown keys are rejected (exit 2) by default; an explicit
28
+ * `compiler.strict: false` downgrades them to warnings. Known keys are always
29
+ * type-checked.
30
+ *
31
+ * `include` defaults to {@link DEFAULT_INCLUDE} (`**\/*.cssx`), so a configuration
32
+ * file is only needed to change a default or scope discovery. `exclude` stays
33
+ * empty by default: imported modules declare themselves with
34
+ * `@setup { module: true; }` rather than appearing in a project-wide list.
35
+ */
36
+ import { readFile, stat } from "node:fs/promises";
37
+ import { absolutePath, dirnamePosix, toPosix } from "./paths.js";
38
+ /** Entry globs used when a project does not configure `include`. */
39
+ export const DEFAULT_INCLUDE = Object.freeze(["**/*.cssx"]);
40
+ const TOP_LEVEL_KEYS = new Set([
41
+ "$schema",
42
+ "include",
43
+ "exclude",
44
+ "output",
45
+ "classes",
46
+ "media",
47
+ "compiler",
48
+ ]);
49
+ const OUTPUT_KEYS = new Set([
50
+ "cssDir",
51
+ "cssName",
52
+ "mapDir",
53
+ "mapName",
54
+ "emitCss",
55
+ "emitMap",
56
+ "mapTypes",
57
+ "emitTypes",
58
+ "sourceMap",
59
+ "minify",
60
+ "mapInherit",
61
+ "importCss",
62
+ ]);
63
+ const CLASSES_KEYS = new Set(["strategy", "prefix"]);
64
+ const COMPILER_KEYS = new Set(["strict", "mediaGrouping"]);
65
+ /** Walk up from `startDir` to the filesystem root for the nearest config file. */
66
+ export async function findConfigPath(startDir) {
67
+ let current = toPosix(startDir);
68
+ for (;;) {
69
+ const candidate = `${current === "/" ? "" : current}/xessa.config.json`;
70
+ if (await isFile(candidate))
71
+ return candidate;
72
+ const parent = dirnamePosix(current);
73
+ if (parent === current)
74
+ return null;
75
+ current = parent;
76
+ }
77
+ }
78
+ /** Walk up for the nearest `xessa.config.json`, else `package.json`, else `startDir`. */
79
+ export async function findWorkspaceRoot(startDir) {
80
+ const config = await findConfigPath(startDir);
81
+ if (config !== null)
82
+ return dirnamePosix(config);
83
+ let current = toPosix(startDir);
84
+ for (;;) {
85
+ if (await isFile(`${current === "/" ? "" : current}/package.json`))
86
+ return current;
87
+ const parent = dirnamePosix(current);
88
+ if (parent === current)
89
+ return toPosix(startDir);
90
+ current = parent;
91
+ }
92
+ }
93
+ /** Load and validate `xessa.config.json`, resolving the nearest file when not explicit. */
94
+ export async function loadConfig(request) {
95
+ const explicit = request.explicitPath === undefined
96
+ ? undefined
97
+ : absolutePath(request.cwd, request.explicitPath);
98
+ const configPath = explicit ?? (await findConfigPath(request.startDir));
99
+ if (configPath === null)
100
+ return { ok: true, config: null, warnings: [] };
101
+ if (!(await isFile(configPath))) {
102
+ return {
103
+ ok: false,
104
+ message: explicit === undefined
105
+ ? `Configuration file could not be read: ${configPath}`
106
+ : `Configuration file not found: ${request.explicitPath ?? configPath}`,
107
+ };
108
+ }
109
+ let text;
110
+ try {
111
+ text = await readFile(configPath, "utf8");
112
+ }
113
+ catch (error) {
114
+ return { ok: false, message: `Could not read ${configPath}: ${describeError(error)}` };
115
+ }
116
+ const document = parseConfigDocument(text, configPath);
117
+ if (document.config === undefined || document.errors.length > 0) {
118
+ return { ok: false, message: document.errors.join("\n") };
119
+ }
120
+ return { ok: true, config: document.config, warnings: document.warnings };
121
+ }
122
+ /** Parse and validate one configuration document. */
123
+ export function parseConfigDocument(text, file) {
124
+ let value;
125
+ try {
126
+ value = JSON.parse(text);
127
+ }
128
+ catch (error) {
129
+ return { errors: [`${file}: invalid JSON: ${describeError(error)}`], warnings: [] };
130
+ }
131
+ if (!isRecord(value)) {
132
+ return { errors: [`${file}: expected a JSON object at the top level.`], warnings: [] };
133
+ }
134
+ const errors = [];
135
+ const warnings = [];
136
+ const compilerValue = value.compiler;
137
+ // Strict is the default; only an explicit `false` downgrades unknown keys.
138
+ const strict = !(isRecord(compilerValue) && compilerValue.strict === false);
139
+ reportUnknownKeys(value, TOP_LEVEL_KEYS, "", strict, errors, warnings);
140
+ const include = readStringArray(value.include, "include", errors) ?? DEFAULT_INCLUDE;
141
+ const exclude = readStringArray(value.exclude, "exclude", errors) ?? [];
142
+ const output = readOutput(value.output, strict, errors, warnings);
143
+ const classes = readClasses(value.classes, strict, errors, warnings);
144
+ const media = readMedia(value.media, errors);
145
+ const compiler = readCompiler(value.compiler, strict, errors, warnings) ?? {
146
+ strict: true,
147
+ mediaGrouping: "safe",
148
+ };
149
+ if (errors.length > 0)
150
+ return { errors, warnings };
151
+ return {
152
+ config: {
153
+ file,
154
+ root: dirnamePosix(file),
155
+ include,
156
+ exclude,
157
+ ...(output === undefined ? {} : { output }),
158
+ ...(classes === undefined ? {} : { classes }),
159
+ ...(media === undefined ? {} : { media }),
160
+ compiler,
161
+ },
162
+ errors,
163
+ warnings,
164
+ };
165
+ }
166
+ function readOutput(value, strict, errors, warnings) {
167
+ if (value === undefined)
168
+ return undefined;
169
+ if (!isRecord(value)) {
170
+ errors.push(`"output" must be an object.`);
171
+ return undefined;
172
+ }
173
+ reportUnknownKeys(value, OUTPUT_KEYS, "output", strict, errors, warnings);
174
+ const output = {};
175
+ assignString(output, value, "cssDir", "output", errors);
176
+ assignString(output, value, "cssName", "output", errors);
177
+ assignString(output, value, "mapDir", "output", errors);
178
+ assignString(output, value, "mapName", "output", errors);
179
+ assignBoolean(output, value, "emitCss", "output", errors);
180
+ assignBoolean(output, value, "emitMap", "output", errors);
181
+ assignBoolean(output, value, "mapTypes", "output", errors);
182
+ assignBoolean(output, value, "emitTypes", "output", errors);
183
+ assignBoolean(output, value, "sourceMap", "output", errors);
184
+ assignBoolean(output, value, "minify", "output", errors);
185
+ assignBoolean(output, value, "mapInherit", "output", errors);
186
+ assignBoolean(output, value, "importCss", "output", errors);
187
+ return output;
188
+ }
189
+ function readClasses(value, strict, errors, warnings) {
190
+ if (value === undefined)
191
+ return undefined;
192
+ if (!isRecord(value)) {
193
+ errors.push(`"classes" must be an object.`);
194
+ return undefined;
195
+ }
196
+ reportUnknownKeys(value, CLASSES_KEYS, "classes", strict, errors, warnings);
197
+ const strategyValue = value.strategy;
198
+ let strategy;
199
+ if (strategyValue === undefined) {
200
+ strategy = "prefix";
201
+ }
202
+ else if (strategyValue === "none" || strategyValue === "prefix") {
203
+ strategy = strategyValue;
204
+ }
205
+ else {
206
+ errors.push(`"classes.strategy" must be "prefix" or "none".`);
207
+ }
208
+ const prefixValue = value.prefix;
209
+ if (prefixValue !== undefined && typeof prefixValue !== "string") {
210
+ errors.push(`"classes.prefix" must be a string.`);
211
+ }
212
+ if (strategy === undefined)
213
+ return undefined;
214
+ return {
215
+ strategy,
216
+ ...(typeof prefixValue === "string" ? { prefix: prefixValue } : {}),
217
+ };
218
+ }
219
+ function readMedia(value, errors) {
220
+ if (value === undefined)
221
+ return undefined;
222
+ if (!isRecord(value)) {
223
+ errors.push(`"media" must be an object mapping alias names to media queries.`);
224
+ return undefined;
225
+ }
226
+ const media = {};
227
+ for (const [key, query] of Object.entries(value)) {
228
+ if (key.trim() === "") {
229
+ errors.push(`"media" keys must be non-empty alias names.`);
230
+ continue;
231
+ }
232
+ if (typeof query !== "string" || query.trim() === "") {
233
+ errors.push(`"media.${key}" must be a non-empty media query string.`);
234
+ continue;
235
+ }
236
+ media[key] = query;
237
+ }
238
+ return media;
239
+ }
240
+ function readCompiler(value, strict, errors, warnings) {
241
+ if (value === undefined)
242
+ return undefined;
243
+ if (!isRecord(value)) {
244
+ errors.push(`"compiler" must be an object.`);
245
+ return undefined;
246
+ }
247
+ reportUnknownKeys(value, COMPILER_KEYS, "compiler", strict, errors, warnings);
248
+ const strictValue = value.strict;
249
+ if (strictValue !== undefined && typeof strictValue !== "boolean") {
250
+ errors.push(`"compiler.strict" must be a boolean.`);
251
+ }
252
+ const groupingValue = value.mediaGrouping;
253
+ let mediaGrouping = "safe";
254
+ if (groupingValue !== undefined) {
255
+ if (groupingValue === "safe" || groupingValue === "none" || groupingValue === "merge") {
256
+ mediaGrouping = groupingValue;
257
+ }
258
+ else {
259
+ errors.push(`"compiler.mediaGrouping" must be "safe", "none" or "merge".`);
260
+ }
261
+ }
262
+ return {
263
+ strict: typeof strictValue === "boolean" ? strictValue : true,
264
+ mediaGrouping,
265
+ };
266
+ }
267
+ function reportUnknownKeys(value, allowed, path, strict, errors, warnings) {
268
+ for (const key of Object.keys(value)) {
269
+ if (allowed.has(key))
270
+ continue;
271
+ const location = path === "" ? key : `${path}.${key}`;
272
+ if (strict) {
273
+ errors.push(`Unknown configuration key "${location}" (strict mode).`);
274
+ }
275
+ else {
276
+ warnings.push(`Ignoring unknown configuration key "${location}".`);
277
+ }
278
+ }
279
+ }
280
+ function readStringArray(value, key, errors) {
281
+ if (value === undefined)
282
+ return undefined;
283
+ if (!Array.isArray(value)) {
284
+ errors.push(`"${key}" must be an array of glob strings.`);
285
+ return undefined;
286
+ }
287
+ const result = [];
288
+ for (const entry of value) {
289
+ if (typeof entry !== "string" || entry.trim() === "") {
290
+ errors.push(`"${key}" entries must be non-empty strings.`);
291
+ continue;
292
+ }
293
+ result.push(entry);
294
+ }
295
+ return result;
296
+ }
297
+ function assignString(target, source, key, path, errors) {
298
+ const value = source[key];
299
+ if (value === undefined)
300
+ return;
301
+ if (typeof value !== "string") {
302
+ errors.push(`"${path}.${key}" must be a string.`);
303
+ return;
304
+ }
305
+ target[key] = value;
306
+ }
307
+ function assignBoolean(target, source, key, path, errors) {
308
+ const value = source[key];
309
+ if (value === undefined)
310
+ return;
311
+ if (typeof value !== "boolean") {
312
+ errors.push(`"${path}.${key}" must be a boolean.`);
313
+ return;
314
+ }
315
+ target[key] = value;
316
+ }
317
+ function isRecord(value) {
318
+ return typeof value === "object" && value !== null && !Array.isArray(value);
319
+ }
320
+ async function isFile(path) {
321
+ try {
322
+ return (await stat(path)).isFile();
323
+ }
324
+ catch {
325
+ return false;
326
+ }
327
+ }
328
+ function describeError(error) {
329
+ return error instanceof Error ? error.message : String(error);
330
+ }
331
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAQlD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAEjE,oEAAoE;AACpE,MAAM,CAAC,MAAM,eAAe,GAAsB,MAAM,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;AAqD/E,MAAM,cAAc,GAAwB,IAAI,GAAG,CAAC;IAClD,SAAS;IACT,SAAS;IACT,SAAS;IACT,QAAQ;IACR,SAAS;IACT,OAAO;IACP,UAAU;CACX,CAAC,CAAC;AAEH,MAAM,WAAW,GAAwB,IAAI,GAAG,CAAC;IAC/C,QAAQ;IACR,SAAS;IACT,QAAQ;IACR,SAAS;IACT,SAAS;IACT,SAAS;IACT,UAAU;IACV,WAAW;IACX,WAAW;IACX,QAAQ;IACR,YAAY;IACZ,WAAW;CACZ,CAAC,CAAC;AAEH,MAAM,YAAY,GAAwB,IAAI,GAAG,CAAC,CAAC,UAAU,EA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C;AACtB,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED,KAAK,UAAU,MAAM,CAAC,IAAY;IAChC,IAAI,CAAC;QACH,OAAO,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IACrC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED,SAAS,aAAa,CAAC,KAAc;IACnC,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAChE,CAAC"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Compiler formatter boundary for the CLI.
3
+ *
4
+ * `format` is a pure compiler module exported from the public barrel. The CLI
5
+ * reaches it through the shared {@link loadCompiler} boundary (bare package →
6
+ * built `dist` → TypeScript source under Bun), so there is no separate module
7
+ * resolution path. The export is validated before use so a stale compiler build
8
+ * fails with an actionable message instead of a call-site `TypeError`.
9
+ */
10
+ import type { Diagnostic } from "@xessa/compiler";
11
+ /** Formatter module surface the CLI consumes. */
12
+ export interface FormatterApi {
13
+ /** Canonical formatting; errors return the original source unchanged. */
14
+ format(source: string, file: string): {
15
+ readonly formatted: string;
16
+ readonly diagnostics: readonly Diagnostic[];
17
+ };
18
+ }
19
+ /** Load (and cache) the compiler formatter through the public API boundary. */
20
+ export declare function loadFormatter(): Promise<FormatterApi>;
21
+ //# sourceMappingURL=formatter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatter.d.ts","sourceRoot":"","sources":["../src/formatter.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAGlD,iDAAiD;AACjD,MAAM,WAAW,YAAY;IAC3B,yEAAyE;IACzE,MAAM,CACJ,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,GACX;QAAE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAA;KAAE,CAAC;CAChF;AAID,+EAA+E;AAC/E,wBAAgB,aAAa,IAAI,OAAO,CAAC,YAAY,CAAC,CAGrD"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Compiler formatter boundary for the CLI.
3
+ *
4
+ * `format` is a pure compiler module exported from the public barrel. The CLI
5
+ * reaches it through the shared {@link loadCompiler} boundary (bare package →
6
+ * built `dist` → TypeScript source under Bun), so there is no separate module
7
+ * resolution path. The export is validated before use so a stale compiler build
8
+ * fails with an actionable message instead of a call-site `TypeError`.
9
+ */
10
+ import { loadCompiler } from "./compiler.js";
11
+ let cached;
12
+ /** Load (and cache) the compiler formatter through the public API boundary. */
13
+ export function loadFormatter() {
14
+ cached ??= resolveFormatter();
15
+ return cached;
16
+ }
17
+ async function resolveFormatter() {
18
+ const compiler = await loadCompiler();
19
+ const format = compiler.format;
20
+ if (typeof format === "function") {
21
+ return { format: format };
22
+ }
23
+ // Development fallback: a stale checked-out `dist` may predate the barrel
24
+ // export. Under Bun the TypeScript formatter source is always loadable.
25
+ if (typeof globalThis.Bun !== "undefined") {
26
+ try {
27
+ const loaded = (await import(new URL("../../compiler/src/formatter/index.ts", import.meta.url).href));
28
+ if (typeof loaded.format === "function") {
29
+ return { format: loaded.format };
30
+ }
31
+ }
32
+ catch {
33
+ // Fall through to the actionable error below.
34
+ }
35
+ }
36
+ throw new Error('Unable to load the Xessa formatter: the compiler build does not export "format". Rebuild it with "bun run build" in packages/compiler.');
37
+ }
38
+ //# sourceMappingURL=formatter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatter.js","sourceRoot":"","sources":["../src/formatter.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAW7C,IAAI,MAAyC,CAAC;AAE9C,+EAA+E;AAC/E,MAAM,UAAU,aAAa;IAC3B,MAAM,KAAK,gBAAgB,EAAE,CAAC;IAC9B,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,KAAK,UAAU,gBAAgB;IAC7B,MAAM,QAAQ,GAAG,MAAM,YAAY,EAAE,CAAC;IACtC,MAAM,MAAM,GAAI,QAA4C,CAAC,MAAM,CAAC;IACpE,IAAI,OAAO,MAAM,KAAK,UAAU,EAAE,CAAC;QACjC,OAAO,EAAE,MAAM,EAAE,MAAgC,EAAE,CAAC;IACtD,CAAC;IAED,0EAA0E;IAC1E,wEAAwE;IACxE,IAAI,OAAQ,UAAgC,CAAC,GAAG,KAAK,WAAW,EAAE,CAAC;QACjE,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,CAAC,MAAM,MAAM,CAC1B,IAAI,GAAG,CAAC,uCAAuC,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CACvE,CAAyB,CAAC;YAC3B,IAAI,OAAO,MAAM,CAAC,MAAM,KAAK,UAAU,EAAE,CAAC;gBACxC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,MAAgC,EAAE,CAAC;YAC7D,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,8CAA8C;QAChD,CAAC;IACH,CAAC;IAED,MAAM,IAAI,KAAK,CACb,wIAAwI,CACzI,CAAC;AACJ,CAAC"}
package/dist/glob.d.ts ADDED
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Zero-dependency glob matching and source discovery for project builds.
3
+ *
4
+ * Supported syntax: `*` (any run of characters except `/`), `**` (any run of
5
+ * characters including `/`, and as a path segment it also matches zero
6
+ * segments), `?` (one character except `/`) and `{a,b}` alternation, including
7
+ * nesting. Character classes are not supported and are matched literally.
8
+ *
9
+ * Patterns are POSIX-style; backslashes are treated as separators so Windows
10
+ * authored configuration behaves the same as forward slashes. A leading `./` or
11
+ * `/` is ignored, which anchors the pattern at the workspace root.
12
+ */
13
+ /** Normalize a path or pattern for glob matching (POSIX separators, no `./`). */
14
+ export declare function normalizeGlobPath(value: string): string;
15
+ /** Whether a pattern segment contains glob magic. */
16
+ export declare function hasGlobMagic(value: string): boolean;
17
+ /** Expand `{a,b}` alternations (including nesting) into concrete patterns. */
18
+ export declare function expandBraces(pattern: string): string[];
19
+ /** Translate one glob pattern into an anchored regular expression. */
20
+ export declare function globToRegExp(pattern: string): RegExp;
21
+ /** Match a workspace-relative POSIX path against one glob pattern. */
22
+ export declare function matchesGlob(relativePath: string, pattern: string): boolean;
23
+ /**
24
+ * Whether a workspace-relative path is excluded by any pattern.
25
+ *
26
+ * A pattern also excludes descendants of a matching directory and, when it is a
27
+ * bare name such as `node_modules`, any path segment with that name.
28
+ */
29
+ export declare function isExcluded(relativePath: string, patterns: readonly string[]): boolean;
30
+ /**
31
+ * Directory the discovery walk can start from for a pattern, before its first
32
+ * glob segment. Exact file patterns start at their parent directory.
33
+ */
34
+ export declare function staticDirectoryPrefix(pattern: string): string;
35
+ /** Options for {@link discoverSources}. */
36
+ export interface DiscoverOptions {
37
+ /** Absolute POSIX workspace root. */
38
+ readonly root: string;
39
+ /** Include globs, relative to the workspace root. */
40
+ readonly include: readonly string[];
41
+ /** Exclude globs or directory names, relative to the workspace root. */
42
+ readonly exclude: readonly string[];
43
+ }
44
+ /**
45
+ * Discover `.cssx` sources matching the include globs, minus exclusions.
46
+ *
47
+ * Only `.cssx` files are sources by definition, `.git` and `node_modules`
48
+ * directories are never walked, symlinks are skipped, and results are sorted for
49
+ * deterministic builds.
50
+ */
51
+ export declare function discoverSources(options: DiscoverOptions): Promise<string[]>;
52
+ //# sourceMappingURL=glob.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"glob.d.ts","sourceRoot":"","sources":["../src/glob.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH,iFAAiF;AACjF,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAMvD;AAED,qDAAqD;AACrD,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEnD;AAED,8EAA8E;AAC9E,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CA0BtD;AAmBD,sEAAsE;AACtE,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAIpD;AAmCD,sEAAsE;AACtE,wBAAgB,WAAW,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAE1E;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAoBrF;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAW7D;AAED,2CAA2C;AAC3C,MAAM,WAAW,eAAe;IAC9B,qCAAqC;IACrC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,qDAAqD;IACrD,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,wEAAwE;IACxE,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;CACrC;AAED;;;;;;GAMG;AACH,wBAAsB,eAAe,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAWjF"}