emdash 0.6.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 (263) hide show
  1. package/dist/{adapters-Di31kZ28.d.mts → adapters-BKSf3T9R.d.mts} +1 -1
  2. package/dist/{adapters-Di31kZ28.d.mts.map → adapters-BKSf3T9R.d.mts.map} +1 -1
  3. package/dist/{apply-B4MsLM-w.mjs → apply-x0eMK1lX.mjs} +186 -28
  4. package/dist/apply-x0eMK1lX.mjs.map +1 -0
  5. package/dist/astro/index.d.mts +6 -6
  6. package/dist/astro/index.d.mts.map +1 -1
  7. package/dist/astro/index.mjs +92 -17
  8. package/dist/astro/index.mjs.map +1 -1
  9. package/dist/astro/middleware/auth.d.mts +5 -5
  10. package/dist/astro/middleware/auth.d.mts.map +1 -1
  11. package/dist/astro/middleware/auth.mjs +22 -2
  12. package/dist/astro/middleware/auth.mjs.map +1 -1
  13. package/dist/astro/middleware/redirect.mjs +2 -2
  14. package/dist/astro/middleware/request-context.mjs +7 -2
  15. package/dist/astro/middleware/request-context.mjs.map +1 -1
  16. package/dist/astro/middleware/setup.mjs +1 -1
  17. package/dist/astro/middleware.d.mts.map +1 -1
  18. package/dist/astro/middleware.mjs +263 -74
  19. package/dist/astro/middleware.mjs.map +1 -1
  20. package/dist/astro/types.d.mts +25 -8
  21. package/dist/astro/types.d.mts.map +1 -1
  22. package/dist/{byline-C4OVd8b3.mjs → byline-Chbr2GoP.mjs} +3 -3
  23. package/dist/byline-Chbr2GoP.mjs.map +1 -0
  24. package/dist/{bylines-hPTW79hw.mjs → bylines-CRNsVG88.mjs} +4 -4
  25. package/dist/{bylines-hPTW79hw.mjs.map → bylines-CRNsVG88.mjs.map} +1 -1
  26. package/dist/cli/index.mjs +17 -13
  27. package/dist/cli/index.mjs.map +1 -1
  28. package/dist/client/cf-access.d.mts +1 -1
  29. package/dist/client/index.d.mts +1 -1
  30. package/dist/client/index.mjs +1 -1
  31. package/dist/{content-BsBoyj8G.mjs → content-BcQPYxdV.mjs} +39 -15
  32. package/dist/content-BcQPYxdV.mjs.map +1 -0
  33. package/dist/db/index.d.mts +3 -3
  34. package/dist/db/index.mjs +1 -1
  35. package/dist/db/libsql.d.mts +1 -1
  36. package/dist/db/postgres.d.mts +1 -1
  37. package/dist/db/sqlite.d.mts +1 -1
  38. package/dist/{db-errors-D0UT85nC.mjs → db-errors-l1Qh2RPR.mjs} +1 -1
  39. package/dist/{db-errors-D0UT85nC.mjs.map → db-errors-l1Qh2RPR.mjs.map} +1 -1
  40. package/dist/{default-CME5YdZ3.mjs → default-DCVqE5ib.mjs} +1 -1
  41. package/dist/{default-CME5YdZ3.mjs.map → default-DCVqE5ib.mjs.map} +1 -1
  42. package/dist/{error-CiYn9yDu.mjs → error-zG5T1UGA.mjs} +1 -1
  43. package/dist/error-zG5T1UGA.mjs.map +1 -0
  44. package/dist/{index-BYv0mB9g.d.mts → index-DIb-CzNx.d.mts} +232 -15
  45. package/dist/index-DIb-CzNx.d.mts.map +1 -0
  46. package/dist/index.d.mts +11 -11
  47. package/dist/index.mjs +23 -21
  48. package/dist/{load-CBcmDIot.mjs → load-CyEoextb.mjs} +1 -1
  49. package/dist/{load-CBcmDIot.mjs.map → load-CyEoextb.mjs.map} +1 -1
  50. package/dist/{loader-DeiBJEMe.mjs → loader-CndGj8kM.mjs} +8 -6
  51. package/dist/loader-CndGj8kM.mjs.map +1 -0
  52. package/dist/{manifest-schema-V30qsMft.mjs → manifest-schema-DH9xhc6t.mjs} +13 -1
  53. package/dist/manifest-schema-DH9xhc6t.mjs.map +1 -0
  54. package/dist/media/index.d.mts +1 -1
  55. package/dist/media/local-runtime.d.mts +7 -7
  56. package/dist/media/local-runtime.mjs +2 -2
  57. package/dist/{media-DqHVh136.mjs → media-D8FbNsl0.mjs} +4 -7
  58. package/dist/media-D8FbNsl0.mjs.map +1 -0
  59. package/dist/{mode-CpNnGkPz.mjs → mode-BnAOqItE.mjs} +1 -1
  60. package/dist/mode-BnAOqItE.mjs.map +1 -0
  61. package/dist/page/index.d.mts +2 -2
  62. package/dist/placeholder-C-fk5hYI.mjs.map +1 -1
  63. package/dist/{placeholder-tzpqGWII.d.mts → placeholder-D29tWZ7o.d.mts} +1 -1
  64. package/dist/{placeholder-tzpqGWII.d.mts.map → placeholder-D29tWZ7o.d.mts.map} +1 -1
  65. package/dist/plugins/adapt-sandbox-entry.d.mts +5 -5
  66. package/dist/plugins/adapt-sandbox-entry.mjs +1 -1
  67. package/dist/{query-Bk_3vKvU.mjs → query-fqEdLFms.mjs} +9 -9
  68. package/dist/{query-Bk_3vKvU.mjs.map → query-fqEdLFms.mjs.map} +1 -1
  69. package/dist/{redirect-7lGhLBNZ.mjs → redirect-D_pshWdf.mjs} +69 -13
  70. package/dist/redirect-D_pshWdf.mjs.map +1 -0
  71. package/dist/{registry-Ci3WxVAr.mjs → registry-C3Mr0ODu.mjs} +33 -9
  72. package/dist/registry-C3Mr0ODu.mjs.map +1 -0
  73. package/dist/{request-cache-DiR961CV.mjs → request-cache-Ci7f5pBb.mjs} +1 -1
  74. package/dist/request-cache-Ci7f5pBb.mjs.map +1 -0
  75. package/dist/{runner-Fl2NcUUz.d.mts → runner-OURCaApa.d.mts} +2 -2
  76. package/dist/{runner-Fl2NcUUz.d.mts.map → runner-OURCaApa.d.mts.map} +1 -1
  77. package/dist/{runner-Cd-_WyDo.mjs → runner-tQ7BJ4T7.mjs} +211 -134
  78. package/dist/runner-tQ7BJ4T7.mjs.map +1 -0
  79. package/dist/runtime.d.mts +6 -6
  80. package/dist/runtime.mjs +2 -2
  81. package/dist/{search-DI4bM2w9.mjs → search-BoZYFuUk.mjs} +339 -102
  82. package/dist/search-BoZYFuUk.mjs.map +1 -0
  83. package/dist/seed/index.d.mts +2 -2
  84. package/dist/seed/index.mjs +12 -12
  85. package/dist/seo/index.d.mts +1 -1
  86. package/dist/storage/local.d.mts +1 -1
  87. package/dist/storage/local.mjs +1 -1
  88. package/dist/storage/s3.d.mts +1 -1
  89. package/dist/storage/s3.d.mts.map +1 -1
  90. package/dist/storage/s3.mjs +4 -4
  91. package/dist/storage/s3.mjs.map +1 -1
  92. package/dist/{taxonomies-DbrKzDju.mjs → taxonomies-B4IAshV8.mjs} +5 -5
  93. package/dist/{taxonomies-DbrKzDju.mjs.map → taxonomies-B4IAshV8.mjs.map} +1 -1
  94. package/dist/{tokens-BFPFx3CA.mjs → tokens-D9vnZqYS.mjs} +1 -1
  95. package/dist/{tokens-BFPFx3CA.mjs.map → tokens-D9vnZqYS.mjs.map} +1 -1
  96. package/dist/{transport-BykRfpyy.mjs → transport-C9ugt2Nr.mjs} +1 -1
  97. package/dist/{transport-BykRfpyy.mjs.map → transport-C9ugt2Nr.mjs.map} +1 -1
  98. package/dist/{transport-H4Iwx7tC.d.mts → transport-CUnEL3Vs.d.mts} +1 -1
  99. package/dist/{transport-H4Iwx7tC.d.mts.map → transport-CUnEL3Vs.d.mts.map} +1 -1
  100. package/dist/types-BIgulNsW.mjs +68 -0
  101. package/dist/types-BIgulNsW.mjs.map +1 -0
  102. package/dist/{types-DDS4MxsT.mjs → types-Bm1dn-q3.mjs} +1 -1
  103. package/dist/{types-DDS4MxsT.mjs.map → types-Bm1dn-q3.mjs.map} +1 -1
  104. package/dist/{types-CnZYHyLW.d.mts → types-BmPPSUEx.d.mts} +1 -1
  105. package/dist/{types-CnZYHyLW.d.mts.map → types-BmPPSUEx.d.mts.map} +1 -1
  106. package/dist/{types-6CUZRrZP.d.mts → types-BrA0xf5I.d.mts} +24 -2
  107. package/dist/{types-6CUZRrZP.d.mts.map → types-BrA0xf5I.d.mts.map} +1 -1
  108. package/dist/{types-8xrvl_68.d.mts → types-CS8FIX7L.d.mts} +10 -1
  109. package/dist/{types-8xrvl_68.d.mts.map → types-CS8FIX7L.d.mts.map} +1 -1
  110. package/dist/{types-BH2L167P.mjs → types-CgqmmMJB.mjs} +1 -1
  111. package/dist/{types-BH2L167P.mjs.map → types-CgqmmMJB.mjs.map} +1 -1
  112. package/dist/{types-CFWjXmus.d.mts → types-DIMwPFub.d.mts} +1 -1
  113. package/dist/{types-CFWjXmus.d.mts.map → types-DIMwPFub.d.mts.map} +1 -1
  114. package/dist/{types-DgrIP0tF.d.mts → types-i36XcA_X.d.mts} +49 -6
  115. package/dist/types-i36XcA_X.d.mts.map +1 -0
  116. package/dist/{validate-CqsNItbt.mjs → validate-CxVsLehf.mjs} +2 -2
  117. package/dist/{validate-CqsNItbt.mjs.map → validate-CxVsLehf.mjs.map} +1 -1
  118. package/dist/{validate-CaLH1Ia2.d.mts → validate-DHxmpFJt.d.mts} +4 -4
  119. package/dist/{validate-CaLH1Ia2.d.mts.map → validate-DHxmpFJt.d.mts.map} +1 -1
  120. package/dist/validation-C-ZpN2GI.mjs +144 -0
  121. package/dist/validation-C-ZpN2GI.mjs.map +1 -0
  122. package/dist/version-DJrV1K0M.mjs +7 -0
  123. package/dist/{version-Uaf2ynPX.mjs.map → version-DJrV1K0M.mjs.map} +1 -1
  124. package/dist/zod-generator-CpwccCIv.mjs +132 -0
  125. package/dist/zod-generator-CpwccCIv.mjs.map +1 -0
  126. package/package.json +19 -6
  127. package/src/api/auth-storage.ts +37 -0
  128. package/src/api/error.ts +6 -0
  129. package/src/api/errors.ts +8 -0
  130. package/src/api/handlers/comments.ts +13 -0
  131. package/src/api/handlers/content.ts +124 -3
  132. package/src/api/handlers/index.ts +2 -0
  133. package/src/api/handlers/media.ts +8 -1
  134. package/src/api/handlers/menus.ts +160 -21
  135. package/src/api/handlers/redirects.ts +16 -3
  136. package/src/api/handlers/sections.ts +8 -1
  137. package/src/api/handlers/taxonomies.ts +128 -16
  138. package/src/api/handlers/validation.ts +212 -0
  139. package/src/api/openapi/document.ts +4 -1
  140. package/src/api/public-url.ts +6 -3
  141. package/src/api/route-utils.ts +14 -0
  142. package/src/api/schemas/common.ts +1 -1
  143. package/src/api/schemas/content.ts +8 -0
  144. package/src/api/schemas/setup.ts +8 -0
  145. package/src/api/schemas/widgets.ts +12 -10
  146. package/src/api/setup-complete.ts +40 -0
  147. package/src/astro/integration/font-provider.ts +3 -1
  148. package/src/astro/integration/index.ts +15 -2
  149. package/src/astro/integration/routes.ts +28 -0
  150. package/src/astro/integration/runtime.ts +74 -2
  151. package/src/astro/integration/virtual-modules.ts +41 -0
  152. package/src/astro/integration/vite-config.ts +43 -12
  153. package/src/astro/middleware/auth.ts +21 -0
  154. package/src/astro/middleware.ts +18 -1
  155. package/src/astro/routes/PluginRegistry.tsx +10 -1
  156. package/src/astro/routes/admin.astro +14 -7
  157. package/src/astro/routes/api/auth/magic-link/send.ts +2 -1
  158. package/src/astro/routes/api/auth/mode.ts +57 -0
  159. package/src/astro/routes/api/auth/oauth/[provider]/callback.ts +23 -3
  160. package/src/astro/routes/api/auth/oauth/[provider].ts +10 -4
  161. package/src/astro/routes/api/auth/passkey/options.ts +2 -1
  162. package/src/astro/routes/api/auth/signup/request.ts +26 -8
  163. package/src/astro/routes/api/comments/[collection]/[contentId]/index.ts +10 -6
  164. package/src/astro/routes/api/content/[collection]/[id]/compare.ts +1 -1
  165. package/src/astro/routes/api/content/[collection]/[id]/preview-url.ts +1 -1
  166. package/src/astro/routes/api/content/[collection]/[id]/revisions.ts +1 -1
  167. package/src/astro/routes/api/content/[collection]/[id]/translations.ts +26 -0
  168. package/src/astro/routes/api/content/[collection]/[id].ts +30 -2
  169. package/src/astro/routes/api/content/[collection]/index.ts +20 -10
  170. package/src/astro/routes/api/content/[collection]/trash.ts +1 -1
  171. package/src/astro/routes/api/import/wordpress/media.ts +2 -7
  172. package/src/astro/routes/api/import/wordpress/prepare.ts +10 -0
  173. package/src/astro/routes/api/import/wordpress-plugin/analyze.ts +4 -3
  174. package/src/astro/routes/api/import/wordpress-plugin/execute.ts +4 -3
  175. package/src/astro/routes/api/manifest.ts +7 -0
  176. package/src/astro/routes/api/oauth/device/code.ts +2 -1
  177. package/src/astro/routes/api/oauth/device/token.ts +2 -1
  178. package/src/astro/routes/api/settings/email.ts +4 -9
  179. package/src/astro/routes/api/setup/admin-verify.ts +30 -5
  180. package/src/astro/routes/api/setup/admin.ts +38 -8
  181. package/src/astro/routes/api/setup/index.ts +7 -4
  182. package/src/astro/routes/api/setup/status.ts +3 -1
  183. package/src/astro/routes/api/widget-areas/[name]/widgets/[id].ts +4 -1
  184. package/src/astro/routes/api/widget-areas/[name]/widgets.ts +4 -1
  185. package/src/astro/routes/api/widget-areas/[name].ts +4 -1
  186. package/src/astro/routes/api/widget-areas/index.ts +4 -1
  187. package/src/astro/types.ts +18 -0
  188. package/src/auth/mode.ts +15 -3
  189. package/src/auth/providers/github-admin.tsx +29 -0
  190. package/src/auth/providers/github.ts +31 -0
  191. package/src/auth/providers/google-admin.tsx +44 -0
  192. package/src/auth/providers/google.ts +31 -0
  193. package/src/auth/rate-limit.ts +50 -22
  194. package/src/auth/setup-nonce.ts +22 -0
  195. package/src/auth/trusted-proxy.ts +92 -0
  196. package/src/auth/types.ts +114 -4
  197. package/src/cli/commands/bundle.ts +3 -1
  198. package/src/components/EmDashImage.astro +7 -6
  199. package/src/components/Gallery.astro +5 -3
  200. package/src/components/Image.astro +8 -3
  201. package/src/components/InlinePortableTextEditor.tsx +2 -1
  202. package/src/components/LiveSearch.astro +5 -14
  203. package/src/database/migrations/035_bounded_404_log.ts +112 -0
  204. package/src/database/migrations/runner.ts +2 -0
  205. package/src/database/repositories/audit.ts +6 -8
  206. package/src/database/repositories/byline.ts +6 -8
  207. package/src/database/repositories/comment.ts +12 -16
  208. package/src/database/repositories/content.ts +79 -40
  209. package/src/database/repositories/index.ts +1 -1
  210. package/src/database/repositories/media.ts +10 -13
  211. package/src/database/repositories/options.ts +25 -0
  212. package/src/database/repositories/plugin-storage.ts +4 -6
  213. package/src/database/repositories/redirect.ts +123 -24
  214. package/src/database/repositories/taxonomy.ts +14 -3
  215. package/src/database/repositories/types.ts +57 -8
  216. package/src/database/repositories/user.ts +6 -8
  217. package/src/database/types.ts +9 -0
  218. package/src/emdash-runtime.ts +309 -91
  219. package/src/import/registry.ts +4 -3
  220. package/src/import/ssrf.ts +253 -12
  221. package/src/index.ts +5 -1
  222. package/src/loader.ts +6 -5
  223. package/src/mcp/server.ts +753 -107
  224. package/src/media/normalize.ts +1 -1
  225. package/src/media/url.ts +78 -0
  226. package/src/plugins/context.ts +15 -3
  227. package/src/plugins/email-console.ts +10 -3
  228. package/src/plugins/hooks.ts +11 -0
  229. package/src/plugins/manager.ts +6 -0
  230. package/src/plugins/manifest-schema.ts +12 -0
  231. package/src/plugins/request-meta.ts +66 -15
  232. package/src/plugins/routes.ts +3 -1
  233. package/src/plugins/types.ts +23 -2
  234. package/src/query.ts +1 -1
  235. package/src/request-cache.ts +3 -0
  236. package/src/schema/registry.ts +41 -5
  237. package/src/search/fts-manager.ts +0 -2
  238. package/src/search/query.ts +111 -26
  239. package/src/search/types.ts +8 -1
  240. package/src/sections/index.ts +7 -9
  241. package/src/seed/apply.ts +26 -0
  242. package/src/storage/s3.ts +12 -6
  243. package/src/virtual-modules.d.ts +21 -1
  244. package/src/visual-editing/toolbar.ts +6 -1
  245. package/src/widgets/index.ts +1 -1
  246. package/dist/apply-B4MsLM-w.mjs.map +0 -1
  247. package/dist/byline-C4OVd8b3.mjs.map +0 -1
  248. package/dist/content-BsBoyj8G.mjs.map +0 -1
  249. package/dist/error-CiYn9yDu.mjs.map +0 -1
  250. package/dist/index-BYv0mB9g.d.mts.map +0 -1
  251. package/dist/loader-DeiBJEMe.mjs.map +0 -1
  252. package/dist/manifest-schema-V30qsMft.mjs.map +0 -1
  253. package/dist/media-DqHVh136.mjs.map +0 -1
  254. package/dist/mode-CpNnGkPz.mjs.map +0 -1
  255. package/dist/redirect-7lGhLBNZ.mjs.map +0 -1
  256. package/dist/registry-Ci3WxVAr.mjs.map +0 -1
  257. package/dist/request-cache-DiR961CV.mjs.map +0 -1
  258. package/dist/runner-Cd-_WyDo.mjs.map +0 -1
  259. package/dist/search-DI4bM2w9.mjs.map +0 -1
  260. package/dist/types-CMMN0pNg.mjs +0 -31
  261. package/dist/types-CMMN0pNg.mjs.map +0 -1
  262. package/dist/types-DgrIP0tF.d.mts.map +0 -1
  263. package/dist/version-Uaf2ynPX.mjs +0 -7
@@ -1,9 +1,9 @@
1
- import "../types-8xrvl_68.mjs";
2
- import { Ri as MediaItem, _n as S3StorageConfig, gn as LocalStorageConfig, hn as getStoredConfig, pn as EmDashConfig, vn as StorageDescriptor } from "../index-BYv0mB9g.mjs";
3
- import "../runner-Fl2NcUUz.mjs";
4
- import { r as ContentItem } from "../types-6CUZRrZP.mjs";
5
- import { X as ResolvedPlugin } from "../types-DgrIP0tF.mjs";
6
- import "../validate-CaLH1Ia2.mjs";
1
+ import "../types-CS8FIX7L.mjs";
2
+ import { Vi as MediaItem, _n as S3StorageConfig, gn as LocalStorageConfig, hn as getStoredConfig, pn as EmDashConfig, vn as StorageDescriptor } from "../index-DIb-CzNx.mjs";
3
+ import "../runner-OURCaApa.mjs";
4
+ import { r as ContentItem } from "../types-BrA0xf5I.mjs";
5
+ import { X as ResolvedPlugin } from "../types-i36XcA_X.mjs";
6
+ import "../validate-DHxmpFJt.mjs";
7
7
  import { EmDashHandlers, EmDashManifest, ManifestCollection } from "./types.mjs";
8
8
  import { AstroIntegration } from "astro";
9
9
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/astro/storage/adapters.ts","../../src/astro/integration/index.ts"],"mappings":";;;;;;;;;;;;;;;;;AC4DA;;;;;;;;;;;;;;;;;;;;;;;iBDCgB,EAAA,CAAG,MAAA,GAAQ,OAAA,CAAQ,eAAA,IAAwB,iBAAA;;;;;;;;;;;;;;;iBAqB3C,KAAA,CAAM,MAAA,EAAQ,kBAAA,GAAqB,iBAAA;;;;;;iBCtBnC,MAAA,CAAO,MAAA,GAAQ,YAAA,GAAoB,gBAAA"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/astro/storage/adapters.ts","../../src/astro/integration/index.ts"],"mappings":";;;;;;;;;;;;;;;;;ACiEA;;;;;;;;;;;;;;;;;;;;;;;iBDJgB,EAAA,CAAG,MAAA,GAAQ,OAAA,CAAQ,eAAA,IAAwB,iBAAA;;;;;;;;;;;;;;;iBAqB3C,KAAA,CAAM,MAAA,EAAQ,kBAAA,GAAqB,iBAAA;;;;;;iBCjBnC,MAAA,CAAO,MAAA,GAAQ,YAAA,GAAoB,gBAAA"}
@@ -1,8 +1,8 @@
1
- import { t as defaultSeed } from "../default-CME5YdZ3.mjs";
2
- import { n as VERSION, t as COMMIT } from "../version-Uaf2ynPX.mjs";
1
+ import { t as defaultSeed } from "../default-DCVqE5ib.mjs";
2
+ import { n as VERSION, t as COMMIT } from "../version-DJrV1K0M.mjs";
3
3
  import { createRequire } from "node:module";
4
4
  import { fontProviders } from "astro/config";
5
- import { dirname, resolve } from "node:path";
5
+ import { dirname, isAbsolute, relative, resolve } from "node:path";
6
6
  import { fileURLToPath } from "node:url";
7
7
  import { existsSync, readFileSync } from "node:fs";
8
8
 
@@ -95,6 +95,7 @@ const ALL_GOOGLE_SUBSETS = [
95
95
  "cyrillic-ext",
96
96
  "devanagari",
97
97
  "ethiopic",
98
+ "farsi",
98
99
  "georgian",
99
100
  "greek",
100
101
  "greek-ext",
@@ -121,7 +122,7 @@ const ALL_GOOGLE_SUBSETS = [
121
122
  "vietnamese"
122
123
  ];
123
124
  /**
124
- * Known Noto Sans script families on Google Fonts.
125
+ * Known Noto Sans and Sans script families on Google Fonts.
125
126
  * Maps user-friendly script names to Google Fonts family names.
126
127
  */
127
128
  const NOTO_SCRIPT_FAMILIES = {
@@ -133,6 +134,7 @@ const NOTO_SCRIPT_FAMILIES = {
133
134
  "chinese-hongkong": "Noto Sans HK",
134
135
  devanagari: "Noto Sans Devanagari",
135
136
  ethiopic: "Noto Sans Ethiopic",
137
+ farsi: "Vazirmatn",
136
138
  georgian: "Noto Sans Georgian",
137
139
  gujarati: "Noto Sans Gujarati",
138
140
  gurmukhi: "Noto Sans Gurmukhi",
@@ -218,6 +220,10 @@ function injectCoreRoutes(injectRoute) {
218
220
  pattern: "/_emdash/api/manifest",
219
221
  entrypoint: resolveRoute("api/manifest.ts")
220
222
  });
223
+ injectRoute({
224
+ pattern: "/_emdash/api/auth/mode",
225
+ entrypoint: resolveRoute("api/auth/mode.ts")
226
+ });
221
227
  injectRoute({
222
228
  pattern: "/_emdash/api/dashboard",
223
229
  entrypoint: resolveRoute("api/dashboard.ts")
@@ -746,6 +752,18 @@ function injectMcpRoute(injectRoute) {
746
752
  });
747
753
  }
748
754
  /**
755
+ * Injects routes from pluggable auth providers.
756
+ *
757
+ * Each provider declares the routes it needs in its `AuthProviderDescriptor.routes` array.
758
+ * Routes are injected at build time so Vite can bundle them.
759
+ */
760
+ function injectAuthProviderRoutes(injectRoute, providers) {
761
+ for (const provider of providers) if (provider.routes) for (const route of provider.routes) injectRoute({
762
+ pattern: route.pattern,
763
+ entrypoint: route.entrypoint
764
+ });
765
+ }
766
+ /**
749
767
  * Injects passkey/oauth/magic-link auth routes.
750
768
  * Only used when NOT using external auth.
751
769
  */
@@ -862,6 +880,8 @@ const VIRTUAL_SANDBOXED_PLUGINS_ID = "virtual:emdash/sandboxed-plugins";
862
880
  const RESOLVED_VIRTUAL_SANDBOXED_PLUGINS_ID = "\0" + VIRTUAL_SANDBOXED_PLUGINS_ID;
863
881
  const VIRTUAL_AUTH_ID = "virtual:emdash/auth";
864
882
  const RESOLVED_VIRTUAL_AUTH_ID = "\0" + VIRTUAL_AUTH_ID;
883
+ const VIRTUAL_AUTH_PROVIDERS_ID = "virtual:emdash/auth-providers";
884
+ const RESOLVED_VIRTUAL_AUTH_PROVIDERS_ID = "\0" + VIRTUAL_AUTH_PROVIDERS_ID;
865
885
  const VIRTUAL_MEDIA_PROVIDERS_ID = "virtual:emdash/media-providers";
866
886
  const RESOLVED_VIRTUAL_MEDIA_PROVIDERS_ID = "\0" + VIRTUAL_MEDIA_PROVIDERS_ID;
867
887
  const VIRTUAL_BLOCK_COMPONENTS_ID = "virtual:emdash/block-components";
@@ -929,6 +949,34 @@ export const authenticate = _authenticate;
929
949
  `;
930
950
  }
931
951
  /**
952
+ * Generates the auth providers module.
953
+ *
954
+ * Statically imports each auth provider's `adminEntry` module and exports
955
+ * a registry keyed by provider ID. The admin UI uses this to render
956
+ * provider-specific login buttons/forms and setup steps.
957
+ *
958
+ * Follows the same pattern as `generateAdminRegistryModule()` for plugins.
959
+ */
960
+ function generateAuthProvidersModule(descriptors) {
961
+ const withAdmin = descriptors.filter((d) => d.adminEntry);
962
+ if (withAdmin.length === 0) return `export const authProviders = {};`;
963
+ const imports = [];
964
+ const entries = [];
965
+ withAdmin.forEach((descriptor, index) => {
966
+ const varName = `authProvider${index}`;
967
+ imports.push(`import * as ${varName} from ${JSON.stringify(descriptor.adminEntry)};`);
968
+ entries.push(` ${JSON.stringify(descriptor.id)}: { ...${varName}, id: ${JSON.stringify(descriptor.id)}, label: ${JSON.stringify(descriptor.label)} },`);
969
+ });
970
+ return `
971
+ // Auto-generated auth provider registry
972
+ ${imports.join("\n")}
973
+
974
+ export const authProviders = {
975
+ ${entries.join("\n")}
976
+ };
977
+ `;
978
+ }
979
+ /**
932
980
  * Generates the plugins module.
933
981
  * Imports and instantiates all plugins at runtime.
934
982
  *
@@ -1222,15 +1270,24 @@ function resolveAdminDist() {
1222
1270
  return dirname(createRequire(import.meta.url).resolve("@emdash-cms/admin"));
1223
1271
  }
1224
1272
  /**
1273
+ * Check whether child is inside parent without relying on simple prefix checks.
1274
+ */
1275
+ function isInside(parent, child) {
1276
+ const relativePath = relative(parent, child);
1277
+ return relativePath === "" || !relativePath.startsWith("..") && !isAbsolute(relativePath);
1278
+ }
1279
+ /**
1225
1280
  * Resolve path to the admin package source directory.
1226
- * In dev mode, we alias @emdash-cms/admin to the source so Vite processes it
1227
- * directly — giving instant HMR instead of requiring a rebuild + restart.
1281
+ * In dev mode inside this repo, we alias @emdash-cms/admin to the source so
1282
+ * Vite processes it directly — giving instant HMR instead of requiring a
1283
+ * rebuild + restart. External apps should use the built package surface.
1228
1284
  */
1229
- function resolveAdminSource() {
1285
+ function resolveAdminSource(projectRoot) {
1230
1286
  const packageRoot = resolve(dirname(createRequire(import.meta.url).resolve("@emdash-cms/admin")), "..");
1287
+ const repoRoot = resolve(packageRoot, "..", "..");
1231
1288
  const srcEntry = resolve(packageRoot, "src", "index.ts");
1232
1289
  try {
1233
- if (existsSync(srcEntry)) return resolve(packageRoot, "src");
1290
+ if (existsSync(srcEntry) && isInside(repoRoot, projectRoot)) return resolve(packageRoot, "src");
1234
1291
  } catch {}
1235
1292
  }
1236
1293
  /**
@@ -1249,6 +1306,7 @@ function createVirtualModulesPlugin(options) {
1249
1306
  if (id === VIRTUAL_SANDBOX_RUNNER_ID) return RESOLVED_VIRTUAL_SANDBOX_RUNNER_ID;
1250
1307
  if (id === VIRTUAL_SANDBOXED_PLUGINS_ID) return RESOLVED_VIRTUAL_SANDBOXED_PLUGINS_ID;
1251
1308
  if (id === VIRTUAL_AUTH_ID) return RESOLVED_VIRTUAL_AUTH_ID;
1309
+ if (id === VIRTUAL_AUTH_PROVIDERS_ID) return RESOLVED_VIRTUAL_AUTH_PROVIDERS_ID;
1252
1310
  if (id === VIRTUAL_MEDIA_PROVIDERS_ID) return RESOLVED_VIRTUAL_MEDIA_PROVIDERS_ID;
1253
1311
  if (id === VIRTUAL_BLOCK_COMPONENTS_ID) return RESOLVED_VIRTUAL_BLOCK_COMPONENTS_ID;
1254
1312
  if (id === VIRTUAL_SEED_ID) return RESOLVED_VIRTUAL_SEED_ID;
@@ -1274,6 +1332,7 @@ function createVirtualModulesPlugin(options) {
1274
1332
  if (!authDescriptor || !("entrypoint" in authDescriptor)) return generateAuthModule(void 0);
1275
1333
  return generateAuthModule(authDescriptor.entrypoint);
1276
1334
  }
1335
+ if (id === RESOLVED_VIRTUAL_AUTH_PROVIDERS_ID) return generateAuthProvidersModule(resolvedConfig.authProviders ?? []);
1277
1336
  if (id === RESOLVED_VIRTUAL_MEDIA_PROVIDERS_ID) return generateMediaProvidersModule(resolvedConfig.mediaProviders ?? []);
1278
1337
  if (id === RESOLVED_VIRTUAL_BLOCK_COMPONENTS_ID) return generateBlockComponentsModule(pluginDescriptors);
1279
1338
  if (id === RESOLVED_VIRTUAL_SEED_ID) return generateSeedModule(fileURLToPath(astroConfig.root));
@@ -1307,7 +1366,8 @@ function createViteConfig(options, command) {
1307
1366
  const adminDistPath = resolveAdminDist();
1308
1367
  const cloudflare = isCloudflareAdapter(options.astroConfig);
1309
1368
  const isDev = command === "dev";
1310
- const adminSourcePath = isDev ? resolveAdminSource() : void 0;
1369
+ const projectRoot = fileURLToPath(options.astroConfig.root);
1370
+ const adminSourcePath = isDev ? resolveAdminSource(projectRoot) : void 0;
1311
1371
  const useSource = adminSourcePath !== void 0;
1312
1372
  return {
1313
1373
  define: {
@@ -1321,13 +1381,24 @@ function createViteConfig(options, command) {
1321
1381
  "react",
1322
1382
  "react-dom"
1323
1383
  ],
1324
- alias: [{
1325
- find: "@emdash-cms/admin/styles.css",
1326
- replacement: resolve(adminDistPath, "styles.css")
1327
- }, {
1328
- find: "@emdash-cms/admin",
1329
- replacement: useSource ? adminSourcePath : adminDistPath
1330
- }]
1384
+ alias: [
1385
+ {
1386
+ find: "@emdash-cms/admin/styles.css",
1387
+ replacement: resolve(adminDistPath, "styles.css")
1388
+ },
1389
+ {
1390
+ find: "@emdash-cms/admin",
1391
+ replacement: useSource ? adminSourcePath : adminDistPath
1392
+ },
1393
+ {
1394
+ find: "use-sync-external-store/shim/index.js",
1395
+ replacement: "use-sync-external-store"
1396
+ },
1397
+ {
1398
+ find: "use-sync-external-store/shim",
1399
+ replacement: "use-sync-external-store"
1400
+ }
1401
+ ]
1331
1402
  },
1332
1403
  plugins: [createVirtualModulesPlugin(options), ...useSource ? [linguiMacroPlugin(adminSourcePath, adminDistPath)] : []],
1333
1404
  ssr: cloudflare ? {
@@ -1460,9 +1531,12 @@ function emdash(config = {}) {
1460
1531
  database: resolvedConfig.database,
1461
1532
  storage: resolvedConfig.storage,
1462
1533
  auth: resolvedConfig.auth,
1534
+ authProviders: resolvedConfig.authProviders,
1463
1535
  marketplace: resolvedConfig.marketplace,
1464
1536
  siteUrl: resolvedConfig.siteUrl,
1465
- maxUploadSize: resolvedConfig.maxUploadSize
1537
+ trustedProxyHeaders: resolvedConfig.trustedProxyHeaders,
1538
+ maxUploadSize: resolvedConfig.maxUploadSize,
1539
+ admin: resolvedConfig.admin
1466
1540
  };
1467
1541
  const useExternalAuth = !!(resolvedConfig.auth && "entrypoint" in resolvedConfig.auth);
1468
1542
  return {
@@ -1516,6 +1590,7 @@ function emdash(config = {}) {
1516
1590
  }, command)
1517
1591
  });
1518
1592
  injectCoreRoutes(injectRoute);
1593
+ if (resolvedConfig.authProviders?.length) injectAuthProviderRoutes(injectRoute, resolvedConfig.authProviders);
1519
1594
  if (!useExternalAuth) injectBuiltinAuthRoutes(injectRoute);
1520
1595
  if (resolvedConfig.mcp !== false) injectMcpRoute(injectRoute);
1521
1596
  if (resolvedConfig.playground) addMiddleware({