content-query 0.0.2 → 0.2.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 (48) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +91 -2
  3. package/dist/build-DfKd2bpf.d.mts +25 -0
  4. package/dist/build-Dxz7P1ur.mjs +1439 -0
  5. package/dist/build.d.mts +2 -0
  6. package/dist/build.mjs +1 -0
  7. package/dist/cli.d.mts +1 -0
  8. package/dist/cli.mjs +97 -0
  9. package/dist/computed.d.mts +43 -0
  10. package/dist/computed.mjs +139 -0
  11. package/dist/content-G69dPPuo.d.mts +109 -0
  12. package/dist/content-N1gYshjg.mjs +1028 -0
  13. package/dist/descriptor-D9Th5hzk.d.mts +18 -0
  14. package/dist/diagnostics-Cu94mZhl.mjs +80 -0
  15. package/dist/dist-C7_FOzY_.mjs +5405 -0
  16. package/dist/errors-C2iuBM0G.mjs +72 -0
  17. package/dist/github-slugger-BMgR_Q0I.mjs +72 -0
  18. package/dist/glob-Bv0dpvCQ.mjs +159 -0
  19. package/dist/index.d.mts +78 -0
  20. package/dist/index.mjs +46 -0
  21. package/dist/internal/markdown.d.mts +5 -0
  22. package/dist/internal/markdown.mjs +1 -0
  23. package/dist/internal.d.mts +54 -0
  24. package/dist/internal.mjs +89 -0
  25. package/dist/loaders.d.mts +11 -0
  26. package/dist/loaders.mjs +86 -0
  27. package/dist/markdown-CHvBBJNa.mjs +54 -0
  28. package/dist/next.d.mts +20 -0
  29. package/dist/next.mjs +142 -0
  30. package/dist/operators-UqWUhKQJ.mjs +173 -0
  31. package/dist/query.d.mts +44 -0
  32. package/dist/query.mjs +1 -0
  33. package/dist/relational-types-DgK3rLuw.d.mts +278 -0
  34. package/dist/rolldown-runtime-Bg1v5YCA.mjs +34 -0
  35. package/dist/runtime.d.mts +3 -0
  36. package/dist/runtime.mjs +5 -0
  37. package/dist/schema-C5Str-E8.mjs +20 -0
  38. package/dist/schema.d.mts +11 -0
  39. package/dist/schema.mjs +1 -0
  40. package/dist/server-only-CIJUlyL-.mjs +7 -0
  41. package/dist/types-C-kdMblM.d.mts +69 -0
  42. package/dist/types-ChaNhj42.d.mts +143 -0
  43. package/dist/types-Dh-Sydyw.d.mts +20 -0
  44. package/dist/validation-D_XdE1pF.mjs +84 -0
  45. package/dist/values-BbTV4QT-.mjs +901 -0
  46. package/dist/vite.d.mts +6 -0
  47. package/dist/vite.mjs +296 -0
  48. package/package.json +92 -10
@@ -0,0 +1,18 @@
1
+ import { p as MaybePromise } from "./types-ChaNhj42.mjs";
2
+ //#region src/loaders/descriptor.d.ts
3
+ type GlobOptions = {
4
+ pattern: string | string[];
5
+ base?: string | URL;
6
+ generateId?: (context: {
7
+ entry: string;
8
+ base: URL;
9
+ data: Record<string, unknown>;
10
+ }) => string;
11
+ retainBody?: boolean;
12
+ deferRender?: boolean;
13
+ };
14
+ type FileOptions = {
15
+ parser?: (text: string) => MaybePromise<unknown>;
16
+ };
17
+ //#endregion
18
+ export { GlobOptions as n, FileOptions as t };
@@ -0,0 +1,80 @@
1
+ import { t as ContentError } from "./errors-C2iuBM0G.mjs";
2
+ import { o as encode, r as decode } from "./values-BbTV4QT-.mjs";
3
+ //#region src/runtime/diagnostics.ts
4
+ /** Transports Error nodes as records while preserving the supported diagnostic value graph. */
5
+ function diagnosticGraph(value, causes, restore, seen = /* @__PURE__ */ new Map()) {
6
+ if (value === null || typeof value !== "object") return value;
7
+ if (seen.has(value)) return seen.get(value);
8
+ if (Array.isArray(value)) {
9
+ const result = [];
10
+ result.length = value.length;
11
+ seen.set(value, result);
12
+ value.forEach((item, index) => {
13
+ result[index] = diagnosticGraph(item, causes, restore, seen);
14
+ });
15
+ return result;
16
+ }
17
+ if (value instanceof Map) {
18
+ const result = /* @__PURE__ */ new Map();
19
+ seen.set(value, result);
20
+ for (const [key, item] of value) result.set(diagnosticGraph(key, causes, restore, seen), diagnosticGraph(item, causes, restore, seen));
21
+ return result;
22
+ }
23
+ if (value instanceof Set) {
24
+ const result = /* @__PURE__ */ new Set();
25
+ seen.set(value, result);
26
+ for (const item of value) result.add(diagnosticGraph(item, causes, restore, seen));
27
+ return result;
28
+ }
29
+ const isError = restore ? causes.has(value) : value instanceof Error;
30
+ const prototype = Object.getPrototypeOf(value);
31
+ if (!isError && prototype !== Object.prototype && prototype !== null) return value;
32
+ const result = restore && isError ? /* @__PURE__ */ new Error() : Object.create(isError ? Object.prototype : prototype);
33
+ seen.set(value, result);
34
+ if (!restore && isError) causes.add(result);
35
+ const properties = !restore && value instanceof Error ? {
36
+ ...Object.fromEntries(Object.entries(value)),
37
+ name: value.name,
38
+ message: value.message,
39
+ stack: value.stack,
40
+ cause: value.cause
41
+ } : value;
42
+ for (const [key, item] of Object.entries(properties)) Object.defineProperty(result, key, {
43
+ value: diagnosticGraph(item, causes, restore, seen),
44
+ enumerable: true,
45
+ configurable: true,
46
+ writable: true
47
+ });
48
+ return result;
49
+ }
50
+ /** Encodes contextual development failures without reducing BigInts or structured issues to JSON. */
51
+ function serializeContentError(error) {
52
+ const causes = /* @__PURE__ */ new Set();
53
+ const details = {
54
+ code: error.code,
55
+ message: error.message,
56
+ stack: error.stack,
57
+ operation: error.operation,
58
+ collection: error.collection,
59
+ id: error.id,
60
+ source: error.source,
61
+ path: error.path,
62
+ issues: error.issues,
63
+ cause: error.cause,
64
+ diagnostics: error.diagnostics
65
+ };
66
+ return encode({
67
+ error: diagnosticGraph(details, causes, false),
68
+ causes: [...causes]
69
+ });
70
+ }
71
+ /** Restores the library error and its causes in a generated or isolated development runtime. */
72
+ function restoreContentError(encoded) {
73
+ const envelope = decode(encoded);
74
+ const details = diagnosticGraph(envelope.error, new Set(envelope.causes), true);
75
+ const error = new ContentError(details);
76
+ error.stack = details.stack;
77
+ return error;
78
+ }
79
+ //#endregion
80
+ export { serializeContentError as n, restoreContentError as t };