@specglass/core 0.0.2

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 (95) hide show
  1. package/dist/config/defaults.d.ts +4 -0
  2. package/dist/config/defaults.d.ts.map +1 -0
  3. package/dist/config/defaults.js +31 -0
  4. package/dist/config/defaults.js.map +1 -0
  5. package/dist/config/define-config.d.ts +17 -0
  6. package/dist/config/define-config.d.ts.map +1 -0
  7. package/dist/config/define-config.js +55 -0
  8. package/dist/config/define-config.js.map +1 -0
  9. package/dist/config/loader.d.ts +11 -0
  10. package/dist/config/loader.d.ts.map +1 -0
  11. package/dist/config/loader.js +74 -0
  12. package/dist/config/loader.js.map +1 -0
  13. package/dist/config/schema.d.ts +366 -0
  14. package/dist/config/schema.d.ts.map +1 -0
  15. package/dist/config/schema.js +109 -0
  16. package/dist/config/schema.js.map +1 -0
  17. package/dist/content/frontmatter-schema.d.ts +53 -0
  18. package/dist/content/frontmatter-schema.d.ts.map +1 -0
  19. package/dist/content/frontmatter-schema.js +27 -0
  20. package/dist/content/frontmatter-schema.js.map +1 -0
  21. package/dist/content/mdx-loader.d.ts +93 -0
  22. package/dist/content/mdx-loader.d.ts.map +1 -0
  23. package/dist/content/mdx-loader.js +97 -0
  24. package/dist/content/mdx-loader.js.map +1 -0
  25. package/dist/content/openapi-loader.d.ts +40 -0
  26. package/dist/content/openapi-loader.d.ts.map +1 -0
  27. package/dist/content/openapi-loader.js +58 -0
  28. package/dist/content/openapi-loader.js.map +1 -0
  29. package/dist/content/rehype-code-blocks.d.ts +15 -0
  30. package/dist/content/rehype-code-blocks.d.ts.map +1 -0
  31. package/dist/content/rehype-code-blocks.js +84 -0
  32. package/dist/content/rehype-code-blocks.js.map +1 -0
  33. package/dist/errors/specglass-error.d.ts +12 -0
  34. package/dist/errors/specglass-error.d.ts.map +1 -0
  35. package/dist/errors/specglass-error.js +19 -0
  36. package/dist/errors/specglass-error.js.map +1 -0
  37. package/dist/index.d.ts +26 -0
  38. package/dist/index.d.ts.map +1 -0
  39. package/dist/index.js +26 -0
  40. package/dist/index.js.map +1 -0
  41. package/dist/integration.d.ts +41 -0
  42. package/dist/integration.d.ts.map +1 -0
  43. package/dist/integration.js +276 -0
  44. package/dist/integration.js.map +1 -0
  45. package/dist/navigation/builder.d.ts +24 -0
  46. package/dist/navigation/builder.d.ts.map +1 -0
  47. package/dist/navigation/builder.js +169 -0
  48. package/dist/navigation/builder.js.map +1 -0
  49. package/dist/navigation/index.d.ts +7 -0
  50. package/dist/navigation/index.d.ts.map +1 -0
  51. package/dist/navigation/index.js +6 -0
  52. package/dist/navigation/index.js.map +1 -0
  53. package/dist/navigation/meta-parser.d.ts +9 -0
  54. package/dist/navigation/meta-parser.d.ts.map +1 -0
  55. package/dist/navigation/meta-parser.js +59 -0
  56. package/dist/navigation/meta-parser.js.map +1 -0
  57. package/dist/navigation/meta-schema.d.ts +77 -0
  58. package/dist/navigation/meta-schema.d.ts.map +1 -0
  59. package/dist/navigation/meta-schema.js +31 -0
  60. package/dist/navigation/meta-schema.js.map +1 -0
  61. package/dist/navigation/watcher.d.ts +44 -0
  62. package/dist/navigation/watcher.d.ts.map +1 -0
  63. package/dist/navigation/watcher.js +81 -0
  64. package/dist/navigation/watcher.js.map +1 -0
  65. package/dist/openapi/parser.d.ts +24 -0
  66. package/dist/openapi/parser.d.ts.map +1 -0
  67. package/dist/openapi/parser.js +53 -0
  68. package/dist/openapi/parser.js.map +1 -0
  69. package/dist/openapi/transformer.d.ts +19 -0
  70. package/dist/openapi/transformer.d.ts.map +1 -0
  71. package/dist/openapi/transformer.js +294 -0
  72. package/dist/openapi/transformer.js.map +1 -0
  73. package/dist/openapi/types.d.ts +109 -0
  74. package/dist/openapi/types.d.ts.map +1 -0
  75. package/dist/openapi/types.js +11 -0
  76. package/dist/openapi/types.js.map +1 -0
  77. package/dist/openapi/utils.d.ts +26 -0
  78. package/dist/openapi/utils.d.ts.map +1 -0
  79. package/dist/openapi/utils.js +34 -0
  80. package/dist/openapi/utils.js.map +1 -0
  81. package/dist/types/config.d.ts +7 -0
  82. package/dist/types/config.d.ts.map +1 -0
  83. package/dist/types/config.js +2 -0
  84. package/dist/types/config.js.map +1 -0
  85. package/dist/types/navigation.d.ts +62 -0
  86. package/dist/types/navigation.d.ts.map +1 -0
  87. package/dist/types/navigation.js +2 -0
  88. package/dist/types/navigation.js.map +1 -0
  89. package/dist/virtual/modules.d.ts +34 -0
  90. package/dist/virtual/modules.d.ts.map +1 -0
  91. package/dist/virtual/modules.js +37 -0
  92. package/dist/virtual/modules.js.map +1 -0
  93. package/package.json +51 -0
  94. package/src/pages/[...slug].astro +55 -0
  95. package/src/pages/api-reference/[...slug].astro +67 -0
@@ -0,0 +1,294 @@
1
+ /**
2
+ * OpenAPI document transformer.
3
+ *
4
+ * Converts a raw (dereferenced) OpenAPI document into the typed
5
+ * `ParsedOpenApiSpec` data model. Each operation is transformed into
6
+ * an `ApiEndpoint`; failures on individual endpoints produce
7
+ * `ApiEndpointError` objects instead of aborting the entire spec (FR40).
8
+ *
9
+ * @module
10
+ */
11
+ /** HTTP methods recognised in OpenAPI path items */
12
+ const HTTP_METHODS = [
13
+ "get",
14
+ "post",
15
+ "put",
16
+ "delete",
17
+ "patch",
18
+ "options",
19
+ "head",
20
+ "trace",
21
+ ];
22
+ /**
23
+ * Transform a raw dereferenced OpenAPI document into a `ParsedOpenApiSpec`.
24
+ *
25
+ * @param document - The parsed OpenAPI document from @redocly/openapi-core
26
+ * @returns Structured spec with endpoints, errors, security schemes, and servers
27
+ */
28
+ export function transformSpec(document) {
29
+ const info = extractInfo(document);
30
+ const servers = extractServers(document);
31
+ const securitySchemes = extractSecuritySchemes(document);
32
+ const globalSecurity = extractSecurityRequirements(document.security, securitySchemes);
33
+ const endpoints = [];
34
+ const errors = [];
35
+ const paths = (document.paths ?? {});
36
+ for (const [path, pathItem] of Object.entries(paths)) {
37
+ // Path-level parameters apply to all operations on this path
38
+ const pathParams = extractParameters(pathItem.parameters);
39
+ for (const method of HTTP_METHODS) {
40
+ const operation = pathItem[method];
41
+ if (!operation)
42
+ continue;
43
+ try {
44
+ const endpoint = transformOperation(path, method, operation, pathParams, globalSecurity, securitySchemes);
45
+ endpoints.push(endpoint);
46
+ }
47
+ catch (error) {
48
+ errors.push({
49
+ path,
50
+ method,
51
+ reason: error instanceof Error ? error.message : "Unknown transformation error",
52
+ rawSpec: operation,
53
+ });
54
+ }
55
+ }
56
+ }
57
+ return { info, endpoints, errors, securitySchemes, servers };
58
+ }
59
+ // ─── Extraction helpers ──────────────────────────────────────────────
60
+ function extractInfo(document) {
61
+ const info = (document.info ?? {});
62
+ return {
63
+ title: String(info.title ?? "Untitled API"),
64
+ version: String(info.version ?? "0.0.0"),
65
+ description: info.description ? String(info.description) : undefined,
66
+ };
67
+ }
68
+ function extractServers(document) {
69
+ const raw = document.servers;
70
+ if (!Array.isArray(raw))
71
+ return [];
72
+ return raw.map((s) => ({
73
+ url: String(s.url ?? ""),
74
+ description: s.description ? String(s.description) : undefined,
75
+ }));
76
+ }
77
+ function extractSecuritySchemes(document) {
78
+ const components = (document.components ?? {});
79
+ const raw = (components.securitySchemes ?? {});
80
+ const result = {};
81
+ for (const [name, scheme] of Object.entries(raw)) {
82
+ result[name] = {
83
+ schemeName: name,
84
+ scopes: [],
85
+ type: String(scheme.type ?? "apiKey"),
86
+ name: scheme.name ? String(scheme.name) : undefined,
87
+ in: scheme.in ? String(scheme.in) : undefined,
88
+ scheme: scheme.scheme ? String(scheme.scheme) : undefined,
89
+ };
90
+ }
91
+ return result;
92
+ }
93
+ function extractSecurityRequirements(security, schemes) {
94
+ if (!Array.isArray(security))
95
+ return [];
96
+ return security.flatMap((req) => Object.entries(req).map(([schemeName, scopes]) => ({
97
+ ...(schemes[schemeName] ?? {
98
+ schemeName,
99
+ type: "apiKey",
100
+ }),
101
+ schemeName,
102
+ scopes: scopes ?? [],
103
+ })));
104
+ }
105
+ // ─── Operation transformation ────────────────────────────────────────
106
+ function transformOperation(path, method, operation, pathLevelParams, globalSecurity, securitySchemes) {
107
+ // Merge path-level and operation-level parameters.
108
+ // Operation-level params override path-level params with the same name+in.
109
+ const operationParams = extractParameters(operation.parameters);
110
+ const mergedParams = mergeParameters(pathLevelParams, operationParams);
111
+ // Security: operation-level overrides global
112
+ const security = operation.security
113
+ ? extractSecurityRequirements(operation.security, securitySchemes)
114
+ : globalSecurity;
115
+ return {
116
+ method: method.toUpperCase(),
117
+ path,
118
+ operationId: operation.operationId
119
+ ? String(operation.operationId)
120
+ : undefined,
121
+ summary: operation.summary ? String(operation.summary) : undefined,
122
+ description: operation.description
123
+ ? String(operation.description)
124
+ : undefined,
125
+ tags: Array.isArray(operation.tags)
126
+ ? operation.tags.map(String)
127
+ : [],
128
+ deprecated: Boolean(operation.deprecated),
129
+ parameters: mergedParams,
130
+ requestBody: extractRequestBody(operation.requestBody),
131
+ responses: extractResponses(operation.responses),
132
+ security,
133
+ };
134
+ }
135
+ // ─── Parameter handling ──────────────────────────────────────────────
136
+ function extractParameters(raw) {
137
+ if (!Array.isArray(raw))
138
+ return [];
139
+ return raw.map((p) => {
140
+ const param = p;
141
+ return {
142
+ name: String(param.name ?? ""),
143
+ in: String(param.in ?? "query"),
144
+ required: Boolean(param.required),
145
+ description: param.description ? String(param.description) : undefined,
146
+ schema: extractSchema(param.schema),
147
+ example: param.example,
148
+ };
149
+ });
150
+ }
151
+ /**
152
+ * Merge path-level and operation-level parameters.
153
+ * Operation-level parameters override path-level ones with the same name+in.
154
+ */
155
+ function mergeParameters(pathParams, operationParams) {
156
+ const merged = new Map();
157
+ // Path-level first
158
+ for (const p of pathParams) {
159
+ merged.set(`${p.in}:${p.name}`, p);
160
+ }
161
+ // Operation-level overrides
162
+ for (const p of operationParams) {
163
+ merged.set(`${p.in}:${p.name}`, p);
164
+ }
165
+ return Array.from(merged.values());
166
+ }
167
+ // ─── Request body ────────────────────────────────────────────────────
168
+ function extractRequestBody(raw) {
169
+ if (!raw)
170
+ return undefined;
171
+ const content = {};
172
+ const rawContent = (raw.content ?? {});
173
+ for (const [mediaType, mediaSpec] of Object.entries(rawContent)) {
174
+ content[mediaType] = extractMediaType(mediaSpec);
175
+ }
176
+ return {
177
+ required: Boolean(raw.required),
178
+ description: raw.description ? String(raw.description) : undefined,
179
+ content,
180
+ };
181
+ }
182
+ function extractMediaType(raw) {
183
+ return {
184
+ schema: extractSchema(raw.schema),
185
+ example: raw.example,
186
+ examples: raw.examples
187
+ ? extractExamples(raw.examples)
188
+ : undefined,
189
+ };
190
+ }
191
+ function extractExamples(raw) {
192
+ const result = {};
193
+ for (const [name, example] of Object.entries(raw)) {
194
+ result[name] = {
195
+ summary: example.summary ? String(example.summary) : undefined,
196
+ description: example.description
197
+ ? String(example.description)
198
+ : undefined,
199
+ value: example.value,
200
+ };
201
+ }
202
+ return result;
203
+ }
204
+ // ─── Response handling ───────────────────────────────────────────────
205
+ function extractResponses(raw) {
206
+ if (!raw)
207
+ return [];
208
+ return Object.entries(raw).map(([statusCode, response]) => {
209
+ const content = response.content
210
+ ? Object.fromEntries(Object.entries(response.content).map(([mediaType, mediaSpec]) => [
211
+ mediaType,
212
+ extractMediaType(mediaSpec),
213
+ ]))
214
+ : undefined;
215
+ // Extract response headers
216
+ const headers = response.headers
217
+ ? Object.fromEntries(Object.entries(response.headers).map(([headerName, headerSpec]) => [
218
+ headerName,
219
+ {
220
+ name: headerName,
221
+ in: "header",
222
+ required: Boolean(headerSpec.required),
223
+ description: headerSpec.description
224
+ ? String(headerSpec.description)
225
+ : undefined,
226
+ schema: extractSchema(headerSpec.schema),
227
+ example: headerSpec.example,
228
+ },
229
+ ]))
230
+ : undefined;
231
+ return {
232
+ statusCode,
233
+ description: String(response.description ?? ""),
234
+ content,
235
+ headers,
236
+ };
237
+ });
238
+ }
239
+ // ─── Schema extraction ──────────────────────────────────────────────
240
+ function extractSchema(raw) {
241
+ if (!raw)
242
+ return {};
243
+ const schema = {};
244
+ if (raw.type)
245
+ schema.type = String(raw.type);
246
+ if (raw.format)
247
+ schema.format = String(raw.format);
248
+ if (raw.description)
249
+ schema.description = String(raw.description);
250
+ if (raw.nullable)
251
+ schema.nullable = Boolean(raw.nullable);
252
+ if (raw.$ref)
253
+ schema.ref = String(raw.$ref);
254
+ // Enum values
255
+ if (Array.isArray(raw.enum)) {
256
+ schema.enum = raw.enum;
257
+ }
258
+ // Required fields
259
+ if (Array.isArray(raw.required)) {
260
+ schema.required = raw.required.map(String);
261
+ }
262
+ // Nested properties
263
+ if (raw.properties && typeof raw.properties === "object") {
264
+ schema.properties = {};
265
+ for (const [key, value] of Object.entries(raw.properties)) {
266
+ schema.properties[key] = extractSchema(value);
267
+ }
268
+ }
269
+ // Array items
270
+ if (raw.items && typeof raw.items === "object") {
271
+ schema.items = extractSchema(raw.items);
272
+ }
273
+ // additionalProperties
274
+ if (raw.additionalProperties !== undefined) {
275
+ if (typeof raw.additionalProperties === "boolean") {
276
+ schema.additionalProperties = raw.additionalProperties;
277
+ }
278
+ else if (typeof raw.additionalProperties === "object") {
279
+ schema.additionalProperties = extractSchema(raw.additionalProperties);
280
+ }
281
+ }
282
+ // Composition keywords — preserve as arrays, do NOT deep merge
283
+ if (Array.isArray(raw.allOf)) {
284
+ schema.allOf = raw.allOf.map((s) => extractSchema(s));
285
+ }
286
+ if (Array.isArray(raw.oneOf)) {
287
+ schema.oneOf = raw.oneOf.map((s) => extractSchema(s));
288
+ }
289
+ if (Array.isArray(raw.anyOf)) {
290
+ schema.anyOf = raw.anyOf.map((s) => extractSchema(s));
291
+ }
292
+ return schema;
293
+ }
294
+ //# sourceMappingURL=transformer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transformer.js","sourceRoot":"","sources":["../../src/openapi/transformer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAcH,oDAAoD;AACpD,MAAM,YAAY,GAAG;IACnB,KAAK;IACL,MAAM;IACN,KAAK;IACL,QAAQ;IACR,OAAO;IACP,SAAS;IACT,MAAM;IACN,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,CAAC,CAC5C,CAAC;IACJ,CAAC;IACD,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;QAC7B,MAAM,CAAC,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CACjC,aAAa,CAAC,CAA4B,CAAC,CAC5C,CAAC;IACJ,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,109 @@
1
+ /**
2
+ * TypeScript types for the parsed OpenAPI specification data model.
3
+ *
4
+ * These types define the intermediate representation between the raw
5
+ * OpenAPI document (parsed by @redocly/openapi-core) and the final
6
+ * content entries consumed by the Astro Content Layer and theme components.
7
+ *
8
+ * @module
9
+ */
10
+ /** JSON Schema subset used for parameter, request body, and response schemas */
11
+ export interface ApiSchema {
12
+ type?: string;
13
+ format?: string;
14
+ properties?: Record<string, ApiSchema>;
15
+ items?: ApiSchema;
16
+ required?: string[];
17
+ enum?: unknown[];
18
+ description?: string;
19
+ /** Original $ref path, preserved for display (e.g., "#/components/schemas/Pet") */
20
+ ref?: string;
21
+ allOf?: ApiSchema[];
22
+ oneOf?: ApiSchema[];
23
+ anyOf?: ApiSchema[];
24
+ nullable?: boolean;
25
+ additionalProperties?: boolean | ApiSchema;
26
+ }
27
+ /** An example value associated with a media type */
28
+ export interface ApiExample {
29
+ summary?: string;
30
+ description?: string;
31
+ value: unknown;
32
+ }
33
+ /** A single media type entry (e.g., application/json) in a request body or response */
34
+ export interface ApiMediaType {
35
+ schema: ApiSchema;
36
+ example?: unknown;
37
+ examples?: Record<string, ApiExample>;
38
+ }
39
+ /** An API endpoint parameter (path, query, header, or cookie) */
40
+ export interface ApiParameter {
41
+ name: string;
42
+ in: "path" | "query" | "header" | "cookie";
43
+ required: boolean;
44
+ description?: string;
45
+ schema: ApiSchema;
46
+ example?: unknown;
47
+ }
48
+ /** Request body definition for an API endpoint */
49
+ export interface ApiRequestBody {
50
+ required: boolean;
51
+ description?: string;
52
+ content: Record<string, ApiMediaType>;
53
+ }
54
+ /** A single HTTP response definition */
55
+ export interface ApiResponse {
56
+ statusCode: string;
57
+ description: string;
58
+ content?: Record<string, ApiMediaType>;
59
+ headers?: Record<string, ApiParameter>;
60
+ }
61
+ /** A security requirement referencing a security scheme */
62
+ export interface ApiSecurityRequirement {
63
+ schemeName: string;
64
+ scopes: string[];
65
+ type: "apiKey" | "http" | "oauth2" | "openIdConnect";
66
+ name?: string;
67
+ in?: string;
68
+ scheme?: string;
69
+ }
70
+ /** A single API endpoint (one HTTP method on one path) */
71
+ export interface ApiEndpoint {
72
+ method: string;
73
+ path: string;
74
+ operationId?: string;
75
+ summary?: string;
76
+ description?: string;
77
+ tags: string[];
78
+ deprecated: boolean;
79
+ parameters: ApiParameter[];
80
+ requestBody?: ApiRequestBody;
81
+ responses: ApiResponse[];
82
+ security: ApiSecurityRequirement[];
83
+ }
84
+ /**
85
+ * Per-endpoint error produced during transformation.
86
+ * Allows graceful fallback: the rest of the spec is still usable (FR40).
87
+ */
88
+ export interface ApiEndpointError {
89
+ path: string;
90
+ method: string;
91
+ reason: string;
92
+ rawSpec: unknown;
93
+ }
94
+ /** The fully parsed and transformed OpenAPI specification */
95
+ export interface ParsedOpenApiSpec {
96
+ info: {
97
+ title: string;
98
+ version: string;
99
+ description?: string;
100
+ };
101
+ endpoints: ApiEndpoint[];
102
+ errors: ApiEndpointError[];
103
+ securitySchemes: Record<string, ApiSecurityRequirement>;
104
+ servers: Array<{
105
+ url: string;
106
+ description?: string;
107
+ }>;
108
+ }
109
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/openapi/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,gFAAgF;AAChF,MAAM,WAAW,SAAS;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,U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QACd,OAAO,EAAE,MAAM,CAAC;QAChB,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,CAAC;IACF,SAAS,EAAE,WAAW,EAAE,CAAC;IACzB,MAAM,EAAE,gBAAgB,EAAE,CAAC;IAC3B,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,sBAAsB,CAAC,CAAC;IACxD,OAAO,EAAE,KAAK,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACvD"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * TypeScript types for the parsed OpenAPI specification data model.
3
+ *
4
+ * These types define the intermediate representation between the raw
5
+ * OpenAPI document (parsed by @redocly/openapi-core) and the final
6
+ * content entries consumed by the Astro Content Layer and theme components.
7
+ *
8
+ * @module
9
+ */
10
+ export {};
11
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/openapi/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Shared OpenAPI utilities for route/slug generation.
3
+ *
4
+ * Used by the API reference route page and theme navigation component
5
+ * to ensure consistent URL generation.
6
+ *
7
+ * @module
8
+ */
9
+ import type { ApiEndpoint } from "./types.js";
10
+ /**
11
+ * Build a URL-friendly slug for an API endpoint.
12
+ *
13
+ * Format: `{tag}/{method}-{sanitized-path}`
14
+ *
15
+ * @example
16
+ * buildEndpointSlug({ method: "get", path: "/pets/{petId}", tags: ["pets"] })
17
+ * // → "pets/get-pets-petId"
18
+ */
19
+ export declare function buildEndpointSlug(endpoint: ApiEndpoint): string;
20
+ /**
21
+ * Build a unique identifier for an endpoint (used for active-state matching).
22
+ *
23
+ * Format: `{method}-{path}`
24
+ */
25
+ export declare function buildEndpointId(endpoint: ApiEndpoint): string;
26
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/openapi/utils.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,WAAW,GAAG,MAAM,CAO/D;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,WAAW,GAAG,MAAM,CAE7D"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Shared OpenAPI utilities for route/slug generation.
3
+ *
4
+ * Used by the API reference route page and theme navigation component
5
+ * to ensure consistent URL generation.
6
+ *
7
+ * @module
8
+ */
9
+ /**
10
+ * Build a URL-friendly slug for an API endpoint.
11
+ *
12
+ * Format: `{tag}/{method}-{sanitized-path}`
13
+ *
14
+ * @example
15
+ * buildEndpointSlug({ method: "get", path: "/pets/{petId}", tags: ["pets"] })
16
+ * // → "pets/get-pets-petId"
17
+ */
18
+ export function buildEndpointSlug(endpoint) {
19
+ const tag = endpoint.tags?.[0] ?? "default";
20
+ const sanitizedPath = endpoint.path
21
+ .replace(/^\//, "")
22
+ .replace(/\//g, "-")
23
+ .replace(/[{}]/g, "");
24
+ return `${tag}/${endpoint.method}-${sanitizedPath}`;
25
+ }
26
+ /**
27
+ * Build a unique identifier for an endpoint (used for active-state matching).
28
+ *
29
+ * Format: `{method}-{path}`
30
+ */
31
+ export function buildEndpointId(endpoint) {
32
+ return `${endpoint.method}-${endpoint.path}`;
33
+ }
34
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/openapi/utils.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH;;;;;;;;GAQG;AACH,MAAM,UAAU,iBAAiB,CAAC,QAAqB;IACrD,MAAM,GAAG,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,SAAS,CAAC;IAC5C,MAAM,aAAa,GAAG,QAAQ,CAAC,IAAI;SAChC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;SAClB,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;SACnB,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IACxB,OAAO,GAAG,GAAG,IAAI,QAAQ,CAAC,MAAM,IAAI,aAAa,EAAE,CAAC;AACtD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,QAAqB;IACnD,OAAO,GAAG,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,IAAI,EAAE,CAAC;AAC/C,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { z } from "zod";
2
+ import { configSchema } from "../config/schema.js";
3
+ /** Fully resolved specglass configuration object. */
4
+ export type SpecglassConfig = z.infer<typeof configSchema>;
5
+ /** Deep partial version of SpecglassConfig for user input to defineConfig. */
6
+ export type SpecglassUserConfig = z.input<typeof configSchema>;
7
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/types/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,qDAAqD;AACrD,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAE3D,8EAA8E;AAC9E,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/types/config.ts"],"names":[],"mappings":""}
@@ -0,0 +1,62 @@
1
+ /**
2
+ * A single navigation item in the sidebar tree.
3
+ *
4
+ * - `"page"` — a content page (MDX/MD file)
5
+ * - `"section"` — a directory containing child items
6
+ * - `"external-link"` — an external URL defined in `_meta.json`
7
+ */
8
+ export interface NavItem {
9
+ /** Display title for the sidebar */
10
+ title: string;
11
+ /** URL slug (relative path from content root, without extension) */
12
+ slug: string;
13
+ /** Discriminator for the item kind */
14
+ type: "page" | "section" | "external-link";
15
+ /** Child items (only meaningful for sections) */
16
+ children?: NavItem[];
17
+ /** Whether the section is collapsed by default */
18
+ collapsed?: boolean;
19
+ /** Optional icon (emoji or symbol) */
20
+ icon?: string;
21
+ /** External URL (only for type "external-link") */
22
+ href?: string;
23
+ /** If true, item is excluded from the rendered tree */
24
+ hidden?: boolean;
25
+ }
26
+ /**
27
+ * The complete sidebar navigation tree.
28
+ */
29
+ export interface NavigationTree {
30
+ items: NavItem[];
31
+ }
32
+ /**
33
+ * Raw entry parsed from a `_meta.json` file.
34
+ *
35
+ * String values are shorthand for `{ title: "value" }`.
36
+ * Object values support extended configuration.
37
+ */
38
+ export type MetaJsonEntryValue = string | {
39
+ title: string;
40
+ collapsed?: boolean;
41
+ icon?: string;
42
+ href?: string;
43
+ hidden?: boolean;
44
+ };
45
+ /**
46
+ * A single parsed entry from `_meta.json`, preserving key order.
47
+ */
48
+ export interface MetaJsonEntry {
49
+ /** Filename without extension (the JSON key) */
50
+ key: string;
51
+ /** Resolved title */
52
+ title: string;
53
+ /** Whether this section is collapsed by default */
54
+ collapsed?: boolean;
55
+ /** Optional icon */
56
+ icon?: string;
57
+ /** External link URL */
58
+ href?: string;
59
+ /** Whether to hide from navigation */
60
+ hidden?: boolean;
61
+ }
62
+ //# sourceMappingURL=navigation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../src/types/navigation.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,WAAW,OAAO;IACtB,oCAAoC;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,oEAAoE;IACpE,IAAI,EAAE,MAAM,CAAC;IACb,sCAAsC;IACtC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,eAAe,CAAC;IAC3C,iDAAiD;IACjD,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;IACrB,kDAAkD;IAClD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,sCAAsC;IACtC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,mDAAmD;IACnD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,uDAAuD;IACvD,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,OAAO,EAAE,CAAC;CAClB;AAED;;;;;GAKG;AACH,MAAM,MAAM,kBAAkB,GAC1B,MAAM,GACN;IACE,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AAEN;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,gDAAgD;IAChD,GAAG,EAAE,MAAM,CAAC;IACZ,qBAAqB;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,mDAAmD;IACnD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,oBAAoB;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,wBAAwB;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,sCAAsC;IACtC,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=navigation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"navigation.js","sourceRoot":"","sources":["../../src/types/navigation.ts"],"names":[],"mappings":""}
@@ -0,0 +1,34 @@
1
+ import type { SpecglassConfig } from "../types/config.js";
2
+ import type { NavigationTree } from "../types/navigation.js";
3
+ import type { ParsedOpenApiSpec } from "../openapi/types.js";
4
+ /** Identifier for the specglass config virtual module */
5
+ export declare const VIRTUAL_MODULE_ID = "virtual:specglass/config";
6
+ /** Identifier for the specglass navigation virtual module */
7
+ export declare const NAVIGATION_MODULE_ID = "virtual:specglass/navigation";
8
+ /** Identifier for the specglass OpenAPI data virtual module */
9
+ export declare const OPENAPI_DATA_MODULE_ID = "virtual:specglass/openapi-data";
10
+ /**
11
+ * Generate the JavaScript module content for `virtual:specglass/config`.
12
+ * Serializes the resolved config object into an exportable module string.
13
+ *
14
+ * @param config - The fully resolved and validated SpecglassConfig
15
+ * @returns JavaScript module source code exporting `config`
16
+ */
17
+ export declare function generateConfigModuleContent(config: SpecglassConfig): string;
18
+ /**
19
+ * Generate the JavaScript module content for `virtual:specglass/navigation`.
20
+ *
21
+ * @param tree - The computed navigation tree to serialize into the virtual module.
22
+ * Defaults to an empty tree if not provided.
23
+ * @returns JavaScript module source code exporting `navigation`
24
+ */
25
+ export declare function generateNavigationModuleContent(tree?: NavigationTree): string;
26
+ /**
27
+ * Generate the JavaScript module content for `virtual:specglass/openapi-data`.
28
+ *
29
+ * @param data - Array of parsed OpenAPI specs to serialize.
30
+ * Defaults to an empty array if not provided.
31
+ * @returns JavaScript module source code exporting `openApiData`
32
+ */
33
+ export declare function generateOpenApiDataModuleContent(data?: ParsedOpenApiSpec[]): string;
34
+ //# sourceMappingURL=modules.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"modules.d.ts","sourceRoot":"","sources":["../../src/virtual/modules.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,yDAAyD;AACzD,eAAO,MAAM,iBAAiB,6BAA6B,CAAC;AAE5D,6DAA6D;AAC7D,eAAO,MAAM,oBAAoB,iCAAiC,CAAC;AAEnE,+DAA+D;AAC/D,eAAO,MAAM,sBAAsB,mCAAmC,CAAC;AAGvE;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM,CAE3E;AAED;;;;;;GAMG;AACH,wBAAgB,+BAA+B,CAC7C,IAAI,GAAE,cAA8B,GACnC,MAAM,CAER;AAED;;;;;;GAMG;AACH,wBAAgB,gCAAgC,CAC9C,IAAI,GAAE,iBAAiB,EAAO,GAC7B,MAAM,CAER"}