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.
- package/dist/{adapters-Di31kZ28.d.mts → adapters-BKSf3T9R.d.mts} +1 -1
- package/dist/{adapters-Di31kZ28.d.mts.map → adapters-BKSf3T9R.d.mts.map} +1 -1
- package/dist/{apply-B4MsLM-w.mjs → apply-x0eMK1lX.mjs} +186 -28
- package/dist/apply-x0eMK1lX.mjs.map +1 -0
- package/dist/astro/index.d.mts +6 -6
- package/dist/astro/index.d.mts.map +1 -1
- package/dist/astro/index.mjs +92 -17
- package/dist/astro/index.mjs.map +1 -1
- package/dist/astro/middleware/auth.d.mts +5 -5
- package/dist/astro/middleware/auth.d.mts.map +1 -1
- package/dist/astro/middleware/auth.mjs +22 -2
- package/dist/astro/middleware/auth.mjs.map +1 -1
- package/dist/astro/middleware/redirect.mjs +2 -2
- package/dist/astro/middleware/request-context.mjs +7 -2
- package/dist/astro/middleware/request-context.mjs.map +1 -1
- package/dist/astro/middleware/setup.mjs +1 -1
- package/dist/astro/middleware.d.mts.map +1 -1
- package/dist/astro/middleware.mjs +263 -74
- package/dist/astro/middleware.mjs.map +1 -1
- package/dist/astro/types.d.mts +25 -8
- package/dist/astro/types.d.mts.map +1 -1
- package/dist/{byline-C4OVd8b3.mjs → byline-Chbr2GoP.mjs} +3 -3
- package/dist/byline-Chbr2GoP.mjs.map +1 -0
- package/dist/{bylines-hPTW79hw.mjs → bylines-CRNsVG88.mjs} +4 -4
- package/dist/{bylines-hPTW79hw.mjs.map → bylines-CRNsVG88.mjs.map} +1 -1
- package/dist/cli/index.mjs +17 -13
- package/dist/cli/index.mjs.map +1 -1
- package/dist/client/cf-access.d.mts +1 -1
- package/dist/client/index.d.mts +1 -1
- package/dist/client/index.mjs +1 -1
- package/dist/{content-BsBoyj8G.mjs → content-BcQPYxdV.mjs} +39 -15
- package/dist/content-BcQPYxdV.mjs.map +1 -0
- package/dist/db/index.d.mts +3 -3
- package/dist/db/index.mjs +1 -1
- package/dist/db/libsql.d.mts +1 -1
- package/dist/db/postgres.d.mts +1 -1
- package/dist/db/sqlite.d.mts +1 -1
- package/dist/{db-errors-D0UT85nC.mjs → db-errors-l1Qh2RPR.mjs} +1 -1
- package/dist/{db-errors-D0UT85nC.mjs.map → db-errors-l1Qh2RPR.mjs.map} +1 -1
- package/dist/{default-CME5YdZ3.mjs → default-DCVqE5ib.mjs} +1 -1
- package/dist/{default-CME5YdZ3.mjs.map → default-DCVqE5ib.mjs.map} +1 -1
- package/dist/{error-CiYn9yDu.mjs → error-zG5T1UGA.mjs} +1 -1
- package/dist/error-zG5T1UGA.mjs.map +1 -0
- package/dist/{index-BYv0mB9g.d.mts → index-DIb-CzNx.d.mts} +232 -15
- package/dist/index-DIb-CzNx.d.mts.map +1 -0
- package/dist/index.d.mts +11 -11
- package/dist/index.mjs +23 -21
- package/dist/{load-CBcmDIot.mjs → load-CyEoextb.mjs} +1 -1
- package/dist/{load-CBcmDIot.mjs.map → load-CyEoextb.mjs.map} +1 -1
- package/dist/{loader-DeiBJEMe.mjs → loader-CndGj8kM.mjs} +8 -6
- package/dist/loader-CndGj8kM.mjs.map +1 -0
- package/dist/{manifest-schema-V30qsMft.mjs → manifest-schema-DH9xhc6t.mjs} +13 -1
- package/dist/manifest-schema-DH9xhc6t.mjs.map +1 -0
- package/dist/media/index.d.mts +1 -1
- package/dist/media/local-runtime.d.mts +7 -7
- package/dist/media/local-runtime.mjs +2 -2
- package/dist/{media-DqHVh136.mjs → media-D8FbNsl0.mjs} +4 -7
- package/dist/media-D8FbNsl0.mjs.map +1 -0
- package/dist/{mode-CpNnGkPz.mjs → mode-BnAOqItE.mjs} +1 -1
- package/dist/mode-BnAOqItE.mjs.map +1 -0
- package/dist/page/index.d.mts +2 -2
- package/dist/placeholder-C-fk5hYI.mjs.map +1 -1
- package/dist/{placeholder-tzpqGWII.d.mts → placeholder-D29tWZ7o.d.mts} +1 -1
- package/dist/{placeholder-tzpqGWII.d.mts.map → placeholder-D29tWZ7o.d.mts.map} +1 -1
- package/dist/plugins/adapt-sandbox-entry.d.mts +5 -5
- package/dist/plugins/adapt-sandbox-entry.mjs +1 -1
- package/dist/{query-Bk_3vKvU.mjs → query-fqEdLFms.mjs} +9 -9
- package/dist/{query-Bk_3vKvU.mjs.map → query-fqEdLFms.mjs.map} +1 -1
- package/dist/{redirect-7lGhLBNZ.mjs → redirect-D_pshWdf.mjs} +69 -13
- package/dist/redirect-D_pshWdf.mjs.map +1 -0
- package/dist/{registry-Ci3WxVAr.mjs → registry-C3Mr0ODu.mjs} +33 -9
- package/dist/registry-C3Mr0ODu.mjs.map +1 -0
- package/dist/{request-cache-DiR961CV.mjs → request-cache-Ci7f5pBb.mjs} +1 -1
- package/dist/request-cache-Ci7f5pBb.mjs.map +1 -0
- package/dist/{runner-Fl2NcUUz.d.mts → runner-OURCaApa.d.mts} +2 -2
- package/dist/{runner-Fl2NcUUz.d.mts.map → runner-OURCaApa.d.mts.map} +1 -1
- package/dist/{runner-Cd-_WyDo.mjs → runner-tQ7BJ4T7.mjs} +211 -134
- package/dist/runner-tQ7BJ4T7.mjs.map +1 -0
- package/dist/runtime.d.mts +6 -6
- package/dist/runtime.mjs +2 -2
- package/dist/{search-DI4bM2w9.mjs → search-BoZYFuUk.mjs} +339 -102
- package/dist/search-BoZYFuUk.mjs.map +1 -0
- package/dist/seed/index.d.mts +2 -2
- package/dist/seed/index.mjs +12 -12
- package/dist/seo/index.d.mts +1 -1
- package/dist/storage/local.d.mts +1 -1
- package/dist/storage/local.mjs +1 -1
- package/dist/storage/s3.d.mts +1 -1
- package/dist/storage/s3.d.mts.map +1 -1
- package/dist/storage/s3.mjs +4 -4
- package/dist/storage/s3.mjs.map +1 -1
- package/dist/{taxonomies-DbrKzDju.mjs → taxonomies-B4IAshV8.mjs} +5 -5
- package/dist/{taxonomies-DbrKzDju.mjs.map → taxonomies-B4IAshV8.mjs.map} +1 -1
- package/dist/{tokens-BFPFx3CA.mjs → tokens-D9vnZqYS.mjs} +1 -1
- package/dist/{tokens-BFPFx3CA.mjs.map → tokens-D9vnZqYS.mjs.map} +1 -1
- package/dist/{transport-BykRfpyy.mjs → transport-C9ugt2Nr.mjs} +1 -1
- package/dist/{transport-BykRfpyy.mjs.map → transport-C9ugt2Nr.mjs.map} +1 -1
- package/dist/{transport-H4Iwx7tC.d.mts → transport-CUnEL3Vs.d.mts} +1 -1
- package/dist/{transport-H4Iwx7tC.d.mts.map → transport-CUnEL3Vs.d.mts.map} +1 -1
- package/dist/types-BIgulNsW.mjs +68 -0
- package/dist/types-BIgulNsW.mjs.map +1 -0
- package/dist/{types-DDS4MxsT.mjs → types-Bm1dn-q3.mjs} +1 -1
- package/dist/{types-DDS4MxsT.mjs.map → types-Bm1dn-q3.mjs.map} +1 -1
- package/dist/{types-CnZYHyLW.d.mts → types-BmPPSUEx.d.mts} +1 -1
- package/dist/{types-CnZYHyLW.d.mts.map → types-BmPPSUEx.d.mts.map} +1 -1
- package/dist/{types-6CUZRrZP.d.mts → types-BrA0xf5I.d.mts} +24 -2
- package/dist/{types-6CUZRrZP.d.mts.map → types-BrA0xf5I.d.mts.map} +1 -1
- package/dist/{types-8xrvl_68.d.mts → types-CS8FIX7L.d.mts} +10 -1
- package/dist/{types-8xrvl_68.d.mts.map → types-CS8FIX7L.d.mts.map} +1 -1
- package/dist/{types-BH2L167P.mjs → types-CgqmmMJB.mjs} +1 -1
- package/dist/{types-BH2L167P.mjs.map → types-CgqmmMJB.mjs.map} +1 -1
- package/dist/{types-CFWjXmus.d.mts → types-DIMwPFub.d.mts} +1 -1
- package/dist/{types-CFWjXmus.d.mts.map → types-DIMwPFub.d.mts.map} +1 -1
- package/dist/{types-DgrIP0tF.d.mts → types-i36XcA_X.d.mts} +49 -6
- package/dist/types-i36XcA_X.d.mts.map +1 -0
- package/dist/{validate-CqsNItbt.mjs → validate-CxVsLehf.mjs} +2 -2
- package/dist/{validate-CqsNItbt.mjs.map → validate-CxVsLehf.mjs.map} +1 -1
- package/dist/{validate-CaLH1Ia2.d.mts → validate-DHxmpFJt.d.mts} +4 -4
- package/dist/{validate-CaLH1Ia2.d.mts.map → validate-DHxmpFJt.d.mts.map} +1 -1
- package/dist/validation-C-ZpN2GI.mjs +144 -0
- package/dist/validation-C-ZpN2GI.mjs.map +1 -0
- package/dist/version-DJrV1K0M.mjs +7 -0
- package/dist/{version-Uaf2ynPX.mjs.map → version-DJrV1K0M.mjs.map} +1 -1
- package/dist/zod-generator-CpwccCIv.mjs +132 -0
- package/dist/zod-generator-CpwccCIv.mjs.map +1 -0
- package/package.json +19 -6
- package/src/api/auth-storage.ts +37 -0
- package/src/api/error.ts +6 -0
- package/src/api/errors.ts +8 -0
- package/src/api/handlers/comments.ts +13 -0
- package/src/api/handlers/content.ts +124 -3
- package/src/api/handlers/index.ts +2 -0
- package/src/api/handlers/media.ts +8 -1
- package/src/api/handlers/menus.ts +160 -21
- package/src/api/handlers/redirects.ts +16 -3
- package/src/api/handlers/sections.ts +8 -1
- package/src/api/handlers/taxonomies.ts +128 -16
- package/src/api/handlers/validation.ts +212 -0
- package/src/api/openapi/document.ts +4 -1
- package/src/api/public-url.ts +6 -3
- package/src/api/route-utils.ts +14 -0
- package/src/api/schemas/common.ts +1 -1
- package/src/api/schemas/content.ts +8 -0
- package/src/api/schemas/setup.ts +8 -0
- package/src/api/schemas/widgets.ts +12 -10
- package/src/api/setup-complete.ts +40 -0
- package/src/astro/integration/font-provider.ts +3 -1
- package/src/astro/integration/index.ts +15 -2
- package/src/astro/integration/routes.ts +28 -0
- package/src/astro/integration/runtime.ts +74 -2
- package/src/astro/integration/virtual-modules.ts +41 -0
- package/src/astro/integration/vite-config.ts +43 -12
- package/src/astro/middleware/auth.ts +21 -0
- package/src/astro/middleware.ts +18 -1
- package/src/astro/routes/PluginRegistry.tsx +10 -1
- package/src/astro/routes/admin.astro +14 -7
- package/src/astro/routes/api/auth/magic-link/send.ts +2 -1
- package/src/astro/routes/api/auth/mode.ts +57 -0
- package/src/astro/routes/api/auth/oauth/[provider]/callback.ts +23 -3
- package/src/astro/routes/api/auth/oauth/[provider].ts +10 -4
- package/src/astro/routes/api/auth/passkey/options.ts +2 -1
- package/src/astro/routes/api/auth/signup/request.ts +26 -8
- package/src/astro/routes/api/comments/[collection]/[contentId]/index.ts +10 -6
- package/src/astro/routes/api/content/[collection]/[id]/compare.ts +1 -1
- package/src/astro/routes/api/content/[collection]/[id]/preview-url.ts +1 -1
- package/src/astro/routes/api/content/[collection]/[id]/revisions.ts +1 -1
- package/src/astro/routes/api/content/[collection]/[id]/translations.ts +26 -0
- package/src/astro/routes/api/content/[collection]/[id].ts +30 -2
- package/src/astro/routes/api/content/[collection]/index.ts +20 -10
- package/src/astro/routes/api/content/[collection]/trash.ts +1 -1
- package/src/astro/routes/api/import/wordpress/media.ts +2 -7
- package/src/astro/routes/api/import/wordpress/prepare.ts +10 -0
- package/src/astro/routes/api/import/wordpress-plugin/analyze.ts +4 -3
- package/src/astro/routes/api/import/wordpress-plugin/execute.ts +4 -3
- package/src/astro/routes/api/manifest.ts +7 -0
- package/src/astro/routes/api/oauth/device/code.ts +2 -1
- package/src/astro/routes/api/oauth/device/token.ts +2 -1
- package/src/astro/routes/api/settings/email.ts +4 -9
- package/src/astro/routes/api/setup/admin-verify.ts +30 -5
- package/src/astro/routes/api/setup/admin.ts +38 -8
- package/src/astro/routes/api/setup/index.ts +7 -4
- package/src/astro/routes/api/setup/status.ts +3 -1
- package/src/astro/routes/api/widget-areas/[name]/widgets/[id].ts +4 -1
- package/src/astro/routes/api/widget-areas/[name]/widgets.ts +4 -1
- package/src/astro/routes/api/widget-areas/[name].ts +4 -1
- package/src/astro/routes/api/widget-areas/index.ts +4 -1
- package/src/astro/types.ts +18 -0
- package/src/auth/mode.ts +15 -3
- package/src/auth/providers/github-admin.tsx +29 -0
- package/src/auth/providers/github.ts +31 -0
- package/src/auth/providers/google-admin.tsx +44 -0
- package/src/auth/providers/google.ts +31 -0
- package/src/auth/rate-limit.ts +50 -22
- package/src/auth/setup-nonce.ts +22 -0
- package/src/auth/trusted-proxy.ts +92 -0
- package/src/auth/types.ts +114 -4
- package/src/cli/commands/bundle.ts +3 -1
- package/src/components/EmDashImage.astro +7 -6
- package/src/components/Gallery.astro +5 -3
- package/src/components/Image.astro +8 -3
- package/src/components/InlinePortableTextEditor.tsx +2 -1
- package/src/components/LiveSearch.astro +5 -14
- package/src/database/migrations/035_bounded_404_log.ts +112 -0
- package/src/database/migrations/runner.ts +2 -0
- package/src/database/repositories/audit.ts +6 -8
- package/src/database/repositories/byline.ts +6 -8
- package/src/database/repositories/comment.ts +12 -16
- package/src/database/repositories/content.ts +79 -40
- package/src/database/repositories/index.ts +1 -1
- package/src/database/repositories/media.ts +10 -13
- package/src/database/repositories/options.ts +25 -0
- package/src/database/repositories/plugin-storage.ts +4 -6
- package/src/database/repositories/redirect.ts +123 -24
- package/src/database/repositories/taxonomy.ts +14 -3
- package/src/database/repositories/types.ts +57 -8
- package/src/database/repositories/user.ts +6 -8
- package/src/database/types.ts +9 -0
- package/src/emdash-runtime.ts +309 -91
- package/src/import/registry.ts +4 -3
- package/src/import/ssrf.ts +253 -12
- package/src/index.ts +5 -1
- package/src/loader.ts +6 -5
- package/src/mcp/server.ts +753 -107
- package/src/media/normalize.ts +1 -1
- package/src/media/url.ts +78 -0
- package/src/plugins/context.ts +15 -3
- package/src/plugins/email-console.ts +10 -3
- package/src/plugins/hooks.ts +11 -0
- package/src/plugins/manager.ts +6 -0
- package/src/plugins/manifest-schema.ts +12 -0
- package/src/plugins/request-meta.ts +66 -15
- package/src/plugins/routes.ts +3 -1
- package/src/plugins/types.ts +23 -2
- package/src/query.ts +1 -1
- package/src/request-cache.ts +3 -0
- package/src/schema/registry.ts +41 -5
- package/src/search/fts-manager.ts +0 -2
- package/src/search/query.ts +111 -26
- package/src/search/types.ts +8 -1
- package/src/sections/index.ts +7 -9
- package/src/seed/apply.ts +26 -0
- package/src/storage/s3.ts +12 -6
- package/src/virtual-modules.d.ts +21 -1
- package/src/visual-editing/toolbar.ts +6 -1
- package/src/widgets/index.ts +1 -1
- package/dist/apply-B4MsLM-w.mjs.map +0 -1
- package/dist/byline-C4OVd8b3.mjs.map +0 -1
- package/dist/content-BsBoyj8G.mjs.map +0 -1
- package/dist/error-CiYn9yDu.mjs.map +0 -1
- package/dist/index-BYv0mB9g.d.mts.map +0 -1
- package/dist/loader-DeiBJEMe.mjs.map +0 -1
- package/dist/manifest-schema-V30qsMft.mjs.map +0 -1
- package/dist/media-DqHVh136.mjs.map +0 -1
- package/dist/mode-CpNnGkPz.mjs.map +0 -1
- package/dist/redirect-7lGhLBNZ.mjs.map +0 -1
- package/dist/registry-Ci3WxVAr.mjs.map +0 -1
- package/dist/request-cache-DiR961CV.mjs.map +0 -1
- package/dist/runner-Cd-_WyDo.mjs.map +0 -1
- package/dist/search-DI4bM2w9.mjs.map +0 -1
- package/dist/types-CMMN0pNg.mjs +0 -31
- package/dist/types-CMMN0pNg.mjs.map +0 -1
- package/dist/types-DgrIP0tF.d.mts.map +0 -1
- package/dist/version-Uaf2ynPX.mjs +0 -7
package/dist/astro/index.d.mts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import "../types-
|
|
2
|
-
import {
|
|
3
|
-
import "../runner-
|
|
4
|
-
import { r as ContentItem } from "../types-
|
|
5
|
-
import { X as ResolvedPlugin } from "../types-
|
|
6
|
-
import "../validate-
|
|
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":";;;;;;;;;;;;;;;;;
|
|
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"}
|
package/dist/astro/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { t as defaultSeed } from "../default-
|
|
2
|
-
import { n as VERSION, t as COMMIT } from "../version-
|
|
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
|
|
1227
|
-
* directly — giving instant HMR instead of requiring a
|
|
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
|
|
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
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
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
|
-
|
|
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({
|