@pptx-studio/validate 0.2.0 → 0.2.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/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @pptx-studio/validate
2
2
 
3
+ ## 0.2.1
4
+
5
+ ### Patch Changes
6
+
7
+ - b58dd19: Built with tsdown 0.23. The declarations take a new shape, and the API is unchanged.
8
+
9
+ - Every value is exported where it is declared (`export declare function …`), not in a trailing
10
+ `export { … }`.
11
+ - The types are exported in one `export type { … }`.
12
+ - The JavaScript is byte-for-byte what 0.22 emitted.
13
+ - In geometry, opc, validate and xml, the source maps name fewer symbols.
14
+
15
+ - Updated dependencies [b58dd19]
16
+ - @pptx-studio/opc@0.1.3
17
+ - @pptx-studio/xml@0.1.2
18
+
3
19
  ## 0.2.0
4
20
 
5
21
  ### Minor Changes
package/dist/index.d.ts CHANGED
@@ -24,7 +24,7 @@ import { PartName, PartStore, ReadZipOptions, ZipArchive } from "@pptx-studio/op
24
24
  *
25
25
  * Deliberately few. Almost everything this package has to say is a finding.
26
26
  */
27
- declare const VALIDATE_ERROR_CODES: readonly ["ERR_VALIDATION_FAILED", "ERR_UNVALIDATABLE", "ERR_UNKNOWN_RULE"];
27
+ export declare const VALIDATE_ERROR_CODES: readonly ["ERR_VALIDATION_FAILED", "ERR_UNVALIDATABLE", "ERR_UNKNOWN_RULE"];
28
28
  type ValidateErrorCode = (typeof VALIDATE_ERROR_CODES)[number];
29
29
  interface ValidateErrorDetail {
30
30
  /** The part the failure is about, if it is about one. */
@@ -40,12 +40,12 @@ interface ValidateErrorDetail {
40
40
  */
41
41
  readonly report?: unknown;
42
42
  }
43
- declare class ValidateError extends Error {
43
+ export declare class ValidateError extends Error {
44
44
  readonly code: ValidateErrorCode;
45
45
  readonly detail: ValidateErrorDetail;
46
46
  constructor(code: ValidateErrorCode, message: string, detail?: ValidateErrorDetail);
47
47
  }
48
- declare function isValidateError(value: unknown): value is ValidateError;
48
+ export declare function isValidateError(value: unknown): value is ValidateError;
49
49
  //#endregion
50
50
  //#region src/rules/rules.d.ts
51
51
  /**
@@ -114,7 +114,7 @@ interface Rule {
114
114
  */
115
115
  readonly needsBaseline?: true;
116
116
  }
117
- declare const RULES: readonly [{
117
+ export declare const RULES: readonly [{
118
118
  readonly id: "V001";
119
119
  readonly category: "package";
120
120
  readonly severity: "fatal";
@@ -336,10 +336,10 @@ declare const RULES: readonly [{
336
336
  readonly why: string;
337
337
  }];
338
338
  type RuleId = (typeof RULES)[number]['id'];
339
- declare function ruleById(id: string): Rule | undefined;
340
- declare const RULE_IDS: readonly RuleId[];
339
+ export declare function ruleById(id: string): Rule | undefined;
340
+ export declare const RULE_IDS: readonly RuleId[];
341
341
  /** Rules that need the package as it was opened. See `Rule.needsBaseline`. */
342
- declare const BASELINE_RULES: readonly RuleId[];
342
+ export declare const BASELINE_RULES: readonly RuleId[];
343
343
  //#endregion
344
344
  //#region src/report/location.d.ts
345
345
  /**
@@ -397,9 +397,9 @@ interface Location {
397
397
  readonly offset: number | null;
398
398
  }
399
399
  /** A location that names a part and nothing inside it. */
400
- declare function partLocation(part: string): Location;
400
+ export declare function partLocation(part: string): Location;
401
401
  /** The location of the package itself: the archive, the content types, the graph. */
402
- declare const PACKAGE_LOCATION: Location;
402
+ export declare const PACKAGE_LOCATION: Location;
403
403
  /**
404
404
  * The XPath of an element, from the document root.
405
405
  *
@@ -408,11 +408,11 @@ declare const PACKAGE_LOCATION: Location;
408
408
  * finding built from a node the caller synthesised is degraded rather than
409
409
  * lost.
410
410
  */
411
- declare function xpathOf(element: XElement): string;
411
+ export declare function xpathOf(element: XElement): string;
412
412
  /** The XPath of an attribute: its owner's path, then `/@qname`. */
413
- declare function xpathOfAttribute(owner: XElement, attr: XAttribute | string): string;
413
+ export declare function xpathOfAttribute(owner: XElement, attr: XAttribute | string): string;
414
414
  /** A location for an element inside a named part. */
415
- declare function elementLocation(part: string, element: XElement): Location;
415
+ export declare function elementLocation(part: string, element: XElement): Location;
416
416
  /**
417
417
  * A location for one attribute of an element.
418
418
  *
@@ -420,7 +420,7 @@ declare function elementLocation(part: string, element: XElement): Location;
420
420
  * element's start when it does not - which is the case that matters, because a
421
421
  * *missing* required attribute is a finding and it has to point somewhere.
422
422
  */
423
- declare function attributeLocation(part: string, element: XElement, qname: string): Location;
423
+ export declare function attributeLocation(part: string, element: XElement, qname: string): Location;
424
424
  /**
425
425
  * `line:column` for an offset, 1-based, or `null`.
426
426
  *
@@ -429,14 +429,14 @@ declare function attributeLocation(part: string, element: XElement, qname: strin
429
429
  * hundred times. Callers that render a report for a human ask for it once, at
430
430
  * the point of rendering, for the findings they are about to show.
431
431
  */
432
- declare function lineColumn(source: string, offset: number): {
432
+ export declare function lineColumn(source: string, offset: number): {
433
433
  line: number;
434
434
  column: number;
435
435
  };
436
436
  /** Document order, for sorting findings within a part. */
437
- declare function inDocumentOrder(a: XNode, b: XNode): number;
437
+ export declare function inDocumentOrder(a: XNode, b: XNode): number;
438
438
  /** The root element's qname, for the handful of rules that dispatch on it. */
439
- declare function rootName(document: XDocument): string;
439
+ export declare function rootName(document: XDocument): string;
440
440
  //#endregion
441
441
  //#region src/report/report.d.ts
442
442
  /**
@@ -528,14 +528,14 @@ interface Report {
528
528
  * the same place with different values are different findings, and treating
529
529
  * them as one would let an introduced defect hide behind an inherited one.
530
530
  */
531
- declare function findingKey(finding: Finding): string;
532
- declare function buildReport(input: {
531
+ export declare function findingKey(finding: Finding): string;
532
+ export declare function buildReport(input: {
533
533
  readonly findings: readonly Finding[];
534
534
  readonly checked: readonly RuleId[];
535
535
  readonly skipped: readonly SkippedRule[];
536
536
  readonly problems: readonly ReadProblem[];
537
537
  }): Report;
538
- declare function isReport(value: unknown): value is Report;
538
+ export declare function isReport(value: unknown): value is Report;
539
539
  interface FormatOptions {
540
540
  /** Include `inherited` findings. Default true. */
541
541
  readonly inherited?: boolean;
@@ -551,7 +551,7 @@ interface FormatOptions {
551
551
  * "what is wrong with this file", and a file is a set of parts. Grouping by
552
552
  * rule is the right shape for the corpus gate and the wrong one here.
553
553
  */
554
- declare function formatReport(report: Report, options?: FormatOptions): string;
554
+ export declare function formatReport(report: Report, options?: FormatOptions): string;
555
555
  //#endregion
556
556
  //#region src/context.d.ts
557
557
  /**
@@ -665,7 +665,7 @@ declare class RuntimeContext implements Context {
665
665
  add(rule: RuleId, where: Location, message: string): void;
666
666
  problem(part: string, message: string): void;
667
667
  }
668
- declare function createContext(input: ContextInput): RuntimeContext;
668
+ export declare function createContext(input: ContextInput): RuntimeContext;
669
669
  //#endregion
670
670
  //#region src/validate.d.ts
671
671
  interface ValidateOptions {
@@ -704,7 +704,7 @@ interface ValidateOptions {
704
704
  * findings in it, which is the shape a caller can render. It throws only when
705
705
  * it was handed something it cannot open at all.
706
706
  */
707
- declare function validatePackage(options: ValidateOptions): Report;
707
+ export declare function validatePackage(options: ValidateOptions): Report;
708
708
  /**
709
709
  * Validate, and refuse to go on if we broke something.
710
710
  *
@@ -715,7 +715,7 @@ declare function validatePackage(options: ValidateOptions): Report;
715
715
  * feedback loop that exists, and a caller who forgot to check a return value
716
716
  * would have removed it.
717
717
  */
718
- declare function assertValid(options: ValidateOptions): Report;
718
+ export declare function assertValid(options: ValidateOptions): Report;
719
719
  //#endregion
720
- export { BASELINE_RULES, type Context, type ContextInput, type Evidence, type Finding, type FormatOptions, type Location, type Origin, PACKAGE_LOCATION, RULES, RULE_IDS, type ReadProblem, type Report, type Rule, type RuleCategory, type RuleId, type Severity, type SkippedRule, VALIDATE_ERROR_CODES, ValidateError, type ValidateErrorCode, type ValidateErrorDetail, type ValidateOptions, assertValid, attributeLocation, buildReport, createContext, elementLocation, findingKey, formatReport, inDocumentOrder, isReport, isValidateError, lineColumn, partLocation, rootName, ruleById, validatePackage, xpathOf, xpathOfAttribute };
720
+ export type { Context, ContextInput, Evidence, Finding, FormatOptions, Location, Origin, ReadProblem, Report, Rule, RuleCategory, RuleId, Severity, SkippedRule, ValidateErrorCode, ValidateErrorDetail, ValidateOptions };
721
721
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/errors.ts","../src/rules/rules.ts","../src/report/location.ts","../src/report/report.ts","../src/context.ts","../src/validate.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;cAwBa;KAuBD,4BAA4B;UAEvB;;WAEN;;WAEA;;;;;;;;WAQA;;cAGE,sBAAsB;WACxB,MAAM;WACN,QAAQ;EAEL,YAAA,MAAM,mBAAmB,iBAAiB,SAAQ;;iBAQhD,gBAAgB,iBAAiB,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KCjC9C;KAGA;;KAGA;UAEK;WACN,IAAI;WACJ,UAAU;WACV,UAAU;WACV,UAAU;;WAEV;;WAEA;;;;;;;;;;WAUA;;cAsBE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAydD,iBAAiB;iBAIb,SAAS,aAAa;cAIzB,mBAAmB;;cAGnB,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UC7gBrB;;;;;;;WAON;;WAEA;;WAEA;;;iBAIK,aAAa,eAAe;;cAK/B,kBAAkB;;;;;;;;;iBAwBf,QAAQ,SAAS;;iBAWjB,iBAAiB,OAAO,UAAU,MAAM;;iBAMxC,gBAAgB,cAAc,SAAS,WAAW;;;;;;;;iBAWlD,kBAAkB,cAAc,SAAS,UAAU,gBAAgB;;;;;;;;;iBAiBnE,WAAW,gBAAgB;EAAmB;EAAc;;;iBAc5D,gB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UCvKnC;;;;;;;;;;WAUN,QAAQ;;;;;;;;;WASR,QAAQ;;WAER,WAAW;;WAEX,gBAAgB;;WAEhB,iBAAiB;;WAEjB,MAAM;;;;;;;;;iBAwBD,gBAAgB,SAAS,kBAAkB;;;;;;;;;;;iBA2I3C,YAAY,SAAS,kBAAkB"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/errors.ts","../src/rules/rules.ts","../src/report/location.ts","../src/report/report.ts","../src/context.ts","../src/validate.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;qBAwBa;KAuBD,4BAA4B;UAEvB;;WAEN;;WAEA;;;;;;;;WAQA;;qBAGE,sBAAsB;WACxB,MAAM;WACN,QAAQ;EAEL,YAAA,MAAM,mBAAmB,iBAAiB,SAAQ;;wBAQhD,gBAAgB,iBAAiB,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KCjC9C;KAGA;;KAGA;UAEK;WACN,IAAI;WACJ,UAAU;WACV,UAAU;WACV,UAAU;;WAEV;;WAEA;;;;;;;;;;WAUA;;qBAsBE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAydD,iBAAiB;wBAIb,SAAS,aAAa;qBAIzB,mBAAmB;;qBAGnB,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UC7gBrB;;;;;;;WAON;;WAEA;;WAEA;;;wBAIK,aAAa,eAAe;;qBAK/B,kBAAkB;;;;;;;;;wBAwBf,QAAQ,SAAS;;wBAWjB,iBAAiB,OAAO,UAAU,MAAM;;wBAMxC,gBAAgB,c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