emdash 0.40.1 → 0.42.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/action-token-DBki7IT4.mjs +26 -0
- package/dist/action-token-DBki7IT4.mjs.map +1 -0
- package/dist/activation-DDuqAat2.mjs +387 -0
- package/dist/activation-DDuqAat2.mjs.map +1 -0
- package/dist/adapters-BrZxU6vM.d.mts +171 -0
- package/dist/adapters-BrZxU6vM.d.mts.map +1 -0
- package/dist/allowed-origins-CFtudhyw.mjs +116 -0
- package/dist/allowed-origins-CFtudhyw.mjs.map +1 -0
- package/dist/api/route-utils.d.mts +5 -4
- package/dist/api/route-utils.d.mts.map +1 -1
- package/dist/api/route-utils.mjs +52 -46
- package/dist/api/route-utils.mjs.map +1 -1
- package/dist/api/schemas/index.d.mts +2 -2
- package/dist/api/schemas/index.mjs +11 -10
- package/dist/api-CFQn8VLR.mjs +4973 -0
- package/dist/api-CFQn8VLR.mjs.map +1 -0
- package/dist/api-tokens-P3mAaQgr.mjs +166 -0
- package/dist/api-tokens-P3mAaQgr.mjs.map +1 -0
- package/dist/apply-C1kq5l7p.mjs +1672 -0
- package/dist/apply-C1kq5l7p.mjs.map +1 -0
- package/dist/approvals-l9sGqPmL.mjs +460 -0
- package/dist/approvals-l9sGqPmL.mjs.map +1 -0
- package/dist/artifact-fetch-CWxyELVI.mjs +659 -0
- package/dist/artifact-fetch-CWxyELVI.mjs.map +1 -0
- package/dist/astro/index.d.mts +14 -14
- package/dist/astro/index.d.mts.map +1 -1
- package/dist/astro/index.mjs +106 -560
- package/dist/astro/index.mjs.map +1 -1
- package/dist/astro/middleware/auth.d.mts +12 -12
- package/dist/astro/middleware/auth.mjs +10 -10
- package/dist/astro/middleware/media-usage-write-fence.mjs +5 -5
- package/dist/astro/middleware/redirect.d.mts.map +1 -1
- package/dist/astro/middleware/redirect.mjs +19 -9
- package/dist/astro/middleware/redirect.mjs.map +1 -1
- package/dist/astro/middleware/request-context.d.mts +2 -1
- package/dist/astro/middleware/request-context.d.mts.map +1 -1
- package/dist/astro/middleware/request-context.mjs +15 -6
- package/dist/astro/middleware/request-context.mjs.map +1 -1
- package/dist/astro/middleware/setup.mjs +1 -1
- package/dist/astro/middleware.d.mts +12 -12
- package/dist/astro/middleware.mjs +114 -107
- package/dist/astro/middleware.mjs.map +1 -1
- package/dist/astro/routes/api/admin/allowed-domains/_domain_.mjs +15 -14
- package/dist/astro/routes/api/admin/allowed-domains/_domain_.mjs.map +1 -1
- package/dist/astro/routes/api/admin/allowed-domains/index.mjs +15 -14
- package/dist/astro/routes/api/admin/allowed-domains/index.mjs.map +1 -1
- package/dist/astro/routes/api/admin/api-tokens/_id_.mjs +6 -6
- package/dist/astro/routes/api/admin/api-tokens/index.mjs +7 -7
- package/dist/astro/routes/api/admin/byline-fields/_slug_/usage.mjs +7 -7
- package/dist/astro/routes/api/admin/byline-fields/_slug_.mjs +18 -17
- package/dist/astro/routes/api/admin/byline-fields/_slug_.mjs.map +1 -1
- package/dist/astro/routes/api/admin/byline-fields/index.mjs +18 -17
- package/dist/astro/routes/api/admin/byline-fields/index.mjs.map +1 -1
- package/dist/astro/routes/api/admin/byline-fields/reorder.mjs +18 -17
- package/dist/astro/routes/api/admin/byline-fields/reorder.mjs.map +1 -1
- package/dist/astro/routes/api/admin/bylines/_id_/index.d.mts.map +1 -1
- package/dist/astro/routes/api/admin/bylines/_id_/index.mjs +36 -27
- package/dist/astro/routes/api/admin/bylines/_id_/index.mjs.map +1 -1
- package/dist/astro/routes/api/admin/bylines/_id_/translations.d.mts.map +1 -1
- package/dist/astro/routes/api/admin/bylines/_id_/translations.mjs +32 -26
- package/dist/astro/routes/api/admin/bylines/_id_/translations.mjs.map +1 -1
- package/dist/astro/routes/api/admin/bylines/index.d.mts.map +1 -1
- package/dist/astro/routes/api/admin/bylines/index.mjs +32 -26
- package/dist/astro/routes/api/admin/bylines/index.mjs.map +1 -1
- package/dist/astro/routes/api/admin/comments/_id_/status.mjs +20 -19
- package/dist/astro/routes/api/admin/comments/_id_/status.mjs.map +1 -1
- package/dist/astro/routes/api/admin/comments/_id_.mjs +8 -8
- package/dist/astro/routes/api/admin/comments/bulk.mjs +19 -18
- package/dist/astro/routes/api/admin/comments/bulk.mjs.map +1 -1
- package/dist/astro/routes/api/admin/comments/counts.mjs +8 -8
- package/dist/astro/routes/api/admin/comments/index.mjs +19 -18
- package/dist/astro/routes/api/admin/comments/index.mjs.map +1 -1
- package/dist/astro/routes/api/admin/core-update.d.mts +8 -0
- package/dist/astro/routes/api/admin/core-update.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/core-update.mjs +28 -0
- package/dist/astro/routes/api/admin/core-update.mjs.map +1 -0
- package/dist/astro/routes/api/admin/hooks/exclusive/_hookName_.mjs +6 -6
- package/dist/astro/routes/api/admin/hooks/exclusive/index.mjs +5 -5
- package/dist/astro/routes/api/admin/media-usage/activation.mjs +21 -20
- package/dist/astro/routes/api/admin/media-usage/activation.mjs.map +1 -1
- package/dist/astro/routes/api/admin/media-usage/collection-deletions/index.mjs +23 -22
- package/dist/astro/routes/api/admin/media-usage/collection-deletions/index.mjs.map +1 -1
- package/dist/astro/routes/api/admin/media-usage/collection-deletions/retry.mjs +23 -22
- package/dist/astro/routes/api/admin/media-usage/collection-deletions/retry.mjs.map +1 -1
- package/dist/astro/routes/api/admin/media-usage/progress.mjs +26 -25
- package/dist/astro/routes/api/admin/media-usage/progress.mjs.map +1 -1
- package/dist/astro/routes/api/admin/media-usage/repair.mjs +32 -31
- package/dist/astro/routes/api/admin/media-usage/repair.mjs.map +1 -1
- package/dist/astro/routes/api/admin/media-usage/work/index.mjs +23 -22
- package/dist/astro/routes/api/admin/media-usage/work/index.mjs.map +1 -1
- package/dist/astro/routes/api/admin/media-usage/work/retry.mjs +23 -22
- package/dist/astro/routes/api/admin/media-usage/work/retry.mjs.map +1 -1
- package/dist/astro/routes/api/admin/oauth-clients/_id_.mjs +6 -6
- package/dist/astro/routes/api/admin/oauth-clients/index.mjs +6 -6
- package/dist/astro/routes/api/admin/plugins/_id_/disable.mjs +8 -8
- package/dist/astro/routes/api/admin/plugins/_id_/enable.mjs +8 -8
- package/dist/astro/routes/api/admin/plugins/_id_/index.mjs +75 -69
- package/dist/astro/routes/api/admin/plugins/_id_/index.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/_id_/mcp.mjs +7 -7
- package/dist/astro/routes/api/admin/plugins/_id_/settings.mjs +74 -68
- package/dist/astro/routes/api/admin/plugins/_id_/settings.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/_id_/uninstall.mjs +75 -69
- package/dist/astro/routes/api/admin/plugins/_id_/uninstall.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/_id_/update.mjs +86 -79
- package/dist/astro/routes/api/admin/plugins/_id_/update.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/index.mjs +75 -69
- package/dist/astro/routes/api/admin/plugins/index.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/icon.d.mts.map +1 -1
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/icon.mjs +10 -7
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/icon.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/index.mjs +74 -68
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/index.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/install.mjs +85 -78
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/install.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/marketplace/index.mjs +74 -68
- package/dist/astro/routes/api/admin/plugins/marketplace/index.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/registry/_id_/uninstall.mjs +75 -69
- package/dist/astro/routes/api/admin/plugins/registry/_id_/uninstall.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/registry/_id_/update.mjs +87 -80
- package/dist/astro/routes/api/admin/plugins/registry/_id_/update.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/registry/artifact.mjs +9 -9
- package/dist/astro/routes/api/admin/plugins/registry/install.mjs +77 -71
- package/dist/astro/routes/api/admin/plugins/registry/install.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/registry/publisher-handle.mjs +7 -7
- package/dist/astro/routes/api/admin/plugins/registry/verify.mjs +75 -69
- package/dist/astro/routes/api/admin/plugins/registry/verify.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/updates.mjs +74 -68
- package/dist/astro/routes/api/admin/plugins/updates.mjs.map +1 -1
- package/dist/astro/routes/api/admin/scheduled-policy-rejections/_collection_/_id_.mjs +6 -6
- package/dist/astro/routes/api/admin/themes/marketplace/_id_/index.mjs +74 -68
- package/dist/astro/routes/api/admin/themes/marketplace/_id_/index.mjs.map +1 -1
- package/dist/astro/routes/api/admin/themes/marketplace/_id_/thumbnail.d.mts.map +1 -1
- package/dist/astro/routes/api/admin/themes/marketplace/_id_/thumbnail.mjs +10 -7
- package/dist/astro/routes/api/admin/themes/marketplace/_id_/thumbnail.mjs.map +1 -1
- package/dist/astro/routes/api/admin/themes/marketplace/index.mjs +74 -68
- package/dist/astro/routes/api/admin/themes/marketplace/index.mjs.map +1 -1
- package/dist/astro/routes/api/admin/transfer/_...path_.mjs +4 -4
- package/dist/astro/routes/api/admin/transfer/approvals/_id_/approve.mjs +42 -41
- package/dist/astro/routes/api/admin/transfer/approvals/_id_/approve.mjs.map +1 -1
- package/dist/astro/routes/api/admin/transfer/approvals/_id_/deny.mjs +42 -41
- package/dist/astro/routes/api/admin/transfer/approvals/_id_/deny.mjs.map +1 -1
- package/dist/astro/routes/api/admin/transfer/approvals/index.mjs +44 -43
- package/dist/astro/routes/api/admin/transfer/approvals/index.mjs.map +1 -1
- package/dist/astro/routes/api/admin/transfer/capabilities.mjs +44 -43
- package/dist/astro/routes/api/admin/transfer/capabilities.mjs.map +1 -1
- package/dist/astro/routes/api/admin/transfer/exports/_id_/advance.mjs +44 -43
- package/dist/astro/routes/api/admin/transfer/exports/_id_/advance.mjs.map +1 -1
- package/dist/astro/routes/api/admin/transfer/exports/_id_/archive.mjs +45 -44
- package/dist/astro/routes/api/admin/transfer/exports/_id_/archive.mjs.map +1 -1
- package/dist/astro/routes/api/admin/transfer/exports/_id_/files/_...path_.mjs +45 -44
- package/dist/astro/routes/api/admin/transfer/exports/_id_/files/_...path_.mjs.map +1 -1
- package/dist/astro/routes/api/admin/transfer/exports/_id_/index.mjs +44 -43
- package/dist/astro/routes/api/admin/transfer/exports/_id_/index.mjs.map +1 -1
- package/dist/astro/routes/api/admin/transfer/exports/_id_/manifest.mjs +45 -44
- package/dist/astro/routes/api/admin/transfer/exports/_id_/manifest.mjs.map +1 -1
- package/dist/astro/routes/api/admin/transfer/exports/index.mjs +46 -45
- package/dist/astro/routes/api/admin/transfer/exports/index.mjs.map +1 -1
- package/dist/astro/routes/api/admin/transfer/imports/_id_/abandon.mjs +44 -43
- package/dist/astro/routes/api/admin/transfer/imports/_id_/abandon.mjs.map +1 -1
- package/dist/astro/routes/api/admin/transfer/imports/_id_/advance.mjs +44 -43
- package/dist/astro/routes/api/admin/transfer/imports/_id_/advance.mjs.map +1 -1
- package/dist/astro/routes/api/admin/transfer/imports/_id_/analyze.mjs +46 -45
- package/dist/astro/routes/api/admin/transfer/imports/_id_/analyze.mjs.map +1 -1
- package/dist/astro/routes/api/admin/transfer/imports/_id_/cancel.mjs +44 -43
- package/dist/astro/routes/api/admin/transfer/imports/_id_/cancel.mjs.map +1 -1
- package/dist/astro/routes/api/admin/transfer/imports/_id_/execute.mjs +46 -45
- package/dist/astro/routes/api/admin/transfer/imports/_id_/execute.mjs.map +1 -1
- package/dist/astro/routes/api/admin/transfer/imports/_id_/files/_...path_.mjs +44 -43
- package/dist/astro/routes/api/admin/transfer/imports/_id_/files/_...path_.mjs.map +1 -1
- package/dist/astro/routes/api/admin/transfer/imports/_id_/index.mjs +44 -43
- package/dist/astro/routes/api/admin/transfer/imports/_id_/index.mjs.map +1 -1
- package/dist/astro/routes/api/admin/transfer/imports/_id_/missing.mjs +46 -45
- package/dist/astro/routes/api/admin/transfer/imports/_id_/missing.mjs.map +1 -1
- package/dist/astro/routes/api/admin/transfer/imports/_id_/plan.mjs +44 -43
- package/dist/astro/routes/api/admin/transfer/imports/_id_/plan.mjs.map +1 -1
- package/dist/astro/routes/api/admin/transfer/imports/_id_/receipt.mjs +44 -43
- package/dist/astro/routes/api/admin/transfer/imports/_id_/receipt.mjs.map +1 -1
- package/dist/astro/routes/api/admin/transfer/imports/index.mjs +46 -45
- package/dist/astro/routes/api/admin/transfer/imports/index.mjs.map +1 -1
- package/dist/astro/routes/api/admin/users/_id_/disable.mjs +5 -5
- package/dist/astro/routes/api/admin/users/_id_/enable.mjs +4 -4
- package/dist/astro/routes/api/admin/users/_id_/index.mjs +16 -15
- package/dist/astro/routes/api/admin/users/_id_/index.mjs.map +1 -1
- package/dist/astro/routes/api/admin/users/_id_/send-recovery.mjs +6 -6
- package/dist/astro/routes/api/admin/users/index.mjs +15 -14
- package/dist/astro/routes/api/admin/users/index.mjs.map +1 -1
- package/dist/astro/routes/api/auth/dev-bypass.mjs +6 -6
- package/dist/astro/routes/api/auth/invite/accept.mjs +4 -4
- package/dist/astro/routes/api/auth/invite/complete.d.mts.map +1 -1
- package/dist/astro/routes/api/auth/invite/complete.mjs +23 -19
- package/dist/astro/routes/api/auth/invite/complete.mjs.map +1 -1
- package/dist/astro/routes/api/auth/invite/index.mjs +17 -16
- package/dist/astro/routes/api/auth/invite/index.mjs.map +1 -1
- package/dist/astro/routes/api/auth/invite/register-options.mjs +18 -17
- package/dist/astro/routes/api/auth/invite/register-options.mjs.map +1 -1
- package/dist/astro/routes/api/auth/logout.mjs +5 -5
- package/dist/astro/routes/api/auth/magic-link/send.mjs +19 -18
- package/dist/astro/routes/api/auth/magic-link/send.mjs.map +1 -1
- package/dist/astro/routes/api/auth/magic-link/verify.d.mts.map +1 -1
- package/dist/astro/routes/api/auth/magic-link/verify.mjs +19 -15
- package/dist/astro/routes/api/auth/magic-link/verify.mjs.map +1 -1
- package/dist/astro/routes/api/auth/me.mjs +16 -15
- package/dist/astro/routes/api/auth/me.mjs.map +1 -1
- package/dist/astro/routes/api/auth/mode.mjs +5 -5
- package/dist/astro/routes/api/auth/oauth/_provider_/callback.d.mts.map +1 -1
- package/dist/astro/routes/api/auth/oauth/_provider_/callback.mjs +13 -4
- package/dist/astro/routes/api/auth/oauth/_provider_/callback.mjs.map +1 -1
- package/dist/astro/routes/api/auth/oauth/_provider_.mjs +2 -2
- package/dist/astro/routes/api/auth/passkey/_id_.mjs +15 -14
- package/dist/astro/routes/api/auth/passkey/_id_.mjs.map +1 -1
- package/dist/astro/routes/api/auth/passkey/index.mjs +4 -4
- package/dist/astro/routes/api/auth/passkey/options.mjs +20 -19
- package/dist/astro/routes/api/auth/passkey/options.mjs.map +1 -1
- package/dist/astro/routes/api/auth/passkey/register/options.mjs +18 -17
- package/dist/astro/routes/api/auth/passkey/register/options.mjs.map +1 -1
- package/dist/astro/routes/api/auth/passkey/register/verify.mjs +19 -18
- package/dist/astro/routes/api/auth/passkey/register/verify.mjs.map +1 -1
- package/dist/astro/routes/api/auth/passkey/verify.d.mts.map +1 -1
- package/dist/astro/routes/api/auth/passkey/verify.mjs +23 -19
- package/dist/astro/routes/api/auth/passkey/verify.mjs.map +1 -1
- package/dist/astro/routes/api/auth/signup/complete.d.mts.map +1 -1
- package/dist/astro/routes/api/auth/signup/complete.mjs +23 -19
- package/dist/astro/routes/api/auth/signup/complete.mjs.map +1 -1
- package/dist/astro/routes/api/auth/signup/request.mjs +18 -17
- package/dist/astro/routes/api/auth/signup/request.mjs.map +1 -1
- package/dist/astro/routes/api/auth/signup/verify.mjs +4 -4
- package/dist/astro/routes/api/comments/_collection_/_contentId_/index.mjs +13 -13
- package/dist/astro/routes/api/comments/_collection_/_contentId_/reactions.mjs +20 -19
- package/dist/astro/routes/api/comments/_collection_/_contentId_/reactions.mjs.map +1 -1
- package/dist/astro/routes/api/content/_collection_/_id_/compare.mjs +5 -5
- package/dist/astro/routes/api/content/_collection_/_id_/discard-draft.mjs +18 -17
- package/dist/astro/routes/api/content/_collection_/_id_/discard-draft.mjs.map +1 -1
- package/dist/astro/routes/api/content/_collection_/_id_/duplicate.mjs +5 -5
- package/dist/astro/routes/api/content/_collection_/_id_/lock.mjs +18 -17
- package/dist/astro/routes/api/content/_collection_/_id_/lock.mjs.map +1 -1
- package/dist/astro/routes/api/content/_collection_/_id_/permanent.mjs +5 -5
- package/dist/astro/routes/api/content/_collection_/_id_/plugin-extensions/_pluginId_/_kind_/_extensionId_.mjs +12 -11
- package/dist/astro/routes/api/content/_collection_/_id_/plugin-extensions/_pluginId_/_kind_/_extensionId_.mjs.map +1 -1
- package/dist/astro/routes/api/content/_collection_/_id_/preview-url.mjs +33 -32
- package/dist/astro/routes/api/content/_collection_/_id_/preview-url.mjs.map +1 -1
- package/dist/astro/routes/api/content/_collection_/_id_/publish.mjs +18 -17
- package/dist/astro/routes/api/content/_collection_/_id_/publish.mjs.map +1 -1
- package/dist/astro/routes/api/content/_collection_/_id_/references/_relation_/children.d.mts +1 -2
- package/dist/astro/routes/api/content/_collection_/_id_/references/_relation_/children.d.mts.map +1 -1
- package/dist/astro/routes/api/content/_collection_/_id_/references/_relation_/children.mjs +44 -54
- package/dist/astro/routes/api/content/_collection_/_id_/references/_relation_/children.mjs.map +1 -1
- package/dist/astro/routes/api/content/_collection_/_id_/references/_relation_/parents.mjs +36 -30
- package/dist/astro/routes/api/content/_collection_/_id_/references/_relation_/parents.mjs.map +1 -1
- package/dist/astro/routes/api/content/_collection_/_id_/restore.mjs +5 -5
- package/dist/astro/routes/api/content/_collection_/_id_/revisions.mjs +5 -5
- package/dist/astro/routes/api/content/_collection_/_id_/schedule.mjs +18 -17
- package/dist/astro/routes/api/content/_collection_/_id_/schedule.mjs.map +1 -1
- package/dist/astro/routes/api/content/_collection_/_id_/terms/_taxonomy_.mjs +27 -25
- package/dist/astro/routes/api/content/_collection_/_id_/terms/_taxonomy_.mjs.map +1 -1
- package/dist/astro/routes/api/content/_collection_/_id_/translations.mjs +5 -5
- package/dist/astro/routes/api/content/_collection_/_id_/unpublish.mjs +18 -17
- package/dist/astro/routes/api/content/_collection_/_id_/unpublish.mjs.map +1 -1
- package/dist/astro/routes/api/content/_collection_/_id_.d.mts.map +1 -1
- package/dist/astro/routes/api/content/_collection_/_id_.mjs +19 -18
- package/dist/astro/routes/api/content/_collection_/_id_.mjs.map +1 -1
- package/dist/astro/routes/api/content/_collection_/authors.mjs +5 -5
- package/dist/astro/routes/api/content/_collection_/index.mjs +16 -15
- package/dist/astro/routes/api/content/_collection_/index.mjs.map +1 -1
- package/dist/astro/routes/api/content/_collection_/trash.mjs +16 -15
- package/dist/astro/routes/api/content/_collection_/trash.mjs.map +1 -1
- package/dist/astro/routes/api/dashboard.mjs +13 -10
- package/dist/astro/routes/api/dashboard.mjs.map +1 -1
- package/dist/astro/routes/api/dev/emails.mjs +5 -5
- package/dist/astro/routes/api/health.mjs +6 -6
- package/dist/astro/routes/api/import/probe.d.mts +3 -3
- package/dist/astro/routes/api/import/probe.mjs +25 -24
- package/dist/astro/routes/api/import/probe.mjs.map +1 -1
- package/dist/astro/routes/api/import/wordpress/analyze.mjs +6 -6
- package/dist/astro/routes/api/import/wordpress/execute.d.mts +14 -14
- package/dist/astro/routes/api/import/wordpress/execute.d.mts.map +1 -1
- package/dist/astro/routes/api/import/wordpress/execute.mjs +167 -21
- package/dist/astro/routes/api/import/wordpress/execute.mjs.map +1 -1
- package/dist/astro/routes/api/import/wordpress/media.d.mts +12 -12
- package/dist/astro/routes/api/import/wordpress/media.mjs +20 -19
- package/dist/astro/routes/api/import/wordpress/media.mjs.map +1 -1
- package/dist/astro/routes/api/import/wordpress/prepare.mjs +19 -18
- package/dist/astro/routes/api/import/wordpress/prepare.mjs.map +1 -1
- package/dist/astro/routes/api/import/wordpress/rewrite-urls.d.mts +13 -13
- package/dist/astro/routes/api/import/wordpress/rewrite-urls.mjs +29 -28
- package/dist/astro/routes/api/import/wordpress/rewrite-urls.mjs.map +1 -1
- package/dist/astro/routes/api/import/wordpress-plugin/analyze.d.mts +1 -1
- package/dist/astro/routes/api/import/wordpress-plugin/analyze.mjs +25 -24
- package/dist/astro/routes/api/import/wordpress-plugin/analyze.mjs.map +1 -1
- package/dist/astro/routes/api/import/wordpress-plugin/execute.d.mts +13 -13
- package/dist/astro/routes/api/import/wordpress-plugin/execute.mjs +36 -35
- package/dist/astro/routes/api/import/wordpress-plugin/execute.mjs.map +1 -1
- package/dist/astro/routes/api/manifest.mjs +6 -6
- package/dist/astro/routes/api/mcp.mjs +167 -110
- package/dist/astro/routes/api/mcp.mjs.map +1 -1
- package/dist/astro/routes/api/media/_id_/confirm.mjs +20 -19
- package/dist/astro/routes/api/media/_id_/confirm.mjs.map +1 -1
- package/dist/astro/routes/api/media/_id_/replace.mjs +17 -16
- package/dist/astro/routes/api/media/_id_/replace.mjs.map +1 -1
- package/dist/astro/routes/api/media/_id_/upload.mjs +9 -9
- package/dist/astro/routes/api/media/_id_/usage.mjs +34 -33
- package/dist/astro/routes/api/media/_id_/usage.mjs.map +1 -1
- package/dist/astro/routes/api/media/_id_.mjs +32 -31
- package/dist/astro/routes/api/media/_id_.mjs.map +1 -1
- package/dist/astro/routes/api/media/asset/_id_/_filename_.mjs +6 -6
- package/dist/astro/routes/api/media/file/_...key_.mjs +9 -9
- package/dist/astro/routes/api/media/folders/_id_.mjs +17 -16
- package/dist/astro/routes/api/media/folders/_id_.mjs.map +1 -1
- package/dist/astro/routes/api/media/folders/index.mjs +17 -16
- package/dist/astro/routes/api/media/folders/index.mjs.map +1 -1
- package/dist/astro/routes/api/media/providers/_providerId_/_itemId_.mjs +5 -5
- package/dist/astro/routes/api/media/providers/_providerId_/index.mjs +5 -5
- package/dist/astro/routes/api/media/providers/index.mjs +5 -5
- package/dist/astro/routes/api/media/upload-url.mjs +19 -18
- package/dist/astro/routes/api/media/upload-url.mjs.map +1 -1
- package/dist/astro/routes/api/media.mjs +36 -35
- package/dist/astro/routes/api/media.mjs.map +1 -1
- package/dist/astro/routes/api/menus/_name_/items/_id_.mjs +19 -18
- package/dist/astro/routes/api/menus/_name_/items/_id_.mjs.map +1 -1
- package/dist/astro/routes/api/menus/_name_/items.mjs +19 -18
- package/dist/astro/routes/api/menus/_name_/items.mjs.map +1 -1
- package/dist/astro/routes/api/menus/_name_/reorder.mjs +19 -18
- package/dist/astro/routes/api/menus/_name_/reorder.mjs.map +1 -1
- package/dist/astro/routes/api/menus/_name_/translations.mjs +19 -18
- package/dist/astro/routes/api/menus/_name_/translations.mjs.map +1 -1
- package/dist/astro/routes/api/menus/_name_.mjs +19 -18
- package/dist/astro/routes/api/menus/_name_.mjs.map +1 -1
- package/dist/astro/routes/api/menus/index.mjs +19 -18
- package/dist/astro/routes/api/menus/index.mjs.map +1 -1
- package/dist/astro/routes/api/oauth/authorize.mjs +6 -6
- package/dist/astro/routes/api/oauth/device/authorize.d.mts +2 -1
- package/dist/astro/routes/api/oauth/device/authorize.d.mts.map +1 -1
- package/dist/astro/routes/api/oauth/device/authorize.mjs +23 -9
- package/dist/astro/routes/api/oauth/device/authorize.mjs.map +1 -1
- package/dist/astro/routes/api/oauth/device/code.mjs +11 -11
- package/dist/astro/routes/api/oauth/device/token.mjs +10 -10
- package/dist/astro/routes/api/oauth/register.d.mts.map +1 -1
- package/dist/astro/routes/api/oauth/register.mjs +15 -7
- package/dist/astro/routes/api/oauth/register.mjs.map +1 -1
- package/dist/astro/routes/api/oauth/token/refresh.mjs +8 -8
- package/dist/astro/routes/api/oauth/token/revoke.mjs +8 -8
- package/dist/astro/routes/api/oauth/token.mjs +8 -8
- package/dist/astro/routes/api/openapi.json.mjs +21 -20
- package/dist/astro/routes/api/openapi.json.mjs.map +1 -1
- package/dist/astro/routes/api/plugins/_pluginId_/_...path_.mjs +12 -11
- package/dist/astro/routes/api/plugins/_pluginId_/_...path_.mjs.map +1 -1
- package/dist/astro/routes/api/redirects/404s/index.mjs +20 -19
- package/dist/astro/routes/api/redirects/404s/index.mjs.map +1 -1
- package/dist/astro/routes/api/redirects/404s/summary.mjs +20 -19
- package/dist/astro/routes/api/redirects/404s/summary.mjs.map +1 -1
- package/dist/astro/routes/api/redirects/_id_.mjs +20 -19
- package/dist/astro/routes/api/redirects/_id_.mjs.map +1 -1
- package/dist/astro/routes/api/redirects/index.mjs +20 -19
- package/dist/astro/routes/api/redirects/index.mjs.map +1 -1
- package/dist/astro/routes/api/relations/_id_/index.mjs +36 -30
- package/dist/astro/routes/api/relations/_id_/index.mjs.map +1 -1
- package/dist/astro/routes/api/relations/index.mjs +38 -32
- package/dist/astro/routes/api/relations/index.mjs.map +1 -1
- package/dist/astro/routes/api/revisions/_revisionId_/index.mjs +5 -5
- package/dist/astro/routes/api/revisions/_revisionId_/restore.d.mts.map +1 -1
- package/dist/astro/routes/api/revisions/_revisionId_/restore.mjs +26 -6
- package/dist/astro/routes/api/revisions/_revisionId_/restore.mjs.map +1 -1
- package/dist/astro/routes/api/schema/block-types/_slug_/index.mjs +74 -68
- package/dist/astro/routes/api/schema/block-types/_slug_/index.mjs.map +1 -1
- package/dist/astro/routes/api/schema/block-types/_slug_/versions/_version_/activate.mjs +74 -68
- package/dist/astro/routes/api/schema/block-types/_slug_/versions/_version_/activate.mjs.map +1 -1
- package/dist/astro/routes/api/schema/block-types/index.mjs +74 -68
- package/dist/astro/routes/api/schema/block-types/index.mjs.map +1 -1
- package/dist/astro/routes/api/schema/collections/_slug_/fields/_fieldSlug_.mjs +76 -70
- package/dist/astro/routes/api/schema/collections/_slug_/fields/_fieldSlug_.mjs.map +1 -1
- package/dist/astro/routes/api/schema/collections/_slug_/fields/index.mjs +74 -68
- package/dist/astro/routes/api/schema/collections/_slug_/fields/index.mjs.map +1 -1
- package/dist/astro/routes/api/schema/collections/_slug_/fields/reorder.mjs +74 -68
- package/dist/astro/routes/api/schema/collections/_slug_/fields/reorder.mjs.map +1 -1
- package/dist/astro/routes/api/schema/collections/_slug_/index.mjs +74 -68
- package/dist/astro/routes/api/schema/collections/_slug_/index.mjs.map +1 -1
- package/dist/astro/routes/api/schema/collections/index.mjs +74 -68
- package/dist/astro/routes/api/schema/collections/index.mjs.map +1 -1
- package/dist/astro/routes/api/schema/collections/reorder.mjs +74 -68
- package/dist/astro/routes/api/schema/collections/reorder.mjs.map +1 -1
- package/dist/astro/routes/api/schema/index.mjs +17 -16
- package/dist/astro/routes/api/schema/index.mjs.map +1 -1
- package/dist/astro/routes/api/schema/orphans/_slug_.mjs +74 -68
- package/dist/astro/routes/api/schema/orphans/_slug_.mjs.map +1 -1
- package/dist/astro/routes/api/schema/orphans/index.mjs +74 -68
- package/dist/astro/routes/api/schema/orphans/index.mjs.map +1 -1
- package/dist/astro/routes/api/search/enable.mjs +20 -19
- package/dist/astro/routes/api/search/enable.mjs.map +1 -1
- package/dist/astro/routes/api/search/index.mjs +19 -18
- package/dist/astro/routes/api/search/index.mjs.map +1 -1
- package/dist/astro/routes/api/search/rebuild.mjs +20 -19
- package/dist/astro/routes/api/search/rebuild.mjs.map +1 -1
- package/dist/astro/routes/api/search/stats.mjs +9 -9
- package/dist/astro/routes/api/search/suggest.mjs +19 -18
- package/dist/astro/routes/api/search/suggest.mjs.map +1 -1
- package/dist/astro/routes/api/sections/_slug_.mjs +19 -18
- package/dist/astro/routes/api/sections/_slug_.mjs.map +1 -1
- package/dist/astro/routes/api/sections/index.mjs +19 -18
- package/dist/astro/routes/api/sections/index.mjs.map +1 -1
- package/dist/astro/routes/api/settings/backups/archives/_name_.mjs +7 -7
- package/dist/astro/routes/api/settings/backups/archives/index.mjs +7 -7
- package/dist/astro/routes/api/settings/backups/export.mjs +7 -7
- package/dist/astro/routes/api/settings/backups/index.mjs +8 -8
- package/dist/astro/routes/api/settings/email.mjs +6 -6
- package/dist/astro/routes/api/settings.mjs +23 -22
- package/dist/astro/routes/api/settings.mjs.map +1 -1
- package/dist/astro/routes/api/setup/admin-verify.d.mts.map +1 -1
- package/dist/astro/routes/api/setup/admin-verify.mjs +26 -24
- package/dist/astro/routes/api/setup/admin-verify.mjs.map +1 -1
- package/dist/astro/routes/api/setup/admin.mjs +19 -18
- package/dist/astro/routes/api/setup/admin.mjs.map +1 -1
- package/dist/astro/routes/api/setup/dev-bypass.mjs +47 -40
- package/dist/astro/routes/api/setup/dev-bypass.mjs.map +1 -1
- package/dist/astro/routes/api/setup/dev-reset.mjs +4 -4
- package/dist/astro/routes/api/setup/index.mjs +52 -45
- package/dist/astro/routes/api/setup/index.mjs.map +1 -1
- package/dist/astro/routes/api/setup/status.mjs +6 -6
- package/dist/astro/routes/api/snapshot.mjs +8 -8
- package/dist/astro/routes/api/taxonomies/_name_/reorder.mjs +25 -24
- package/dist/astro/routes/api/taxonomies/_name_/reorder.mjs.map +1 -1
- package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_/translations.mjs +25 -24
- package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_/translations.mjs.map +1 -1
- package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_.mjs +25 -24
- package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_.mjs.map +1 -1
- package/dist/astro/routes/api/taxonomies/_name_/terms/index.mjs +25 -24
- package/dist/astro/routes/api/taxonomies/_name_/terms/index.mjs.map +1 -1
- package/dist/astro/routes/api/taxonomies/_name_/translations.mjs +24 -23
- package/dist/astro/routes/api/taxonomies/_name_/translations.mjs.map +1 -1
- package/dist/astro/routes/api/taxonomies/_name_.mjs +25 -24
- package/dist/astro/routes/api/taxonomies/_name_.mjs.map +1 -1
- package/dist/astro/routes/api/taxonomies/bulk-tag.mjs +42 -40
- package/dist/astro/routes/api/taxonomies/bulk-tag.mjs.map +1 -1
- package/dist/astro/routes/api/taxonomies/index.mjs +25 -24
- package/dist/astro/routes/api/taxonomies/index.mjs.map +1 -1
- package/dist/astro/routes/api/themes/preview.mjs +6 -6
- package/dist/astro/routes/api/typegen.d.mts.map +1 -1
- package/dist/astro/routes/api/typegen.mjs +8 -39
- package/dist/astro/routes/api/typegen.mjs.map +1 -1
- package/dist/astro/routes/api/visual-editing/action-token.mjs +6 -6
- package/dist/astro/routes/api/visual-editing/content/_collection_/_id_/publish.mjs +20 -19
- package/dist/astro/routes/api/visual-editing/content/_collection_/_id_/publish.mjs.map +1 -1
- package/dist/astro/routes/api/visual-editing/toolbar-labels.mjs +4 -4
- package/dist/astro/routes/api/well-known/auth.mjs +1 -1
- package/dist/astro/routes/api/well-known/oauth-authorization-server.mjs +2 -2
- package/dist/astro/routes/api/well-known/oauth-protected-resource.mjs +2 -2
- package/dist/astro/routes/api/widget-areas/_name_/reorder.mjs +17 -16
- package/dist/astro/routes/api/widget-areas/_name_/reorder.mjs.map +1 -1
- package/dist/astro/routes/api/widget-areas/_name_/widgets/_id_.mjs +20 -19
- package/dist/astro/routes/api/widget-areas/_name_/widgets/_id_.mjs.map +1 -1
- package/dist/astro/routes/api/widget-areas/_name_/widgets.mjs +20 -19
- package/dist/astro/routes/api/widget-areas/_name_/widgets.mjs.map +1 -1
- package/dist/astro/routes/api/widget-areas/_name_.mjs +9 -9
- package/dist/astro/routes/api/widget-areas/index.mjs +20 -19
- package/dist/astro/routes/api/widget-areas/index.mjs.map +1 -1
- package/dist/astro/routes/api/widget-components.mjs +5 -5
- package/dist/astro/routes/robots.txt.mjs +7 -7
- package/dist/astro/routes/sitemap-_collection_.xml.mjs +10 -10
- package/dist/astro/routes/sitemap.xml.mjs +8 -8
- package/dist/astro/types.d.mts +30 -18
- package/dist/astro/types.d.mts.map +1 -1
- package/dist/audit-BszbE_BP.mjs +127 -0
- package/dist/audit-BszbE_BP.mjs.map +1 -0
- package/dist/auth/providers/github.d.mts +1 -1
- package/dist/auth/providers/google.d.mts +1 -1
- package/dist/authoritative-records-dSvXCfzb.mjs +5172 -0
- package/dist/authoritative-records-dSvXCfzb.mjs.map +1 -0
- package/dist/authorize-soZXK7U0.mjs +49 -0
- package/dist/authorize-soZXK7U0.mjs.map +1 -0
- package/dist/backup-DQ3CABsO.mjs +246 -0
- package/dist/backup-DQ3CABsO.mjs.map +1 -0
- package/dist/block-types-DIG_KZwi.mjs +132 -0
- package/dist/block-types-DIG_KZwi.mjs.map +1 -0
- package/dist/block-values-BrTrtA-v.mjs +175 -0
- package/dist/block-values-BrTrtA-v.mjs.map +1 -0
- package/dist/byline-02tu_Uc-.mjs +909 -0
- package/dist/byline-02tu_Uc-.mjs.map +1 -0
- package/dist/byline-fields-B01Txzyx.mjs +123 -0
- package/dist/byline-fields-B01Txzyx.mjs.map +1 -0
- package/dist/byline-fields-DHJs0Mja.mjs +280 -0
- package/dist/byline-fields-DHJs0Mja.mjs.map +1 -0
- package/dist/byline-registry-dvt4N3xV.mjs +406 -0
- package/dist/byline-registry-dvt4N3xV.mjs.map +1 -0
- package/dist/bylines-COTwmMBF.mjs +150 -0
- package/dist/bylines-COTwmMBF.mjs.map +1 -0
- package/dist/bylines-D_S8UKRX.mjs +214 -0
- package/dist/bylines-D_S8UKRX.mjs.map +1 -0
- package/dist/cache-CPanL9IO.mjs +114 -0
- package/dist/cache-CPanL9IO.mjs.map +1 -0
- package/dist/canonical-CAecl1UQ.mjs +174 -0
- package/dist/canonical-CAecl1UQ.mjs.map +1 -0
- package/dist/capture-triggers-CdZfvHtF.mjs +362 -0
- package/dist/capture-triggers-CdZfvHtF.mjs.map +1 -0
- package/dist/challenge-store-CxZxPqaw.mjs +51 -0
- package/dist/challenge-store-CxZxPqaw.mjs.map +1 -0
- package/dist/checksum-DtH6m5uk.mjs +162 -0
- package/dist/checksum-DtH6m5uk.mjs.map +1 -0
- package/dist/chrome-tags-CKELm-bo.mjs +24 -0
- package/dist/chrome-tags-CKELm-bo.mjs.map +1 -0
- package/dist/chunks-DBmkKmBH.mjs +25 -0
- package/dist/chunks-DBmkKmBH.mjs.map +1 -0
- package/dist/cli/index.mjs +380 -1620
- package/dist/cli/index.mjs.map +1 -1
- package/dist/client/cf-access.d.mts +1 -1
- package/dist/client/index.d.mts +39 -34
- package/dist/client/index.d.mts.map +1 -1
- package/dist/client/index.mjs +8 -3
- package/dist/client/index.mjs.map +1 -1
- package/dist/collection-deletion-JecE26cS.mjs +436 -0
- package/dist/collection-deletion-JecE26cS.mjs.map +1 -0
- package/dist/collection-deletion-processor-DgCfF3a1.mjs +217 -0
- package/dist/collection-deletion-processor-DgCfF3a1.mjs.map +1 -0
- package/dist/collection-slugs-cache-BNRAPNiu.mjs +85 -0
- package/dist/collection-slugs-cache-BNRAPNiu.mjs.map +1 -0
- package/dist/comment-Cq1UYN8_.mjs +313 -0
- package/dist/comment-Cq1UYN8_.mjs.map +1 -0
- package/dist/comment-reaction-DPeGAfjd.mjs +85 -0
- package/dist/comment-reaction-DPeGAfjd.mjs.map +1 -0
- package/dist/comments-BRtp992B.mjs +99 -0
- package/dist/comments-BRtp992B.mjs.map +1 -0
- package/dist/comments-Bi2j9IoX.mjs +195 -0
- package/dist/comments-Bi2j9IoX.mjs.map +1 -0
- package/dist/components-CQY-Sgm-.mjs +108 -0
- package/dist/components-CQY-Sgm-.mjs.map +1 -0
- package/dist/config-BnuORwSP.mjs +242 -0
- package/dist/config-BnuORwSP.mjs.map +1 -0
- package/dist/config-CDmPF4p7.d.mts +39 -0
- package/dist/config-CDmPF4p7.d.mts.map +1 -0
- package/dist/config-DHsDMpXc.d.mts +6707 -0
- package/dist/config-DHsDMpXc.d.mts.map +1 -0
- package/dist/connection-B9pIasFd.mjs +36 -0
- package/dist/connection-B9pIasFd.mjs.map +1 -0
- package/dist/content-RzEXY3QX.mjs +2020 -0
- package/dist/content-RzEXY3QX.mjs.map +1 -0
- package/dist/content-list-query-CnXfe1Nu.d.mts +26 -0
- package/dist/content-list-query-CnXfe1Nu.d.mts.map +1 -0
- package/dist/content-policy-Dm32n9C6.mjs +46 -0
- package/dist/content-policy-Dm32n9C6.mjs.map +1 -0
- package/dist/content-repair-B-k5JrVN.mjs +442 -0
- package/dist/content-repair-B-k5JrVN.mjs.map +1 -0
- package/dist/context-CtRvoSAj.mjs +2026 -0
- package/dist/context-CtRvoSAj.mjs.map +1 -0
- package/dist/credits-CAFPFhuk.mjs +110 -0
- package/dist/credits-CAFPFhuk.mjs.map +1 -0
- package/dist/cron-xe5XKqA-.mjs +306 -0
- package/dist/cron-xe5XKqA-.mjs.map +1 -0
- package/dist/dashboard-BoV4pwPP.mjs +151 -0
- package/dist/dashboard-BoV4pwPP.mjs.map +1 -0
- package/dist/db/index.d.mts +3 -3
- package/dist/db/index.mjs +1 -1
- package/dist/db/libsql-migrations.d.mts +1 -1
- package/dist/db/libsql-migrations.mjs +4 -4
- package/dist/db/libsql.d.mts +1 -1
- package/dist/db/postgres-migrations.d.mts +1 -1
- package/dist/db/postgres-migrations.mjs +4 -4
- package/dist/db/postgres.d.mts +1 -1
- package/dist/db/sqlite-migrations.d.mts +1 -1
- package/dist/db/sqlite-migrations.mjs +4 -4
- package/dist/db/sqlite.d.mts +1 -1
- package/dist/db/sqlite.mjs +1 -1
- package/dist/default-DaoYyFRS.mjs +81 -0
- package/dist/default-DaoYyFRS.mjs.map +1 -0
- package/dist/deferred-tasks-OBADxoFf.d.mts +9 -0
- package/dist/deferred-tasks-OBADxoFf.d.mts.map +1 -0
- package/dist/destination-r2zIAZ2S.mjs +18 -0
- package/dist/destination-r2zIAZ2S.mjs.map +1 -0
- package/dist/dev-typegen-8JlYYFno.mjs +29 -0
- package/dist/dev-typegen-8JlYYFno.mjs.map +1 -0
- package/dist/device-flow-CzKi6tID.mjs +521 -0
- package/dist/device-flow-CzKi6tID.mjs.map +1 -0
- package/dist/digest-DiYAoZpf.mjs +194 -0
- package/dist/digest-DiYAoZpf.mjs.map +1 -0
- package/dist/direct-executor-CsEmH_2m.mjs +104 -0
- package/dist/direct-executor-CsEmH_2m.mjs.map +1 -0
- package/dist/dist-Cfu8mMBs.mjs +810 -0
- package/dist/dist-Cfu8mMBs.mjs.map +1 -0
- package/dist/email-console-DmqVF5J_.mjs +50 -0
- package/dist/email-console-DmqVF5J_.mjs.map +1 -0
- package/dist/email-locale-B5OjmAj_.mjs +25 -0
- package/dist/email-locale-B5OjmAj_.mjs.map +1 -0
- package/dist/emdash-runtime-CMdYH2Of.mjs +4229 -0
- package/dist/emdash-runtime-CMdYH2Of.mjs.map +1 -0
- package/dist/enrich-BDdVNeDK.mjs +194 -0
- package/dist/enrich-BDdVNeDK.mjs.map +1 -0
- package/dist/entry-lock-B-1bUDxX.d.mts +4544 -0
- package/dist/entry-lock-B-1bUDxX.d.mts.map +1 -0
- package/dist/entry-lock-B5eaZEZP.mjs +163 -0
- package/dist/entry-lock-B5eaZEZP.mjs.map +1 -0
- package/dist/entry-lock-PP1JCXBB.mjs +1180 -0
- package/dist/entry-lock-PP1JCXBB.mjs.map +1 -0
- package/dist/entry-locks-DJAqVweV.mjs +167 -0
- package/dist/entry-locks-DJAqVweV.mjs.map +1 -0
- package/dist/env-types-BaTCgn-y.mjs +38 -0
- package/dist/env-types-BaTCgn-y.mjs.map +1 -0
- package/dist/error-CEdm_AWU.mjs +90 -0
- package/dist/error-CEdm_AWU.mjs.map +1 -0
- package/dist/errors-CNvATh_7.mjs +469 -0
- package/dist/errors-CNvATh_7.mjs.map +1 -0
- package/dist/errors-CjXd1LgH.mjs +120 -0
- package/dist/errors-CjXd1LgH.mjs.map +1 -0
- package/dist/escape-nJW7dR0s.mjs +9 -0
- package/dist/escape-nJW7dR0s.mjs.map +1 -0
- package/dist/fence-BrnQffdY.mjs +162 -0
- package/dist/fence-BrnQffdY.mjs.map +1 -0
- package/dist/field-defs-cache-DEkFYCDE.mjs +77 -0
- package/dist/field-defs-cache-DEkFYCDE.mjs.map +1 -0
- package/dist/field-map-Cp5hDSRU.mjs +83 -0
- package/dist/field-map-Cp5hDSRU.mjs.map +1 -0
- package/dist/focal-point-JX8kcOTQ.mjs +23 -0
- package/dist/focal-point-JX8kcOTQ.mjs.map +1 -0
- package/dist/fts-manager-DU03MxWu.mjs +443 -0
- package/dist/fts-manager-DU03MxWu.mjs.map +1 -0
- package/dist/gc-Gf9LOF42.mjs +75 -0
- package/dist/gc-Gf9LOF42.mjs.map +1 -0
- package/dist/hash-CY4QdeMJ.mjs +37 -0
- package/dist/hash-CY4QdeMJ.mjs.map +1 -0
- package/dist/hook-result-DjdVwWpw.d.mts +31 -0
- package/dist/hook-result-DjdVwWpw.d.mts.map +1 -0
- package/dist/hreflang-Bq0ahAd4.mjs +105 -0
- package/dist/hreflang-Bq0ahAd4.mjs.map +1 -0
- package/dist/hreflang-C7ETs0Tv.d.mts +50 -0
- package/dist/hreflang-C7ETs0Tv.d.mts.map +1 -0
- package/dist/http-route-dispatch-B2G7_OOm.mjs +339 -0
- package/dist/http-route-dispatch-B2G7_OOm.mjs.map +1 -0
- package/dist/identity-u3KgtUC9.mjs +35 -0
- package/dist/identity-u3KgtUC9.mjs.map +1 -0
- package/dist/import-CzP9ffo0.mjs +2020 -0
- package/dist/import-CzP9ffo0.mjs.map +1 -0
- package/dist/index-D1_ykO2u.d.mts +623 -0
- package/dist/index-D1_ykO2u.d.mts.map +1 -0
- package/dist/index.d.mts +24 -24
- package/dist/index.mjs +108 -102
- package/dist/install-finalization-TbcQozrV.mjs +58 -0
- package/dist/install-finalization-TbcQozrV.mjs.map +1 -0
- package/dist/keys-r08WvAng.mjs +61 -0
- package/dist/keys-r08WvAng.mjs.map +1 -0
- package/dist/kinds-CXY-fwQ6.mjs +974 -0
- package/dist/kinds-CXY-fwQ6.mjs.map +1 -0
- package/dist/lifecycle-CpebZNAA.mjs +25 -0
- package/dist/lifecycle-CpebZNAA.mjs.map +1 -0
- package/dist/load-dHcR5yh9.mjs +28 -0
- package/dist/load-dHcR5yh9.mjs.map +1 -0
- package/dist/loader-B_bcoE1h.mjs +1197 -0
- package/dist/loader-B_bcoE1h.mjs.map +1 -0
- package/dist/loops-Dn1i16FP.mjs +205 -0
- package/dist/loops-Dn1i16FP.mjs.map +1 -0
- package/dist/manifest-builder-D7Y8iirE.mjs +189 -0
- package/dist/manifest-builder-D7Y8iirE.mjs.map +1 -0
- package/dist/manifest-schema-gy37bD_D.mjs +496 -0
- package/dist/manifest-schema-gy37bD_D.mjs.map +1 -0
- package/dist/marketplace-tHWSsCUo.mjs +257 -0
- package/dist/marketplace-tHWSsCUo.mjs.map +1 -0
- package/dist/media/image-endpoint.mjs +1 -1
- package/dist/media/index.d.mts +1 -1
- package/dist/media/index.mjs +4 -4
- package/dist/media/local-runtime.d.mts +14 -14
- package/dist/media/local-runtime.mjs +7 -7
- package/dist/media-3v7mqAVX.mjs +294 -0
- package/dist/media-3v7mqAVX.mjs.map +1 -0
- package/dist/media-CputjGE1.mjs +373 -0
- package/dist/media-CputjGE1.mjs.map +1 -0
- package/dist/media-D1z_jisb.mjs +408 -0
- package/dist/media-D1z_jisb.mjs.map +1 -0
- package/dist/media-allowlist-D5a4d-RA.mjs +44 -0
- package/dist/media-allowlist-D5a4d-RA.mjs.map +1 -0
- package/dist/media-folders-D2VdVBf6.mjs +210 -0
- package/dist/media-folders-D2VdVBf6.mjs.map +1 -0
- package/dist/media-url-DloW2xrP.mjs +43 -0
- package/dist/media-url-DloW2xrP.mjs.map +1 -0
- package/dist/media-usage-B8q0owWQ.mjs +1629 -0
- package/dist/media-usage-B8q0owWQ.mjs.map +1 -0
- package/dist/media-usage-activation-CQWOOTJi.mjs +78 -0
- package/dist/media-usage-activation-CQWOOTJi.mjs.map +1 -0
- package/dist/media-usage-work-BC0qpkMD.mjs +152 -0
- package/dist/media-usage-work-BC0qpkMD.mjs.map +1 -0
- package/dist/media-usage-work-BlMjwPg8.mjs +586 -0
- package/dist/media-usage-work-BlMjwPg8.mjs.map +1 -0
- package/dist/menus-BQKqf0Up.mjs +92 -0
- package/dist/menus-BQKqf0Up.mjs.map +1 -0
- package/dist/menus-DiuhXKWf.mjs +3646 -0
- package/dist/menus-DiuhXKWf.mjs.map +1 -0
- package/dist/menus-trvc6_fW.mjs +753 -0
- package/dist/menus-trvc6_fW.mjs.map +1 -0
- package/dist/migrations/index.d.mts +1 -1
- package/dist/migrations/index.mjs +3 -3
- package/dist/mime-IZf-LHIS.mjs +36 -0
- package/dist/mime-IZf-LHIS.mjs.map +1 -0
- package/dist/mode-nh0ppSX5.mjs +23 -0
- package/dist/mode-nh0ppSX5.mjs.map +1 -0
- package/dist/node-sqlite-compat-CDOEcc97.mjs +63 -0
- package/dist/node-sqlite-compat-CDOEcc97.mjs.map +1 -0
- package/dist/normalize-BuWa0lvd.mjs +191 -0
- package/dist/normalize-BuWa0lvd.mjs.map +1 -0
- package/dist/oauth-authorization-BcRdGojQ.mjs +274 -0
- package/dist/oauth-authorization-BcRdGojQ.mjs.map +1 -0
- package/dist/oauth-clients-C-8WDTqj.mjs +266 -0
- package/dist/oauth-clients-C-8WDTqj.mjs.map +1 -0
- package/dist/oauth-state-store-CM5ZEYQS.mjs +50 -0
- package/dist/oauth-state-store-CM5ZEYQS.mjs.map +1 -0
- package/dist/oauth-user-lookup-DrrqvTZC.mjs +26 -0
- package/dist/oauth-user-lookup-DrrqvTZC.mjs.map +1 -0
- package/dist/object-cache/memory.d.mts +1 -1
- package/dist/object-cache-Bo6DGaC9.mjs +586 -0
- package/dist/object-cache-Bo6DGaC9.mjs.map +1 -0
- package/dist/options-C2IDQnD2.d.mts +81 -0
- package/dist/options-C2IDQnD2.d.mts.map +1 -0
- package/dist/ownership-DoeAIuTg.mjs +12 -0
- package/dist/ownership-DoeAIuTg.mjs.map +1 -0
- package/dist/page/index.d.mts +2 -2
- package/dist/page/index.mjs +6 -6
- package/dist/parse-D5Sw9wAI.d.mts +172 -0
- package/dist/parse-D5Sw9wAI.d.mts.map +1 -0
- package/dist/parse-Gt2l4Sld.mjs +81 -0
- package/dist/parse-Gt2l4Sld.mjs.map +1 -0
- package/dist/passkey-config-CkQsrcU-.mjs +46 -0
- package/dist/passkey-config-CkQsrcU-.mjs.map +1 -0
- package/dist/paths-DiENGBx5.mjs +77 -0
- package/dist/paths-DiENGBx5.mjs.map +1 -0
- package/dist/patterns-DyZJ67I7.mjs +140 -0
- package/dist/patterns-DyZJ67I7.mjs.map +1 -0
- package/dist/placeholder-Cq5wLDCX.d.mts +306 -0
- package/dist/placeholder-Cq5wLDCX.d.mts.map +1 -0
- package/dist/plan-BxCS1tl5.mjs +135 -0
- package/dist/plan-BxCS1tl5.mjs.map +1 -0
- package/dist/plugin-test-runtime.d.mts +14 -14
- package/dist/plugin-test-runtime.mjs +115 -108
- package/dist/plugin-types.d.mts +5 -3
- package/dist/plugin-types.d.mts.map +1 -1
- package/dist/plugin-types.mjs.map +1 -1
- package/dist/plugin-utils.d.mts +12 -12
- package/dist/plugins/adapt-sandbox-entry.d.mts +12 -12
- package/dist/plugins/adapt-sandbox-entry.d.mts.map +1 -1
- package/dist/plugins/adapt-sandbox-entry.mjs +48 -10
- package/dist/plugins/adapt-sandbox-entry.mjs.map +1 -1
- package/dist/plugins/host.d.mts +6 -6
- package/dist/plugins/host.mjs +49 -43
- package/dist/plugins-BpLkXA1S.mjs +277 -0
- package/dist/plugins-BpLkXA1S.mjs.map +1 -0
- package/dist/policy-C1qpNxrr.mjs +45 -0
- package/dist/policy-C1qpNxrr.mjs.map +1 -0
- package/dist/portable-text-BnRuiR1-.mjs +307 -0
- package/dist/portable-text-BnRuiR1-.mjs.map +1 -0
- package/dist/preview-DU5rwz_m.mjs +107 -0
- package/dist/preview-DU5rwz_m.mjs.map +1 -0
- package/dist/protocol-B9GEhEyi.d.mts +61 -0
- package/dist/protocol-B9GEhEyi.d.mts.map +1 -0
- package/dist/public-submission-yZaTTfsC.mjs +250 -0
- package/dist/public-submission-yZaTTfsC.mjs.map +1 -0
- package/dist/public-url-B5a0QAh6.mjs +101 -0
- package/dist/public-url-B5a0QAh6.mjs.map +1 -0
- package/dist/query-6e2CQxUv.mjs +1161 -0
- package/dist/query-6e2CQxUv.mjs.map +1 -0
- package/dist/query-DC3bv__4.mjs +41 -0
- package/dist/query-DC3bv__4.mjs.map +1 -0
- package/dist/rate-limit-BXx3Ecp9.mjs +120 -0
- package/dist/rate-limit-BXx3Ecp9.mjs.map +1 -0
- package/dist/receipt-q1VK9jhj.mjs +43 -0
- package/dist/receipt-q1VK9jhj.mjs.map +1 -0
- package/dist/redirect-BvFKh8Sz.mjs +416 -0
- package/dist/redirect-BvFKh8Sz.mjs.map +1 -0
- package/dist/redirect-D1AmADlk.mjs +19 -0
- package/dist/redirect-D1AmADlk.mjs.map +1 -0
- package/dist/redirects-CWQMKYOS.mjs +446 -0
- package/dist/redirects-CWQMKYOS.mjs.map +1 -0
- package/dist/redirects-D4EWeXAo.mjs +148 -0
- package/dist/redirects-D4EWeXAo.mjs.map +1 -0
- package/dist/registry/testing.d.mts +16 -4
- package/dist/registry/testing.d.mts.map +1 -1
- package/dist/registry/testing.mjs +20 -10
- package/dist/registry/testing.mjs.map +1 -1
- package/dist/registry-CtHRqVe-.mjs +6771 -0
- package/dist/registry-CtHRqVe-.mjs.map +1 -0
- package/dist/relations-CVI2nbrn.mjs +776 -0
- package/dist/relations-CVI2nbrn.mjs.map +1 -0
- package/dist/request-cache-C4CIo5ad.mjs +104 -0
- package/dist/request-cache-C4CIo5ad.mjs.map +1 -0
- package/dist/request-context.d.mts +9 -1
- package/dist/request-context.d.mts.map +1 -1
- package/dist/request-context.mjs.map +1 -1
- package/dist/request-meta-B6blULFY.mjs +141 -0
- package/dist/request-meta-B6blULFY.mjs.map +1 -0
- package/dist/resolve-Cx0Pwz0-.mjs +100 -0
- package/dist/resolve-Cx0Pwz0-.mjs.map +1 -0
- package/dist/resolve-D-kqyKns.mjs +199 -0
- package/dist/resolve-D-kqyKns.mjs.map +1 -0
- package/dist/revision-CGkQA0e5.mjs +366 -0
- package/dist/revision-CGkQA0e5.mjs.map +1 -0
- package/dist/route-wire-DK600v4u.mjs +197 -0
- package/dist/route-wire-DK600v4u.mjs.map +1 -0
- package/dist/routes-DTduBPzX.mjs +272 -0
- package/dist/routes-DTduBPzX.mjs.map +1 -0
- package/dist/runner-CLpxmhl8.mjs +6197 -0
- package/dist/runner-CLpxmhl8.mjs.map +1 -0
- package/dist/runner-Ji7qyH2A.d.mts +68 -0
- package/dist/runner-Ji7qyH2A.d.mts.map +1 -0
- package/dist/runtime.d.mts +13 -13
- package/dist/runtime.mjs +3 -3
- package/dist/schema/project-env-types.d.mts +12 -0
- package/dist/schema/project-env-types.d.mts.map +1 -0
- package/dist/schema/project-env-types.mjs +86 -0
- package/dist/schema/project-env-types.mjs.map +1 -0
- package/dist/schema-BZPj3kwZ.mjs +13 -0
- package/dist/schema-BZPj3kwZ.mjs.map +1 -0
- package/dist/schema-Berj5VQx.mjs +815 -0
- package/dist/schema-Berj5VQx.mjs.map +1 -0
- package/dist/scopes-C1HJaIyf.mjs +34 -0
- package/dist/scopes-C1HJaIyf.mjs.map +1 -0
- package/dist/search-thYf8j9F.mjs +448 -0
- package/dist/search-thYf8j9F.mjs.map +1 -0
- package/dist/sections-2k1uIgJ0.mjs +346 -0
- package/dist/sections-2k1uIgJ0.mjs.map +1 -0
- package/dist/seed/index.d.mts +2 -2
- package/dist/seed/index.mjs +39 -32
- package/dist/seo/index.d.mts +3 -3
- package/dist/seo/index.mjs +24 -22
- package/dist/seo/index.mjs.map +1 -1
- package/dist/seo-C61bnPuV.mjs +114 -0
- package/dist/seo-C61bnPuV.mjs.map +1 -0
- package/dist/seo-DpYxmGaL.mjs +133 -0
- package/dist/seo-DpYxmGaL.mjs.map +1 -0
- package/dist/service-BFUImckH.mjs +150 -0
- package/dist/service-BFUImckH.mjs.map +1 -0
- package/dist/session-user-DVcHsFD5.mjs +61 -0
- package/dist/session-user-DVcHsFD5.mjs.map +1 -0
- package/dist/settings-B0zQj_Tj.mjs +61 -0
- package/dist/settings-B0zQj_Tj.mjs.map +1 -0
- package/dist/settings-BJjK_X7x.mjs +51 -0
- package/dist/settings-BJjK_X7x.mjs.map +1 -0
- package/dist/settings-BbVRRGDp.mjs +439 -0
- package/dist/settings-BbVRRGDp.mjs.map +1 -0
- package/dist/setup-complete-CuLcTDTU.mjs +65 -0
- package/dist/setup-complete-CuLcTDTU.mjs.map +1 -0
- package/dist/setup-nonce-CAQoY5PC.mjs +25 -0
- package/dist/setup-nonce-CAQoY5PC.mjs.map +1 -0
- package/dist/site-settings-AYFvhwQn.mjs +50 -0
- package/dist/site-settings-AYFvhwQn.mjs.map +1 -0
- package/dist/site-url-Ceq_AUK0.mjs +16 -0
- package/dist/site-url-Ceq_AUK0.mjs.map +1 -0
- package/dist/snapshot-Dzsn3NZa.mjs +414 -0
- package/dist/snapshot-Dzsn3NZa.mjs.map +1 -0
- package/dist/ssrf-DsmvZB80.mjs +406 -0
- package/dist/ssrf-DsmvZB80.mjs.map +1 -0
- package/dist/stage-Cf9PqdUB.mjs +662 -0
- package/dist/stage-Cf9PqdUB.mjs.map +1 -0
- package/dist/staged-Bw5eHbKS.mjs +686 -0
- package/dist/staged-Bw5eHbKS.mjs.map +1 -0
- package/dist/state-kGdOMQRY.mjs +153 -0
- package/dist/state-kGdOMQRY.mjs.map +1 -0
- package/dist/status-D39Fpy8R.mjs +30 -0
- package/dist/status-D39Fpy8R.mjs.map +1 -0
- 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.mjs +1 -1
- package/dist/storage-query-C9bK0Dg6.d.mts +1614 -0
- package/dist/storage-query-C9bK0Dg6.d.mts.map +1 -0
- package/dist/tar-lDI_fzLD.mjs +449 -0
- package/dist/tar-lDI_fzLD.mjs.map +1 -0
- package/dist/target-DOFs5oUC.mjs +27 -0
- package/dist/target-DOFs5oUC.mjs.map +1 -0
- package/dist/taxonomies-DQGomz9p.mjs +939 -0
- package/dist/taxonomies-DQGomz9p.mjs.map +1 -0
- package/dist/taxonomies-DWv-OYT0.mjs +697 -0
- package/dist/taxonomies-DWv-OYT0.mjs.map +1 -0
- package/dist/taxonomy-BesdHIwi.mjs +525 -0
- package/dist/taxonomy-BesdHIwi.mjs.map +1 -0
- package/dist/tokens-BIGxi8sP.mjs +171 -0
- package/dist/tokens-BIGxi8sP.mjs.map +1 -0
- package/dist/transaction-BVYIo_yu.mjs +29 -0
- package/dist/transaction-BVYIo_yu.mjs.map +1 -0
- package/dist/transfer-BtzoaXLk.mjs +166 -0
- package/dist/transfer-BtzoaXLk.mjs.map +1 -0
- package/dist/transfer-DLu_6AXL.mjs +8856 -0
- package/dist/transfer-DLu_6AXL.mjs.map +1 -0
- package/dist/transfer-download-b_PCrqJJ.mjs +33 -0
- package/dist/transfer-download-b_PCrqJJ.mjs.map +1 -0
- package/dist/transformations-DdnpSdeC.mjs +196 -0
- package/dist/transformations-DdnpSdeC.mjs.map +1 -0
- package/dist/transport-flR-Zmds.d.mts +42 -0
- package/dist/transport-flR-Zmds.d.mts.map +1 -0
- package/dist/transport-umzEbgYO.mjs +136 -0
- package/dist/transport-umzEbgYO.mjs.map +1 -0
- package/dist/trusted-proxy-BqfQFs6a.mjs +51 -0
- package/dist/trusted-proxy-BqfQFs6a.mjs.map +1 -0
- package/dist/turnstile-IvQp2uyD.mjs +53 -0
- package/dist/turnstile-IvQp2uyD.mjs.map +1 -0
- package/dist/types-2V_MVPYy.d.mts +125 -0
- package/dist/types-2V_MVPYy.d.mts.map +1 -0
- package/dist/types-B-WCvzdi.d.mts +198 -0
- package/dist/types-B-WCvzdi.d.mts.map +1 -0
- package/dist/types-BGmQ0uXs.mjs +201 -0
- package/dist/types-BGmQ0uXs.mjs.map +1 -0
- package/dist/types-CVsmpTcU.mjs +18 -0
- package/dist/types-CVsmpTcU.mjs.map +1 -0
- package/dist/types-C_V-_vMS.d.mts +198 -0
- package/dist/types-C_V-_vMS.d.mts.map +1 -0
- package/dist/types-CdEMurNh.mjs +77 -0
- package/dist/types-CdEMurNh.mjs.map +1 -0
- package/dist/types-CsmwbOwa.mjs +22 -0
- package/dist/types-CsmwbOwa.mjs.map +1 -0
- package/dist/types-Cw-1it3n.d.mts +287 -0
- package/dist/types-Cw-1it3n.d.mts.map +1 -0
- package/dist/types-D7B20WFC.d.mts +374 -0
- package/dist/types-D7B20WFC.d.mts.map +1 -0
- package/dist/types-DGw8KMX_.mjs +16 -0
- package/dist/types-DGw8KMX_.mjs.map +1 -0
- package/dist/types-DZeDpzMc.d.mts +896 -0
- package/dist/types-DZeDpzMc.d.mts.map +1 -0
- package/dist/types-DuQAIPA-.d.mts +363 -0
- package/dist/types-DuQAIPA-.d.mts.map +1 -0
- package/dist/types-edRPQchz.d.mts +85 -0
- package/dist/types-edRPQchz.d.mts.map +1 -0
- package/dist/types-j6MBDjlZ.mjs +103 -0
- package/dist/types-j6MBDjlZ.mjs.map +1 -0
- package/dist/types-pOLeFKGq.d.mts +1720 -0
- package/dist/types-pOLeFKGq.d.mts.map +1 -0
- package/dist/update-check-CaZyFHZC.mjs +161 -0
- package/dist/update-check-CaZyFHZC.mjs.map +1 -0
- package/dist/upload-attempts-BodUoFBu.mjs +32 -0
- package/dist/upload-attempts-BodUoFBu.mjs.map +1 -0
- package/dist/url-Dn3IStq8.mjs +104 -0
- package/dist/url-Dn3IStq8.mjs.map +1 -0
- package/dist/url-pattern-DGAG6ZP2.mjs +41 -0
- package/dist/url-pattern-DGAG6ZP2.mjs.map +1 -0
- package/dist/user-BOvuF1sQ.mjs +171 -0
- package/dist/user-BOvuF1sQ.mjs.map +1 -0
- package/dist/utils-CoV-PYhg.mjs +439 -0
- package/dist/utils-CoV-PYhg.mjs.map +1 -0
- package/dist/validate-WkjGwBSO.mjs +516 -0
- package/dist/validate-WkjGwBSO.mjs.map +1 -0
- package/dist/validate-dK97qe7F.d.mts +468 -0
- package/dist/validate-dK97qe7F.d.mts.map +1 -0
- package/dist/validation-D-ICq_tY.mjs +219 -0
- package/dist/validation-D-ICq_tY.mjs.map +1 -0
- package/dist/version-DbT04wbH.mjs +9 -0
- package/dist/version-DbT04wbH.mjs.map +1 -0
- package/dist/version-IneBU54o.mjs +7 -0
- package/dist/version-IneBU54o.mjs.map +1 -0
- package/dist/virtual-modules-Brh6mRVe.mjs +516 -0
- package/dist/virtual-modules-Brh6mRVe.mjs.map +1 -0
- package/dist/widgets-D8T0xBYs.mjs +126 -0
- package/dist/widgets-D8T0xBYs.mjs.map +1 -0
- package/dist/wxr-taxonomies-B6iE8m9I.d.mts +34 -0
- package/dist/wxr-taxonomies-B6iE8m9I.d.mts.map +1 -0
- package/dist/wxr-taxonomies-DEzR9N7e.mjs +453 -0
- package/dist/wxr-taxonomies-DEzR9N7e.mjs.map +1 -0
- package/dist/zod-generator-DnfG5sGQ.mjs +424 -0
- package/dist/zod-generator-DnfG5sGQ.mjs.map +1 -0
- package/package.json +15 -15
- package/src/api/errors.ts +11 -0
- package/src/api/handlers/bulk-tag.ts +4 -4
- package/src/api/handlers/content.ts +631 -32
- package/src/api/handlers/device-flow.ts +74 -21
- package/src/api/handlers/index.ts +3 -0
- package/src/api/handlers/manifest.ts +81 -5
- package/src/api/handlers/media-upload.ts +3 -0
- package/src/api/handlers/media.ts +2 -2
- package/src/api/handlers/registry.ts +123 -70
- package/src/api/handlers/relations.ts +638 -157
- package/src/api/handlers/revision.ts +40 -2
- package/src/api/handlers/schema.ts +403 -1
- package/src/api/handlers/staged-references.ts +208 -0
- package/src/api/handlers/update-check.ts +236 -0
- package/src/api/handlers/validate-references.ts +146 -0
- package/src/api/redirect.ts +9 -1
- package/src/api/schemas/content.ts +17 -0
- package/src/api/schemas/import.ts +50 -14
- package/src/api/schemas/relations.ts +54 -44
- package/src/api/schemas/schema.ts +26 -6
- package/src/api/setup-complete.ts +49 -1
- package/src/api/types.ts +4 -0
- package/src/astro/dev-typegen.ts +15 -22
- package/src/astro/integration/dev-typegen.ts +32 -3
- package/src/astro/integration/index.ts +88 -22
- package/src/astro/integration/routes.ts +21 -19
- package/src/astro/integration/runtime.ts +33 -7
- package/src/astro/integration/virtual-modules.ts +1 -0
- package/src/astro/integration/vite-config.ts +16 -8
- package/src/astro/middleware/redirect.ts +15 -2
- package/src/astro/middleware/request-context.ts +13 -6
- package/src/astro/routes/api/admin/bylines/[id]/index.ts +11 -1
- package/src/astro/routes/api/admin/bylines/[id]/translations.ts +7 -1
- package/src/astro/routes/api/admin/bylines/index.ts +6 -1
- package/src/astro/routes/api/admin/core-update.ts +34 -0
- package/src/astro/routes/api/admin/plugins/marketplace/[id]/icon.ts +6 -2
- package/src/astro/routes/api/admin/themes/marketplace/[id]/thumbnail.ts +6 -2
- package/src/astro/routes/api/auth/invite/complete.ts +4 -4
- package/src/astro/routes/api/auth/magic-link/verify.ts +4 -1
- package/src/astro/routes/api/auth/oauth/[provider]/callback.ts +9 -4
- package/src/astro/routes/api/auth/passkey/verify.ts +4 -4
- package/src/astro/routes/api/auth/signup/complete.ts +4 -4
- package/src/astro/routes/api/content/[collection]/[id]/references/[relation]/children.ts +11 -54
- package/src/astro/routes/api/content/[collection]/[id].ts +3 -1
- package/src/astro/routes/api/import/wordpress/execute.ts +252 -6
- package/src/astro/routes/api/import/wordpress/prepare.ts +1 -2
- package/src/astro/routes/api/oauth/device/authorize.ts +33 -4
- package/src/astro/routes/api/oauth/register.ts +22 -2
- package/src/astro/routes/api/relations/index.ts +4 -4
- package/src/astro/routes/api/revisions/[revisionId]/restore.ts +17 -1
- package/src/astro/routes/api/schema/collections/[slug]/fields/[fieldSlug].ts +6 -2
- package/src/astro/routes/api/setup/admin-verify.ts +6 -5
- package/src/astro/routes/api/typegen.ts +4 -46
- package/src/astro/session-user.ts +14 -0
- package/src/astro/types.ts +11 -0
- package/src/bylines/credits.ts +149 -0
- package/src/bylines/index.ts +4 -142
- package/src/cli/commands/export-seed.ts +510 -89
- package/src/cli/commands/seed.ts +2 -0
- package/src/cli/credentials.ts +1 -60
- package/src/cli/index.ts +0 -2
- package/src/client/index.ts +8 -2
- package/src/components/Image.astro +24 -13
- package/src/components/InlinePortableTextEditor.tsx +25 -8
- package/src/components/WidgetArea.astro +3 -2
- package/src/content/converters/portable-text-to-prosemirror.ts +23 -17
- package/src/content/converters/prosemirror-to-portable-text.ts +16 -5
- package/src/content/converters/types.ts +1 -0
- package/src/database/content-datetime.ts +111 -23
- package/src/database/migrations/036_i18n_menus_and_taxonomies.ts +132 -92
- package/src/database/migrations/086_relations_structural.ts +197 -0
- package/src/database/migrations/087_reference_field_relations.ts +407 -0
- package/src/database/migrations/088_cron_oneshot_utc.ts +39 -0
- package/src/database/migrations/089_auto_seed_completion.ts +13 -0
- package/src/database/migrations/runner.ts +8 -0
- package/src/database/reference-backfill.ts +141 -0
- package/src/database/repositories/comment.ts +2 -2
- package/src/database/repositories/content.ts +58 -16
- package/src/database/repositories/plugin-storage.ts +1 -1
- package/src/database/repositories/redirect.ts +7 -2
- package/src/database/repositories/relation.ts +622 -210
- package/src/database/repositories/revision.ts +16 -0
- package/src/database/repositories/types.ts +38 -0
- package/src/database/transaction.ts +12 -1
- package/src/database/types.ts +15 -6
- package/src/db/node-sqlite-compat.ts +63 -37
- package/src/emdash-runtime.ts +149 -46
- package/src/import/wxr-taxonomies.ts +163 -88
- package/src/index.ts +20 -0
- package/src/loader.ts +177 -23
- package/src/mcp/server.ts +90 -8
- package/src/media/usage/activation.ts +18 -9
- package/src/migrations/config-loader.ts +5 -0
- package/src/object-cache/index.ts +19 -7
- package/src/object-cache/types.ts +3 -2
- package/src/plugin-types.ts +7 -0
- package/src/plugins/adapt-sandbox-entry.ts +47 -12
- package/src/plugins/byline-access.ts +158 -0
- package/src/plugins/context.ts +7 -1
- package/src/plugins/cron.ts +27 -4
- package/src/plugins/hooks.ts +47 -0
- package/src/plugins/host.ts +1 -0
- package/src/plugins/index.ts +10 -1
- package/src/plugins/manifest-schema.ts +5 -1
- package/src/plugins/marketplace.ts +48 -36
- package/src/plugins/sandbox/proxy.ts +1 -0
- package/src/plugins/types.ts +95 -0
- package/src/query.ts +464 -27
- package/src/redirects/cache.ts +11 -1
- package/src/redirects/destination.ts +20 -0
- package/src/redirects/loops.ts +10 -6
- package/src/redirects/patterns.ts +12 -30
- package/src/references/field-map.ts +115 -0
- package/src/references/resolve.ts +160 -0
- package/src/references/staged.ts +157 -0
- package/src/references/types.ts +16 -0
- package/src/registry/artifact-fetch.ts +45 -271
- package/src/registry/testing.ts +59 -14
- package/src/request-context.ts +8 -0
- package/src/schema/block-type-registry.ts +1 -1
- package/src/schema/env-types.ts +37 -0
- package/src/schema/project-env-types.ts +41 -0
- package/src/schema/registry.ts +132 -26
- package/src/schema/types.ts +63 -0
- package/src/schema/url-pattern.ts +10 -0
- package/src/schema/zod-generator.ts +78 -2
- package/src/seed/apply.ts +553 -63
- package/src/seed/ownership.ts +15 -0
- package/src/seed/types.ts +36 -2
- package/src/seed/validate.ts +123 -4
- package/src/transfer/analyze/unique-keys.ts +3 -12
- package/src/transfer/analyze/validate.ts +178 -40
- package/src/transfer/analyze/values.ts +116 -2
- package/src/transfer/analyze/write-rules.ts +8 -0
- package/src/transfer/export/readers.ts +12 -8
- package/src/transfer/format/columns.ts +26 -6
- package/src/transfer/format/kinds.ts +21 -5
- package/src/transfer/import/context.ts +8 -1
- package/src/transfer/ops/package-index.ts +1 -1
- package/src/utils/url.ts +58 -3
- package/src/virtual-modules.d.ts +3 -0
- package/dist/action-token-DYwe4Pk0.mjs +0 -26
- package/dist/action-token-DYwe4Pk0.mjs.map +0 -1
- package/dist/activation-LOkDM5WT.mjs +0 -382
- package/dist/activation-LOkDM5WT.mjs.map +0 -1
- package/dist/adapters-B64LbYcB.d.mts +0 -171
- package/dist/adapters-B64LbYcB.d.mts.map +0 -1
- package/dist/allowed-origins-CHB8oZNM.mjs +0 -116
- package/dist/allowed-origins-CHB8oZNM.mjs.map +0 -1
- package/dist/api-CuyNEHZG.mjs +0 -4718
- package/dist/api-CuyNEHZG.mjs.map +0 -1
- package/dist/api-tokens-s4i4aUp_.mjs +0 -166
- package/dist/api-tokens-s4i4aUp_.mjs.map +0 -1
- package/dist/apply-npY1TAhG.mjs +0 -1366
- package/dist/apply-npY1TAhG.mjs.map +0 -1
- package/dist/approvals-CqMfNxak.mjs +0 -460
- package/dist/approvals-CqMfNxak.mjs.map +0 -1
- package/dist/artifact-fetch-DZMOGZ3-.mjs +0 -818
- package/dist/artifact-fetch-DZMOGZ3-.mjs.map +0 -1
- package/dist/astro/routes/api/relations/_id_/translations.d.mts +0 -8
- package/dist/astro/routes/api/relations/_id_/translations.d.mts.map +0 -1
- package/dist/astro/routes/api/relations/_id_/translations.mjs +0 -47
- package/dist/astro/routes/api/relations/_id_/translations.mjs.map +0 -1
- package/dist/audit-RfCugiSB.mjs +0 -127
- package/dist/audit-RfCugiSB.mjs.map +0 -1
- package/dist/authoritative-records-CoJvBXAD.mjs +0 -5172
- package/dist/authoritative-records-CoJvBXAD.mjs.map +0 -1
- package/dist/authorize-seCifOMJ.mjs +0 -49
- package/dist/authorize-seCifOMJ.mjs.map +0 -1
- package/dist/backup-BQRj3afm.mjs +0 -246
- package/dist/backup-BQRj3afm.mjs.map +0 -1
- package/dist/block-type-registry-DUI_3KxT.mjs +0 -6709
- package/dist/block-type-registry-DUI_3KxT.mjs.map +0 -1
- package/dist/block-types-BmZmLmAD.mjs +0 -132
- package/dist/block-types-BmZmLmAD.mjs.map +0 -1
- package/dist/block-values-C_VIPr5t.mjs +0 -175
- package/dist/block-values-C_VIPr5t.mjs.map +0 -1
- package/dist/byline-DYmkXqvo.mjs +0 -909
- package/dist/byline-DYmkXqvo.mjs.map +0 -1
- package/dist/byline-fields-D28AT-Fh.mjs +0 -123
- package/dist/byline-fields-D28AT-Fh.mjs.map +0 -1
- package/dist/byline-registry-gnKscbQX.mjs +0 -406
- package/dist/byline-registry-gnKscbQX.mjs.map +0 -1
- package/dist/bylines-BPwJqoYH.mjs +0 -232
- package/dist/bylines-BPwJqoYH.mjs.map +0 -1
- package/dist/bylines-ukLaYpVZ.mjs +0 -214
- package/dist/bylines-ukLaYpVZ.mjs.map +0 -1
- package/dist/cache-m7UEkRFV.mjs +0 -108
- package/dist/cache-m7UEkRFV.mjs.map +0 -1
- package/dist/canonical-YhEQezjg.mjs +0 -174
- package/dist/canonical-YhEQezjg.mjs.map +0 -1
- package/dist/capture-triggers-kJyl_yyM.mjs +0 -362
- package/dist/capture-triggers-kJyl_yyM.mjs.map +0 -1
- package/dist/challenge-store-ppU6Uv13.mjs +0 -51
- package/dist/challenge-store-ppU6Uv13.mjs.map +0 -1
- package/dist/checksum-B2IINIlN.mjs +0 -162
- package/dist/checksum-B2IINIlN.mjs.map +0 -1
- package/dist/chrome-tags-DApCQSIk.mjs +0 -24
- package/dist/chrome-tags-DApCQSIk.mjs.map +0 -1
- package/dist/chunks-Dms7Uxbt.mjs +0 -25
- package/dist/chunks-Dms7Uxbt.mjs.map +0 -1
- package/dist/collection-deletion-BIm28mo3.mjs +0 -436
- package/dist/collection-deletion-BIm28mo3.mjs.map +0 -1
- package/dist/collection-deletion-processor-Br6rxs3u.mjs +0 -217
- package/dist/collection-deletion-processor-Br6rxs3u.mjs.map +0 -1
- package/dist/collection-slugs-cache-CjGk__zp.mjs +0 -85
- package/dist/collection-slugs-cache-CjGk__zp.mjs.map +0 -1
- package/dist/comment-CrBl22OF.mjs +0 -313
- package/dist/comment-CrBl22OF.mjs.map +0 -1
- package/dist/comment-reaction-JEQ2Fpd8.mjs +0 -85
- package/dist/comment-reaction-JEQ2Fpd8.mjs.map +0 -1
- package/dist/comments-2ah9du9y.mjs +0 -195
- package/dist/comments-2ah9du9y.mjs.map +0 -1
- package/dist/comments-fHZ8ON9O.mjs +0 -99
- package/dist/comments-fHZ8ON9O.mjs.map +0 -1
- package/dist/components-CXbq7CSM.mjs +0 -108
- package/dist/components-CXbq7CSM.mjs.map +0 -1
- package/dist/config-BjEm_3xL.d.mts +0 -6537
- package/dist/config-BjEm_3xL.d.mts.map +0 -1
- package/dist/config-IhybvkIQ.mjs +0 -242
- package/dist/config-IhybvkIQ.mjs.map +0 -1
- package/dist/config-Py43JK9r.d.mts +0 -39
- package/dist/config-Py43JK9r.d.mts.map +0 -1
- package/dist/content-DFaIEDj9.mjs +0 -2281
- package/dist/content-DFaIEDj9.mjs.map +0 -1
- package/dist/content-list-query-Dra4Dalc.d.mts +0 -26
- package/dist/content-list-query-Dra4Dalc.d.mts.map +0 -1
- package/dist/content-policy-DFNw91-d.mjs +0 -46
- package/dist/content-policy-DFNw91-d.mjs.map +0 -1
- package/dist/content-repair-Q8IUrpLL.mjs +0 -442
- package/dist/content-repair-Q8IUrpLL.mjs.map +0 -1
- package/dist/context-BV_7t-Ua.mjs +0 -1921
- package/dist/context-BV_7t-Ua.mjs.map +0 -1
- package/dist/cron-7DCJwPXq.mjs +0 -284
- package/dist/cron-7DCJwPXq.mjs.map +0 -1
- package/dist/dashboard-BP-iJqpd.mjs +0 -151
- package/dist/dashboard-BP-iJqpd.mjs.map +0 -1
- package/dist/default-DQ6vsviu.mjs +0 -81
- package/dist/default-DQ6vsviu.mjs.map +0 -1
- package/dist/deferred-tasks-BPxXUB4x.d.mts +0 -9
- package/dist/deferred-tasks-BPxXUB4x.d.mts.map +0 -1
- package/dist/dev-typegen-CZaPLl3V.mjs +0 -29
- package/dist/dev-typegen-CZaPLl3V.mjs.map +0 -1
- package/dist/device-flow-CRd6DXmW.mjs +0 -466
- package/dist/device-flow-CRd6DXmW.mjs.map +0 -1
- package/dist/digest-BarSh-pN.mjs +0 -194
- package/dist/digest-BarSh-pN.mjs.map +0 -1
- package/dist/direct-executor-D2lNadwo.mjs +0 -104
- package/dist/direct-executor-D2lNadwo.mjs.map +0 -1
- package/dist/dist-BNwANFJR.mjs +0 -810
- package/dist/dist-BNwANFJR.mjs.map +0 -1
- package/dist/email-console-bJn3ctqA.mjs +0 -50
- package/dist/email-console-bJn3ctqA.mjs.map +0 -1
- package/dist/email-locale-CN6WAMx0.mjs +0 -25
- package/dist/email-locale-CN6WAMx0.mjs.map +0 -1
- package/dist/emdash-runtime-CtfnZmPi.mjs +0 -4186
- package/dist/emdash-runtime-CtfnZmPi.mjs.map +0 -1
- package/dist/enrich-Dl3kZ-lP.mjs +0 -194
- package/dist/enrich-Dl3kZ-lP.mjs.map +0 -1
- package/dist/entry-lock-BJYdBfXb.mjs +0 -1097
- package/dist/entry-lock-BJYdBfXb.mjs.map +0 -1
- package/dist/entry-lock-Cf5OoIgN.d.mts +0 -4368
- package/dist/entry-lock-Cf5OoIgN.d.mts.map +0 -1
- package/dist/entry-lock-DHQOxN7R.mjs +0 -163
- package/dist/entry-lock-DHQOxN7R.mjs.map +0 -1
- package/dist/entry-locks-D0foLdjQ.mjs +0 -167
- package/dist/entry-locks-D0foLdjQ.mjs.map +0 -1
- package/dist/error-CfvOHP0M.mjs +0 -90
- package/dist/error-CfvOHP0M.mjs.map +0 -1
- package/dist/errors-BF0_LFhW.mjs +0 -460
- package/dist/errors-BF0_LFhW.mjs.map +0 -1
- package/dist/errors-DgE1zJGG.mjs +0 -120
- package/dist/errors-DgE1zJGG.mjs.map +0 -1
- package/dist/escape-CuaZhZvL.mjs +0 -9
- package/dist/escape-CuaZhZvL.mjs.map +0 -1
- package/dist/fence-CMDXJYc_.mjs +0 -162
- package/dist/fence-CMDXJYc_.mjs.map +0 -1
- package/dist/field-defs-cache-HIgBbqZZ.mjs +0 -77
- package/dist/field-defs-cache-HIgBbqZZ.mjs.map +0 -1
- package/dist/focal-point-Gr34o-4o.mjs +0 -23
- package/dist/focal-point-Gr34o-4o.mjs.map +0 -1
- package/dist/fts-manager-S-K0laoS.mjs +0 -443
- package/dist/fts-manager-S-K0laoS.mjs.map +0 -1
- package/dist/gc-DjKY0Ay1.mjs +0 -75
- package/dist/gc-DjKY0Ay1.mjs.map +0 -1
- package/dist/hash-SDAW6zC-.mjs +0 -37
- package/dist/hash-SDAW6zC-.mjs.map +0 -1
- package/dist/hook-result-B5bXDgS2.d.mts +0 -31
- package/dist/hook-result-B5bXDgS2.d.mts.map +0 -1
- package/dist/hreflang-CbVI4paR.mjs +0 -105
- package/dist/hreflang-CbVI4paR.mjs.map +0 -1
- package/dist/hreflang-D5uNnsGJ.d.mts +0 -50
- package/dist/hreflang-D5uNnsGJ.d.mts.map +0 -1
- package/dist/http-route-dispatch-BitqzwMy.mjs +0 -339
- package/dist/http-route-dispatch-BitqzwMy.mjs.map +0 -1
- package/dist/identity-Be5kzutJ.mjs +0 -35
- package/dist/identity-Be5kzutJ.mjs.map +0 -1
- package/dist/import-YzfKCaco.mjs +0 -2020
- package/dist/import-YzfKCaco.mjs.map +0 -1
- package/dist/index-D-hdtLe8.d.mts +0 -623
- package/dist/index-D-hdtLe8.d.mts.map +0 -1
- package/dist/install-finalization-DfM1fj5x.mjs +0 -58
- package/dist/install-finalization-DfM1fj5x.mjs.map +0 -1
- package/dist/keys-yxLm5l35.mjs +0 -61
- package/dist/keys-yxLm5l35.mjs.map +0 -1
- package/dist/kinds-CRu_T5T5.mjs +0 -961
- package/dist/kinds-CRu_T5T5.mjs.map +0 -1
- package/dist/lifecycle-BzeGPeQ-.mjs +0 -25
- package/dist/lifecycle-BzeGPeQ-.mjs.map +0 -1
- package/dist/load-XgJiE6_3.mjs +0 -28
- package/dist/load-XgJiE6_3.mjs.map +0 -1
- package/dist/loader-BzqeR1ZN.mjs +0 -1086
- package/dist/loader-BzqeR1ZN.mjs.map +0 -1
- package/dist/loops-BQSzv5Zn.mjs +0 -203
- package/dist/loops-BQSzv5Zn.mjs.map +0 -1
- package/dist/manifest-builder-BmSAOOEF.mjs +0 -189
- package/dist/manifest-builder-BmSAOOEF.mjs.map +0 -1
- package/dist/manifest-schema-CY3zng_M.mjs +0 -492
- package/dist/manifest-schema-CY3zng_M.mjs.map +0 -1
- package/dist/media-CPXTbb1R.mjs +0 -373
- package/dist/media-CPXTbb1R.mjs.map +0 -1
- package/dist/media-JXRWDhw3.mjs +0 -294
- package/dist/media-JXRWDhw3.mjs.map +0 -1
- package/dist/media-Pu1L6xir.mjs +0 -408
- package/dist/media-Pu1L6xir.mjs.map +0 -1
- package/dist/media-allowlist-BSoa9Vvm.mjs +0 -44
- package/dist/media-allowlist-BSoa9Vvm.mjs.map +0 -1
- package/dist/media-folders-BE0oo2eX.mjs +0 -210
- package/dist/media-folders-BE0oo2eX.mjs.map +0 -1
- package/dist/media-url-jArBpzIG.mjs +0 -43
- package/dist/media-url-jArBpzIG.mjs.map +0 -1
- package/dist/media-usage-De-zeR9E.mjs +0 -1629
- package/dist/media-usage-De-zeR9E.mjs.map +0 -1
- package/dist/media-usage-activation-HKp7zk7W.mjs +0 -78
- package/dist/media-usage-activation-HKp7zk7W.mjs.map +0 -1
- package/dist/media-usage-work-C2OZLCAd.mjs +0 -586
- package/dist/media-usage-work-C2OZLCAd.mjs.map +0 -1
- package/dist/media-usage-work-DwUNbgvS.mjs +0 -152
- package/dist/media-usage-work-DwUNbgvS.mjs.map +0 -1
- package/dist/menus-BM7BPLOb.mjs +0 -139
- package/dist/menus-BM7BPLOb.mjs.map +0 -1
- package/dist/menus-Cm68rsAq.mjs +0 -3608
- package/dist/menus-Cm68rsAq.mjs.map +0 -1
- package/dist/menus-ITeAbcIF.mjs +0 -753
- package/dist/menus-ITeAbcIF.mjs.map +0 -1
- package/dist/mime-ChLqYwDk.mjs +0 -36
- package/dist/mime-ChLqYwDk.mjs.map +0 -1
- package/dist/mode-CCuKXUci.mjs +0 -23
- package/dist/mode-CCuKXUci.mjs.map +0 -1
- package/dist/node-sqlite-compat-CONMsl-x.mjs +0 -46
- package/dist/node-sqlite-compat-CONMsl-x.mjs.map +0 -1
- package/dist/normalize-CO2P8-iE.mjs +0 -191
- package/dist/normalize-CO2P8-iE.mjs.map +0 -1
- package/dist/oauth-authorization-DlMIL5_h.mjs +0 -274
- package/dist/oauth-authorization-DlMIL5_h.mjs.map +0 -1
- package/dist/oauth-clients-Djq9r_KP.mjs +0 -266
- package/dist/oauth-clients-Djq9r_KP.mjs.map +0 -1
- package/dist/oauth-state-store-BbjnZXNC.mjs +0 -50
- package/dist/oauth-state-store-BbjnZXNC.mjs.map +0 -1
- package/dist/oauth-user-lookup-vue9a64A.mjs +0 -26
- package/dist/oauth-user-lookup-vue9a64A.mjs.map +0 -1
- package/dist/object-cache-CqWNY5uP.mjs +0 -582
- package/dist/object-cache-CqWNY5uP.mjs.map +0 -1
- package/dist/options-SQCHQCPH.d.mts +0 -81
- package/dist/options-SQCHQCPH.d.mts.map +0 -1
- package/dist/parse-CVgO-Qai.d.mts +0 -168
- package/dist/parse-CVgO-Qai.d.mts.map +0 -1
- package/dist/parse-DY6OD1j_.mjs +0 -81
- package/dist/parse-DY6OD1j_.mjs.map +0 -1
- package/dist/passkey-config-X_H8128a.mjs +0 -46
- package/dist/passkey-config-X_H8128a.mjs.map +0 -1
- package/dist/paths-JxokKIbr.mjs +0 -77
- package/dist/paths-JxokKIbr.mjs.map +0 -1
- package/dist/patterns-BhAvqO0S.mjs +0 -145
- package/dist/patterns-BhAvqO0S.mjs.map +0 -1
- package/dist/placeholder-MSEd8gty.d.mts +0 -306
- package/dist/placeholder-MSEd8gty.d.mts.map +0 -1
- package/dist/plan-xjcWrAah.mjs +0 -135
- package/dist/plan-xjcWrAah.mjs.map +0 -1
- package/dist/plugins-DUXUt8B9.mjs +0 -277
- package/dist/plugins-DUXUt8B9.mjs.map +0 -1
- package/dist/policy-CUvwAARc.mjs +0 -45
- package/dist/policy-CUvwAARc.mjs.map +0 -1
- package/dist/portable-text-5O_ZGUjB.mjs +0 -307
- package/dist/portable-text-5O_ZGUjB.mjs.map +0 -1
- package/dist/preview-CIUcPYr6.mjs +0 -107
- package/dist/preview-CIUcPYr6.mjs.map +0 -1
- package/dist/protocol-B97DZaFr.d.mts +0 -61
- package/dist/protocol-B97DZaFr.d.mts.map +0 -1
- package/dist/public-submission-BFBUrqst.mjs +0 -250
- package/dist/public-submission-BFBUrqst.mjs.map +0 -1
- package/dist/public-url-Bn7U0D7-.mjs +0 -101
- package/dist/public-url-Bn7U0D7-.mjs.map +0 -1
- package/dist/query-B48peoRT.mjs +0 -890
- package/dist/query-B48peoRT.mjs.map +0 -1
- package/dist/query-C4IH0uhR.mjs +0 -41
- package/dist/query-C4IH0uhR.mjs.map +0 -1
- package/dist/rate-limit-BZ6nybgc.mjs +0 -120
- package/dist/rate-limit-BZ6nybgc.mjs.map +0 -1
- package/dist/receipt-B4wJj5Jq.mjs +0 -43
- package/dist/receipt-B4wJj5Jq.mjs.map +0 -1
- package/dist/redirect-B29UjdUn.mjs +0 -411
- package/dist/redirect-B29UjdUn.mjs.map +0 -1
- package/dist/redirect-Cd1E7VUt.mjs +0 -17
- package/dist/redirect-Cd1E7VUt.mjs.map +0 -1
- package/dist/redirects-Ca2MPfEG.mjs +0 -446
- package/dist/redirects-Ca2MPfEG.mjs.map +0 -1
- package/dist/redirects-Cv9apQKj.mjs +0 -148
- package/dist/redirects-Cv9apQKj.mjs.map +0 -1
- package/dist/relation-M4NUCb0b.mjs +0 -334
- package/dist/relation-M4NUCb0b.mjs.map +0 -1
- package/dist/relations-CCif47Oq.mjs +0 -403
- package/dist/relations-CCif47Oq.mjs.map +0 -1
- package/dist/relations-CK9CYUyr.mjs +0 -310
- package/dist/relations-CK9CYUyr.mjs.map +0 -1
- package/dist/request-cache-DzLYKm_x.mjs +0 -104
- package/dist/request-cache-DzLYKm_x.mjs.map +0 -1
- package/dist/request-meta-sZXt3sRo.mjs +0 -141
- package/dist/request-meta-sZXt3sRo.mjs.map +0 -1
- package/dist/resolve-2WbQsCvT.mjs +0 -199
- package/dist/resolve-2WbQsCvT.mjs.map +0 -1
- package/dist/route-wire--1hLuACz.mjs +0 -197
- package/dist/route-wire--1hLuACz.mjs.map +0 -1
- package/dist/routes-vrR95WR6.mjs +0 -272
- package/dist/routes-vrR95WR6.mjs.map +0 -1
- package/dist/runner-1y4J9fJB.mjs +0 -5742
- package/dist/runner-1y4J9fJB.mjs.map +0 -1
- package/dist/runner-D5_LzKXI.d.mts +0 -68
- package/dist/runner-D5_LzKXI.d.mts.map +0 -1
- package/dist/schema-BABiRdsH.mjs +0 -13
- package/dist/schema-BABiRdsH.mjs.map +0 -1
- package/dist/schema-Du3MzCG0.mjs +0 -446
- package/dist/schema-Du3MzCG0.mjs.map +0 -1
- package/dist/scopes-Dbk-ElhT.mjs +0 -34
- package/dist/scopes-Dbk-ElhT.mjs.map +0 -1
- package/dist/search-Bt1PL1jf.mjs +0 -448
- package/dist/search-Bt1PL1jf.mjs.map +0 -1
- package/dist/sections-Ddptx_o9.mjs +0 -346
- package/dist/sections-Ddptx_o9.mjs.map +0 -1
- package/dist/seo-CZT2oLtT.mjs +0 -114
- package/dist/seo-CZT2oLtT.mjs.map +0 -1
- package/dist/seo-D5w3-Azy.mjs +0 -133
- package/dist/seo-D5w3-Azy.mjs.map +0 -1
- package/dist/service-DuykXPyW.mjs +0 -150
- package/dist/service-DuykXPyW.mjs.map +0 -1
- package/dist/session-user-BhaVp8w0.mjs +0 -51
- package/dist/session-user-BhaVp8w0.mjs.map +0 -1
- package/dist/settings-B4vDl1fK.mjs +0 -439
- package/dist/settings-B4vDl1fK.mjs.map +0 -1
- package/dist/settings-DYidIB26.mjs +0 -61
- package/dist/settings-DYidIB26.mjs.map +0 -1
- package/dist/settings-Dyj6v8C4.mjs +0 -51
- package/dist/settings-Dyj6v8C4.mjs.map +0 -1
- package/dist/setup-complete-bOogcHWG.mjs +0 -26
- package/dist/setup-complete-bOogcHWG.mjs.map +0 -1
- package/dist/setup-nonce-0EGuKM4s.mjs +0 -25
- package/dist/setup-nonce-0EGuKM4s.mjs.map +0 -1
- package/dist/site-settings-DOgRUoFX.mjs +0 -50
- package/dist/site-settings-DOgRUoFX.mjs.map +0 -1
- package/dist/site-url-BU_bbxwj.mjs +0 -16
- package/dist/site-url-BU_bbxwj.mjs.map +0 -1
- package/dist/snapshot-PawoX-WG.mjs +0 -414
- package/dist/snapshot-PawoX-WG.mjs.map +0 -1
- package/dist/ssrf-CJUnJymJ.mjs +0 -406
- package/dist/ssrf-CJUnJymJ.mjs.map +0 -1
- package/dist/stage-DgrBz_du.mjs +0 -662
- package/dist/stage-DgrBz_du.mjs.map +0 -1
- package/dist/state-DDiPySSG.mjs +0 -153
- package/dist/state-DDiPySSG.mjs.map +0 -1
- package/dist/status-DZKIG4a9.mjs +0 -30
- package/dist/status-DZKIG4a9.mjs.map +0 -1
- package/dist/storage-query-FXJH5pI8.d.mts +0 -1581
- package/dist/storage-query-FXJH5pI8.d.mts.map +0 -1
- package/dist/tar-_1AgTYFu.mjs +0 -449
- package/dist/tar-_1AgTYFu.mjs.map +0 -1
- package/dist/target-_7pn2Gbg.mjs +0 -27
- package/dist/target-_7pn2Gbg.mjs.map +0 -1
- package/dist/taxonomies-C1IwNe8Q.mjs +0 -697
- package/dist/taxonomies-C1IwNe8Q.mjs.map +0 -1
- package/dist/taxonomies-C_XMoRcX.mjs +0 -939
- package/dist/taxonomies-C_XMoRcX.mjs.map +0 -1
- package/dist/taxonomy-C3Fu1YeH.mjs +0 -525
- package/dist/taxonomy-C3Fu1YeH.mjs.map +0 -1
- package/dist/tokens-u78jETkX.mjs +0 -171
- package/dist/tokens-u78jETkX.mjs.map +0 -1
- package/dist/transaction-BcJO4Tmc.mjs +0 -29
- package/dist/transaction-BcJO4Tmc.mjs.map +0 -1
- package/dist/transfer-DIGvR9Af.mjs +0 -166
- package/dist/transfer-DIGvR9Af.mjs.map +0 -1
- package/dist/transfer-DgeCvHnj.mjs +0 -8675
- package/dist/transfer-DgeCvHnj.mjs.map +0 -1
- package/dist/transfer-download-Pml7RMio.mjs +0 -33
- package/dist/transfer-download-Pml7RMio.mjs.map +0 -1
- package/dist/transformations-9gfpwY65.mjs +0 -196
- package/dist/transformations-9gfpwY65.mjs.map +0 -1
- package/dist/transport-BIfH7_hx.d.mts +0 -42
- package/dist/transport-BIfH7_hx.d.mts.map +0 -1
- package/dist/transport-DKWIq53q.mjs +0 -136
- package/dist/transport-DKWIq53q.mjs.map +0 -1
- package/dist/trusted-proxy-tKiVtyTD.mjs +0 -51
- package/dist/trusted-proxy-tKiVtyTD.mjs.map +0 -1
- package/dist/turnstile-DpsoyOfg.mjs +0 -53
- package/dist/turnstile-DpsoyOfg.mjs.map +0 -1
- package/dist/types-B4sUC2p1.d.mts +0 -198
- package/dist/types-B4sUC2p1.d.mts.map +0 -1
- package/dist/types-B7Lmsh1E.d.mts +0 -887
- package/dist/types-B7Lmsh1E.d.mts.map +0 -1
- package/dist/types-BZakh7Ym.mjs +0 -22
- package/dist/types-BZakh7Ym.mjs.map +0 -1
- package/dist/types-B_CppEmv.d.mts +0 -264
- package/dist/types-B_CppEmv.d.mts.map +0 -1
- package/dist/types-BcrBrE6-.mjs +0 -159
- package/dist/types-BcrBrE6-.mjs.map +0 -1
- package/dist/types-BkUg2yHx.mjs +0 -92
- package/dist/types-BkUg2yHx.mjs.map +0 -1
- package/dist/types-CAZgq9fO.d.mts +0 -124
- package/dist/types-CAZgq9fO.d.mts.map +0 -1
- package/dist/types-Cd-O03VG.d.mts +0 -363
- package/dist/types-Cd-O03VG.d.mts.map +0 -1
- package/dist/types-Cr-Kg-3D.d.mts +0 -1641
- package/dist/types-Cr-Kg-3D.d.mts.map +0 -1
- package/dist/types-D2fvWd1i.d.mts +0 -359
- package/dist/types-D2fvWd1i.d.mts.map +0 -1
- package/dist/types-D7HUsguf.mjs +0 -77
- package/dist/types-D7HUsguf.mjs.map +0 -1
- package/dist/types-DA1Te3Oy.d.mts +0 -198
- package/dist/types-DA1Te3Oy.d.mts.map +0 -1
- package/dist/types-DhV6Q5bP.mjs +0 -18
- package/dist/types-DhV6Q5bP.mjs.map +0 -1
- package/dist/types-DnnVSl6Y.d.mts +0 -85
- package/dist/types-DnnVSl6Y.d.mts.map +0 -1
- package/dist/types-VT4-BugW.mjs +0 -16
- package/dist/types-VT4-BugW.mjs.map +0 -1
- package/dist/upload-attempts-B68ZGNu9.mjs +0 -32
- package/dist/upload-attempts-B68ZGNu9.mjs.map +0 -1
- package/dist/url-pattern-CCeZMGOh.mjs +0 -33
- package/dist/url-pattern-CCeZMGOh.mjs.map +0 -1
- package/dist/user-DDSL-sGw.mjs +0 -171
- package/dist/user-DDSL-sGw.mjs.map +0 -1
- package/dist/utils-DdhmO9w9.mjs +0 -439
- package/dist/utils-DdhmO9w9.mjs.map +0 -1
- package/dist/validate-CHosPEhs.mjs +0 -453
- package/dist/validate-CHosPEhs.mjs.map +0 -1
- package/dist/validate-CM79QXYE.d.mts +0 -432
- package/dist/validate-CM79QXYE.d.mts.map +0 -1
- package/dist/validation-BFecQczG.mjs +0 -218
- package/dist/validation-BFecQczG.mjs.map +0 -1
- package/dist/version-BRZXVifl.mjs +0 -9
- package/dist/version-BRZXVifl.mjs.map +0 -1
- package/dist/version-DXsxRrob.mjs +0 -7
- package/dist/version-DXsxRrob.mjs.map +0 -1
- package/dist/widgets-WdV72brA.mjs +0 -126
- package/dist/widgets-WdV72brA.mjs.map +0 -1
- package/dist/wxr-taxonomies-BHTdqkmZ.d.mts +0 -34
- package/dist/wxr-taxonomies-BHTdqkmZ.d.mts.map +0 -1
- package/dist/wxr-taxonomies-DP6ESgMN.mjs +0 -372
- package/dist/wxr-taxonomies-DP6ESgMN.mjs.map +0 -1
- package/dist/zod-generator-D6uE4WiS.mjs +0 -389
- package/dist/zod-generator-D6uE4WiS.mjs.map +0 -1
- package/src/astro/routes/api/relations/[id]/translations.ts +0 -33
- package/src/cli/commands/bundle-utils.ts +0 -408
- package/src/cli/commands/bundle.ts +0 -659
- package/src/cli/commands/plugin-init.ts +0 -417
- package/src/cli/commands/plugin-validate.ts +0 -31
- package/src/cli/commands/plugin.ts +0 -33
- package/src/cli/commands/publish.ts +0 -721
- /package/dist/{api-tokens-CE1ECIg0.mjs → api-tokens-BLz2MtQs.mjs} +0 -0
- /package/dist/{ssrf-DpBH7aOt.mjs → ssrf-tA45vIPX.mjs} +0 -0
package/dist/cli/index.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { a as getMigrationStatus, c as formatDatetimeStorageReport, i as getExactMigrationStatus, l as scanDatetimeStorage, s as runMigrations, u as __exportAll } from "../runner-
|
|
3
|
-
import { t as EmDashDatabaseError } from "../errors-9P_FDrJ_.mjs";
|
|
2
|
+
import { a as getMigrationStatus, c as formatDatetimeStorageReport, i as getExactMigrationStatus, l as scanDatetimeStorage, s as runMigrations, u as __exportAll } from "../runner-CLpxmhl8.mjs";
|
|
4
3
|
import { n as isMissingTableError } from "../db-errors-CBD5yMro.mjs";
|
|
5
4
|
import { busyLockHeldSince, migrationLockHeldMessage } from "../database/migration-lock.mjs";
|
|
6
5
|
import { t as validateIdentifier } from "../validate-DANX1-Qi.mjs";
|
|
@@ -11,67 +10,69 @@ import "../after-PcEvMY_6.mjs";
|
|
|
11
10
|
import { t as OptionsRepository } from "../options-DhrI7eMv.mjs";
|
|
12
11
|
import { a as encodeBase64url } from "../base64-DvnNgP7e.mjs";
|
|
13
12
|
import { n as fingerprintKey, r as generateEncryptionKey, t as EmDashSecretsError } from "../secrets-CIi0nFiR.mjs";
|
|
14
|
-
import { t as ContentRepository } from "../content-
|
|
15
|
-
import "../object-cache-
|
|
13
|
+
import { t as ContentRepository } from "../content-RzEXY3QX.mjs";
|
|
14
|
+
import "../object-cache-Bo6DGaC9.mjs";
|
|
16
15
|
import { n as slugify } from "../slugify-T5GHH42D.mjs";
|
|
17
|
-
import "../
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import "../
|
|
21
|
-
import "../
|
|
22
|
-
import "../
|
|
23
|
-
import "../
|
|
24
|
-
import "../
|
|
25
|
-
import
|
|
26
|
-
import
|
|
27
|
-
import "../
|
|
28
|
-
import
|
|
29
|
-
import
|
|
30
|
-
import "../
|
|
31
|
-
import "../
|
|
32
|
-
import "../
|
|
33
|
-
import
|
|
34
|
-
import "../
|
|
35
|
-
import
|
|
36
|
-
import "../
|
|
37
|
-
import
|
|
38
|
-
import "../
|
|
39
|
-
import "../
|
|
40
|
-
import "../
|
|
41
|
-
import "../
|
|
42
|
-
import "../
|
|
43
|
-
import
|
|
44
|
-
import
|
|
45
|
-
import "../
|
|
46
|
-
import
|
|
47
|
-
import "../
|
|
48
|
-
import
|
|
49
|
-
import
|
|
50
|
-
import "../
|
|
51
|
-
import
|
|
16
|
+
import "../request-cache-C4CIo5ad.mjs";
|
|
17
|
+
import "../url-Dn3IStq8.mjs";
|
|
18
|
+
import "../types-j6MBDjlZ.mjs";
|
|
19
|
+
import "../revision-CGkQA0e5.mjs";
|
|
20
|
+
import { t as MediaRepository } from "../media-CputjGE1.mjs";
|
|
21
|
+
import { t as TaxonomyRepository } from "../taxonomy-BesdHIwi.mjs";
|
|
22
|
+
import "../resolve-D-kqyKns.mjs";
|
|
23
|
+
import "../redirect-BvFKh8Sz.mjs";
|
|
24
|
+
import "../byline-registry-dvt4N3xV.mjs";
|
|
25
|
+
import "../field-defs-cache-DEkFYCDE.mjs";
|
|
26
|
+
import { t as BylineRepository } from "../byline-02tu_Uc-.mjs";
|
|
27
|
+
import "../staged-Bw5eHbKS.mjs";
|
|
28
|
+
import "../dist-Cfu8mMBs.mjs";
|
|
29
|
+
import "../fts-manager-DU03MxWu.mjs";
|
|
30
|
+
import { h as selectTaxonomyDefs, p as parseTaxonomyCollections } from "../loader-B_bcoE1h.mjs";
|
|
31
|
+
import "../collection-slugs-cache-BNRAPNiu.mjs";
|
|
32
|
+
import "../capture-triggers-CdZfvHtF.mjs";
|
|
33
|
+
import "../activation-DDuqAat2.mjs";
|
|
34
|
+
import "../collection-deletion-JecE26cS.mjs";
|
|
35
|
+
import { L as BlockTypeRegistry, n as SchemaRegistry } from "../registry-CtHRqVe-.mjs";
|
|
36
|
+
import "../hash-CY4QdeMJ.mjs";
|
|
37
|
+
import "../zod-generator-DnfG5sGQ.mjs";
|
|
38
|
+
import { r as isTransferError, t as TransferError } from "../errors-CjXd1LgH.mjs";
|
|
39
|
+
import "../canonical-CAecl1UQ.mjs";
|
|
40
|
+
import { d as sha256Hex, i as createSha256, s as packageDigest } from "../digest-DiYAoZpf.mjs";
|
|
41
|
+
import "../block-values-BrTrtA-v.mjs";
|
|
42
|
+
import "../query-DC3bv__4.mjs";
|
|
43
|
+
import "../schema-BZPj3kwZ.mjs";
|
|
44
|
+
import "../relations-CVI2nbrn.mjs";
|
|
45
|
+
import "../settings-B0zQj_Tj.mjs";
|
|
46
|
+
import "../schema-Berj5VQx.mjs";
|
|
47
|
+
import "../settings-BbVRRGDp.mjs";
|
|
48
|
+
import "../ssrf-DsmvZB80.mjs";
|
|
49
|
+
import { t as applySeed } from "../apply-C1kq5l7p.mjs";
|
|
50
|
+
import "../ssrf-tA45vIPX.mjs";
|
|
51
|
+
import { n as validateSeed } from "../validate-WkjGwBSO.mjs";
|
|
52
|
+
import { a as MigrationManifestValidationError, c as normalizeAstroI18n, i as getMigrationIntegrationMetadata, n as MIGRATION_CONFIG_SYMBOL, s as validateMigrationManifest, t as buildMigrationManifest } from "../manifest-builder-D7Y8iirE.mjs";
|
|
53
|
+
import "../identity-u3KgtUC9.mjs";
|
|
54
|
+
import { n as claimExplicitSeedOwnership } from "../ownership-DoeAIuTg.mjs";
|
|
52
55
|
import { LocalStorage } from "../storage/local.mjs";
|
|
53
|
-
import { t as
|
|
56
|
+
import { t as createDatabase } from "../connection-B9pIasFd.mjs";
|
|
57
|
+
import { t as convertDataForRead } from "../portable-text-BnRuiR1-.mjs";
|
|
54
58
|
import { createHeaderAwareFetch, customHeadersInterceptor, getCachedAccessToken, isAccessRedirect, resolveCustomHeaders, runCloudflaredLogin } from "../client/cf-access.mjs";
|
|
55
59
|
import { EmDashApiError, EmDashClient } from "../client/index.mjs";
|
|
56
|
-
import { a as parseIndexLine, n as unpackSitePackage, o as parseManifest, r as decodeUtf8, t as packSitePackage } from "../tar-
|
|
57
|
-
import "../kinds-
|
|
58
|
-
import { t as MANIFEST_PATH } from "../paths-
|
|
59
|
-
import "../transformations-
|
|
60
|
-
import "../version-
|
|
61
|
-
import { r as verifyReceiptDigest } from "../receipt-
|
|
60
|
+
import { a as parseIndexLine, n as unpackSitePackage, o as parseManifest, r as decodeUtf8, t as packSitePackage } from "../tar-lDI_fzLD.mjs";
|
|
61
|
+
import "../kinds-CXY-fwQ6.mjs";
|
|
62
|
+
import { t as MANIFEST_PATH } from "../paths-DiENGBx5.mjs";
|
|
63
|
+
import "../transformations-DdnpSdeC.mjs";
|
|
64
|
+
import "../version-DbT04wbH.mjs";
|
|
65
|
+
import { r as verifyReceiptDigest } from "../receipt-q1VK9jhj.mjs";
|
|
62
66
|
import { createRequire } from "node:module";
|
|
63
|
-
import {
|
|
67
|
+
import { sql } from "kysely";
|
|
64
68
|
import { z } from "zod";
|
|
65
69
|
import { ulid } from "ulidx";
|
|
66
|
-
import { extractManifestRoute, extractRouteOptions, isJsonPostRouteContract } from "@emdash-cms/plugin-types";
|
|
67
|
-
import { createGzipDecoder, unpackTar } from "modern-tar";
|
|
68
70
|
import { pathToFileURL } from "node:url";
|
|
69
|
-
import {
|
|
70
|
-
import {
|
|
71
|
-
import { basename, dirname, extname, isAbsolute, join, parse, resolve } from "node:path";
|
|
71
|
+
import { access, mkdir, readFile, rename, rm, stat, writeFile } from "node:fs/promises";
|
|
72
|
+
import { basename, dirname, isAbsolute, join, parse, resolve } from "node:path";
|
|
72
73
|
import { createReadStream, createWriteStream, existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
73
74
|
import { Readable, Writable } from "node:stream";
|
|
74
|
-
import { defineCommand,
|
|
75
|
+
import { defineCommand, runMain } from "citty";
|
|
75
76
|
import consola, { consola as consola$1 } from "consola";
|
|
76
77
|
import pc from "picocolors";
|
|
77
78
|
import { spawn } from "node:child_process";
|
|
@@ -79,8 +80,6 @@ import { homedir } from "node:os";
|
|
|
79
80
|
import { parse as parse$1, printParseErrorCode } from "jsonc-parser";
|
|
80
81
|
import { parse as parse$2 } from "smol-toml";
|
|
81
82
|
import { createInterface } from "node:readline/promises";
|
|
82
|
-
import { pipeline } from "node:stream/promises";
|
|
83
|
-
import { packTar } from "modern-tar/fs";
|
|
84
83
|
|
|
85
84
|
//#region src/cli/commands/auth.ts
|
|
86
85
|
/**
|
|
@@ -238,45 +237,6 @@ function removeCredentials(baseUrl) {
|
|
|
238
237
|
}
|
|
239
238
|
return false;
|
|
240
239
|
}
|
|
241
|
-
function marketplaceKey(registryUrl) {
|
|
242
|
-
try {
|
|
243
|
-
return `marketplace:${new URL(registryUrl).origin}`;
|
|
244
|
-
} catch {
|
|
245
|
-
return `marketplace:${registryUrl}`;
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
/**
|
|
249
|
-
* Get stored marketplace credential for a registry URL.
|
|
250
|
-
*/
|
|
251
|
-
function getMarketplaceCredential(registryUrl) {
|
|
252
|
-
const key = marketplaceKey(registryUrl);
|
|
253
|
-
const cred = readStore()[key];
|
|
254
|
-
if (!cred || !("token" in cred)) return null;
|
|
255
|
-
if (new Date(cred.expiresAt) < /* @__PURE__ */ new Date()) return null;
|
|
256
|
-
return cred;
|
|
257
|
-
}
|
|
258
|
-
/**
|
|
259
|
-
* Save marketplace credential for a registry URL.
|
|
260
|
-
*/
|
|
261
|
-
function saveMarketplaceCredential(registryUrl, cred) {
|
|
262
|
-
const key = marketplaceKey(registryUrl);
|
|
263
|
-
const store = readStore();
|
|
264
|
-
store[key] = cred;
|
|
265
|
-
writeStore(store);
|
|
266
|
-
}
|
|
267
|
-
/**
|
|
268
|
-
* Remove marketplace credential for a registry URL.
|
|
269
|
-
*/
|
|
270
|
-
function removeMarketplaceCredential(registryUrl) {
|
|
271
|
-
const key = marketplaceKey(registryUrl);
|
|
272
|
-
const store = readStore();
|
|
273
|
-
if (key in store) {
|
|
274
|
-
delete store[key];
|
|
275
|
-
writeStore(store);
|
|
276
|
-
return true;
|
|
277
|
-
}
|
|
278
|
-
return false;
|
|
279
|
-
}
|
|
280
240
|
|
|
281
241
|
//#endregion
|
|
282
242
|
//#region src/cli/client-factory.ts
|
|
@@ -728,7 +688,7 @@ const deleteCommand$2 = defineCommand({
|
|
|
728
688
|
}
|
|
729
689
|
}
|
|
730
690
|
});
|
|
731
|
-
const publishCommand
|
|
691
|
+
const publishCommand = defineCommand({
|
|
732
692
|
meta: {
|
|
733
693
|
name: "publish",
|
|
734
694
|
description: "Publish a content item"
|
|
@@ -907,7 +867,7 @@ const contentCommand = defineCommand({
|
|
|
907
867
|
create: createCommand$1,
|
|
908
868
|
update: updateCommand,
|
|
909
869
|
delete: deleteCommand$2,
|
|
910
|
-
publish: publishCommand
|
|
870
|
+
publish: publishCommand,
|
|
911
871
|
unpublish: unpublishCommand,
|
|
912
872
|
schedule: scheduleCommand,
|
|
913
873
|
restore: restoreCommand,
|
|
@@ -915,35 +875,6 @@ const contentCommand = defineCommand({
|
|
|
915
875
|
}
|
|
916
876
|
});
|
|
917
877
|
|
|
918
|
-
//#endregion
|
|
919
|
-
//#region src/database/connection.ts
|
|
920
|
-
/**
|
|
921
|
-
* Creates a Kysely database instance
|
|
922
|
-
* Supports:
|
|
923
|
-
* - file:./path/to/db.sqlite (local SQLite)
|
|
924
|
-
* - :memory: (in-memory SQLite for testing)
|
|
925
|
-
* - libsql://... (Turso/libSQL with auth token) - TODO
|
|
926
|
-
*/
|
|
927
|
-
function createDatabase(config) {
|
|
928
|
-
try {
|
|
929
|
-
if (config.url.startsWith("file:") || config.url === ":memory:") return new Kysely({
|
|
930
|
-
dialect: new SqliteDialect({ database: openNodeSqliteDatabase(config.url === ":memory:" ? ":memory:" : config.url.replace("file:", ""), {
|
|
931
|
-
journalMode: "wal",
|
|
932
|
-
readOnly: config.readOnly
|
|
933
|
-
}) }),
|
|
934
|
-
log: kyselyLogOption()
|
|
935
|
-
});
|
|
936
|
-
if (config.url.startsWith("libsql:")) {
|
|
937
|
-
if (!config.authToken) throw new EmDashDatabaseError("Auth token required for remote libSQL database");
|
|
938
|
-
throw new EmDashDatabaseError("LibSQL not yet implemented");
|
|
939
|
-
}
|
|
940
|
-
throw new EmDashDatabaseError(`Unsupported database URL scheme: ${config.url}`);
|
|
941
|
-
} catch (error) {
|
|
942
|
-
if (error instanceof EmDashDatabaseError) throw error;
|
|
943
|
-
throw new EmDashDatabaseError("Failed to create database", error);
|
|
944
|
-
}
|
|
945
|
-
}
|
|
946
|
-
|
|
947
878
|
//#endregion
|
|
948
879
|
//#region src/cli/commands/dev.ts
|
|
949
880
|
/**
|
|
@@ -960,7 +891,7 @@ async function readPackageJson$2(cwd) {
|
|
|
960
891
|
return null;
|
|
961
892
|
}
|
|
962
893
|
}
|
|
963
|
-
async function fileExists$
|
|
894
|
+
async function fileExists$3(path) {
|
|
964
895
|
try {
|
|
965
896
|
await access(path);
|
|
966
897
|
return true;
|
|
@@ -1012,7 +943,7 @@ const devCommand = defineCommand({
|
|
|
1012
943
|
process.exit(1);
|
|
1013
944
|
}
|
|
1014
945
|
const dbPath = resolve(cwd, args.database);
|
|
1015
|
-
if (!await fileExists$
|
|
946
|
+
if (!await fileExists$3(dbPath)) consola.start("Database not found, initializing...");
|
|
1016
947
|
const db = createDatabase({ url: `file:${dbPath}` });
|
|
1017
948
|
try {
|
|
1018
949
|
consola.start("Checking database migrations...");
|
|
@@ -1051,8 +982,8 @@ const devCommand = defineCommand({
|
|
|
1051
982
|
"--port",
|
|
1052
983
|
args.port
|
|
1053
984
|
];
|
|
1054
|
-
const pnpmLockExists = await fileExists$
|
|
1055
|
-
const yarnLockExists = await fileExists$
|
|
985
|
+
const pnpmLockExists = await fileExists$3(resolve(cwd, "pnpm-lock.yaml"));
|
|
986
|
+
const yarnLockExists = await fileExists$3(resolve(cwd, "yarn.lock"));
|
|
1056
987
|
let cmd;
|
|
1057
988
|
let cmdArgs;
|
|
1058
989
|
if (pnpmLockExists) {
|
|
@@ -1115,7 +1046,7 @@ function triggerFix(configPath) {
|
|
|
1115
1046
|
function mainFix(configPath) {
|
|
1116
1047
|
return configPath.endsWith(".toml") ? MAIN_FIX_TOML : MAIN_FIX_JSONC;
|
|
1117
1048
|
}
|
|
1118
|
-
async function fileExists$
|
|
1049
|
+
async function fileExists$2(path) {
|
|
1119
1050
|
try {
|
|
1120
1051
|
await access(path);
|
|
1121
1052
|
return true;
|
|
@@ -1136,7 +1067,7 @@ function sourcePosition(source, offset) {
|
|
|
1136
1067
|
async function findWranglerConfig(cwd) {
|
|
1137
1068
|
for (const filename of WRANGLER_CONFIG_FILES) {
|
|
1138
1069
|
const path = resolve(cwd, filename);
|
|
1139
|
-
if (await fileExists$
|
|
1070
|
+
if (await fileExists$2(path)) return path;
|
|
1140
1071
|
}
|
|
1141
1072
|
return null;
|
|
1142
1073
|
}
|
|
@@ -1231,7 +1162,7 @@ function printResult(result) {
|
|
|
1231
1162
|
}
|
|
1232
1163
|
async function checkDatabase(dbPath) {
|
|
1233
1164
|
const results = [];
|
|
1234
|
-
if (!await fileExists$
|
|
1165
|
+
if (!await fileExists$2(dbPath)) {
|
|
1235
1166
|
results.push({
|
|
1236
1167
|
name: "database",
|
|
1237
1168
|
status: "fail",
|
|
@@ -1377,6 +1308,7 @@ const doctorCommand = defineCommand({
|
|
|
1377
1308
|
* Export current database schema (and optionally content) as a seed file
|
|
1378
1309
|
*/
|
|
1379
1310
|
const SETTINGS_PREFIX = "site:";
|
|
1311
|
+
const TRAILING_SLASHES = /\/+$/;
|
|
1380
1312
|
const exportSeedCommand = defineCommand({
|
|
1381
1313
|
meta: {
|
|
1382
1314
|
name: "export-seed",
|
|
@@ -1403,6 +1335,11 @@ const exportSeedCommand = defineCommand({
|
|
|
1403
1335
|
type: "boolean",
|
|
1404
1336
|
description: "Pretty print JSON output",
|
|
1405
1337
|
default: true
|
|
1338
|
+
},
|
|
1339
|
+
"media-base-url": {
|
|
1340
|
+
type: "string",
|
|
1341
|
+
description: "Public URL of the site, used to write absolute media URLs",
|
|
1342
|
+
required: false
|
|
1406
1343
|
}
|
|
1407
1344
|
},
|
|
1408
1345
|
async run({ args }) {
|
|
@@ -1422,7 +1359,10 @@ const exportSeedCommand = defineCommand({
|
|
|
1422
1359
|
process.exit(1);
|
|
1423
1360
|
}
|
|
1424
1361
|
try {
|
|
1425
|
-
const seed = await exportSeed(db, args["with-content"]
|
|
1362
|
+
const seed = await exportSeed(db, args["with-content"], {
|
|
1363
|
+
mediaBaseUrl: args["media-base-url"],
|
|
1364
|
+
warn: (message) => process.stderr.write(`Warning: ${message}\n`)
|
|
1365
|
+
});
|
|
1426
1366
|
const output = args.pretty ? JSON.stringify(seed, null, " ") : JSON.stringify(seed);
|
|
1427
1367
|
console.log(output);
|
|
1428
1368
|
} catch (error) {
|
|
@@ -1436,7 +1376,9 @@ const exportSeedCommand = defineCommand({
|
|
|
1436
1376
|
/**
|
|
1437
1377
|
* Export database to seed file format
|
|
1438
1378
|
*/
|
|
1439
|
-
async function exportSeed(db, withContent) {
|
|
1379
|
+
async function exportSeed(db, withContent, options = {}) {
|
|
1380
|
+
const warn = options.warn ?? (() => {});
|
|
1381
|
+
const mediaUrlPrefix = mediaFileUrlPrefix(options.mediaBaseUrl);
|
|
1440
1382
|
const seed = {
|
|
1441
1383
|
$schema: "https://emdashcms.com/seed.schema.json",
|
|
1442
1384
|
version: "1",
|
|
@@ -1448,19 +1390,46 @@ async function exportSeed(db, withContent) {
|
|
|
1448
1390
|
seed.settings = await exportSettings(db);
|
|
1449
1391
|
seed.blockTypes = await exportBlockTypes(db);
|
|
1450
1392
|
seed.collections = await exportCollections(db);
|
|
1393
|
+
const relations = await exportRelations(db);
|
|
1394
|
+
if (relations.length > 0) seed.relations = relations;
|
|
1451
1395
|
const { i18nEnabled, defaultLocale } = await detectLocaleInfo(db, seed.collections);
|
|
1452
1396
|
if (defaultLocale) seed.defaultLocale = defaultLocale;
|
|
1453
1397
|
seed.taxonomies = await exportTaxonomies(db, i18nEnabled);
|
|
1454
|
-
seed.menus = await exportMenus(db, i18nEnabled);
|
|
1455
|
-
seed.widgetAreas = await exportWidgetAreas(db);
|
|
1456
1398
|
const { bylines, groupToSeedId } = await exportBylines(db);
|
|
1457
|
-
|
|
1399
|
+
let exportedContent;
|
|
1458
1400
|
if (withContent !== void 0) {
|
|
1459
1401
|
const collections = withContent === "" || withContent === "true" || withContent === "all" ? null : withContent.split(",").map((s) => s.trim()).filter(Boolean);
|
|
1460
|
-
|
|
1402
|
+
exportedContent = await exportContent(db, seed.collections || [], collections, groupToSeedId, i18nEnabled, mediaUrlPrefix);
|
|
1403
|
+
}
|
|
1404
|
+
seed.menus = await exportMenus(db, i18nEnabled, exportedContent?.groupSeedIds ?? /* @__PURE__ */ new Map());
|
|
1405
|
+
const redirects = await exportRedirects(db, warn);
|
|
1406
|
+
if (redirects.length > 0) seed.redirects = redirects;
|
|
1407
|
+
seed.widgetAreas = await exportWidgetAreas(db);
|
|
1408
|
+
const sections = await exportSections(db, warn);
|
|
1409
|
+
if (sections.length > 0) seed.sections = sections;
|
|
1410
|
+
if (bylines.length > 0) seed.bylines = bylines;
|
|
1411
|
+
if (exportedContent) {
|
|
1412
|
+
seed.content = exportedContent.content;
|
|
1413
|
+
if (exportedContent.mediaCount > 0 && !options.mediaBaseUrl) warn(`${exportedContent.mediaCount} media reference(s) use site-relative URLs, which \`emdash seed\` cannot download. Pass --media-base-url with the site's public URL to make them importable.`);
|
|
1461
1414
|
}
|
|
1462
1415
|
return seed;
|
|
1463
1416
|
}
|
|
1417
|
+
const MEDIA_FILE_PATH = "/_emdash/api/media/file/";
|
|
1418
|
+
/**
|
|
1419
|
+
* Prefix for `$media` URLs: the site's base URL (without a trailing slash)
|
|
1420
|
+
* plus the public media route, or the bare route when no base is given.
|
|
1421
|
+
*/
|
|
1422
|
+
function mediaFileUrlPrefix(mediaBaseUrl) {
|
|
1423
|
+
if (mediaBaseUrl === void 0) return MEDIA_FILE_PATH;
|
|
1424
|
+
let base;
|
|
1425
|
+
try {
|
|
1426
|
+
base = new URL(mediaBaseUrl);
|
|
1427
|
+
} catch {
|
|
1428
|
+
throw new Error(`Invalid media base URL: ${mediaBaseUrl}`);
|
|
1429
|
+
}
|
|
1430
|
+
if (base.protocol !== "http:" && base.protocol !== "https:") throw new Error(`Media base URL must use http or https: ${mediaBaseUrl}`);
|
|
1431
|
+
return `${base.origin}${base.pathname.replace(TRAILING_SLASHES, "")}${MEDIA_FILE_PATH}`;
|
|
1432
|
+
}
|
|
1464
1433
|
/**
|
|
1465
1434
|
* Export byline profiles as root-level `bylines[]`.
|
|
1466
1435
|
*
|
|
@@ -1508,7 +1477,7 @@ async function exportBylines(db) {
|
|
|
1508
1477
|
* Determine locale-awareness and the data's default locale for the export.
|
|
1509
1478
|
*
|
|
1510
1479
|
* The runtime initializes the i18n config in middleware, but the CLI never does,
|
|
1511
|
-
* so `isI18nEnabled()` is always false under `emdash export-seed
|
|
1480
|
+
* so `isI18nEnabled()` is always false under `emdash export-seed`. When
|
|
1512
1481
|
* the flag is unset, fall back to the data: a project is multi-locale when its
|
|
1513
1482
|
* i18n-aware tables hold rows in more than one distinct locale. `locale` is
|
|
1514
1483
|
* NOT NULL (defaulting to the site's default locale), so a per-row presence
|
|
@@ -1518,7 +1487,7 @@ async function exportBylines(db) {
|
|
|
1518
1487
|
* per-locale suffix they need to avoid duplicate seed ids.
|
|
1519
1488
|
*
|
|
1520
1489
|
* `defaultLocale` self-describes the single-locale case so a non-`en` default
|
|
1521
|
-
* survives the round-trip
|
|
1490
|
+
* survives the round-trip. When more than one locale is present every
|
|
1522
1491
|
* row already carries its own `locale`, so no fallback is needed and we leave it
|
|
1523
1492
|
* undefined rather than guess which locale is the "default" without the runtime
|
|
1524
1493
|
* config.
|
|
@@ -1600,6 +1569,9 @@ async function exportCollections(db) {
|
|
|
1600
1569
|
hidden: collection.hidden || void 0,
|
|
1601
1570
|
sortOrder: collection.sortOrder,
|
|
1602
1571
|
group: collection.group,
|
|
1572
|
+
commentsEnabled: collection.commentsEnabled || void 0,
|
|
1573
|
+
titleField: collection.titleField,
|
|
1574
|
+
dateField: collection.dateField,
|
|
1603
1575
|
fields: fields.map((field) => ({
|
|
1604
1576
|
slug: field.slug,
|
|
1605
1577
|
label: field.label,
|
|
@@ -1608,6 +1580,7 @@ async function exportCollections(db) {
|
|
|
1608
1580
|
unique: field.unique || void 0,
|
|
1609
1581
|
searchable: field.searchable || void 0,
|
|
1610
1582
|
indexed: field.indexed || void 0,
|
|
1583
|
+
translatable: field.translatable === false ? false : void 0,
|
|
1611
1584
|
defaultValue: field.defaultValue,
|
|
1612
1585
|
validation: field.validation ? { ...field.validation } : void 0,
|
|
1613
1586
|
widget: field.widget || void 0,
|
|
@@ -1619,6 +1592,36 @@ async function exportCollections(db) {
|
|
|
1619
1592
|
return result;
|
|
1620
1593
|
}
|
|
1621
1594
|
/**
|
|
1595
|
+
* Export relations as root-level `relations[]`.
|
|
1596
|
+
*
|
|
1597
|
+
* A reference field's `validation.relation` names a relation by slug, and the
|
|
1598
|
+
* field's validation is exported verbatim, so re-applying the seed binds the
|
|
1599
|
+
* field to this relation rather than creating another one.
|
|
1600
|
+
*/
|
|
1601
|
+
async function exportRelations(db) {
|
|
1602
|
+
return (await db.selectFrom("_emdash_relations").select([
|
|
1603
|
+
"slug",
|
|
1604
|
+
"parent_collection",
|
|
1605
|
+
"child_collection",
|
|
1606
|
+
"parent_label",
|
|
1607
|
+
"parent_label_singular",
|
|
1608
|
+
"child_label",
|
|
1609
|
+
"child_label_singular",
|
|
1610
|
+
"max_children_per_parent",
|
|
1611
|
+
"max_parents_per_child"
|
|
1612
|
+
]).orderBy("slug", "asc").execute()).map((row) => ({
|
|
1613
|
+
slug: row.slug,
|
|
1614
|
+
parentCollection: row.parent_collection,
|
|
1615
|
+
childCollection: row.child_collection,
|
|
1616
|
+
parentLabel: row.parent_label,
|
|
1617
|
+
parentLabelSingular: row.parent_label_singular ?? void 0,
|
|
1618
|
+
childLabel: row.child_label,
|
|
1619
|
+
childLabelSingular: row.child_label_singular ?? void 0,
|
|
1620
|
+
maxChildrenPerParent: row.max_children_per_parent,
|
|
1621
|
+
maxParentsPerChild: row.max_parents_per_child
|
|
1622
|
+
}));
|
|
1623
|
+
}
|
|
1624
|
+
/**
|
|
1622
1625
|
* Export taxonomy definitions and terms
|
|
1623
1626
|
*/
|
|
1624
1627
|
async function exportTaxonomies(db, i18nEnabled) {
|
|
@@ -1678,7 +1681,7 @@ async function exportTaxonomies(db, i18nEnabled) {
|
|
|
1678
1681
|
/**
|
|
1679
1682
|
* Export menus with their items
|
|
1680
1683
|
*/
|
|
1681
|
-
async function exportMenus(db, i18nEnabled) {
|
|
1684
|
+
async function exportMenus(db, i18nEnabled, contentGroupSeedIds) {
|
|
1682
1685
|
const menus = await db.selectFrom("_emdash_menus").selectAll().orderBy("name").orderBy("locale").execute();
|
|
1683
1686
|
const result = [];
|
|
1684
1687
|
const groupToSeedId = /* @__PURE__ */ new Map();
|
|
@@ -1691,7 +1694,8 @@ async function exportMenus(db, i18nEnabled) {
|
|
|
1691
1694
|
menuName: menu.name,
|
|
1692
1695
|
menuLocale: menu.locale ?? null,
|
|
1693
1696
|
itemGroupToSeedId,
|
|
1694
|
-
usedItemSeedIds
|
|
1697
|
+
usedItemSeedIds,
|
|
1698
|
+
contentGroupSeedIds
|
|
1695
1699
|
});
|
|
1696
1700
|
const seedMenu = {
|
|
1697
1701
|
id: seedId,
|
|
@@ -1746,7 +1750,7 @@ function buildMenuItemTree(items, i18nCtx) {
|
|
|
1746
1750
|
};
|
|
1747
1751
|
if (item.type === "custom") seedItem.url = item.custom_url || void 0;
|
|
1748
1752
|
else {
|
|
1749
|
-
seedItem.ref = item.reference_id || void 0;
|
|
1753
|
+
seedItem.ref = (item.type !== "taxonomy" && item.reference_id ? i18nCtx.contentGroupSeedIds.get(item.reference_id) : void 0) ?? (item.reference_id || void 0);
|
|
1750
1754
|
seedItem.collection = item.reference_collection || void 0;
|
|
1751
1755
|
}
|
|
1752
1756
|
if (item.target === "_blank") seedItem.target = "_blank";
|
|
@@ -1797,27 +1801,129 @@ async function exportWidgetAreas(db) {
|
|
|
1797
1801
|
}
|
|
1798
1802
|
return result;
|
|
1799
1803
|
}
|
|
1800
|
-
|
|
1801
|
-
|
|
1804
|
+
function isSeedRedirectType(type) {
|
|
1805
|
+
return type === 301 || type === 302 || type === 307 || type === 308;
|
|
1806
|
+
}
|
|
1807
|
+
/**
|
|
1808
|
+
* Export redirect rules. Terminal rules (410/451) have no seed representation
|
|
1809
|
+
* and are reported through `warn` instead.
|
|
1810
|
+
*
|
|
1811
|
+
* Databases migrated from before the source guard can hold several rows for
|
|
1812
|
+
* one source; only the guarded row is exported, since a seed rejects duplicate
|
|
1813
|
+
* sources.
|
|
1814
|
+
*/
|
|
1815
|
+
async function exportRedirects(db, warn) {
|
|
1816
|
+
const rows = await db.selectFrom("_emdash_redirects").select([
|
|
1817
|
+
"source",
|
|
1818
|
+
"destination",
|
|
1819
|
+
"type",
|
|
1820
|
+
"enabled",
|
|
1821
|
+
"group_name",
|
|
1822
|
+
"source_guard"
|
|
1823
|
+
]).orderBy("created_at").orderBy("id").execute();
|
|
1824
|
+
const guardedRows = /* @__PURE__ */ new Map();
|
|
1825
|
+
for (const row of rows) {
|
|
1826
|
+
const current = guardedRows.get(row.source);
|
|
1827
|
+
if (!current || row.source_guard === 1 && current.source_guard !== 1) guardedRows.set(row.source, row);
|
|
1828
|
+
}
|
|
1829
|
+
const result = [];
|
|
1830
|
+
for (const row of rows) {
|
|
1831
|
+
if (guardedRows.get(row.source) !== row) {
|
|
1832
|
+
warn(`Skipping duplicate rule for "${row.source}" -> "${row.destination}".`);
|
|
1833
|
+
continue;
|
|
1834
|
+
}
|
|
1835
|
+
if (!isSeedRedirectType(row.type)) {
|
|
1836
|
+
warn(`Skipping ${row.type} rule for "${row.source}": seeds only carry 301/302/307/308.`);
|
|
1837
|
+
continue;
|
|
1838
|
+
}
|
|
1839
|
+
const redirect = {
|
|
1840
|
+
source: row.source,
|
|
1841
|
+
destination: row.destination,
|
|
1842
|
+
type: row.type
|
|
1843
|
+
};
|
|
1844
|
+
if (row.enabled === 0) redirect.enabled = false;
|
|
1845
|
+
if (row.group_name) redirect.groupName = row.group_name;
|
|
1846
|
+
result.push(redirect);
|
|
1847
|
+
}
|
|
1848
|
+
return result;
|
|
1849
|
+
}
|
|
1850
|
+
function isSeedSectionSource(source) {
|
|
1851
|
+
return source === "theme" || source === "user" || source === "import";
|
|
1852
|
+
}
|
|
1853
|
+
/** Section slugs a seed accepts. The WordPress importer can store others. */
|
|
1854
|
+
const SEED_SECTION_SLUG_PATTERN = /^[a-z0-9-]+$/;
|
|
1855
|
+
async function exportSections(db, warn) {
|
|
1856
|
+
const rows = await db.selectFrom("_emdash_sections").select([
|
|
1857
|
+
"slug",
|
|
1858
|
+
"title",
|
|
1859
|
+
"description",
|
|
1860
|
+
"keywords",
|
|
1861
|
+
"content",
|
|
1862
|
+
"source"
|
|
1863
|
+
]).orderBy("slug").execute();
|
|
1864
|
+
const result = [];
|
|
1865
|
+
for (const row of rows) {
|
|
1866
|
+
if (!SEED_SECTION_SLUG_PATTERN.test(row.slug)) {
|
|
1867
|
+
warn(`Skipping section "${row.slug}": seed section slugs may only contain lowercase letters, digits, and hyphens.`);
|
|
1868
|
+
continue;
|
|
1869
|
+
}
|
|
1870
|
+
const section = {
|
|
1871
|
+
slug: row.slug,
|
|
1872
|
+
title: row.title,
|
|
1873
|
+
content: JSON.parse(row.content)
|
|
1874
|
+
};
|
|
1875
|
+
if (row.description) section.description = row.description;
|
|
1876
|
+
if (row.keywords) section.keywords = JSON.parse(row.keywords);
|
|
1877
|
+
if (isSeedSectionSource(row.source)) section.source = row.source;
|
|
1878
|
+
result.push(section);
|
|
1879
|
+
}
|
|
1880
|
+
return result;
|
|
1881
|
+
}
|
|
1882
|
+
async function loadRelations(db) {
|
|
1883
|
+
const rows = await db.selectFrom("_emdash_relations").select([
|
|
1884
|
+
"id",
|
|
1885
|
+
"slug",
|
|
1886
|
+
"child_collection",
|
|
1887
|
+
"max_children_per_parent"
|
|
1888
|
+
]).execute();
|
|
1889
|
+
return new Map(rows.map((row) => [row.slug, {
|
|
1890
|
+
id: row.id,
|
|
1891
|
+
childCollection: row.child_collection,
|
|
1892
|
+
maxChildrenPerParent: row.max_children_per_parent
|
|
1893
|
+
}]));
|
|
1894
|
+
}
|
|
1895
|
+
/** A legacy reference column holds a single entry id or an array of them. */
|
|
1896
|
+
function legacyReferenceValues(value) {
|
|
1802
1897
|
if (typeof value === "string") return [value];
|
|
1803
1898
|
if (Array.isArray(value)) return value.filter((v) => typeof v === "string");
|
|
1804
1899
|
return [];
|
|
1805
1900
|
}
|
|
1806
1901
|
/**
|
|
1807
1902
|
* For each exported collection, the other exported collections its entries
|
|
1808
|
-
* point into.
|
|
1809
|
-
*
|
|
1903
|
+
* point into.
|
|
1904
|
+
*
|
|
1905
|
+
* A field bound to a relation names its target in the relation, and its links
|
|
1906
|
+
* are not in `data` to be read. A field with no relation still holds entry ids
|
|
1907
|
+
* in its own column; those are read from the values rather than from a declared
|
|
1908
|
+
* target, so a field without `options.collection` is still accounted for.
|
|
1810
1909
|
*/
|
|
1811
|
-
function referenceTargets(collected, collectionsBySlug, entryIdToCollection) {
|
|
1910
|
+
function referenceTargets(collected, collectionsBySlug, entryIdToCollection, relations) {
|
|
1812
1911
|
const targets = /* @__PURE__ */ new Map();
|
|
1813
1912
|
for (const [slug, items] of collected) {
|
|
1814
|
-
const referenceFields = (collectionsBySlug.get(slug)?.fields ?? []).filter((field) => field.type === "reference")
|
|
1913
|
+
const referenceFields = (collectionsBySlug.get(slug)?.fields ?? []).filter((field) => field.type === "reference");
|
|
1815
1914
|
if (referenceFields.length === 0) continue;
|
|
1816
1915
|
const found = /* @__PURE__ */ new Set();
|
|
1817
|
-
|
|
1818
|
-
const target = entryIdToCollection.get(value);
|
|
1916
|
+
const add = (target) => {
|
|
1819
1917
|
if (target && target !== slug) found.add(target);
|
|
1820
|
-
}
|
|
1918
|
+
};
|
|
1919
|
+
for (const field of referenceFields) {
|
|
1920
|
+
const relationSlug = field.validation?.relation;
|
|
1921
|
+
if (typeof relationSlug !== "string") continue;
|
|
1922
|
+
if (field.validation?.relationSide === "child") continue;
|
|
1923
|
+
add(relations.get(relationSlug)?.childCollection);
|
|
1924
|
+
}
|
|
1925
|
+
const columnFields = referenceFields.filter((field) => typeof field.validation?.relation !== "string").map((field) => field.slug);
|
|
1926
|
+
if (columnFields.length > 0) for (const { item } of items) for (const fieldSlug of columnFields) for (const value of legacyReferenceValues(item.data[fieldSlug])) add(entryIdToCollection.get(value));
|
|
1821
1927
|
if (found.size > 0) targets.set(slug, found);
|
|
1822
1928
|
}
|
|
1823
1929
|
return targets;
|
|
@@ -1851,8 +1957,9 @@ function orderByReferenceTargets(slugs, targets) {
|
|
|
1851
1957
|
/**
|
|
1852
1958
|
* Export content from collections
|
|
1853
1959
|
*/
|
|
1854
|
-
async function exportContent(db, collections, includeCollections, bylineGroupToSeedId, i18nEnabled) {
|
|
1960
|
+
async function exportContent(db, collections, includeCollections, bylineGroupToSeedId, i18nEnabled, mediaUrlPrefix) {
|
|
1855
1961
|
const content = {};
|
|
1962
|
+
const mediaCounter = { count: 0 };
|
|
1856
1963
|
const contentRepo = new ContentRepository(db);
|
|
1857
1964
|
const taxonomyRepo = new TaxonomyRepository(db);
|
|
1858
1965
|
const mediaRepo = new MediaRepository(db);
|
|
@@ -1866,7 +1973,7 @@ async function exportContent(db, collections, includeCollections, bylineGroupToS
|
|
|
1866
1973
|
status: "all"
|
|
1867
1974
|
});
|
|
1868
1975
|
for (const media of result.items) mediaMap.set(media.id, {
|
|
1869
|
-
url:
|
|
1976
|
+
url: `${mediaUrlPrefix}${media.storageKey}`,
|
|
1870
1977
|
filename: media.filename,
|
|
1871
1978
|
alt: media.alt || void 0,
|
|
1872
1979
|
caption: media.caption || void 0
|
|
@@ -1877,6 +1984,8 @@ async function exportContent(db, collections, includeCollections, bylineGroupToS
|
|
|
1877
1984
|
const collected = /* @__PURE__ */ new Map();
|
|
1878
1985
|
const entryIdToSeedId = /* @__PURE__ */ new Map();
|
|
1879
1986
|
const entryIdToCollection = /* @__PURE__ */ new Map();
|
|
1987
|
+
const groupToSeedId = /* @__PURE__ */ new Map();
|
|
1988
|
+
const exported = [];
|
|
1880
1989
|
for (const collection of collections) {
|
|
1881
1990
|
if (includeCollections && !includeCollections.includes(collection.slug)) continue;
|
|
1882
1991
|
const items = [];
|
|
@@ -1894,13 +2003,16 @@ async function exportContent(db, collections, includeCollections, bylineGroupToS
|
|
|
1894
2003
|
});
|
|
1895
2004
|
entryIdToSeedId.set(item.id, seedId);
|
|
1896
2005
|
entryIdToCollection.set(item.id, collection.slug);
|
|
2006
|
+
const group = item.translationGroup ?? item.id;
|
|
2007
|
+
if (!groupToSeedId.has(group)) groupToSeedId.set(group, seedId);
|
|
1897
2008
|
}
|
|
1898
2009
|
cursor = result.nextCursor;
|
|
1899
2010
|
} while (cursor);
|
|
1900
2011
|
collected.set(collection.slug, items);
|
|
1901
2012
|
}
|
|
2013
|
+
const relations = await loadRelations(db);
|
|
1902
2014
|
const collectionsBySlug = new Map(collections.map((c) => [c.slug, c]));
|
|
1903
|
-
const orderedSlugs = orderByReferenceTargets([...collected.keys()], referenceTargets(collected, collectionsBySlug, entryIdToCollection));
|
|
2015
|
+
const orderedSlugs = orderByReferenceTargets([...collected.keys()], referenceTargets(collected, collectionsBySlug, entryIdToCollection, relations));
|
|
1904
2016
|
for (const slug of orderedSlugs) {
|
|
1905
2017
|
const collection = collectionsBySlug.get(slug);
|
|
1906
2018
|
const items = collected.get(slug);
|
|
@@ -1908,11 +2020,11 @@ async function exportContent(db, collections, includeCollections, bylineGroupToS
|
|
|
1908
2020
|
const entries = [];
|
|
1909
2021
|
const translationGroupToSeedId = /* @__PURE__ */ new Map();
|
|
1910
2022
|
for (const { item, seedId } of items) {
|
|
1911
|
-
const processedData = processDataForExport(item.data, collection.fields, mediaMap,
|
|
2023
|
+
const processedData = processDataForExport(item.data, collection.fields, mediaMap, mediaCounter);
|
|
1912
2024
|
const entry = {
|
|
1913
2025
|
id: seedId,
|
|
1914
2026
|
slug: item.slug?.trim() ? item.slug : collection.routable === false ? void 0 : item.id,
|
|
1915
|
-
status: item.status === "published"
|
|
2027
|
+
status: item.status === "published" ? "published" : "draft",
|
|
1916
2028
|
data: processedData
|
|
1917
2029
|
};
|
|
1918
2030
|
if (i18nEnabled && item.locale) {
|
|
@@ -1927,6 +2039,12 @@ async function exportContent(db, collections, includeCollections, bylineGroupToS
|
|
|
1927
2039
|
if (Object.keys(taxonomies).length > 0) entry.taxonomies = taxonomies;
|
|
1928
2040
|
const bylines = await getBylineCredits(db, collection.slug, item.id, bylineGroupToSeedId);
|
|
1929
2041
|
if (bylines.length > 0) entry.bylines = bylines;
|
|
2042
|
+
exported.push({
|
|
2043
|
+
collection,
|
|
2044
|
+
entry,
|
|
2045
|
+
translationGroup: item.translationGroup ?? null,
|
|
2046
|
+
referenceValues: item.data
|
|
2047
|
+
});
|
|
1930
2048
|
entries.push(entry);
|
|
1931
2049
|
}
|
|
1932
2050
|
if (i18nEnabled && entries.length > 0) entries.sort((a, b) => {
|
|
@@ -1936,37 +2054,110 @@ async function exportContent(db, collections, includeCollections, bylineGroupToS
|
|
|
1936
2054
|
});
|
|
1937
2055
|
if (entries.length > 0) content[collection.slug] = entries;
|
|
1938
2056
|
}
|
|
1939
|
-
|
|
2057
|
+
await addReferenceLinks(db, exported, relations, groupToSeedId, entryIdToSeedId);
|
|
2058
|
+
return {
|
|
2059
|
+
content,
|
|
2060
|
+
groupSeedIds: groupToSeedId,
|
|
2061
|
+
mediaCount: mediaCounter.count
|
|
2062
|
+
};
|
|
1940
2063
|
}
|
|
1941
2064
|
/**
|
|
1942
|
-
*
|
|
2065
|
+
* Write each entry's reference selection into its `data` as `$ref:` values, which
|
|
2066
|
+
* the seed's own content ids resolve on apply.
|
|
2067
|
+
*
|
|
2068
|
+
* A field bound to a relation takes its selection from the link table. Only the
|
|
2069
|
+
* parent side is emitted: both sides view one link set, so a child-side field
|
|
2070
|
+
* would restate links the parent side already carries, and `setReferenceChildren`
|
|
2071
|
+
* accepts them only from the parent. A field with no relation takes the entry id
|
|
2072
|
+
* in its column instead.
|
|
2073
|
+
*
|
|
2074
|
+
* Runs after every collection has been emitted, so the seed id of any target is
|
|
2075
|
+
* known. A target that was not exported has none: a link is then dropped, since
|
|
2076
|
+
* nothing in the seed owns it, while a column value keeps its `$ref:` prefix
|
|
2077
|
+
* around the raw row id. Stripping the prefix there would write a row id that no
|
|
2078
|
+
* restored row carries into the column, and the restore would report success.
|
|
2079
|
+
*/
|
|
2080
|
+
async function addReferenceLinks(db, exported, relations, groupToSeedId, entryIdToSeedId) {
|
|
2081
|
+
if (exported.length === 0) return;
|
|
2082
|
+
const linksByRelation = /* @__PURE__ */ new Map();
|
|
2083
|
+
if (relations.size > 0) {
|
|
2084
|
+
const edges = await db.selectFrom("_emdash_content_references").select([
|
|
2085
|
+
"relation_id",
|
|
2086
|
+
"parent_group",
|
|
2087
|
+
"child_group"
|
|
2088
|
+
]).orderBy("sort_order", "asc").execute();
|
|
2089
|
+
for (const edge of edges) {
|
|
2090
|
+
const byParent = linksByRelation.get(edge.relation_id) ?? /* @__PURE__ */ new Map();
|
|
2091
|
+
const children = byParent.get(edge.parent_group) ?? [];
|
|
2092
|
+
children.push(edge.child_group);
|
|
2093
|
+
byParent.set(edge.parent_group, children);
|
|
2094
|
+
linksByRelation.set(edge.relation_id, byParent);
|
|
2095
|
+
}
|
|
2096
|
+
}
|
|
2097
|
+
for (const { collection, entry, translationGroup, referenceValues } of exported) for (const field of collection.fields) {
|
|
2098
|
+
if (field.type !== "reference") continue;
|
|
2099
|
+
const slug = field.validation?.relation;
|
|
2100
|
+
if (typeof slug !== "string") {
|
|
2101
|
+
const stored = referenceValues[field.slug];
|
|
2102
|
+
const refs = (Array.isArray(stored) ? stored : [stored]).filter((id) => typeof id === "string" && id.length > 0).map((id) => `$ref:${entryIdToSeedId.get(id) ?? id}`);
|
|
2103
|
+
if (refs.length === 0) continue;
|
|
2104
|
+
entry.data[field.slug] = Array.isArray(stored) ? refs : refs[0];
|
|
2105
|
+
continue;
|
|
2106
|
+
}
|
|
2107
|
+
if (field.validation?.relationSide === "child") continue;
|
|
2108
|
+
const relation = relations.get(slug);
|
|
2109
|
+
if (!relation || !translationGroup) continue;
|
|
2110
|
+
const refs = (linksByRelation.get(relation.id)?.get(translationGroup) ?? []).map((group) => groupToSeedId.get(group)).filter((seedId) => seedId !== void 0).map((seedId) => `$ref:${seedId}`);
|
|
2111
|
+
if (refs.length === 0) continue;
|
|
2112
|
+
entry.data[field.slug] = relation.maxChildrenPerParent === 1 ? refs[0] : refs;
|
|
2113
|
+
}
|
|
2114
|
+
}
|
|
2115
|
+
/**
|
|
2116
|
+
* Convert a stored media value (image or file) to `$media` syntax. Values that
|
|
2117
|
+
* don't point at a known media row are kept as they are.
|
|
1943
2118
|
*/
|
|
1944
|
-
function
|
|
2119
|
+
function toSeedMedia(value, mediaMap, mediaCounter) {
|
|
2120
|
+
if (!value || typeof value !== "object") return value;
|
|
2121
|
+
const mediaValue = value;
|
|
2122
|
+
const mediaInfo = typeof mediaValue.id === "string" ? mediaMap.get(mediaValue.id) : void 0;
|
|
2123
|
+
if (!mediaInfo) return value;
|
|
2124
|
+
mediaCounter.count++;
|
|
2125
|
+
return { $media: {
|
|
2126
|
+
url: mediaInfo.url,
|
|
2127
|
+
filename: mediaInfo.filename,
|
|
2128
|
+
alt: typeof mediaValue.alt === "string" && mediaValue.alt || mediaInfo.alt,
|
|
2129
|
+
caption: mediaInfo.caption
|
|
2130
|
+
} };
|
|
2131
|
+
}
|
|
2132
|
+
/** Slugs of a repeater field's `image` sub-fields. */
|
|
2133
|
+
function repeaterImageSubFields(field) {
|
|
2134
|
+
const subFields = field.validation?.subFields;
|
|
2135
|
+
const slugs = /* @__PURE__ */ new Set();
|
|
2136
|
+
if (!Array.isArray(subFields)) return slugs;
|
|
2137
|
+
for (const subField of subFields) if (subField && typeof subField === "object" && subField.type === "image" && typeof subField.slug === "string") slugs.add(subField.slug);
|
|
2138
|
+
return slugs;
|
|
2139
|
+
}
|
|
2140
|
+
/**
|
|
2141
|
+
* Process content data for export: media values become `$media` references
|
|
2142
|
+
* and reference values become `$ref:` seed ids.
|
|
2143
|
+
*/
|
|
2144
|
+
function processDataForExport(data, fields, mediaMap, mediaCounter) {
|
|
1945
2145
|
const result = {};
|
|
1946
|
-
const
|
|
1947
|
-
for (const field of fields)
|
|
2146
|
+
const fieldsBySlug = /* @__PURE__ */ new Map();
|
|
2147
|
+
for (const field of fields) fieldsBySlug.set(field.slug, field);
|
|
1948
2148
|
for (const [key, value] of Object.entries(data)) {
|
|
1949
|
-
const
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
continue;
|
|
1962
|
-
}
|
|
1963
|
-
}
|
|
1964
|
-
result[key] = value;
|
|
1965
|
-
} else if (fieldType === "reference" && typeof value === "string") result[key] = `$ref:${entryIdToSeedId.get(value) ?? value}`;
|
|
1966
|
-
else if (Array.isArray(value)) result[key] = value.map((item) => {
|
|
1967
|
-
if (typeof item === "string" && fieldType === "reference") return `$ref:${entryIdToSeedId.get(item) ?? item}`;
|
|
1968
|
-
return item;
|
|
1969
|
-
});
|
|
2149
|
+
const field = fieldsBySlug.get(key);
|
|
2150
|
+
const fieldType = field?.type;
|
|
2151
|
+
if (fieldType === "image" || fieldType === "file") result[key] = toSeedMedia(value, mediaMap, mediaCounter);
|
|
2152
|
+
else if (field && fieldType === "repeater" && Array.isArray(value)) {
|
|
2153
|
+
const imageSubFields = repeaterImageSubFields(field);
|
|
2154
|
+
result[key] = value.map((row) => {
|
|
2155
|
+
if (!row || typeof row !== "object" || Array.isArray(row)) return row;
|
|
2156
|
+
const exportedRow = {};
|
|
2157
|
+
for (const [subKey, subValue] of Object.entries(row)) exportedRow[subKey] = imageSubFields.has(subKey) ? toSeedMedia(subValue, mediaMap, mediaCounter) : subValue;
|
|
2158
|
+
return exportedRow;
|
|
2159
|
+
});
|
|
2160
|
+
} else if (fieldType === "reference") continue;
|
|
1970
2161
|
else result[key] = value;
|
|
1971
2162
|
}
|
|
1972
2163
|
return result;
|
|
@@ -2011,7 +2202,7 @@ async function getTaxonomyAssignments(taxonomyRepo, collection, entryId) {
|
|
|
2011
2202
|
*
|
|
2012
2203
|
* Initialize database from template config in package.json
|
|
2013
2204
|
*/
|
|
2014
|
-
async function fileExists$
|
|
2205
|
+
async function fileExists$1(path) {
|
|
2015
2206
|
try {
|
|
2016
2207
|
await access(path);
|
|
2017
2208
|
return true;
|
|
@@ -2102,7 +2293,7 @@ const initCommand = defineCommand({
|
|
|
2102
2293
|
if (alreadyInitialized && args.force) consola.warn("Re-initializing (--force)...");
|
|
2103
2294
|
if (config?.schema) {
|
|
2104
2295
|
const schemaPath = resolve(cwd, config.schema);
|
|
2105
|
-
if (await fileExists$
|
|
2296
|
+
if (await fileExists$1(schemaPath)) {
|
|
2106
2297
|
consola.start(`Running schema: ${config.schema}`);
|
|
2107
2298
|
try {
|
|
2108
2299
|
await runSqlFile(db, schemaPath);
|
|
@@ -2820,7 +3011,9 @@ async function loadProjectConfig(projectRoot, configFile) {
|
|
|
2820
3011
|
},
|
|
2821
3012
|
configFile,
|
|
2822
3013
|
projectRoot,
|
|
2823
|
-
"silent"
|
|
3014
|
+
"silent",
|
|
3015
|
+
void 0,
|
|
3016
|
+
"runner"
|
|
2824
3017
|
]);
|
|
2825
3018
|
if (!isRecord$1(loaded) || !Object.hasOwn(loaded, "config")) throw new MigrationConfigLoaderError(`Vite could not load Astro config: ${configFile}`);
|
|
2826
3019
|
return loaded.config;
|
|
@@ -3303,1439 +3496,6 @@ const migrateCommand = defineCommand({
|
|
|
3303
3496
|
}
|
|
3304
3497
|
});
|
|
3305
3498
|
|
|
3306
|
-
//#endregion
|
|
3307
|
-
//#region src/cli/commands/bundle-utils.ts
|
|
3308
|
-
/**
|
|
3309
|
-
* Bundle utility functions
|
|
3310
|
-
*
|
|
3311
|
-
* Shared logic extracted from the bundle command so it can be tested
|
|
3312
|
-
* without the CLI harness and tsdown dependency.
|
|
3313
|
-
*/
|
|
3314
|
-
const MAX_BUNDLE_SIZE = 256 * 1024;
|
|
3315
|
-
const MAX_FILE_SIZE = 128 * 1024;
|
|
3316
|
-
const MAX_FILE_COUNT = 20;
|
|
3317
|
-
const MAX_SCREENSHOTS = 5;
|
|
3318
|
-
const MAX_SCREENSHOT_WIDTH = 1920;
|
|
3319
|
-
const MAX_SCREENSHOT_HEIGHT = 1080;
|
|
3320
|
-
const ICON_SIZE = 256;
|
|
3321
|
-
const MCP_TOOL_NAME_PATTERN = /^[a-zA-Z0-9_-]+$/;
|
|
3322
|
-
/**
|
|
3323
|
-
* Matches Node.js built-in imports in bundled output:
|
|
3324
|
-
* - require("node:xxx") / require("xxx")
|
|
3325
|
-
* - import("node:xxx") / import("xxx")
|
|
3326
|
-
* - import X from "node:xxx" / import { X } from "node:xxx"
|
|
3327
|
-
* - import * as X from "node:xxx"
|
|
3328
|
-
* - export { X } from "node:xxx"
|
|
3329
|
-
* Captures the base module name (e.g. "fs" from "node:fs/promises").
|
|
3330
|
-
*/
|
|
3331
|
-
const NODE_BUILTIN_IMPORT_RE = /(?:import|export|require)\s*(?:\(|[^(]*?\bfrom\s+)["'](?:node:)?([a-z_]+)(?:\/[^"']*)?\s*["']\)?/g;
|
|
3332
|
-
const LEADING_DOT_SLASH_RE = /^\.\//;
|
|
3333
|
-
const DIST_PREFIX_RE = /^dist\//;
|
|
3334
|
-
const MJS_EXT_RE = /\.m?js$/;
|
|
3335
|
-
const TS_TO_TSX_RE = /\.ts$/;
|
|
3336
|
-
/** Node.js built-in modules that shouldn't appear in sandbox code */
|
|
3337
|
-
const NODE_BUILTINS = new Set([
|
|
3338
|
-
"assert",
|
|
3339
|
-
"buffer",
|
|
3340
|
-
"child_process",
|
|
3341
|
-
"cluster",
|
|
3342
|
-
"crypto",
|
|
3343
|
-
"dgram",
|
|
3344
|
-
"dns",
|
|
3345
|
-
"domain",
|
|
3346
|
-
"events",
|
|
3347
|
-
"fs",
|
|
3348
|
-
"http",
|
|
3349
|
-
"http2",
|
|
3350
|
-
"https",
|
|
3351
|
-
"inspector",
|
|
3352
|
-
"module",
|
|
3353
|
-
"net",
|
|
3354
|
-
"os",
|
|
3355
|
-
"path",
|
|
3356
|
-
"perf_hooks",
|
|
3357
|
-
"process",
|
|
3358
|
-
"punycode",
|
|
3359
|
-
"querystring",
|
|
3360
|
-
"readline",
|
|
3361
|
-
"repl",
|
|
3362
|
-
"stream",
|
|
3363
|
-
"string_decoder",
|
|
3364
|
-
"sys",
|
|
3365
|
-
"timers",
|
|
3366
|
-
"tls",
|
|
3367
|
-
"trace_events",
|
|
3368
|
-
"tty",
|
|
3369
|
-
"url",
|
|
3370
|
-
"util",
|
|
3371
|
-
"v8",
|
|
3372
|
-
"vm",
|
|
3373
|
-
"wasi",
|
|
3374
|
-
"worker_threads",
|
|
3375
|
-
"zlib"
|
|
3376
|
-
]);
|
|
3377
|
-
async function fileExists$1(path) {
|
|
3378
|
-
try {
|
|
3379
|
-
await access(path);
|
|
3380
|
-
return true;
|
|
3381
|
-
} catch {
|
|
3382
|
-
return false;
|
|
3383
|
-
}
|
|
3384
|
-
}
|
|
3385
|
-
/** Convert an absolute build artifact path into a portable ESM import specifier. */
|
|
3386
|
-
function toFileImportSpecifier(path) {
|
|
3387
|
-
return pathToFileURL(path).href;
|
|
3388
|
-
}
|
|
3389
|
-
/**
|
|
3390
|
-
* Read image dimensions from a buffer.
|
|
3391
|
-
* Returns [width, height] or null if the format is unrecognized.
|
|
3392
|
-
*/
|
|
3393
|
-
function readImageDimensions(buf) {
|
|
3394
|
-
try {
|
|
3395
|
-
const result = imageSize(buf);
|
|
3396
|
-
if (result.width != null && result.height != null) return [result.width, result.height];
|
|
3397
|
-
return null;
|
|
3398
|
-
} catch {
|
|
3399
|
-
return null;
|
|
3400
|
-
}
|
|
3401
|
-
}
|
|
3402
|
-
/**
|
|
3403
|
-
* Extract manifest metadata from a ResolvedPlugin.
|
|
3404
|
-
* Strips functions (hooks, route handlers) and keeps only serializable metadata.
|
|
3405
|
-
*/
|
|
3406
|
-
function extractManifest(plugin) {
|
|
3407
|
-
if ((plugin.admin.pages?.length ?? 0) > 0 || (plugin.admin.widgets?.length ?? 0) > 0) {
|
|
3408
|
-
const adminRoute = plugin.routes.admin;
|
|
3409
|
-
if (adminRoute && (adminRoute.public === true || !isJsonPostRouteContract(adminRoute))) throw new Error("Block Kit admin route must accept POST JSON requests and return JSON");
|
|
3410
|
-
}
|
|
3411
|
-
const declaredAccess = capabilitiesToDeclaredAccess$1(plugin.capabilities, plugin.allowedHosts);
|
|
3412
|
-
const enforcedAccess = declaredAccessToCapabilities$1(declaredAccess);
|
|
3413
|
-
const hooks = [];
|
|
3414
|
-
for (const [name, resolved] of Object.entries(plugin.hooks)) {
|
|
3415
|
-
if (!resolved) continue;
|
|
3416
|
-
if (resolved.exclusive || resolved.priority !== 100 || resolved.timeout !== 5e3) {
|
|
3417
|
-
const entry = { name };
|
|
3418
|
-
if (resolved.exclusive) entry.exclusive = true;
|
|
3419
|
-
if (resolved.priority !== 100) entry.priority = resolved.priority;
|
|
3420
|
-
if (resolved.timeout !== 5e3) entry.timeout = resolved.timeout;
|
|
3421
|
-
hooks.push(entry);
|
|
3422
|
-
} else hooks.push(name);
|
|
3423
|
-
}
|
|
3424
|
-
const routes = Object.entries(plugin.routes).map(([name, route]) => extractManifestRoute(name, route));
|
|
3425
|
-
const tools = Object.entries(plugin.mcp?.tools ?? {}).map(([name, tool]) => {
|
|
3426
|
-
if (!MCP_TOOL_NAME_PATTERN.test(name)) throw new Error(`Invalid MCP tool name "${name}"`);
|
|
3427
|
-
const route = plugin.routes[tool.route];
|
|
3428
|
-
if (!route?.permission || route.public || route.response === "raw") throw new Error(`MCP tool "${name}" must reference a private route with a permission`);
|
|
3429
|
-
if (!isJsonPostRouteContract(route)) throw new Error(`MCP tool "${name}" must reference a POST-compatible JSON route`);
|
|
3430
|
-
return {
|
|
3431
|
-
name,
|
|
3432
|
-
description: tool.description,
|
|
3433
|
-
route: tool.route,
|
|
3434
|
-
permission: route.permission,
|
|
3435
|
-
destructive: tool.destructive ?? false,
|
|
3436
|
-
inputSchema: z.toJSONSchema(tool.input, { target: "draft-7" }),
|
|
3437
|
-
...tool.output ? { outputSchema: z.toJSONSchema(tool.output, { target: "draft-7" }) } : {}
|
|
3438
|
-
};
|
|
3439
|
-
});
|
|
3440
|
-
return {
|
|
3441
|
-
id: plugin.id,
|
|
3442
|
-
version: plugin.version,
|
|
3443
|
-
declaredAccess,
|
|
3444
|
-
capabilities: enforcedAccess.capabilities,
|
|
3445
|
-
allowedHosts: plugin.allowedHosts,
|
|
3446
|
-
storage: plugin.storage,
|
|
3447
|
-
hooks,
|
|
3448
|
-
routes,
|
|
3449
|
-
...tools.length > 0 ? { mcp: { tools } } : {},
|
|
3450
|
-
admin: {
|
|
3451
|
-
settingsSchema: plugin.admin.settingsSchema,
|
|
3452
|
-
pages: plugin.admin.pages,
|
|
3453
|
-
widgets: plugin.admin.widgets,
|
|
3454
|
-
editorPanels: plugin.admin.editorPanels,
|
|
3455
|
-
editorActions: plugin.admin.editorActions
|
|
3456
|
-
}
|
|
3457
|
-
};
|
|
3458
|
-
}
|
|
3459
|
-
/**
|
|
3460
|
-
* Scan bundled code for Node.js built-in imports.
|
|
3461
|
-
* Matches require("node:xxx"), require("xxx"), import("node:xxx") — the patterns
|
|
3462
|
-
* that appear in bundled ESM/CJS output (not source-level named imports).
|
|
3463
|
-
* Returns deduplicated array of built-in module names found.
|
|
3464
|
-
*/
|
|
3465
|
-
function findNodeBuiltinImports(code) {
|
|
3466
|
-
const found = [];
|
|
3467
|
-
NODE_BUILTIN_IMPORT_RE.lastIndex = 0;
|
|
3468
|
-
let match;
|
|
3469
|
-
while ((match = NODE_BUILTIN_IMPORT_RE.exec(code)) !== null) {
|
|
3470
|
-
const mod = match[1];
|
|
3471
|
-
if (NODE_BUILTINS.has(mod)) found.push(mod);
|
|
3472
|
-
}
|
|
3473
|
-
return [...new Set(found)];
|
|
3474
|
-
}
|
|
3475
|
-
/**
|
|
3476
|
-
* Find a build output file by base name, checking common extensions.
|
|
3477
|
-
* tsdown may output .mjs, .js, or .cjs depending on format and config.
|
|
3478
|
-
*/
|
|
3479
|
-
async function findBuildOutput(dir, baseName) {
|
|
3480
|
-
for (const ext of [
|
|
3481
|
-
".mjs",
|
|
3482
|
-
".js",
|
|
3483
|
-
".cjs"
|
|
3484
|
-
]) {
|
|
3485
|
-
const candidate = join(dir, `${baseName}${ext}`);
|
|
3486
|
-
if (await fileExists$1(candidate)) return candidate;
|
|
3487
|
-
}
|
|
3488
|
-
}
|
|
3489
|
-
/**
|
|
3490
|
-
* Resolve a dist/built path back to its source .ts/.tsx equivalent.
|
|
3491
|
-
* E.g., "./dist/index.mjs" → "src/index.ts"
|
|
3492
|
-
*/
|
|
3493
|
-
async function resolveSourceEntry(pluginDir, distPath) {
|
|
3494
|
-
const cleaned = distPath.replace(LEADING_DOT_SLASH_RE, "");
|
|
3495
|
-
const srcPath = cleaned.replace(DIST_PREFIX_RE, "src/").replace(MJS_EXT_RE, ".ts");
|
|
3496
|
-
const srcFull = resolve(pluginDir, srcPath);
|
|
3497
|
-
if (await fileExists$1(srcFull)) return srcFull;
|
|
3498
|
-
const tsxFull = resolve(pluginDir, srcPath.replace(TS_TO_TSX_RE, ".tsx"));
|
|
3499
|
-
if (await fileExists$1(tsxFull)) return tsxFull;
|
|
3500
|
-
const direct = resolve(pluginDir, cleaned);
|
|
3501
|
-
if (await fileExists$1(direct)) return direct;
|
|
3502
|
-
}
|
|
3503
|
-
const TS_SOURCE_EXPORT_RE = /\.(?:ts|tsx|mts|cts|jsx)$/;
|
|
3504
|
-
/**
|
|
3505
|
-
* Find package.json exports that point to source files instead of built output.
|
|
3506
|
-
* Returns an array of `{ exportPath, resolvedPath }` for each offending export.
|
|
3507
|
-
*/
|
|
3508
|
-
function findSourceExports(exports) {
|
|
3509
|
-
const issues = [];
|
|
3510
|
-
for (const [exportPath, exportValue] of Object.entries(exports)) {
|
|
3511
|
-
const resolved = typeof exportValue === "string" ? exportValue : exportValue && typeof exportValue === "object" && "import" in exportValue ? exportValue.import : null;
|
|
3512
|
-
if (resolved && TS_SOURCE_EXPORT_RE.test(resolved)) issues.push({
|
|
3513
|
-
exportPath,
|
|
3514
|
-
resolvedPath: resolved
|
|
3515
|
-
});
|
|
3516
|
-
}
|
|
3517
|
-
return issues;
|
|
3518
|
-
}
|
|
3519
|
-
/**
|
|
3520
|
-
* Recursively walk a staging directory and return a flat list of all files
|
|
3521
|
-
* with sizes. Names are relative to `dir` so they match what would appear
|
|
3522
|
-
* as the tarball entry name.
|
|
3523
|
-
*/
|
|
3524
|
-
async function collectBundleEntries(dir) {
|
|
3525
|
-
const entries = [];
|
|
3526
|
-
await walkBundle(dir, "", entries);
|
|
3527
|
-
return entries;
|
|
3528
|
-
}
|
|
3529
|
-
async function walkBundle(dir, prefix, into) {
|
|
3530
|
-
const items = await readdir(dir, { withFileTypes: true });
|
|
3531
|
-
for (const item of items) {
|
|
3532
|
-
const fullPath = join(dir, item.name);
|
|
3533
|
-
const relPath = prefix ? `${prefix}/${item.name}` : item.name;
|
|
3534
|
-
if (item.isFile()) {
|
|
3535
|
-
const s = await stat(fullPath);
|
|
3536
|
-
into.push({
|
|
3537
|
-
name: relPath,
|
|
3538
|
-
bytes: s.size
|
|
3539
|
-
});
|
|
3540
|
-
} else if (item.isDirectory()) await walkBundle(fullPath, relPath, into);
|
|
3541
|
-
}
|
|
3542
|
-
}
|
|
3543
|
-
/**
|
|
3544
|
-
* Sum the byte sizes of all entries.
|
|
3545
|
-
*/
|
|
3546
|
-
function totalBundleBytes(entries) {
|
|
3547
|
-
let total = 0;
|
|
3548
|
-
for (const e of entries) total += e.bytes;
|
|
3549
|
-
return total;
|
|
3550
|
-
}
|
|
3551
|
-
/**
|
|
3552
|
-
* Check a bundle against the three size caps from RFC 0001:
|
|
3553
|
-
* - total decompressed ≤ MAX_BUNDLE_SIZE
|
|
3554
|
-
* - per-file decompressed ≤ MAX_FILE_SIZE
|
|
3555
|
-
* - file count ≤ MAX_FILE_COUNT
|
|
3556
|
-
*
|
|
3557
|
-
* Returns a list of violation messages (empty if the bundle is within all
|
|
3558
|
-
* caps). Messages are deterministic per input — the total/count violations
|
|
3559
|
-
* come first, then oversized files in alphabetical order — so the same
|
|
3560
|
-
* bundle always produces the same error text.
|
|
3561
|
-
*/
|
|
3562
|
-
function validateBundleSize(entries) {
|
|
3563
|
-
const violations = [];
|
|
3564
|
-
const total = totalBundleBytes(entries);
|
|
3565
|
-
if (total > MAX_BUNDLE_SIZE) violations.push(`Bundle size ${formatBytes$1(total)} exceeds maximum of ${formatBytes$1(MAX_BUNDLE_SIZE)}.`);
|
|
3566
|
-
if (entries.length > MAX_FILE_COUNT) violations.push(`Bundle contains ${entries.length} files, exceeds maximum of ${MAX_FILE_COUNT}.`);
|
|
3567
|
-
const oversized = entries.filter((e) => e.bytes > MAX_FILE_SIZE).toSorted((a, b) => a.name.localeCompare(b.name));
|
|
3568
|
-
for (const e of oversized) violations.push(`File ${e.name} is ${formatBytes$1(e.bytes)}, exceeds per-file maximum of ${formatBytes$1(MAX_FILE_SIZE)}.`);
|
|
3569
|
-
return violations;
|
|
3570
|
-
}
|
|
3571
|
-
/**
|
|
3572
|
-
* Render a byte count as a human-friendly string (e.g. "256.0 KB").
|
|
3573
|
-
*/
|
|
3574
|
-
function formatBytes$1(n) {
|
|
3575
|
-
if (n < 1024) return `${n} B`;
|
|
3576
|
-
if (n < 1024 * 1024) return `${(n / 1024).toFixed(1)} KB`;
|
|
3577
|
-
return `${(n / 1024 / 1024).toFixed(2)} MB`;
|
|
3578
|
-
}
|
|
3579
|
-
/**
|
|
3580
|
-
* Create a gzipped tarball from a directory.
|
|
3581
|
-
*/
|
|
3582
|
-
async function createTarball(sourceDir, outputPath) {
|
|
3583
|
-
const { createGzip } = await import("node:zlib");
|
|
3584
|
-
await pipeline(packTar(sourceDir), createGzip({ level: 9 }), createWriteStream(outputPath));
|
|
3585
|
-
}
|
|
3586
|
-
|
|
3587
|
-
//#endregion
|
|
3588
|
-
//#region src/cli/commands/bundle.ts
|
|
3589
|
-
/**
|
|
3590
|
-
* emdash plugin bundle
|
|
3591
|
-
*
|
|
3592
|
-
* Produces a publishable plugin tarball from a plugin source directory.
|
|
3593
|
-
*
|
|
3594
|
-
* Steps:
|
|
3595
|
-
* 1. Resolve plugin entrypoint (finds definePlugin() export)
|
|
3596
|
-
* 2. Bundle backend code with tsdown → backend.js (single ES module, tree-shaken)
|
|
3597
|
-
* 3. Bundle admin code if present → admin.js
|
|
3598
|
-
* 4. Extract manifest from definePlugin() → manifest.json
|
|
3599
|
-
* 5. Collect assets (README.md, icon.png, screenshots/)
|
|
3600
|
-
* 6. Validate bundle (manifest schema, size limits, no Node.js builtins)
|
|
3601
|
-
* 7. Create tarball ({id}-{version}.tar.gz)
|
|
3602
|
-
*/
|
|
3603
|
-
var bundle_exports = /* @__PURE__ */ __exportAll({ bundleCommand: () => bundleCommand });
|
|
3604
|
-
const TS_EXT_RE = /\.(tsx?|[mc]?js)$/;
|
|
3605
|
-
const SLASH_RE = /\//g;
|
|
3606
|
-
const LEADING_AT_RE = /^@/;
|
|
3607
|
-
const emdash_SCOPE_RE = /^@emdash-cms\//;
|
|
3608
|
-
const bundleCommand = defineCommand({
|
|
3609
|
-
meta: {
|
|
3610
|
-
name: "bundle",
|
|
3611
|
-
description: "Bundle a plugin for marketplace distribution"
|
|
3612
|
-
},
|
|
3613
|
-
args: {
|
|
3614
|
-
dir: {
|
|
3615
|
-
type: "string",
|
|
3616
|
-
description: "Plugin directory (default: current directory)",
|
|
3617
|
-
default: process.cwd()
|
|
3618
|
-
},
|
|
3619
|
-
outDir: {
|
|
3620
|
-
type: "string",
|
|
3621
|
-
alias: "o",
|
|
3622
|
-
description: "Output directory for the tarball (default: ./dist)",
|
|
3623
|
-
default: "dist"
|
|
3624
|
-
},
|
|
3625
|
-
validateOnly: {
|
|
3626
|
-
type: "boolean",
|
|
3627
|
-
description: "Run validation only, skip tarball creation",
|
|
3628
|
-
default: false
|
|
3629
|
-
}
|
|
3630
|
-
},
|
|
3631
|
-
async run({ args }) {
|
|
3632
|
-
const pluginDir = resolve(args.dir);
|
|
3633
|
-
const outDir = resolve(pluginDir, args.outDir);
|
|
3634
|
-
const validateOnly = args.validateOnly;
|
|
3635
|
-
consola.start(validateOnly ? "Validating plugin..." : "Bundling plugin...");
|
|
3636
|
-
const pkgPath = join(pluginDir, "package.json");
|
|
3637
|
-
if (!await fileExists$1(pkgPath)) {
|
|
3638
|
-
consola.error("No package.json found in", pluginDir);
|
|
3639
|
-
process.exit(1);
|
|
3640
|
-
}
|
|
3641
|
-
const pkg = JSON.parse(await readFile(pkgPath, "utf-8"));
|
|
3642
|
-
let backendEntry;
|
|
3643
|
-
let adminEntry;
|
|
3644
|
-
if (pkg.exports) {
|
|
3645
|
-
const sandboxExport = pkg.exports["./sandbox"];
|
|
3646
|
-
if (typeof sandboxExport === "string") backendEntry = await resolveSourceEntry(pluginDir, sandboxExport);
|
|
3647
|
-
else if (sandboxExport && typeof sandboxExport === "object" && "import" in sandboxExport) backendEntry = await resolveSourceEntry(pluginDir, sandboxExport.import);
|
|
3648
|
-
const adminExport = pkg.exports["./admin"];
|
|
3649
|
-
if (typeof adminExport === "string") adminEntry = await resolveSourceEntry(pluginDir, adminExport);
|
|
3650
|
-
else if (adminExport && typeof adminExport === "object" && "import" in adminExport) adminEntry = await resolveSourceEntry(pluginDir, adminExport.import);
|
|
3651
|
-
}
|
|
3652
|
-
if (!backendEntry) {
|
|
3653
|
-
const defaultSandbox = join(pluginDir, "src/sandbox-entry.ts");
|
|
3654
|
-
if (await fileExists$1(defaultSandbox)) backendEntry = defaultSandbox;
|
|
3655
|
-
}
|
|
3656
|
-
let mainEntry;
|
|
3657
|
-
if (pkg.exports?.["."] !== void 0) {
|
|
3658
|
-
const mainExport = pkg.exports["."];
|
|
3659
|
-
if (typeof mainExport === "string") mainEntry = await resolveSourceEntry(pluginDir, mainExport);
|
|
3660
|
-
else if (mainExport && typeof mainExport === "object" && "import" in mainExport) mainEntry = await resolveSourceEntry(pluginDir, mainExport.import);
|
|
3661
|
-
}
|
|
3662
|
-
if (!mainEntry && pkg.main) mainEntry = await resolveSourceEntry(pluginDir, pkg.main);
|
|
3663
|
-
if (!mainEntry) {
|
|
3664
|
-
const defaultMain = join(pluginDir, "src/index.ts");
|
|
3665
|
-
if (await fileExists$1(defaultMain)) mainEntry = defaultMain;
|
|
3666
|
-
}
|
|
3667
|
-
if (!mainEntry) {
|
|
3668
|
-
consola.error("Cannot find plugin entrypoint. Expected src/index.ts or main/exports in package.json");
|
|
3669
|
-
process.exit(1);
|
|
3670
|
-
}
|
|
3671
|
-
consola.info(`Main entry: ${mainEntry}`);
|
|
3672
|
-
if (backendEntry) consola.info(`Backend entry: ${backendEntry}`);
|
|
3673
|
-
if (adminEntry) consola.info(`Admin entry: ${adminEntry}`);
|
|
3674
|
-
consola.start("Extracting plugin manifest...");
|
|
3675
|
-
const { build } = await import("tsdown");
|
|
3676
|
-
const tmpDir = join(pluginDir, ".emdash-bundle-tmp");
|
|
3677
|
-
try {
|
|
3678
|
-
await rm(tmpDir, {
|
|
3679
|
-
recursive: true,
|
|
3680
|
-
force: true
|
|
3681
|
-
});
|
|
3682
|
-
await mkdir(tmpDir, { recursive: true });
|
|
3683
|
-
const mainOutDir = join(tmpDir, "main");
|
|
3684
|
-
await build({
|
|
3685
|
-
config: false,
|
|
3686
|
-
entry: [mainEntry],
|
|
3687
|
-
format: "esm",
|
|
3688
|
-
outDir: mainOutDir,
|
|
3689
|
-
dts: false,
|
|
3690
|
-
platform: "node",
|
|
3691
|
-
external: ["emdash", emdash_SCOPE_RE]
|
|
3692
|
-
});
|
|
3693
|
-
const pluginNodeModules = join(pluginDir, "node_modules");
|
|
3694
|
-
const tmpNodeModules = join(mainOutDir, "node_modules");
|
|
3695
|
-
if (await fileExists$1(pluginNodeModules)) await symlink(pluginNodeModules, tmpNodeModules, "junction");
|
|
3696
|
-
const mainOutputPath = await findBuildOutput(mainOutDir, basename(mainEntry).replace(TS_EXT_RE, ""));
|
|
3697
|
-
if (!mainOutputPath) {
|
|
3698
|
-
consola.error("Failed to build main entry — no output found in", mainOutDir);
|
|
3699
|
-
process.exit(1);
|
|
3700
|
-
}
|
|
3701
|
-
const pluginModule = await import(toFileImportSpecifier(mainOutputPath));
|
|
3702
|
-
let resolvedPlugin;
|
|
3703
|
-
if (typeof pluginModule.createPlugin === "function") resolvedPlugin = pluginModule.createPlugin();
|
|
3704
|
-
else if (typeof pluginModule.default === "function") resolvedPlugin = pluginModule.default();
|
|
3705
|
-
else if (typeof pluginModule.default === "object" && pluginModule.default !== null) {
|
|
3706
|
-
const defaultExport = pluginModule.default;
|
|
3707
|
-
if ("id" in defaultExport && "version" in defaultExport) resolvedPlugin = defaultExport;
|
|
3708
|
-
}
|
|
3709
|
-
if (!resolvedPlugin) for (const [key, value] of Object.entries(pluginModule)) {
|
|
3710
|
-
if (key === "default" || typeof value !== "function") continue;
|
|
3711
|
-
try {
|
|
3712
|
-
const result = value();
|
|
3713
|
-
if (result && typeof result === "object" && "id" in result && "version" in result) {
|
|
3714
|
-
resolvedPlugin = {
|
|
3715
|
-
id: result.id,
|
|
3716
|
-
version: result.version,
|
|
3717
|
-
capabilities: result.capabilities ?? [],
|
|
3718
|
-
allowedHosts: result.allowedHosts ?? [],
|
|
3719
|
-
storage: result.storage ?? {},
|
|
3720
|
-
hooks: {},
|
|
3721
|
-
routes: {},
|
|
3722
|
-
admin: {
|
|
3723
|
-
pages: result.adminPages,
|
|
3724
|
-
widgets: result.adminWidgets
|
|
3725
|
-
}
|
|
3726
|
-
};
|
|
3727
|
-
if (backendEntry) {
|
|
3728
|
-
const backendProbeDir = join(tmpDir, "backend-probe");
|
|
3729
|
-
const probeShimDir = join(tmpDir, "probe-shims");
|
|
3730
|
-
await mkdir(probeShimDir, { recursive: true });
|
|
3731
|
-
await writeFile(join(probeShimDir, "emdash.mjs"), "export const definePlugin = (d) => d;\n");
|
|
3732
|
-
await build({
|
|
3733
|
-
config: false,
|
|
3734
|
-
entry: [backendEntry],
|
|
3735
|
-
format: "esm",
|
|
3736
|
-
outDir: backendProbeDir,
|
|
3737
|
-
dts: false,
|
|
3738
|
-
platform: "neutral",
|
|
3739
|
-
external: [],
|
|
3740
|
-
alias: { emdash: join(probeShimDir, "emdash.mjs") },
|
|
3741
|
-
treeshake: true
|
|
3742
|
-
});
|
|
3743
|
-
const backendProbePath = await findBuildOutput(backendProbeDir, basename(backendEntry).replace(TS_EXT_RE, ""));
|
|
3744
|
-
if (backendProbePath) {
|
|
3745
|
-
const standardDef = (await import(toFileImportSpecifier(backendProbePath))).default ?? {};
|
|
3746
|
-
const hooks = standardDef.hooks;
|
|
3747
|
-
const routes = standardDef.routes;
|
|
3748
|
-
if (hooks) for (const hookName of Object.keys(hooks)) {
|
|
3749
|
-
const hookEntry = hooks[hookName];
|
|
3750
|
-
const isConfig = typeof hookEntry === "object" && hookEntry !== null && "handler" in hookEntry;
|
|
3751
|
-
const config = isConfig ? hookEntry : {};
|
|
3752
|
-
resolvedPlugin.hooks[hookName] = {
|
|
3753
|
-
handler: isConfig ? hookEntry.handler : hookEntry,
|
|
3754
|
-
priority: config.priority ?? 100,
|
|
3755
|
-
timeout: config.timeout ?? 5e3,
|
|
3756
|
-
dependencies: config.dependencies ?? [],
|
|
3757
|
-
errorPolicy: config.errorPolicy ?? "abort",
|
|
3758
|
-
exclusive: config.exclusive ?? false,
|
|
3759
|
-
pluginId: result.id
|
|
3760
|
-
};
|
|
3761
|
-
}
|
|
3762
|
-
if (routes) for (const [name, route] of Object.entries(routes)) {
|
|
3763
|
-
const routeObj = typeof route === "object" && route !== null ? route : {};
|
|
3764
|
-
resolvedPlugin.routes[name] = {
|
|
3765
|
-
handler: typeof route === "function" ? route : routeObj.handler,
|
|
3766
|
-
...extractRouteOptions(route)
|
|
3767
|
-
};
|
|
3768
|
-
}
|
|
3769
|
-
}
|
|
3770
|
-
}
|
|
3771
|
-
break;
|
|
3772
|
-
}
|
|
3773
|
-
} catch (error) {
|
|
3774
|
-
if (resolvedPlugin) throw error;
|
|
3775
|
-
}
|
|
3776
|
-
}
|
|
3777
|
-
if (!resolvedPlugin?.id || !resolvedPlugin?.version) {
|
|
3778
|
-
consola.error("Could not extract plugin definition. Expected one of:\n - createPlugin() export (native format)\n - Descriptor factory function returning { id, version, ... } (standard format)");
|
|
3779
|
-
process.exit(1);
|
|
3780
|
-
}
|
|
3781
|
-
const manifest = extractManifest(resolvedPlugin);
|
|
3782
|
-
if (resolvedPlugin.admin?.entry) {
|
|
3783
|
-
consola.error("Plugin declares adminEntry — React admin components require native/trusted mode. Use Block Kit for sandboxed admin pages, or remove adminEntry.");
|
|
3784
|
-
process.exit(1);
|
|
3785
|
-
}
|
|
3786
|
-
if (resolvedPlugin.admin?.portableTextBlocks && resolvedPlugin.admin.portableTextBlocks.length > 0) {
|
|
3787
|
-
consola.error("Plugin declares portableTextBlocks — these require native/trusted mode and cannot be bundled for the marketplace.");
|
|
3788
|
-
process.exit(1);
|
|
3789
|
-
}
|
|
3790
|
-
consola.success(`Plugin: ${manifest.id}@${manifest.version}`);
|
|
3791
|
-
consola.info(` Capabilities: ${manifest.capabilities.length > 0 ? manifest.capabilities.join(", ") : "(none)"}`);
|
|
3792
|
-
consola.info(` Hooks: ${manifest.hooks.length > 0 ? manifest.hooks.map((h) => typeof h === "string" ? h : h.name).join(", ") : "(none)"}`);
|
|
3793
|
-
consola.info(` Routes: ${manifest.routes.length > 0 ? manifest.routes.map((r) => typeof r === "string" ? r : r.name).join(", ") : "(none)"}`);
|
|
3794
|
-
const bundleDir = join(tmpDir, "bundle");
|
|
3795
|
-
await mkdir(bundleDir, { recursive: true });
|
|
3796
|
-
if (backendEntry) {
|
|
3797
|
-
consola.start("Bundling backend...");
|
|
3798
|
-
const shimDir = join(tmpDir, "shims");
|
|
3799
|
-
await mkdir(shimDir, { recursive: true });
|
|
3800
|
-
await writeFile(join(shimDir, "emdash.mjs"), "export const definePlugin = (d) => d;\n");
|
|
3801
|
-
await build({
|
|
3802
|
-
config: false,
|
|
3803
|
-
entry: [backendEntry],
|
|
3804
|
-
format: "esm",
|
|
3805
|
-
outDir: join(tmpDir, "backend"),
|
|
3806
|
-
dts: false,
|
|
3807
|
-
platform: "neutral",
|
|
3808
|
-
external: [],
|
|
3809
|
-
alias: { emdash: join(shimDir, "emdash.mjs") },
|
|
3810
|
-
minify: true,
|
|
3811
|
-
treeshake: true
|
|
3812
|
-
});
|
|
3813
|
-
const backendBaseName = basename(backendEntry).replace(TS_EXT_RE, "");
|
|
3814
|
-
const backendOutputPath = await findBuildOutput(join(tmpDir, "backend"), backendBaseName);
|
|
3815
|
-
if (backendOutputPath) {
|
|
3816
|
-
await copyFile(backendOutputPath, join(bundleDir, "backend.js"));
|
|
3817
|
-
consola.success("Built backend.js");
|
|
3818
|
-
} else {
|
|
3819
|
-
consola.error("Backend build produced no output");
|
|
3820
|
-
process.exit(1);
|
|
3821
|
-
}
|
|
3822
|
-
} else {
|
|
3823
|
-
consola.warn("No sandbox entry found — bundle will have no backend.js");
|
|
3824
|
-
consola.warn(" Add a \"sandbox-entry.ts\" in src/ or a \"./sandbox\" export in package.json");
|
|
3825
|
-
}
|
|
3826
|
-
if (adminEntry) {
|
|
3827
|
-
consola.start("Bundling admin...");
|
|
3828
|
-
await build({
|
|
3829
|
-
config: false,
|
|
3830
|
-
entry: [adminEntry],
|
|
3831
|
-
format: "esm",
|
|
3832
|
-
outDir: join(tmpDir, "admin"),
|
|
3833
|
-
dts: false,
|
|
3834
|
-
platform: "neutral",
|
|
3835
|
-
external: [],
|
|
3836
|
-
minify: true,
|
|
3837
|
-
treeshake: true
|
|
3838
|
-
});
|
|
3839
|
-
const adminBaseName = basename(adminEntry).replace(TS_EXT_RE, "");
|
|
3840
|
-
const adminOutputPath = await findBuildOutput(join(tmpDir, "admin"), adminBaseName);
|
|
3841
|
-
if (adminOutputPath) {
|
|
3842
|
-
await copyFile(adminOutputPath, join(bundleDir, "admin.js"));
|
|
3843
|
-
consola.success("Built admin.js");
|
|
3844
|
-
}
|
|
3845
|
-
}
|
|
3846
|
-
await writeFile(join(bundleDir, "manifest.json"), JSON.stringify(manifest, null, 2));
|
|
3847
|
-
consola.start("Collecting assets...");
|
|
3848
|
-
const readmePath = join(pluginDir, "README.md");
|
|
3849
|
-
if (await fileExists$1(readmePath)) {
|
|
3850
|
-
await copyFile(readmePath, join(bundleDir, "README.md"));
|
|
3851
|
-
consola.success("Included README.md");
|
|
3852
|
-
}
|
|
3853
|
-
const iconPath = join(pluginDir, "icon.png");
|
|
3854
|
-
if (await fileExists$1(iconPath)) {
|
|
3855
|
-
const dims = readImageDimensions(await readFile(iconPath));
|
|
3856
|
-
if (!dims) consola.warn("icon.png is not a valid PNG — skipping");
|
|
3857
|
-
else if (dims[0] !== ICON_SIZE || dims[1] !== ICON_SIZE) {
|
|
3858
|
-
consola.warn(`icon.png is ${dims[0]}x${dims[1]}, expected ${ICON_SIZE}x${ICON_SIZE} — including anyway`);
|
|
3859
|
-
await copyFile(iconPath, join(bundleDir, "icon.png"));
|
|
3860
|
-
} else {
|
|
3861
|
-
await copyFile(iconPath, join(bundleDir, "icon.png"));
|
|
3862
|
-
consola.success("Included icon.png");
|
|
3863
|
-
}
|
|
3864
|
-
}
|
|
3865
|
-
const screenshotsDir = join(pluginDir, "screenshots");
|
|
3866
|
-
if (await fileExists$1(screenshotsDir)) {
|
|
3867
|
-
const screenshotFiles = (await readdir(screenshotsDir)).filter((f) => {
|
|
3868
|
-
const ext = extname(f).toLowerCase();
|
|
3869
|
-
return ext === ".png" || ext === ".jpg" || ext === ".jpeg";
|
|
3870
|
-
}).toSorted().slice(0, MAX_SCREENSHOTS);
|
|
3871
|
-
if (screenshotFiles.length > 0) {
|
|
3872
|
-
await mkdir(join(bundleDir, "screenshots"), { recursive: true });
|
|
3873
|
-
for (const file of screenshotFiles) {
|
|
3874
|
-
const filePath = join(screenshotsDir, file);
|
|
3875
|
-
const dims = readImageDimensions(await readFile(filePath));
|
|
3876
|
-
if (!dims) {
|
|
3877
|
-
consola.warn(`screenshots/${file} — cannot read dimensions, skipping`);
|
|
3878
|
-
continue;
|
|
3879
|
-
}
|
|
3880
|
-
if (dims[0] > MAX_SCREENSHOT_WIDTH || dims[1] > MAX_SCREENSHOT_HEIGHT) consola.warn(`screenshots/${file} is ${dims[0]}x${dims[1]}, max ${MAX_SCREENSHOT_WIDTH}x${MAX_SCREENSHOT_HEIGHT} — including anyway`);
|
|
3881
|
-
await copyFile(filePath, join(bundleDir, "screenshots", file));
|
|
3882
|
-
}
|
|
3883
|
-
consola.success(`Included ${screenshotFiles.length} screenshot(s)`);
|
|
3884
|
-
}
|
|
3885
|
-
}
|
|
3886
|
-
consola.start("Validating bundle...");
|
|
3887
|
-
let hasErrors = false;
|
|
3888
|
-
if (pkg.exports) for (const issue of findSourceExports(pkg.exports)) {
|
|
3889
|
-
consola.error(`Export "${issue.exportPath}" points to source (${issue.resolvedPath}). Package exports must point to built files (e.g. dist/*.mjs). Add a build step and update the exports map.`);
|
|
3890
|
-
hasErrors = true;
|
|
3891
|
-
}
|
|
3892
|
-
const backendPath = join(bundleDir, "backend.js");
|
|
3893
|
-
if (await fileExists$1(backendPath)) {
|
|
3894
|
-
const builtins = findNodeBuiltinImports(await readFile(backendPath, "utf-8"));
|
|
3895
|
-
if (builtins.length > 0) {
|
|
3896
|
-
consola.error(`backend.js imports Node.js built-in modules: ${builtins.join(", ")}`);
|
|
3897
|
-
consola.error("Sandboxed plugins cannot use Node.js APIs");
|
|
3898
|
-
hasErrors = true;
|
|
3899
|
-
}
|
|
3900
|
-
}
|
|
3901
|
-
const declaresUnrestricted = manifest.capabilities.includes("network:request:unrestricted") || manifest.capabilities.includes("network:fetch:any");
|
|
3902
|
-
const declaresHostRestricted = manifest.capabilities.includes("network:request") || manifest.capabilities.includes("network:fetch");
|
|
3903
|
-
if (declaresUnrestricted) consola.warn("Plugin declares unrestricted network access (network:request:unrestricted) — it can make requests to any host");
|
|
3904
|
-
else if (declaresHostRestricted && manifest.allowedHosts.length === 0) consola.warn("Plugin declares network:request capability but no allowedHosts — all requests will be blocked");
|
|
3905
|
-
const deprecatedCaps = manifest.capabilities.filter(isDeprecatedCapability);
|
|
3906
|
-
if (deprecatedCaps.length > 0) {
|
|
3907
|
-
consola.warn("Plugin uses deprecated capability names. Rename them before publishing:");
|
|
3908
|
-
for (const cap of deprecatedCaps) {
|
|
3909
|
-
const replacement = CAPABILITY_RENAMES[cap];
|
|
3910
|
-
consola.warn(` ${cap} → ${replacement}`);
|
|
3911
|
-
}
|
|
3912
|
-
}
|
|
3913
|
-
if (resolvedPlugin.admin?.portableTextBlocks && resolvedPlugin.admin.portableTextBlocks.length > 0) consola.warn("Plugin declares portableTextBlocks — these require trusted mode and will be ignored in sandboxed plugins");
|
|
3914
|
-
if (resolvedPlugin.admin?.entry) consola.warn("Plugin declares admin.entry — custom React components require trusted mode. Use Block Kit for sandboxed admin pages");
|
|
3915
|
-
if (resolvedPlugin.hooks["page:fragments"]) consola.warn("Plugin declares page:fragments hook — this is trusted-only and will not work in sandboxed mode");
|
|
3916
|
-
const hasAdminPages = (manifest.admin?.pages?.length ?? 0) > 0;
|
|
3917
|
-
const hasAdminWidgets = (manifest.admin?.widgets?.length ?? 0) > 0;
|
|
3918
|
-
if (hasAdminPages || hasAdminWidgets) {
|
|
3919
|
-
if (!manifest.routes.map((r) => typeof r === "string" ? r : r.name).includes("admin")) {
|
|
3920
|
-
consola.error(`Plugin declares ${hasAdminPages ? "adminPages" : ""}${hasAdminPages && hasAdminWidgets ? " and " : ""}${hasAdminWidgets ? "adminWidgets" : ""} but the sandbox entry has no "admin" route. Add an admin route handler to serve Block Kit pages.`);
|
|
3921
|
-
hasErrors = true;
|
|
3922
|
-
}
|
|
3923
|
-
}
|
|
3924
|
-
const bundleEntries = await collectBundleEntries(bundleDir);
|
|
3925
|
-
const sizeViolations = validateBundleSize(bundleEntries);
|
|
3926
|
-
if (sizeViolations.length > 0) {
|
|
3927
|
-
for (const v of sizeViolations) consola.error(v);
|
|
3928
|
-
hasErrors = true;
|
|
3929
|
-
} else consola.info(`Bundle size: ${formatBytes$1(totalBundleBytes(bundleEntries))} across ${bundleEntries.length} file${bundleEntries.length === 1 ? "" : "s"}`);
|
|
3930
|
-
if (hasErrors) {
|
|
3931
|
-
consola.error("Bundle validation failed");
|
|
3932
|
-
process.exit(1);
|
|
3933
|
-
}
|
|
3934
|
-
consola.success("Validation passed");
|
|
3935
|
-
if (validateOnly) return;
|
|
3936
|
-
await mkdir(outDir, { recursive: true });
|
|
3937
|
-
const tarballName = `${manifest.id.replace(SLASH_RE, "-").replace(LEADING_AT_RE, "")}-${manifest.version}.tar.gz`;
|
|
3938
|
-
const tarballPath = join(outDir, tarballName);
|
|
3939
|
-
consola.start("Creating tarball...");
|
|
3940
|
-
await createTarball(bundleDir, tarballPath);
|
|
3941
|
-
const tarballSizeKB = ((await stat(tarballPath)).size / 1024).toFixed(1);
|
|
3942
|
-
const tarballBuf = await readFile(tarballPath);
|
|
3943
|
-
const checksum = createHash("sha256").update(tarballBuf).digest("hex");
|
|
3944
|
-
consola.success(`Created ${tarballName} (${tarballSizeKB}KB)`);
|
|
3945
|
-
consola.info(` SHA-256: ${checksum}`);
|
|
3946
|
-
consola.info(` Path: ${tarballPath}`);
|
|
3947
|
-
} finally {
|
|
3948
|
-
if (tmpDir.endsWith(".emdash-bundle-tmp")) await rm(tmpDir, {
|
|
3949
|
-
recursive: true,
|
|
3950
|
-
force: true
|
|
3951
|
-
});
|
|
3952
|
-
}
|
|
3953
|
-
}
|
|
3954
|
-
});
|
|
3955
|
-
|
|
3956
|
-
//#endregion
|
|
3957
|
-
//#region src/cli/commands/plugin-init.ts
|
|
3958
|
-
/**
|
|
3959
|
-
* emdash plugin init
|
|
3960
|
-
*
|
|
3961
|
-
* Scaffold a new EmDash plugin. Generates the sandboxed-format boilerplate:
|
|
3962
|
-
* src/index.ts -- descriptor factory
|
|
3963
|
-
* src/sandbox-entry.ts -- definePlugin({ hooks, routes })
|
|
3964
|
-
* package.json
|
|
3965
|
-
* tsconfig.json
|
|
3966
|
-
*
|
|
3967
|
-
* Use --format=native (or --native) to generate native-format boilerplate
|
|
3968
|
-
* instead (createPlugin + React admin). When neither is passed and stdout
|
|
3969
|
-
* is a TTY, the user is prompted to choose.
|
|
3970
|
-
*
|
|
3971
|
-
*/
|
|
3972
|
-
const SLUG_RE = /^[a-z][a-z0-9]*(-[a-z0-9]+)*$/;
|
|
3973
|
-
const SCOPE_RE = /^@[^/]+\//;
|
|
3974
|
-
const pluginInitCommand = defineCommand({
|
|
3975
|
-
meta: {
|
|
3976
|
-
name: "init",
|
|
3977
|
-
description: "Scaffold a new plugin"
|
|
3978
|
-
},
|
|
3979
|
-
args: {
|
|
3980
|
-
dir: {
|
|
3981
|
-
type: "string",
|
|
3982
|
-
description: "Directory to create the plugin in (default: current directory)",
|
|
3983
|
-
default: "."
|
|
3984
|
-
},
|
|
3985
|
-
name: {
|
|
3986
|
-
type: "string",
|
|
3987
|
-
description: "Plugin name/id (e.g. my-plugin or @org/my-plugin)"
|
|
3988
|
-
},
|
|
3989
|
-
format: {
|
|
3990
|
-
type: "string",
|
|
3991
|
-
description: "Plugin format: sandboxed or native. Prompts when running interactively if not set.",
|
|
3992
|
-
valueHint: "sandboxed|native"
|
|
3993
|
-
},
|
|
3994
|
-
native: {
|
|
3995
|
-
type: "boolean",
|
|
3996
|
-
description: "Shortcut for --format=native",
|
|
3997
|
-
default: false
|
|
3998
|
-
}
|
|
3999
|
-
},
|
|
4000
|
-
async run({ args }) {
|
|
4001
|
-
const targetDir = resolve(args.dir);
|
|
4002
|
-
const format = await resolveFormat(args.format, args.native);
|
|
4003
|
-
if (!format) {
|
|
4004
|
-
consola.info("Cancelled");
|
|
4005
|
-
return;
|
|
4006
|
-
}
|
|
4007
|
-
const isNative = format === "native";
|
|
4008
|
-
let pluginName = args.name || basename(targetDir);
|
|
4009
|
-
if (!pluginName || pluginName === ".") pluginName = basename(resolve("."));
|
|
4010
|
-
const slug = pluginName.replace(SCOPE_RE, "");
|
|
4011
|
-
if (!SLUG_RE.test(slug)) {
|
|
4012
|
-
consola.error(`Invalid plugin name "${pluginName}". Use lowercase letters, numbers, and hyphens (e.g. my-plugin).`);
|
|
4013
|
-
process.exit(1);
|
|
4014
|
-
}
|
|
4015
|
-
const srcDir = join(targetDir, "src");
|
|
4016
|
-
if (await fileExists$1(join(targetDir, "package.json"))) {
|
|
4017
|
-
consola.error(`package.json already exists in ${targetDir}`);
|
|
4018
|
-
process.exit(1);
|
|
4019
|
-
}
|
|
4020
|
-
consola.start(`Scaffolding ${isNative ? "native" : "sandboxed"} plugin: ${pluginName}`);
|
|
4021
|
-
await mkdir(srcDir, { recursive: true });
|
|
4022
|
-
if (isNative) await scaffoldNative(targetDir, srcDir, pluginName, slug);
|
|
4023
|
-
else await scaffoldStandard(targetDir, srcDir, pluginName, slug);
|
|
4024
|
-
consola.success(`Plugin scaffolded in ${targetDir}`);
|
|
4025
|
-
consola.info("Next steps:");
|
|
4026
|
-
const steps = [];
|
|
4027
|
-
if (args.dir !== ".") steps.push(`cd ${args.dir}`);
|
|
4028
|
-
steps.push("pnpm install");
|
|
4029
|
-
steps.push(isNative ? "Edit src/index.ts to add hooks and routes" : "Edit src/sandbox-entry.ts to add hooks and routes");
|
|
4030
|
-
steps.push("pnpm build");
|
|
4031
|
-
if (!isNative) steps.push("emdash plugin validate --dir .");
|
|
4032
|
-
steps.forEach((step, i) => consola.info(` ${i + 1}. ${step}`));
|
|
4033
|
-
}
|
|
4034
|
-
});
|
|
4035
|
-
async function resolveFormat(formatArg, nativeFlag) {
|
|
4036
|
-
if (formatArg) {
|
|
4037
|
-
const normalized = formatArg.toLowerCase();
|
|
4038
|
-
let parsed;
|
|
4039
|
-
if (normalized === "native") parsed = "native";
|
|
4040
|
-
else if (normalized === "sandboxed" || normalized === "standard") parsed = "standard";
|
|
4041
|
-
else {
|
|
4042
|
-
consola.error(`Invalid --format "${formatArg}". Use "sandboxed" or "native".`);
|
|
4043
|
-
process.exit(1);
|
|
4044
|
-
}
|
|
4045
|
-
if (nativeFlag && parsed !== "native") {
|
|
4046
|
-
consola.error(`Conflicting flags: --native and --format=${formatArg}. Pass only one.`);
|
|
4047
|
-
process.exit(1);
|
|
4048
|
-
}
|
|
4049
|
-
return parsed;
|
|
4050
|
-
}
|
|
4051
|
-
if (nativeFlag) return "native";
|
|
4052
|
-
if (!process.stdout.isTTY) return "standard";
|
|
4053
|
-
const choice = await consola.prompt("Which plugin format?", {
|
|
4054
|
-
type: "select",
|
|
4055
|
-
initial: "standard",
|
|
4056
|
-
options: [{
|
|
4057
|
-
label: "Sandboxed",
|
|
4058
|
-
value: "standard",
|
|
4059
|
-
hint: "runs in an isolated sandbox; safe to install from the marketplace"
|
|
4060
|
-
}, {
|
|
4061
|
-
label: "Native",
|
|
4062
|
-
value: "native",
|
|
4063
|
-
hint: "full runtime access; install from npm"
|
|
4064
|
-
}],
|
|
4065
|
-
cancel: "null"
|
|
4066
|
-
});
|
|
4067
|
-
if (choice === null) return null;
|
|
4068
|
-
return choice;
|
|
4069
|
-
}
|
|
4070
|
-
function camelCase(slug) {
|
|
4071
|
-
return slug.split("-").map((s, i) => i === 0 ? s : s[0].toUpperCase() + s.slice(1)).join("");
|
|
4072
|
-
}
|
|
4073
|
-
function pascalCase(slug) {
|
|
4074
|
-
return slug.split("-").map((s) => s[0].toUpperCase() + s.slice(1)).join("");
|
|
4075
|
-
}
|
|
4076
|
-
const TSCONFIG = {
|
|
4077
|
-
compilerOptions: {
|
|
4078
|
-
target: "ES2022",
|
|
4079
|
-
module: "preserve",
|
|
4080
|
-
moduleResolution: "bundler",
|
|
4081
|
-
strict: true,
|
|
4082
|
-
esModuleInterop: true,
|
|
4083
|
-
declaration: true,
|
|
4084
|
-
outDir: "./dist",
|
|
4085
|
-
rootDir: "./src"
|
|
4086
|
-
},
|
|
4087
|
-
include: ["src/**/*"],
|
|
4088
|
-
exclude: ["node_modules", "dist"]
|
|
4089
|
-
};
|
|
4090
|
-
const TSDOWN_VERSION = "^0.20.0";
|
|
4091
|
-
const TYPESCRIPT_VERSION = "^5.9.0";
|
|
4092
|
-
async function scaffoldStandard(targetDir, srcDir, pluginName, slug) {
|
|
4093
|
-
const fnName = camelCase(slug);
|
|
4094
|
-
await writeFile(join(targetDir, "package.json"), JSON.stringify({
|
|
4095
|
-
name: pluginName,
|
|
4096
|
-
version: "0.1.0",
|
|
4097
|
-
type: "module",
|
|
4098
|
-
main: "./dist/index.mjs",
|
|
4099
|
-
exports: {
|
|
4100
|
-
".": {
|
|
4101
|
-
types: "./dist/index.d.mts",
|
|
4102
|
-
import: "./dist/index.mjs"
|
|
4103
|
-
},
|
|
4104
|
-
"./sandbox": {
|
|
4105
|
-
types: "./dist/sandbox-entry.d.mts",
|
|
4106
|
-
import: "./dist/sandbox-entry.mjs"
|
|
4107
|
-
}
|
|
4108
|
-
},
|
|
4109
|
-
files: ["dist"],
|
|
4110
|
-
scripts: {
|
|
4111
|
-
build: "tsdown src/index.ts src/sandbox-entry.ts --format esm --dts --clean",
|
|
4112
|
-
dev: "tsdown src/index.ts src/sandbox-entry.ts --format esm --dts --watch",
|
|
4113
|
-
typecheck: "tsc --noEmit"
|
|
4114
|
-
},
|
|
4115
|
-
keywords: ["emdash", "emdash-plugin"],
|
|
4116
|
-
license: "MIT",
|
|
4117
|
-
peerDependencies: { emdash: "*" },
|
|
4118
|
-
devDependencies: {
|
|
4119
|
-
emdash: "*",
|
|
4120
|
-
tsdown: TSDOWN_VERSION,
|
|
4121
|
-
typescript: TYPESCRIPT_VERSION
|
|
4122
|
-
}
|
|
4123
|
-
}, null, " ") + "\n");
|
|
4124
|
-
await writeFile(join(targetDir, "tsconfig.json"), JSON.stringify(TSCONFIG, null, " ") + "\n");
|
|
4125
|
-
await writeFile(join(srcDir, "index.ts"), `import type { PluginDescriptor } from "emdash";
|
|
4126
|
-
|
|
4127
|
-
export function ${fnName}Plugin(): PluginDescriptor {
|
|
4128
|
-
\treturn {
|
|
4129
|
-
\t\tid: "${slug}",
|
|
4130
|
-
\t\tversion: "0.1.0",
|
|
4131
|
-
\t\tformat: "standard",
|
|
4132
|
-
\t\tentrypoint: "${pluginName}/sandbox",
|
|
4133
|
-
|
|
4134
|
-
\t\tcapabilities: ["content:read"],
|
|
4135
|
-
\t\tstorage: {
|
|
4136
|
-
\t\t\tevents: { indexes: ["timestamp"] },
|
|
4137
|
-
\t\t},
|
|
4138
|
-
\t};
|
|
4139
|
-
}
|
|
4140
|
-
`);
|
|
4141
|
-
await writeFile(join(srcDir, "sandbox-entry.ts"), `import { definePlugin } from "emdash";
|
|
4142
|
-
import type { PluginContext } from "emdash";
|
|
4143
|
-
|
|
4144
|
-
interface ContentSaveEvent {
|
|
4145
|
-
\tcollection: string;
|
|
4146
|
-
\tcontent: { id: string };
|
|
4147
|
-
\tisNew: boolean;
|
|
4148
|
-
}
|
|
4149
|
-
|
|
4150
|
-
export default definePlugin({
|
|
4151
|
-
\thooks: {
|
|
4152
|
-
\t\t"content:afterSave": {
|
|
4153
|
-
\t\t\thandler: async (event: ContentSaveEvent, ctx: PluginContext) => {
|
|
4154
|
-
\t\t\t\tctx.log.info("Content saved", {
|
|
4155
|
-
\t\t\t\t\tcollection: event.collection,
|
|
4156
|
-
\t\t\t\t\tid: event.content.id,
|
|
4157
|
-
\t\t\t\t});
|
|
4158
|
-
|
|
4159
|
-
\t\t\t\tawait ctx.storage.events.put(\`save-\${Date.now()}\`, {
|
|
4160
|
-
\t\t\t\t\ttimestamp: new Date().toISOString(),
|
|
4161
|
-
\t\t\t\t\tcollection: event.collection,
|
|
4162
|
-
\t\t\t\t\tcontentId: event.content.id,
|
|
4163
|
-
\t\t\t\t});
|
|
4164
|
-
\t\t\t},
|
|
4165
|
-
\t\t},
|
|
4166
|
-
\t},
|
|
4167
|
-
|
|
4168
|
-
\troutes: {
|
|
4169
|
-
\t\trecent: {
|
|
4170
|
-
\t\t\thandler: async (_routeCtx, ctx: PluginContext) => {
|
|
4171
|
-
\t\t\t\tconst result = await ctx.storage.events.query({
|
|
4172
|
-
\t\t\t\t\torderBy: { timestamp: "desc" },
|
|
4173
|
-
\t\t\t\t\tlimit: 10,
|
|
4174
|
-
\t\t\t\t});
|
|
4175
|
-
\t\t\t\treturn { events: result.items };
|
|
4176
|
-
\t\t\t},
|
|
4177
|
-
\t\t},
|
|
4178
|
-
\t},
|
|
4179
|
-
});
|
|
4180
|
-
`);
|
|
4181
|
-
}
|
|
4182
|
-
async function scaffoldNative(targetDir, srcDir, pluginName, slug) {
|
|
4183
|
-
const fnName = camelCase(slug);
|
|
4184
|
-
const typeName = pascalCase(slug);
|
|
4185
|
-
await writeFile(join(targetDir, "package.json"), JSON.stringify({
|
|
4186
|
-
name: pluginName,
|
|
4187
|
-
version: "0.1.0",
|
|
4188
|
-
type: "module",
|
|
4189
|
-
main: "./dist/index.mjs",
|
|
4190
|
-
exports: { ".": {
|
|
4191
|
-
types: "./dist/index.d.mts",
|
|
4192
|
-
import: "./dist/index.mjs"
|
|
4193
|
-
} },
|
|
4194
|
-
files: ["dist"],
|
|
4195
|
-
scripts: {
|
|
4196
|
-
build: "tsdown src/index.ts --format esm --dts --clean",
|
|
4197
|
-
dev: "tsdown src/index.ts --format esm --dts --watch",
|
|
4198
|
-
typecheck: "tsc --noEmit"
|
|
4199
|
-
},
|
|
4200
|
-
keywords: ["emdash", "emdash-plugin"],
|
|
4201
|
-
license: "MIT",
|
|
4202
|
-
peerDependencies: { emdash: "*" },
|
|
4203
|
-
devDependencies: {
|
|
4204
|
-
emdash: "*",
|
|
4205
|
-
tsdown: TSDOWN_VERSION,
|
|
4206
|
-
typescript: TYPESCRIPT_VERSION
|
|
4207
|
-
}
|
|
4208
|
-
}, null, " ") + "\n");
|
|
4209
|
-
await writeFile(join(targetDir, "tsconfig.json"), JSON.stringify(TSCONFIG, null, " ") + "\n");
|
|
4210
|
-
await writeFile(join(srcDir, "index.ts"), `import { definePlugin } from "emdash";
|
|
4211
|
-
import type { PluginDescriptor } from "emdash";
|
|
4212
|
-
|
|
4213
|
-
export interface ${typeName}Options {
|
|
4214
|
-
\tenabled?: boolean;
|
|
4215
|
-
}
|
|
4216
|
-
|
|
4217
|
-
export function ${fnName}Plugin(options: ${typeName}Options = {}): PluginDescriptor<${typeName}Options> {
|
|
4218
|
-
\treturn {
|
|
4219
|
-
\t\tid: "${slug}",
|
|
4220
|
-
\t\tversion: "0.1.0",
|
|
4221
|
-
\t\tformat: "native",
|
|
4222
|
-
\t\tentrypoint: "${pluginName}",
|
|
4223
|
-
\t\toptions,
|
|
4224
|
-
\t};
|
|
4225
|
-
}
|
|
4226
|
-
|
|
4227
|
-
export function createPlugin(options: ${typeName}Options = {}) {
|
|
4228
|
-
\treturn definePlugin({
|
|
4229
|
-
\t\tid: "${slug}",
|
|
4230
|
-
\t\tversion: "0.1.0",
|
|
4231
|
-
|
|
4232
|
-
\t\tcapabilities: ["content:read"],
|
|
4233
|
-
\t\tstorage: {
|
|
4234
|
-
\t\t\tevents: { indexes: ["createdAt"] },
|
|
4235
|
-
\t\t},
|
|
4236
|
-
|
|
4237
|
-
\t\thooks: {
|
|
4238
|
-
\t\t\t"content:afterSave": async (event, ctx) => {
|
|
4239
|
-
\t\t\t\tif (options.enabled === false) return;
|
|
4240
|
-
\t\t\t\tawait ctx.storage.events.put(\`evt_\${Date.now()}\`, {
|
|
4241
|
-
\t\t\t\t\tcollection: event.collection,
|
|
4242
|
-
\t\t\t\t\tcontentId: event.content.id,
|
|
4243
|
-
\t\t\t\t\tcreatedAt: new Date().toISOString(),
|
|
4244
|
-
\t\t\t\t});
|
|
4245
|
-
\t\t\t},
|
|
4246
|
-
\t\t},
|
|
4247
|
-
|
|
4248
|
-
\t\troutes: {
|
|
4249
|
-
\t\t\trecent: {
|
|
4250
|
-
\t\t\t\thandler: async (ctx) => {
|
|
4251
|
-
\t\t\t\t\tconst result = await ctx.storage.events.query({
|
|
4252
|
-
\t\t\t\t\t\torderBy: { createdAt: "desc" },
|
|
4253
|
-
\t\t\t\t\t\tlimit: 10,
|
|
4254
|
-
\t\t\t\t\t});
|
|
4255
|
-
\t\t\t\t\treturn { events: result.items };
|
|
4256
|
-
\t\t\t\t},
|
|
4257
|
-
\t\t\t},
|
|
4258
|
-
\t\t},
|
|
4259
|
-
\t});
|
|
4260
|
-
}
|
|
4261
|
-
|
|
4262
|
-
export default createPlugin;
|
|
4263
|
-
`);
|
|
4264
|
-
}
|
|
4265
|
-
|
|
4266
|
-
//#endregion
|
|
4267
|
-
//#region src/cli/commands/plugin-validate.ts
|
|
4268
|
-
/**
|
|
4269
|
-
* emdash plugin validate
|
|
4270
|
-
*
|
|
4271
|
-
* Runs bundle validation without producing a tarball.
|
|
4272
|
-
* Thin wrapper around `emdash plugin bundle --validate-only`.
|
|
4273
|
-
*
|
|
4274
|
-
*/
|
|
4275
|
-
const pluginValidateCommand = defineCommand({
|
|
4276
|
-
meta: {
|
|
4277
|
-
name: "validate",
|
|
4278
|
-
description: "Validate a plugin without producing a tarball (same checks as bundle)"
|
|
4279
|
-
},
|
|
4280
|
-
args: { dir: {
|
|
4281
|
-
type: "string",
|
|
4282
|
-
description: "Plugin directory (default: current directory)",
|
|
4283
|
-
default: "."
|
|
4284
|
-
} },
|
|
4285
|
-
async run({ args }) {
|
|
4286
|
-
await runCommand(bundleCommand, { rawArgs: [
|
|
4287
|
-
"--dir",
|
|
4288
|
-
args.dir,
|
|
4289
|
-
"--validateOnly"
|
|
4290
|
-
] });
|
|
4291
|
-
}
|
|
4292
|
-
});
|
|
4293
|
-
|
|
4294
|
-
//#endregion
|
|
4295
|
-
//#region src/cli/commands/publish.ts
|
|
4296
|
-
/**
|
|
4297
|
-
* emdash plugin publish
|
|
4298
|
-
*
|
|
4299
|
-
* Publishes a plugin tarball to the EmDash Marketplace.
|
|
4300
|
-
*
|
|
4301
|
-
* Flow:
|
|
4302
|
-
* 1. Resolve tarball (from --tarball path, or build via `emdash plugin bundle`)
|
|
4303
|
-
* 2. Read manifest.json from tarball to show summary
|
|
4304
|
-
* 3. Authenticate (stored credential or GitHub device flow)
|
|
4305
|
-
* 4. Pre-publish validation (check plugin exists, version not published)
|
|
4306
|
-
* 5. Upload via multipart POST
|
|
4307
|
-
* 6. Display audit results
|
|
4308
|
-
*/
|
|
4309
|
-
const DEFAULT_REGISTRY = "https://marketplace.emdashcms.com";
|
|
4310
|
-
/**
|
|
4311
|
-
* Authenticate with the marketplace via GitHub Device Flow.
|
|
4312
|
-
* Returns the marketplace JWT and author info.
|
|
4313
|
-
*/
|
|
4314
|
-
async function authenticateViaDeviceFlow(registryUrl) {
|
|
4315
|
-
consola.start("Fetching auth configuration...");
|
|
4316
|
-
const discoveryRes = await fetch(new URL("/api/v1/auth/discovery", registryUrl));
|
|
4317
|
-
if (!discoveryRes.ok) throw new Error(`Marketplace unreachable: ${discoveryRes.status} ${discoveryRes.statusText}`);
|
|
4318
|
-
const discovery = await discoveryRes.json();
|
|
4319
|
-
const deviceRes = await fetch(discovery.github.deviceAuthorizationEndpoint, {
|
|
4320
|
-
method: "POST",
|
|
4321
|
-
headers: {
|
|
4322
|
-
"Content-Type": "application/json",
|
|
4323
|
-
Accept: "application/json"
|
|
4324
|
-
},
|
|
4325
|
-
body: JSON.stringify({
|
|
4326
|
-
client_id: discovery.github.clientId,
|
|
4327
|
-
scope: "read:user user:email"
|
|
4328
|
-
})
|
|
4329
|
-
});
|
|
4330
|
-
if (!deviceRes.ok) throw new Error(`GitHub device flow failed: ${deviceRes.status}`);
|
|
4331
|
-
const deviceCode = await deviceRes.json();
|
|
4332
|
-
console.log();
|
|
4333
|
-
consola.info("Open your browser to:");
|
|
4334
|
-
console.log(` ${pc.cyan(pc.bold(deviceCode.verification_uri))}`);
|
|
4335
|
-
console.log();
|
|
4336
|
-
consola.info(`Enter code: ${pc.yellow(pc.bold(deviceCode.user_code))}`);
|
|
4337
|
-
console.log();
|
|
4338
|
-
try {
|
|
4339
|
-
const { execFile } = await import("node:child_process");
|
|
4340
|
-
if (process.platform === "darwin") execFile("open", [deviceCode.verification_uri]);
|
|
4341
|
-
else if (process.platform === "win32") execFile("cmd", [
|
|
4342
|
-
"/c",
|
|
4343
|
-
"start",
|
|
4344
|
-
"",
|
|
4345
|
-
deviceCode.verification_uri
|
|
4346
|
-
]);
|
|
4347
|
-
else execFile("xdg-open", [deviceCode.verification_uri]);
|
|
4348
|
-
} catch {}
|
|
4349
|
-
consola.start("Waiting for authorization...");
|
|
4350
|
-
const githubToken = await pollGitHubDeviceFlow(discovery.github.tokenEndpoint, discovery.github.clientId, deviceCode.device_code, deviceCode.interval, deviceCode.expires_in);
|
|
4351
|
-
consola.start("Authenticating with marketplace...");
|
|
4352
|
-
const deviceTokenUrl = new URL(discovery.marketplace.deviceTokenEndpoint, registryUrl);
|
|
4353
|
-
const authRes = await fetch(deviceTokenUrl, {
|
|
4354
|
-
method: "POST",
|
|
4355
|
-
headers: { "Content-Type": "application/json" },
|
|
4356
|
-
body: JSON.stringify({ access_token: githubToken })
|
|
4357
|
-
});
|
|
4358
|
-
if (!authRes.ok) {
|
|
4359
|
-
const body = await authRes.json().catch(() => ({}));
|
|
4360
|
-
throw new Error(`Marketplace auth failed: ${body.error ?? authRes.statusText}`);
|
|
4361
|
-
}
|
|
4362
|
-
return await authRes.json();
|
|
4363
|
-
}
|
|
4364
|
-
async function pollGitHubDeviceFlow(tokenEndpoint, clientId, deviceCode, interval, expiresIn) {
|
|
4365
|
-
const deadline = Date.now() + expiresIn * 1e3;
|
|
4366
|
-
let currentInterval = interval;
|
|
4367
|
-
while (Date.now() < deadline) {
|
|
4368
|
-
await new Promise((r) => setTimeout(r, currentInterval * 1e3));
|
|
4369
|
-
const body = await (await fetch(tokenEndpoint, {
|
|
4370
|
-
method: "POST",
|
|
4371
|
-
headers: {
|
|
4372
|
-
"Content-Type": "application/json",
|
|
4373
|
-
Accept: "application/json"
|
|
4374
|
-
},
|
|
4375
|
-
body: JSON.stringify({
|
|
4376
|
-
client_id: clientId,
|
|
4377
|
-
device_code: deviceCode,
|
|
4378
|
-
grant_type: "urn:ietf:params:oauth:grant-type:device_code"
|
|
4379
|
-
})
|
|
4380
|
-
})).json();
|
|
4381
|
-
if (body.access_token) return body.access_token;
|
|
4382
|
-
if (body.error === "authorization_pending") continue;
|
|
4383
|
-
if (body.error === "slow_down") {
|
|
4384
|
-
currentInterval = body.interval ?? currentInterval + 5;
|
|
4385
|
-
continue;
|
|
4386
|
-
}
|
|
4387
|
-
if (body.error === "expired_token") throw new Error("Device code expired. Please try again.");
|
|
4388
|
-
if (body.error === "access_denied") throw new Error("Authorization was denied.");
|
|
4389
|
-
throw new Error(`GitHub token exchange failed: ${body.error ?? "unknown error"}`);
|
|
4390
|
-
}
|
|
4391
|
-
throw new Error("Device code expired (timeout). Please try again.");
|
|
4392
|
-
}
|
|
4393
|
-
const manifestSummarySchema = pluginManifestBaseSchema.pick({
|
|
4394
|
-
id: true,
|
|
4395
|
-
version: true,
|
|
4396
|
-
capabilities: true,
|
|
4397
|
-
allowedHosts: true
|
|
4398
|
-
});
|
|
4399
|
-
/**
|
|
4400
|
-
* Read manifest.json from a tarball without fully extracting it.
|
|
4401
|
-
*/
|
|
4402
|
-
async function readManifestFromTarball(tarballPath) {
|
|
4403
|
-
const data = await readFile(tarballPath);
|
|
4404
|
-
const manifest = (await unpackTar(new ReadableStream({ start(controller) {
|
|
4405
|
-
controller.enqueue(new Uint8Array(data.buffer, data.byteOffset, data.byteLength));
|
|
4406
|
-
controller.close();
|
|
4407
|
-
} }).pipeThrough(createGzipDecoder()), { filter: (header) => header.name === "manifest.json" })).find((e) => e.header.name === "manifest.json");
|
|
4408
|
-
if (!manifest?.data) throw new Error("Tarball does not contain manifest.json");
|
|
4409
|
-
const content = new TextDecoder().decode(manifest.data);
|
|
4410
|
-
const parsed = JSON.parse(content);
|
|
4411
|
-
const result = manifestSummarySchema.safeParse(parsed);
|
|
4412
|
-
if (!result.success) throw new Error(`Invalid manifest.json: ${result.error.message}`);
|
|
4413
|
-
return result.data;
|
|
4414
|
-
}
|
|
4415
|
-
const POLL_INTERVAL_MS = 3e3;
|
|
4416
|
-
const POLL_TIMEOUT_MS = 12e4;
|
|
4417
|
-
/**
|
|
4418
|
-
* Poll the version endpoint until status leaves "pending" or timeout.
|
|
4419
|
-
* Returns the final version data, or null on timeout.
|
|
4420
|
-
*/
|
|
4421
|
-
async function pollVersionStatus(versionUrl, token) {
|
|
4422
|
-
const deadline = Date.now() + POLL_TIMEOUT_MS;
|
|
4423
|
-
while (Date.now() < deadline) {
|
|
4424
|
-
await new Promise((r) => setTimeout(r, POLL_INTERVAL_MS));
|
|
4425
|
-
try {
|
|
4426
|
-
const res = await fetch(versionUrl, { headers: { Authorization: `Bearer ${token}` } });
|
|
4427
|
-
if (!res.ok) continue;
|
|
4428
|
-
const data = await res.json();
|
|
4429
|
-
if (data.status !== "pending") return data;
|
|
4430
|
-
} catch {}
|
|
4431
|
-
}
|
|
4432
|
-
return null;
|
|
4433
|
-
}
|
|
4434
|
-
function displayAuditResults(version) {
|
|
4435
|
-
const statusColor = version.status === "published" ? pc.green : version.status === "flagged" ? pc.yellow : pc.red;
|
|
4436
|
-
consola.info(` Status: ${statusColor(version.status)}`);
|
|
4437
|
-
if (version.audit_verdict) {
|
|
4438
|
-
const verdictColor = version.audit_verdict === "pass" ? pc.green : version.audit_verdict === "warn" ? pc.yellow : pc.red;
|
|
4439
|
-
consola.info(` Audit: ${verdictColor(version.audit_verdict)}`);
|
|
4440
|
-
}
|
|
4441
|
-
if (version.image_audit_verdict) {
|
|
4442
|
-
const verdictColor = version.image_audit_verdict === "pass" ? pc.green : version.image_audit_verdict === "warn" ? pc.yellow : pc.red;
|
|
4443
|
-
consola.info(` Image audit: ${verdictColor(version.image_audit_verdict)}`);
|
|
4444
|
-
}
|
|
4445
|
-
}
|
|
4446
|
-
function displayInlineAuditResults(audit, imageAudit) {
|
|
4447
|
-
const verdictColor = audit.verdict === "pass" ? pc.green : audit.verdict === "warn" ? pc.yellow : pc.red;
|
|
4448
|
-
consola.info(` Audit: ${verdictColor(audit.verdict)} (risk: ${audit.riskScore}/100)`);
|
|
4449
|
-
if (audit.findings.length > 0) for (const finding of audit.findings) {
|
|
4450
|
-
const icon = finding.severity === "high" ? pc.red("!") : pc.yellow("~");
|
|
4451
|
-
consola.info(` ${icon} [${finding.category}] ${finding.description}`);
|
|
4452
|
-
}
|
|
4453
|
-
if (imageAudit) {
|
|
4454
|
-
const imgColor = imageAudit.verdict === "pass" ? pc.green : imageAudit.verdict === "warn" ? pc.yellow : pc.red;
|
|
4455
|
-
consola.info(` Image audit: ${imgColor(imageAudit.verdict)}`);
|
|
4456
|
-
}
|
|
4457
|
-
}
|
|
4458
|
-
const publishCommand = defineCommand({
|
|
4459
|
-
meta: {
|
|
4460
|
-
name: "publish",
|
|
4461
|
-
description: "Publish a plugin to the EmDash Marketplace"
|
|
4462
|
-
},
|
|
4463
|
-
args: {
|
|
4464
|
-
tarball: {
|
|
4465
|
-
type: "string",
|
|
4466
|
-
description: "Path to plugin tarball (default: build first via `emdash plugin bundle`)"
|
|
4467
|
-
},
|
|
4468
|
-
dir: {
|
|
4469
|
-
type: "string",
|
|
4470
|
-
description: "Plugin directory (used with --build, default: current directory)",
|
|
4471
|
-
default: process.cwd()
|
|
4472
|
-
},
|
|
4473
|
-
build: {
|
|
4474
|
-
type: "boolean",
|
|
4475
|
-
description: "Build the plugin before publishing",
|
|
4476
|
-
default: false
|
|
4477
|
-
},
|
|
4478
|
-
registry: {
|
|
4479
|
-
type: "string",
|
|
4480
|
-
description: "Marketplace registry URL",
|
|
4481
|
-
default: DEFAULT_REGISTRY
|
|
4482
|
-
},
|
|
4483
|
-
"no-wait": {
|
|
4484
|
-
type: "boolean",
|
|
4485
|
-
description: "Exit immediately after upload without waiting for audit (useful for CI)",
|
|
4486
|
-
default: false
|
|
4487
|
-
}
|
|
4488
|
-
},
|
|
4489
|
-
async run({ args }) {
|
|
4490
|
-
const registryUrl = args.registry;
|
|
4491
|
-
let tarballPath;
|
|
4492
|
-
if (args.tarball) tarballPath = resolve(args.tarball);
|
|
4493
|
-
else if (args.build) {
|
|
4494
|
-
consola.start("Building plugin...");
|
|
4495
|
-
const pluginDir = resolve(args.dir);
|
|
4496
|
-
try {
|
|
4497
|
-
const { runCommand } = await import("citty");
|
|
4498
|
-
const { bundleCommand } = await Promise.resolve().then(() => bundle_exports);
|
|
4499
|
-
await runCommand(bundleCommand, { rawArgs: ["--dir", pluginDir] });
|
|
4500
|
-
} catch {
|
|
4501
|
-
consola.error("Build failed");
|
|
4502
|
-
process.exit(1);
|
|
4503
|
-
}
|
|
4504
|
-
const { readdir } = await import("node:fs/promises");
|
|
4505
|
-
const distDir = resolve(pluginDir, "dist");
|
|
4506
|
-
const tarball = (await readdir(distDir)).find((f) => f.endsWith(".tar.gz"));
|
|
4507
|
-
if (!tarball) {
|
|
4508
|
-
consola.error("Build succeeded but no .tar.gz found in dist/");
|
|
4509
|
-
process.exit(1);
|
|
4510
|
-
}
|
|
4511
|
-
tarballPath = resolve(distDir, tarball);
|
|
4512
|
-
} else {
|
|
4513
|
-
const pluginDir = resolve(args.dir);
|
|
4514
|
-
const { readdir } = await import("node:fs/promises");
|
|
4515
|
-
try {
|
|
4516
|
-
const distDir = resolve(pluginDir, "dist");
|
|
4517
|
-
const tarball = (await readdir(distDir)).find((f) => f.endsWith(".tar.gz"));
|
|
4518
|
-
if (tarball) tarballPath = resolve(distDir, tarball);
|
|
4519
|
-
else {
|
|
4520
|
-
consola.error("No tarball found. Run `emdash plugin bundle` first or use --build.");
|
|
4521
|
-
process.exit(1);
|
|
4522
|
-
}
|
|
4523
|
-
} catch {
|
|
4524
|
-
consola.error("No dist/ directory found. Run `emdash plugin bundle` first or use --build.");
|
|
4525
|
-
process.exit(1);
|
|
4526
|
-
}
|
|
4527
|
-
}
|
|
4528
|
-
const sizeKB = ((await stat(tarballPath)).size / 1024).toFixed(1);
|
|
4529
|
-
consola.info(`Tarball: ${pc.dim(tarballPath)} (${sizeKB}KB)`);
|
|
4530
|
-
const manifest = await readManifestFromTarball(tarballPath);
|
|
4531
|
-
console.log();
|
|
4532
|
-
consola.info(`Plugin: ${pc.bold(`${manifest.id}@${manifest.version}`)}`);
|
|
4533
|
-
if (manifest.capabilities.length > 0) consola.info(`Capabilities: ${manifest.capabilities.join(", ")}`);
|
|
4534
|
-
if (manifest.allowedHosts?.length) consola.info(`Allowed hosts: ${manifest.allowedHosts.join(", ")}`);
|
|
4535
|
-
console.log();
|
|
4536
|
-
const deprecatedCaps = manifest.capabilities.filter(isDeprecatedCapability);
|
|
4537
|
-
if (deprecatedCaps.length > 0) {
|
|
4538
|
-
consola.error("Plugin declares deprecated capability names. Rename them and re-bundle before publishing:");
|
|
4539
|
-
for (const cap of deprecatedCaps) {
|
|
4540
|
-
const replacement = CAPABILITY_RENAMES[cap];
|
|
4541
|
-
consola.error(` ${cap} → ${replacement}`);
|
|
4542
|
-
}
|
|
4543
|
-
consola.error("See https://emdashcms.com/docs/plugins/overview#capabilities for the full rename table.");
|
|
4544
|
-
process.exit(1);
|
|
4545
|
-
}
|
|
4546
|
-
let token;
|
|
4547
|
-
const envToken = process.env.EMDASH_MARKETPLACE_TOKEN;
|
|
4548
|
-
const stored = !envToken ? getMarketplaceCredential(registryUrl) : null;
|
|
4549
|
-
if (envToken) {
|
|
4550
|
-
token = envToken;
|
|
4551
|
-
consola.info("Using EMDASH_MARKETPLACE_TOKEN for authentication");
|
|
4552
|
-
} else if (stored) {
|
|
4553
|
-
token = stored.token;
|
|
4554
|
-
consola.info(`Authenticated as ${pc.bold(stored.author?.name ?? "unknown")}`);
|
|
4555
|
-
} else {
|
|
4556
|
-
consola.info("Not logged in to marketplace. Starting GitHub authentication...");
|
|
4557
|
-
const result = await authenticateViaDeviceFlow(registryUrl);
|
|
4558
|
-
token = result.token;
|
|
4559
|
-
saveMarketplaceCredential(registryUrl, {
|
|
4560
|
-
token: result.token,
|
|
4561
|
-
expiresAt: new Date(Date.now() + 30 * 86400 * 1e3).toISOString(),
|
|
4562
|
-
author: {
|
|
4563
|
-
id: result.author.id,
|
|
4564
|
-
name: result.author.name
|
|
4565
|
-
}
|
|
4566
|
-
});
|
|
4567
|
-
consola.success(`Authenticated as ${pc.bold(result.author.name)}`);
|
|
4568
|
-
}
|
|
4569
|
-
consola.start("Checking marketplace...");
|
|
4570
|
-
const pluginRes = await fetch(new URL(`/api/v1/plugins/${manifest.id}`, registryUrl));
|
|
4571
|
-
if (pluginRes.status === 404 && !envToken) {
|
|
4572
|
-
consola.info(`Plugin ${pc.bold(manifest.id)} not found in marketplace. Registering...`);
|
|
4573
|
-
const createRes = await fetch(new URL("/api/v1/plugins", registryUrl), {
|
|
4574
|
-
method: "POST",
|
|
4575
|
-
headers: {
|
|
4576
|
-
"Content-Type": "application/json",
|
|
4577
|
-
Authorization: `Bearer ${token}`
|
|
4578
|
-
},
|
|
4579
|
-
body: JSON.stringify({
|
|
4580
|
-
id: manifest.id,
|
|
4581
|
-
name: manifest.id,
|
|
4582
|
-
capabilities: manifest.capabilities
|
|
4583
|
-
})
|
|
4584
|
-
});
|
|
4585
|
-
if (!createRes.ok) {
|
|
4586
|
-
const body = await createRes.json().catch(() => ({}));
|
|
4587
|
-
if (createRes.status === 401) {
|
|
4588
|
-
removeMarketplaceCredential(registryUrl);
|
|
4589
|
-
consola.error("Authentication expired. Please run `emdash plugin publish` again to re-authenticate.");
|
|
4590
|
-
process.exit(1);
|
|
4591
|
-
}
|
|
4592
|
-
consola.error(`Failed to register plugin: ${body.error ?? createRes.statusText}`);
|
|
4593
|
-
process.exit(1);
|
|
4594
|
-
}
|
|
4595
|
-
consola.success(`Registered ${pc.bold(manifest.id)}`);
|
|
4596
|
-
} else if (pluginRes.status === 404 && envToken) consola.info(`Plugin ${pc.bold(manifest.id)} will be auto-registered on publish`);
|
|
4597
|
-
else if (!pluginRes.ok) {
|
|
4598
|
-
consola.error(`Marketplace error: ${pluginRes.status}`);
|
|
4599
|
-
process.exit(1);
|
|
4600
|
-
}
|
|
4601
|
-
consola.start(`Publishing ${manifest.id}@${manifest.version}...`);
|
|
4602
|
-
const tarballData = await readFile(tarballPath);
|
|
4603
|
-
const formData = new FormData();
|
|
4604
|
-
formData.append("bundle", new Blob([tarballData], { type: "application/gzip" }), basename(tarballPath));
|
|
4605
|
-
const uploadUrl = new URL(`/api/v1/plugins/${manifest.id}/versions`, registryUrl);
|
|
4606
|
-
const uploadRes = await fetch(uploadUrl, {
|
|
4607
|
-
method: "POST",
|
|
4608
|
-
headers: { Authorization: `Bearer ${token}` },
|
|
4609
|
-
body: formData
|
|
4610
|
-
});
|
|
4611
|
-
if (!uploadRes.ok && uploadRes.status !== 202) {
|
|
4612
|
-
const body = await uploadRes.json().catch(() => ({}));
|
|
4613
|
-
if (uploadRes.status === 401) {
|
|
4614
|
-
if (envToken) consola.error("EMDASH_MARKETPLACE_TOKEN was rejected by the marketplace.");
|
|
4615
|
-
else {
|
|
4616
|
-
removeMarketplaceCredential(registryUrl);
|
|
4617
|
-
consola.error("Authentication expired. Please run `emdash plugin publish` again.");
|
|
4618
|
-
}
|
|
4619
|
-
process.exit(1);
|
|
4620
|
-
}
|
|
4621
|
-
if (uploadRes.status === 409) {
|
|
4622
|
-
if (body.latestVersion) consola.error(`Version ${manifest.version} must be greater than ${body.latestVersion}`);
|
|
4623
|
-
else consola.error(body.error ?? "Version conflict");
|
|
4624
|
-
process.exit(1);
|
|
4625
|
-
}
|
|
4626
|
-
if (uploadRes.status === 422 && body.audit) {
|
|
4627
|
-
consola.error("Plugin failed security audit:");
|
|
4628
|
-
consola.error(` Verdict: ${pc.red(body.audit.verdict)}`);
|
|
4629
|
-
consola.error(` Summary: ${body.audit.summary}`);
|
|
4630
|
-
process.exit(1);
|
|
4631
|
-
}
|
|
4632
|
-
consola.error(`Publish failed: ${body.error ?? uploadRes.statusText}`);
|
|
4633
|
-
process.exit(1);
|
|
4634
|
-
}
|
|
4635
|
-
const result = await uploadRes.json();
|
|
4636
|
-
console.log();
|
|
4637
|
-
consola.success(`Uploaded ${pc.bold(`${manifest.id}@${result.version}`)}`);
|
|
4638
|
-
consola.info(` Checksum: ${pc.dim(result.checksum)}`);
|
|
4639
|
-
consola.info(` Size: ${(result.bundleSize / 1024).toFixed(1)}KB`);
|
|
4640
|
-
if (uploadRes.status === 202) {
|
|
4641
|
-
consola.info(` Status: ${pc.yellow("pending")} (audit running in background)`);
|
|
4642
|
-
if (args["no-wait"]) {
|
|
4643
|
-
consola.info("Skipping audit wait (--no-wait). Check status later.");
|
|
4644
|
-
console.log();
|
|
4645
|
-
return;
|
|
4646
|
-
}
|
|
4647
|
-
consola.start("Waiting for security audit to complete...");
|
|
4648
|
-
const versionUrl = new URL(`/api/v1/plugins/${manifest.id}/versions/${manifest.version}`, registryUrl);
|
|
4649
|
-
const finalStatus = await pollVersionStatus(versionUrl.toString(), token);
|
|
4650
|
-
if (finalStatus) displayAuditResults(finalStatus);
|
|
4651
|
-
else {
|
|
4652
|
-
consola.warn("Audit did not complete within timeout. Check status later with:");
|
|
4653
|
-
consola.info(` ${pc.dim(`curl ${versionUrl.toString()}`)}`);
|
|
4654
|
-
}
|
|
4655
|
-
} else {
|
|
4656
|
-
if (result.audit) displayInlineAuditResults(result.audit, result.imageAudit ?? null);
|
|
4657
|
-
consola.info(` Status: ${pc.green(result.status ?? "published")}`);
|
|
4658
|
-
}
|
|
4659
|
-
console.log();
|
|
4660
|
-
}
|
|
4661
|
-
});
|
|
4662
|
-
const marketplaceLoginCommand = defineCommand({
|
|
4663
|
-
meta: {
|
|
4664
|
-
name: "login",
|
|
4665
|
-
description: "Log in to the EmDash Marketplace via GitHub"
|
|
4666
|
-
},
|
|
4667
|
-
args: { registry: {
|
|
4668
|
-
type: "string",
|
|
4669
|
-
description: "Marketplace registry URL",
|
|
4670
|
-
default: DEFAULT_REGISTRY
|
|
4671
|
-
} },
|
|
4672
|
-
async run({ args }) {
|
|
4673
|
-
const registryUrl = args.registry;
|
|
4674
|
-
const existing = getMarketplaceCredential(registryUrl);
|
|
4675
|
-
if (existing) {
|
|
4676
|
-
consola.info(`Already logged in as ${pc.bold(existing.author?.name ?? "unknown")}`);
|
|
4677
|
-
consola.info("Use `emdash plugin logout` to log out first.");
|
|
4678
|
-
return;
|
|
4679
|
-
}
|
|
4680
|
-
const result = await authenticateViaDeviceFlow(registryUrl);
|
|
4681
|
-
saveMarketplaceCredential(registryUrl, {
|
|
4682
|
-
token: result.token,
|
|
4683
|
-
expiresAt: new Date(Date.now() + 30 * 86400 * 1e3).toISOString(),
|
|
4684
|
-
author: {
|
|
4685
|
-
id: result.author.id,
|
|
4686
|
-
name: result.author.name
|
|
4687
|
-
}
|
|
4688
|
-
});
|
|
4689
|
-
consola.success(`Logged in as ${pc.bold(result.author.name)}`);
|
|
4690
|
-
}
|
|
4691
|
-
});
|
|
4692
|
-
const marketplaceLogoutCommand = defineCommand({
|
|
4693
|
-
meta: {
|
|
4694
|
-
name: "logout",
|
|
4695
|
-
description: "Log out of the EmDash Marketplace"
|
|
4696
|
-
},
|
|
4697
|
-
args: { registry: {
|
|
4698
|
-
type: "string",
|
|
4699
|
-
description: "Marketplace registry URL",
|
|
4700
|
-
default: DEFAULT_REGISTRY
|
|
4701
|
-
} },
|
|
4702
|
-
async run({ args }) {
|
|
4703
|
-
if (removeMarketplaceCredential(args.registry)) consola.success("Logged out of marketplace.");
|
|
4704
|
-
else consola.info("No marketplace credentials found.");
|
|
4705
|
-
}
|
|
4706
|
-
});
|
|
4707
|
-
|
|
4708
|
-
//#endregion
|
|
4709
|
-
//#region src/cli/commands/plugin.ts
|
|
4710
|
-
/**
|
|
4711
|
-
* emdash plugin
|
|
4712
|
-
*
|
|
4713
|
-
* Plugin management commands grouped under a single namespace.
|
|
4714
|
-
*
|
|
4715
|
-
* Subcommands:
|
|
4716
|
-
* - init: Scaffold a new plugin
|
|
4717
|
-
* - bundle: Bundle a plugin for marketplace distribution
|
|
4718
|
-
* - validate: Run bundle validation without producing a tarball
|
|
4719
|
-
* - publish: Publish a plugin to the marketplace
|
|
4720
|
-
* - login: Log in to the marketplace via GitHub
|
|
4721
|
-
* - logout: Log out of the marketplace
|
|
4722
|
-
*
|
|
4723
|
-
*/
|
|
4724
|
-
const pluginCommand = defineCommand({
|
|
4725
|
-
meta: {
|
|
4726
|
-
name: "plugin",
|
|
4727
|
-
description: "Manage plugins"
|
|
4728
|
-
},
|
|
4729
|
-
subCommands: {
|
|
4730
|
-
init: pluginInitCommand,
|
|
4731
|
-
bundle: bundleCommand,
|
|
4732
|
-
validate: pluginValidateCommand,
|
|
4733
|
-
publish: publishCommand,
|
|
4734
|
-
login: marketplaceLoginCommand,
|
|
4735
|
-
logout: marketplaceLogoutCommand
|
|
4736
|
-
}
|
|
4737
|
-
});
|
|
4738
|
-
|
|
4739
3499
|
//#endregion
|
|
4740
3500
|
//#region src/cli/commands/schema.ts
|
|
4741
3501
|
/**
|
|
@@ -5287,6 +4047,7 @@ const seedCommand = defineCommand({
|
|
|
5287
4047
|
};
|
|
5288
4048
|
consola.start("Applying seed...");
|
|
5289
4049
|
try {
|
|
4050
|
+
await claimExplicitSeedOwnership(db, seed);
|
|
5290
4051
|
const result = await applySeed(db, seed, options);
|
|
5291
4052
|
consola.success("Seed applied successfully!");
|
|
5292
4053
|
consola.log("");
|
|
@@ -6884,7 +5645,6 @@ runMain(defineCommand({
|
|
|
6884
5645
|
search: searchCommand,
|
|
6885
5646
|
taxonomy: taxonomyCommand,
|
|
6886
5647
|
menu: menuCommand,
|
|
6887
|
-
plugin: pluginCommand,
|
|
6888
5648
|
site: siteCommand
|
|
6889
5649
|
}
|
|
6890
5650
|
}));
|