create-ailk 0.39.0 → 0.40.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/add-route.js +15 -0
- package/dist/body-heading.d.ts +2 -1
- package/dist/body-heading.js +31 -3
- package/dist/module-architecture.js +0 -3
- package/dist/remove-module.js +13 -4
- package/dist/routes.d.ts +7 -0
- package/dist/routes.js +1 -1
- package/dist/site-roster.js +7 -1
- package/dist/surfaces.d.ts +2 -0
- package/dist/surfaces.js +59 -172
- package/package.json +3 -3
- package/templates/apps/web/CLAUDE.md +7 -1
- package/templates/apps/web/__tests__/__mocks__/next-intl-server.ts +3 -2
- package/templates/apps/web/__tests__/__mocks__/next-intl.ts +3 -2
- package/templates/apps/web/app/[locale]/layout.tsx +1 -1
- package/templates/apps/web/i18n/request.ts +5 -1
- package/templates/apps/web/jest.config.cjs +6 -0
- package/templates/apps/web/lib/__tests__/deck-page.test.ts +9 -0
- package/templates/apps/web/lib/__tests__/in-page-magnet-self-request.test.ts +1 -1
- package/templates/apps/web/lib/__tests__/in-page-magnet.test.ts +2 -2
- package/templates/apps/web/lib/__tests__/pricing-page.test.ts +1 -1
- package/templates/apps/web/lib/__tests__/structured-data.test.tsx +17 -4
- package/templates/apps/web/lib/in-page-magnet.ts +2 -2
- package/templates/apps/web/lib/pricing-page.ts +3 -3
- package/templates/apps/web/{app/[locale]/contact → lib}/site-contact-email.ts +1 -1
- package/templates/apps/web/{app/[locale]/contact → lib}/site-contact-lines.ts +1 -1
- package/templates/apps/web/lib/site-header.ts +1 -1
- package/templates/apps/web/messages/en.json +0 -119
- package/templates/apps/web/next.config.mjs +7 -0
- package/templates/apps/web/package.json +1 -0
- package/templates/apps/web/site-pages.config.tsx +85 -0
- package/templates/tools/body-heading.ts +30 -3
- package/versions.json +50 -49
- package/templates/apps/web/app/[locale]/(authed)/leads/__tests__/page.test.tsx +0 -205
- package/templates/apps/web/app/[locale]/(authed)/leads/components/LeadsTable.tsx +0 -137
- package/templates/apps/web/app/[locale]/(authed)/leads/page.tsx +0 -122
- package/templates/apps/web/app/[locale]/(authed)/waitlist/components/ForbiddenState.tsx +0 -24
- package/templates/apps/web/app/[locale]/(authed)/waitlist/format.ts +0 -111
- package/templates/apps/web/app/[locale]/[slug]/[detail]/__tests__/page.test.tsx +0 -402
- package/templates/apps/web/app/[locale]/[slug]/[detail]/page.tsx +0 -143
- package/templates/apps/web/app/[locale]/[slug]/__tests__/page.test.tsx +0 -148
- package/templates/apps/web/app/[locale]/[slug]/page.tsx +0 -109
- package/templates/apps/web/app/[locale]/about/[slug]/page.tsx +0 -46
- package/templates/apps/web/app/[locale]/about/__tests__/about-routes.test.tsx +0 -353
- package/templates/apps/web/app/[locale]/about/page.tsx +0 -122
- package/templates/apps/web/app/[locale]/alternatives/__tests__/page.test.tsx +0 -161
- package/templates/apps/web/app/[locale]/alternatives/page.tsx +0 -112
- package/templates/apps/web/app/[locale]/careers/[slug]/[action]/page.tsx +0 -244
- package/templates/apps/web/app/[locale]/careers/[slug]/apply.actions.ts +0 -325
- package/templates/apps/web/app/[locale]/careers/[slug]/job-application-form.ts +0 -120
- package/templates/apps/web/app/[locale]/careers/[slug]/page.tsx +0 -73
- package/templates/apps/web/app/[locale]/careers/__tests__/apply.actions.test.ts +0 -497
- package/templates/apps/web/app/[locale]/careers/__tests__/careers-hub.test.tsx +0 -172
- package/templates/apps/web/app/[locale]/careers/__tests__/careers-set.test.tsx +0 -153
- package/templates/apps/web/app/[locale]/careers/__tests__/job-application-form.test.ts +0 -141
- package/templates/apps/web/app/[locale]/careers/__tests__/job-apply-page.test.tsx +0 -546
- package/templates/apps/web/app/[locale]/careers/__tests__/page-renderer-migration.test.tsx +0 -189
- package/templates/apps/web/app/[locale]/careers/page.tsx +0 -165
- package/templates/apps/web/app/[locale]/case-studies/[slug]/page.tsx +0 -49
- package/templates/apps/web/app/[locale]/case-studies/__tests__/hub-children.test.tsx +0 -65
- package/templates/apps/web/app/[locale]/case-studies/__tests__/page-renderer-migration.test.tsx +0 -125
- package/templates/apps/web/app/[locale]/case-studies/page.tsx +0 -49
- package/templates/apps/web/app/[locale]/clients/__tests__/page-renderer-migration.test.tsx +0 -85
- package/templates/apps/web/app/[locale]/clients/page.tsx +0 -47
- package/templates/apps/web/app/[locale]/contact/ConversationalIntakeWrapper.tsx +0 -249
- package/templates/apps/web/app/[locale]/contact/__tests__/ConversationalIntakeWrapper.test.tsx +0 -400
- package/templates/apps/web/app/[locale]/contact/__tests__/contact-form-magnet.test.ts +0 -138
- package/templates/apps/web/app/[locale]/contact/__tests__/contact-form-text.test.ts +0 -49
- package/templates/apps/web/app/[locale]/contact/__tests__/contact-magnet-page.test.tsx +0 -494
- package/templates/apps/web/app/[locale]/contact/__tests__/contact.actions.test.ts +0 -1122
- package/templates/apps/web/app/[locale]/contact/__tests__/intake-analytics.test.ts +0 -51
- package/templates/apps/web/app/[locale]/contact/__tests__/page-renderer-migration.test.tsx +0 -319
- package/templates/apps/web/app/[locale]/contact/contact-form-magnet.ts +0 -77
- package/templates/apps/web/app/[locale]/contact/contact-form-text.ts +0 -52
- package/templates/apps/web/app/[locale]/contact/contact.actions.ts +0 -403
- package/templates/apps/web/app/[locale]/contact/intake-analytics.ts +0 -49
- package/templates/apps/web/app/[locale]/contact/intake-script.ts +0 -92
- package/templates/apps/web/app/[locale]/contact/page.tsx +0 -267
- package/templates/apps/web/app/[locale]/courses/[slug]/page.tsx +0 -50
- package/templates/apps/web/app/[locale]/courses/__tests__/hub-children.test.tsx +0 -32
- package/templates/apps/web/app/[locale]/courses/__tests__/page-renderer-migration.test.tsx +0 -123
- package/templates/apps/web/app/[locale]/courses/page.tsx +0 -49
- package/templates/apps/web/app/[locale]/events/[slug]/page.tsx +0 -57
- package/templates/apps/web/app/[locale]/events/__tests__/hub-children.test.tsx +0 -32
- package/templates/apps/web/app/[locale]/events/__tests__/page-renderer-migration.test.tsx +0 -164
- package/templates/apps/web/app/[locale]/events/__tests__/program-event.test.tsx +0 -120
- package/templates/apps/web/app/[locale]/events/page.tsx +0 -60
- package/templates/apps/web/app/[locale]/faq/page.tsx +0 -54
- package/templates/apps/web/app/[locale]/features/[slug]/page.tsx +0 -54
- package/templates/apps/web/app/[locale]/features/__tests__/hub-children.test.tsx +0 -32
- package/templates/apps/web/app/[locale]/features/page.tsx +0 -50
- package/templates/apps/web/app/[locale]/for/[slug]/page.tsx +0 -54
- package/templates/apps/web/app/[locale]/for/__tests__/hub-children.test.tsx +0 -32
- package/templates/apps/web/app/[locale]/for/__tests__/page-renderer-migration.test.tsx +0 -90
- package/templates/apps/web/app/[locale]/for/page.tsx +0 -51
- package/templates/apps/web/app/[locale]/glossary/page.tsx +0 -53
- package/templates/apps/web/app/[locale]/how-to/[slug]/page.tsx +0 -50
- package/templates/apps/web/app/[locale]/how-to/__tests__/page-renderer-migration.test.tsx +0 -78
- package/templates/apps/web/app/[locale]/how-to/page.tsx +0 -50
- package/templates/apps/web/app/[locale]/integrations/[slug]/page.tsx +0 -54
- package/templates/apps/web/app/[locale]/integrations/__tests__/hub-children.test.tsx +0 -38
- package/templates/apps/web/app/[locale]/integrations/__tests__/page-renderer-migration.test.tsx +0 -141
- package/templates/apps/web/app/[locale]/integrations/page.tsx +0 -49
- package/templates/apps/web/app/[locale]/launch-service/page.tsx +0 -44
- package/templates/apps/web/app/[locale]/newsletter/__tests__/page.test.tsx +0 -236
- package/templates/apps/web/app/[locale]/newsletter/page.tsx +0 -179
- package/templates/apps/web/app/[locale]/page.tsx +0 -147
- package/templates/apps/web/app/[locale]/partners/[slug]/page.tsx +0 -45
- package/templates/apps/web/app/[locale]/partners/__tests__/hub-children.test.tsx +0 -32
- package/templates/apps/web/app/[locale]/partners/__tests__/page-renderer-migration.test.tsx +0 -125
- package/templates/apps/web/app/[locale]/partners/page.tsx +0 -49
- package/templates/apps/web/app/[locale]/portfolio/[slug]/page.tsx +0 -46
- package/templates/apps/web/app/[locale]/portfolio/__tests__/hub-children.test.tsx +0 -38
- package/templates/apps/web/app/[locale]/portfolio/page.tsx +0 -50
- package/templates/apps/web/app/[locale]/pricing/[slug]/__tests__/page.test.tsx +0 -324
- package/templates/apps/web/app/[locale]/pricing/[slug]/page.tsx +0 -87
- package/templates/apps/web/app/[locale]/pricing/__tests__/__snapshots__/unconnected.test.tsx.snap +0 -7
- package/templates/apps/web/app/[locale]/pricing/__tests__/offerings.test.tsx +0 -605
- package/templates/apps/web/app/[locale]/pricing/__tests__/page.test.tsx +0 -219
- package/templates/apps/web/app/[locale]/pricing/__tests__/pricing-pages.test.tsx +0 -215
- package/templates/apps/web/app/[locale]/pricing/__tests__/unconnected.test.tsx +0 -282
- package/templates/apps/web/app/[locale]/pricing/page.tsx +0 -120
- package/templates/apps/web/app/[locale]/privacy/page.tsx +0 -40
- package/templates/apps/web/app/[locale]/products/[slug]/page.tsx +0 -50
- package/templates/apps/web/app/[locale]/products/__tests__/hub-children.test.tsx +0 -32
- package/templates/apps/web/app/[locale]/products/__tests__/page-renderer-migration.test.tsx +0 -141
- package/templates/apps/web/app/[locale]/products/page.tsx +0 -49
- package/templates/apps/web/app/[locale]/projects/[slug]/page.tsx +0 -37
- package/templates/apps/web/app/[locale]/projects/__tests__/hub-children.test.tsx +0 -32
- package/templates/apps/web/app/[locale]/projects/__tests__/page-renderer-migration.test.tsx +0 -157
- package/templates/apps/web/app/[locale]/projects/page.tsx +0 -49
- package/templates/apps/web/app/[locale]/purchase-policy/page.tsx +0 -49
- package/templates/apps/web/app/[locale]/resources/[slug]/page.tsx +0 -54
- package/templates/apps/web/app/[locale]/resources/__tests__/hub-children.test.tsx +0 -38
- package/templates/apps/web/app/[locale]/resources/__tests__/page-renderer-migration.test.tsx +0 -151
- package/templates/apps/web/app/[locale]/resources/page.tsx +0 -49
- package/templates/apps/web/app/[locale]/services/[slug]/[child]/page.tsx +0 -68
- package/templates/apps/web/app/[locale]/services/[slug]/page.tsx +0 -88
- package/templates/apps/web/app/[locale]/services/__tests__/hub-children.test.tsx +0 -158
- package/templates/apps/web/app/[locale]/services/__tests__/page-renderer-migration.test.tsx +0 -187
- package/templates/apps/web/app/[locale]/services/__tests__/service-detail-sections.test.tsx +0 -224
- package/templates/apps/web/app/[locale]/services/__tests__/service-families.test.tsx +0 -368
- package/templates/apps/web/app/[locale]/services/page.tsx +0 -71
- package/templates/apps/web/app/[locale]/software/[slug]/page.tsx +0 -49
- package/templates/apps/web/app/[locale]/software/__tests__/page-renderer-migration.test.tsx +0 -81
- package/templates/apps/web/app/[locale]/software/page.tsx +0 -49
- package/templates/apps/web/app/[locale]/team/[slug]/page.tsx +0 -45
- package/templates/apps/web/app/[locale]/team/__tests__/hub-children.test.tsx +0 -32
- package/templates/apps/web/app/[locale]/team/__tests__/team-routes.test.tsx +0 -161
- package/templates/apps/web/app/[locale]/team/page.tsx +0 -50
- package/templates/apps/web/app/[locale]/tech-articles/[slug]/page.tsx +0 -54
- package/templates/apps/web/app/[locale]/tech-articles/__tests__/page-renderer-migration.test.tsx +0 -82
- package/templates/apps/web/app/[locale]/tech-articles/page.tsx +0 -49
- package/templates/apps/web/app/[locale]/templates/[slug]/__tests__/page.test.tsx +0 -203
- package/templates/apps/web/app/[locale]/templates/[slug]/page.tsx +0 -81
- package/templates/apps/web/app/[locale]/templates/__tests__/page.test.tsx +0 -237
- package/templates/apps/web/app/[locale]/templates/page.tsx +0 -114
- package/templates/apps/web/app/[locale]/terms/page.tsx +0 -40
- package/templates/apps/web/app/[locale]/testimonials/__tests__/page-renderer-migration.test.tsx +0 -85
- package/templates/apps/web/app/[locale]/testimonials/page.tsx +0 -51
- package/templates/apps/web/app/[locale]/thanks/[slug]/__tests__/page.test.tsx +0 -136
- package/templates/apps/web/app/[locale]/thanks/[slug]/page.tsx +0 -39
- package/templates/apps/web/app/[locale]/unsubscribe/__tests__/unsubscribe-rsc-boundary.test.tsx +0 -226
- package/templates/apps/web/app/[locale]/unsubscribe/__tests__/unsubscribe.test.tsx +0 -217
- package/templates/apps/web/app/[locale]/unsubscribe/page.tsx +0 -106
- package/templates/apps/web/app/[locale]/unsubscribe/unsubscribe-button.tsx +0 -94
- package/templates/apps/web/app/[locale]/unsubscribe/unsubscribe.actions.ts +0 -55
- package/templates/apps/web/app/[locale]/vs/[slug]/__tests__/page.test.tsx +0 -100
- package/templates/apps/web/app/[locale]/vs/[slug]/page.tsx +0 -60
- package/templates/apps/web/app/[locale]/whitepapers/[slug]/page.tsx +0 -54
- package/templates/apps/web/app/[locale]/whitepapers/__tests__/page-renderer-migration.test.tsx +0 -82
- package/templates/apps/web/app/[locale]/whitepapers/page.tsx +0 -49
- package/templates/apps/web/app/[locale]/working-agreement/__tests__/page.test.tsx +0 -63
- package/templates/apps/web/app/[locale]/working-agreement/page.tsx +0 -41
- package/templates/apps/web/lib/__tests__/hub-children.fixtures.ts +0 -279
- package/templates/apps/web/lib/__tests__/route-family.test.ts +0 -57
- package/templates/apps/web/lib/__tests__/service-listing.test.ts +0 -111
- package/templates/apps/web/lib/__tests__/template-listing.test.ts +0 -158
- package/templates/apps/web/lib/hub-children.tsx +0 -351
- package/templates/apps/web/lib/meet-placeholder.ts +0 -5
- package/templates/apps/web/lib/posting-title.ts +0 -39
- package/templates/apps/web/lib/route-family.ts +0 -69
- package/templates/apps/web/lib/service-listing.ts +0 -89
- package/templates/apps/web/lib/template-listing.ts +0 -169
- package/templates/apps/web/src/lib/__tests__/lead-write.test.ts +0 -187
- package/templates/apps/web/src/lib/lead-write.ts +0 -90
- /package/templates/apps/web/{app/[locale]/contact → lib}/__tests__/site-contact-lines.test.ts +0 -0
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
// Mapped rather than only `jest.mock()`d for the same reason as
|
|
3
3
|
// ./next-intl-server.ts — see that file's header.
|
|
4
4
|
import authMsgs from "@working-theory/auth/messages/en";
|
|
5
|
+
import sitePagesMsgs from "@working-theory/site-pages/messages/en";
|
|
5
6
|
|
|
6
7
|
import msgs from "../../messages/en.json";
|
|
7
8
|
|
|
8
9
|
// The sign-in package's catalog is merged under this site's, as
|
|
9
|
-
// `i18n/request.ts` merges it (#11257 D12).
|
|
10
|
-
const catalog = { ...authMsgs, ...msgs } as unknown as Record<string, Record<string, string>>;
|
|
10
|
+
// `i18n/request.ts` merges it (#11257 D12), and the base pages' (#11259 D7).
|
|
11
|
+
const catalog = { ...sitePagesMsgs, ...authMsgs, ...msgs } as unknown as Record<string, Record<string, string>>;
|
|
11
12
|
|
|
12
13
|
export const useTranslations =
|
|
13
14
|
(namespace: string) =>
|
|
@@ -141,7 +141,7 @@ import {
|
|
|
141
141
|
import { pagePathFor, resolveBaseUrl } from "../../src/lib/routes";
|
|
142
142
|
|
|
143
143
|
import { ConsentBanner } from "./consent-banner";
|
|
144
|
-
import { readSiteContactLines } from "
|
|
144
|
+
import { readSiteContactLines } from "../../lib/site-contact-lines";
|
|
145
145
|
|
|
146
146
|
/**
|
|
147
147
|
* The generated `siteChrome`, read through a widened type (#7740 D8): a
|
|
@@ -25,11 +25,14 @@
|
|
|
25
25
|
// stub answers `null` on a site without the module. `@working-theory/auth`
|
|
26
26
|
// ships the `auth`, `signIn`, `mcpConsent` and `spokeSignIn` keys of the
|
|
27
27
|
// sign-in surfaces (#11257 D12), added after the account catalog.
|
|
28
|
+
// `@working-theory/site-pages` ships the ten namespaces of the base pages
|
|
29
|
+
// (#11259 D7), added beside the account catalog: every site carries it.
|
|
28
30
|
//
|
|
29
31
|
// Spec: docs/internal/specs/i18n-phase1-s2-next-intl-foundation-spec.md
|
|
30
32
|
|
|
31
33
|
import { accountMessages } from "@working-theory/account";
|
|
32
34
|
import { authMessages } from "@working-theory/auth";
|
|
35
|
+
import { sitePagesMessages } from "@working-theory/site-pages";
|
|
33
36
|
import type { AbstractIntlMessages } from "next-intl";
|
|
34
37
|
import { getRequestConfig } from "next-intl/server";
|
|
35
38
|
|
|
@@ -103,6 +106,7 @@ export default getRequestConfig(async ({ requestLocale }) => {
|
|
|
103
106
|
// package; this site's catalog holds overrides only, so the package's keys
|
|
104
107
|
// are added under it and a key the site carries keeps the site's value.
|
|
105
108
|
const packaged = accountMessages(locale) ?? accountMessages(DEFAULT_LOCALE) ?? {};
|
|
109
|
+
const basePages = sitePagesMessages(locale) ?? sitePagesMessages(DEFAULT_LOCALE) ?? {};
|
|
106
110
|
const signIn = authMessages(locale) ?? authMessages(DEFAULT_LOCALE) ?? {};
|
|
107
111
|
const signalCollectors = await loadUiSignalCollectors();
|
|
108
112
|
const flows =
|
|
@@ -118,7 +122,7 @@ export default getRequestConfig(async ({ requestLocale }) => {
|
|
|
118
122
|
const withPackages = mergeAddOnly(
|
|
119
123
|
mergeAddOnly(
|
|
120
124
|
mergeAddOnly(
|
|
121
|
-
mergeAddOnly(mergeAddOnly(mergeAddOnly(messages as Catalog, packaged), signIn), flows),
|
|
125
|
+
mergeAddOnly(mergeAddOnly(mergeAddOnly(mergeAddOnly(messages as Catalog, packaged), basePages), signIn), flows),
|
|
122
126
|
schedule,
|
|
123
127
|
),
|
|
124
128
|
checkout,
|
|
@@ -149,6 +149,12 @@ module.exports = {
|
|
|
149
149
|
// aliases it to auth.config.tsx. The package's own suites run on this
|
|
150
150
|
// config too (packages/auth/jest.config.cjs), against this site.
|
|
151
151
|
"^@working-theory/auth/site$": "<rootDir>/auth.config.tsx",
|
|
152
|
+
// #11259 — the base website pages' seam, the same way: next.config.mjs
|
|
153
|
+
// aliases it to site-pages.config.tsx. The package's own suites run on
|
|
154
|
+
// this config too (packages/site-pages/jest.config.cjs), against this
|
|
155
|
+
// site. Its other subpaths need no mapper: it ships TypeScript source and
|
|
156
|
+
// its `exports` name the files.
|
|
157
|
+
"^@working-theory/site-pages/site$": "<rootDir>/site-pages.config.tsx",
|
|
152
158
|
// The package's modules resolve `next/headers` and `better-auth/react`
|
|
153
159
|
// from their own install, a second physical copy of each (the #5025
|
|
154
160
|
// class above), so a test's `jest.mock()` of either would miss them.
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* `next/headers` mocked, in `renderPage-extension.test.tsx`'s idiom.
|
|
8
8
|
*/
|
|
9
9
|
import { readFileSync } from "node:fs";
|
|
10
|
+
import { createRequire } from "node:module";
|
|
10
11
|
import path from "node:path";
|
|
11
12
|
|
|
12
13
|
import { ROUTES } from "@working-theory/templates/routes";
|
|
@@ -111,6 +112,14 @@ describe("DECK_ROUTES parity (#8687 D3)", () => {
|
|
|
111
112
|
let pageSource: string;
|
|
112
113
|
try {
|
|
113
114
|
pageSource = readFileSync(path.join(appRoot, dir, "page.tsx"), "utf8");
|
|
115
|
+
// A generated route file is a re-export (#11259 D8): read the
|
|
116
|
+
// package page it re-exports, resolved from apps/web.
|
|
117
|
+
const spec = pageSource.startsWith("// Generated by create-ailk routes from ")
|
|
118
|
+
? /from "(@working-theory\/[^"]+)"/.exec(pageSource)?.[1]
|
|
119
|
+
: undefined;
|
|
120
|
+
if (spec !== undefined) {
|
|
121
|
+
pageSource = readFileSync(createRequire(path.join(__dirname, "..", "..", "package.json")).resolve(spec), "utf8");
|
|
122
|
+
}
|
|
114
123
|
} catch {
|
|
115
124
|
continue;
|
|
116
125
|
}
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
export {};
|
|
16
16
|
|
|
17
17
|
// eslint-disable-next-line no-restricted-syntax -- test-seam mock: a "use server" boundary the module only binds
|
|
18
|
-
jest.mock("
|
|
18
|
+
jest.mock("@working-theory/site-pages/pages/contact/contact.actions", () => ({
|
|
19
19
|
captureLeadAction: jest.fn(),
|
|
20
20
|
}));
|
|
21
21
|
// eslint-disable-next-line no-restricted-syntax -- test-seam mock: a "use server" boundary the module only binds
|
|
@@ -18,7 +18,7 @@ jest.mock("@working-theory/api-client", () => ({
|
|
|
18
18
|
}));
|
|
19
19
|
|
|
20
20
|
// eslint-disable-next-line no-restricted-syntax -- test-seam mock: a "use server" boundary the module only binds
|
|
21
|
-
jest.mock("
|
|
21
|
+
jest.mock("@working-theory/site-pages/pages/contact/contact.actions", () => ({
|
|
22
22
|
captureLeadAction: jest.fn(),
|
|
23
23
|
}));
|
|
24
24
|
// eslint-disable-next-line no-restricted-syntax -- test-seam mock: a "use server" boundary the module only binds
|
|
@@ -28,7 +28,7 @@ jest.mock("../newsletter.actions", () => ({
|
|
|
28
28
|
|
|
29
29
|
import { flows } from "@working-theory/api-client";
|
|
30
30
|
|
|
31
|
-
import { captureLeadAction } from "
|
|
31
|
+
import { captureLeadAction } from "@working-theory/site-pages/pages/contact/contact.actions";
|
|
32
32
|
import {
|
|
33
33
|
fillEndingName,
|
|
34
34
|
framedSources,
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
pricingPageCard,
|
|
15
15
|
pricingSections,
|
|
16
16
|
} from "../pricing-page";
|
|
17
|
-
import type { DetailPage } from "
|
|
17
|
+
import type { DetailPage } from "@working-theory/site-pages/lib/route-family";
|
|
18
18
|
|
|
19
19
|
const fetchMock: jest.Mock = jest.fn(async () => ({
|
|
20
20
|
ok: true,
|
|
@@ -50,6 +50,7 @@ import {
|
|
|
50
50
|
rmSync,
|
|
51
51
|
writeFileSync,
|
|
52
52
|
} from "node:fs";
|
|
53
|
+
import { createRequire } from "node:module";
|
|
53
54
|
import { tmpdir } from "node:os";
|
|
54
55
|
import { basename, dirname, join, relative, resolve, sep } from "node:path";
|
|
55
56
|
|
|
@@ -78,7 +79,7 @@ import {
|
|
|
78
79
|
type ValidationError,
|
|
79
80
|
} from "@working-theory/schema-validator";
|
|
80
81
|
|
|
81
|
-
import { MEET_PLACEHOLDER_HUB } from "
|
|
82
|
+
import { MEET_PLACEHOLDER_HUB } from "@working-theory/site-pages/lib/meet-placeholder";
|
|
82
83
|
import type { ReactElement } from "react";
|
|
83
84
|
import { parse as parseYaml } from "yaml";
|
|
84
85
|
|
|
@@ -105,6 +106,18 @@ jest.mock("@working-theory/analytics/server", () => ({
|
|
|
105
106
|
|
|
106
107
|
// ── Where the site's content and routes live ────────────────────────────────
|
|
107
108
|
|
|
109
|
+
/**
|
|
110
|
+
* A route file's own source (#11259 D8): a generated route file is a
|
|
111
|
+
* re-export, so it is followed to the package page it re-exports — resolved
|
|
112
|
+
* from apps/web as the build resolves it — whose text the checks below read.
|
|
113
|
+
*/
|
|
114
|
+
function routeSource(file: string): string {
|
|
115
|
+
const text = readFileSync(file, "utf8");
|
|
116
|
+
if (!text.startsWith("// Generated by create-ailk routes from ")) return text;
|
|
117
|
+
const spec = /from "(@working-theory\/[^"]+)"/.exec(text)?.[1];
|
|
118
|
+
return spec === undefined ? text : readFileSync(createRequire(join(__dirname, "..", "..", "package.json")).resolve(spec), "utf8");
|
|
119
|
+
}
|
|
120
|
+
|
|
108
121
|
const CONTENT_ROOT =
|
|
109
122
|
process.env.AILK_CONTENT_ROOT ?? resolve(__dirname, "../../../../content");
|
|
110
123
|
const ROUTE_ROOT = resolve(__dirname, "../../app/[locale]");
|
|
@@ -683,7 +696,7 @@ function hubOwnSlug(file: string, type: string): string | null {
|
|
|
683
696
|
if (basename(dirname(file)) !== "[slug]") return null;
|
|
684
697
|
const parent = join(dirname(dirname(file)), "page.tsx");
|
|
685
698
|
if (!existsSync(parent)) return null;
|
|
686
|
-
const identity = routeIdentity(
|
|
699
|
+
const identity = routeIdentity(routeSource(parent));
|
|
687
700
|
return identity !== null && identity.type === type ? identity.slug : null;
|
|
688
701
|
}
|
|
689
702
|
|
|
@@ -745,7 +758,7 @@ describe("structured data — every route emits a valid JSON-LD script", () => {
|
|
|
745
758
|
|
|
746
759
|
it.each(routes)("$route", async ({ route, file }) => {
|
|
747
760
|
const label = `/${DEFAULT_LOCALE}${route === "" ? "" : "/" + route}`;
|
|
748
|
-
const src =
|
|
761
|
+
const src = routeSource(file);
|
|
749
762
|
// #10040 decision 1 — without the marketing module `/` redirects to
|
|
750
763
|
// /account before any content: no HomePage seed, no JSON-LD, and its
|
|
751
764
|
// page.tsx still names renderPage, so it is skipped here rather than
|
|
@@ -871,7 +884,7 @@ describe("structured data — every route emits a valid JSON-LD script", () => {
|
|
|
871
884
|
|
|
872
885
|
describe("structured data — a hub's own page is not rendered at its detail route (#10044 AC-6)", () => {
|
|
873
886
|
const dynamicRoutes = walkRoutes(ROUTE_ROOT).flatMap(({ route, file }) => {
|
|
874
|
-
const identity = routeIdentity(
|
|
887
|
+
const identity = routeIdentity(routeSource(file));
|
|
875
888
|
return identity !== null && identity.slug === null
|
|
876
889
|
? [{ route, file, type: identity.type }]
|
|
877
890
|
: [];
|
|
@@ -49,8 +49,8 @@ import { createElement, type ReactElement } from "react";
|
|
|
49
49
|
import {
|
|
50
50
|
contactFormFromConfig,
|
|
51
51
|
type ContactFormView,
|
|
52
|
-
} from "
|
|
53
|
-
import { captureLeadAction } from "
|
|
52
|
+
} from "@working-theory/site-pages/pages/contact/contact-form-magnet";
|
|
53
|
+
import { captureLeadAction } from "@working-theory/site-pages/pages/contact/contact.actions";
|
|
54
54
|
|
|
55
55
|
import { consentPoliciesFor } from "./consent-policies";
|
|
56
56
|
import { subscribeNewsletterAction } from "./newsletter.actions";
|
|
@@ -29,8 +29,8 @@ import {
|
|
|
29
29
|
import { getTranslations } from "next-intl/server";
|
|
30
30
|
import { createElement, type ReactNode } from "react";
|
|
31
31
|
|
|
32
|
-
import { contactFormText } from "
|
|
33
|
-
import { readSiteContactEmail } from "
|
|
32
|
+
import { contactFormText } from "@working-theory/site-pages/pages/contact/contact-form-text";
|
|
33
|
+
import { readSiteContactEmail } from "./site-contact-email";
|
|
34
34
|
|
|
35
35
|
import { browserApiOrigin } from "./api-origin.generated";
|
|
36
36
|
import {
|
|
@@ -38,7 +38,7 @@ import {
|
|
|
38
38
|
type OfferingsPricing,
|
|
39
39
|
type OfferingsPricingLabels,
|
|
40
40
|
} from "./offerings-pricing";
|
|
41
|
-
import type { DetailPage } from "
|
|
41
|
+
import type { DetailPage } from "@working-theory/site-pages/lib/route-family";
|
|
42
42
|
|
|
43
43
|
type PricingSection = Extract<PageSection, { type: "pricing" }>;
|
|
44
44
|
type PricingData = PricingSection["data"];
|
|
@@ -21,7 +21,7 @@ import { join } from "node:path";
|
|
|
21
21
|
import { SiteConfigSchema } from "@working-theory/site-config/schema";
|
|
22
22
|
import { parse as parseYaml } from "yaml";
|
|
23
23
|
|
|
24
|
-
import { resolveContentRoot } from "
|
|
24
|
+
import { resolveContentRoot } from "./site-brand";
|
|
25
25
|
|
|
26
26
|
const FRONTMATTER_RE = /^---\r?\n([\s\S]*?)\r?\n---/;
|
|
27
27
|
|
|
@@ -24,7 +24,7 @@ import { join } from "node:path";
|
|
|
24
24
|
import { SiteIdentitySchema } from "@working-theory/site-config/schema";
|
|
25
25
|
import { parse as parseYaml } from "yaml";
|
|
26
26
|
|
|
27
|
-
import { resolveContentRoot } from "
|
|
27
|
+
import { resolveContentRoot } from "./site-brand";
|
|
28
28
|
|
|
29
29
|
import { readSiteContactEmail } from "./site-contact-email";
|
|
30
30
|
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* account" link to `/account`, where Sign out lives (#11095 D6).
|
|
8
8
|
*
|
|
9
9
|
* A local frontmatter read rather than `@working-theory/site-config/server`,
|
|
10
|
-
* for the same reason as `
|
|
10
|
+
* for the same reason as `lib/site-contact-email.ts`:
|
|
11
11
|
* `architecture.yaml` keeps `node:fs` out of a tree that also carries edge
|
|
12
12
|
* routes (#1567). The value is validated against the canonical schema from
|
|
13
13
|
* the client-safe `/schema` entry.
|
|
@@ -72,35 +72,6 @@
|
|
|
72
72
|
"heading": "My Site",
|
|
73
73
|
"emptyState": "Home page content coming soon."
|
|
74
74
|
},
|
|
75
|
-
"about": {
|
|
76
|
-
"heading": "About",
|
|
77
|
-
"emptyState": "About page content coming soon.",
|
|
78
|
-
"viewProfile": "View profile"
|
|
79
|
-
},
|
|
80
|
-
"careers": {
|
|
81
|
-
"heading": "Careers",
|
|
82
|
-
"emptyState": "Career listings coming soon.",
|
|
83
|
-
"applicationSuccess": "Thank you for applying! We have your application and will be in touch.",
|
|
84
|
-
"apply": "Apply for this role",
|
|
85
|
-
"openPositions": "Open positions",
|
|
86
|
-
"viewRole": "View role",
|
|
87
|
-
"employmentTypeFullTime": "Full-time",
|
|
88
|
-
"employmentTypePartTime": "Part-time",
|
|
89
|
-
"employmentTypeContractor": "Contract",
|
|
90
|
-
"employmentTypeTemporary": "Temporary",
|
|
91
|
-
"employmentTypeIntern": "Internship",
|
|
92
|
-
"employmentTypeVolunteer": "Volunteer",
|
|
93
|
-
"employmentTypePerDiem": "Per diem",
|
|
94
|
-
"employmentTypeOther": "Other",
|
|
95
|
-
"filterSearch": "Search roles",
|
|
96
|
-
"filterType": "Type",
|
|
97
|
-
"filterAllTypes": "All types",
|
|
98
|
-
"filterLocation": "Location",
|
|
99
|
-
"filterAllLocations": "All locations",
|
|
100
|
-
"filterEmpty": "No open positions match your search.",
|
|
101
|
-
"filterCountOne": "1 open position",
|
|
102
|
-
"filterCountOther": "{count} open positions"
|
|
103
|
-
},
|
|
104
75
|
"case-studies": {
|
|
105
76
|
"heading": "Case Studies",
|
|
106
77
|
"emptyState": "Case studies listing coming soon."
|
|
@@ -121,43 +92,6 @@
|
|
|
121
92
|
"heading": "Clients",
|
|
122
93
|
"emptyState": "Clients listing coming soon."
|
|
123
94
|
},
|
|
124
|
-
"contact": {
|
|
125
|
-
"heading": "Contact",
|
|
126
|
-
"emptyState": "Contact page content coming soon.",
|
|
127
|
-
"nameLabel": "Name",
|
|
128
|
-
"emailLabel": "Email",
|
|
129
|
-
"messageLabel": "Message",
|
|
130
|
-
"sending": "Sending\u2026",
|
|
131
|
-
"sendMessage": "Send message",
|
|
132
|
-
"successMessage": "Thank you for reaching out! We will be in touch shortly.",
|
|
133
|
-
"trackInAccount": "Track this in your account",
|
|
134
|
-
"consentStatement": "I accept the [Terms](terms) and [Privacy Policy](privacy).",
|
|
135
|
-
"preferEmail": "Prefer email?",
|
|
136
|
-
"consentRequired": "Please accept the terms to send your message.",
|
|
137
|
-
"genericError": "Something went wrong, please try again.",
|
|
138
|
-
"unavailableHeading": "Get in touch",
|
|
139
|
-
"unavailableBody": "Email us at {email} and we'll reply.",
|
|
140
|
-
"unavailableNoEmail": "Contact details for this site haven't been published yet.",
|
|
141
|
-
"intake": {
|
|
142
|
-
"guidedBadge": "Guided",
|
|
143
|
-
"skip": "Skip",
|
|
144
|
-
"send": "Send",
|
|
145
|
-
"freeTextPlaceholder": "Type your answer…",
|
|
146
|
-
"nameAck": "Thanks for stopping by!",
|
|
147
|
-
"namePrompt": "What's your name?",
|
|
148
|
-
"messageAck": "Good to meet you.",
|
|
149
|
-
"messagePrompt": "What are you hoping to get done?",
|
|
150
|
-
"emailAck": "Got it.",
|
|
151
|
-
"emailPrompt": "What's the best email to reach you at?",
|
|
152
|
-
"consentAck": "Thanks — one last thing.",
|
|
153
|
-
"consentPrompt": "Do you accept our Terms and Privacy Policy? They're linked at the foot of every page.",
|
|
154
|
-
"consentAccept": "Yes, I accept",
|
|
155
|
-
"consentDecline": "Not yet",
|
|
156
|
-
"skipMessage": "No worries — here's our form instead.",
|
|
157
|
-
"completionMessage": "Thanks! We'll be in touch shortly.",
|
|
158
|
-
"submitError": "We couldn't send that automatically — please review and send below."
|
|
159
|
-
}
|
|
160
|
-
},
|
|
161
95
|
"downloads": {
|
|
162
96
|
"heading": "Downloads",
|
|
163
97
|
"emptyState": "Downloads listing coming soon."
|
|
@@ -190,23 +124,6 @@
|
|
|
190
124
|
"heading": "Launch Service",
|
|
191
125
|
"emptyState": "Launch Service page content coming soon."
|
|
192
126
|
},
|
|
193
|
-
"leadsInbox": {
|
|
194
|
-
"title": "Leads",
|
|
195
|
-
"description": "Every lead your site has captured, newest first.",
|
|
196
|
-
"forbiddenHeadline": "You don't have access",
|
|
197
|
-
"forbiddenDescription": "Sign in with the account that owns this site to see the leads it captured.",
|
|
198
|
-
"table": {
|
|
199
|
-
"caption": "Leads captured by your site",
|
|
200
|
-
"columnName": "Name",
|
|
201
|
-
"columnEmail": "Email",
|
|
202
|
-
"columnSource": "Source",
|
|
203
|
-
"columnCreated": "Captured",
|
|
204
|
-
"unavailable": "—",
|
|
205
|
-
"next": "Next page",
|
|
206
|
-
"emptyHeadline": "No leads yet",
|
|
207
|
-
"emptyDescription": "Leads captured by your site's forms will appear here."
|
|
208
|
-
}
|
|
209
|
-
},
|
|
210
127
|
"partners": {
|
|
211
128
|
"heading": "Partners",
|
|
212
129
|
"emptyState": "Partners listing coming soon."
|
|
@@ -226,10 +143,6 @@
|
|
|
226
143
|
"withRequired": "{plan} + {required}",
|
|
227
144
|
"depositNote": "{deposit} deposit due today; the balance is invoiced."
|
|
228
145
|
},
|
|
229
|
-
"pricingPages": {
|
|
230
|
-
"heading": "Pricing by offering",
|
|
231
|
-
"viewPricing": "See pricing"
|
|
232
|
-
},
|
|
233
146
|
"purchasePolicy": {
|
|
234
147
|
"heading": "Purchase Policy",
|
|
235
148
|
"emptyState": "Purchase policy content coming soon."
|
|
@@ -263,17 +176,6 @@
|
|
|
263
176
|
"schedule": {
|
|
264
177
|
"bookLength": "Book {minutes} min"
|
|
265
178
|
},
|
|
266
|
-
"services": {
|
|
267
|
-
"heading": "Services",
|
|
268
|
-
"emptyState": "Services listing coming soon.",
|
|
269
|
-
"childrenHeading": "Services in this area",
|
|
270
|
-
"viewService": "View service"
|
|
271
|
-
},
|
|
272
|
-
"software": {
|
|
273
|
-
"heading": "Software",
|
|
274
|
-
"description": "The @working-theory/* packages — typed tools for building AX-first products.",
|
|
275
|
-
"emptyState": "Software listings coming soon."
|
|
276
|
-
},
|
|
277
179
|
"tech-articles": {
|
|
278
180
|
"heading": "Technical Articles",
|
|
279
181
|
"description": "Deep dives into the architecture and internals of this site.",
|
|
@@ -299,17 +201,6 @@
|
|
|
299
201
|
"heading": "Alternatives",
|
|
300
202
|
"emptyState": "Comparisons coming soon."
|
|
301
203
|
},
|
|
302
|
-
"templates": {
|
|
303
|
-
"heading": "Templates",
|
|
304
|
-
"emptyState": "Templates coming soon.",
|
|
305
|
-
"getIt": "Get it",
|
|
306
|
-
"startFree": "Start free",
|
|
307
|
-
"viewDemo": "View demo",
|
|
308
|
-
"viewTemplate": "View template",
|
|
309
|
-
"included": "What's included",
|
|
310
|
-
"demoBadge": "Live demo",
|
|
311
|
-
"moreCategories": "+{count} more"
|
|
312
|
-
},
|
|
313
204
|
"reports": {
|
|
314
205
|
"heading": "Reports",
|
|
315
206
|
"emptyState": "Reports coming soon.",
|
|
@@ -431,11 +322,6 @@
|
|
|
431
322
|
"genericTitle": "Waitlist signup"
|
|
432
323
|
}
|
|
433
324
|
},
|
|
434
|
-
"whitepapers": {
|
|
435
|
-
"heading": "Whitepapers",
|
|
436
|
-
"description": "In-depth research and strategy papers from this site's team.",
|
|
437
|
-
"emptyState": "Whitepapers coming soon."
|
|
438
|
-
},
|
|
439
325
|
"account": {
|
|
440
326
|
"yourAccount": "Your account",
|
|
441
327
|
"gate": {
|
|
@@ -925,11 +811,6 @@
|
|
|
925
811
|
"heading": "Features",
|
|
926
812
|
"emptyState": "Features coming soon."
|
|
927
813
|
},
|
|
928
|
-
"unsubscribe": {
|
|
929
|
-
"already": "You were already unsubscribed.",
|
|
930
|
-
"invalid": "This link isn't valid.",
|
|
931
|
-
"unavailable": "Unsubscribing isn't available right now."
|
|
932
|
-
},
|
|
933
814
|
"hubConnect": {
|
|
934
815
|
"metaTitle": "Sign in to a site",
|
|
935
816
|
"title": "Sign in to {name}?",
|
|
@@ -344,6 +344,9 @@ const nextConfig = {
|
|
|
344
344
|
"@working-theory/schema-pack-registry",
|
|
345
345
|
"@working-theory/sections-registry",
|
|
346
346
|
"@working-theory/site-config",
|
|
347
|
+
// #11259 (ADR 0040 phase 4): the base website pages ship as TypeScript
|
|
348
|
+
// source; the generated route files under app/[locale]/ re-export them.
|
|
349
|
+
"@working-theory/site-pages",
|
|
347
350
|
"@working-theory/theme",
|
|
348
351
|
"@working-theory/ui",
|
|
349
352
|
"@working-theory/ui-commerce",
|
|
@@ -372,9 +375,13 @@ const nextConfig = {
|
|
|
372
375
|
// handlers import `@working-theory/auth/site`, answered by auth.config.tsx
|
|
373
376
|
// (`AuthSite`). `create-ailk routes --check` refuses a site whose manifests
|
|
374
377
|
// include the package and whose config lacks this line (SEC-11257-1).
|
|
378
|
+
// #11259 — the base website pages' seam, the same way: their pages, actions
|
|
379
|
+
// and loaders import `@working-theory/site-pages/site`, answered by
|
|
380
|
+
// site-pages.config.tsx (`SitePagesSite`).
|
|
375
381
|
webpack(config) {
|
|
376
382
|
config.resolve.alias["@working-theory/account/site$"] = join(process.cwd(), "account.config.tsx");
|
|
377
383
|
config.resolve.alias["@working-theory/auth/site$"] = join(process.cwd(), "auth.config.tsx");
|
|
384
|
+
config.resolve.alias["@working-theory/site-pages/site$"] = join(process.cwd(), "site-pages.config.tsx");
|
|
378
385
|
config.resolve.alias["@working-theory/ui-signal-collectors/site$"] = join(
|
|
379
386
|
process.cwd(),
|
|
380
387
|
"signal-collectors.config.tsx",
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
"@working-theory/schema-pack-registry": "workspace:*",
|
|
33
33
|
"@working-theory/schema-validator": "workspace:*",
|
|
34
34
|
"@working-theory/site-config": "workspace:*",
|
|
35
|
+
"@working-theory/site-pages": "workspace:*",
|
|
35
36
|
"@working-theory/spoke-checkout": "workspace:*",
|
|
36
37
|
"@working-theory/templates": "workspace:*",
|
|
37
38
|
"@working-theory/theme": "workspace:*",
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* site-pages.config.tsx — this site's answer to the base website pages'
|
|
3
|
+
* runtime-services seam (ADR 0040 rule 4; #11259 D3).
|
|
4
|
+
*
|
|
5
|
+
* The pages under `app/[locale]/` that `@working-theory/site-pages` ships are
|
|
6
|
+
* generated re-exports (`create-ailk routes`); the package's pages, server
|
|
7
|
+
* actions and loaders read the site's own services through the one fixed
|
|
8
|
+
* specifier `@working-theory/site-pages/site`, which `next.config.mjs`
|
|
9
|
+
* aliases to this file (and `jest.config.cjs` maps). Its named export `site`
|
|
10
|
+
* carries exactly those services; its shape is `SitePagesSite`, fixed by the
|
|
11
|
+
* package, so a missing or misspelled member fails `tsc`.
|
|
12
|
+
*
|
|
13
|
+
* Not a customization slot: no page is site-configurable beyond these
|
|
14
|
+
* services (rule 8), so this file has no default export and no option.
|
|
15
|
+
*/
|
|
16
|
+
import type { SitePagesSite } from "@working-theory/site-pages/site";
|
|
17
|
+
|
|
18
|
+
import { accountInviteHref } from "./lib/account-invite";
|
|
19
|
+
import { runBotCheck } from "./lib/bot-check";
|
|
20
|
+
import { consentVisitorHeader, ensureConsentVisitor, readConsentVisitor } from "./lib/consent-visitor";
|
|
21
|
+
import { framedSources, inPageView, newsletterSignup, readCaptureStatus, readServedMagnet } from "./lib/in-page-magnet";
|
|
22
|
+
import { MARKETING_PAGES } from "./lib/modules.generated";
|
|
23
|
+
import { isShownLookupKey, offeringsCheckoutHref } from "./lib/offerings-pricing";
|
|
24
|
+
import {
|
|
25
|
+
offeringPricingPages,
|
|
26
|
+
pagePlans,
|
|
27
|
+
PRICING_HUB_SLUG,
|
|
28
|
+
pricingPageCard,
|
|
29
|
+
pricingSections,
|
|
30
|
+
pricingSectionSlots,
|
|
31
|
+
} from "./lib/pricing-page";
|
|
32
|
+
import { ApiError, forwardedCookieInit, unwrapApiResult } from "./lib/server-api";
|
|
33
|
+
import { SERVICES_PATH, SERVICES_ROUTE, toPublicServicesHref } from "./lib/services-path";
|
|
34
|
+
import { siteChrome } from "./lib/site-chrome";
|
|
35
|
+
import { readSiteContactEmail } from "./lib/site-contact-email";
|
|
36
|
+
import { siteLogomarkAsset, siteWordmarkAsset } from "./lib/site-logo";
|
|
37
|
+
import { readSession } from "./lib/topology.generated";
|
|
38
|
+
import { takeVisitorLimit } from "./src/lib/rate-limit";
|
|
39
|
+
import { pagePathFor } from "./src/lib/routes";
|
|
40
|
+
|
|
41
|
+
// `lib/in-page-magnet` imports two package modules that import this seam (a
|
|
42
|
+
// cycle, as account.config.tsx has with the account actions): its members
|
|
43
|
+
// copied below must stay hoisted function declarations, read at call time.
|
|
44
|
+
export const site = {
|
|
45
|
+
accountInviteHref,
|
|
46
|
+
runBotCheck,
|
|
47
|
+
consentVisitorHeader,
|
|
48
|
+
readConsentVisitor,
|
|
49
|
+
ensureConsentVisitor,
|
|
50
|
+
framedSources,
|
|
51
|
+
inPageView,
|
|
52
|
+
readCaptureStatus,
|
|
53
|
+
readServedMagnet,
|
|
54
|
+
newsletterSignup,
|
|
55
|
+
// Loaded on first call, as the two modules' registrations (the listing
|
|
56
|
+
// extension, the deck pages) already run from the locale layout: a page's
|
|
57
|
+
// module graph stays what it was before the move.
|
|
58
|
+
listingExtension: {
|
|
59
|
+
entryAt: async (...args) => (await import("./lib/listings")).listingExtension.entryAt(...args),
|
|
60
|
+
entryMetadataAt: async (...args) => (await import("./lib/listings")).listingExtension.entryMetadataAt(...args),
|
|
61
|
+
},
|
|
62
|
+
MARKETING_PAGES,
|
|
63
|
+
isShownLookupKey,
|
|
64
|
+
offeringsCheckoutHref,
|
|
65
|
+
resolveHomeChrome: async (...args) => (await import("./lib/page-chrome")).resolveHomeChrome(...args),
|
|
66
|
+
offeringPricingPages,
|
|
67
|
+
pagePlans,
|
|
68
|
+
pricingPageCard,
|
|
69
|
+
pricingSections,
|
|
70
|
+
pricingSectionSlots,
|
|
71
|
+
PRICING_HUB_SLUG,
|
|
72
|
+
ApiError,
|
|
73
|
+
forwardedCookieInit,
|
|
74
|
+
unwrapApiResult,
|
|
75
|
+
SERVICES_PATH,
|
|
76
|
+
SERVICES_ROUTE,
|
|
77
|
+
toPublicServicesHref,
|
|
78
|
+
siteChrome,
|
|
79
|
+
siteLogomarkAsset,
|
|
80
|
+
siteWordmarkAsset,
|
|
81
|
+
takeVisitorLimit,
|
|
82
|
+
pagePathFor,
|
|
83
|
+
readSiteContactEmail,
|
|
84
|
+
getSession: readSession,
|
|
85
|
+
} satisfies SitePagesSite;
|
|
@@ -25,7 +25,8 @@
|
|
|
25
25
|
* file from source.
|
|
26
26
|
*/
|
|
27
27
|
import { existsSync, lstatSync, readFileSync, readdirSync, writeFileSync } from "node:fs";
|
|
28
|
-
import {
|
|
28
|
+
import { createRequire } from "node:module";
|
|
29
|
+
import { join, resolve } from "node:path";
|
|
29
30
|
|
|
30
31
|
/** Per content type: mdx-body always, or only while `sections[]` is empty. */
|
|
31
32
|
export type MdxBodyRule = Map<string, "always" | "unless-sections">;
|
|
@@ -57,19 +58,45 @@ function pageFiles(dir: string, out: string[] = []): string[] {
|
|
|
57
58
|
return out;
|
|
58
59
|
}
|
|
59
60
|
|
|
61
|
+
// A route file `create-ailk routes` generated (#11259 D8): its header line
|
|
62
|
+
// (after an optional `// oss: false` marker) and the package page it re-exports.
|
|
63
|
+
const GENERATED_ROUTE_HEADER = "// Generated by create-ailk routes from ";
|
|
64
|
+
const OSS_FALSE_MARKER = "// oss: false";
|
|
65
|
+
const GENERATED_FROM_RE = /\bfrom\s+"(@working-theory\/[^"]+)"/;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* A page file's own source. A generated route file is followed to the package
|
|
69
|
+
* page it re-exports, resolved from the site's `apps/web` as Next resolves it
|
|
70
|
+
* (#11259 D8: the base pages ship in `@working-theory/site-pages`); one whose
|
|
71
|
+
* package is not installed reads as itself.
|
|
72
|
+
*/
|
|
73
|
+
function pageSource(file: string, webDir: string): string {
|
|
74
|
+
const text = readFileSync(file, "utf8");
|
|
75
|
+
const [line1 = "", line2 = ""] = text.split("\n", 2);
|
|
76
|
+
if (!(line1 === OSS_FALSE_MARKER ? line2 : line1).startsWith(GENERATED_ROUTE_HEADER)) return text;
|
|
77
|
+
const specifier = GENERATED_FROM_RE.exec(text)?.[1];
|
|
78
|
+
if (specifier === undefined) return text;
|
|
79
|
+
try {
|
|
80
|
+
return readFileSync(createRequire(resolve(webDir, "package.json")).resolve(specifier), "utf8");
|
|
81
|
+
} catch {
|
|
82
|
+
return text;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
60
86
|
/**
|
|
61
87
|
* Scan `<appsRoot>/apps/web/app/**\/page.{ts,tsx}` for `renderPage({…})` calls
|
|
62
88
|
* naming `bodyMode: "mdx-body"`. A call whose `bodyMode` sits in a conditional
|
|
63
89
|
* spread is `"unless-sections"`, any other `"always"`; `"always"` wins when two
|
|
64
90
|
* routes name one type. A content hub's `HubConfig` reads the same way, from
|
|
65
|
-
* its `body`. A
|
|
91
|
+
* its `body`. A generated route file reads as the package page it re-exports
|
|
92
|
+
* (`pageSource`). A missing `apps/web/app` gives an empty map.
|
|
66
93
|
*/
|
|
67
94
|
export function mdxBodyRule(appsRoot: string): MdxBodyRule {
|
|
68
95
|
const rule: MdxBodyRule = new Map();
|
|
69
96
|
const appDir = join(appsRoot, "apps", "web", "app");
|
|
70
97
|
if (!existsSync(appDir)) return rule;
|
|
71
98
|
for (const file of pageFiles(appDir)) {
|
|
72
|
-
const source =
|
|
99
|
+
const source = pageSource(file, join(appsRoot, "apps", "web"));
|
|
73
100
|
if (HUB_INPUT_RE.test(source)) {
|
|
74
101
|
const types = [...source.matchAll(HUB_LIST_TYPE_RE)];
|
|
75
102
|
const bodies = [...source.matchAll(HUB_BODY_RE)];
|