@conloca/content-api 0.1.15 → 0.1.16

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 (187) hide show
  1. package/dist/asset-manifest.d.ts +23 -0
  2. package/dist/asset-manifest.d.ts.map +1 -0
  3. package/dist/asset-manifest.js +73 -0
  4. package/dist/asset-operations.d.ts +159 -0
  5. package/dist/asset-operations.d.ts.map +1 -0
  6. package/dist/asset-operations.js +736 -0
  7. package/dist/asset-types.d.ts +56 -0
  8. package/dist/asset-types.d.ts.map +1 -0
  9. package/dist/asset-types.js +7 -0
  10. package/dist/base-content-index.d.ts +57 -0
  11. package/dist/base-content-index.d.ts.map +1 -0
  12. package/dist/base-content-index.js +179 -0
  13. package/dist/block-index.d.ts +9 -0
  14. package/dist/block-index.d.ts.map +1 -0
  15. package/dist/block-index.js +11 -0
  16. package/dist/blocks.d.ts +16 -0
  17. package/dist/blocks.d.ts.map +1 -0
  18. package/dist/blocks.js +103 -0
  19. package/dist/cf-access.d.ts +31 -0
  20. package/dist/cf-access.d.ts.map +1 -0
  21. package/dist/cf-access.js +66 -0
  22. package/dist/component-registry.d.ts +50 -0
  23. package/dist/component-registry.d.ts.map +1 -0
  24. package/dist/component-registry.js +120 -0
  25. package/dist/{component-registry.types-CBGONnYn.d.mts → component-registry.types-C0ctF9nh.d.mts} +1 -1
  26. package/dist/component-registry.types-C0ctF9nh.d.mts.map +1 -0
  27. package/dist/component-registry.types.d.ts +11 -0
  28. package/dist/component-registry.types.d.ts.map +1 -0
  29. package/dist/component-registry.types.js +1 -0
  30. package/dist/content-api.interface.d.ts +64 -0
  31. package/dist/content-api.interface.d.ts.map +1 -0
  32. package/dist/content-api.interface.js +1 -0
  33. package/dist/content-filters.d.ts +31 -0
  34. package/dist/content-filters.d.ts.map +1 -0
  35. package/dist/content-filters.js +246 -0
  36. package/dist/content-index-D092_vk1.mjs +629 -0
  37. package/dist/content-index-D092_vk1.mjs.map +1 -0
  38. package/dist/content-index-D6IVMmAB.d.mts +127 -0
  39. package/dist/content-index-D6IVMmAB.d.mts.map +1 -0
  40. package/dist/content-index.d.ts +126 -0
  41. package/dist/content-index.d.ts.map +1 -0
  42. package/dist/content-index.js +418 -0
  43. package/dist/content-operations-DIbsxG5A.d.mts +354 -0
  44. package/dist/content-operations-DIbsxG5A.d.mts.map +1 -0
  45. package/dist/content-operations.d.ts +93 -0
  46. package/dist/content-operations.d.ts.map +1 -0
  47. package/dist/content-operations.js +275 -0
  48. package/dist/content-reader.d.ts +10 -0
  49. package/dist/content-reader.d.ts.map +1 -0
  50. package/dist/content-reader.js +13 -0
  51. package/dist/content-utils-fWNHTrPy.mjs +280 -0
  52. package/dist/content-utils-fWNHTrPy.mjs.map +1 -0
  53. package/dist/content-utils.d.ts +132 -0
  54. package/dist/content-utils.d.ts.map +1 -0
  55. package/dist/content-utils.js +352 -0
  56. package/dist/content-watcher.d.ts +43 -0
  57. package/dist/content-watcher.d.ts.map +1 -0
  58. package/dist/content-watcher.js +83 -0
  59. package/dist/{data-Db1Iv9T0.mjs → data-DquNIEnQ.mjs} +4 -2
  60. package/dist/{data-Db1Iv9T0.mjs.map → data-DquNIEnQ.mjs.map} +1 -1
  61. package/dist/data-index.d.ts +8 -0
  62. package/dist/data-index.d.ts.map +1 -0
  63. package/dist/data-index.js +7 -0
  64. package/dist/data.d.ts +43 -0
  65. package/dist/data.d.ts.map +1 -0
  66. package/dist/data.js +103 -0
  67. package/dist/etag-utils.d.ts +77 -0
  68. package/dist/etag-utils.d.ts.map +1 -0
  69. package/dist/etag-utils.js +160 -0
  70. package/dist/filesystem-content-api-B1KIQJfk.mjs +2 -0
  71. package/dist/{filesystem-content-api-kxKY5IUw.mjs → filesystem-content-api-C0HIhqZi.mjs} +172 -1230
  72. package/dist/filesystem-content-api-C0HIhqZi.mjs.map +1 -0
  73. package/dist/{filesystem-content-api-C1TM0GLo.d.mts → filesystem-content-api-DCdNi-co.d.mts} +19 -4
  74. package/dist/filesystem-content-api-DCdNi-co.d.mts.map +1 -0
  75. package/dist/filesystem-content-api.d.ts +135 -0
  76. package/dist/filesystem-content-api.d.ts.map +1 -0
  77. package/dist/filesystem-content-api.js +2181 -0
  78. package/dist/git-operations.d.ts +49 -0
  79. package/dist/git-operations.d.ts.map +1 -0
  80. package/dist/git-operations.js +252 -0
  81. package/dist/header-parser.d.ts +37 -0
  82. package/dist/header-parser.d.ts.map +1 -0
  83. package/dist/header-parser.js +286 -0
  84. package/dist/in-memory-content-api.d.ts +35 -0
  85. package/dist/in-memory-content-api.d.ts.map +1 -0
  86. package/dist/in-memory-content-api.js +591 -0
  87. package/dist/index-DxVTFK66.d.mts +105 -0
  88. package/dist/index-DxVTFK66.d.mts.map +1 -0
  89. package/dist/index.d.mts +6 -5
  90. package/dist/index.d.mts.map +1 -1
  91. package/dist/index.d.ts +19 -0
  92. package/dist/index.d.ts.map +1 -0
  93. package/dist/index.js +16 -0
  94. package/dist/index.mjs +37 -6
  95. package/dist/index.mjs.map +1 -1
  96. package/dist/indexing.d.mts +152 -0
  97. package/dist/indexing.d.mts.map +1 -0
  98. package/dist/indexing.d.ts +5 -0
  99. package/dist/indexing.d.ts.map +1 -0
  100. package/dist/indexing.js +7 -0
  101. package/dist/indexing.mjs +255 -0
  102. package/dist/indexing.mjs.map +1 -0
  103. package/dist/json-whitespace-view.d.ts +32 -0
  104. package/dist/json-whitespace-view.d.ts.map +1 -0
  105. package/dist/json-whitespace-view.js +152 -0
  106. package/dist/middleware.d.ts +20 -0
  107. package/dist/middleware.d.ts.map +1 -0
  108. package/dist/middleware.js +1031 -0
  109. package/dist/node.d.mts +10 -15
  110. package/dist/node.d.mts.map +1 -1
  111. package/dist/node.d.ts +25 -0
  112. package/dist/node.d.ts.map +1 -0
  113. package/dist/node.js +24 -0
  114. package/dist/node.mjs +89 -135
  115. package/dist/node.mjs.map +1 -1
  116. package/dist/reader.d.mts +5 -8
  117. package/dist/reader.d.mts.map +1 -1
  118. package/dist/reader.d.ts +15 -0
  119. package/dist/reader.d.ts.map +1 -0
  120. package/dist/reader.js +13 -0
  121. package/dist/reader.mjs +8 -8
  122. package/dist/reader.mjs.map +1 -1
  123. package/dist/schemas/index.d.mts +2 -90
  124. package/dist/schemas/index.d.ts +102 -0
  125. package/dist/schemas/index.d.ts.map +1 -0
  126. package/dist/schemas/index.js +87 -0
  127. package/dist/schemas/index.mjs +2 -70
  128. package/dist/schemas-CFRD0FIQ.mjs +84 -0
  129. package/dist/schemas-CFRD0FIQ.mjs.map +1 -0
  130. package/dist/{site-vNtJ5jCh.mjs → site-8oaj1Q60.mjs} +21 -193
  131. package/dist/site-8oaj1Q60.mjs.map +1 -0
  132. package/dist/site-index-B_254bCc.d.mts +136 -0
  133. package/dist/site-index-B_254bCc.d.mts.map +1 -0
  134. package/dist/site-index.d.ts +60 -0
  135. package/dist/site-index.d.ts.map +1 -0
  136. package/dist/site-index.js +287 -0
  137. package/dist/site.d.ts +21 -0
  138. package/dist/site.d.ts.map +1 -0
  139. package/dist/site.js +168 -0
  140. package/dist/{types-DWt912tu.mjs → types-DOdldbfD.mjs} +3 -2
  141. package/dist/types-DOdldbfD.mjs.map +1 -0
  142. package/dist/types-DjfhS272.d.mts +456 -0
  143. package/dist/types-DjfhS272.d.mts.map +1 -0
  144. package/dist/types.d.ts +453 -0
  145. package/dist/types.d.ts.map +1 -0
  146. package/dist/types.js +36 -0
  147. package/dist/url-safe-base64.d.ts +12 -0
  148. package/dist/url-safe-base64.d.ts.map +1 -0
  149. package/dist/url-safe-base64.js +40 -0
  150. package/dist/url-validation.d.ts +14 -0
  151. package/dist/url-validation.d.ts.map +1 -0
  152. package/dist/url-validation.js +81 -0
  153. package/dist/utils/atomic-write.d.ts +6 -0
  154. package/dist/utils/atomic-write.d.ts.map +1 -0
  155. package/dist/utils/atomic-write.js +20 -0
  156. package/dist/utils.d.ts +46 -0
  157. package/dist/utils.d.ts.map +1 -0
  158. package/dist/utils.js +70 -0
  159. package/dist/vite-plugin.d.ts +12 -0
  160. package/dist/vite-plugin.d.ts.map +1 -0
  161. package/dist/vite-plugin.js +29 -0
  162. package/dist/vxjson-qHrgLGip.mjs +555 -0
  163. package/dist/vxjson-qHrgLGip.mjs.map +1 -0
  164. package/dist/vxjson-serialize-geF6qvpn.mjs +34 -0
  165. package/dist/vxjson-serialize-geF6qvpn.mjs.map +1 -0
  166. package/dist/vxjson-serialize.d.mts +17 -0
  167. package/dist/vxjson-serialize.d.mts.map +1 -0
  168. package/dist/vxjson-serialize.d.ts +14 -0
  169. package/dist/vxjson-serialize.d.ts.map +1 -0
  170. package/dist/vxjson-serialize.js +50 -0
  171. package/dist/vxjson-serialize.mjs +2 -0
  172. package/dist/vxjson.d.ts +112 -0
  173. package/dist/vxjson.d.ts.map +1 -0
  174. package/dist/vxjson.js +391 -0
  175. package/dist/xxhash.d.ts +10 -0
  176. package/dist/xxhash.d.ts.map +1 -0
  177. package/dist/xxhash.js +31 -0
  178. package/package.json +79 -17
  179. package/dist/component-registry.types-CBGONnYn.d.mts.map +0 -1
  180. package/dist/content-operations-Dv67amz3.d.mts +0 -852
  181. package/dist/content-operations-Dv67amz3.d.mts.map +0 -1
  182. package/dist/filesystem-content-api-C1TM0GLo.d.mts.map +0 -1
  183. package/dist/filesystem-content-api-kxKY5IUw.mjs.map +0 -1
  184. package/dist/schemas/index.d.mts.map +0 -1
  185. package/dist/schemas/index.mjs.map +0 -1
  186. package/dist/site-vNtJ5jCh.mjs.map +0 -1
  187. package/dist/types-DWt912tu.mjs.map +0 -1
package/dist/node.d.mts CHANGED
@@ -1,10 +1,9 @@
1
- import { a as AssetManifestData, c as FolderTreeNode, i as AssetEntry, l as ManifestEntryData, n as ComponentEntryWithId, o as AssetUsage, s as FolderListing, t as ComponentEntry } from "./component-registry.types-CBGONnYn.mjs";
2
- import { $ as ErrorCode, A as Site, B as ContentListResult, C as mapSiteNames, D as serializeMdxWithFrontmatter, E as resolvePublishDate, F as BlockFilters, G as CreateBlockInput, H as ContentMeta, I as ContentAPIOptions, J as CreateResult, K as CreateContentInput, L as ContentData, M as APIError, N as BatchOperationResult, O as Blocks, P as BatchResult, Q as DeleteResult, R as ContentEntry, S as mapLocales, T as parseDate, U as ContentProp, V as ContentManifest, W as ContentType, X as DataContext, Y as DataCollectionEntry, Z as DeleteLocaleInput, _ as isContentPublished, _t as VXJSONFile, a as analyzeUpdateScope, at as LocaleUpdateData, b as isValidPathname, c as shouldUpdateModifiedTimestamp, ct as LocalizedManifest, d as validateCreateContent, dt as MoveResult, et as ErrorCodes, f as extractBlockName, ft as PageReference, g as getMetadataSize, gt as UpdateResult, h as getCurrentISODate, ht as UpdateLocaleInput, i as ValidationResult, it as LocalePathData, j as Data, k as ContentAPI, l as updatePublishDates, lt as MDXCompileResponse, m as generateContentId, mt as SitesConfig, n as UPDATE_SCOPE, nt as GlobalFilters, o as buildLocaleVersion, ot as LocaleVersion, p as formatFileSize, pt as SiteFilters, q as CreatePageInput, r as UpdateScope, rt as LocaleFileData, s as buildPathnameHistory, st as LocalizedEntry, t as CreateValidationResult, tt as FindOptions, u as validateAndPrepareMetadata, ut as MDXFrontmatter, v as isMetadataTooLarge, vt as WriteResult, w as normalizePathname, x as localesOf, y as isValidBlockName, z as ContentIdentity } from "./content-operations-Dv67amz3.mjs";
3
- import { t as FileSystemContentAPI } from "./filesystem-content-api-C1TM0GLo.mjs";
1
+ import { a as AssetManifestData, c as FolderTreeNode, i as AssetEntry, l as ManifestEntryData, n as ComponentEntryWithId, o as AssetUsage, s as FolderListing, t as ComponentEntry } from "./component-registry.types-C0ctF9nh.mjs";
2
+ import { A as LocalizedEntry, B as VXJSONFile, C as ErrorCodes, D as LocalePathData, E as LocaleFileData, F as PageReference, I as SiteFilters, L as SitesConfig, M as MDXCompileResponse, N as MDXFrontmatter, O as LocaleUpdateData, P as MoveResult, R as UpdateLocaleInput, S as ErrorCode, T as GlobalFilters, V as WriteResult, _ as CreateResult, a as ContentAPIOptions, b as DeleteLocaleInput, c as ContentIdentity, d as ContentMeta, f as ContentProp, g as CreatePageInput, h as CreateContentInput, i as BlockFilters, j as LocalizedManifest, k as LocaleVersion, l as ContentListResult, m as CreateBlockInput, n as BatchOperationResult, o as ContentData, p as ContentType, r as BatchResult, s as ContentEntry, t as APIError, u as ContentManifest, v as DataCollectionEntry, w as FindOptions, x as DeleteResult, y as DataContext, z as UpdateResult } from "./types-DjfhS272.mjs";
3
+ import { A as serializeMdxWithFrontmatter, C as localesOf, D as normalizePathname, E as normalizeAndValidatePathname, M as ContentAPI, N as Site, O as parseDate, P as Data, S as isValidPathname, T as mapSiteNames, _ as getCurrentISODate, a as analyzeUpdateScope, b as isMetadataTooLarge, c as shouldUpdateModifiedTimestamp, d as validateCreateContent, f as PathnameValidationReason, g as generateContentId, h as formatFileSize, i as ValidationResult, j as Blocks, k as resolvePublishDate, l as updatePublishDates, m as extractBlockName, n as UPDATE_SCOPE, o as buildLocaleVersion, p as PathnameValidationResult, r as UpdateScope, s as buildPathnameHistory, t as CreateValidationResult, u as validateAndPrepareMetadata, v as getMetadataSize, w as mapLocales, x as isValidBlockName, y as isContentPublished } from "./content-operations-DIbsxG5A.mjs";
4
+ import { n as readSitesConfig, t as FileSystemContentAPI } from "./filesystem-content-api-DCdNi-co.mjs";
4
5
  import { Hono } from "hono";
5
- import * as hono_types0 from "hono/types";
6
6
  import { Plugin } from "vite";
7
-
8
7
  //#region src/asset-manifest.d.ts
9
8
  declare class AssetManifest {
10
9
  private manifestPath;
@@ -269,10 +268,7 @@ declare class ComponentRegistry {
269
268
  }
270
269
  //#endregion
271
270
  //#region src/content-watcher.d.ts
272
- interface ContentWatcherOptions {
273
- contentRoot: string;
274
- canvasDir?: string;
275
- }
271
+ type ContentWatcherOptions = ContentAPIOptions;
276
272
  interface WebSocketSender {
277
273
  send(payload: {
278
274
  type: string;
@@ -283,6 +279,8 @@ interface WebSocketSender {
283
279
  interface ContentWatchEvent {
284
280
  file: string;
285
281
  action: 'update' | 'create' | 'delete';
282
+ inMdxRoot: boolean;
283
+ inContentRoot: boolean;
286
284
  }
287
285
  interface ReindexResultLike {
288
286
  updated: unknown[];
@@ -341,9 +339,6 @@ declare class InMemoryContentAPI implements ContentAPI {
341
339
  } | null>;
342
340
  }
343
341
  //#endregion
344
- //#region src/mdx/compile.d.ts
345
- declare function compileMDX(content: string): Promise<MDXCompileResponse>;
346
- //#endregion
347
342
  //#region src/middleware.d.ts
348
343
  /**
349
344
  * Create REST API router using Hono
@@ -355,12 +350,12 @@ interface ContentAPIRouterOptions {
355
350
  /** Content root directory for asset usage tracking */
356
351
  contentRoot?: string;
357
352
  }
358
- declare function createContentAPIRouter(api: ContentAPI, options?: ContentAPIRouterOptions): Hono<hono_types0.BlankEnv, hono_types0.BlankSchema, "/">;
353
+ declare function createContentAPIRouter(api: ContentAPI, options?: ContentAPIRouterOptions): Hono<import("hono/types").BlankEnv, import("hono/types").BlankSchema, "/">;
359
354
  /**
360
355
  * Create middleware for backwards compatibility with existing code
361
356
  * This wraps the Hono app to work with Node.js IncomingMessage/ServerResponse
362
357
  */
363
- declare function createContentMiddleware(contentApi: ContentAPI): (req: any, res: any, next: () => void) => Promise<void>;
358
+ declare function createContentMiddleware(contentApi: ContentAPI, options?: ContentAPIRouterOptions): (req: any, res: any, next: () => void) => Promise<void>;
364
359
  //#endregion
365
360
  //#region src/vite-plugin.d.ts
366
361
  interface ConlocaContentOptions {
@@ -374,5 +369,5 @@ interface ConlocaContentOptions {
374
369
  */
375
370
  declare function conlocaContent(options: ConlocaContentOptions): Plugin;
376
371
  //#endregion
377
- export { APIError, type AssetConfig, type AssetEntry, AssetManifest, type AssetManifestData, AssetOperations, BatchOperationResult, BatchResult, BlockFilters, Blocks, type CFAccessResult, type CFAccessUser, ComponentEntry, ComponentEntryWithId, ComponentRegistry, type ConlocaContentOptions, type ContentAPI, ContentAPIOptions, ContentData, ContentEntry, ContentIdentity, ContentListResult, ContentManifest, ContentMeta, ContentProp, ContentType, type ContentWatcherOptions, CreateBlockInput, CreateContentInput, CreatePageInput, CreateResult, CreateValidationResult, DataCollectionEntry, DataContext, DeleteLocaleInput, DeleteResult, ErrorCode, ErrorCodes, FileSystemContentAPI, FindOptions, GlobalFilters, InMemoryContentAPI, LocaleFileData, LocalePathData, LocaleUpdateData, LocaleVersion, LocalizedEntry, LocalizedManifest, MDXCompileResponse, MDXFrontmatter, MoveResult, PageReference, Site, SiteFilters, SitesConfig, UPDATE_SCOPE, UpdateLocaleInput, UpdateResult, UpdateScope, VXJSONFile, ValidationResult, type WebSocketSender, WriteResult, analyzeUpdateScope, buildLocaleVersion, buildPathnameHistory, compileMDX, conlocaContent, createContentAPI, createContentAPIRouter, createContentMiddleware, createContentWatchHandlers, extractBlockName, extractCFAccessToken, formatFileSize, generateContentId, getCurrentISODate, getMetadataSize, isContentPublished, isMetadataTooLarge, isValidBlockName, isValidPathname, localesOf, mapLocales, mapSiteNames, normalizePathname, parseDate, resolvePublishDate, serializeMdxWithFrontmatter, shouldUpdateModifiedTimestamp, updatePublishDates, validateAndPrepareMetadata, validateCFAccessRequest, validateCreateContent };
372
+ export { APIError, type AssetConfig, type AssetEntry, AssetManifest, type AssetManifestData, AssetOperations, BatchOperationResult, BatchResult, BlockFilters, Blocks, type CFAccessResult, type CFAccessUser, ComponentEntry, ComponentEntryWithId, ComponentRegistry, type ConlocaContentOptions, type ContentAPI, ContentAPIOptions, ContentData, ContentEntry, ContentIdentity, ContentListResult, ContentManifest, ContentMeta, ContentProp, ContentType, type ContentWatcherOptions, CreateBlockInput, CreateContentInput, CreatePageInput, CreateResult, CreateValidationResult, DataCollectionEntry, DataContext, DeleteLocaleInput, DeleteResult, ErrorCode, ErrorCodes, FileSystemContentAPI, FindOptions, GlobalFilters, InMemoryContentAPI, LocaleFileData, LocalePathData, LocaleUpdateData, LocaleVersion, LocalizedEntry, LocalizedManifest, MDXCompileResponse, MDXFrontmatter, MoveResult, PageReference, PathnameValidationReason, PathnameValidationResult, Site, SiteFilters, SitesConfig, UPDATE_SCOPE, UpdateLocaleInput, UpdateResult, UpdateScope, VXJSONFile, ValidationResult, type WebSocketSender, WriteResult, analyzeUpdateScope, buildLocaleVersion, buildPathnameHistory, conlocaContent, createContentAPI, createContentAPIRouter, createContentMiddleware, createContentWatchHandlers, extractBlockName, extractCFAccessToken, formatFileSize, generateContentId, getCurrentISODate, getMetadataSize, isContentPublished, isMetadataTooLarge, isValidBlockName, isValidPathname, localesOf, mapLocales, mapSiteNames, normalizeAndValidatePathname, normalizePathname, parseDate, readSitesConfig, resolvePublishDate, serializeMdxWithFrontmatter, shouldUpdateModifiedTimestamp, updatePublishDates, validateAndPrepareMetadata, validateCFAccessRequest, validateCreateContent };
378
373
  //# sourceMappingURL=node.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"node.d.mts","names":[],"sources":["../src/asset-manifest.ts","../src/asset-operations.ts","../src/cf-access.ts","../src/component-registry.ts","../src/content-watcher.ts","../src/in-memory-content-api.ts","../src/mdx/compile.ts","../src/middleware.ts","../src/vite-plugin.ts"],"mappings":";;;;;;;;cAkBa,aAAA;EAAA,QACH,YAAA;EAAA,QACA,KAAA;cAEI,UAAA;EAIN,IAAA,CAAA,GAAQ,OAAA,CAAQ,iBAAA;EAShB,KAAA,CAAM,IAAA,EAAM,iBAAA,GAAoB,OAAA;EAjB3B;EAsBL,YAAA,CAAa,EAAA,GAAK,IAAA,EAAM,iBAAA,KAAsB,iBAAA,GAAoB,OAAA;EAgBlE,GAAA,CAAI,YAAA,UAAsB,IAAA,EAAM,iBAAA,GAAoB,OAAA;EAOpD,MAAA,CAAO,YAAA,WAAuB,OAAA;EAU9B,GAAA,CAAI,YAAA,WAAuB,OAAA,CAAQ,iBAAA;EAtCvB;;;;EA+CZ,aAAA,CAAc,QAAA,WAAmB,OAAA;IAAU,YAAA;IAAsB,IAAA,EAAM,iBAAA;EAAA;AAAA;;;UClE9D,WAAA;EACf,UAAA;EACA,WAAA;EACA,eAAA;;EAEA,WAAA;AAAA;AAAA,cAkCW,eAAA;EAAA,QACH,MAAA;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A,CAAQ,QAAA,WAAmB,IAAA;EAU1B,cAAA,CAAe,OAAA,GAAU,aAAA,GAAgB,SAAA,CAAU,eAAA;EAInD,uBAAA,CAAwB,YAAA,UAAsB,OAAA,GAAU,WAAA,GAAc,SAAA,CAAU,eAAA;EAK3E,eAAA,CAAgB,KAAA,EAAO,iBAAA,GAAoB,OAAA,CAAQ,YAAA;EAoDnD,WAAA,CAAY,UAAA,EAAY,iBAAA,KAAsB,OAAA,CAAQ,WAAA;EAmC5D,UAAA,CAAW,EAAA,UAAY,OAAA,EAAS,YAAA;EA+ChC,KAAA,CAAA;EAIM,kBAAA,CACJ,EAAA,UACA,MAAA,WACC,OAAA;IACD,MAAA,EAAQ,UAAA;IACR,IAAA;IACA,WAAA;EAAA;AAAA;;;iBClqBkB,UAAA,CAAW,OAAA,WAAkB,OAAA,CAAQ,kBAAA;;;;;;;UCgC1C,uBAAA;EACf,UAAA;EACA,WAAA,GAAc,IAAA,CAAK,WAAA;;EAEnB,WAAA;AAAA;AAAA,iBAGc,sBAAA,CAAuB,GAAA,EAAK,UAAA,EAAY,OAAA,GAAU,uBAAA,GAAuB,IAAA,CAAA,WAAA,CAAA,QAAA,EAAA,WAAA,CAAA,WAAA;;;;;iBAkpCzE,uBAAA,CAAwB,UAAA,EAAY,UAAA,IAIpC,GAAA,OAAU,GAAA,OAAU,IAAA,iBAAgB,OAAA;;;UC9rCnC,qBAAA;EACf,WAAA;EACA,SAAA;EACA,QAAA;AAAA;;;ARSF;;iBQFgB,cAAA,CAAe,OAAA,EAAS,qBAAA,GAAwB,MAAA"}
1
+ {"version":3,"file":"node.d.mts","names":[],"sources":["../src/asset-manifest.ts","../src/asset-operations.ts","../src/cf-access.ts","../src/component-registry.ts","../src/content-watcher.ts","../src/in-memory-content-api.ts","../src/middleware.ts","../src/vite-plugin.ts"],"mappings":";;;;;;;cAkBa;UACH;UACA;EAEI,YAAA;EAIN,QAAQ,QAAQ;EAShB,MAAM,MAAM,oBAAoB;;EAKhC,aA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;;;UCltCnC;EACf;EACA;EACA;;;;;;iBAOc,eAAe,SAAS,wBAAwB"}
package/dist/node.d.ts ADDED
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Node.js-specific exports for @conloca/content-api
3
+ *
4
+ * These exports require Node.js runtime APIs and should not be imported in browser environments.
5
+ * Use the main package exports for browser-compatible APIs.
6
+ */
7
+ export { type AssetEntry, AssetManifest, type AssetManifestData } from './asset-manifest';
8
+ export { type AssetConfig, AssetOperations } from './asset-operations';
9
+ export { Blocks } from './blocks';
10
+ export { type CFAccessResult, type CFAccessUser, extractCFAccessToken, validateCFAccessRequest, } from './cf-access.js';
11
+ export { ComponentRegistry } from './component-registry';
12
+ export * from './component-registry.types';
13
+ export type { ContentAPI } from './content-api.interface';
14
+ export * from './content-operations';
15
+ export * from './content-utils';
16
+ export type { ContentWatcherOptions, WebSocketSender } from './content-watcher';
17
+ export { createContentAPI, createContentWatchHandlers } from './content-watcher';
18
+ export { FileSystemContentAPI, readSitesConfig } from './filesystem-content-api';
19
+ export { InMemoryContentAPI } from './in-memory-content-api';
20
+ export { createContentAPIRouter, createContentMiddleware } from './middleware';
21
+ export { Site } from './site';
22
+ export * from './types';
23
+ export type { ConlocaContentOptions } from './vite-plugin';
24
+ export { conlocaContent } from './vite-plugin';
25
+ //# sourceMappingURL=node.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,KAAK,UAAU,EAAE,aAAa,EAAE,KAAK,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC1F,OAAO,EAAE,KAAK,WAAW,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,oBAAoB,EACpB,uBAAuB,GACxB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,cAAc,4BAA4B,CAAC;AAC3C,YAAY,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC1D,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,YAAY,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAChF,OAAO,EAAE,gBAAgB,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AAEjF,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AACjF,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAC/E,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,cAAc,SAAS,CAAC;AACxB,YAAY,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC"}
package/dist/node.js ADDED
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Node.js-specific exports for @conloca/content-api
3
+ *
4
+ * These exports require Node.js runtime APIs and should not be imported in browser environments.
5
+ * Use the main package exports for browser-compatible APIs.
6
+ */
7
+ export { AssetManifest } from './asset-manifest';
8
+ export { AssetOperations } from './asset-operations';
9
+ export { Blocks } from './blocks';
10
+ // CF Access authentication
11
+ export { extractCFAccessToken, validateCFAccessRequest, } from './cf-access.js';
12
+ export { ComponentRegistry } from './component-registry';
13
+ export * from './component-registry.types';
14
+ export * from './content-operations';
15
+ export * from './content-utils';
16
+ export { createContentAPI, createContentWatchHandlers } from './content-watcher';
17
+ // Node.js specific implementations (require fs, xxhash, etc.)
18
+ export { FileSystemContentAPI, readSitesConfig } from './filesystem-content-api';
19
+ export { InMemoryContentAPI } from './in-memory-content-api';
20
+ export { createContentAPIRouter, createContentMiddleware } from './middleware';
21
+ export { Site } from './site';
22
+ // Re-export types and utilities that are safe for Node.js environments
23
+ export * from './types';
24
+ export { conlocaContent } from './vite-plugin';
package/dist/node.mjs CHANGED
@@ -1,22 +1,19 @@
1
- import { a as findMdxContentStartPosition, c as atomicWriteFile, i as calculateEtagsFromMdxBuffer, o as ContentIndex, r as VXJSON, s as filterContentWithIndexes, t as FileSystemContentAPI } from "./filesystem-content-api-kxKY5IUw.mjs";
2
- import { C as parseDate, E as Blocks, S as normalizePathname, T as serializeMdxWithFrontmatter, _ as isValidBlockName, a as buildPathnameHistory, b as mapLocales, c as validateAndPrepareMetadata, d as formatFileSize, f as generateContentId, g as isMetadataTooLarge, h as isContentPublished, i as buildLocaleVersion, l as validateCreateContent, m as getMetadataSize, n as UPDATE_SCOPE, o as shouldUpdateModifiedTimestamp, p as getCurrentISODate, r as analyzeUpdateScope, s as updatePublishDates, t as Site, u as extractBlockName, v as isValidPathname, w as resolvePublishDate, x as mapSiteNames, y as localesOf } from "./site-vNtJ5jCh.mjs";
3
- import { t as ErrorCodes } from "./types-DWt912tu.mjs";
4
- import { t as Data } from "./data-Db1Iv9T0.mjs";
1
+ import { a as buildPathnameHistory, c as validateAndPrepareMetadata, i as buildLocaleVersion, l as validateCreateContent, n as UPDATE_SCOPE, o as shouldUpdateModifiedTimestamp, r as analyzeUpdateScope, s as updatePublishDates, t as Site, u as Blocks } from "./site-8oaj1Q60.mjs";
2
+ import { _ as serializeMdxWithFrontmatter, a as getMetadataSize, c as isValidBlockName, d as mapLocales, f as mapSiteNames, g as resolvePublishDate, h as parseDate, i as getCurrentISODate, l as isValidPathname, m as normalizePathname, n as formatFileSize, o as isContentPublished, p as normalizeAndValidatePathname, r as generateContentId, s as isMetadataTooLarge, t as extractBlockName, u as localesOf } from "./content-utils-fWNHTrPy.mjs";
3
+ import { t as ContentIndex } from "./content-index-D092_vk1.mjs";
4
+ import { t as ErrorCodes } from "./types-DOdldbfD.mjs";
5
+ import { n as calculateEtagsFromMdxBuffer, r as findMdxContentStartPosition, t as VXJSON } from "./vxjson-qHrgLGip.mjs";
6
+ import { i as atomicWriteFile, n as readSitesConfig, r as filterContentWithIndexes, t as FileSystemContentAPI } from "./filesystem-content-api-C0HIhqZi.mjs";
7
+ import { t as Data } from "./data-DquNIEnQ.mjs";
5
8
  import sortKeys from "sort-keys";
6
9
  import { access, mkdir, readFile, readdir, rename, stat, unlink, writeFile } from "node:fs/promises";
7
10
  import { dirname, extname, join, normalize, parse, resolve } from "node:path";
8
11
  import { imageSize } from "image-size";
9
12
  import { spawn } from "node:child_process";
10
13
  import { createRemoteJWKSet, jwtVerify } from "jose";
11
- import matter from "gray-matter";
12
- import { compile } from "@mdx-js/mdx";
13
- import remarkFrontmatter from "remark-frontmatter";
14
- import remarkGfm from "remark-gfm";
15
- import remarkMdxFrontmatter from "remark-mdx-frontmatter";
16
14
  import { Hono } from "hono";
17
15
  import { cors } from "hono/cors";
18
16
  import { getRequestListener } from "@hono/node-server";
19
-
20
17
  //#region src/asset-manifest.ts
21
18
  const MANIFEST_FILENAME = ".asset-manifest.json";
22
19
  var AssetManifest = class {
@@ -81,7 +78,6 @@ var AssetManifest = class {
81
78
  };
82
79
  }
83
80
  };
84
-
85
81
  //#endregion
86
82
  //#region src/git-operations.ts
87
83
  function runGitCommand(cwd, args) {
@@ -371,14 +367,13 @@ async function setupGitLfsAttributes(contentRoot) {
371
367
  if (missingPatterns.length === 0) return;
372
368
  await writeFile(gitattributesPath, existing ? `${existing.trimEnd()}\n${missingPatterns.join("\n")}\n` : `${missingPatterns.join("\n")}\n`, "utf-8");
373
369
  }
374
-
375
370
  //#endregion
376
371
  //#region src/url-validation.ts
377
372
  /**
378
373
  * URL validation for SSRF prevention in server-side fetch operations.
379
374
  * Blocks private/reserved IP addresses and non-http(s) schemes.
380
375
  */
381
- const BLOCKED_HOSTNAMES = new Set(["localhost"]);
376
+ const BLOCKED_HOSTNAMES = /* @__PURE__ */ new Set(["localhost"]);
382
377
  /** Check if an IPv4 address string points to a private/reserved range */
383
378
  function isPrivateIPv4(hostname) {
384
379
  const parts = hostname.split(".");
@@ -420,7 +415,6 @@ function validateFetchUrl(url) {
420
415
  if (isPrivateIPv6(hostname)) throw new Error("URL points to a private/reserved IP address");
421
416
  return parsed;
422
417
  }
423
-
424
418
  //#endregion
425
419
  //#region src/asset-operations.ts
426
420
  const DEFAULT_MAX_FILE_SIZE = 10 * 1024 * 1024;
@@ -445,7 +439,7 @@ const MIME_MAP = {
445
439
  ico: "image/x-icon"
446
440
  };
447
441
  /** Recognized web image extensions for filesystem scanning */
448
- const RECOGNIZED_IMAGE_EXTENSIONS = new Set([
442
+ const RECOGNIZED_IMAGE_EXTENSIONS = /* @__PURE__ */ new Set([
449
443
  "jpg",
450
444
  "jpeg",
451
445
  "png",
@@ -456,7 +450,7 @@ const RECOGNIZED_IMAGE_EXTENSIONS = new Set([
456
450
  "ico"
457
451
  ]);
458
452
  /** System files to skip during filesystem scanning */
459
- const SYSTEM_FILES = new Set([
453
+ const SYSTEM_FILES = /* @__PURE__ */ new Set([
460
454
  ".ds_store",
461
455
  "thumbs.db",
462
456
  ".gitkeep",
@@ -664,8 +658,10 @@ var AssetOperations = class {
664
658
  for (const entry of entries) {
665
659
  if (isSystemFile(entry.name) || entry.isSymbolicLink()) continue;
666
660
  const entryPath = join(folderPath, entry.name);
667
- if (entry.isDirectory()) await scanFolder(entryPath, folder === "/" ? `/${entry.name}` : `${folder}/${entry.name}`);
668
- else if (entry.isFile() && isRecognizedImageExtension(entry.name)) {
661
+ if (entry.isDirectory()) {
662
+ const subFolder = folder === "/" ? `/${entry.name}` : `${folder}/${entry.name}`;
663
+ await scanFolder(entryPath, subFolder);
664
+ } else if (entry.isFile() && isRecognizedImageExtension(entry.name)) {
669
665
  const assetEntry = await this.buildAssetEntry(entry, folder, manifestData);
670
666
  assets.push(assetEntry);
671
667
  }
@@ -678,9 +674,9 @@ var AssetOperations = class {
678
674
  * Get asset by filename and optional folder
679
675
  */
680
676
  async getAsset(filename, folder = "/") {
681
- if (folder === "/") folder = await this.resolveFolder(filename);
682
- const relativePath = folder === "/" ? filename : `${folder.slice(1)}/${filename}`;
683
- const fullPath = this.getAssetPath(filename, folder);
677
+ const resolvedFolder = folder === "/" ? await this.resolveFolder(filename) : folder;
678
+ const relativePath = resolvedFolder === "/" ? filename : `${resolvedFolder.slice(1)}/${filename}`;
679
+ const fullPath = this.getAssetPath(filename, resolvedFolder);
684
680
  let stats;
685
681
  try {
686
682
  stats = await stat(fullPath);
@@ -707,7 +703,7 @@ var AssetOperations = class {
707
703
  alt: manifestEntry?.alt,
708
704
  uploadedAt: manifestEntry?.uploadedAt || stats.birthtime.toISOString(),
709
705
  uploadedBy: manifestEntry?.uploadedBy,
710
- folder,
706
+ folder: resolvedFolder,
711
707
  tags: manifestEntry?.tags
712
708
  };
713
709
  }
@@ -715,9 +711,9 @@ var AssetOperations = class {
715
711
  * Delete asset file and manifest entry
716
712
  */
717
713
  async delete(filename, folder = "/") {
718
- if (folder === "/") folder = await this.resolveFolder(filename);
719
- const relativePath = folder === "/" ? filename : `${folder.slice(1)}/${filename}`;
720
- const filePath = this.getAssetPath(filename, folder);
714
+ const resolvedFolder = folder === "/" ? await this.resolveFolder(filename) : folder;
715
+ const relativePath = resolvedFolder === "/" ? filename : `${resolvedFolder.slice(1)}/${filename}`;
716
+ const filePath = this.getAssetPath(filename, resolvedFolder);
721
717
  try {
722
718
  await unlink(filePath);
723
719
  } catch {}
@@ -833,9 +829,9 @@ var AssetOperations = class {
833
829
  * @param folder Optional folder path (default '/')
834
830
  */
835
831
  async updateMetadata(filename, updates, folder = "/") {
836
- if (folder === "/") folder = await this.resolveFolder(filename);
837
- const relativePath = folder === "/" ? filename : `${folder.slice(1)}/${filename}`;
838
- const fullPath = this.getAssetPath(filename, folder);
832
+ const resolvedFolder = folder === "/" ? await this.resolveFolder(filename) : folder;
833
+ const relativePath = resolvedFolder === "/" ? filename : `${resolvedFolder.slice(1)}/${filename}`;
834
+ const fullPath = this.getAssetPath(filename, resolvedFolder);
839
835
  try {
840
836
  await stat(fullPath);
841
837
  } catch {
@@ -849,7 +845,7 @@ var AssetOperations = class {
849
845
  ...updates
850
846
  };
851
847
  await this.manifest.add(relativePath, merged);
852
- const asset = await this.getAsset(filename, folder);
848
+ const asset = await this.getAsset(filename, resolvedFolder);
853
849
  if (!asset) return {
854
850
  success: false,
855
851
  error: "Failed to retrieve updated asset"
@@ -1078,7 +1074,6 @@ var AssetOperations = class {
1078
1074
  }];
1079
1075
  }
1080
1076
  };
1081
-
1082
1077
  //#endregion
1083
1078
  //#region src/cf-access.ts
1084
1079
  /**
@@ -1140,7 +1135,6 @@ async function validateCFAccessRequest(request) {
1140
1135
  };
1141
1136
  }
1142
1137
  }
1143
-
1144
1138
  //#endregion
1145
1139
  //#region src/component-registry.ts
1146
1140
  /**
@@ -1243,7 +1237,6 @@ var ComponentRegistry = class {
1243
1237
  await this.save();
1244
1238
  }
1245
1239
  };
1246
-
1247
1240
  //#endregion
1248
1241
  //#region src/content-watcher.ts
1249
1242
  /**
@@ -1251,7 +1244,7 @@ var ComponentRegistry = class {
1251
1244
  */
1252
1245
  async function createContentAPI(options) {
1253
1246
  return await FileSystemContentAPI.create({
1254
- contentRoot: options.contentRoot,
1247
+ ...options,
1255
1248
  canvasDir: options.canvasDir || "./canvas"
1256
1249
  });
1257
1250
  }
@@ -1265,8 +1258,12 @@ function createContentWatchHandlers(contentApi, options, ws, onReindexed) {
1265
1258
  if (!isContentFile && !isDataFile) return;
1266
1259
  const normalizedFile = normalize(resolve(file));
1267
1260
  const normalizedRoot = normalize(resolve(options.contentRoot));
1268
- if (normalizedFile.startsWith(normalizedRoot)) {
1269
- const relativePath = normalizedFile.replace(normalizedRoot + "/", "");
1261
+ const normalizedMdxRoot = options.mdxPagesRoot ? normalize(resolve(options.mdxPagesRoot)) : null;
1262
+ const inContentRoot = normalizedFile === normalizedRoot || normalizedFile.startsWith(normalizedRoot + "/");
1263
+ const inMdxRoot = !!normalizedMdxRoot && (normalizedFile === normalizedMdxRoot || normalizedFile.startsWith(normalizedMdxRoot + "/"));
1264
+ if (inContentRoot || inMdxRoot) {
1265
+ const matchedRoot = inContentRoot ? normalizedRoot : normalizedMdxRoot;
1266
+ const relativePath = normalizedFile.replace(matchedRoot + "/", "");
1270
1267
  console.log(`[Content] ${action}: ${relativePath}`);
1271
1268
  try {
1272
1269
  const reindexOptions = action === "delete" ? { handleDeletions: true } : void 0;
@@ -1297,7 +1294,9 @@ function createContentWatchHandlers(contentApi, options, ws, onReindexed) {
1297
1294
  try {
1298
1295
  await onReindexed?.({
1299
1296
  file: normalizedFile,
1300
- action
1297
+ action,
1298
+ inMdxRoot,
1299
+ inContentRoot
1301
1300
  });
1302
1301
  } catch (error) {
1303
1302
  console.error("[Content Watcher] onReindexed callback failed:", error);
@@ -1310,7 +1309,6 @@ function createContentWatchHandlers(contentApi, options, ws, onReindexed) {
1310
1309
  onUnlink: (file) => handleFileChange(file, "delete")
1311
1310
  };
1312
1311
  }
1313
-
1314
1312
  //#endregion
1315
1313
  //#region src/in-memory-content-api.ts
1316
1314
  /**
@@ -1351,27 +1349,10 @@ var InMemoryContentAPI = class {
1351
1349
  for (const localeVersion of localesOf(manifest)) {
1352
1350
  const { locale } = localeVersion;
1353
1351
  const cachedContent = this.contentIndex.getCachedContent(id, locale);
1354
- if (cachedContent) {
1355
- let contentToReturn = cachedContent;
1356
- if (manifest.type === "mdx" && cachedContent.mdx) {
1357
- const frontmatterData = {
1358
- id: manifest.id,
1359
- created: localeVersion.created,
1360
- modified: localeVersion.modified,
1361
- ...localeVersion.publishAt && { publishAt: localeVersion.publishAt },
1362
- ...localeVersion.unpublishAt && { unpublishAt: localeVersion.unpublishAt },
1363
- ...localeVersion.meta
1364
- };
1365
- contentToReturn = {
1366
- ...cachedContent,
1367
- mdx: serializeMdxWithFrontmatter(frontmatterData, cachedContent.mdx)
1368
- };
1369
- }
1370
- contentEntry.locales[locale] = {
1371
- ...localeVersion,
1372
- content: contentToReturn
1373
- };
1374
- }
1352
+ if (cachedContent) contentEntry.locales[locale] = {
1353
+ ...localeVersion,
1354
+ content: cachedContent
1355
+ };
1375
1356
  }
1376
1357
  return contentEntry;
1377
1358
  }
@@ -1381,21 +1362,7 @@ var InMemoryContentAPI = class {
1381
1362
  const localeVersion = manifest.locales[locale];
1382
1363
  const cachedContent = this.contentIndex.getCachedContent(id, locale);
1383
1364
  if (!cachedContent) return null;
1384
- let contentToReturn = { ...cachedContent };
1385
- if (manifest.type === "mdx" && cachedContent.mdx) {
1386
- const frontmatterData = {
1387
- id: manifest.id,
1388
- created: localeVersion.created,
1389
- modified: localeVersion.modified,
1390
- ...localeVersion.publishAt && { publishAt: localeVersion.publishAt },
1391
- ...localeVersion.unpublishAt && { unpublishAt: localeVersion.unpublishAt },
1392
- ...localeVersion.meta
1393
- };
1394
- contentToReturn = {
1395
- ...cachedContent,
1396
- mdx: serializeMdxWithFrontmatter(frontmatterData, cachedContent.mdx)
1397
- };
1398
- }
1365
+ const contentToReturn = { ...cachedContent };
1399
1366
  return {
1400
1367
  id,
1401
1368
  site: manifest.site,
@@ -1778,35 +1745,6 @@ var InMemoryContentAPI = class {
1778
1745
  };
1779
1746
  }
1780
1747
  };
1781
-
1782
- //#endregion
1783
- //#region src/mdx/compile.ts
1784
- async function compileMDX(content) {
1785
- try {
1786
- const { data: metadata } = matter(content);
1787
- const compiled = await compile(content, {
1788
- outputFormat: "function-body",
1789
- development: process.env.NODE_ENV === "development",
1790
- remarkPlugins: [
1791
- remarkFrontmatter,
1792
- remarkMdxFrontmatter,
1793
- remarkGfm
1794
- ]
1795
- });
1796
- return {
1797
- code: String(compiled.value),
1798
- metadata
1799
- };
1800
- } catch (error) {
1801
- if (error instanceof Error) {
1802
- const enhancedError = /* @__PURE__ */ new Error(`MDX compilation failed: ${error.message}`);
1803
- enhancedError.stack = error.stack;
1804
- throw enhancedError;
1805
- }
1806
- throw error;
1807
- }
1808
- }
1809
-
1810
1748
  //#endregion
1811
1749
  //#region src/middleware.ts
1812
1750
  /**
@@ -1847,10 +1785,14 @@ function createContentAPIRouter(api, options) {
1847
1785
  app.get("/content/collections", async (c) => {
1848
1786
  try {
1849
1787
  const allCollections = /* @__PURE__ */ new Set();
1850
- api.blocks.collections.forEach((c) => allCollections.add(c));
1788
+ const blockCollections = api.blocks.collections;
1789
+ for (const collection of blockCollections) allCollections.add(collection);
1851
1790
  for (const siteName of Object.keys(api.sitesConfig.sites)) {
1852
1791
  const site = api.getSite(siteName);
1853
- if (site) site.collections.forEach((c) => allCollections.add(c));
1792
+ if (site) {
1793
+ const siteCollections = site.collections;
1794
+ for (const collection of siteCollections) allCollections.add(collection);
1795
+ }
1854
1796
  }
1855
1797
  return c.json({ collections: Array.from(allCollections).sort() });
1856
1798
  } catch (error) {
@@ -1912,10 +1854,35 @@ function createContentAPIRouter(api, options) {
1912
1854
  const data = await c.req.json();
1913
1855
  const result = await api.createContent(data);
1914
1856
  if (!result.success) {
1915
- if (result.reason === "already_exists") return c.json(result, 409);
1916
- if (result.reason === "pathname_taken") return c.json(result, 409);
1917
- if (result.reason === "metadata_too_large") return c.json(result, 400);
1918
- return c.json(result, 500);
1857
+ const errMessage = (result.error instanceof Error ? result.error.message : void 0) ?? "";
1858
+ if (result.reason === "already_exists") return c.json({
1859
+ ...result,
1860
+ ...errorResponse(ErrorCodes.ALREADY_EXISTS, errMessage || "Content already exists")
1861
+ }, 409);
1862
+ if (result.reason === "name_taken") return c.json({
1863
+ ...result,
1864
+ ...errorResponse(ErrorCodes.NAME_TAKEN, errMessage || "A block with that name already exists")
1865
+ }, 409);
1866
+ if (result.reason === "pathname_taken") return c.json({
1867
+ ...result,
1868
+ ...errorResponse(ErrorCodes.PATHNAME_TAKEN, errMessage || "Pathname already taken")
1869
+ }, 409);
1870
+ if (result.reason === "invalid_name") return c.json({
1871
+ ...result,
1872
+ ...errorResponse(ErrorCodes.INVALID_REQUEST, errMessage || "Invalid name")
1873
+ }, 400);
1874
+ if (result.reason === "invalid_pathname") return c.json({
1875
+ ...result,
1876
+ ...errorResponse(ErrorCodes.INVALID_PATHNAME, errMessage || "Invalid pathname")
1877
+ }, 400);
1878
+ if (result.reason === "metadata_too_large") return c.json({
1879
+ ...result,
1880
+ ...errorResponse(ErrorCodes.METADATA_TOO_LARGE, errMessage || "Metadata too large")
1881
+ }, 400);
1882
+ return c.json({
1883
+ ...result,
1884
+ ...errorResponse(ErrorCodes.WRITE_ERROR, errMessage || "Failed to create content")
1885
+ }, 500);
1919
1886
  }
1920
1887
  return c.json(result, 201);
1921
1888
  } catch (error) {
@@ -1923,7 +1890,7 @@ function createContentAPIRouter(api, options) {
1923
1890
  return c.json({
1924
1891
  success: false,
1925
1892
  reason: "write_error",
1926
- error: error instanceof Error ? error.message : "Unknown error"
1893
+ ...errorResponse(ErrorCodes.WRITE_ERROR, errorMessage(error, "Failed to create content"))
1927
1894
  }, 500);
1928
1895
  }
1929
1896
  });
@@ -2283,10 +2250,17 @@ function createContentAPIRouter(api, options) {
2283
2250
  if (!pathname) return c.json(errorResponse(ErrorCodes.MISSING_REQUIRED_FIELD, "pathname query parameter is required", { field: "pathname" }), 400);
2284
2251
  try {
2285
2252
  if (site === "blocks") return c.json(errorResponse(ErrorCodes.INVALID_REQUEST, "Blocks do not have pathnames. This endpoint is only for page content."), 400);
2253
+ const validation = normalizeAndValidatePathname(pathname);
2254
+ if (!validation.valid) return c.json({
2255
+ available: false,
2256
+ reason: "invalid_pathname",
2257
+ message: validation.message
2258
+ });
2259
+ const normalized = validation.value;
2286
2260
  const siteObj = api.getSite(site);
2287
2261
  if (!siteObj) return c.json(errorResponse(ErrorCodes.SITE_NOT_FOUND, `Site '${site}' not found`, { site }), 404);
2288
- if (siteObj.isPathnameAvailable(pathname, locale, excludeId)) return c.json({ available: true });
2289
- const existingId = siteObj.getPathnameConflict(pathname, locale, excludeId);
2262
+ if (siteObj.isPathnameAvailable(normalized, locale, excludeId)) return c.json({ available: true });
2263
+ const existingId = siteObj.getPathnameConflict(normalized, locale, excludeId);
2290
2264
  return c.json({
2291
2265
  available: false,
2292
2266
  existingId
@@ -2525,33 +2499,14 @@ function createContentAPIRouter(api, options) {
2525
2499
  return c.json(logAndCreateErrorResponse(error, ErrorCodes.GIT_PULL_FAILED, "Failed to pull from origin"), 500);
2526
2500
  }
2527
2501
  });
2528
- app.post("/mdx/compile", async (c) => {
2529
- try {
2530
- let body;
2531
- try {
2532
- body = await c.req.json();
2533
- } catch {
2534
- return c.json(errorResponse(ErrorCodes.INVALID_REQUEST, "Invalid JSON body"), 400);
2535
- }
2536
- const mdxContent = typeof body === "object" && body !== null ? body.mdxContent : null;
2537
- if (!mdxContent || typeof mdxContent !== "string") return c.json(errorResponse(ErrorCodes.MISSING_REQUIRED_FIELD, "mdxContent string required", { field: "mdxContent" }), 400);
2538
- const { code, metadata } = await compileMDX(mdxContent);
2539
- return c.json({
2540
- code,
2541
- metadata
2542
- });
2543
- } catch (error) {
2544
- return c.json(logAndCreateErrorResponse(error, ErrorCodes.MDX_COMPILE_FAILED, errorMessage(error, "Failed to compile MDX")), 422);
2545
- }
2546
- });
2547
2502
  return app;
2548
2503
  }
2549
2504
  /**
2550
2505
  * Create middleware for backwards compatibility with existing code
2551
2506
  * This wraps the Hono app to work with Node.js IncomingMessage/ServerResponse
2552
2507
  */
2553
- function createContentMiddleware(contentApi) {
2554
- const app = createContentAPIRouter(contentApi);
2508
+ function createContentMiddleware(contentApi, options) {
2509
+ const app = createContentAPIRouter(contentApi, options);
2555
2510
  return async (req, res, next) => {
2556
2511
  const url = new URL(req.url, `http://${req.headers.host}`);
2557
2512
  const basePath = url.pathname.startsWith("/__cms/api") ? "/__cms/api" : "/__conloca/api";
@@ -2588,7 +2543,6 @@ function readBody(req) {
2588
2543
  req.on("error", reject);
2589
2544
  });
2590
2545
  }
2591
-
2592
2546
  //#endregion
2593
2547
  //#region src/vite-plugin.ts
2594
2548
  /**
@@ -2612,7 +2566,7 @@ function conlocaContent(options) {
2612
2566
  }
2613
2567
  };
2614
2568
  }
2615
-
2616
2569
  //#endregion
2617
- export { AssetManifest, AssetOperations, Blocks, ComponentRegistry, ErrorCodes, FileSystemContentAPI, InMemoryContentAPI, Site, UPDATE_SCOPE, analyzeUpdateScope, buildLocaleVersion, buildPathnameHistory, compileMDX, conlocaContent, createContentAPI, createContentAPIRouter, createContentMiddleware, createContentWatchHandlers, extractBlockName, extractCFAccessToken, formatFileSize, generateContentId, getCurrentISODate, getMetadataSize, isContentPublished, isMetadataTooLarge, isValidBlockName, isValidPathname, localesOf, mapLocales, mapSiteNames, normalizePathname, parseDate, resolvePublishDate, serializeMdxWithFrontmatter, shouldUpdateModifiedTimestamp, updatePublishDates, validateAndPrepareMetadata, validateCFAccessRequest, validateCreateContent };
2570
+ export { AssetManifest, AssetOperations, Blocks, ComponentRegistry, ErrorCodes, FileSystemContentAPI, InMemoryContentAPI, Site, UPDATE_SCOPE, analyzeUpdateScope, buildLocaleVersion, buildPathnameHistory, conlocaContent, createContentAPI, createContentAPIRouter, createContentMiddleware, createContentWatchHandlers, extractBlockName, extractCFAccessToken, formatFileSize, generateContentId, getCurrentISODate, getMetadataSize, isContentPublished, isMetadataTooLarge, isValidBlockName, isValidPathname, localesOf, mapLocales, mapSiteNames, normalizeAndValidatePathname, normalizePathname, parseDate, readSitesConfig, resolvePublishDate, serializeMdxWithFrontmatter, shouldUpdateModifiedTimestamp, updatePublishDates, validateAndPrepareMetadata, validateCFAccessRequest, validateCreateContent };
2571
+
2618
2572
  //# sourceMappingURL=node.mjs.map