create-ailk 0.37.1 → 0.39.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/README.md +129 -0
- package/component-catalog.json +44 -6
- package/component-catalog.md +6 -5
- package/dist/add-module.js +16 -1
- package/dist/add-route.d.ts +2 -2
- package/dist/add-route.js +19 -12
- package/dist/cli.js +52 -0
- package/dist/declined-routes.d.ts +13 -0
- package/dist/declined-routes.js +74 -0
- package/dist/derive-architecture.d.ts +0 -6
- package/dist/derive-architecture.js +12 -16
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -0
- package/dist/language-import.d.ts +93 -0
- package/dist/language-import.js +270 -43
- package/dist/lib/import-mdx.js +1 -1
- package/dist/lib/scaffold-render-sweep.d.ts +6 -3
- package/dist/lib/scaffold-render-sweep.js +8 -4
- package/dist/migrate-content.d.ts +6 -2
- package/dist/migrate-content.js +62 -5
- package/dist/module-architecture.js +139 -103
- package/dist/paid-sections.d.ts +13 -0
- package/dist/paid-sections.js +35 -5
- package/dist/programmatic.js +6 -16
- package/dist/remove-module.js +73 -2
- package/dist/routes.d.ts +130 -0
- package/dist/routes.js +954 -0
- package/dist/site-manifest.js +6 -4
- package/dist/site-roster.d.ts +11 -2
- package/dist/site-roster.js +63 -21
- package/dist/spoke-checkout.d.ts +28 -27
- package/dist/spoke-checkout.js +71 -102
- package/dist/surfaces.d.ts +26 -0
- package/dist/surfaces.js +105 -293
- package/dist/sync-routes.d.ts +14 -1
- package/dist/sync-routes.js +108 -10
- package/dist/template-record.js +3 -1
- package/dist/topology.d.ts +26 -1
- package/dist/topology.js +273 -7
- package/dist/update.d.ts +17 -2
- package/dist/update.js +480 -77
- package/package.json +3 -3
- package/templates/README.md +1 -1
- package/templates/apps/mcp/CLAUDE.md +5 -3
- package/templates/apps/web/CLAUDE.md +87 -23
- package/templates/apps/web/__tests__/__mocks__/next-intl-server.ts +5 -1
- package/templates/apps/web/__tests__/__mocks__/next-intl.ts +5 -1
- package/templates/apps/web/__tests__/auth/seam.test.ts +34 -0
- package/templates/apps/web/account.config.tsx +100 -0
- package/templates/apps/web/app/[locale]/(authed)/account/connect/__tests__/page.test.tsx +1 -1
- package/templates/apps/web/app/[locale]/(authed)/account/connect/page.tsx +2 -2
- package/templates/apps/web/app/[locale]/(authed)/signed-out-gate.generated.tsx +1 -1
- package/templates/apps/web/app/[locale]/layout.tsx +46 -29
- package/templates/apps/web/app/apple-icon.tsx +72 -0
- package/templates/apps/web/app/llms.txt/__tests__/site-listing.test.ts +22 -12
- package/templates/apps/web/app/og/__tests__/__snapshots__/card.test.tsx.snap +3 -0
- package/templates/apps/web/app/og/__tests__/card.test.tsx +129 -0
- package/templates/apps/web/app/og/__tests__/route.test.ts +3 -4
- package/templates/apps/web/app/og/route.tsx +155 -72
- package/templates/apps/web/app/sitemap.xml/__tests__/site-listing.test.ts +12 -0
- package/templates/apps/web/auth.config.tsx +107 -0
- package/templates/apps/web/auth.ts +2 -1
- package/templates/apps/web/i18n/request.ts +51 -1
- package/templates/apps/web/jest.config.cjs +17 -1
- package/templates/apps/web/lib/__tests__/auth-phone.test.ts +11 -0
- package/templates/apps/web/lib/__tests__/fixtures/site-topology.ts +73 -0
- package/templates/apps/web/lib/__tests__/nav-label-keys.test.ts +14 -0
- package/templates/apps/web/lib/__tests__/profile-back-link.test.ts +148 -61
- package/templates/apps/web/lib/__tests__/served-pages.test.ts +77 -0
- package/templates/apps/web/lib/__tests__/server-api.test.ts +37 -5
- package/templates/apps/web/lib/__tests__/structured-data.test.tsx +26 -13
- package/templates/apps/web/lib/listings.tsx +2 -2
- package/templates/apps/web/lib/nav-label-keys.ts +16 -2
- package/templates/apps/web/lib/paid-section-contracts.ts +35 -6
- package/templates/apps/web/lib/paid-sections.generated.ts +8 -0
- package/templates/apps/web/lib/profile-back-link.ts +105 -32
- package/templates/apps/web/lib/served-pages.ts +95 -0
- package/templates/apps/web/lib/server-api.ts +1 -1
- package/templates/apps/web/lib/site-brand.tsx +3 -5
- package/templates/apps/web/lib/topology.generated.ts +5 -0
- package/templates/apps/web/messages/en.json +8 -836
- package/templates/apps/web/middleware.ts +15 -26
- package/templates/apps/web/next.config.mjs +35 -0
- package/templates/apps/web/package.json +2 -0
- package/templates/apps/web/types/messages.d.ts +6 -1
- package/templates/customizations.yaml +9 -0
- package/templates/package.json +3 -1
- package/templates/tools/lint-architecture.ts +164 -11
- package/versions.json +49 -47
- package/templates/apps/web/app/[locale]/(auth)/__tests__/auth-pages.test.tsx +0 -322
- package/templates/apps/web/app/[locale]/(auth)/__tests__/password-reset.test.tsx +0 -554
- package/templates/apps/web/app/[locale]/(auth)/consent/__tests__/consent-actions.test.ts +0 -56
- package/templates/apps/web/app/[locale]/(auth)/consent/__tests__/page.test.tsx +0 -164
- package/templates/apps/web/app/[locale]/(auth)/consent/consent-form.tsx +0 -132
- package/templates/apps/web/app/[locale]/(auth)/consent/consent.actions.ts +0 -51
- package/templates/apps/web/app/[locale]/(auth)/consent/page.tsx +0 -144
- package/templates/apps/web/app/[locale]/(auth)/forgot-password/forgot-password-card.tsx +0 -101
- package/templates/apps/web/app/[locale]/(auth)/forgot-password/page.tsx +0 -111
- package/templates/apps/web/app/[locale]/(auth)/layout.tsx +0 -81
- package/templates/apps/web/app/[locale]/(auth)/legal-footnote.tsx +0 -35
- package/templates/apps/web/app/[locale]/(auth)/reset-password/__tests__/return.test.tsx +0 -179
- package/templates/apps/web/app/[locale]/(auth)/reset-password/page.tsx +0 -157
- package/templates/apps/web/app/[locale]/(auth)/reset-password/reset-password-card.tsx +0 -126
- package/templates/apps/web/app/[locale]/(auth)/sign-in/__tests__/next-path.test.ts +0 -54
- package/templates/apps/web/app/[locale]/(auth)/sign-in/__tests__/page.test.tsx +0 -628
- package/templates/apps/web/app/[locale]/(auth)/sign-in/__tests__/remembered-method.test.ts +0 -43
- package/templates/apps/web/app/[locale]/(auth)/sign-in/__tests__/sign-in-card.test.tsx +0 -266
- package/templates/apps/web/app/[locale]/(auth)/sign-in/next-path.ts +0 -20
- package/templates/apps/web/app/[locale]/(auth)/sign-in/page.tsx +0 -234
- package/templates/apps/web/app/[locale]/(auth)/sign-in/remembered-method.ts +0 -37
- package/templates/apps/web/app/[locale]/(auth)/sign-in/sign-in-card.tsx +0 -323
- package/templates/apps/web/app/[locale]/(auth)/sign-in/sign-in-text.ts +0 -93
- package/templates/apps/web/app/[locale]/(auth)/sign-up/__tests__/page.test.tsx +0 -301
- package/templates/apps/web/app/[locale]/(auth)/sign-up/__tests__/sign-up-card.test.tsx +0 -309
- package/templates/apps/web/app/[locale]/(auth)/sign-up/page.tsx +0 -201
- package/templates/apps/web/app/[locale]/(auth)/sign-up/sign-up-card.tsx +0 -366
- package/templates/apps/web/app/[locale]/(auth)/use-auth-card-flow.ts +0 -116
- package/templates/apps/web/app/[locale]/(auth)/verify-email/__tests__/actions.test.ts +0 -94
- package/templates/apps/web/app/[locale]/(auth)/verify-email/actions.ts +0 -77
- package/templates/apps/web/app/[locale]/(auth)/verify-email/page.tsx +0 -154
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/account-frame-sign-out.test.tsx +0 -175
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/agreements-prompt.test.tsx +0 -301
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/billing.test.tsx +0 -515
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/general.test.tsx +0 -883
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/hub-mode.test.tsx +0 -758
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/item.test.tsx +0 -264
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/layout-sign-out.test.tsx +0 -167
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/layout.test.tsx +0 -730
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/new-menu.test.tsx +0 -355
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/new-popups.test.tsx +0 -97
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/notifications.test.tsx +0 -375
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/onboarding.test.tsx +0 -323
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/page.test.tsx +0 -1208
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/popups.test.tsx +0 -418
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/privacy.test.tsx +0 -462
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/rich-translator.ts +0 -63
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/security.test.tsx +0 -406
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/settings.test.tsx +0 -93
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/support.test.tsx +0 -208
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/thread.test.tsx +0 -340
- package/templates/apps/web/app/[locale]/(authed)/account/account-data.ts +0 -182
- package/templates/apps/web/app/[locale]/(authed)/account/account-frame.tsx +0 -353
- package/templates/apps/web/app/[locale]/(authed)/account/actions.ts +0 -57
- package/templates/apps/web/app/[locale]/(authed)/account/agreements-actions.ts +0 -58
- package/templates/apps/web/app/[locale]/(authed)/account/agreements-gate.ts +0 -61
- package/templates/apps/web/app/[locale]/(authed)/account/agreements-prompt.tsx +0 -184
- package/templates/apps/web/app/[locale]/(authed)/account/appointments/[slug]/page.tsx +0 -161
- package/templates/apps/web/app/[locale]/(authed)/account/appointments/__tests__/page.test.tsx +0 -426
- package/templates/apps/web/app/[locale]/(authed)/account/appointments/appointments-data.ts +0 -76
- package/templates/apps/web/app/[locale]/(authed)/account/appointments/page.tsx +0 -139
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/page.tsx +0 -406
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/pay-form.tsx +0 -65
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/review-form.tsx +0 -172
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/versions/[version]/file/route.ts +0 -190
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/file-route.test.ts +0 -333
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/page.test.tsx +0 -936
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/pay.test.tsx +0 -193
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/review.test.tsx +0 -476
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/artifact-actions.ts +0 -184
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/artifact-data.ts +0 -197
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/page.tsx +0 -182
- package/templates/apps/web/app/[locale]/(authed)/account/billing/__tests__/offerings.test.ts +0 -99
- package/templates/apps/web/app/[locale]/(authed)/account/billing/offerings.ts +0 -123
- package/templates/apps/web/app/[locale]/(authed)/account/billing/page.tsx +0 -424
- package/templates/apps/web/app/[locale]/(authed)/account/billing-source.ts +0 -303
- package/templates/apps/web/app/[locale]/(authed)/account/components/request-quote.tsx +0 -274
- package/templates/apps/web/app/[locale]/(authed)/account/error-row.tsx +0 -35
- package/templates/apps/web/app/[locale]/(authed)/account/for-you-labels.ts +0 -36
- package/templates/apps/web/app/[locale]/(authed)/account/general/__tests__/phone-verification.test.tsx +0 -215
- package/templates/apps/web/app/[locale]/(authed)/account/general/__tests__/seam-imports.test.ts +0 -65
- package/templates/apps/web/app/[locale]/(authed)/account/general/account-name.ts +0 -36
- package/templates/apps/web/app/[locale]/(authed)/account/general/billing-anchor.tsx +0 -27
- package/templates/apps/web/app/[locale]/(authed)/account/general/contact-actions.ts +0 -149
- package/templates/apps/web/app/[locale]/(authed)/account/general/contact-details.tsx +0 -42
- package/templates/apps/web/app/[locale]/(authed)/account/general/deletion-request.tsx +0 -132
- package/templates/apps/web/app/[locale]/(authed)/account/general/page.tsx +0 -218
- package/templates/apps/web/app/[locale]/(authed)/account/general/phone-actions.ts +0 -122
- package/templates/apps/web/app/[locale]/(authed)/account/general/phone-verification.tsx +0 -215
- package/templates/apps/web/app/[locale]/(authed)/account/general/photo-actions.ts +0 -73
- package/templates/apps/web/app/[locale]/(authed)/account/general/profile-form.tsx +0 -107
- package/templates/apps/web/app/[locale]/(authed)/account/general/profile-source.ts +0 -87
- package/templates/apps/web/app/[locale]/(authed)/account/inbox/[kind]/[id]/page.tsx +0 -119
- package/templates/apps/web/app/[locale]/(authed)/account/inbox/message/[id]/file/__tests__/route.test.ts +0 -215
- package/templates/apps/web/app/[locale]/(authed)/account/inbox/message/[id]/file/route.ts +0 -80
- package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/member-thread-composer.tsx +0 -43
- package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/page.tsx +0 -125
- package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/thread-data.ts +0 -88
- package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/thread-write.ts +0 -31
- package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/__tests__/invitation-id.test.ts +0 -35
- package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/__tests__/page.test.tsx +0 -266
- package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/actions.ts +0 -116
- package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/invitation-id.ts +0 -12
- package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/page.tsx +0 -154
- package/templates/apps/web/app/[locale]/(authed)/account/layout.tsx +0 -152
- package/templates/apps/web/app/[locale]/(authed)/account/new-actions.ts +0 -219
- package/templates/apps/web/app/[locale]/(authed)/account/new-menu.tsx +0 -365
- package/templates/apps/web/app/[locale]/(authed)/account/new-popups.tsx +0 -86
- package/templates/apps/web/app/[locale]/(authed)/account/notifications/page.tsx +0 -143
- package/templates/apps/web/app/[locale]/(authed)/account/onboarding/actions.ts +0 -120
- package/templates/apps/web/app/[locale]/(authed)/account/onboarding/onboarding-form.tsx +0 -322
- package/templates/apps/web/app/[locale]/(authed)/account/onboarding/page.tsx +0 -126
- package/templates/apps/web/app/[locale]/(authed)/account/page.tsx +0 -306
- package/templates/apps/web/app/[locale]/(authed)/account/privacy/__tests__/export-route.test.ts +0 -173
- package/templates/apps/web/app/[locale]/(authed)/account/privacy/actions.ts +0 -103
- package/templates/apps/web/app/[locale]/(authed)/account/privacy/export/route.ts +0 -102
- package/templates/apps/web/app/[locale]/(authed)/account/privacy/page.tsx +0 -240
- package/templates/apps/web/app/[locale]/(authed)/account/profile-actions.ts +0 -116
- package/templates/apps/web/app/[locale]/(authed)/account/retry-button.tsx +0 -27
- package/templates/apps/web/app/[locale]/(authed)/account/security/__tests__/hub-variant.test.tsx +0 -258
- package/templates/apps/web/app/[locale]/(authed)/account/security/page.tsx +0 -131
- package/templates/apps/web/app/[locale]/(authed)/account/security/security-panel.tsx +0 -130
- package/templates/apps/web/app/[locale]/(authed)/account/security/security-source.ts +0 -92
- package/templates/apps/web/app/[locale]/(authed)/account/settings/page.tsx +0 -24
- package/templates/apps/web/app/[locale]/(authed)/account/settings-frame.tsx +0 -121
- package/templates/apps/web/app/[locale]/(authed)/account/sign-in-method.ts +0 -37
- package/templates/apps/web/app/[locale]/(authed)/account/support/page.tsx +0 -60
- package/templates/apps/web/app/[locale]/(authed)/account/support/support-form.tsx +0 -98
- package/templates/apps/web/app/[locale]/(authed)/account/support-actions.ts +0 -100
- package/templates/apps/web/app/[locale]/checkout/__tests__/pages.test.tsx +0 -139
- package/templates/apps/web/app/[locale]/checkout/__tests__/thank-you-account.test.tsx +0 -146
- package/templates/apps/web/app/[locale]/checkout/thank-you/page.tsx +0 -114
- package/templates/apps/web/app/[locale]/checkout/unavailable/page.tsx +0 -51
- package/templates/apps/web/app/[locale]/flows/[slug]/FlowStepperClient.tsx +0 -614
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.count.test.tsx +0 -43
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.deliverable.test.tsx +0 -214
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.ending.test.tsx +0 -197
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.invite.test.tsx +0 -286
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.permalink.test.tsx +0 -520
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.test.tsx +0 -376
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.thanks-by-tier.test.tsx +0 -306
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/account-invite.actions.test.ts +0 -69
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/flow.actions.test.ts +0 -398
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/magnet-page.test.tsx +0 -704
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/save.actions.test.ts +0 -173
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/two-route-tool.test.tsx +0 -141
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/verify.test.tsx +0 -249
- package/templates/apps/web/app/[locale]/flows/[slug]/account-invite.actions.ts +0 -35
- package/templates/apps/web/app/[locale]/flows/[slug]/email-moment.ts +0 -92
- package/templates/apps/web/app/[locale]/flows/[slug]/flow.actions.ts +0 -177
- package/templates/apps/web/app/[locale]/flows/[slug]/magnet-page.tsx +0 -472
- package/templates/apps/web/app/[locale]/flows/[slug]/page.tsx +0 -48
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/LevelChart.tsx +0 -100
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/ResultsCard.tsx +0 -99
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/ResultsClient.tsx +0 -820
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/ResultsEmailStep.tsx +0 -203
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/ResultsClient.no-commerce.test.tsx +0 -194
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/ResultsClient.report.test.tsx +0 -284
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/by-result.test.tsx +0 -302
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/cards.test.tsx +0 -402
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/landing.test.tsx +0 -293
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/page.test.tsx +0 -485
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/score.test.tsx +0 -231
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/checkout-seam.ts +0 -74
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/meeting-seam.ts +0 -36
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/page.tsx +0 -420
- package/templates/apps/web/app/[locale]/flows/[slug]/save.actions.ts +0 -85
- package/templates/apps/web/app/[locale]/flows/[slug]/served-flow.ts +0 -91
- package/templates/apps/web/app/[locale]/flows/[slug]/start/page.tsx +0 -32
- package/templates/apps/web/app/[locale]/flows/[slug]/verify/page.tsx +0 -153
- package/templates/apps/web/app/[locale]/flows/[slug]/verify.actions.ts +0 -151
- package/templates/apps/web/app/[locale]/meet/confirmed/BookingHandOff.tsx +0 -128
- package/templates/apps/web/app/[locale]/meet/confirmed/__tests__/BookingHandOff.test.tsx +0 -126
- package/templates/apps/web/app/[locale]/purchase/__tests__/cancel.test.tsx +0 -162
- package/templates/apps/web/app/[locale]/purchase/__tests__/module-scope.test.ts +0 -68
- package/templates/apps/web/app/[locale]/purchase/__tests__/success.test.tsx +0 -411
- package/templates/apps/web/app/[locale]/purchase/cancel/page.tsx +0 -115
- package/templates/apps/web/app/[locale]/purchase/success/page.tsx +0 -348
- package/templates/apps/web/app/api/auth/[...all]/route.ts +0 -16
- package/templates/apps/web/app/api/auth/hub/__tests__/continuation.test.ts +0 -143
- package/templates/apps/web/app/api/auth/hub/__tests__/entry-routes.test.ts +0 -749
- package/templates/apps/web/app/api/auth/hub/authorize/__tests__/route.test.ts +0 -964
- package/templates/apps/web/app/api/auth/hub/authorize/route.ts +0 -390
- package/templates/apps/web/app/api/auth/hub/continuation.ts +0 -127
- package/templates/apps/web/app/api/auth/hub/continue/[ref]/__tests__/route.test.ts +0 -188
- package/templates/apps/web/app/api/auth/hub/continue/[ref]/route.ts +0 -53
- package/templates/apps/web/app/api/auth/hub/email/route.ts +0 -111
- package/templates/apps/web/app/api/auth/hub/entry-shared.ts +0 -163
- package/templates/apps/web/app/api/auth/hub/password/__tests__/return.test.ts +0 -86
- package/templates/apps/web/app/api/auth/hub/password/__tests__/route.test.ts +0 -368
- package/templates/apps/web/app/api/auth/hub/password/return.ts +0 -86
- package/templates/apps/web/app/api/auth/hub/password/route.ts +0 -171
- package/templates/apps/web/app/api/auth/hub/purchase/route.ts +0 -230
- package/templates/apps/web/app/api/auth/hub/purchase-link/route.ts +0 -174
- package/templates/apps/web/app/api/auth/hub/sign-up/route.ts +0 -60
- package/templates/apps/web/app/api/auth/hub/sign-up-evidence.ts +0 -97
- package/templates/apps/web/app/api/auth/mcp/__tests__/continuation.test.ts +0 -92
- package/templates/apps/web/app/api/auth/mcp/continuation.ts +0 -89
- package/templates/apps/web/app/api/auth/mcp/continue/[ref]/__tests__/route.test.ts +0 -59
- package/templates/apps/web/app/api/auth/mcp/continue/[ref]/route.ts +0 -41
- package/templates/apps/web/app/api/hub-session/__tests__/routes.test.ts +0 -1166
- package/templates/apps/web/app/api/hub-session/callback/route.ts +0 -134
- package/templates/apps/web/app/api/hub-session/email/route.ts +0 -125
- package/templates/apps/web/app/api/hub-session/one-tap/nonce/route.ts +0 -49
- package/templates/apps/web/app/api/hub-session/one-tap/route.ts +0 -106
- package/templates/apps/web/app/api/hub-session/open/route.ts +0 -111
- package/templates/apps/web/app/api/hub-session/password/return/route.ts +0 -69
- package/templates/apps/web/app/api/hub-session/password/route.ts +0 -106
- package/templates/apps/web/app/api/hub-session/sign-in/route.ts +0 -91
- package/templates/apps/web/app/api/hub-session/sign-out/route.ts +0 -54
- package/templates/apps/web/components/sign-out-trigger.tsx +0 -62
- package/templates/apps/web/lib/__tests__/account-config.test.ts +0 -704
- package/templates/apps/web/lib/__tests__/auth-routes.test.ts +0 -140
- package/templates/apps/web/lib/account-config.ts +0 -678
- package/templates/apps/web/lib/auth-routes.ts +0 -125
- package/templates/apps/web/lib/checkout-config.ts +0 -16
- package/templates/apps/web/lib/hub-session/__tests__/hub-session.test.ts +0 -433
- package/templates/apps/web/lib/hub-session/__tests__/spoke-sign-in.test.tsx +0 -332
- package/templates/apps/web/lib/hub-session/config.ts +0 -110
- package/templates/apps/web/lib/hub-session/entry.ts +0 -238
- package/templates/apps/web/lib/hub-session/index.ts +0 -21
- package/templates/apps/web/lib/hub-session/one-tap.tsx +0 -148
- package/templates/apps/web/lib/hub-session/reseal.ts +0 -90
- package/templates/apps/web/lib/hub-session/seal.ts +0 -86
- package/templates/apps/web/lib/hub-session/session.ts +0 -298
- package/templates/apps/web/lib/hub-session/spoke-sign-in.tsx +0 -277
- package/templates/apps/web/lib/next-path.ts +0 -35
- package/templates/apps/web/src/lib/__tests__/commerce-sections.test.ts +0 -57
- package/templates/apps/web/src/lib/commerce-sections.ts +0 -55
package/dist/site-manifest.js
CHANGED
|
@@ -89,11 +89,13 @@ export function planSiteManifest(opts) {
|
|
|
89
89
|
// #10774 D4.2 — the template's own code-route rows a spoke does not serve
|
|
90
90
|
// (`/sign-in`, `/sign-up`) leave with the files the spoke filter dropped.
|
|
91
91
|
const planned = plan.next ?? roster.text;
|
|
92
|
-
const appended = withoutUnservedRouteRows(parseRosterFile(planned, roster.path), opts.targetDir).next ?? planned;
|
|
92
|
+
const appended = withoutUnservedRouteRows(parseRosterFile(planned, roster.path), opts.targetDir, opts.topology, opts.signIn).next ?? planned;
|
|
93
93
|
const declared = new Set(JSON.parse(appended).rows.map((row) => row["route"]));
|
|
94
94
|
const extra = [
|
|
95
95
|
...sampleRows(opts, declared),
|
|
96
|
-
...codeRouteRows(opts.targetDir, declared
|
|
96
|
+
...codeRouteRows(opts.targetDir, declared, opts.topology === "spoke"
|
|
97
|
+
? { mcp: true, signIn: opts.signIn ?? "off" }
|
|
98
|
+
: null),
|
|
97
99
|
];
|
|
98
100
|
const withRows = appendRows(appended, extra, roster);
|
|
99
101
|
return insertRecord(withRows, opts, roster.path);
|
|
@@ -225,8 +227,8 @@ function sampleRows(opts, declared) {
|
|
|
225
227
|
return out;
|
|
226
228
|
}
|
|
227
229
|
/** A code-route row for every page route on disk that `declared` does not name. */
|
|
228
|
-
function codeRouteRows(targetDir, declared) {
|
|
229
|
-
return servedRoutes(targetDir)
|
|
230
|
+
function codeRouteRows(targetDir, declared, spoke) {
|
|
231
|
+
return servedRoutes(targetDir, spoke)
|
|
230
232
|
.filter((route) => !declared.has(route))
|
|
231
233
|
.map((route) => ({ route, ...CODE_ROUTE_ROW }));
|
|
232
234
|
}
|
package/dist/site-roster.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import type { ModuleName } from "./parse-args.js";
|
|
|
6
6
|
import type { ResolvedSiteChrome } from "./site-chrome.js";
|
|
7
7
|
import { type MarkerMap } from "./substitute.js";
|
|
8
8
|
import { type TemplateManifest } from "./template-manifest.js";
|
|
9
|
+
import { type SignInMode, type SpokeShapeOptions, type Topology } from "./topology.js";
|
|
9
10
|
/** The site-root file that is the roster of record (#6658 D7). */
|
|
10
11
|
export declare const SITE_ROSTER_PATH = ".ailk-site-manifest.json";
|
|
11
12
|
/**
|
|
@@ -188,14 +189,22 @@ export declare function planRosterAppend(opts: PlanRosterAppendOptions): RosterA
|
|
|
188
189
|
* its parent (docs-blog's `/blog/[[...slug]]` serves `/blog`). The root
|
|
189
190
|
* content renderers (`/[slug]`, `/[slug]/[detail]`) are not routes of their
|
|
190
191
|
* own — they are how the content rows render — so they are left out.
|
|
192
|
+
*
|
|
193
|
+
* #11259 D6 — a page a carried page package ships (`PAGE_PACKAGE_ROUTES`
|
|
194
|
+
* `pages`) is served too, unless the site is a spoke that does not carry its
|
|
195
|
+
* path: the snapshot holds none of a package's generated route files, which
|
|
196
|
+
* `create-ailk routes --write` writes after the install. `spoke` is the
|
|
197
|
+
* site's spoke shape — `null` on a hub, read from the site when omitted.
|
|
191
198
|
*/
|
|
192
|
-
export declare function servedRoutes(targetDir: string): string[];
|
|
199
|
+
export declare function servedRoutes(targetDir: string, spoke?: SpokeShapeOptions | null): string[];
|
|
200
|
+
/** The dependency and devDependency names of the site's `apps/web/package.json`; empty when it has none. */
|
|
201
|
+
export declare function webDependencies(targetDir: string): Set<string>;
|
|
193
202
|
/**
|
|
194
203
|
* `file`'s next text with its unserved code-route rows removed — every other
|
|
195
204
|
* byte verbatim — and the dropped routes in file order; `next` is undefined
|
|
196
205
|
* when none is dropped.
|
|
197
206
|
*/
|
|
198
|
-
export declare function withoutUnservedRouteRows(file: RosterFile, targetDir: string): {
|
|
207
|
+
export declare function withoutUnservedRouteRows(file: RosterFile, targetDir: string, topology?: Topology, signIn?: SignInMode): {
|
|
199
208
|
next: string | undefined;
|
|
200
209
|
dropped: string[];
|
|
201
210
|
};
|
package/dist/site-roster.js
CHANGED
|
@@ -36,8 +36,9 @@ import { diffTwoStrings } from "./lib/extract-module-bundle.js";
|
|
|
36
36
|
import { publicTreeRemoved } from "./lib/site-modules.js";
|
|
37
37
|
import { MODULE_SLICES, normalizeModules, } from "./module-architecture.js";
|
|
38
38
|
import { substituteMarkers } from "./substitute.js";
|
|
39
|
-
import { isUnservedSurfaceContent, resolveSurfaces } from "./surfaces.js";
|
|
39
|
+
import { isUnservedSurfaceContent, PAGE_PACKAGE_ROUTES, pagePackageOfRoute, resolveSurfaces } from "./surfaces.js";
|
|
40
40
|
import { BASE_LAYER_DIR, SHAPE_STARTERS, TEMPLATE_MANIFESTS, resolveTemplate, rosterDeclares, shippedManifestPath, templateTreeDir, } from "./template-manifest.js";
|
|
41
|
+
import { isSpokeExcluded, readSpokeShape, } from "./topology.js";
|
|
41
42
|
/** The site-root file that is the roster of record (#6658 D7). */
|
|
42
43
|
export const SITE_ROSTER_PATH = ".ailk-site-manifest.json";
|
|
43
44
|
/**
|
|
@@ -634,29 +635,49 @@ function spliceRows(file, rows) {
|
|
|
634
635
|
* its parent (docs-blog's `/blog/[[...slug]]` serves `/blog`). The root
|
|
635
636
|
* content renderers (`/[slug]`, `/[slug]/[detail]`) are not routes of their
|
|
636
637
|
* own — they are how the content rows render — so they are left out.
|
|
638
|
+
*
|
|
639
|
+
* #11259 D6 — a page a carried page package ships (`PAGE_PACKAGE_ROUTES`
|
|
640
|
+
* `pages`) is served too, unless the site is a spoke that does not carry its
|
|
641
|
+
* path: the snapshot holds none of a package's generated route files, which
|
|
642
|
+
* `create-ailk routes --write` writes after the install. `spoke` is the
|
|
643
|
+
* site's spoke shape — `null` on a hub, read from the site when omitted.
|
|
637
644
|
*/
|
|
638
|
-
export function servedRoutes(targetDir) {
|
|
645
|
+
export function servedRoutes(targetDir, spoke) {
|
|
639
646
|
const root = join(targetDir, ROUTE_ROOT);
|
|
647
|
+
if (!existsSync(root))
|
|
648
|
+
return [];
|
|
640
649
|
const routes = new Set();
|
|
641
|
-
const
|
|
650
|
+
const add = (dir) => {
|
|
651
|
+
const segments = dir
|
|
652
|
+
.split(/[\\/]/)
|
|
653
|
+
.filter((segment) => segment !== "" && !/^\(.+\)$/.test(segment));
|
|
654
|
+
const last = segments[segments.length - 1];
|
|
655
|
+
if (last !== undefined && /^\[\[\.\.\..+\]\]$/.test(last))
|
|
656
|
+
segments.pop();
|
|
657
|
+
if (segments[0]?.startsWith("["))
|
|
658
|
+
return;
|
|
659
|
+
routes.add(`/${segments.join("/")}`);
|
|
660
|
+
};
|
|
661
|
+
const stack = [root];
|
|
642
662
|
for (let cur = stack.pop(); cur !== undefined; cur = stack.pop()) {
|
|
643
663
|
const entries = readdirSync(cur, { withFileTypes: true });
|
|
644
664
|
for (const entry of entries) {
|
|
645
665
|
if (entry.isDirectory())
|
|
646
666
|
stack.push(join(cur, entry.name));
|
|
647
667
|
}
|
|
648
|
-
if (
|
|
649
|
-
|
|
668
|
+
if (entries.some((entry) => entry.isFile() && PAGE_FILE.test(entry.name))) {
|
|
669
|
+
add(relative(root, cur));
|
|
650
670
|
}
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
if (
|
|
656
|
-
segments.pop();
|
|
657
|
-
if (segments[0]?.startsWith("["))
|
|
671
|
+
}
|
|
672
|
+
const carried = webDependencies(targetDir);
|
|
673
|
+
const shape = spoke === undefined ? readSpokeShape(targetDir) : spoke;
|
|
674
|
+
for (const row of PAGE_PACKAGE_ROUTES) {
|
|
675
|
+
if (!carried.has(row.package))
|
|
658
676
|
continue;
|
|
659
|
-
|
|
677
|
+
for (const page of row.pages) {
|
|
678
|
+
if (!shape || !isSpokeExcluded(`apps/web/app/[locale]/${page}`, shape))
|
|
679
|
+
add(page);
|
|
680
|
+
}
|
|
660
681
|
}
|
|
661
682
|
return [...routes].sort();
|
|
662
683
|
}
|
|
@@ -667,25 +688,46 @@ export function servedRoutes(targetDir) {
|
|
|
667
688
|
* dynamic is never judged either: the root renderers are not in
|
|
668
689
|
* `servedRoutes`.
|
|
669
690
|
*/
|
|
670
|
-
function unservedRouteRow(targetDir) {
|
|
691
|
+
function unservedRouteRow(targetDir, topology, signIn) {
|
|
671
692
|
if (!existsSync(join(targetDir, ROUTE_ROOT)))
|
|
672
693
|
return undefined;
|
|
673
|
-
|
|
694
|
+
// The spoke shape `planSiteManifest` passes `codeRouteRows`, so the two agree.
|
|
695
|
+
const shape = topology === undefined ? readSpokeShape(targetDir) : topology === "spoke" ? { mcp: true, signIn: signIn ?? "off" } : undefined;
|
|
696
|
+
const served = new Set(servedRoutes(targetDir, shape ?? null));
|
|
697
|
+
const carried = webDependencies(targetDir);
|
|
674
698
|
return (row) => {
|
|
675
699
|
const route = row["route"];
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
700
|
+
if (row["kind"] !== "route" || typeof route !== "string")
|
|
701
|
+
return false;
|
|
702
|
+
if (route.split("/").filter(Boolean)[0]?.startsWith("[") || served.has(route))
|
|
703
|
+
return false;
|
|
704
|
+
// #11251 — a route a carried page package ships is served once
|
|
705
|
+
// `create-ailk routes --write` writes its file after the install, unless
|
|
706
|
+
// the spoke removal registry drops it (the generator's `not carried`).
|
|
707
|
+
const pkg = pagePackageOfRoute(route.slice(1));
|
|
708
|
+
if (pkg === undefined || !carried.has(pkg))
|
|
709
|
+
return true;
|
|
710
|
+
return shape !== undefined && isSpokeExcluded(`apps/web/app/[locale]${route}`, shape);
|
|
680
711
|
};
|
|
681
712
|
}
|
|
713
|
+
/** The dependency and devDependency names of the site's `apps/web/package.json`; empty when it has none. */
|
|
714
|
+
export function webDependencies(targetDir) {
|
|
715
|
+
try {
|
|
716
|
+
const pkg = JSON.parse(readFileSync(join(targetDir, "apps", "web", "package.json"), "utf8"));
|
|
717
|
+
// The route generator's own reading (`readRouteManifests`): both lists.
|
|
718
|
+
return new Set([...Object.keys(pkg.dependencies ?? {}), ...Object.keys(pkg.devDependencies ?? {})]);
|
|
719
|
+
}
|
|
720
|
+
catch {
|
|
721
|
+
return new Set();
|
|
722
|
+
}
|
|
723
|
+
}
|
|
682
724
|
/**
|
|
683
725
|
* `file`'s next text with its unserved code-route rows removed — every other
|
|
684
726
|
* byte verbatim — and the dropped routes in file order; `next` is undefined
|
|
685
727
|
* when none is dropped.
|
|
686
728
|
*/
|
|
687
|
-
export function withoutUnservedRouteRows(file, targetDir) {
|
|
688
|
-
const unserved = unservedRouteRow(targetDir);
|
|
729
|
+
export function withoutUnservedRouteRows(file, targetDir, topology, signIn) {
|
|
730
|
+
const unserved = unservedRouteRow(targetDir, topology, signIn);
|
|
689
731
|
const dropped = file.rows.filter((row) => unserved?.(row.value) === true);
|
|
690
732
|
if (dropped.length === 0)
|
|
691
733
|
return { next: undefined, dropped: [] };
|
package/dist/spoke-checkout.d.ts
CHANGED
|
@@ -4,17 +4,15 @@ import { type WorkspaceVersionMap } from "./substitute.js";
|
|
|
4
4
|
import { type SignInMode } from "./topology.js";
|
|
5
5
|
/** The checkout package a spoke's billing action and thank-you page import. */
|
|
6
6
|
export declare const SPOKE_CHECKOUT_PACKAGE = "@working-theory/spoke-checkout";
|
|
7
|
-
/** The site's checkout stamp —
|
|
7
|
+
/** The site's checkout stamp — stamped once, the site's from then on (#8748 D2). */
|
|
8
8
|
export declare const SPOKE_CHECKOUT_CONFIG_PATH = "apps/web/lib/checkout-config.ts";
|
|
9
|
-
/** The two return pages a commerce spoke still carries (#8748 D5). */
|
|
10
|
-
export declare const SPOKE_CHECKOUT_PAGE_FILES: readonly string[];
|
|
11
9
|
/**
|
|
12
|
-
* The
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
10
|
+
* The stamp the bundled `lib/checkout-config.ts` carries until a spoke's is
|
|
11
|
+
* stamped (#11253 D6). This monorepo's copy is that file, and
|
|
12
|
+
* `spoke-checkout.test.ts` pins it to this value, so an edited bundled stamp
|
|
13
|
+
* fails CI rather than stamping every new spoke alike (SEC-11253-2).
|
|
16
14
|
*/
|
|
17
|
-
export declare const
|
|
15
|
+
export declare const SPOKE_CHECKOUT_PLACEHOLDER_SITE = "example-site";
|
|
18
16
|
/** The variables a commerce spoke depends on (D9): the package reads both. */
|
|
19
17
|
export declare const SPOKE_CHECKOUT_ENV_CATALOG: Readonly<Record<string, EnvCatalogEntry>>;
|
|
20
18
|
/** The names a commerce spoke declares although only the package reads them (D9). */
|
|
@@ -45,7 +43,7 @@ export declare const BILLING_ACTION: string;
|
|
|
45
43
|
/**
|
|
46
44
|
* The rendered part of the slice for `site` (#8748 D3): with `signIn: "hub"`
|
|
47
45
|
* the billing action (#8217 D8), else nothing. It does not depend on `site`.
|
|
48
|
-
* The rest of the slice is
|
|
46
|
+
* The rest of the slice is the config's stamp, written in place by
|
|
49
47
|
* `writeSpokeCheckoutSlice`. Throws `TopologyError` for an invalid stamp
|
|
50
48
|
* (SEC-7838-10).
|
|
51
49
|
*/
|
|
@@ -53,35 +51,38 @@ export declare function renderSpokeCheckoutFiles(site: string, opts?: {
|
|
|
53
51
|
signIn?: SignInMode | undefined;
|
|
54
52
|
}): [string, string][];
|
|
55
53
|
/**
|
|
56
|
-
* Write the slice into `targetDir` (#7838 D3, #8748 D3). The
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
* action, and the web seam — generated, so
|
|
66
|
-
* billing render: reported `patched` when it
|
|
54
|
+
* Write the slice into `targetDir` (#7838 D3, #8748 D3, #11253 D6). The
|
|
55
|
+
* site's `lib/checkout-config.ts` — delivered by the commerce bundle, which
|
|
56
|
+
* lands first — is stamped in place: its one `const SITE` line is set to
|
|
57
|
+
* `site` while it still reads the placeholder
|
|
58
|
+
* (`SPOKE_CHECKOUT_PLACEHOLDER_SITE`), reported `patched`; any other value is
|
|
59
|
+
* the site's and is left byte-for-byte, unreported, but only when it is a
|
|
60
|
+
* stamp this writer would itself write (`assertSite`, SEC-11253-1). Then come
|
|
61
|
+
* the rendered files (`renderSpokeCheckoutFiles`); one that already exists is
|
|
62
|
+
* left byte-for-byte and reported `skipped`. With `signIn: "hub"` (#8217 D8)
|
|
63
|
+
* the slice carries the billing action, and the web seam — generated, so
|
|
64
|
+
* always rewritten — becomes the billing render: reported `patched` when it
|
|
65
|
+
* changed, not at all when equal.
|
|
67
66
|
* Adds the package to `apps/web/package.json` when absent, and raises a plain
|
|
68
67
|
* pin older than the one it writes (#7839): the rendered billing action
|
|
69
68
|
* calls the package's current `createSpokeCheckout` shape, which an older
|
|
70
69
|
* pin does not take (#9142). Any other range — newer, `workspace:`, a tag —
|
|
71
70
|
* is the site's and is kept.
|
|
72
71
|
* Every refusal (an invalid stamp, a version map without the package, a
|
|
73
|
-
* missing or malformed `apps/web/package.json`, a
|
|
74
|
-
* `
|
|
75
|
-
*
|
|
76
|
-
*
|
|
72
|
+
* missing or malformed `apps/web/package.json`, no config, a config without
|
|
73
|
+
* exactly one `const SITE` line, a kept value `assertSite` refuses, a
|
|
74
|
+
* destination to write that resolves outside `targetDir`) throws before the
|
|
75
|
+
* first write.
|
|
76
|
+
*
|
|
77
|
+
* `projectName` and `templatesDir` are no longer read (nothing is copied from
|
|
78
|
+
* the template since #11253); they stay accepted for `add-module.ts`'s call.
|
|
77
79
|
*/
|
|
78
80
|
export declare function writeSpokeCheckoutSlice(targetDir: string, opts: {
|
|
79
81
|
site: string;
|
|
80
|
-
projectName
|
|
82
|
+
projectName?: string;
|
|
81
83
|
versions: WorkspaceVersionMap;
|
|
82
|
-
templatesDir
|
|
84
|
+
templatesDir?: string;
|
|
83
85
|
signIn?: SignInMode | undefined;
|
|
84
|
-
onWrite?: (relPath: string, bytes: Uint8Array) => void;
|
|
85
86
|
}): InstallReportRow[];
|
|
86
87
|
/**
|
|
87
88
|
* Drop the checkout package from a scaffold that does not get the slice — a
|
package/dist/spoke-checkout.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The spoke checkout slice (#7838, #8748) — what a spoke carrying `commerce`
|
|
3
|
-
* gets in `apps/web
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
* gets in `apps/web` beyond the commerce bundle: its `lib/checkout-config.ts`
|
|
4
|
+
* stamped in place. The thank-you and unavailable return pages ship in
|
|
5
|
+
* `@working-theory/ui-commerce` (#11253) and mount through the route files
|
|
6
|
+
* `create-ailk routes` generates; the config is a commerce `ownedFiles`
|
|
7
|
+
* entry, so the bundle delivers it to every commerce site with the
|
|
8
|
+
* template's placeholder stamp, and this writer stamps it on a spoke. A spoke
|
|
6
9
|
* that signs in through its hub also gets the billing action, the one file
|
|
7
|
-
* allowed to import the package
|
|
8
|
-
*
|
|
10
|
+
* in its `apps/web` allowed to import the package, and the web seam render
|
|
11
|
+
* that reaches it (#8217 D6–D8); that action is rendered here.
|
|
9
12
|
*
|
|
10
13
|
* A spoke sells through its hub's Offerings buy route
|
|
11
14
|
* (`apps/web/app/api/offerings/checkout/[lookupKey]/route.ts`), never its own
|
|
@@ -15,24 +18,22 @@
|
|
|
15
18
|
* (`RETIRED_SPOKE_CHECKOUT_PATHS`, sync-routes.ts).
|
|
16
19
|
*
|
|
17
20
|
* Every guarantee lives in `@working-theory/spoke-checkout` and arrives by a
|
|
18
|
-
* package bump; the
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
21
|
+
* package bump; the pages arrive with `@working-theory/ui-commerce`'s, and
|
|
22
|
+
* the config differs across spokes in its one stamp line alone (roadmap D3,
|
|
23
|
+
* AC-SPOKE-02). A hub carries the config with its placeholder unread: both
|
|
24
|
+
* checkout pages answer `notFound()` there first.
|
|
22
25
|
*
|
|
23
26
|
* Spec: docs/specs/7838-spoke-web-checkout-slice-spec.md (D3–D7, D9);
|
|
24
27
|
* docs/specs/8748-a-standard-spoke-checkout-route-spec.md (D2, D3).
|
|
25
28
|
*
|
|
26
|
-
* Pure module: no `import.meta.url`, so jest imports it directly
|
|
27
|
-
* passes `templatesDir`. Every package specifier in a rendered file is
|
|
29
|
+
* Pure module: no `import.meta.url`, so jest imports it directly. Every package specifier in a rendered file is
|
|
28
30
|
* interpolated from a constant, so the monorepo's own architecture lint never
|
|
29
31
|
* reads a rendered line as an import create-ailk makes (the
|
|
30
32
|
* `CONTENT_ADAPTERS_PACKAGE` idiom in topology.ts).
|
|
31
33
|
*/
|
|
32
34
|
import { createHash } from "node:crypto";
|
|
33
|
-
import { existsSync, lstatSync, mkdirSync, readFileSync,
|
|
35
|
+
import { existsSync, lstatSync, mkdirSync, readFileSync, realpathSync, writeFileSync, } from "node:fs";
|
|
34
36
|
import { dirname, join, resolve, sep } from "node:path";
|
|
35
|
-
import { buildScaffoldMarkers, renderTemplateFile, templateDestination } from "./copy.js";
|
|
36
37
|
import { SPOKE_BILLING_ACTION_PATH } from "./derive-architecture.js";
|
|
37
38
|
import { ENV_CATALOG } from "./lib/env-catalog.js";
|
|
38
39
|
import { diffTwoStrings, } from "./lib/extract-module-bundle.js";
|
|
@@ -41,23 +42,15 @@ import { TopologyError, WEB_SEAM_PATH, renderWebSeam, } from "./topology.js";
|
|
|
41
42
|
/** The checkout package a spoke's billing action and thank-you page import. */
|
|
42
43
|
export const SPOKE_CHECKOUT_PACKAGE = "@working-theory/spoke-checkout";
|
|
43
44
|
const API_CLIENT_PACKAGE = "@working-theory/api-client";
|
|
44
|
-
/** The site's checkout stamp —
|
|
45
|
+
/** The site's checkout stamp — stamped once, the site's from then on (#8748 D2). */
|
|
45
46
|
export const SPOKE_CHECKOUT_CONFIG_PATH = "apps/web/lib/checkout-config.ts";
|
|
46
|
-
/** The two return pages a commerce spoke still carries (#8748 D5). */
|
|
47
|
-
export const SPOKE_CHECKOUT_PAGE_FILES = Object.freeze([
|
|
48
|
-
"apps/web/app/[locale]/checkout/thank-you/page.tsx",
|
|
49
|
-
"apps/web/app/[locale]/checkout/unavailable/page.tsx",
|
|
50
|
-
]);
|
|
51
47
|
/**
|
|
52
|
-
* The
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
48
|
+
* The stamp the bundled `lib/checkout-config.ts` carries until a spoke's is
|
|
49
|
+
* stamped (#11253 D6). This monorepo's copy is that file, and
|
|
50
|
+
* `spoke-checkout.test.ts` pins it to this value, so an edited bundled stamp
|
|
51
|
+
* fails CI rather than stamping every new spoke alike (SEC-11253-2).
|
|
56
52
|
*/
|
|
57
|
-
export const
|
|
58
|
-
"apps/web/app/[locale]/checkout",
|
|
59
|
-
SPOKE_CHECKOUT_CONFIG_PATH,
|
|
60
|
-
]);
|
|
53
|
+
export const SPOKE_CHECKOUT_PLACEHOLDER_SITE = "example-site";
|
|
61
54
|
/** The variables a commerce spoke depends on (D9): the package reads both. */
|
|
62
55
|
export const SPOKE_CHECKOUT_ENV_CATALOG = Object.freeze({
|
|
63
56
|
STRIPE_SECRET_KEY: {
|
|
@@ -151,7 +144,7 @@ export const BILLING_ACTION = [
|
|
|
151
144
|
/**
|
|
152
145
|
* The rendered part of the slice for `site` (#8748 D3): with `signIn: "hub"`
|
|
153
146
|
* the billing action (#8217 D8), else nothing. It does not depend on `site`.
|
|
154
|
-
* The rest of the slice is
|
|
147
|
+
* The rest of the slice is the config's stamp, written in place by
|
|
155
148
|
* `writeSpokeCheckoutSlice`. Throws `TopologyError` for an invalid stamp
|
|
156
149
|
* (SEC-7838-10).
|
|
157
150
|
*/
|
|
@@ -159,35 +152,8 @@ export function renderSpokeCheckoutFiles(site, opts = {}) {
|
|
|
159
152
|
assertSite(site);
|
|
160
153
|
return opts.signIn === "hub" ? [[SPOKE_BILLING_ACTION_PATH, BILLING_ACTION]] : [];
|
|
161
154
|
}
|
|
162
|
-
/** The one line of the
|
|
163
|
-
const SITE_LINE = /^const SITE = "[
|
|
164
|
-
/**
|
|
165
|
-
* Every template file under `SPOKE_CHECKOUT_TEMPLATE_PATHS`, sorted, as its
|
|
166
|
-
* destination path and its source. A symlink is skipped, never followed, as
|
|
167
|
-
* `copyTemplate` skips one; a `.gitkeep` has no destination.
|
|
168
|
-
*/
|
|
169
|
-
function templateCheckoutFiles(templatesDir) {
|
|
170
|
-
const out = [];
|
|
171
|
-
const visit = (rel) => {
|
|
172
|
-
const abs = join(templatesDir, ...rel.split("/"));
|
|
173
|
-
if (!existsSync(abs))
|
|
174
|
-
return;
|
|
175
|
-
const stat = lstatSync(abs);
|
|
176
|
-
if (stat.isSymbolicLink())
|
|
177
|
-
return;
|
|
178
|
-
if (stat.isDirectory()) {
|
|
179
|
-
for (const name of readdirSync(abs))
|
|
180
|
-
visit(`${rel}/${name}`);
|
|
181
|
-
return;
|
|
182
|
-
}
|
|
183
|
-
const dest = templateDestination(rel);
|
|
184
|
-
if (dest !== undefined)
|
|
185
|
-
out.push([dest, abs]);
|
|
186
|
-
};
|
|
187
|
-
for (const entry of SPOKE_CHECKOUT_TEMPLATE_PATHS)
|
|
188
|
-
visit(entry);
|
|
189
|
-
return out.sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0));
|
|
190
|
-
}
|
|
155
|
+
/** The one line of the config the writer stamps (#8748 D2); its value is group 1. */
|
|
156
|
+
const SITE_LINE = /^const SITE = "([^"\n]*)";$/gm;
|
|
191
157
|
/** Whether anything — a dangling symlink included — sits at `abs`. */
|
|
192
158
|
function lstatExists(abs) {
|
|
193
159
|
try {
|
|
@@ -243,27 +209,31 @@ function isOlderPin(current, wanted) {
|
|
|
243
209
|
return false;
|
|
244
210
|
}
|
|
245
211
|
/**
|
|
246
|
-
* Write the slice into `targetDir` (#7838 D3, #8748 D3). The
|
|
247
|
-
*
|
|
248
|
-
*
|
|
249
|
-
*
|
|
250
|
-
*
|
|
251
|
-
*
|
|
252
|
-
*
|
|
253
|
-
*
|
|
254
|
-
*
|
|
255
|
-
* action, and the web seam — generated, so
|
|
256
|
-
* billing render: reported `patched` when it
|
|
212
|
+
* Write the slice into `targetDir` (#7838 D3, #8748 D3, #11253 D6). The
|
|
213
|
+
* site's `lib/checkout-config.ts` — delivered by the commerce bundle, which
|
|
214
|
+
* lands first — is stamped in place: its one `const SITE` line is set to
|
|
215
|
+
* `site` while it still reads the placeholder
|
|
216
|
+
* (`SPOKE_CHECKOUT_PLACEHOLDER_SITE`), reported `patched`; any other value is
|
|
217
|
+
* the site's and is left byte-for-byte, unreported, but only when it is a
|
|
218
|
+
* stamp this writer would itself write (`assertSite`, SEC-11253-1). Then come
|
|
219
|
+
* the rendered files (`renderSpokeCheckoutFiles`); one that already exists is
|
|
220
|
+
* left byte-for-byte and reported `skipped`. With `signIn: "hub"` (#8217 D8)
|
|
221
|
+
* the slice carries the billing action, and the web seam — generated, so
|
|
222
|
+
* always rewritten — becomes the billing render: reported `patched` when it
|
|
223
|
+
* changed, not at all when equal.
|
|
257
224
|
* Adds the package to `apps/web/package.json` when absent, and raises a plain
|
|
258
225
|
* pin older than the one it writes (#7839): the rendered billing action
|
|
259
226
|
* calls the package's current `createSpokeCheckout` shape, which an older
|
|
260
227
|
* pin does not take (#9142). Any other range — newer, `workspace:`, a tag —
|
|
261
228
|
* is the site's and is kept.
|
|
262
229
|
* Every refusal (an invalid stamp, a version map without the package, a
|
|
263
|
-
* missing or malformed `apps/web/package.json`, a
|
|
264
|
-
* `
|
|
265
|
-
*
|
|
266
|
-
*
|
|
230
|
+
* missing or malformed `apps/web/package.json`, no config, a config without
|
|
231
|
+
* exactly one `const SITE` line, a kept value `assertSite` refuses, a
|
|
232
|
+
* destination to write that resolves outside `targetDir`) throws before the
|
|
233
|
+
* first write.
|
|
234
|
+
*
|
|
235
|
+
* `projectName` and `templatesDir` are no longer read (nothing is copied from
|
|
236
|
+
* the template since #11253); they stay accepted for `add-module.ts`'s call.
|
|
267
237
|
*/
|
|
268
238
|
export function writeSpokeCheckoutSlice(targetDir, opts) {
|
|
269
239
|
const rendered = renderSpokeCheckoutFiles(opts.site, { signIn: opts.signIn });
|
|
@@ -272,28 +242,30 @@ export function writeSpokeCheckoutSlice(targetDir, opts) {
|
|
|
272
242
|
const pkgPath = join(targetDir, WEB_PACKAGE_JSON);
|
|
273
243
|
const before = readFileSync(pkgPath, "utf8");
|
|
274
244
|
const pkg = JSON.parse(before);
|
|
275
|
-
const
|
|
276
|
-
const
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
if (path === SPOKE_CHECKOUT_CONFIG_PATH) {
|
|
280
|
-
const text = bytes.toString("utf8");
|
|
281
|
-
const lines = text.match(SITE_LINE) ?? [];
|
|
282
|
-
if (lines.length !== 1) {
|
|
283
|
-
throw new TopologyError(`spoke checkout: the template's ${SPOKE_CHECKOUT_CONFIG_PATH} must hold exactly one const SITE line, found ${lines.length}`);
|
|
284
|
-
}
|
|
285
|
-
bytes = Buffer.from(text.replace(SITE_LINE, `const SITE = "${opts.site}";`), "utf8");
|
|
286
|
-
}
|
|
287
|
-
copied.push([path, bytes]);
|
|
245
|
+
const targetReal = realpathSync(targetDir);
|
|
246
|
+
const configPath = join(targetDir, SPOKE_CHECKOUT_CONFIG_PATH);
|
|
247
|
+
if (!existsSync(configPath)) {
|
|
248
|
+
throw new TopologyError(`spoke checkout: the site has no ${SPOKE_CHECKOUT_CONFIG_PATH} (the commerce bundle delivers it)`);
|
|
288
249
|
}
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
250
|
+
// The config is rewritten in place, so it must be the site's own file: a
|
|
251
|
+
// symlink, or a path that resolves outside the site, is refused.
|
|
252
|
+
if (lstatSync(configPath).isSymbolicLink() || !resolvesInside(targetReal, configPath)) {
|
|
253
|
+
throw new TopologyError(`spoke checkout: refusing to write outside the site: ${SPOKE_CHECKOUT_CONFIG_PATH}`);
|
|
292
254
|
}
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
255
|
+
const config = readFileSync(configPath, "utf8");
|
|
256
|
+
const siteLines = [...config.matchAll(SITE_LINE)];
|
|
257
|
+
if (siteLines.length !== 1) {
|
|
258
|
+
throw new TopologyError(`spoke checkout: ${SPOKE_CHECKOUT_CONFIG_PATH} must hold exactly one const SITE line, found ${siteLines.length}`);
|
|
259
|
+
}
|
|
260
|
+
const kept = siteLines[0][1];
|
|
261
|
+
if (kept !== SPOKE_CHECKOUT_PLACEHOLDER_SITE)
|
|
262
|
+
assertSite(kept);
|
|
263
|
+
const stamped = kept === SPOKE_CHECKOUT_PLACEHOLDER_SITE
|
|
264
|
+
? config.replace(SITE_LINE, `const SITE = "${opts.site}";`)
|
|
265
|
+
: undefined;
|
|
266
|
+
// A rendered file already there is skipped below, never written, so only a
|
|
267
|
+
// path that will be written must resolve inside the site.
|
|
268
|
+
for (const [path] of rendered) {
|
|
297
269
|
const abs = resolve(targetDir, path);
|
|
298
270
|
if (lstatExists(abs))
|
|
299
271
|
continue;
|
|
@@ -302,16 +274,13 @@ export function writeSpokeCheckoutSlice(targetDir, opts) {
|
|
|
302
274
|
}
|
|
303
275
|
}
|
|
304
276
|
const rows = [];
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
writeFileSync(abs, bytes);
|
|
313
|
-
opts.onWrite?.(path, bytes);
|
|
314
|
-
rows.push({ path, action: "written" });
|
|
277
|
+
if (stamped !== undefined) {
|
|
278
|
+
writeFileSync(configPath, stamped);
|
|
279
|
+
rows.push({
|
|
280
|
+
path: SPOKE_CHECKOUT_CONFIG_PATH,
|
|
281
|
+
action: "patched",
|
|
282
|
+
change: diffTwoStrings(SPOKE_CHECKOUT_CONFIG_PATH, config, stamped, true),
|
|
283
|
+
});
|
|
315
284
|
}
|
|
316
285
|
for (const [path, text] of rendered) {
|
|
317
286
|
const abs = join(targetDir, path);
|
package/dist/surfaces.d.ts
CHANGED
|
@@ -29,6 +29,30 @@ export declare const HUB_KEPT_ROUTE_DIRS: readonly string[];
|
|
|
29
29
|
* site whose manifest lists no `marketing` (`lib/site-modules.ts`, spec 10040 D10).
|
|
30
30
|
*/
|
|
31
31
|
export declare function isRemovedPublicRoutePath(destRel: string): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* The route trees a page package ships (ADR 0040): the package's pages
|
|
34
|
+
* mount through the route files `create-ailk routes` generates from its
|
|
35
|
+
* manifest, so `sync-routes` has nothing to sync under the prefix — the
|
|
36
|
+
* generator writes, checks and records those files, never the route copier.
|
|
37
|
+
* A `siteOwned` route under the prefix stays the site's own page (one the
|
|
38
|
+
* package leaves to a later slice) and `sync-routes` keeps it in scope. One
|
|
39
|
+
* entry per prefix of a page package, mirroring its `routes.json` (`prefix`,
|
|
40
|
+
* each `siteOwned` routing file's directory, and in `pages` each locale-mount
|
|
41
|
+
* page entry's directory under the prefix); `sync-routes.test.ts` pins every
|
|
42
|
+
* row to its package's manifest.
|
|
43
|
+
*
|
|
44
|
+
* `pages` is what a scaffold serves before the package is installed (#11259
|
|
45
|
+
* D6): the snapshot carries none of a page package's generated route files, so
|
|
46
|
+
* the site roster (`servedRoutes`) reads a carried package's pages here.
|
|
47
|
+
*/
|
|
48
|
+
export declare const PAGE_PACKAGE_ROUTES: readonly {
|
|
49
|
+
package: string;
|
|
50
|
+
prefix: string;
|
|
51
|
+
siteOwned: readonly string[];
|
|
52
|
+
pages: readonly string[];
|
|
53
|
+
}[];
|
|
54
|
+
/** The page package that ships `route` (a ROUTE_ROOT-relative dir), or `undefined` when no page package does. */
|
|
55
|
+
export declare function pagePackageOfRoute(route: string): string | undefined;
|
|
32
56
|
/** Template-relative route directories that are always copied. */
|
|
33
57
|
export declare const CORE_ROUTE_DIRS: readonly string[];
|
|
34
58
|
/**
|
|
@@ -85,6 +109,8 @@ export declare const SURFACE_ALIASES: Readonly<Record<string, string>>;
|
|
|
85
109
|
* is copied regardless.
|
|
86
110
|
*/
|
|
87
111
|
export declare const CORE_PROMOTED_SURFACES: ReadonlySet<string>;
|
|
112
|
+
/** Canonical id for a `--surfaces` value, resolving a retired alias. */
|
|
113
|
+
export declare function canonicalizeSurface(s: string): string;
|
|
88
114
|
/**
|
|
89
115
|
* Surfaces each recognized module contributes.
|
|
90
116
|
*
|