nextjs-studio 0.3.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (238) hide show
  1. package/README.md +3 -1
  2. package/dist/bin/nextjs-studio.js +315 -54
  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/cli/ui/next.config.js +1 -0
  230. package/dist/cli/ui/package.json +4 -0
  231. package/dist/core/index.d.ts +34 -356
  232. package/dist/core/index.js +112 -332
  233. package/dist/core/index.js.map +1 -1
  234. package/dist/core/server.d.ts +135 -0
  235. package/dist/core/server.js +707 -0
  236. package/dist/core/server.js.map +1 -0
  237. package/dist/query-builder-KXz9cPzF.d.ts +330 -0
  238. package/package.json +32 -11
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/core/server.ts","../../src/shared/constants.ts","../../src/core/fs-adapter.ts","../../src/core/indexer.ts","../../src/core/parsers/parser-mdx.ts","../../src/core/frontmatter-binder.ts","../../src/core/parsers/parser-json.ts","../../src/core/schema-inferrer.ts","../../src/core/locale-parser.ts","../../src/core/content-store.ts","../../src/core/config-loader.ts","../../src/core/query-builder.ts","../../src/core/draft-filter.ts"],"sourcesContent":["/**\n * @context Core layer — server entry point at src/core/server.ts\n * @does Re-exports server-only APIs and auto-initializes the content store\n * @depends src/core/fs-adapter.ts, src/core/content-store.ts\n * @do Import from 'nextjs-studio/server' in Next.js server components\n * @dont Import from client components\n */\n\nimport path from \"node:path\";\nimport { CONTENTS_DIR } from \"../shared/constants.js\";\nimport { FsAdapter } from \"./fs-adapter.js\";\nimport { ContentIndex } from \"./indexer.js\";\nimport { hasStore, setStore } from \"./content-store.js\";\n\n// Auto-initialize the content store synchronously on import\nif (!hasStore()) {\n const dir = path.join(process.cwd(), CONTENTS_DIR);\n const index = new ContentIndex(new FsAdapter(dir));\n index.buildSync();\n setStore(index);\n}\n\nexport { FsAdapter } from \"./fs-adapter.js\";\nexport { ContentIndex } from \"./indexer.js\";\nexport { loadContent, loadContentSync } from \"./content-store.js\";\nexport { loadStudioConfig, resolveConfigPath, loadConfigFromPath } from \"./config-loader.js\";\nexport { queryCollection } from \"./query-builder.js\";\n\nexport type {\n ContentEntry,\n Collection,\n CollectionTypeMap,\n StudioConfig,\n CollectionConfig,\n QueryOptions,\n} from \"../shared/types.js\";\n\nexport type { QueryResult } from \"./query-builder.js\";\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 — filesystem adapter at src/core/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 fsSync from \"node:fs\";\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 readFileSync(filePath: string): string {\n return fsSync.readFileSync(this.resolve(filePath), \"utf-8\");\n }\n\n existsSync(filePath: string): boolean {\n return fsSync.existsSync(this.resolve(filePath));\n }\n\n listFilesSync(dirPath: string, extensions?: readonly string[]): string[] {\n const fullPath = this.resolve(dirPath);\n const filterExts = extensions ?? SUPPORTED_EXTENSIONS;\n\n let entries: Dirent[];\n try {\n entries = fsSync.readdirSync(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 listDirectoriesSync(dirPath: string): string[] {\n const fullPath = this.resolve(dirPath);\n\n let entries: Dirent[];\n try {\n entries = fsSync.readdirSync(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","/**\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 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 — 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;\nconst RICH_TEXT_FIELD_NAMES = [\"description\", \"descriptions\", \"text\", \"content\"];\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 // Fields with well-known names are always treated as long/rich text\n if (RICH_TEXT_FIELD_NAMES.includes(name.toLowerCase())) return { name, type: \"long-text\" };\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 — 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 — config loader at src/core/config-loader.ts\n * @does Resolves and loads studio.config.ts/.js from the project root using dynamic import\n * @depends src/shared/constants.ts, src/shared/types.ts\n * @do Add new config resolution strategies or validation here\n * @dont Import from CLI or UI; access content files\n */\n\nimport { existsSync } from \"node:fs\";\nimport path from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\nimport type { StudioConfig } from \"../shared/types.js\";\nimport { CONFIG_FILENAMES } from \"../shared/constants.js\";\n\n/**\n * Resolves the config file path from the project root.\n * Returns undefined if no config file is found.\n */\nexport function resolveConfigPath(projectRoot: string): string | undefined {\n for (const filename of CONFIG_FILENAMES) {\n const fullPath = path.resolve(projectRoot, filename);\n if (existsSync(fullPath)) return fullPath;\n }\n return undefined;\n}\n\n/**\n * Loads the studio config from the project root.\n * Tries CONFIG_FILENAMES in order, uses dynamic import().\n * Returns empty config if no file found or loading fails.\n */\nexport async function loadStudioConfig(projectRoot: string): Promise<StudioConfig> {\n const configPath = resolveConfigPath(projectRoot);\n if (!configPath) return {};\n\n return loadConfigFromPath(configPath);\n}\n\n/**\n * Loads config from a specific file path.\n */\nexport async function loadConfigFromPath(configPath: string): Promise<StudioConfig> {\n try {\n const fileUrl = pathToFileURL(configPath).href;\n const mod = await import(/* webpackIgnore: true */ fileUrl);\n const config = mod.default ?? mod.config ?? mod;\n\n if (typeof config !== \"object\" || config === null || Array.isArray(config)) {\n return {};\n }\n\n return config as StudioConfig;\n } catch {\n return {};\n }\n}\n","/**\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 — 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"],"mappings":";AAQA,OAAOA,WAAU;;;ACAV,IAAM,eAAe;AAGrB,IAAM,mBAAmB,CAAC,oBAAoB,oBAAoB,mBAAmB;AACrF,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;;;AC7B9F,OAAO,QAAQ;AACf,OAAO,YAAY;AACnB,OAAO,UAAU;AAMV,IAAM,YAAN,MAAsC;AAAA,EAC1B;AAAA,EAEjB,YAAY,UAAkB;AAC5B,SAAK,WAAW,KAAK,QAAQ,QAAQ;AAAA,EACvC;AAAA,EAEQ,WAAW,UAA4B;AAC7C,WAAO,KAAK,QAAQ,KAAK,UAAU,GAAG,QAAQ;AAAA,EAChD;AAAA,EAEA,MAAM,SAAS,UAAmC;AAChD,WAAO,GAAG,SAAS,KAAK,QAAQ,QAAQ,GAAG,OAAO;AAAA,EACpD;AAAA,EAEA,MAAM,UAAU,UAAkB,SAAgC;AAChE,UAAM,WAAW,KAAK,QAAQ,QAAQ;AACtC,UAAM,GAAG,MAAM,KAAK,QAAQ,QAAQ,GAAG,EAAE,WAAW,KAAK,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,IAAI,CAAC,GAAG;AACpC,cAAM,SAAS,QAAQ,IAAI,QAAQ,IAAI;AACvC,eAAO,IAAI,SAAoB;AAC7B,kBAAQ;AACR,iBAAO,MAAM,QAAQ,IAAI;AACzB,iBAAO;AAAA,QACT;AAAA,MACF;AAGA,UAAI,QAAQ,QAAQ;AAClB,cAAMC,SAAQ,QAAQ,IAAI,QAAQ,MAAM,QAAQ;AAChD,eAAO,OAAOA,WAAU,aAAaA,OAAM,KAAK,MAAM,IAAIA;AAAA,MAC5D;AAGA,UAAI,CAAC,MAAO,SAAQ,OAAO,IAAI;AAC/B,YAAM,QAAQ,QAAQ,IAAI,OAAO,IAAI;AACrC,aAAO,OAAO,UAAU,aAAa,MAAM,KAAK,KAAK,IAAI;AAAA,IAC3D;AAAA,EACF,CAAC;AACH;AASO,SAAS,gBAAgB,MAAwC;AACtE,SAAO,mBAAmB,IAAI,aAAa,IAAI,CAAC;AAClD;;;AXzJA,IAAI,CAAC,SAAS,GAAG;AACf,QAAM,MAAMC,MAAK,KAAK,QAAQ,IAAI,GAAG,YAAY;AACjD,QAAM,QAAQ,IAAI,aAAa,IAAI,UAAU,GAAG,CAAC;AACjD,QAAM,UAAU;AAChB,WAAS,KAAK;AAChB;","names":["path","path","path","path","path","value","path"]}
@@ -0,0 +1,330 @@
1
+ /**
2
+ * @context Shared layer — field type system at src/shared/fields.ts
3
+ * @does Defines every field interface, the FieldDefinition union, and CollectionSchema
4
+ * @depends none
5
+ * @do Add new field types here; the UI and type-generator derive behavior from this shape
6
+ * @dont Import from CLI or UI; contain runtime logic beyond fieldLabel utilities
7
+ */
8
+ declare const __brand: unique symbol;
9
+ type Brand<T, B extends string> = T & {
10
+ readonly [__brand]: B;
11
+ };
12
+ type Email = Brand<string, "Email">;
13
+ type HttpUrl = Brand<string, "HttpUrl">;
14
+ type ISODate = Brand<string, "ISODate">;
15
+ type MediaPath = Brand<string, "MediaPath">;
16
+ type ID = Brand<string, "ID">;
17
+ type Slug = Brand<string, "Slug">;
18
+ interface SelectOption {
19
+ label: string;
20
+ value: string;
21
+ color?: string;
22
+ }
23
+ interface StatusOption {
24
+ label: string;
25
+ value: string;
26
+ /** Semantic color bucket — maps to a badge color in the editor. */
27
+ color?: "gray" | "red" | "yellow" | "green" | "blue" | "purple";
28
+ }
29
+ interface BaseField {
30
+ /** Machine-readable key used in the data object / JSON key. */
31
+ name: string;
32
+ /** Human-readable label shown in the editor. Defaults to `name`. */
33
+ label?: string;
34
+ /** Whether the field must have a non-empty value. */
35
+ required?: boolean;
36
+ /** Helper text shown below the input in the editor. */
37
+ description?: string;
38
+ /** Default value used when creating a new entry. */
39
+ defaultValue?: unknown;
40
+ }
41
+ interface TextField extends BaseField {
42
+ type: "text";
43
+ placeholder?: string;
44
+ maxLength?: number;
45
+ }
46
+ interface LongTextField extends BaseField {
47
+ type: "long-text";
48
+ placeholder?: string;
49
+ /** Minimum visible rows in the textarea. */
50
+ rows?: number;
51
+ }
52
+ interface NumberField extends BaseField {
53
+ type: "number";
54
+ format?: "integer" | "decimal";
55
+ min?: number;
56
+ max?: number;
57
+ step?: number;
58
+ }
59
+ interface BooleanField extends BaseField {
60
+ type: "boolean";
61
+ defaultValue?: boolean;
62
+ }
63
+ interface DateField extends BaseField {
64
+ type: "date";
65
+ /**
66
+ * When `true` the editor renders a datetime-picker (date + time).
67
+ * When `false` or omitted it renders a date-only picker.
68
+ */
69
+ includeTime?: boolean;
70
+ }
71
+ interface SelectField extends BaseField {
72
+ type: "select";
73
+ options: SelectOption[];
74
+ defaultValue?: string;
75
+ }
76
+ interface MultiSelectField extends BaseField {
77
+ type: "multi-select";
78
+ options: SelectOption[];
79
+ defaultValue?: string[];
80
+ }
81
+ interface UrlField extends BaseField {
82
+ type: "url";
83
+ placeholder?: string;
84
+ }
85
+ interface EmailField extends BaseField {
86
+ type: "email";
87
+ placeholder?: string;
88
+ }
89
+ interface MediaField extends BaseField {
90
+ type: "media";
91
+ /** Accepted MIME types or extensions, e.g. `["image/*"]`. */
92
+ accept?: string[];
93
+ }
94
+ interface ObjectField extends BaseField {
95
+ type: "object";
96
+ /** Nested field definitions rendered as a form. */
97
+ fields: FieldDefinition[];
98
+ }
99
+ interface ArrayField extends BaseField {
100
+ type: "array";
101
+ /** Shape of each item in the array — rendered as a sheet (table). */
102
+ itemFields: FieldDefinition[];
103
+ }
104
+ interface IdField extends BaseField {
105
+ type: "id";
106
+ /** Strategy for auto-generating IDs. Defaults to `"nanoid"`. */
107
+ generate?: "uuid" | "nanoid" | "cuid";
108
+ }
109
+ interface SlugField extends BaseField {
110
+ type: "slug";
111
+ /** Name of the field whose value is used as the slug source. */
112
+ from: string;
113
+ }
114
+ interface RelationField extends BaseField {
115
+ type: "relation";
116
+ /** Target collection name. */
117
+ collection: string;
118
+ /** Allow selecting multiple entries. */
119
+ multiple?: boolean;
120
+ }
121
+ interface FormulaField extends BaseField {
122
+ type: "formula";
123
+ /**
124
+ * Expression string evaluated at read time.
125
+ * Syntax TBD — placeholder for v2.
126
+ */
127
+ expression: string;
128
+ /** TypeScript type that the expression produces. Used by the type generator. */
129
+ resultType?: "string" | "number" | "boolean";
130
+ }
131
+ interface StatusField extends BaseField {
132
+ type: "status";
133
+ options: StatusOption[];
134
+ defaultValue?: string;
135
+ }
136
+ interface CreatedTimeField extends BaseField {
137
+ type: "created-time";
138
+ }
139
+ interface UpdatedTimeField extends BaseField {
140
+ type: "updated-time";
141
+ }
142
+ type FieldDefinition = TextField | LongTextField | NumberField | BooleanField | DateField | SelectField | MultiSelectField | UrlField | EmailField | MediaField | ObjectField | ArrayField | IdField | SlugField | RelationField | FormulaField | StatusField | CreatedTimeField | UpdatedTimeField;
143
+ type FieldType = FieldDefinition["type"];
144
+ interface CollectionSchema {
145
+ /** Collection name — must match the folder name under /contents. */
146
+ collection: string;
147
+ /**
148
+ * Human-readable label for the collection.
149
+ * Defaults to the collection name with title case.
150
+ */
151
+ label?: string;
152
+ /** Field definitions that describe the shape of each entry. */
153
+ fields: FieldDefinition[];
154
+ }
155
+
156
+ /**
157
+ * @context Shared layer — domain types at src/shared/types.ts
158
+ * @does Defines core domain interfaces shared across core, CLI, and UI layers
159
+ * @depends src/shared/fields.ts
160
+ * @do Add new shared domain types here
161
+ * @dont Import from CLI or UI; contain runtime logic; import framework-specific code
162
+ */
163
+
164
+ /**
165
+ * Core content entry representing a single piece of content.
166
+ */
167
+ interface ContentEntry {
168
+ /** Collection name derived from the parent folder */
169
+ collection: string;
170
+ /** URL-friendly identifier derived from the filename */
171
+ slug: string;
172
+ /** Full path relative to the contents directory */
173
+ path: string;
174
+ /** Raw body content (MDX string or undefined for JSON) */
175
+ body?: string;
176
+ /** Parsed frontmatter or JSON data */
177
+ data: Record<string, unknown>;
178
+ /** Locale code parsed from filename (e.g. "pt" from "post.pt.mdx") */
179
+ locale?: string;
180
+ }
181
+ /**
182
+ * Collection metadata describing a content collection.
183
+ */
184
+ interface Collection {
185
+ /** Collection name (folder name) */
186
+ name: string;
187
+ /** Type of content in the collection */
188
+ type: "mdx" | "json-array" | "json-object";
189
+ /** Number of entries in the collection */
190
+ count: number;
191
+ /** Filesystem path to the collection folder */
192
+ basePath: string;
193
+ /** Optional schema that describes the fields in this collection. */
194
+ schema?: CollectionSchema;
195
+ }
196
+ /**
197
+ * Studio configuration from studio.config.ts
198
+ */
199
+ interface StudioConfig {
200
+ /** Per-collection configuration */
201
+ collections?: Record<string, CollectionConfig>;
202
+ }
203
+ /**
204
+ * Per-collection configuration options.
205
+ */
206
+ interface CollectionConfig {
207
+ /** Field schema that describes the shape of each entry. */
208
+ schema?: CollectionSchema;
209
+ /** Sync scripts for the collection */
210
+ scripts?: {
211
+ sync?: string;
212
+ };
213
+ /**
214
+ * Directory where media files for this collection are saved, relative to the project root.
215
+ * When set, uploads go here instead of the default `_media` subfolder inside contents.
216
+ * Example: `"public/images/posts"` saves files to `<projectRoot>/public/images/posts/`
217
+ * and generates URLs like `/images/posts/filename.jpg` (strips the leading `public/` segment).
218
+ */
219
+ mediaDir?: string;
220
+ }
221
+ /**
222
+ * Augmentable map of collection names to their typed entry shapes.
223
+ * Extend this via generated types or manual declaration:
224
+ *
225
+ * @example
226
+ * // .studio/studio.d.ts (auto-generated)
227
+ * declare module 'nextjs-studio' {
228
+ * interface CollectionTypeMap {
229
+ * posts: { title: string; date: string; slug: string };
230
+ * }
231
+ * }
232
+ */
233
+ interface CollectionTypeMap {
234
+ }
235
+ /**
236
+ * Shape returned by queryCollection().all() and array accessors.
237
+ * Merges frontmatter data (T) with entry metadata (body, locale, etc.).
238
+ *
239
+ * Entry-level fields (collection, slug, path) serve as defaults —
240
+ * if frontmatter defines the same key (e.g. `slug`), frontmatter wins.
241
+ */
242
+ type EntryResult<T = Record<string, unknown>> = T & {
243
+ /** Raw MDX body content (undefined for JSON entries) */
244
+ body?: string;
245
+ /** Locale parsed from filename (e.g. "pt" from "post.pt.mdx") */
246
+ locale?: string;
247
+ /** Collection name */
248
+ collection: string;
249
+ /** Entry slug derived from filename */
250
+ slug: string;
251
+ /** Entry path (e.g. "/posts/my-post") */
252
+ path: string;
253
+ };
254
+ /**
255
+ * Query options for the content query builder.
256
+ */
257
+ interface QueryOptions {
258
+ where?: Record<string, unknown>;
259
+ sort?: {
260
+ field: string;
261
+ order: "asc" | "desc";
262
+ };
263
+ limit?: number;
264
+ offset?: number;
265
+ }
266
+ /**
267
+ * File metadata returned by the FS adapter.
268
+ */
269
+ interface FileInfo {
270
+ path: string;
271
+ size: number;
272
+ modifiedAt: Date;
273
+ }
274
+ /**
275
+ * A file entry returned by a flat directory listing (non-recursive).
276
+ */
277
+ interface DirectoryFileEntry {
278
+ name: string;
279
+ relativePath: string;
280
+ size: number;
281
+ modifiedAt: Date;
282
+ }
283
+
284
+ /**
285
+ * @context Core layer — query builder at src/core/query-builder.ts
286
+ * @does Provides a fluent API to filter, sort, and paginate content entries from a collection
287
+ * @depends src/shared/types.ts, src/core/content-store.ts
288
+ * @do Add new query capabilities here (e.g. search, groupBy)
289
+ * @dont Import from CLI or UI; access the filesystem; perform I/O
290
+ */
291
+
292
+ /**
293
+ * Fluent query builder for content collections.
294
+ * Returned by `queryCollection()` — supports both chaining and direct array usage.
295
+ *
296
+ * ```ts
297
+ * Fluent chaining
298
+ * queryCollection("blog").where({ published: true }).sort("date", "desc").limit(10).all()
299
+ *
300
+ * Direct array usage — all native JS array methods work
301
+ * queryCollection("blog").slice(0, 5)
302
+ * queryCollection("blog").map(post => post.title)
303
+ * ```
304
+ */
305
+ declare class QueryBuilder<T = Record<string, unknown>> {
306
+ private readonly collectionName;
307
+ private options;
308
+ private _excludeDrafts;
309
+ private _locale;
310
+ constructor(collection: string);
311
+ where(conditions: Record<string, unknown>): this;
312
+ sort(field: string, order?: "asc" | "desc"): this;
313
+ limit(count: number): this;
314
+ offset(count: number): this;
315
+ excludeDrafts(): this;
316
+ locale(code: string): this;
317
+ all(): T[];
318
+ first(): T | undefined;
319
+ one(): T;
320
+ count(): number;
321
+ }
322
+ /** Intersection type: fluent builder + full native Array<T> interface. */
323
+ type QueryResult<T> = QueryBuilder<T> & T[];
324
+ /**
325
+ * Entry point for querying a content collection.
326
+ */
327
+ declare function queryCollection<K extends keyof CollectionTypeMap>(name: K): QueryResult<EntryResult<CollectionTypeMap[K]>>;
328
+ declare function queryCollection(name: string): QueryResult<EntryResult>;
329
+
330
+ export { type ArrayField as A, type BooleanField as B, type ContentEntry as C, type DateField as D, type EmailField as E, type FieldDefinition as F, type HttpUrl as H, type ISODate as I, type LongTextField as L, type MultiSelectField as M, type NumberField as N, type ObjectField as O, type QueryOptions as Q, type RelationField as R, type SelectField as S, type TextField as T, type UrlField as U, type Email as a, type MediaField as b, type MediaPath as c, type IdField as d, type ID as e, type SlugField as f, type Slug as g, type FormulaField as h, type StatusField as i, type CreatedTimeField as j, type UpdatedTimeField as k, type CollectionSchema as l, type BaseField as m, type Collection as n, type CollectionConfig as o, type CollectionTypeMap as p, type EntryResult as q, type FieldType as r, type QueryResult as s, type StudioConfig as t, queryCollection as u, type FileInfo as v, type DirectoryFileEntry as w };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nextjs-studio",
3
- "version": "0.3.0",
3
+ "version": "1.0.0",
4
4
  "description": "A Git-based, local-first CMS for Next.js projects",
5
5
  "keywords": [
6
6
  "nextjs",
@@ -23,22 +23,43 @@
23
23
  ".": {
24
24
  "types": "./dist/core/index.d.ts",
25
25
  "import": "./dist/core/index.js"
26
+ },
27
+ "./server": {
28
+ "types": "./dist/core/server.d.ts",
29
+ "import": "./dist/core/server.js"
26
30
  }
27
31
  },
28
32
  "main": "./dist/core/index.js",
29
33
  "types": "./dist/core/index.d.ts",
30
- "bin": {
31
- "nextjs-studio": "dist/bin/nextjs-studio.js"
32
- },
34
+ "bin": "dist/bin/nextjs-studio.js",
33
35
  "files": [
34
- "dist",
36
+ "dist/bin",
37
+ "dist/core",
38
+ "dist/*.d.ts",
39
+ "dist/cli/ui/package.json",
40
+ "dist/cli/ui/next.config.js",
41
+ "dist/cli/ui/.next/static",
42
+ "dist/cli/ui/.next/server",
43
+ "dist/cli/ui/.next/BUILD_ID",
44
+ "dist/cli/ui/.next/app-path-routes-manifest.json",
45
+ "dist/cli/ui/.next/build-manifest.json",
46
+ "dist/cli/ui/.next/export-marker.json",
47
+ "dist/cli/ui/.next/images-manifest.json",
48
+ "dist/cli/ui/.next/next-minimal-server.js.nft.json",
49
+ "dist/cli/ui/.next/next-server.js.nft.json",
50
+ "dist/cli/ui/.next/package.json",
51
+ "dist/cli/ui/.next/prerender-manifest.json",
52
+ "dist/cli/ui/.next/react-loadable-manifest.json",
53
+ "dist/cli/ui/.next/required-server-files.js",
54
+ "dist/cli/ui/.next/required-server-files.json",
55
+ "dist/cli/ui/.next/routes-manifest.json",
35
56
  "README.md",
36
57
  "LICENSE"
37
58
  ],
38
59
  "scripts": {
39
60
  "dev": "tsx src/bin/nextjs-studio.ts --dir example/contents",
40
61
  "studio:dev": "cross-env STUDIO_CONTENTS_DIR=example/contents next dev --port 3030 --webpack src/cli/ui",
41
- "studio:build": "next build --webpack src/cli/ui",
62
+ "studio:build": "next build --webpack src/cli/ui && node -e \"const fs=require('fs');fs.copyFileSync('src/cli/ui/package.json','dist/cli/ui/package.json');fs.writeFileSync('dist/cli/ui/next.config.js','module.exports={distDir:\\'.next\\'};')\"",
42
63
  "build": "tsup && yarn studio:build",
43
64
  "lint": "eslint src/",
44
65
  "type-check": "tsc --noEmit",
@@ -75,10 +96,7 @@
75
96
  "lowlight": "^3.3.0",
76
97
  "lucide-react": "^0.574.0",
77
98
  "mermaid": "^11.6.0",
78
- "next": "^16.1.6",
79
99
  "next-themes": "^0.4.6",
80
- "react": "^19.2.4",
81
- "react-dom": "^19.2.4",
82
100
  "tailwind-merge": "^3.4.1",
83
101
  "tailwindcss": "^4.1.18",
84
102
  "tippy.js": "^6.3.7",
@@ -95,6 +113,9 @@
95
113
  "chokidar": "^5.0.0",
96
114
  "commander": "^14.0.3",
97
115
  "gray-matter": "^4.0.3",
98
- "lodash-es": "^4.17.23"
116
+ "lodash-es": "^4.17.23",
117
+ "next": "^16.1.6",
118
+ "react": "^19.2.4",
119
+ "react-dom": "^19.2.4"
99
120
  }
100
- }
121
+ }