@hawkeyexl/manni 2.7.0 → 2.8.0

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 CHANGED
@@ -98,7 +98,7 @@ actually reads rather than hand-written:
98
98
  ```yaml
99
99
  repos:
100
100
  - repo: https://github.com/hawkeyexl/manni
101
- rev: v2.7.0
101
+ rev: v2.8.0
102
102
  hooks:
103
103
  - id: manni-meta
104
104
  ```
@@ -8,7 +8,7 @@ var __export = (target, all) => {
8
8
  // package.json
9
9
  var package_default = {
10
10
  name: "@hawkeyexl/manni",
11
- version: "2.7.0",
11
+ version: "2.8.0",
12
12
  description: "One command line for documentation that is meant to be checked. `manni meta` validates the presence and format of document metadata (Markdown frontmatter and more) against JSON Schema, built for CI. Formerly docmeta.",
13
13
  type: "module",
14
14
  bin: {
@@ -125,94 +125,6 @@ var package_default = {
125
125
  }
126
126
  };
127
127
 
128
- // src/shared/run.ts
129
- import { realpathSync } from "node:fs";
130
- import { fileURLToPath } from "node:url";
131
- import { CommanderError } from "commander";
132
-
133
- // src/shared/errors.ts
134
- var ToolError = class extends Error {
135
- /** clig.dev: 2 is operational/usage; 1 is reserved for findings. */
136
- exitCode = 2;
137
- constructor(message) {
138
- super(message);
139
- this.name = "ToolError";
140
- }
141
- };
142
- function errorMessage(err) {
143
- if (err instanceof Error) return err.message;
144
- if (typeof err === "string") return err;
145
- if (typeof err === "number" || typeof err === "bigint") return String(err);
146
- if (typeof err === "object" && err !== null && "message" in err && typeof err.message === "string") {
147
- return err.message;
148
- }
149
- try {
150
- const json = JSON.stringify(err);
151
- if (json !== void 0) return json;
152
- } catch {
153
- }
154
- return String(err);
155
- }
156
-
157
- // src/shared/program-name.ts
158
- var name = "manni";
159
- function programName() {
160
- return name;
161
- }
162
- function setProgramName(value) {
163
- name = value;
164
- }
165
-
166
- // src/shared/run.ts
167
- function fail(err) {
168
- const msg = err instanceof ToolError ? err.message : `Unexpected error: ${errorMessage(err)}`;
169
- process.stderr.write(`${programName()}: ${msg}
170
- `);
171
- process.exit(2);
172
- }
173
- var STDIN_LINES_MARKER = "\0";
174
- var STDIN_WITH_LINES = /^-(:[1-9][0-9]*(?:-[1-9][0-9]*)?)$/;
175
- function normalizeStdinArgv(argv) {
176
- return argv.map((arg) => {
177
- const lines = STDIN_WITH_LINES.exec(arg)?.[1];
178
- return lines === void 0 ? arg : `${STDIN_LINES_MARKER}${lines}`;
179
- });
180
- }
181
- async function runProgram(program, argv = process.argv) {
182
- setProgramName(program.name());
183
- try {
184
- await program.parseAsync(normalizeStdinArgv(argv));
185
- } catch (err) {
186
- if (err instanceof CommanderError) {
187
- process.exitCode = err.exitCode === 0 ? 0 : 2;
188
- return;
189
- }
190
- throw err;
191
- }
192
- }
193
- function isMainModule(moduleUrl) {
194
- const entry = process.argv[1];
195
- if (!entry) return false;
196
- try {
197
- return realpathSync(entry) === fileURLToPath(moduleUrl);
198
- } catch {
199
- return false;
200
- }
201
- }
202
- function endOutputOnClosedReader(streams = [process.stdout, process.stderr]) {
203
- for (const stream of streams) {
204
- stream.on("error", (err) => {
205
- if (err.code === "EPIPE") return;
206
- throw err;
207
- });
208
- }
209
- }
210
- function runIfMain(moduleUrl, build) {
211
- if (!isMainModule(moduleUrl)) return;
212
- endOutputOnClosedReader();
213
- runProgram(build()).catch(fail);
214
- }
215
-
216
128
  // src/shared/collections.ts
217
129
  import picomatch2 from "picomatch";
218
130
 
@@ -488,6 +400,97 @@ function isGlob(entry) {
488
400
  return picomatch2.scan(entry).isGlob;
489
401
  }
490
402
 
403
+ // src/shared/run.ts
404
+ import { realpathSync } from "node:fs";
405
+ import { fileURLToPath } from "node:url";
406
+ import { CommanderError } from "commander";
407
+
408
+ // src/shared/errors.ts
409
+ var ToolError = class extends Error {
410
+ /** clig.dev: 2 is operational/usage; 1 is reserved for findings. */
411
+ exitCode = 2;
412
+ constructor(message) {
413
+ super(message);
414
+ this.name = "ToolError";
415
+ }
416
+ };
417
+ function errorMessage(err) {
418
+ if (err instanceof Error) return err.message;
419
+ if (typeof err === "string") return err;
420
+ if (typeof err === "number" || typeof err === "bigint") return String(err);
421
+ if (typeof err === "object" && err !== null && "message" in err && typeof err.message === "string") {
422
+ return err.message;
423
+ }
424
+ try {
425
+ const json = JSON.stringify(err);
426
+ if (json !== void 0) return json;
427
+ } catch {
428
+ }
429
+ return String(err);
430
+ }
431
+
432
+ // src/shared/program-name.ts
433
+ var name = "manni";
434
+ function programName() {
435
+ return name;
436
+ }
437
+ function setProgramName(value) {
438
+ name = value;
439
+ }
440
+
441
+ // src/shared/run.ts
442
+ function fail(err) {
443
+ const msg = err instanceof ToolError ? err.message : `Unexpected error: ${errorMessage(err)}`;
444
+ const prefix = programName();
445
+ for (const line of msg.replace(/\n+$/, "").split("\n")) {
446
+ process.stderr.write(`${prefix}: ${line}
447
+ `);
448
+ }
449
+ process.exit(2);
450
+ }
451
+ var STDIN_LINES_MARKER = "\0";
452
+ var STDIN_WITH_LINES = /^-(:[1-9][0-9]*(?:-[1-9][0-9]*)?)$/;
453
+ function normalizeStdinArgv(argv) {
454
+ return argv.map((arg) => {
455
+ const lines = STDIN_WITH_LINES.exec(arg)?.[1];
456
+ return lines === void 0 ? arg : `${STDIN_LINES_MARKER}${lines}`;
457
+ });
458
+ }
459
+ async function runProgram(program, argv = process.argv) {
460
+ setProgramName(program.name());
461
+ try {
462
+ await program.parseAsync(normalizeStdinArgv(argv));
463
+ } catch (err) {
464
+ if (err instanceof CommanderError) {
465
+ process.exitCode = err.exitCode === 0 ? 0 : 2;
466
+ return;
467
+ }
468
+ throw err;
469
+ }
470
+ }
471
+ function isMainModule(moduleUrl) {
472
+ const entry = process.argv[1];
473
+ if (!entry) return false;
474
+ try {
475
+ return realpathSync(entry) === fileURLToPath(moduleUrl);
476
+ } catch {
477
+ return false;
478
+ }
479
+ }
480
+ function endOutputOnClosedReader(streams = [process.stdout, process.stderr]) {
481
+ for (const stream of streams) {
482
+ stream.on("error", (err) => {
483
+ if (err.code === "EPIPE") return;
484
+ throw err;
485
+ });
486
+ }
487
+ }
488
+ function runIfMain(moduleUrl, build) {
489
+ if (!isMainModule(moduleUrl)) return;
490
+ endOutputOnClosedReader();
491
+ runProgram(build()).catch(fail);
492
+ }
493
+
491
494
  // src/meta/core/integrity.ts
492
495
  import { createHash } from "node:crypto";
493
496
  var INTEGRITY_ALGORITHM = "sha256";
@@ -19745,11 +19748,7 @@ export {
19745
19748
  package_default,
19746
19749
  palette,
19747
19750
  shouldColor,
19748
- ToolError,
19749
- errorMessage,
19750
- programName,
19751
- fail,
19752
- runIfMain,
19751
+ matchesFileGlob,
19753
19752
  externalMetadataUrlProblem,
19754
19753
  parseCollections,
19755
19754
  selectCollections,
@@ -19761,11 +19760,17 @@ export {
19761
19760
  decryptValue,
19762
19761
  findGitRoot,
19763
19762
  valeConfigPath,
19763
+ programName,
19764
19764
  notice,
19765
+ ToolError,
19766
+ errorMessage,
19767
+ FAMILY_CONFIG_NAMES,
19765
19768
  findConfigFile,
19766
19769
  readConfigFile,
19767
19770
  findFamilyConfigFile,
19768
19771
  readFamilyConfigFile,
19772
+ fail,
19773
+ runIfMain,
19769
19774
  escapeWorkflowCommandMessage,
19770
19775
  escapeWorkflowCommandProperty,
19771
19776
  INTEGRITY_SHAPE,
@@ -19942,4 +19947,4 @@ export {
19942
19947
  renderQuery,
19943
19948
  renderQueryCsv
19944
19949
  };
19945
- //# sourceMappingURL=chunk-2672QGFM.js.map
19950
+ //# sourceMappingURL=chunk-MB3DIO7S.js.map