content-query 0.2.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.
- package/README.md +28 -3
- package/dist/{build-Dxz7P1ur.mjs → build-CcqIpkes.mjs} +763 -39
- package/dist/build-DL1GzmRy.d.mts +55 -0
- package/dist/build.d.mts +2 -2
- package/dist/build.mjs +1 -1
- package/dist/cli.mjs +14 -8
- package/dist/computed.d.mts +2 -2
- package/dist/{content-N1gYshjg.mjs → content-BXrgP7nL.mjs} +271 -81
- package/dist/{content-G69dPPuo.d.mts → content-CwTKqRs9.d.mts} +49 -24
- package/dist/{types-ChaNhj42.d.mts → descriptor-bcPa6XLk.d.mts} +26 -1
- package/dist/{diagnostics-Cu94mZhl.mjs → diagnostics-DmUZtrJ6.mjs} +3 -1
- package/dist/{errors-C2iuBM0G.mjs → errors-Bfd0R4_P.mjs} +16 -1
- package/dist/file-DSOcdFj0.mjs +81 -0
- package/dist/{glob-Bv0dpvCQ.mjs → glob-BXJuwy_p.mjs} +94 -6
- package/dist/index.d.mts +61 -17
- package/dist/index.mjs +1 -1
- package/dist/internal.d.mts +11 -4
- package/dist/internal.mjs +29 -5
- package/dist/loaders.d.mts +2 -3
- package/dist/loaders.mjs +2 -81
- package/dist/next.d.mts +1 -1
- package/dist/next.mjs +2 -2
- package/dist/{operators-UqWUhKQJ.mjs → operators-Cwy8Kx4o.mjs} +88 -2
- package/dist/query-style-eXENQJ0O.d.mts +22 -0
- package/dist/query.d.mts +25 -2
- package/dist/query.mjs +1 -1
- package/dist/{relational-types-DgK3rLuw.d.mts → relational-types-C8xJtLG5.d.mts} +113 -38
- package/dist/runtime.d.mts +3 -2
- package/dist/runtime.mjs +1 -1
- package/dist/types-DbFfF6JE.d.mts +181 -0
- package/dist/vite.d.mts +15 -3
- package/dist/vite.mjs +25 -2
- package/package.json +2 -2
- package/dist/build-DfKd2bpf.d.mts +0 -25
- package/dist/descriptor-D9Th5hzk.d.mts +0 -18
- package/dist/types-C-kdMblM.d.mts +0 -69
- package/dist/validation-D_XdE1pF.mjs +0 -84
|
@@ -0,0 +1,55 @@
|
|
|
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";
|
|
4
|
+
//#region src/preparation/session.d.ts
|
|
5
|
+
/** A local source captured by a successfully prepared content revision. */
|
|
6
|
+
type ContentSourceEntry = Readonly<{
|
|
7
|
+
collection: string;
|
|
8
|
+
id: string;
|
|
9
|
+
filePath?: string;
|
|
10
|
+
}>;
|
|
11
|
+
/** Format-neutral integration metadata; the revision token is opaque and session-scoped. */
|
|
12
|
+
type ContentSourceSnapshot = Readonly<{
|
|
13
|
+
revision: string;
|
|
14
|
+
entries: readonly ContentSourceEntry[];
|
|
15
|
+
}>;
|
|
16
|
+
/** Notifications are delivered only after atomic publication, or after a failed attempt. */
|
|
17
|
+
type ContentSourceEvent = {
|
|
18
|
+
type: "ready";
|
|
19
|
+
snapshot: ContentSourceSnapshot;
|
|
20
|
+
} | {
|
|
21
|
+
type: "error";
|
|
22
|
+
error: ContentError;
|
|
23
|
+
};
|
|
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>;
|
|
27
|
+
/** Reads the latest successful source snapshot; current preparation errors are rethrown. */
|
|
28
|
+
sources(): ContentSourceSnapshot;
|
|
29
|
+
/** Observes subsequent publications and failures; returns an idempotent unsubscribe function. */
|
|
30
|
+
subscribe(listener: (event: ContentSourceEvent) => void): () => void;
|
|
31
|
+
dispose(): Promise<void>;
|
|
32
|
+
};
|
|
33
|
+
//#endregion
|
|
34
|
+
//#region src/preparation/build.d.ts
|
|
35
|
+
/** Options shared by standalone content builds and host integrations. */
|
|
36
|
+
type BuildContentOptions = {
|
|
37
|
+
/** Exact config path; omission discovers one content-query.config.{ts,mts,cts,js,mjs,cjs} file. */
|
|
38
|
+
config?: string;
|
|
39
|
+
backend?: "in-memory" | "generated";
|
|
40
|
+
/** Generated backend output directory, relative to the application root; defaults to ./.content-query. */
|
|
41
|
+
outDir?: string;
|
|
42
|
+
watch?: boolean;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Builds content independently of a bundler; bind the registry through an erased type import.
|
|
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.
|
|
52
|
+
*/
|
|
53
|
+
declare function buildContent<Registry extends CollectionRegistry = {}, Style extends QueryStyle = QueryStyle>(...arguments_: InvalidRelationships<Registry> extends never ? [options?: BuildContentOptions] : [invalidRegistry: never]): Promise<ContentSession<Registry, Style>>;
|
|
54
|
+
//#endregion
|
|
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 { n as buildContent, r as ContentSession, t as BuildContentOptions } from "./build-
|
|
2
|
-
export { type BuildContentOptions, type ContentSession, buildContent };
|
|
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
|
+
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-
|
|
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-
|
|
3
|
-
import { t as buildAtRoot } from "./build-
|
|
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.
|
|
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
|
-
/**
|
|
66
|
-
function
|
|
67
|
-
|
|
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
|
-
|
|
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
|
package/dist/computed.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as ComputedContext } from "./types-
|
|
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. */
|