@conloca/cloud-astro 0.0.0-bootstrap.0 → 0.2.1
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 +327 -2
- package/dist/src/build-commit.d.ts +19 -0
- package/dist/src/build-commit.d.ts.map +1 -0
- package/dist/src/build-commit.js +6 -0
- package/dist/src/build-commit.js.map +1 -0
- package/dist/src/bundle.d.ts +173 -0
- package/dist/src/bundle.d.ts.map +1 -0
- package/dist/src/bundle.js +413 -0
- package/dist/src/bundle.js.map +1 -0
- package/dist/src/component-manifest.d.ts +29 -0
- package/dist/src/component-manifest.d.ts.map +1 -0
- package/dist/src/component-manifest.js +53 -0
- package/dist/src/component-manifest.js.map +1 -0
- package/dist/src/constants.d.ts +26 -0
- package/dist/src/constants.d.ts.map +1 -0
- package/dist/src/constants.js +26 -0
- package/dist/src/constants.js.map +1 -0
- package/dist/src/descriptors.d.ts +25 -0
- package/dist/src/descriptors.d.ts.map +1 -0
- package/dist/src/descriptors.js +65 -0
- package/dist/src/descriptors.js.map +1 -0
- package/dist/src/discovery.d.ts +58 -0
- package/dist/src/discovery.d.ts.map +1 -0
- package/dist/src/discovery.js +133 -0
- package/dist/src/discovery.js.map +1 -0
- package/dist/src/doctor/checks-live.d.ts +15 -0
- package/dist/src/doctor/checks-live.d.ts.map +1 -0
- package/dist/src/doctor/checks-live.js +229 -0
- package/dist/src/doctor/checks-live.js.map +1 -0
- package/dist/src/doctor/checks-offline.d.ts +36 -0
- package/dist/src/doctor/checks-offline.d.ts.map +1 -0
- package/dist/src/doctor/checks-offline.js +301 -0
- package/dist/src/doctor/checks-offline.js.map +1 -0
- package/dist/src/doctor/config-scan.d.ts +55 -0
- package/dist/src/doctor/config-scan.d.ts.map +1 -0
- package/dist/src/doctor/config-scan.js +178 -0
- package/dist/src/doctor/config-scan.js.map +1 -0
- package/dist/src/doctor/run.d.ts +4 -0
- package/dist/src/doctor/run.d.ts.map +1 -0
- package/dist/src/doctor/run.js +29 -0
- package/dist/src/doctor/run.js.map +1 -0
- package/dist/src/doctor/types.d.ts +60 -0
- package/dist/src/doctor/types.d.ts.map +1 -0
- package/dist/src/doctor/types.js +18 -0
- package/dist/src/doctor/types.js.map +1 -0
- package/dist/src/doctor.d.ts +9 -0
- package/dist/src/doctor.d.ts.map +1 -0
- package/dist/src/doctor.js +12 -0
- package/dist/src/doctor.js.map +1 -0
- package/dist/src/git.d.ts +38 -0
- package/dist/src/git.d.ts.map +1 -0
- package/dist/src/git.js +43 -0
- package/dist/src/git.js.map +1 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +7 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/integration.d.ts +6 -0
- package/dist/src/integration.d.ts.map +1 -0
- package/dist/src/integration.js +532 -0
- package/dist/src/integration.js.map +1 -0
- package/dist/src/message-of.d.ts +3 -0
- package/dist/src/message-of.d.ts.map +1 -0
- package/dist/src/message-of.js +5 -0
- package/dist/src/message-of.js.map +1 -0
- package/dist/src/node.d.ts +3 -0
- package/dist/src/node.d.ts.map +1 -0
- package/dist/src/node.js +4 -0
- package/dist/src/node.js.map +1 -0
- package/dist/src/package-version.d.ts +7 -0
- package/dist/src/package-version.d.ts.map +1 -0
- package/dist/src/package-version.js +17 -0
- package/dist/src/package-version.js.map +1 -0
- package/dist/src/preview/_dispatch.d.ts +52 -0
- package/dist/src/preview/_dispatch.d.ts.map +1 -0
- package/dist/src/preview/_dispatch.js +70 -0
- package/dist/src/preview/_dispatch.js.map +1 -0
- package/dist/src/preview/_resolve-opts.d.ts +28 -0
- package/dist/src/preview/_resolve-opts.d.ts.map +1 -0
- package/dist/src/preview/_resolve-opts.js +70 -0
- package/dist/src/preview/_resolve-opts.js.map +1 -0
- package/dist/src/preview/banner.d.ts +29 -0
- package/dist/src/preview/banner.d.ts.map +1 -0
- package/dist/src/preview/banner.js +94 -0
- package/dist/src/preview/banner.js.map +1 -0
- package/dist/src/preview/content-api.d.ts +110 -0
- package/dist/src/preview/content-api.d.ts.map +1 -0
- package/dist/src/preview/content-api.js +216 -0
- package/dist/src/preview/content-api.js.map +1 -0
- package/dist/src/preview/cookie.d.ts +36 -0
- package/dist/src/preview/cookie.d.ts.map +1 -0
- package/dist/src/preview/cookie.js +59 -0
- package/dist/src/preview/cookie.js.map +1 -0
- package/dist/src/preview/headers.d.ts +25 -0
- package/dist/src/preview/headers.d.ts.map +1 -0
- package/dist/src/preview/headers.js +31 -0
- package/dist/src/preview/headers.js.map +1 -0
- package/dist/src/preview/landing.d.ts +22 -0
- package/dist/src/preview/landing.d.ts.map +1 -0
- package/dist/src/preview/landing.js +70 -0
- package/dist/src/preview/landing.js.map +1 -0
- package/dist/src/preview/middleware.d.ts +112 -0
- package/dist/src/preview/middleware.d.ts.map +1 -0
- package/dist/src/preview/middleware.js +197 -0
- package/dist/src/preview/middleware.js.map +1 -0
- package/dist/src/preview/preview-path.d.ts +21 -0
- package/dist/src/preview/preview-path.d.ts.map +1 -0
- package/dist/src/preview/preview-path.js +29 -0
- package/dist/src/preview/preview-path.js.map +1 -0
- package/dist/src/preview/satteri-workerd.d.ts +17 -0
- package/dist/src/preview/satteri-workerd.d.ts.map +1 -0
- package/dist/src/preview/satteri-workerd.js +18 -0
- package/dist/src/preview/satteri-workerd.js.map +1 -0
- package/dist/src/preview/site-middleware.d.ts +69 -0
- package/dist/src/preview/site-middleware.d.ts.map +1 -0
- package/dist/src/preview/site-middleware.js +159 -0
- package/dist/src/preview/site-middleware.js.map +1 -0
- package/dist/src/preview/workerd-shim.d.ts +19 -0
- package/dist/src/preview/workerd-shim.d.ts.map +1 -0
- package/dist/src/preview/workerd-shim.js +33 -0
- package/dist/src/preview/workerd-shim.js.map +1 -0
- package/dist/src/preview-build.d.ts +71 -0
- package/dist/src/preview-build.d.ts.map +1 -0
- package/dist/src/preview-build.js +115 -0
- package/dist/src/preview-build.js.map +1 -0
- package/dist/src/preview.d.ts +6 -0
- package/dist/src/preview.d.ts.map +1 -0
- package/dist/src/preview.js +12 -0
- package/dist/src/preview.js.map +1 -0
- package/dist/src/register.d.ts +98 -0
- package/dist/src/register.d.ts.map +1 -0
- package/dist/src/register.js +103 -0
- package/dist/src/register.js.map +1 -0
- package/dist/src/repository.d.ts +18 -0
- package/dist/src/repository.d.ts.map +1 -0
- package/dist/src/repository.js +46 -0
- package/dist/src/repository.js.map +1 -0
- package/dist/src/site-id.d.ts +18 -0
- package/dist/src/site-id.d.ts.map +1 -0
- package/dist/src/site-id.js +70 -0
- package/dist/src/site-id.js.map +1 -0
- package/dist/src/site-middleware.d.ts +18 -0
- package/dist/src/site-middleware.d.ts.map +1 -0
- package/dist/src/site-middleware.js +47 -0
- package/dist/src/site-middleware.js.map +1 -0
- package/dist/src/skill.d.ts +26 -0
- package/dist/src/skill.d.ts.map +1 -0
- package/dist/src/skill.js +67 -0
- package/dist/src/skill.js.map +1 -0
- package/dist/src/types.d.ts +125 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +2 -0
- package/dist/src/types.js.map +1 -0
- package/package.json +170 -5
- package/src/build-commit.ts +22 -0
- package/src/bundle.ts +563 -0
- package/src/component-manifest.ts +75 -0
- package/src/constants.ts +28 -0
- package/src/descriptors.ts +92 -0
- package/src/discovery.ts +183 -0
- package/src/doctor/checks-live.ts +324 -0
- package/src/doctor/checks-offline.ts +325 -0
- package/src/doctor/config-scan.ts +205 -0
- package/src/doctor/run.ts +39 -0
- package/src/doctor/types.ts +71 -0
- package/src/doctor.ts +14 -0
- package/src/git.ts +66 -0
- package/src/index.ts +8 -0
- package/src/integration.ts +595 -0
- package/src/message-of.ts +4 -0
- package/src/node.ts +5 -0
- package/src/package-version.ts +16 -0
- package/src/preview/_dispatch.ts +101 -0
- package/src/preview/_resolve-opts.ts +84 -0
- package/src/preview/banner.ts +96 -0
- package/src/preview/content-api.ts +293 -0
- package/src/preview/cookie.ts +54 -0
- package/src/preview/headers.ts +30 -0
- package/src/preview/landing.ts +73 -0
- package/src/preview/middleware.ts +303 -0
- package/src/preview/preview-path.ts +28 -0
- package/src/preview/satteri-workerd.ts +24 -0
- package/src/preview/site-middleware.ts +209 -0
- package/src/preview/workerd-shim.ts +31 -0
- package/src/preview-build.ts +147 -0
- package/src/preview-handler.astro +55 -0
- package/src/preview-handler.d.ts +6 -0
- package/src/preview.ts +22 -0
- package/src/register.ts +180 -0
- package/src/repository.ts +54 -0
- package/src/site-id.ts +86 -0
- package/src/site-middleware.ts +55 -0
- package/src/skill/SKILL.md +69 -0
- package/src/skill.ts +66 -0
- package/src/types.ts +127 -0
- package/src/virtual-modules.d.ts +51 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: conloca-cloud
|
|
3
|
+
description: Load when a Conloca site uses @conloca/cloud-astro — editor endpoint, build token, registrations, preview.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Connecting a site to an editor endpoint
|
|
7
|
+
|
|
8
|
+
`conlocaCloud(...)` from `@conloca/cloud-astro` is an add-on to `conlocaCMS(...)` — keep both in `integrations`. It
|
|
9
|
+
hooks the site's `astro build` to compile the Puck config into an editor bundle, register that build at `endpoint`, and
|
|
10
|
+
produce a draft-preview app. Nothing from it runs on the published site.
|
|
11
|
+
|
|
12
|
+
## First move: `conloca doctor --live`
|
|
13
|
+
|
|
14
|
+
For any question about the editor at `endpoint` — editor not loading, a stale editor after a deploy, "is this branch
|
|
15
|
+
registered?" — run this before reading source:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
CONLOCA_BUILD_TOKEN=cbt_... conloca doctor --live # add CONLOCA_ENDPOINT=https://... when the config computes endpoint
|
|
19
|
+
conloca doctor # offline: config, token, endpoint, inert options
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
This package's checks are `CC1`–`CC8`. Offline: the wiring, the build token, the endpoint and public base URL,
|
|
23
|
+
`conlocaCMS` options the endpoint's editor ignores, and (CC8) whether a static project keeps the preview build off. With
|
|
24
|
+
`--live` (the token goes only to the configured endpoint): the endpoint answers the token, a registration serves this
|
|
25
|
+
branch and site, and the editor bundle that registration names is still deployed.
|
|
26
|
+
|
|
27
|
+
## The one secret: the build token
|
|
28
|
+
|
|
29
|
+
`CONLOCA_BUILD_TOKEN=cbt_<id>.<secret>` is issued by the endpoint and set as a CI secret. It authenticates the build —
|
|
30
|
+
no other setup, no OIDC. Repository identity comes from CI metadata (`GITHUB_REPOSITORY`, Vercel, GitLab) or the git
|
|
31
|
+
remote; `repoUri` is only for non-standard checkouts. The `endpoint` is an https URL with no trailing slash.
|
|
32
|
+
|
|
33
|
+
**Whole-line gotcha:** the endpoint shows and copies the token as the line `CONLOCA_BUILD_TOKEN=cbt_…`. Pasted whole
|
|
34
|
+
into a secret's value, doctor CC2 reports it and the build's registration answers `401`; the token is fine — store only
|
|
35
|
+
the part from `cbt_`.
|
|
36
|
+
|
|
37
|
+
**Rotation gotcha:** creating a new token invalidates the old one. A `401` from the endpoint for a value that does start
|
|
38
|
+
with `cbt_` (doctor CC5) means the CI secret still holds a rotated token — create a new one and update the secret.
|
|
39
|
+
|
|
40
|
+
## The pipeline: build → register → editor
|
|
41
|
+
|
|
42
|
+
1. `astro build` with the token compiles `dist/_conloca/editor-bundle.<hash>.js` and POSTs a registration naming the
|
|
43
|
+
repo, git sha, branch, site id, and the bundle URL + hash.
|
|
44
|
+
2. The editor at `endpoint`, opened on a branch, loads the NEWEST registration for `(branch, site)`.
|
|
45
|
+
3. A build without a prerequisite (token, repo identity, sha/branch, public base URL) does not register; it warns and
|
|
46
|
+
ends with a summary block. Set `requireRegistration: true` in CI to fail such builds. A registration the endpoint
|
|
47
|
+
REJECTS always fails the build.
|
|
48
|
+
|
|
49
|
+
## Three states of a branch (doctor CC6)
|
|
50
|
+
|
|
51
|
+
- **Own registration** — the branch was built with the token; the editor loads its bundle.
|
|
52
|
+
- **Inherited** — no registration for this branch, but the default branch has one: the editor works from that bundle and
|
|
53
|
+
draft preview is degraded. Build the branch with the token to register it.
|
|
54
|
+
- **None** — neither: the editor will not load for this branch. Build it with the token.
|
|
55
|
+
|
|
56
|
+
Doctor may also report older registrations that are not active yet. They become active the next time the editor opens,
|
|
57
|
+
so a branch served only by them is a warning rather than "will not load" — it fails only if that branch has since grown
|
|
58
|
+
a second site.
|
|
59
|
+
|
|
60
|
+
## A deleted bundle (CC7)
|
|
61
|
+
|
|
62
|
+
A registration can outlive its bytes: a later deploy from another branch replaces `dist/`, and the registration still
|
|
63
|
+
points at a bundle URL that now 404s. Nothing else notices — the editor just fails to load. `conloca doctor --live`
|
|
64
|
+
probes the bundle URL the registration names and says so: rebuild and deploy from that branch.
|
|
65
|
+
|
|
66
|
+
## Options with no effect on the endpoint's editor
|
|
67
|
+
|
|
68
|
+
`conlocaCMS`'s `editorStyles` and `editorCSS` configure the local dev editor only. `templates`, `schemasPath`, and
|
|
69
|
+
`mdxComponentFolders` reach the endpoint's editor automatically.
|
package/src/skill.ts
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import { createRequire } from 'node:module';
|
|
3
|
+
import { dirname, join } from 'node:path';
|
|
4
|
+
import { pathToFileURL } from 'node:url';
|
|
5
|
+
import { messageOf } from './message-of.js';
|
|
6
|
+
|
|
7
|
+
export const SKILL_RELATIVE_PATH = join('.claude', 'skills', 'conloca-cloud', 'SKILL.md');
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The canonical page, located from the package root (through the package's own `./package.json` export) so the
|
|
11
|
+
* built `dist/src/skill.js` and the source `src/skill.ts` reach the same shipped `src/skill/SKILL.md`. Resolved on
|
|
12
|
+
* demand, not at import: a copy running outside its package boundary must fail inside scaffoldSkill's
|
|
13
|
+
* fail-soft path, never while the site's Astro config is loading.
|
|
14
|
+
*/
|
|
15
|
+
export function skillTemplateUrl(): URL {
|
|
16
|
+
const packageRoot = dirname(createRequire(import.meta.url).resolve('@conloca/cloud-astro/package.json'));
|
|
17
|
+
return pathToFileURL(join(packageRoot, 'src', 'skill', 'SKILL.md'));
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
type SkillLogger = { info(msg: string): void; debug(msg: string): void };
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* The nearest directory, from the Astro project root up to the git root, that
|
|
24
|
+
* carries a `.claude/`. Repo-root layouts are the real ones: a site's
|
|
25
|
+
* Astro project is usually a workspace member below the repo root. Needs a git
|
|
26
|
+
* root: a project outside any repository gets nothing.
|
|
27
|
+
*/
|
|
28
|
+
export function findClaudeHome(projectRoot: string): string | undefined {
|
|
29
|
+
let dir = projectRoot;
|
|
30
|
+
let home: string | undefined;
|
|
31
|
+
for (;;) {
|
|
32
|
+
if (home === undefined && existsSync(join(dir, '.claude'))) home = dir;
|
|
33
|
+
// The git root bounds the walk; without one there is no repo to scaffold into
|
|
34
|
+
// (a stray ~/.claude must never receive a global copy).
|
|
35
|
+
if (existsSync(join(dir, '.git'))) return home;
|
|
36
|
+
const parent = dirname(dir);
|
|
37
|
+
if (parent === dir) return undefined;
|
|
38
|
+
dir = parent;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Write the skill page once — never overwrite, never throw. A read-only CI
|
|
44
|
+
* checkout must not break a build over documentation.
|
|
45
|
+
*/
|
|
46
|
+
export function scaffoldSkill(projectRoot: string, logger: SkillLogger): 'written' | 'exists' | 'skipped' | 'failed' {
|
|
47
|
+
const home = findClaudeHome(projectRoot);
|
|
48
|
+
if (home === undefined) {
|
|
49
|
+
logger.debug('no .claude/ directory between the project and the git root — agent skill not scaffolded');
|
|
50
|
+
return 'skipped';
|
|
51
|
+
}
|
|
52
|
+
const target = join(home, SKILL_RELATIVE_PATH);
|
|
53
|
+
if (existsSync(target)) return 'exists';
|
|
54
|
+
try {
|
|
55
|
+
mkdirSync(dirname(target), { recursive: true });
|
|
56
|
+
writeFileSync(target, readFileSync(skillTemplateUrl(), 'utf8'), { flag: 'wx' });
|
|
57
|
+
logger.info(`agent skill written to ${target}`);
|
|
58
|
+
return 'written';
|
|
59
|
+
} catch (error) {
|
|
60
|
+
// The exclusive write lost a race with a concurrent build (or a symlink sits
|
|
61
|
+
// at the path): the page is there, which is the truthful outcome.
|
|
62
|
+
if ((error as NodeJS.ErrnoException).code === 'EEXIST') return 'exists';
|
|
63
|
+
logger.info(`agent skill not written to ${target} (${messageOf(error)})`);
|
|
64
|
+
return 'failed';
|
|
65
|
+
}
|
|
66
|
+
}
|
package/src/types.ts
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import type { AstroIntegration } from 'astro';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Configuration for a recursive preview build that runs immediately after the
|
|
5
|
+
* site's production build completes. The preview build emits the SSR routes
|
|
6
|
+
* that serve draft preview.
|
|
7
|
+
*
|
|
8
|
+
* Set to `false` to explicitly opt out of preview builds for sites that do not
|
|
9
|
+
* need a draft/preview pipeline.
|
|
10
|
+
*/
|
|
11
|
+
export interface PreviewBuildOptions {
|
|
12
|
+
/**
|
|
13
|
+
* Optional alternative Astro adapter to use for the preview build.
|
|
14
|
+
* Falls back to the project's default adapter when omitted.
|
|
15
|
+
*/
|
|
16
|
+
adapter?: AstroIntegration;
|
|
17
|
+
/**
|
|
18
|
+
* Adapter-specific config overrides forwarded to the recursive build.
|
|
19
|
+
*/
|
|
20
|
+
config?: Record<string, unknown>;
|
|
21
|
+
/**
|
|
22
|
+
* Output directory for the preview build. Defaults to `.conloca/preview-server`
|
|
23
|
+
* — outside `dist/`, so the secret-baked artifact can never ride a wholesale
|
|
24
|
+
* static upload of the site and Astro's dist-clearing cannot wipe it.
|
|
25
|
+
*/
|
|
26
|
+
outDir?: string;
|
|
27
|
+
/**
|
|
28
|
+
* If true, fail the parent build when the preview build fails. Defaults to
|
|
29
|
+
* true; set false while setting up.
|
|
30
|
+
*/
|
|
31
|
+
required?: boolean;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Options accepted by {@link conlocaCloud}.
|
|
36
|
+
*
|
|
37
|
+
* Registration authenticates with one build token (`cbt_<id>.<secret>`)
|
|
38
|
+
* issued by the endpoint. Repository identity is normally detected from CI metadata or the Git
|
|
39
|
+
* checkout.
|
|
40
|
+
*/
|
|
41
|
+
export interface ConlocaCloudOptions {
|
|
42
|
+
/** Editor endpoint, e.g. 'https://cms.example.com', no trailing slash. */
|
|
43
|
+
endpoint: string;
|
|
44
|
+
/**
|
|
45
|
+
* Advanced override for repository identity, normalized to `owner/repo`.
|
|
46
|
+
* Normally omit this: Conloca detects GitHub, Vercel, or GitLab CI metadata,
|
|
47
|
+
* then falls back to the checkout's `remote.origin.url`. Registration is
|
|
48
|
+
* rejected when the token does not cover the detected repo.
|
|
49
|
+
*/
|
|
50
|
+
repoUri?: string;
|
|
51
|
+
/**
|
|
52
|
+
* Advanced override for the deployable-site id, for CMS-less builds where
|
|
53
|
+
* `conlocaCMS` does not publish CONLOCA_CONTENT_ROOT. When the CMS channel IS
|
|
54
|
+
* present, the content root's sites.json is authoritative and an override
|
|
55
|
+
* that contradicts it fails the build — never a silent pick.
|
|
56
|
+
*/
|
|
57
|
+
siteId?: string;
|
|
58
|
+
/**
|
|
59
|
+
* Build token issued by the endpoint. Prefer injecting it via the
|
|
60
|
+
* CONLOCA_BUILD_TOKEN environment variable instead of committing it here;
|
|
61
|
+
* when neither is present the build skips registration (fail soft, unless
|
|
62
|
+
* `requireRegistration` is set).
|
|
63
|
+
*/
|
|
64
|
+
buildToken?: string;
|
|
65
|
+
/**
|
|
66
|
+
* Entry module of the puck config to compile into the editor bundle,
|
|
67
|
+
* e.g. './src/puck.config.tsx'. Same option name as @conloca/astro-cms.
|
|
68
|
+
*/
|
|
69
|
+
puckConfigPath: string;
|
|
70
|
+
/**
|
|
71
|
+
* Site CSS for accurate preview rendering — same option name and shape
|
|
72
|
+
* as `conlocaCMS({ siteStyles })`, and compiled the same way: by the site's
|
|
73
|
+
* own Vite pipeline (its plugins, PostCSS config and preprocessors), into
|
|
74
|
+
* the canvas stylesheet each build registers, ahead of the
|
|
75
|
+
* component modules, e.g. './src/styles/index.scss'. Paths resolve against
|
|
76
|
+
* the project root. The assets these stylesheets reference are emitted under
|
|
77
|
+
* `/_conloca/`, and an entry that fails to compile fails the build. Component
|
|
78
|
+
* `*.module.(s)css` imports compile in automatically — list here only what
|
|
79
|
+
* lives outside the component graph.
|
|
80
|
+
*/
|
|
81
|
+
siteStyles?: string | string[];
|
|
82
|
+
/**
|
|
83
|
+
* Representative content route for build-time style discovery — the SAME
|
|
84
|
+
* name and meaning as `conlocaCMS`'s option: the page whose styles and
|
|
85
|
+
* content-wrapper shape prose editing should adopt. When set, the build
|
|
86
|
+
* reads that route's rendered page (a prerendered file, or the booted node
|
|
87
|
+
* server entry), collects its CSS and wrapper shape, and registers them
|
|
88
|
+
* alongside the bundle. Unset: discovery is skipped and the editor falls
|
|
89
|
+
* back to the prose-safe derived tier.
|
|
90
|
+
*
|
|
91
|
+
* @example '/blog/welcome-post'
|
|
92
|
+
*/
|
|
93
|
+
fragmentPreviewRoute?: string;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Public base URL of the deployed site, used to absolutize the editor
|
|
97
|
+
* bundle URL when no dedicated preview domain is configured. Falls back to
|
|
98
|
+
* the CF_PAGES_URL env var; without either, registration is skipped.
|
|
99
|
+
*/
|
|
100
|
+
publicBaseUrl?: string;
|
|
101
|
+
/**
|
|
102
|
+
* Optional dedicated preview deployment as a hostname or absolute URL. A
|
|
103
|
+
* hostname is normalized to HTTPS. When set, editor assets and preview links
|
|
104
|
+
* use this deployment instead of the production site's public base URL.
|
|
105
|
+
*/
|
|
106
|
+
previewDomain?: string;
|
|
107
|
+
/**
|
|
108
|
+
* Recursive preview build configuration. Set to `false` to opt out.
|
|
109
|
+
* Defaults to enabled with project defaults.
|
|
110
|
+
*/
|
|
111
|
+
previewBuild?: PreviewBuildOptions | false;
|
|
112
|
+
/**
|
|
113
|
+
* The token issuer (the JWT `iss` the preview middleware pins).
|
|
114
|
+
* Set it to bake the value into the preview artifact; otherwise the
|
|
115
|
+
* deployment must supply `CONLOCA_SAAS_ISSUER` at runtime.
|
|
116
|
+
*/
|
|
117
|
+
saasIssuer?: string;
|
|
118
|
+
/**
|
|
119
|
+
* Fail the build when registration is SKIPPED for a missing prerequisite
|
|
120
|
+
* (no build token, no repository identity, no git sha/branch, no public
|
|
121
|
+
* base URL). Default false, so a plain `astro build` without the token
|
|
122
|
+
* stays untouched. Turn it on in CI once setup is done: a deploy can
|
|
123
|
+
* then never silently leave the editor at the endpoint stale. An ATTEMPTED
|
|
124
|
+
* registration that fails always fails the build, regardless of this.
|
|
125
|
+
*/
|
|
126
|
+
requireRegistration?: boolean;
|
|
127
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ambient declaration for the build-time virtual module the integration serves.
|
|
3
|
+
*
|
|
4
|
+
* Kept in its OWN file with no top-level import/export: in a module (a file
|
|
5
|
+
* that imports or exports anything), a `declare module` is treated as
|
|
6
|
+
* augmenting an existing module rather than declaring a new ambient one.
|
|
7
|
+
*
|
|
8
|
+
* `virtual:conloca-preview-opts` carries the preview middleware's configuration
|
|
9
|
+
* baked in during the recursive preview build, so a preview deployment needs no
|
|
10
|
+
* runtime env vars. It resolves to `{}` outside that build.
|
|
11
|
+
*/
|
|
12
|
+
declare module 'virtual:conloca-preview-opts' {
|
|
13
|
+
const baked: {
|
|
14
|
+
secret?: string;
|
|
15
|
+
saasEndpoint?: string;
|
|
16
|
+
saasIssuer?: string;
|
|
17
|
+
saasAudience?: string;
|
|
18
|
+
};
|
|
19
|
+
export default baked;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* The routing config astro-cms's vite plugin serves to the site build. The
|
|
24
|
+
* middleware entry is compiled INTO the site's build graph (addMiddleware
|
|
25
|
+
* entrypoint), where the module resolves; this declaration only teaches tsc.
|
|
26
|
+
*/
|
|
27
|
+
declare module 'virtual:conloca-routing-config' {
|
|
28
|
+
import type { ResolvedRoutingConfig } from '@conloca/astro-cms';
|
|
29
|
+
|
|
30
|
+
const config: ResolvedRoutingConfig;
|
|
31
|
+
export default config;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Astro's content-collections module, resolvable only inside a site build.
|
|
36
|
+
* Declared with the narrow surface the middleware entry consumes (the same
|
|
37
|
+
* projection `createCollectionBackedContentAPI` expects).
|
|
38
|
+
*/
|
|
39
|
+
declare module 'astro:content' {
|
|
40
|
+
export function getCollection(collection: string): Promise<{ data: Record<string, unknown> }[]>;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* The Cloudflare Workers runtime module (bindings live here since Astro v6
|
|
45
|
+
* removed `locals.runtime.env`). Only resolvable inside workerd; the preview
|
|
46
|
+
* middleware imports it dynamically and treats a failed import as "not on
|
|
47
|
+
* Cloudflare Workers". Declared with the narrow surface consumed (the env bag).
|
|
48
|
+
*/
|
|
49
|
+
declare module 'cloudflare:workers' {
|
|
50
|
+
export const env: Record<string, unknown>;
|
|
51
|
+
}
|