nextjs-studio 0.4.0 → 1.0.1

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 (236) hide show
  1. package/README.md +3 -1
  2. package/dist/bin/nextjs-studio.js +287 -30
  3. package/dist/bin/nextjs-studio.js.map +1 -1
  4. package/dist/cli/ui/.next/BUILD_ID +1 -0
  5. package/dist/cli/ui/.next/app-path-routes-manifest.json +12 -0
  6. package/dist/cli/ui/.next/build-manifest.json +20 -0
  7. package/dist/cli/ui/.next/export-marker.json +6 -0
  8. package/dist/cli/ui/.next/images-manifest.json +67 -0
  9. package/dist/cli/ui/.next/next-minimal-server.js.nft.json +1 -0
  10. package/dist/cli/ui/.next/next-server.js.nft.json +1 -0
  11. package/dist/cli/ui/.next/package.json +1 -0
  12. package/dist/cli/ui/.next/prerender-manifest.json +61 -0
  13. package/dist/cli/ui/.next/react-loadable-manifest.json +286 -0
  14. package/dist/cli/ui/.next/required-server-files.js +338 -0
  15. package/dist/cli/ui/.next/required-server-files.json +338 -0
  16. package/dist/cli/ui/.next/routes-manifest.json +125 -0
  17. package/dist/cli/ui/.next/server/app/_global-error/page.js +3 -0
  18. package/dist/cli/ui/.next/server/app/_global-error/page.js.nft.json +1 -0
  19. package/dist/cli/ui/.next/server/app/_global-error/page_client-reference-manifest.js +1 -0
  20. package/dist/cli/ui/.next/server/app/_global-error.html +2 -0
  21. package/dist/cli/ui/.next/server/app/_global-error.meta +16 -0
  22. package/dist/cli/ui/.next/server/app/_global-error.rsc +12 -0
  23. package/dist/cli/ui/.next/server/app/_global-error.segments/_full.segment.rsc +12 -0
  24. package/dist/cli/ui/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +5 -0
  25. package/dist/cli/ui/.next/server/app/_global-error.segments/_global-error.segment.rsc +4 -0
  26. package/dist/cli/ui/.next/server/app/_global-error.segments/_head.segment.rsc +5 -0
  27. package/dist/cli/ui/.next/server/app/_global-error.segments/_index.segment.rsc +4 -0
  28. package/dist/cli/ui/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -0
  29. package/dist/cli/ui/.next/server/app/_not-found/page.js +2 -0
  30. package/dist/cli/ui/.next/server/app/_not-found/page.js.nft.json +1 -0
  31. package/dist/cli/ui/.next/server/app/_not-found/page_client-reference-manifest.js +1 -0
  32. package/dist/cli/ui/.next/server/app/_not-found.html +1 -0
  33. package/dist/cli/ui/.next/server/app/_not-found.meta +16 -0
  34. package/dist/cli/ui/.next/server/app/_not-found.rsc +15 -0
  35. package/dist/cli/ui/.next/server/app/_not-found.segments/_full.segment.rsc +15 -0
  36. package/dist/cli/ui/.next/server/app/_not-found.segments/_head.segment.rsc +5 -0
  37. package/dist/cli/ui/.next/server/app/_not-found.segments/_index.segment.rsc +7 -0
  38. package/dist/cli/ui/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +5 -0
  39. package/dist/cli/ui/.next/server/app/_not-found.segments/_not-found.segment.rsc +4 -0
  40. package/dist/cli/ui/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -0
  41. package/dist/cli/ui/.next/server/app/api/media/[collection]/[filename]/route.js +1 -0
  42. package/dist/cli/ui/.next/server/app/api/media/[collection]/[filename]/route.js.nft.json +1 -0
  43. package/dist/cli/ui/.next/server/app/api/media/[collection]/[filename]/route_client-reference-manifest.js +1 -0
  44. package/dist/cli/ui/.next/server/app/api/media/[collection]/route.js +1 -0
  45. package/dist/cli/ui/.next/server/app/api/media/[collection]/route.js.nft.json +1 -0
  46. package/dist/cli/ui/.next/server/app/api/media/[collection]/route_client-reference-manifest.js +1 -0
  47. package/dist/cli/ui/.next/server/app/api/public/[...path]/route.js +1 -0
  48. package/dist/cli/ui/.next/server/app/api/public/[...path]/route.js.nft.json +1 -0
  49. package/dist/cli/ui/.next/server/app/api/public/[...path]/route_client-reference-manifest.js +1 -0
  50. package/dist/cli/ui/.next/server/app/api/sync/[collection]/route.js +1 -0
  51. package/dist/cli/ui/.next/server/app/api/sync/[collection]/route.js.nft.json +1 -0
  52. package/dist/cli/ui/.next/server/app/api/sync/[collection]/route_client-reference-manifest.js +1 -0
  53. package/dist/cli/ui/.next/server/app/api/watch/route.js +3 -0
  54. package/dist/cli/ui/.next/server/app/api/watch/route.js.nft.json +1 -0
  55. package/dist/cli/ui/.next/server/app/api/watch/route_client-reference-manifest.js +1 -0
  56. package/dist/cli/ui/.next/server/app/collection/[name]/[slug]/page.js +99 -0
  57. package/dist/cli/ui/.next/server/app/collection/[name]/[slug]/page.js.nft.json +1 -0
  58. package/dist/cli/ui/.next/server/app/collection/[name]/[slug]/page_client-reference-manifest.js +1 -0
  59. package/dist/cli/ui/.next/server/app/collection/[name]/page.js +5 -0
  60. package/dist/cli/ui/.next/server/app/collection/[name]/page.js.nft.json +1 -0
  61. package/dist/cli/ui/.next/server/app/collection/[name]/page_client-reference-manifest.js +1 -0
  62. package/dist/cli/ui/.next/server/app/page.js +2 -0
  63. package/dist/cli/ui/.next/server/app/page.js.nft.json +1 -0
  64. package/dist/cli/ui/.next/server/app/page_client-reference-manifest.js +1 -0
  65. package/dist/cli/ui/.next/server/app-paths-manifest.json +12 -0
  66. package/dist/cli/ui/.next/server/chunks/1875.js +1 -0
  67. package/dist/cli/ui/.next/server/chunks/2198.js +1 -0
  68. package/dist/cli/ui/.next/server/chunks/2446.js +36 -0
  69. package/dist/cli/ui/.next/server/chunks/2474.js +148 -0
  70. package/dist/cli/ui/.next/server/chunks/2490.js +55 -0
  71. package/dist/cli/ui/.next/server/chunks/2717.js +56 -0
  72. package/dist/cli/ui/.next/server/chunks/2729.js +166 -0
  73. package/dist/cli/ui/.next/server/chunks/2774.js +1 -0
  74. package/dist/cli/ui/.next/server/chunks/2796.js +1 -0
  75. package/dist/cli/ui/.next/server/chunks/3145.js +1 -0
  76. package/dist/cli/ui/.next/server/chunks/3186.js +1 -0
  77. package/dist/cli/ui/.next/server/chunks/3494.js +24 -0
  78. package/dist/cli/ui/.next/server/chunks/3610.js +1 -0
  79. package/dist/cli/ui/.next/server/chunks/3659.js +93 -0
  80. package/dist/cli/ui/.next/server/chunks/3744.js +1 -0
  81. package/dist/cli/ui/.next/server/chunks/3806.js +136 -0
  82. package/dist/cli/ui/.next/server/chunks/408.js +1 -0
  83. package/dist/cli/ui/.next/server/chunks/4189.js +62 -0
  84. package/dist/cli/ui/.next/server/chunks/4293.js +1 -0
  85. package/dist/cli/ui/.next/server/chunks/4469.js +4 -0
  86. package/dist/cli/ui/.next/server/chunks/4484.js +1 -0
  87. package/dist/cli/ui/.next/server/chunks/449.js +82 -0
  88. package/dist/cli/ui/.next/server/chunks/4607.js +22 -0
  89. package/dist/cli/ui/.next/server/chunks/479.js +5 -0
  90. package/dist/cli/ui/.next/server/chunks/4931.js +63 -0
  91. package/dist/cli/ui/.next/server/chunks/528.js +1 -0
  92. package/dist/cli/ui/.next/server/chunks/5341.js +1 -0
  93. package/dist/cli/ui/.next/server/chunks/5585.js +29 -0
  94. package/dist/cli/ui/.next/server/chunks/5677.js +1 -0
  95. package/dist/cli/ui/.next/server/chunks/5724.js +1 -0
  96. package/dist/cli/ui/.next/server/chunks/5760.js +174 -0
  97. package/dist/cli/ui/.next/server/chunks/5784.js +24 -0
  98. package/dist/cli/ui/.next/server/chunks/6.js +262 -0
  99. package/dist/cli/ui/.next/server/chunks/6040.js +1 -0
  100. package/dist/cli/ui/.next/server/chunks/6067.js +13 -0
  101. package/dist/cli/ui/.next/server/chunks/6553.js +1 -0
  102. package/dist/cli/ui/.next/server/chunks/6656.js +201 -0
  103. package/dist/cli/ui/.next/server/chunks/6672.js +1 -0
  104. package/dist/cli/ui/.next/server/chunks/6872.js +1 -0
  105. package/dist/cli/ui/.next/server/chunks/7146.js +59 -0
  106. package/dist/cli/ui/.next/server/chunks/7354.js +1 -0
  107. package/dist/cli/ui/.next/server/chunks/7677.js +1 -0
  108. package/dist/cli/ui/.next/server/chunks/7781.js +1 -0
  109. package/dist/cli/ui/.next/server/chunks/8194.js +215 -0
  110. package/dist/cli/ui/.next/server/chunks/8231.js +1 -0
  111. package/dist/cli/ui/.next/server/chunks/8319.js +2 -0
  112. package/dist/cli/ui/.next/server/chunks/8339.js +1 -0
  113. package/dist/cli/ui/.next/server/chunks/8775.js +1 -0
  114. package/dist/cli/ui/.next/server/chunks/9503.js +43 -0
  115. package/dist/cli/ui/.next/server/chunks/958.js +131 -0
  116. package/dist/cli/ui/.next/server/chunks/9739.js +1 -0
  117. package/dist/cli/ui/.next/server/functions-config-manifest.json +4 -0
  118. package/dist/cli/ui/.next/server/interception-route-rewrite-manifest.js +1 -0
  119. package/dist/cli/ui/.next/server/middleware-build-manifest.js +1 -0
  120. package/dist/cli/ui/.next/server/middleware-manifest.json +6 -0
  121. package/dist/cli/ui/.next/server/middleware-react-loadable-manifest.js +1 -0
  122. package/dist/cli/ui/.next/server/next-font-manifest.js +1 -0
  123. package/dist/cli/ui/.next/server/next-font-manifest.json +1 -0
  124. package/dist/cli/ui/.next/server/pages/404.html +1 -0
  125. package/dist/cli/ui/.next/server/pages/500.html +2 -0
  126. package/dist/cli/ui/.next/server/pages-manifest.json +4 -0
  127. package/dist/cli/ui/.next/server/server-reference-manifest.js +1 -0
  128. package/dist/cli/ui/.next/server/server-reference-manifest.json +1 -0
  129. package/dist/cli/ui/.next/server/webpack-runtime.js +1 -0
  130. package/dist/cli/ui/.next/static/chunks/0937d497-2b220e2d0368e918.js +1 -0
  131. package/dist/cli/ui/.next/static/chunks/1013.5541c1c75688ef6e.js +1 -0
  132. package/dist/cli/ui/.next/static/chunks/1039.d26ef6a818f26d70.js +4 -0
  133. package/dist/cli/ui/.next/static/chunks/1325.cb67348b484ce7a0.js +24 -0
  134. package/dist/cli/ui/.next/static/chunks/1858-d10f8bead2218ad2.js +2 -0
  135. package/dist/cli/ui/.next/static/chunks/1882.05c68ab6bdcd8c31.js +1 -0
  136. package/dist/cli/ui/.next/static/chunks/2011.7e73842f1e8e2cde.js +1 -0
  137. package/dist/cli/ui/.next/static/chunks/2046.73486ea936c9afd2.js +1 -0
  138. package/dist/cli/ui/.next/static/chunks/2389.b73d3a1286a228d0.js +1 -0
  139. package/dist/cli/ui/.next/static/chunks/2430.08df5899978ebf26.js +43 -0
  140. package/dist/cli/ui/.next/static/chunks/2462-4255d8f51dc56f12.js +1 -0
  141. package/dist/cli/ui/.next/static/chunks/3098-4269da0468edc350.js +1 -0
  142. package/dist/cli/ui/.next/static/chunks/317.b4fcc40f219152b1.js +1 -0
  143. package/dist/cli/ui/.next/static/chunks/3197.d2f3398e552228e4.js +1 -0
  144. package/dist/cli/ui/.next/static/chunks/3212-1a9c9d110d15abab.js +4 -0
  145. package/dist/cli/ui/.next/static/chunks/3809.8df186de2ff997f8.js +1 -0
  146. package/dist/cli/ui/.next/static/chunks/3918.caaf4eb4f6450524.js +1 -0
  147. package/dist/cli/ui/.next/static/chunks/3987-6d3217e36ae5b4dc.js +1 -0
  148. package/dist/cli/ui/.next/static/chunks/3c774391-ec08594272867fd5.js +79 -0
  149. package/dist/cli/ui/.next/static/chunks/4075052f.9006147a6182ed95.js +1 -0
  150. package/dist/cli/ui/.next/static/chunks/4389.e7a3c58aa62118e3.js +82 -0
  151. package/dist/cli/ui/.next/static/chunks/46bdbe0e-f5103600b23143b8.js +1 -0
  152. package/dist/cli/ui/.next/static/chunks/4860.2ba51d1d81857c81.js +1 -0
  153. package/dist/cli/ui/.next/static/chunks/4882.794e2a9231f129e5.js +55 -0
  154. package/dist/cli/ui/.next/static/chunks/5149.8de9918b9ace58f5.js +166 -0
  155. package/dist/cli/ui/.next/static/chunks/5230.b7c87400f0d8516f.js +215 -0
  156. package/dist/cli/ui/.next/static/chunks/5263.7adc3ade53cd4ed3.js +24 -0
  157. package/dist/cli/ui/.next/static/chunks/5313.1dfcc2126f85a8f8.js +1 -0
  158. package/dist/cli/ui/.next/static/chunks/5350-17c792e27bf38c77.js +1 -0
  159. package/dist/cli/ui/.next/static/chunks/5638.e3a2119354708654.js +1 -0
  160. package/dist/cli/ui/.next/static/chunks/5758.33b45c6c407ecd94.js +1 -0
  161. package/dist/cli/ui/.next/static/chunks/589.019158de5d02c262.js +1 -0
  162. package/dist/cli/ui/.next/static/chunks/6013.e33e73569339afee.js +62 -0
  163. package/dist/cli/ui/.next/static/chunks/6084.7511ad4ebb4f9df5.js +1 -0
  164. package/dist/cli/ui/.next/static/chunks/612.d3aeebcaaaf06fb2.js +1 -0
  165. package/dist/cli/ui/.next/static/chunks/6239.6c0cd99ea36222b6.js +5 -0
  166. package/dist/cli/ui/.next/static/chunks/6299-79a74877b87acf9f.js +1 -0
  167. package/dist/cli/ui/.next/static/chunks/6484.d38aa531768c3452.js +148 -0
  168. package/dist/cli/ui/.next/static/chunks/6505.731f74c28b8980b3.js +1 -0
  169. package/dist/cli/ui/.next/static/chunks/6584.be94a55391bcdcce.js +262 -0
  170. package/dist/cli/ui/.next/static/chunks/6800.1066ad1f5add7c75.js +1 -0
  171. package/dist/cli/ui/.next/static/chunks/7052.89e2de773d10ac20.js +131 -0
  172. package/dist/cli/ui/.next/static/chunks/7127.360abfa43dc4427e.js +36 -0
  173. package/dist/cli/ui/.next/static/chunks/7430.2b247d9ac6ef694c.js +149 -0
  174. package/dist/cli/ui/.next/static/chunks/7444.66c4d6bbc19309b3.js +59 -0
  175. package/dist/cli/ui/.next/static/chunks/7546.4cb4db4685212384.js +63 -0
  176. package/dist/cli/ui/.next/static/chunks/7564.7b9271fcf06df80c.js +29 -0
  177. package/dist/cli/ui/.next/static/chunks/7664.8268c156d8988844.js +174 -0
  178. package/dist/cli/ui/.next/static/chunks/7722-04e64cc1b26cfa65.js +1 -0
  179. package/dist/cli/ui/.next/static/chunks/8701.3995b58a75e43147.js +56 -0
  180. package/dist/cli/ui/.next/static/chunks/8800.548c3da26cfebf06.js +1 -0
  181. package/dist/cli/ui/.next/static/chunks/8814-7b64110c79ce7209.js +15 -0
  182. package/dist/cli/ui/.next/static/chunks/9058.a195d15265251194.js +1 -0
  183. package/dist/cli/ui/.next/static/chunks/9211.91144a0d23e4cf6d.js +1 -0
  184. package/dist/cli/ui/.next/static/chunks/9690.c1f08c02a675b9ce.js +1 -0
  185. package/dist/cli/ui/.next/static/chunks/9919.1ccc9ca4a749d9b7.js +93 -0
  186. package/dist/cli/ui/.next/static/chunks/app/_global-error/page-ad53913b77389472.js +1 -0
  187. package/dist/cli/ui/.next/static/chunks/app/_not-found/page-202c1e16a4b86ac8.js +1 -0
  188. package/dist/cli/ui/.next/static/chunks/app/api/media/[collection]/[filename]/route-ad53913b77389472.js +1 -0
  189. package/dist/cli/ui/.next/static/chunks/app/api/media/[collection]/route-ad53913b77389472.js +1 -0
  190. package/dist/cli/ui/.next/static/chunks/app/api/public/[...path]/route-ad53913b77389472.js +1 -0
  191. package/dist/cli/ui/.next/static/chunks/app/api/sync/[collection]/route-ad53913b77389472.js +1 -0
  192. package/dist/cli/ui/.next/static/chunks/app/api/watch/route-ad53913b77389472.js +1 -0
  193. package/dist/cli/ui/.next/static/chunks/app/collection/[name]/[slug]/page-7ea9eff252374845.js +6 -0
  194. package/dist/cli/ui/.next/static/chunks/app/collection/[name]/loading-03fc0b653e7060ae.js +1 -0
  195. package/dist/cli/ui/.next/static/chunks/app/collection/[name]/page-ad5976bebc9820cf.js +1 -0
  196. package/dist/cli/ui/.next/static/chunks/app/layout-74cd2ebe3fac00e7.js +1 -0
  197. package/dist/cli/ui/.next/static/chunks/app/page-ed5acadf20146966.js +1 -0
  198. package/dist/cli/ui/.next/static/chunks/b1767599.6a816b06e55b02a1.js +1 -0
  199. package/dist/cli/ui/.next/static/chunks/c6164070.3b9741bce302db0f.js +136 -0
  200. package/dist/cli/ui/.next/static/chunks/fb2ceba8.7fc23e46ca00cfd1.js +53 -0
  201. package/dist/cli/ui/.next/static/chunks/framework-ada624c9bf38edc6.js +1 -0
  202. package/dist/cli/ui/.next/static/chunks/main-0513ff42a7f2e1a0.js +5 -0
  203. package/dist/cli/ui/.next/static/chunks/main-app-b8d23dfb755744e8.js +1 -0
  204. package/dist/cli/ui/.next/static/chunks/next/dist/client/components/builtin/app-error-ad53913b77389472.js +1 -0
  205. package/dist/cli/ui/.next/static/chunks/next/dist/client/components/builtin/forbidden-ad53913b77389472.js +1 -0
  206. package/dist/cli/ui/.next/static/chunks/next/dist/client/components/builtin/global-error-558ee1074f45044b.js +1 -0
  207. package/dist/cli/ui/.next/static/chunks/next/dist/client/components/builtin/not-found-ad53913b77389472.js +1 -0
  208. package/dist/cli/ui/.next/static/chunks/next/dist/client/components/builtin/unauthorized-ad53913b77389472.js +1 -0
  209. package/dist/cli/ui/.next/static/chunks/polyfills-42372ed130431b0a.js +1 -0
  210. package/dist/cli/ui/.next/static/chunks/webpack-acb903cd88aafa6f.js +1 -0
  211. package/dist/cli/ui/.next/static/css/e143949aa3f17880.css +3 -0
  212. package/dist/cli/ui/.next/static/media/034d78ad42e9620c-s.woff2 +0 -0
  213. package/dist/cli/ui/.next/static/media/0484562807a97172-s.p.woff2 +0 -0
  214. package/dist/cli/ui/.next/static/media/29a4aea02fdee119-s.woff2 +0 -0
  215. package/dist/cli/ui/.next/static/media/29e7bbdce9332268-s.woff2 +0 -0
  216. package/dist/cli/ui/.next/static/media/4c285fdca692ea22-s.p.woff2 +0 -0
  217. package/dist/cli/ui/.next/static/media/6c177e25b87fd9cd-s.woff2 +0 -0
  218. package/dist/cli/ui/.next/static/media/6c9a125e97d835e1-s.woff2 +0 -0
  219. package/dist/cli/ui/.next/static/media/8888a3826f4a3af4-s.p.woff2 +0 -0
  220. package/dist/cli/ui/.next/static/media/a1386beebedccca4-s.woff2 +0 -0
  221. package/dist/cli/ui/.next/static/media/b957ea75a84b6ea7-s.p.woff2 +0 -0
  222. package/dist/cli/ui/.next/static/media/c3bc380753a8436c-s.woff2 +0 -0
  223. package/dist/cli/ui/.next/static/media/db911767852bc875-s.woff2 +0 -0
  224. package/dist/cli/ui/.next/static/media/eafabf029ad39a43-s.p.woff2 +0 -0
  225. package/dist/cli/ui/.next/static/media/f10b8e9d91f3edcb-s.woff2 +0 -0
  226. package/dist/cli/ui/.next/static/media/fe0777f1195381cb-s.woff2 +0 -0
  227. package/dist/cli/ui/.next/static/zkOuvkSWApTVHCrj7neNk/_buildManifest.js +1 -0
  228. package/dist/cli/ui/.next/static/zkOuvkSWApTVHCrj7neNk/_ssgManifest.js +1 -0
  229. package/dist/core/index.d.ts +34 -391
  230. package/dist/core/index.js +112 -338
  231. package/dist/core/index.js.map +1 -1
  232. package/dist/core/server.d.ts +135 -0
  233. package/dist/core/server.js +707 -0
  234. package/dist/core/server.js.map +1 -0
  235. package/dist/query-builder-KXz9cPzF.d.ts +330 -0
  236. package/package.json +32 -6
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/core/query-builder.ts","../../src/core/indexer.ts","../../src/shared/constants.ts","../../src/core/parsers/parser-mdx.ts","../../src/core/parsers/parser-json.ts","../../src/core/schema-inferrer.ts","../../src/core/content-store.ts","../../src/core/init.ts","../../src/cli/adapters/fs-adapter.ts","../../src/shared/field-utils.ts"],"sourcesContent":["/**\n * @context Core layer — query builder at src/core/query-builder.ts\n * @does Provides a fluent API to filter, sort, and paginate content entries from a collection\n * @depends src/shared/types.ts, src/core/content-store.ts\n * @do Add new query capabilities here (e.g. search, groupBy)\n * @dont Import from CLI or UI; access the filesystem; perform I/O\n */\n\nimport { filter, orderBy, get, slice } from \"lodash-es\";\nimport type { QueryOptions } from \"../shared/types.js\";\nimport type { CollectionTypeMap } from \"../shared/types.js\";\nimport { getStore } from \"./content-store.js\";\n\n/**\n * Fluent query builder for content collections.\n *\n * ```ts\n * const posts = queryCollection(\"blog\")\n * .where({ published: true })\n * .sort(\"date\", \"desc\")\n * .limit(10)\n * .all();\n * ```\n *\n * Supports dot notation for nested properties:\n * ```ts\n * queryCollection(\"pages\").where({ \"hero.title\": \"Welcome\" }).all();\n * ```\n */\nexport class QueryBuilder<T = Record<string, unknown>> {\n private readonly collectionName: string;\n private options: QueryOptions = {};\n\n constructor(collection: string) {\n this.collectionName = collection;\n }\n\n where(conditions: Record<string, unknown>): this {\n this.options.where = { ...this.options.where, ...conditions };\n return this;\n }\n\n sort(field: string, order: \"asc\" | \"desc\" = \"asc\"): this {\n this.options.sort = { field, order };\n return this;\n }\n\n limit(count: number): this {\n this.options.limit = count;\n return this;\n }\n\n offset(count: number): this {\n this.options.offset = count;\n return this;\n }\n\n all(): T[] {\n let entries = [...getStore().getCollection(this.collectionName)];\n\n if (this.options.where) {\n const conditions = this.options.where;\n entries = filter(entries, (entry) =>\n Object.entries(conditions).every(([key, value]) => get(entry.data, key) === value),\n );\n }\n\n if (this.options.sort) {\n const { field, order } = this.options.sort;\n entries = orderBy(entries, [(entry) => get(entry.data, field)], [order]);\n }\n\n const start = this.options.offset ?? 0;\n const end = this.options.limit ? start + this.options.limit : undefined;\n return slice(entries, start, end).map((e) => e.data as unknown as T);\n }\n\n first(): T | undefined {\n return this.limit(1).all()[0];\n }\n\n count(): number {\n return this.all().length;\n }\n}\n\n/**\n * Entry point for querying a content collection.\n */\nexport function queryCollection<K extends keyof CollectionTypeMap>(\n name: K,\n): QueryBuilder<CollectionTypeMap[K]>;\nexport function queryCollection(name: string): QueryBuilder<Record<string, unknown>>;\nexport function queryCollection(name: string): QueryBuilder {\n return new QueryBuilder(name);\n}\n","/**\n * @context Core layer — content indexer at src/core/indexer.ts\n * @does Scans the contents directory, parses MDX/JSON files, and builds an in-memory index\n * @depends src/shared/types.ts, src/shared/constants.ts, src/shared/fs-adapter.interface.ts, src/core/parsers/, src/core/schema-inferrer.ts\n * @do Add new file type handling here; extend indexCollection for new collection behaviors\n * @dont Import from CLI or UI; instantiate FsAdapter; access the filesystem directly\n */\n\nimport slugify from \"@sindresorhus/slugify\";\nimport type { CollectionSchema } from \"../shared/fields.js\";\nimport type { ContentEntry, Collection, StudioConfig } from \"../shared/types.js\";\nimport type { IFsAdapter } from \"../shared/fs-adapter.interface.js\";\nimport { COLLECTION_ORDER_FILE } from \"../shared/constants.js\";\nimport { parseMdx } from \"./parsers/parser-mdx.js\";\nimport { parseJson } from \"./parsers/parser-json.js\";\nimport { inferSchema } from \"./schema-inferrer.js\";\n\nexport class ContentIndex {\n private readonly entries = new Map<string, ContentEntry[]>();\n private readonly collections = new Map<string, Collection>();\n private readonly fs: IFsAdapter;\n\n constructor(fsAdapter: IFsAdapter) {\n this.fs = fsAdapter;\n }\n\n async build(config?: StudioConfig): Promise<void> {\n this.clear();\n const dirs = await this.fs.listDirectories(\".\");\n\n for (const dir of dirs) {\n const dirName = this.fs.basename(dir);\n const collectionName = slugify(dirName);\n const collectionConfig = config?.collections?.[collectionName];\n await this.indexCollection(dirName, collectionName, collectionConfig?.schema);\n }\n }\n\n getCollection(name: string): ContentEntry[] {\n return this.entries.get(name) ?? [];\n }\n\n getCollections(): Collection[] {\n return Array.from(this.collections.values());\n }\n\n clear(): void {\n this.entries.clear();\n this.collections.clear();\n }\n\n private async indexCollection(\n dirName: string,\n collectionName: string,\n manualSchema?: CollectionSchema,\n ): Promise<void> {\n const entries: ContentEntry[] = [];\n await this.scanDir(dirName, collectionName, dirName, entries);\n\n const orderPath = this.fs.join(dirName, COLLECTION_ORDER_FILE);\n const ordering = await this.readOrdering(orderPath);\n if (ordering) {\n this.applyOrdering(entries, ordering);\n }\n\n const schema = manualSchema ?? inferSchema(entries, collectionName);\n\n this.entries.set(collectionName, entries);\n this.collections.set(collectionName, {\n name: collectionName,\n type: this.detectCollectionType(entries),\n count: entries.length,\n basePath: dirName,\n schema,\n });\n }\n\n private async scanDir(\n dirName: string,\n collectionName: string,\n dirPath: string,\n entries: ContentEntry[],\n ): Promise<void> {\n const subDirs = await this.fs.listDirectories(dirPath);\n for (const subDir of subDirs) {\n await this.scanDir(dirName, collectionName, subDir, entries);\n }\n\n const files = await this.fs.listFiles(dirPath);\n for (const filePath of files) {\n const fileName = this.fs.basename(filePath);\n if (fileName === COLLECTION_ORDER_FILE) continue;\n\n const ext = this.fs.extname(fileName);\n const content = await this.fs.readFile(filePath);\n const relativePath = this.fs.relative(dirName, filePath);\n const slug = this.fs\n .normalizeSlug(relativePath, ext)\n .split(\"/\")\n .map((segment) => slugify(segment))\n .join(\"/\");\n\n if (ext === \".mdx\") {\n entries.push(this.buildMdxEntry(collectionName, slug, content));\n } else if (ext === \".json\") {\n entries.push(...this.buildJsonEntries(collectionName, slug, content));\n }\n }\n }\n\n private buildMdxEntry(collectionName: string, slug: string, content: string): ContentEntry {\n const parsed = parseMdx(content);\n return {\n collection: collectionName,\n slug,\n path: `/${collectionName}/${slug}`,\n body: parsed.body,\n data: parsed.data,\n };\n }\n\n private buildJsonEntries(collectionName: string, slug: string, content: string): ContentEntry[] {\n const parsed = parseJson(content);\n\n if (parsed.type === \"json-array\") {\n return parsed.entries.map((data, index) => {\n const entrySlug =\n typeof data[\"slug\"] === \"string\" ? slugify(data[\"slug\"]) : `${slug}/${index}`;\n return {\n collection: collectionName,\n slug: entrySlug,\n path: `/${collectionName}/${entrySlug}`,\n data,\n };\n });\n }\n\n return [{ collection: collectionName, slug, path: `/${collectionName}/${slug}`, data: parsed.data }];\n }\n\n private async readOrdering(orderPath: string): Promise<string[] | null> {\n if (!(await this.fs.exists(orderPath))) return null;\n\n try {\n const content = await this.fs.readFile(orderPath);\n const parsed: unknown = JSON.parse(content);\n if (Array.isArray(parsed)) return parsed as string[];\n } catch (error) {\n console.warn(`[Nextjs Studio] Failed to parse ordering file: ${orderPath}`, error);\n }\n return null;\n }\n\n private applyOrdering(entries: ContentEntry[], ordering: string[]): void {\n const orderMap = new Map(ordering.map((slug, index) => [slug, index]));\n entries.sort((a, b) => {\n const aIndex = orderMap.get(a.slug) ?? Infinity;\n const bIndex = orderMap.get(b.slug) ?? Infinity;\n return aIndex - bIndex;\n });\n }\n\n private detectCollectionType(entries: ContentEntry[]): Collection[\"type\"] {\n if (entries.length === 0) return \"mdx\";\n const first = entries[0];\n if (first.body !== undefined) return \"mdx\";\n if (entries.length === 1 && !first.slug.includes(\"/\")) return \"json-object\";\n return \"json-array\";\n }\n}\n","/**\n * @context Shared layer — constants at src/shared/constants.ts\n * @does Defines project-wide constants shared across core, CLI, and UI layers\n * @depends none\n * @do Add new shared constants here\n * @dont Import from CLI or UI; constants must be framework-agnostic\n */\n\nexport const CONTENTS_DIR = \"contents\";\nexport const CLI_PORT = 3030;\nexport const CONFIG_FILE = \"studio.config.ts\";\nexport const SUPPORTED_EXTENSIONS = [\".mdx\", \".json\"] as const;\nexport const COLLECTION_ORDER_FILE = \"collection.json\";\nexport const WATCHER_DEBOUNCE_MS = 5_000;\nexport const MEDIA_DIR = \"media\";\n\nexport const IMAGE_MIME_TYPES = [\n \"image/png\",\n \"image/jpeg\",\n \"image/gif\",\n \"image/webp\",\n \"image/svg+xml\",\n \"image/avif\",\n] as const;\n\nexport const VIDEO_MIME_TYPES = [\"video/mp4\", \"video/webm\", \"video/ogg\"] as const;\n\nexport const AUDIO_MIME_TYPES = [\n \"audio/mpeg\",\n \"audio/ogg\",\n \"audio/wav\",\n \"audio/webm\",\n \"audio/aac\",\n \"audio/flac\",\n] as const;\n\nexport const MEDIA_MIME_TYPES = [...IMAGE_MIME_TYPES, ...VIDEO_MIME_TYPES, ...AUDIO_MIME_TYPES] as const;\n\nexport const IMAGE_EXTENSIONS = [\".png\", \".jpg\", \".jpeg\", \".gif\", \".webp\", \".svg\", \".avif\"] as const;\nexport const VIDEO_EXTENSIONS = [\".mp4\", \".webm\", \".ogv\"] as const;\nexport const AUDIO_EXTENSIONS = [\".mp3\", \".ogg\", \".wav\", \".m4a\", \".aac\", \".flac\"] as const;\n","/**\n * @context Core layer — MDX parser/serializer at src/core/parsers/parser-mdx.ts\n * @does Parses .mdx content into frontmatter + body, and serializes them back to MDX strings\n * @depends none (gray-matter is an external dep)\n * @do Add MDX transform steps here; both parse and serialize live here intentionally\n * @dont Access the filesystem; import from CLI or UI; handle JSON content\n */\n\nimport matter from \"gray-matter\";\n\nexport interface ParsedMdx {\n data: Record<string, unknown>;\n body: string;\n}\n\nexport function parseMdx(content: string): ParsedMdx {\n const { data, content: body } = matter(content);\n return { data, body: body.trim() };\n}\n\nexport function serializeMdx(data: Record<string, unknown>, body: string): string {\n return matter.stringify(body, data);\n}\n","/**\n * @context Core layer — JSON parser at src/core/parsers/parser-json.ts\n * @does Parses JSON content strings into typed ParsedJson results (array or object)\n * @depends none\n * @do Extend ParsedJson variants here if new JSON structures are supported\n * @dont Access the filesystem; import from CLI or UI; contain serialization logic\n */\n\nexport interface ParsedJsonArray {\n type: \"json-array\";\n entries: Record<string, unknown>[];\n}\n\nexport interface ParsedJsonObject {\n type: \"json-object\";\n data: Record<string, unknown>;\n}\n\nexport type ParsedJson = ParsedJsonArray | ParsedJsonObject;\n\nexport function parseJson(content: string): ParsedJson {\n const parsed: unknown = JSON.parse(content);\n\n if (Array.isArray(parsed)) {\n return {\n type: \"json-array\",\n entries: parsed as Record<string, unknown>[],\n };\n }\n\n if (typeof parsed === \"object\" && parsed !== null) {\n return {\n type: \"json-object\",\n data: parsed as Record<string, unknown>,\n };\n }\n\n throw new Error(\"JSON content must be an array or object\");\n}\n","/**\n * @context Core layer — schema inferrer at src/core/schema-inferrer.ts\n * @does Infers a CollectionSchema from actual content entries when no manual schema is defined\n * @depends src/shared/types.ts, src/shared/fields.ts\n * @do Add new type detection heuristics here (e.g. color, phone)\n * @dont Import from CLI or UI; access the filesystem; perform I/O\n */\n\nimport type { ContentEntry } from \"../shared/types.js\";\nimport type { CollectionSchema, FieldDefinition, SelectOption } from \"../shared/fields.js\";\n\n// Value detector patterns\nconst RE_ISO_DATE = /^\\d{4}-\\d{2}-\\d{2}$/;\nconst RE_ISO_DATETIME =\n /^\\d{4}-\\d{2}-\\d{2}[T ]\\d{2}:\\d{2}(:\\d{2}(\\.\\d+)?)?(Z|[+-]\\d{2}:?\\d{2})?$/;\nconst RE_EMAIL = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/;\nconst RE_URL = /^https?:\\/\\/.+/;\nconst LONG_TEXT_THRESHOLD = 200;\n\nfunction isISODate(value: string): boolean {\n return RE_ISO_DATE.test(value);\n}\n\nfunction isISODateTime(value: string): boolean {\n return RE_ISO_DATETIME.test(value);\n}\n\nfunction isEmail(value: string): boolean {\n return RE_EMAIL.test(value);\n}\n\nfunction isUrl(value: string): boolean {\n return RE_URL.test(value);\n}\n\nfunction inferStringField(name: string, strings: string[]): FieldDefinition {\n if (strings.every(isEmail)) return { name, type: \"email\" };\n if (strings.every(isUrl)) return { name, type: \"url\" };\n if (strings.every(isISODateTime)) return { name, type: \"date\", includeTime: true };\n if (strings.every(isISODate)) return { name, type: \"date\" };\n\n const isLong = strings.some((s) => s.length > LONG_TEXT_THRESHOLD || s.includes(\"\\n\"));\n return { name, type: isLong ? \"long-text\" : \"text\" };\n}\n\nfunction inferArrayField(name: string, items: unknown[]): FieldDefinition {\n if (items.length === 0) return { name, type: \"array\", itemFields: [] };\n\n if (items.every((item) => typeof item === \"string\")) {\n const unique = [...new Set(items as string[])].slice(0, 50);\n const options: SelectOption[] = unique.map((v) => ({ label: v, value: v }));\n return { name, type: \"multi-select\", options };\n }\n\n if (items.every((item) => typeof item === \"object\" && item !== null && !Array.isArray(item))) {\n return { name, type: \"array\", itemFields: inferFields(items as Record<string, unknown>[]) };\n }\n\n return { name, type: \"array\", itemFields: [] };\n}\n\nfunction inferFieldDefinition(name: string, values: unknown[]): FieldDefinition {\n const present = values.filter((v) => v !== null && v !== undefined);\n\n if (present.length === 0) return { name, type: \"text\" };\n if (present.every((v) => typeof v === \"boolean\")) return { name, type: \"boolean\" };\n\n if (present.every((v) => typeof v === \"number\")) {\n const format = present.every((v) => Number.isInteger(v)) ? \"integer\" : \"decimal\";\n return { name, type: \"number\", format };\n }\n\n if (present.every((v) => typeof v === \"string\")) {\n return inferStringField(name, present as string[]);\n }\n\n if (present.every((v) => Array.isArray(v))) {\n return inferArrayField(name, (present as unknown[][]).flat());\n }\n\n if (present.every((v) => typeof v === \"object\" && v !== null && !Array.isArray(v))) {\n return { name, type: \"object\", fields: inferFields(present as Record<string, unknown>[]) };\n }\n\n return { name, type: \"text\" };\n}\n\nfunction inferFields(rows: Record<string, unknown>[]): FieldDefinition[] {\n const keySet = new Set<string>(rows.flatMap((row) => Object.keys(row)));\n return Array.from(keySet).map((key) => inferFieldDefinition(key, rows.map((row) => row[key])));\n}\n\n/**\n * Infer a `CollectionSchema` from the data of a set of content entries.\n *\n * The result is a best-effort approximation — string fields that look like\n * emails, URLs, or ISO dates get the correct semantic type. Everything else\n * falls back to `text`.\n */\nexport function inferSchema(entries: ContentEntry[], collectionName: string): CollectionSchema {\n const rows = entries.map((entry) => entry.data as Record<string, unknown>);\n return { collection: collectionName, fields: inferFields(rows) };\n}\n","/**\n * @context Core layer — content store at src/core/content-store.ts\n * @does Manages a singleton ContentIndex; exposes loadContent() and getStore() for consumers\n * @depends src/core/indexer.ts, src/shared/fs-adapter.interface.ts, src/shared/types.ts\n * @do Use this as the single access point for in-memory indexed content\n * @dont Import from CLI or UI; instantiate FsAdapter here; contain parsing or I/O logic\n */\n\nimport type { IFsAdapter } from \"../shared/fs-adapter.interface.js\";\nimport type { StudioConfig } from \"../shared/types.js\";\nimport { ContentIndex } from \"./indexer.js\";\n\nlet store: ContentIndex | null = null;\n\nexport function getStore(): ContentIndex {\n if (!store) {\n throw new Error(\"Content not loaded. Call loadContent() before querying.\");\n }\n return store;\n}\n\nexport async function loadContent(\n fsAdapter: IFsAdapter,\n config?: StudioConfig,\n): Promise<ContentIndex> {\n const index = new ContentIndex(fsAdapter);\n await index.build(config);\n store = index;\n return index;\n}\n","/**\r\n * @context Core layer — studio initializer at src/core/init.ts\r\n * @does Convenience function to initialize the content store for Node.js environments\r\n * @depends src/core/content-store.ts, src/cli/adapters/fs-adapter.ts\r\n * @do Use this as the entry point for Next.js and other Node.js consumers\r\n * @dont Import from UI; use in browser environments\r\n */\r\n\r\nimport path from \"node:path\";\r\nimport { FsAdapter } from \"../cli/adapters/fs-adapter.js\";\r\nimport { loadContent, getStore } from \"./content-store.js\";\r\nimport type { StudioConfig } from \"../shared/types.js\";\r\n\r\n/**\r\n * Initialize the content store from the filesystem.\r\n * Call this once before using `queryCollection()`.\r\n *\r\n * @param contentsDir - Path to the contents directory. Defaults to `./contents` relative to cwd.\r\n * @param config - Optional studio config for schemas and scripts.\r\n *\r\n * @example\r\n * ```ts\r\n * import { initStudio, queryCollection } from \"nextjs-studio\";\r\n *\r\n * await initStudio();\r\n * const posts = queryCollection(\"posts\").all();\r\n * ```\r\n */\r\nexport async function initStudio(\r\n contentsDir?: string,\r\n config?: StudioConfig,\r\n): Promise<void> {\r\n const dir = contentsDir ?? path.join(process.cwd(), \"contents\");\r\n await loadContent(new FsAdapter(dir), config);\r\n}\r\n\r\n/**\r\n * Returns true if the content store has been initialized.\r\n */\r\nexport function isStudioInitialized(): boolean {\r\n try {\r\n getStore();\r\n return true;\r\n } catch {\r\n return false;\r\n }\r\n}\r\n\r\n/**\r\n * Ensures the content store is initialized. Safe to call multiple times — only\r\n * initializes once. Ideal for use at the top of Next.js server components and\r\n * `generateStaticParams` / `generateMetadata` functions.\r\n *\r\n * @param contentsDir - Path to the contents directory. Defaults to `./contents` relative to cwd.\r\n * @param config - Optional studio config for schemas and scripts.\r\n *\r\n * @example\r\n * ```ts\r\n * import { ensureContentLoaded, queryCollection } from \"nextjs-studio\";\r\n *\r\n * export default async function Page() {\r\n * await ensureContentLoaded();\r\n * const posts = queryCollection(\"posts\");\r\n * // ...\r\n * }\r\n * ```\r\n */\r\nexport async function ensureContentLoaded(\r\n contentsDir?: string,\r\n config?: StudioConfig,\r\n): Promise<void> {\r\n if (!isStudioInitialized()) {\r\n await initStudio(contentsDir, config);\r\n }\r\n}\r\n","/**\n * @context CLI layer — filesystem adapter at src/cli/adapters/fs-adapter.ts\n * @does Implements IFsAdapter; abstracts all file read/write/list operations behind a single interface\n * @depends src/shared/types.ts, src/shared/constants.ts, src/shared/fs-adapter.interface.ts\n * @do Add new I/O operations here; all file access must go through this adapter\n * @dont Import UI components, run HTTP requests, or contain business logic\n */\n\nimport fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport type { Dirent } from \"node:fs\";\nimport type { FileInfo, DirectoryFileEntry } from \"../../shared/types.js\";\nimport type { IFsAdapter } from \"../../shared/fs-adapter.interface.js\";\nimport { SUPPORTED_EXTENSIONS } from \"../../shared/constants.js\";\n\nexport class FsAdapter implements IFsAdapter {\n private readonly basePath: string;\n\n constructor(basePath: string) {\n this.basePath = path.resolve(basePath);\n }\n\n private resolve(...segments: string[]): string {\n return path.resolve(this.basePath, ...segments);\n }\n\n async readFile(filePath: string): Promise<string> {\n return fs.readFile(this.resolve(filePath), \"utf-8\");\n }\n\n async writeFile(filePath: string, content: string): Promise<void> {\n const fullPath = this.resolve(filePath);\n await fs.mkdir(path.dirname(fullPath), { recursive: true });\n await fs.writeFile(fullPath, content, \"utf-8\");\n }\n\n async deleteFile(filePath: string): Promise<void> {\n await fs.unlink(this.resolve(filePath));\n }\n\n async exists(filePath: string): Promise<boolean> {\n try {\n await fs.access(this.resolve(filePath));\n return true;\n } catch {\n return false;\n }\n }\n\n async getStats(filePath: string): Promise<FileInfo> {\n const fullPath = this.resolve(filePath);\n const stats = await fs.stat(fullPath);\n return { path: filePath, size: stats.size, modifiedAt: stats.mtime };\n }\n\n async listFiles(dirPath: string, extensions?: readonly string[]): Promise<string[]> {\n const fullPath = this.resolve(dirPath);\n const filterExts = extensions ?? SUPPORTED_EXTENSIONS;\n\n let entries: Dirent[];\n try {\n entries = await fs.readdir(fullPath, { withFileTypes: true });\n } catch {\n return [];\n }\n\n return entries\n .filter((entry) => entry.isFile() && filterExts.some((ext) => entry.name.endsWith(ext)))\n .map((entry) => this.join(dirPath, entry.name));\n }\n\n async listDirectories(dirPath: string): Promise<string[]> {\n const fullPath = this.resolve(dirPath);\n\n let entries: Dirent[];\n try {\n entries = await fs.readdir(fullPath, { withFileTypes: true });\n } catch {\n return [];\n }\n\n return entries\n .filter((entry) => entry.isDirectory())\n .map((entry) => this.join(dirPath, entry.name));\n }\n\n async readBuffer(filePath: string): Promise<Buffer> {\n return fs.readFile(this.resolve(filePath));\n }\n\n async writeBuffer(filePath: string, data: Buffer): Promise<void> {\n const fullPath = this.resolve(filePath);\n await fs.mkdir(path.dirname(fullPath), { recursive: true });\n await fs.writeFile(fullPath, data);\n }\n\n async listAllFiles(dirPath: string): Promise<DirectoryFileEntry[]> {\n const fullPath = this.resolve(dirPath);\n\n let entries: Dirent[];\n try {\n entries = await fs.readdir(fullPath, { withFileTypes: true });\n } catch {\n return [];\n }\n\n const results: DirectoryFileEntry[] = [];\n for (const entry of entries) {\n if (!entry.isFile()) continue;\n const relativePath = this.join(dirPath, entry.name);\n const stats = await fs.stat(this.resolve(relativePath));\n results.push({ name: entry.name, relativePath, size: stats.size, modifiedAt: stats.mtime });\n }\n return results;\n }\n\n join(...segments: string[]): string {\n return path.join(...segments);\n }\n\n basename(filePath: string): string {\n return path.basename(filePath);\n }\n\n extname(filePath: string): string {\n return path.extname(filePath);\n }\n\n relative(from: string, to: string): string {\n return path.relative(from, to);\n }\n\n normalizeSlug(relativePath: string, ext: string): string {\n return relativePath.replace(ext, \"\").split(path.sep).join(\"/\");\n }\n}\n","/**\n * @context Shared layer — field label utilities at src/shared/field-utils.ts\n * @does Resolves human-readable labels for field definitions and raw key strings\n * @depends src/shared/fields.ts\n * @do Add field-related utility functions here\n * @dont Import from CLI or UI; contain field type definitions or schema logic\n */\n\nimport type { BaseField } from \"./fields.js\";\n\n/**\n * Resolve the human-readable label for a field.\n *\n * When the field definition has an explicit `label`, that is returned as-is.\n * Otherwise the `name` (camelCase / kebab-case / snake_case) is converted to Title Case:\n *\n * @example\n * fieldLabel({ name: \"siteName\", type: \"text\" }) // \"Site Name\"\n * fieldLabel({ name: \"created_at\", type: \"date\" }) // \"Created At\"\n * fieldLabel({ name: \"bio\", type: \"long-text\", label: \"About\" }) // \"About\"\n */\nexport function fieldLabel(field: Pick<BaseField, \"name\" | \"label\">): string {\n if (field.label) return field.label;\n return field.name\n .replace(/[-_](.)/g, (_, c: string) => ` ${c.toUpperCase()}`)\n .replace(/([A-Z])/g, \" $1\")\n .trim()\n .replace(/\\b\\w/g, (c) => c.toUpperCase());\n}\n\n/**\n * Resolve the label for a raw key string (no field definition available).\n * Useful for dynamic keys that have no schema entry.\n */\nexport function keyLabel(name: string): string {\n return fieldLabel({ name });\n}\n"],"mappings":";AAQA,SAAS,QAAQ,SAAS,KAAK,aAAa;;;ACA5C,OAAO,aAAa;;;ACGb,IAAM,uBAAuB,CAAC,QAAQ,OAAO;AAC7C,IAAM,wBAAwB;AAI9B,IAAM,mBAAmB;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEO,IAAM,mBAAmB,CAAC,aAAa,cAAc,WAAW;AAEhE,IAAM,mBAAmB;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEO,IAAM,mBAAmB,CAAC,GAAG,kBAAkB,GAAG,kBAAkB,GAAG,gBAAgB;;;AC5B9F,OAAO,YAAY;AAOZ,SAAS,SAAS,SAA4B;AACnD,QAAM,EAAE,MAAM,SAAS,KAAK,IAAI,OAAO,OAAO;AAC9C,SAAO,EAAE,MAAM,MAAM,KAAK,KAAK,EAAE;AACnC;;;ACEO,SAAS,UAAU,SAA6B;AACrD,QAAM,SAAkB,KAAK,MAAM,OAAO;AAE1C,MAAI,MAAM,QAAQ,MAAM,GAAG;AACzB,WAAO;AAAA,MACL,MAAM;AAAA,MACN,SAAS;AAAA,IACX;AAAA,EACF;AAEA,MAAI,OAAO,WAAW,YAAY,WAAW,MAAM;AACjD,WAAO;AAAA,MACL,MAAM;AAAA,MACN,MAAM;AAAA,IACR;AAAA,EACF;AAEA,QAAM,IAAI,MAAM,yCAAyC;AAC3D;;;AC1BA,IAAM,cAAc;AACpB,IAAM,kBACJ;AACF,IAAM,WAAW;AACjB,IAAM,SAAS;AACf,IAAM,sBAAsB;AAE5B,SAAS,UAAU,OAAwB;AACzC,SAAO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AAQ,IAAI,GAAG,UAAU;AAC9D,QAAM,YAAY,IAAI,UAAU,GAAG,GAAG,MAAM;AAC9C;AAKO,SAAS,sBAA+B;AAC7C,MAAI;AACF,aAAS;AACT,WAAO;AAAA,EACT,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAqBA,eAAsB,oBACpB,aACA,QACe;AACf,MAAI,CAAC,oBAAoB,GAAG;AAC1B,UAAM,WAAW,aAAa,MAAM;AAAA,EACtC;AACF;;;AErDO,SAAS,WAAW,OAAkD;AAC3E,MAAI,MAAM,MAAO,QAAO,MAAM;AAC9B,SAAO,MAAM,KACV,QAAQ,YAAY,CAAC,GAAG,MAAc,IAAI,EAAE,YAAY,CAAC,EAAE,EAC3D,QAAQ,YAAY,KAAK,EACzB,KAAK,EACL,QAAQ,SAAS,CAAC,MAAM,EAAE,YAAY,CAAC;AAC5C;AAMO,SAAS,SAAS,MAAsB;AAC7C,SAAO,WAAW,EAAE,KAAK,CAAC;AAC5B;","names":["path","path"]}
1
+ {"version":3,"sources":["../../src/core/query-builder.ts","../../src/core/indexer.ts","../../src/shared/constants.ts","../../src/core/parsers/parser-mdx.ts","../../src/core/frontmatter-binder.ts","../../src/core/locale-parser.ts","../../src/core/content-store.ts","../../src/core/draft-filter.ts","../../src/shared/field-utils.ts"],"sourcesContent":["/**\n * @context Core layer — query builder at src/core/query-builder.ts\n * @does Provides a fluent API to filter, sort, and paginate content entries from a collection\n * @depends src/shared/types.ts, src/core/content-store.ts\n * @do Add new query capabilities here (e.g. search, groupBy)\n * @dont Import from CLI or UI; access the filesystem; perform I/O\n */\n\nimport { filter, orderBy, get, slice } from \"lodash-es\";\nimport type { QueryOptions, EntryResult } from \"../shared/types.js\";\nimport type { CollectionTypeMap } from \"../shared/types.js\";\nimport { getStore } from \"./content-store.js\";\nimport { isDraft } from \"./draft-filter.js\";\n\n/**\n * Fluent query builder for content collections.\n * Returned by `queryCollection()` — supports both chaining and direct array usage.\n *\n * ```ts\n * Fluent chaining\n * queryCollection(\"blog\").where({ published: true }).sort(\"date\", \"desc\").limit(10).all()\n *\n * Direct array usage — all native JS array methods work\n * queryCollection(\"blog\").slice(0, 5)\n * queryCollection(\"blog\").map(post => post.title)\n * ```\n */\nexport class QueryBuilder<T = Record<string, unknown>> {\n private readonly collectionName: string;\n private options: QueryOptions = {};\n private _excludeDrafts = false;\n private _locale: string | undefined;\n\n constructor(collection: string) {\n this.collectionName = collection;\n }\n\n where(conditions: Record<string, unknown>): this {\n this.options.where = { ...this.options.where, ...conditions };\n return this;\n }\n\n sort(field: string, order: \"asc\" | \"desc\" = \"asc\"): this {\n this.options.sort = { field, order };\n return this;\n }\n\n limit(count: number): this {\n this.options.limit = count;\n return this;\n }\n\n offset(count: number): this {\n this.options.offset = count;\n return this;\n }\n\n excludeDrafts(): this {\n this._excludeDrafts = true;\n return this;\n }\n\n locale(code: string): this {\n this._locale = code;\n return this;\n }\n\n all(): T[] {\n let entries = [...getStore().getCollection(this.collectionName)];\n\n if (this._excludeDrafts) {\n entries = entries.filter((entry) => !isDraft(entry));\n }\n\n if (this._locale) {\n const loc = this._locale;\n entries = entries.filter((entry) => entry.locale === loc);\n }\n\n if (this.options.where) {\n const conditions = this.options.where;\n entries = filter(entries, (entry) =>\n Object.entries(conditions).every(([key, value]) => get(entry.data, key) === value),\n );\n }\n\n if (this.options.sort) {\n const { field, order } = this.options.sort;\n entries = orderBy(entries, [(entry) => get(entry.data, field)], [order]);\n }\n\n const start = this.options.offset ?? 0;\n const end = this.options.limit ? start + this.options.limit : undefined;\n return slice(entries, start, end).map((e) => ({\n collection: e.collection,\n slug: e.slug,\n path: e.path,\n body: e.body,\n locale: e.locale,\n ...e.data,\n }) as unknown as T);\n }\n\n first(): T | undefined {\n return this.limit(1).all()[0];\n }\n\n one(): T {\n const result = this.limit(1).all()[0];\n if (result === undefined) {\n throw new Error(`Collection \"${this.collectionName}\" is empty — expected exactly one entry.`);\n }\n return result;\n }\n\n count(): number {\n return this.all().length;\n }\n}\n\n/** Intersection type: fluent builder + full native Array<T> interface. */\nexport type QueryResult<T> = QueryBuilder<T> & T[];\n\n/**\n * Wraps a QueryBuilder in a Proxy that delegates any unknown property access\n * to the resolved array. The array result is cached and invalidated whenever\n * a fluent method (where/sort/limit/offset) is called.\n */\nconst FLUENT_METHODS = new Set([\"where\", \"sort\", \"limit\", \"offset\", \"excludeDrafts\", \"locale\"]);\n\nfunction wrapWithArrayProxy<T>(builder: QueryBuilder<T>): QueryResult<T> {\n let cache: T[] | null = null;\n\n return new Proxy(builder, {\n get(target, prop, receiver) {\n // Fluent methods: apply on target, invalidate cache, return proxy for chaining\n if (FLUENT_METHODS.has(String(prop))) {\n const method = Reflect.get(target, prop) as (...args: unknown[]) => unknown;\n return (...args: unknown[]) => {\n cache = null;\n method.apply(target, args);\n return receiver;\n };\n }\n\n // Own QueryBuilder methods (all, first, count, etc.)\n if (prop in target) {\n const value = Reflect.get(target, prop, receiver);\n return typeof value === \"function\" ? value.bind(target) : value;\n }\n\n // Delegate everything else (slice, map, filter, length, etc.) to the resolved array\n if (!cache) cache = target.all();\n const value = Reflect.get(cache, prop);\n return typeof value === \"function\" ? value.bind(cache) : value;\n },\n }) as unknown as QueryResult<T>;\n}\n\n/**\n * Entry point for querying a content collection.\n */\nexport function queryCollection<K extends keyof CollectionTypeMap>(\n name: K,\n): QueryResult<EntryResult<CollectionTypeMap[K]>>;\nexport function queryCollection(name: string): QueryResult<EntryResult>;\nexport function queryCollection(name: string): QueryResult<EntryResult> {\n return wrapWithArrayProxy(new QueryBuilder(name));\n}\n","/**\n * @context Core layer — content indexer at src/core/indexer.ts\n * @does Scans the contents directory, parses MDX/JSON files, and builds an in-memory index\n * @depends src/shared/types.ts, src/shared/constants.ts, src/shared/fs-adapter.interface.ts, src/core/parsers/, src/core/schema-inferrer.ts\n * @do Add new file type handling here; extend indexCollection for new collection behaviors\n * @dont Import from CLI or UI; instantiate FsAdapter; access the filesystem directly\n */\n\nimport slugify from \"@sindresorhus/slugify\";\nimport type { CollectionSchema } from \"../shared/fields.js\";\nimport type { ContentEntry, Collection, StudioConfig } from \"../shared/types.js\";\nimport type { IFsAdapter } from \"../shared/fs-adapter.interface.js\";\nimport { COLLECTION_ORDER_FILE } from \"../shared/constants.js\";\nimport { parseMdx } from \"./parsers/parser-mdx.js\";\nimport { parseJson } from \"./parsers/parser-json.js\";\nimport { inferSchema } from \"./schema-inferrer.js\";\nimport { parseLocaleFromFilename, stripLocaleFromSlug } from \"./locale-parser.js\";\n\nexport class ContentIndex {\n private readonly entries = new Map<string, ContentEntry[]>();\n private readonly collections = new Map<string, Collection>();\n private readonly fs: IFsAdapter;\n\n constructor(fsAdapter: IFsAdapter) {\n this.fs = fsAdapter;\n }\n\n async build(config?: StudioConfig): Promise<void> {\n this.clear();\n const dirs = await this.fs.listDirectories(\".\");\n\n for (const dir of dirs) {\n const dirName = this.fs.basename(dir);\n const collectionName = slugify(dirName);\n const collectionConfig = config?.collections?.[collectionName];\n await this.indexCollection(dirName, collectionName, collectionConfig?.schema);\n }\n }\n\n buildSync(config?: StudioConfig): void {\n this.clear();\n const dirs = this.fs.listDirectoriesSync(\".\");\n\n for (const dir of dirs) {\n const dirName = this.fs.basename(dir);\n const collectionName = slugify(dirName);\n const collectionConfig = config?.collections?.[collectionName];\n this.indexCollectionSync(dirName, collectionName, collectionConfig?.schema);\n }\n }\n\n getCollection(name: string): ContentEntry[] {\n return this.entries.get(name) ?? [];\n }\n\n getCollections(): Collection[] {\n return Array.from(this.collections.values());\n }\n\n clear(): void {\n this.entries.clear();\n this.collections.clear();\n }\n\n updateEntry(collectionName: string, entry: ContentEntry): void {\n const entries = this.entries.get(collectionName) ?? [];\n const idx = entries.findIndex((e) => e.slug === entry.slug);\n if (idx >= 0) {\n entries[idx] = entry;\n } else {\n entries.push(entry);\n }\n this.entries.set(collectionName, entries);\n this.updateCollectionMeta(collectionName);\n }\n\n removeEntry(collectionName: string, slug: string): void {\n const entries = this.entries.get(collectionName);\n if (!entries) return;\n const filtered = entries.filter((e) => e.slug !== slug);\n this.entries.set(collectionName, filtered);\n this.updateCollectionMeta(collectionName);\n }\n\n private updateCollectionMeta(collectionName: string): void {\n const col = this.collections.get(collectionName);\n const entries = this.entries.get(collectionName) ?? [];\n if (col) {\n this.collections.set(collectionName, {\n ...col,\n count: entries.length,\n type: this.detectCollectionType(entries),\n });\n }\n }\n\n private async indexCollection(\n dirName: string,\n collectionName: string,\n manualSchema?: CollectionSchema,\n ): Promise<void> {\n const entries: ContentEntry[] = [];\n await this.scanDir(dirName, collectionName, dirName, entries);\n\n const orderPath = this.fs.join(dirName, COLLECTION_ORDER_FILE);\n const ordering = await this.readOrdering(orderPath);\n if (ordering) {\n this.applyOrdering(entries, ordering);\n }\n\n const schema = manualSchema ?? inferSchema(entries, collectionName);\n\n this.entries.set(collectionName, entries);\n this.collections.set(collectionName, {\n name: collectionName,\n type: this.detectCollectionType(entries),\n count: entries.length,\n basePath: dirName,\n schema,\n });\n }\n\n private indexCollectionSync(\n dirName: string,\n collectionName: string,\n manualSchema?: CollectionSchema,\n ): void {\n const entries: ContentEntry[] = [];\n this.scanDirSync(dirName, collectionName, dirName, entries);\n\n const orderPath = this.fs.join(dirName, COLLECTION_ORDER_FILE);\n const ordering = this.readOrderingSync(orderPath);\n if (ordering) {\n this.applyOrdering(entries, ordering);\n }\n\n const schema = manualSchema ?? inferSchema(entries, collectionName);\n\n this.entries.set(collectionName, entries);\n this.collections.set(collectionName, {\n name: collectionName,\n type: this.detectCollectionType(entries),\n count: entries.length,\n basePath: dirName,\n schema,\n });\n }\n\n private async scanDir(\n dirName: string,\n collectionName: string,\n dirPath: string,\n entries: ContentEntry[],\n ): Promise<void> {\n const subDirs = await this.fs.listDirectories(dirPath);\n for (const subDir of subDirs) {\n await this.scanDir(dirName, collectionName, subDir, entries);\n }\n\n const files = await this.fs.listFiles(dirPath);\n for (const filePath of files) {\n const fileName = this.fs.basename(filePath);\n if (fileName === COLLECTION_ORDER_FILE) continue;\n\n const ext = this.fs.extname(fileName);\n const content = await this.fs.readFile(filePath);\n const relativePath = this.fs.relative(dirName, filePath);\n const slug = this.fs\n .normalizeSlug(relativePath, ext)\n .split(\"/\")\n .map((segment) => slugify(segment))\n .join(\"/\");\n\n if (ext === \".mdx\") {\n entries.push(this.buildMdxEntry(collectionName, slug, fileName, content));\n } else if (ext === \".json\") {\n entries.push(...this.buildJsonEntries(collectionName, slug, content));\n }\n }\n }\n\n private scanDirSync(\n dirName: string,\n collectionName: string,\n dirPath: string,\n entries: ContentEntry[],\n ): void {\n const subDirs = this.fs.listDirectoriesSync(dirPath);\n for (const subDir of subDirs) {\n this.scanDirSync(dirName, collectionName, subDir, entries);\n }\n\n const files = this.fs.listFilesSync(dirPath);\n for (const filePath of files) {\n const fileName = this.fs.basename(filePath);\n if (fileName === COLLECTION_ORDER_FILE) continue;\n\n const ext = this.fs.extname(fileName);\n const content = this.fs.readFileSync(filePath);\n const relativePath = this.fs.relative(dirName, filePath);\n const slug = this.fs\n .normalizeSlug(relativePath, ext)\n .split(\"/\")\n .map((segment) => slugify(segment))\n .join(\"/\");\n\n if (ext === \".mdx\") {\n entries.push(this.buildMdxEntry(collectionName, slug, fileName, content));\n } else if (ext === \".json\") {\n entries.push(...this.buildJsonEntries(collectionName, slug, content));\n }\n }\n }\n\n private buildMdxEntry(collectionName: string, slug: string, fileName: string, content: string): ContentEntry {\n const parsed = parseMdx(content);\n const locale = parseLocaleFromFilename(fileName);\n const normalizedSlug = stripLocaleFromSlug(slug, locale);\n return {\n collection: collectionName,\n slug: normalizedSlug,\n path: `/${collectionName}/${normalizedSlug}`,\n body: parsed.body,\n data: parsed.data,\n ...(locale ? { locale } : {}),\n };\n }\n\n private buildJsonEntries(collectionName: string, slug: string, content: string): ContentEntry[] {\n const parsed = parseJson(content);\n\n if (parsed.type === \"json-array\") {\n return parsed.entries.map((data, index) => {\n const entrySlug =\n typeof data[\"slug\"] === \"string\" ? slugify(data[\"slug\"]) : `${slug}/${index}`;\n return {\n collection: collectionName,\n slug: entrySlug,\n path: `/${collectionName}/${entrySlug}`,\n data,\n };\n });\n }\n\n return [{ collection: collectionName, slug, path: `/${collectionName}/${slug}`, data: parsed.data }];\n }\n\n private async readOrdering(orderPath: string): Promise<string[] | null> {\n if (!(await this.fs.exists(orderPath))) return null;\n\n try {\n const content = await this.fs.readFile(orderPath);\n const parsed: unknown = JSON.parse(content);\n if (Array.isArray(parsed)) return parsed as string[];\n } catch (error) {\n console.warn(`[Nextjs Studio] Failed to parse ordering file: ${orderPath}`, error);\n }\n return null;\n }\n\n private readOrderingSync(orderPath: string): string[] | null {\n if (!this.fs.existsSync(orderPath)) return null;\n\n try {\n const content = this.fs.readFileSync(orderPath);\n const parsed: unknown = JSON.parse(content);\n if (Array.isArray(parsed)) return parsed as string[];\n } catch (error) {\n console.warn(`[Nextjs Studio] Failed to parse ordering file: ${orderPath}`, error);\n }\n return null;\n }\n\n private applyOrdering(entries: ContentEntry[], ordering: string[]): void {\n const orderMap = new Map(ordering.map((slug, index) => [slug, index]));\n entries.sort((a, b) => {\n const aIndex = orderMap.get(a.slug) ?? Infinity;\n const bIndex = orderMap.get(b.slug) ?? Infinity;\n return aIndex - bIndex;\n });\n }\n\n private detectCollectionType(entries: ContentEntry[]): Collection[\"type\"] {\n if (entries.length === 0) return \"mdx\";\n const first = entries[0];\n if (first.body !== undefined) return \"mdx\";\n if (entries.length === 1 && !first.slug.includes(\"/\")) return \"json-object\";\n return \"json-array\";\n }\n}\n","/**\n * @context Shared layer — constants at src/shared/constants.ts\n * @does Defines project-wide constants shared across core, CLI, and UI layers\n * @depends none\n * @do Add new shared constants here\n * @dont Import from CLI or UI; constants must be framework-agnostic\n */\n\nexport const CONTENTS_DIR = \"contents\";\nexport const CLI_PORT = 3030;\nexport const CONFIG_FILE = \"studio.config.ts\";\nexport const CONFIG_FILENAMES = [\"studio.config.ts\", \"studio.config.js\", \"studio.config.mjs\"] as const;\nexport const SUPPORTED_EXTENSIONS = [\".mdx\", \".json\"] as const;\nexport const COLLECTION_ORDER_FILE = \"collection.json\";\nexport const WATCHER_DEBOUNCE_MS = 5_000;\nexport const MEDIA_DIR = \"media\";\n\nexport const IMAGE_MIME_TYPES = [\n \"image/png\",\n \"image/jpeg\",\n \"image/gif\",\n \"image/webp\",\n \"image/svg+xml\",\n \"image/avif\",\n] as const;\n\nexport const VIDEO_MIME_TYPES = [\"video/mp4\", \"video/webm\", \"video/ogg\"] as const;\n\nexport const AUDIO_MIME_TYPES = [\n \"audio/mpeg\",\n \"audio/ogg\",\n \"audio/wav\",\n \"audio/webm\",\n \"audio/aac\",\n \"audio/flac\",\n] as const;\n\nexport const MEDIA_MIME_TYPES = [...IMAGE_MIME_TYPES, ...VIDEO_MIME_TYPES, ...AUDIO_MIME_TYPES] as const;\n\nexport const IMAGE_EXTENSIONS = [\".png\", \".jpg\", \".jpeg\", \".gif\", \".webp\", \".svg\", \".avif\"] as const;\nexport const VIDEO_EXTENSIONS = [\".mp4\", \".webm\", \".ogv\"] as const;\nexport const AUDIO_EXTENSIONS = [\".mp3\", \".ogg\", \".wav\", \".m4a\", \".aac\", \".flac\"] as const;\n","/**\n * @context Core layer — MDX parser/serializer at src/core/parsers/parser-mdx.ts\n * @does Parses .mdx content into frontmatter + body, and serializes them back to MDX strings\n * @depends none (gray-matter is an external dep)\n * @do Add MDX transform steps here; both parse and serialize live here intentionally\n * @dont Access the filesystem; import from CLI or UI; handle JSON content\n */\n\nimport matter from \"gray-matter\";\nimport { bindFrontmatter } from \"../frontmatter-binder.js\";\n\nexport interface ParsedMdx {\n data: Record<string, unknown>;\n body: string;\n}\n\nexport interface ParseMdxOptions {\n /** When true, replaces {frontmatter.X} tokens in the body with actual values. */\n bindTokens?: boolean;\n}\n\n/** Convert Date objects produced by gray-matter back to ISO strings. */\nfunction normalizeDates(data: Record<string, unknown>): Record<string, unknown> {\n const result: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(data)) {\n if (value instanceof Date) {\n result[key] = value.toISOString().split(\"T\")[0];\n } else if (typeof value === \"object\" && value !== null && !Array.isArray(value)) {\n result[key] = normalizeDates(value as Record<string, unknown>);\n } else {\n result[key] = value;\n }\n }\n return result;\n}\n\nexport function parseMdx(content: string, options?: ParseMdxOptions): ParsedMdx {\n const { data: rawData, content: body } = matter(content);\n const data = normalizeDates(rawData);\n const trimmed = body.trim();\n return {\n data,\n body: options?.bindTokens ? bindFrontmatter(trimmed, data) : trimmed,\n };\n}\n\nexport function serializeMdx(data: Record<string, unknown>, body: string): string {\n return matter.stringify(body, data);\n}\n","/**\n * @context Core layer — frontmatter binder at src/core/frontmatter-binder.ts\n * @does Replaces {frontmatter.X} tokens in MDX body with actual frontmatter values\n * @depends none\n * @do Add new token patterns or transformation rules here\n * @dont Import from CLI or UI; access filesystem\n */\n\nconst TOKEN_REGEX = /\\{frontmatter\\.([a-zA-Z0-9_.]+)\\}/g;\n\n/**\n * Replaces `{frontmatter.X}` tokens in the body with values from the data object.\n * Supports dot-notation for nested values (e.g. `{frontmatter.author.name}`).\n */\nexport function bindFrontmatter(body: string, data: Record<string, unknown>): string {\n return body.replace(TOKEN_REGEX, (_match, path: string) => {\n const value = resolvePath(data, path);\n if (value === undefined || value === null) return _match;\n if (typeof value === \"object\") return JSON.stringify(value);\n return String(value);\n });\n}\n\n/**\n * Extracts all frontmatter token paths from the body.\n */\nexport function extractFrontmatterTokens(body: string): string[] {\n const tokens: string[] = [];\n let match: RegExpExecArray | null;\n const regex = new RegExp(TOKEN_REGEX.source, \"g\");\n while ((match = regex.exec(body)) !== null) {\n tokens.push(match[1]!);\n }\n return tokens;\n}\n\nfunction resolvePath(obj: Record<string, unknown>, path: string): unknown {\n const keys = path.split(\".\");\n let current: unknown = obj;\n for (const key of keys) {\n if (typeof current !== \"object\" || current === null) return undefined;\n current = (current as Record<string, unknown>)[key];\n }\n return current;\n}\n","/**\n * @context Core layer — locale parser at src/core/locale-parser.ts\n * @does Extracts locale codes from filenames using the convention `slug.locale.mdx`\n * @depends none\n * @do Add new locale detection strategies here\n * @dont Import from CLI or UI; access filesystem\n */\n\nconst LOCALE_REGEX = /\\.([a-z]{2}(?:-[A-Z]{2})?)\\.mdx$/;\n\n/**\n * Parses locale from a filename.\n * Supports `post.pt.mdx`, `post.en-US.mdx` patterns.\n * Returns undefined for files without a locale suffix.\n */\nexport function parseLocaleFromFilename(filename: string): string | undefined {\n const match = LOCALE_REGEX.exec(filename);\n return match?.[1];\n}\n\n/**\n * Removes the locale suffix from a slug.\n * Handles both pre-slugify (`.pt`) and post-slugify (`-pt`) formats,\n * since `@sindresorhus/slugify` converts dots to dashes.\n * `post.pt` → `post`, `post-pt` → `post`, `post` → `post`\n */\nexport function stripLocaleFromSlug(slug: string, locale?: string): string {\n if (!locale) return slug;\n const dotSuffix = `.${locale}`;\n if (slug.endsWith(dotSuffix)) return slug.slice(0, -dotSuffix.length);\n const dashSuffix = `-${locale}`;\n if (slug.endsWith(dashSuffix)) return slug.slice(0, -dashSuffix.length);\n return slug;\n}\n","/**\n * @context Core layer — content store at src/core/content-store.ts\n * @does Manages a singleton ContentIndex; exposes loadContent() and getStore() for consumers\n * @depends src/core/indexer.ts, src/shared/types.ts\n * @do Use this as the single access point for in-memory indexed content\n * @dont Import from CLI or UI; contain parsing or I/O logic; import fs-adapter at top level\n */\n\nimport type { IFsAdapter } from \"../shared/fs-adapter.interface.js\";\nimport type { StudioConfig } from \"../shared/types.js\";\nimport { ContentIndex } from \"./indexer.js\";\n\nlet store: ContentIndex | null = null;\n\nexport function getStore(): ContentIndex {\n if (!store) {\n throw new Error(\n \"Content not loaded. Auto-init requires 'nextjs-studio/server' — \" +\n \"use loadContentSync() in a server context, or queryCollection() \" +\n \"will auto-init when imported from 'nextjs-studio/server'.\",\n );\n }\n return store;\n}\n\nexport function setStore(index: ContentIndex): void {\n store = index;\n}\n\nexport function hasStore(): boolean {\n return store !== null;\n}\n\nexport async function loadContent(\n fsAdapter: IFsAdapter,\n config?: StudioConfig,\n): Promise<ContentIndex> {\n const index = new ContentIndex(fsAdapter);\n await index.build(config);\n store = index;\n return index;\n}\n\nexport function loadContentSync(\n fsAdapter: IFsAdapter,\n config?: StudioConfig,\n): ContentIndex {\n const index = new ContentIndex(fsAdapter);\n index.buildSync(config);\n store = index;\n return index;\n}\n","/**\n * @context Core layer — draft filter at src/core/draft-filter.ts\n * @does Provides utilities to detect and filter draft content entries\n * @depends src/shared/types.ts\n * @do Add new draft detection heuristics here\n * @dont Import from CLI or UI; access filesystem\n */\n\nimport type { ContentEntry } from \"../shared/types.js\";\n\nexport function isDraft(entry: ContentEntry): boolean {\n return entry.data.draft === true;\n}\n\nexport function filterDrafts(entries: ContentEntry[]): ContentEntry[] {\n return entries.filter((entry) => !isDraft(entry));\n}\n","/**\n * @context Shared layer — field label utilities at src/shared/field-utils.ts\n * @does Resolves human-readable labels for field definitions and raw key strings\n * @depends src/shared/fields.ts\n * @do Add field-related utility functions here\n * @dont Import from CLI or UI; contain field type definitions or schema logic\n */\n\nimport type { BaseField } from \"./fields.js\";\n\n/**\n * Resolve the human-readable label for a field.\n *\n * When the field definition has an explicit `label`, that is returned as-is.\n * Otherwise the `name` (camelCase / kebab-case / snake_case) is converted to Title Case:\n *\n * @example\n * fieldLabel({ name: \"siteName\", type: \"text\" }) // \"Site Name\"\n * fieldLabel({ name: \"created_at\", type: \"date\" }) // \"Created At\"\n * fieldLabel({ name: \"bio\", type: \"long-text\", label: \"About\" }) // \"About\"\n */\nexport function fieldLabel(field: Pick<BaseField, \"name\" | \"label\">): string {\n if (field.label) return field.label;\n return field.name\n .replace(/[-_](.)/g, (_, c: string) => ` ${c.toUpperCase()}`)\n .replace(/([A-Z])/g, \" $1\")\n .trim()\n .replace(/\\b\\w/g, (c) => c.toUpperCase());\n}\n\n/**\n * Resolve the label for a raw key string (no field definition available).\n * Useful for dynamic keys that have no schema entry.\n */\nexport function keyLabel(name: string): string {\n return fieldLabel({ name });\n}\n"],"mappings":";AAQA,SAAS,QAAQ,SAAS,KAAK,aAAa;;;ACA5C,OAAO,aAA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AO,WAAW,EAAE,KAAK,CAAC;AAC5B;","names":["value"]}
@@ -0,0 +1,135 @@
1
+ import { v as FileInfo, w as DirectoryFileEntry, t as StudioConfig, C as ContentEntry, n as Collection } from '../query-builder-KXz9cPzF.js';
2
+ export { o as CollectionConfig, p as CollectionTypeMap, Q as QueryOptions, s as QueryResult, u as queryCollection } from '../query-builder-KXz9cPzF.js';
3
+
4
+ /**
5
+ * @context Shared layer — FS adapter interface at src/shared/fs-adapter.interface.ts
6
+ * @does Defines the IFsAdapter contract so Core can perform I/O without depending on CLI
7
+ * @depends src/shared/types.ts
8
+ * @do Add new I/O methods here when Core needs them; keep the interface minimal
9
+ * @dont Import from CLI or UI; contain implementation logic
10
+ */
11
+
12
+ interface IFsAdapter {
13
+ readFile(filePath: string): Promise<string>;
14
+ writeFile(filePath: string, content: string): Promise<void>;
15
+ deleteFile(filePath: string): Promise<void>;
16
+ exists(filePath: string): Promise<boolean>;
17
+ getStats(filePath: string): Promise<FileInfo>;
18
+ listFiles(dirPath: string, extensions?: readonly string[]): Promise<string[]>;
19
+ listDirectories(dirPath: string): Promise<string[]>;
20
+ readBuffer(filePath: string): Promise<Buffer>;
21
+ writeBuffer(filePath: string, data: Buffer): Promise<void>;
22
+ listAllFiles(dirPath: string): Promise<DirectoryFileEntry[]>;
23
+ join(...segments: string[]): string;
24
+ basename(filePath: string): string;
25
+ extname(filePath: string): string;
26
+ relative(from: string, to: string): string;
27
+ normalizeSlug(relativePath: string, ext: string): string;
28
+ readFileSync(filePath: string): string;
29
+ existsSync(filePath: string): boolean;
30
+ listFilesSync(dirPath: string, extensions?: readonly string[]): string[];
31
+ listDirectoriesSync(dirPath: string): string[];
32
+ }
33
+
34
+ /**
35
+ * @context Core layer — filesystem adapter at src/core/fs-adapter.ts
36
+ * @does Implements IFsAdapter; abstracts all file read/write/list operations behind a single interface
37
+ * @depends src/shared/types.ts, src/shared/constants.ts, src/shared/fs-adapter.interface.ts
38
+ * @do Add new I/O operations here; all file access must go through this adapter
39
+ * @dont Import UI components, run HTTP requests, or contain business logic
40
+ */
41
+
42
+ declare class FsAdapter implements IFsAdapter {
43
+ private readonly basePath;
44
+ constructor(basePath: string);
45
+ private resolve;
46
+ readFile(filePath: string): Promise<string>;
47
+ writeFile(filePath: string, content: string): Promise<void>;
48
+ deleteFile(filePath: string): Promise<void>;
49
+ exists(filePath: string): Promise<boolean>;
50
+ getStats(filePath: string): Promise<FileInfo>;
51
+ listFiles(dirPath: string, extensions?: readonly string[]): Promise<string[]>;
52
+ listDirectories(dirPath: string): Promise<string[]>;
53
+ readBuffer(filePath: string): Promise<Buffer>;
54
+ writeBuffer(filePath: string, data: Buffer): Promise<void>;
55
+ listAllFiles(dirPath: string): Promise<DirectoryFileEntry[]>;
56
+ join(...segments: string[]): string;
57
+ basename(filePath: string): string;
58
+ extname(filePath: string): string;
59
+ relative(from: string, to: string): string;
60
+ normalizeSlug(relativePath: string, ext: string): string;
61
+ readFileSync(filePath: string): string;
62
+ existsSync(filePath: string): boolean;
63
+ listFilesSync(dirPath: string, extensions?: readonly string[]): string[];
64
+ listDirectoriesSync(dirPath: string): string[];
65
+ }
66
+
67
+ /**
68
+ * @context Core layer — content indexer at src/core/indexer.ts
69
+ * @does Scans the contents directory, parses MDX/JSON files, and builds an in-memory index
70
+ * @depends src/shared/types.ts, src/shared/constants.ts, src/shared/fs-adapter.interface.ts, src/core/parsers/, src/core/schema-inferrer.ts
71
+ * @do Add new file type handling here; extend indexCollection for new collection behaviors
72
+ * @dont Import from CLI or UI; instantiate FsAdapter; access the filesystem directly
73
+ */
74
+
75
+ declare class ContentIndex {
76
+ private readonly entries;
77
+ private readonly collections;
78
+ private readonly fs;
79
+ constructor(fsAdapter: IFsAdapter);
80
+ build(config?: StudioConfig): Promise<void>;
81
+ buildSync(config?: StudioConfig): void;
82
+ getCollection(name: string): ContentEntry[];
83
+ getCollections(): Collection[];
84
+ clear(): void;
85
+ updateEntry(collectionName: string, entry: ContentEntry): void;
86
+ removeEntry(collectionName: string, slug: string): void;
87
+ private updateCollectionMeta;
88
+ private indexCollection;
89
+ private indexCollectionSync;
90
+ private scanDir;
91
+ private scanDirSync;
92
+ private buildMdxEntry;
93
+ private buildJsonEntries;
94
+ private readOrdering;
95
+ private readOrderingSync;
96
+ private applyOrdering;
97
+ private detectCollectionType;
98
+ }
99
+
100
+ /**
101
+ * @context Core layer — content store at src/core/content-store.ts
102
+ * @does Manages a singleton ContentIndex; exposes loadContent() and getStore() for consumers
103
+ * @depends src/core/indexer.ts, src/shared/types.ts
104
+ * @do Use this as the single access point for in-memory indexed content
105
+ * @dont Import from CLI or UI; contain parsing or I/O logic; import fs-adapter at top level
106
+ */
107
+
108
+ declare function loadContent(fsAdapter: IFsAdapter, config?: StudioConfig): Promise<ContentIndex>;
109
+ declare function loadContentSync(fsAdapter: IFsAdapter, config?: StudioConfig): ContentIndex;
110
+
111
+ /**
112
+ * @context Core layer — config loader at src/core/config-loader.ts
113
+ * @does Resolves and loads studio.config.ts/.js from the project root using dynamic import
114
+ * @depends src/shared/constants.ts, src/shared/types.ts
115
+ * @do Add new config resolution strategies or validation here
116
+ * @dont Import from CLI or UI; access content files
117
+ */
118
+
119
+ /**
120
+ * Resolves the config file path from the project root.
121
+ * Returns undefined if no config file is found.
122
+ */
123
+ declare function resolveConfigPath(projectRoot: string): string | undefined;
124
+ /**
125
+ * Loads the studio config from the project root.
126
+ * Tries CONFIG_FILENAMES in order, uses dynamic import().
127
+ * Returns empty config if no file found or loading fails.
128
+ */
129
+ declare function loadStudioConfig(projectRoot: string): Promise<StudioConfig>;
130
+ /**
131
+ * Loads config from a specific file path.
132
+ */
133
+ declare function loadConfigFromPath(configPath: string): Promise<StudioConfig>;
134
+
135
+ export { Collection, ContentEntry, ContentIndex, FsAdapter, StudioConfig, loadConfigFromPath, loadContent, loadContentSync, loadStudioConfig, resolveConfigPath };