content-query 0.3.0 → 0.4.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.
Files changed (36) hide show
  1. package/README.md +21 -1
  2. package/dist/{build-CI4s0oFP.mjs → build-CcqIpkes.mjs} +709 -39
  3. package/dist/{build-jKnjDjQE.d.mts → build-DL1GzmRy.d.mts} +12 -5
  4. package/dist/build.d.mts +1 -1
  5. package/dist/build.mjs +1 -1
  6. package/dist/cli.mjs +14 -8
  7. package/dist/computed.d.mts +2 -2
  8. package/dist/{content-N1gYshjg.mjs → content-BXrgP7nL.mjs} +271 -81
  9. package/dist/{content-lwPxE9Yu.d.mts → content-CwTKqRs9.d.mts} +39 -14
  10. package/dist/{types-FmUJ3cH1.d.mts → descriptor-bcPa6XLk.d.mts} +17 -1
  11. package/dist/{diagnostics-Cu94mZhl.mjs → diagnostics-DmUZtrJ6.mjs} +3 -1
  12. package/dist/{errors-C2iuBM0G.mjs → errors-Bfd0R4_P.mjs} +16 -1
  13. package/dist/file-DSOcdFj0.mjs +81 -0
  14. package/dist/{glob-Bv0dpvCQ.mjs → glob-BXJuwy_p.mjs} +94 -6
  15. package/dist/index.d.mts +61 -18
  16. package/dist/index.mjs +1 -1
  17. package/dist/internal.d.mts +11 -4
  18. package/dist/internal.mjs +29 -5
  19. package/dist/loaders.d.mts +1 -2
  20. package/dist/loaders.mjs +2 -81
  21. package/dist/next.d.mts +1 -1
  22. package/dist/next.mjs +2 -2
  23. package/dist/{operators-UqWUhKQJ.mjs → operators-Cwy8Kx4o.mjs} +88 -2
  24. package/dist/query-style-eXENQJ0O.d.mts +22 -0
  25. package/dist/query.d.mts +25 -2
  26. package/dist/query.mjs +1 -1
  27. package/dist/{relational-types-B45zM34W.d.mts → relational-types-C8xJtLG5.d.mts} +113 -38
  28. package/dist/runtime.d.mts +3 -2
  29. package/dist/runtime.mjs +1 -1
  30. package/dist/types-DbFfF6JE.d.mts +181 -0
  31. package/dist/vite.d.mts +1 -1
  32. package/dist/vite.mjs +2 -2
  33. package/package.json +1 -1
  34. package/dist/descriptor-BUPT2J7X.d.mts +0 -18
  35. package/dist/types-BC8gVJ6u.d.mts +0 -69
  36. package/dist/validation-D_XdE1pF.mjs +0 -84
@@ -1,5 +1,6 @@
1
- import { i as InvalidRelationships, o as ContentError, t as Content } from "./content-lwPxE9Yu.mjs";
2
- import { i as CollectionRegistry } from "./types-BC8gVJ6u.mjs";
1
+ import { i as InvalidRelationships, o as ContentError, t as Content } from "./content-CwTKqRs9.mjs";
2
+ import { i as CollectionRegistry } from "./types-DbFfF6JE.mjs";
3
+ import { n as QueryStyle } from "./query-style-eXENQJ0O.mjs";
3
4
  //#region src/preparation/session.d.ts
4
5
  /** A local source captured by a successfully prepared content revision. */
5
6
  type ContentSourceEntry = Readonly<{
@@ -20,8 +21,9 @@ type ContentSourceEvent = {
20
21
  type: "error";
21
22
  error: ContentError;
22
23
  };
23
- type ContentSession<Registry extends CollectionRegistry = {}> = {
24
- content: Content<Registry>;
24
+ type ContentSession<Registry extends CollectionRegistry = {}, Style extends QueryStyle = QueryStyle> = {
25
+ /** Root query APIs are typed by `Style`; the configured `queryStyle` is enforced at runtime. */
26
+ content: Content<Registry, Style>;
25
27
  /** Reads the latest successful source snapshot; current preparation errors are rethrown. */
26
28
  sources(): ContentSourceSnapshot;
27
29
  /** Observes subsequent publications and failures; returns an idempotent unsubscribe function. */
@@ -42,7 +44,12 @@ type BuildContentOptions = {
42
44
  /**
43
45
  * Builds content independently of a bundler; bind the registry through an erased type import.
44
46
  * Generated watch sessions prune previous-run artifacts after their first successful publication.
47
+ *
48
+ * @param arguments_ - Optional build options.
49
+ * @returns A session whose `content` exposes the root query APIs allowed by `Style`. Pass
50
+ * `typeof queryStyle` from the config to type it; the configured `queryStyle` is always enforced
51
+ * at runtime.
45
52
  */
46
- declare function buildContent<Registry extends CollectionRegistry = {}>(...arguments_: InvalidRelationships<Registry> extends never ? [options?: BuildContentOptions] : [invalidRegistry: never]): Promise<ContentSession<Registry>>;
53
+ declare function buildContent<Registry extends CollectionRegistry = {}, Style extends QueryStyle = QueryStyle>(...arguments_: InvalidRelationships<Registry> extends never ? [options?: BuildContentOptions] : [invalidRegistry: never]): Promise<ContentSession<Registry, Style>>;
47
54
  //#endregion
48
55
  export { ContentSourceEvent as a, ContentSourceEntry as i, buildContent as n, ContentSourceSnapshot as o, ContentSession as r, BuildContentOptions as t };
package/dist/build.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { a as ContentSourceEvent, i as ContentSourceEntry, n as buildContent, o as ContentSourceSnapshot, r as ContentSession, t as BuildContentOptions } from "./build-jKnjDjQE.mjs";
1
+ import { a as ContentSourceEvent, i as ContentSourceEntry, n as buildContent, o as ContentSourceSnapshot, r as ContentSession, t as BuildContentOptions } from "./build-DL1GzmRy.mjs";
2
2
  export { type BuildContentOptions, type ContentSession, type ContentSourceEntry, type ContentSourceEvent, type ContentSourceSnapshot, buildContent };
package/dist/build.mjs CHANGED
@@ -1 +1 @@
1
- export { n as buildContent } from "./build-CI4s0oFP.mjs";
1
+ export { n as buildContent } from "./build-CcqIpkes.mjs";
package/dist/cli.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
- import { t as ContentError } from "./errors-C2iuBM0G.mjs";
3
- import { t as buildAtRoot } from "./build-CI4s0oFP.mjs";
2
+ import { o as payloadIdentity, t as ContentError } from "./errors-Bfd0R4_P.mjs";
3
+ import { t as buildAtRoot } from "./build-CcqIpkes.mjs";
4
4
  import { cac } from "cac";
5
5
  //#region package.json
6
- var version = "0.3.0";
6
+ var version = "0.4.0";
7
7
  //#endregion
8
8
  //#region src/integrations/cli/arguments.ts
9
9
  /** Validates one path option after CAC's automatic numeric conversion. */
@@ -62,13 +62,19 @@ function parseArguments(arguments_) {
62
62
  }
63
63
  //#endregion
64
64
  //#region src/integrations/cli/report.ts
65
- /** Prints structured contextual diagnostics without depending on a framework display. */
66
- function report(cause) {
67
- if (cause instanceof ContentError) for (const diagnostic of cause.diagnostics) console.error(`[content-query:${diagnostic.code}] ${[
65
+ /** Names where a diagnostic applies: collection, entry, source, payload variant, and field path. */
66
+ function location(diagnostic) {
67
+ return [
68
68
  diagnostic.collection,
69
69
  diagnostic.id,
70
- diagnostic.source
71
- ].filter(Boolean).join(" ")}: ${diagnostic.message}`);
70
+ diagnostic.source,
71
+ diagnostic.payload ? payloadIdentity(diagnostic.payload, diagnostic.variant) : void 0,
72
+ diagnostic.path?.length ? `at ${diagnostic.path.map(String).join(".")}` : void 0
73
+ ].filter(Boolean).join(" ");
74
+ }
75
+ /** Prints structured contextual diagnostics without depending on a framework display. */
76
+ function report(cause) {
77
+ if (cause instanceof ContentError) for (const diagnostic of cause.diagnostics) console.error(`[content-query:${diagnostic.code}] ${location(diagnostic)}: ${diagnostic.message}`);
72
78
  else console.error(cause instanceof Error ? cause.message : cause);
73
79
  }
74
80
  //#endregion
@@ -1,5 +1,5 @@
1
- import { m as MaybePromise } from "./types-FmUJ3cH1.mjs";
2
- import { a as ComputedContext } from "./types-BC8gVJ6u.mjs";
1
+ import { g as MaybePromise } from "./descriptor-bcPa6XLk.mjs";
2
+ import { a as ComputedContext } from "./types-DbFfF6JE.mjs";
3
3
  import { StandardSchemaV1 } from "@standard-schema/spec";
4
4
  //#region src/computed/text.d.ts
5
5
  /** The syntax removed before computing text-derived fields; literal text preserves all characters. */