@conloca/cloud-astro 0.2.3 → 0.2.4
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 +155 -37
- package/dist/.build-inputs.json +32 -23
- package/dist/src/constants.d.ts +12 -3
- package/dist/src/constants.d.ts.map +1 -1
- package/dist/src/constants.js +12 -3
- package/dist/src/constants.js.map +1 -1
- package/dist/src/d3-build.d.ts +70 -0
- package/dist/src/d3-build.d.ts.map +1 -0
- package/dist/src/d3-build.js +272 -0
- package/dist/src/d3-build.js.map +1 -0
- package/dist/src/descriptors.d.ts.map +1 -1
- package/dist/src/descriptors.js +4 -2
- package/dist/src/descriptors.js.map +1 -1
- package/dist/src/doctor/checks-live.d.ts +2 -2
- package/dist/src/doctor/checks-live.d.ts.map +1 -1
- package/dist/src/doctor/checks-live.js +10 -4
- package/dist/src/doctor/checks-live.js.map +1 -1
- package/dist/src/doctor/checks-offline.d.ts +1 -5
- package/dist/src/doctor/checks-offline.d.ts.map +1 -1
- package/dist/src/doctor/checks-offline.js +15 -27
- package/dist/src/doctor/checks-offline.js.map +1 -1
- package/dist/src/doctor/checks-preview-limits.d.ts +11 -0
- package/dist/src/doctor/checks-preview-limits.d.ts.map +1 -0
- package/dist/src/doctor/checks-preview-limits.js +133 -0
- package/dist/src/doctor/checks-preview-limits.js.map +1 -0
- package/dist/src/doctor/checks-preview-live.d.ts +14 -0
- package/dist/src/doctor/checks-preview-live.d.ts.map +1 -0
- package/dist/src/doctor/checks-preview-live.js +72 -0
- package/dist/src/doctor/checks-preview-live.js.map +1 -0
- package/dist/src/doctor/checks-preview.d.ts +7 -0
- package/dist/src/doctor/checks-preview.d.ts.map +1 -0
- package/dist/src/doctor/checks-preview.js +287 -0
- package/dist/src/doctor/checks-preview.js.map +1 -0
- package/dist/src/doctor/config-scan.d.ts +6 -0
- package/dist/src/doctor/config-scan.d.ts.map +1 -1
- package/dist/src/doctor/config-scan.js +17 -0
- package/dist/src/doctor/config-scan.js.map +1 -1
- package/dist/src/doctor/run.d.ts.map +1 -1
- package/dist/src/doctor/run.js +4 -0
- package/dist/src/doctor/run.js.map +1 -1
- package/dist/src/doctor/types.d.ts +11 -1
- package/dist/src/doctor/types.d.ts.map +1 -1
- package/dist/src/doctor/types.js +11 -1
- package/dist/src/doctor/types.js.map +1 -1
- package/dist/src/editor-page/bundle.d.ts +2 -0
- package/dist/src/editor-page/bundle.d.ts.map +1 -1
- package/dist/src/editor-page/bundle.js +3 -0
- package/dist/src/editor-page/bundle.js.map +1 -1
- package/dist/src/editor-page/data-schemas.d.ts +16 -0
- package/dist/src/editor-page/data-schemas.d.ts.map +1 -0
- package/dist/src/editor-page/data-schemas.js +39 -0
- package/dist/src/editor-page/data-schemas.js.map +1 -0
- package/dist/src/editor-page/emit.d.ts +37 -1
- package/dist/src/editor-page/emit.d.ts.map +1 -1
- package/dist/src/editor-page/emit.js +75 -4
- package/dist/src/editor-page/emit.js.map +1 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +2 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/integration.d.ts.map +1 -1
- package/dist/src/integration.js +165 -41
- package/dist/src/integration.js.map +1 -1
- package/dist/src/preview/_dispatch.d.ts +12 -0
- package/dist/src/preview/_dispatch.d.ts.map +1 -1
- package/dist/src/preview/_dispatch.js +31 -0
- package/dist/src/preview/_dispatch.js.map +1 -1
- package/dist/src/preview/_resolve-opts.d.ts +3 -0
- package/dist/src/preview/_resolve-opts.d.ts.map +1 -1
- package/dist/src/preview/_resolve-opts.js +3 -1
- package/dist/src/preview/_resolve-opts.js.map +1 -1
- package/dist/src/preview/banner.d.ts +12 -9
- package/dist/src/preview/banner.d.ts.map +1 -1
- package/dist/src/preview/banner.js +46 -41
- package/dist/src/preview/banner.js.map +1 -1
- package/dist/src/preview/cloudflare-adapter.d.ts +35 -0
- package/dist/src/preview/cloudflare-adapter.d.ts.map +1 -0
- package/dist/src/preview/cloudflare-adapter.js +92 -0
- package/dist/src/preview/cloudflare-adapter.js.map +1 -0
- package/dist/src/preview/cookie.d.ts +9 -13
- package/dist/src/preview/cookie.d.ts.map +1 -1
- package/dist/src/preview/cookie.js +15 -25
- package/dist/src/preview/cookie.js.map +1 -1
- package/dist/src/preview/dispatcher.d.ts +73 -0
- package/dist/src/preview/dispatcher.d.ts.map +1 -0
- package/dist/src/preview/dispatcher.js +329 -0
- package/dist/src/preview/dispatcher.js.map +1 -0
- package/dist/src/preview/entry-code.d.ts +33 -0
- package/dist/src/preview/entry-code.d.ts.map +1 -0
- package/dist/src/preview/entry-code.js +33 -0
- package/dist/src/preview/entry-code.js.map +1 -0
- package/dist/src/preview/headers.d.ts +24 -4
- package/dist/src/preview/headers.d.ts.map +1 -1
- package/dist/src/preview/headers.js +35 -7
- package/dist/src/preview/headers.js.map +1 -1
- package/dist/src/preview/landing.d.ts +21 -0
- package/dist/src/preview/landing.d.ts.map +1 -1
- package/dist/src/preview/landing.js +103 -35
- package/dist/src/preview/landing.js.map +1 -1
- package/dist/src/preview/middleware.d.ts +29 -7
- package/dist/src/preview/middleware.d.ts.map +1 -1
- package/dist/src/preview/middleware.js +238 -84
- package/dist/src/preview/middleware.js.map +1 -1
- package/dist/src/preview/preview-path.d.ts +29 -0
- package/dist/src/preview/preview-path.d.ts.map +1 -1
- package/dist/src/preview/preview-path.js +41 -0
- package/dist/src/preview/preview-path.js.map +1 -1
- package/dist/src/preview/redeem-url.d.ts +7 -0
- package/dist/src/preview/redeem-url.d.ts.map +1 -0
- package/dist/src/preview/redeem-url.js +14 -0
- package/dist/src/preview/redeem-url.js.map +1 -0
- package/dist/src/preview/site-middleware.d.ts.map +1 -1
- package/dist/src/preview/site-middleware.js +39 -12
- package/dist/src/preview/site-middleware.js.map +1 -1
- package/dist/src/preview-build.d.ts +19 -8
- package/dist/src/preview-build.d.ts.map +1 -1
- package/dist/src/preview-build.js +47 -21
- package/dist/src/preview-build.js.map +1 -1
- package/dist/src/skill.d.ts +11 -0
- package/dist/src/skill.d.ts.map +1 -1
- package/dist/src/skill.js +32 -9
- package/dist/src/skill.js.map +1 -1
- package/dist/src/types.d.ts +15 -12
- package/dist/src/types.d.ts.map +1 -1
- package/package.json +33 -7
- package/src/constants.ts +14 -3
- package/src/d3-build.ts +315 -0
- package/src/descriptors.ts +4 -2
- package/src/doctor/checks-live.ts +10 -4
- package/src/doctor/checks-offline.ts +16 -25
- package/src/doctor/checks-preview-limits.ts +137 -0
- package/src/doctor/checks-preview-live.ts +77 -0
- package/src/doctor/checks-preview.ts +302 -0
- package/src/doctor/config-scan.ts +14 -0
- package/src/doctor/run.ts +4 -0
- package/src/doctor/types.ts +11 -1
- package/src/editor-page/bundle.ts +5 -0
- package/src/editor-page/data-schemas.ts +47 -0
- package/src/editor-page/emit.ts +124 -8
- package/src/index.ts +2 -0
- package/src/integration.ts +176 -40
- package/src/preview/_dispatch.ts +36 -1
- package/src/preview/_resolve-opts.ts +6 -1
- package/src/preview/banner.ts +61 -41
- package/src/preview/cloudflare-adapter.ts +103 -0
- package/src/preview/cookie.ts +14 -23
- package/src/preview/dispatcher.ts +407 -0
- package/src/preview/entry-code.ts +51 -0
- package/src/preview/headers.ts +35 -7
- package/src/preview/landing.ts +115 -37
- package/src/preview/middleware.ts +264 -88
- package/src/preview/preview-path.ts +57 -0
- package/src/preview/redeem-url.ts +14 -0
- package/src/preview/site-middleware.ts +47 -12
- package/src/preview-build.ts +67 -24
- package/src/preview-handler.astro +2 -1
- package/src/skill/SKILL.md +14 -2
- package/src/skill.ts +36 -8
- package/src/types.ts +15 -12
package/README.md
CHANGED
|
@@ -6,13 +6,15 @@ Astro integration that adds the editor page for Conloca's workspace editor to a
|
|
|
6
6
|
1. Write the editor page to `/_conloca/editor/` in every build: the site's Puck config compiled into one bundle
|
|
7
7
|
(react/react-dom/jsx-runtime/`@puckeditor/core` stay external — the workspace editor supplies them at runtime), its
|
|
8
8
|
styles, the MDX sandbox frame and `conloca.json`. The page carries no credential.
|
|
9
|
-
2. When `previewBuild` is given as an object,
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
2. When `previewBuild` is given as an object, build the preview server that renders drafts: next to a static site on
|
|
10
|
+
Cloudflare Workers (under `/_conloca/preview/<branch>/`), on the site's own server deploy, or as a separate deploy.
|
|
11
|
+
3. Wire preview middleware that admits only passes signed by the endpoint, for the repository, site and branch the
|
|
12
|
+
preview build was made from.
|
|
12
13
|
4. Expose `PreviewContentAPI` for `.astro` pages to fetch draft content.
|
|
14
|
+
5. Show share links: a viewer sees who shared the draft and when the link expires; an expired, turned-off, published or
|
|
15
|
+
discarded link shows its own page.
|
|
13
16
|
|
|
14
|
-
Items 2 to
|
|
15
|
-
`previewBuild` is given as an object (see [Draft previews](#draft-previews)).
|
|
17
|
+
Items 2 to 5 stay off unless `previewBuild` is given as an object (see [Draft previews](#draft-previews)).
|
|
16
18
|
|
|
17
19
|
## Setup
|
|
18
20
|
|
|
@@ -81,9 +83,9 @@ export default defineConfig({
|
|
|
81
83
|
|
|
82
84
|
By hand: on a site without `conlocaCMS`, run `npx @conloca/cli astro setup` first. Then
|
|
83
85
|
`bun add @conloca/astro-cms @conloca/cloud-astro` (plus the React peers), add `conlocaCloud()` right after
|
|
84
|
-
`conlocaCMS(...)`, and follow steps 2 and 3. `@conloca/cloud-astro` needs Astro 7.3.1 or a later 7.x release, and
|
|
85
|
-
`@conloca/astro-cms
|
|
86
|
-
|
|
86
|
+
`conlocaCMS(...)`, and follow steps 2 and 3. `@conloca/cloud-astro` needs Astro 7.3.1 or a later 7.x release, and a
|
|
87
|
+
matching `@conloca/astro-cms`: each `@conloca/*` package has its own version, so use `conloca upgrade` to move them to
|
|
88
|
+
the versions one CLI release pins.
|
|
87
89
|
|
|
88
90
|
### 2. Your site's host in `sites.json`
|
|
89
91
|
|
|
@@ -173,8 +175,19 @@ uses the deploy whose code is closest to the branch's latest commit, among the b
|
|
|
173
175
|
branch's and a build of the branch it was created from (on a tie, in that order), and the editor says which; see
|
|
174
176
|
[Branch deploys](#branch-deploys).
|
|
175
177
|
|
|
176
|
-
`/_conloca/editor/conloca.json` publishes the repository's name
|
|
177
|
-
|
|
178
|
+
`/_conloca/editor/conloca.json` publishes the repository's name, the build's branch and commit, and whether the build
|
|
179
|
+
serves draft previews with the preview protocol it speaks (`preview`: `{ "mode": "d3", "protocol": 2 }` for a static
|
|
180
|
+
site with `previewBuild`, `d2` with an adapter, `d4` with `separate: true`, else `off`). If the repository is not
|
|
181
|
+
public, its name becomes public with the deploy. Protocol 2 opens a preview with a single-use `conloca_code` link that
|
|
182
|
+
the preview server trades for the pass with Conloca; a link that carries the pass itself (`conloca_preview`, protocol 1)
|
|
183
|
+
still opens in this release and stops opening in the next.
|
|
184
|
+
|
|
185
|
+
`conloca.json` also lists the build's prerendered page routes (`routes`, at most 500 and within 16 KiB for the whole
|
|
186
|
+
file), which the workspace editor offers when a site has no Conloca pages yet; they are public with the deploy, like the
|
|
187
|
+
pages themselves.
|
|
188
|
+
|
|
189
|
+
`/_conloca/editor/data-schemas.json` publishes the JSON schema of each `dataSchemas` collection, the metadata the
|
|
190
|
+
editor's entry forms already use, so agents can write data entries that match.
|
|
178
191
|
|
|
179
192
|
### CI example (GitHub Actions)
|
|
180
193
|
|
|
@@ -311,15 +324,15 @@ Doctor names each check; the checklist in the workspace editor reports the same
|
|
|
311
324
|
|
|
312
325
|
## Options
|
|
313
326
|
|
|
314
|
-
| Name | Required | Description
|
|
315
|
-
| ---------------- | -------- |
|
|
316
|
-
| `endpoint` | no | The workspace editor's address, scheme and host only, no trailing slash; its host must start with `app.`. Defaults to `https://app.conloca.com`.
|
|
317
|
-
| `puckConfigPath` | no | Puck config entry to compile. Defaults to the value `conlocaCMS` was given.
|
|
318
|
-
| `repoUri` | no | Advanced `owner/repo` override; normally detected from CI or the Git remote.
|
|
319
|
-
| `siteId` | no | Advanced site-id override for CMS-less builds; sites.json is authoritative.
|
|
320
|
-
| `siteStyles` | no | Site CSS compiled into the canvas stylesheet, as in `conlocaCMS`.
|
|
321
|
-
| `previewBuild` | no | `PreviewBuildOptions` or `false`. Off unless given as an object
|
|
322
|
-
| `saasIssuer` | no | Draft previews only. JWT `iss`
|
|
327
|
+
| Name | Required | Description |
|
|
328
|
+
| ---------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
329
|
+
| `endpoint` | no | The workspace editor's address, scheme and host only, no trailing slash; its host must start with `app.`. Defaults to `https://app.conloca.com`. |
|
|
330
|
+
| `puckConfigPath` | no | Puck config entry to compile. Defaults to the value `conlocaCMS` was given. |
|
|
331
|
+
| `repoUri` | no | Advanced `owner/repo` override; normally detected from CI or the Git remote. |
|
|
332
|
+
| `siteId` | no | Advanced site-id override for CMS-less builds; sites.json is authoritative. |
|
|
333
|
+
| `siteStyles` | no | Site CSS compiled into the canvas stylesheet, as in `conlocaCMS`. |
|
|
334
|
+
| `previewBuild` | no | `PreviewBuildOptions` or `false`. Off unless given as an object. See [Draft previews](#draft-previews). Refused under `@astrojs/vercel` and `@astrojs/netlify`. |
|
|
335
|
+
| `saasIssuer` | no | Draft previews only. Pins the JWT `iss` every pass must name; unset, passes are checked against the endpoint's keys alone. |
|
|
323
336
|
|
|
324
337
|
The `conlocaCMS` options `schemasPath`, `mdxComponentFolders`, `templates`, the `routing` data bindings, `editorStyles`
|
|
325
338
|
and `editorCSS` reach the editor page automatically: the CMS publishes what it resolved, and the editor page renders
|
|
@@ -336,34 +349,139 @@ they did before.
|
|
|
336
349
|
|
|
337
350
|
## Draft previews
|
|
338
351
|
|
|
339
|
-
|
|
340
|
-
|
|
352
|
+
The editor's Preview button opens the draft on your site. How depends on the site:
|
|
353
|
+
|
|
354
|
+
| Your site | `previewBuild` | Where drafts render |
|
|
355
|
+
| ---------------------------------------------------------------------- | -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
356
|
+
| Static, deployed to Cloudflare Workers | `{}` | Next to the site: a dispatcher runs only on `/_conloca/preview/*` and your on-demand routes. Every other page stays a static file, and no visitor to it starts a Worker |
|
|
357
|
+
| Static, on another host, or on Cloudflare without a domain of your own | `{ separate: true }` | A separate preview deploy; its address goes in `sites.json` `previewUrl` |
|
|
358
|
+
| Server-rendered (`@astrojs/cloudflare`, `@astrojs/node`) | `{}` | Your own deploy |
|
|
359
|
+
|
|
360
|
+
### Next to a static site on Cloudflare Workers
|
|
361
|
+
|
|
362
|
+
Install `@astrojs/cloudflare` and add `previewBuild: {}` to `conlocaCloud(...)`, then run `npx @conloca/cli connect`. It
|
|
363
|
+
asks once whether your account is on the Cloudflare Workers Paid plan (pass `--cf-plan free` or `--cf-plan paid` when no
|
|
364
|
+
one is at the terminal) and records the answer in `package.json` (`"conloca": { "cfPlan": "paid" }`). It writes
|
|
365
|
+
`wrangler.jsonc`; on the Paid plan it adds the `ratelimits` entry below (Wrangler 4.36 or newer), on the Free plan it
|
|
366
|
+
leaves it out:
|
|
367
|
+
|
|
368
|
+
```jsonc
|
|
369
|
+
{
|
|
370
|
+
"main": ".conloca/dispatcher/index.mjs",
|
|
371
|
+
"compatibility_flags": ["nodejs_compat"],
|
|
372
|
+
"assets": {
|
|
373
|
+
"directory": "./dist",
|
|
374
|
+
"binding": "ASSETS",
|
|
375
|
+
"not_found_handling": "404-page",
|
|
376
|
+
"run_worker_first": ["/_conloca/preview", "/_conloca/preview/*"],
|
|
377
|
+
},
|
|
378
|
+
"ratelimits": [
|
|
379
|
+
{ "name": "conlocaPreviewLimit", "namespace_id": "<chosen by connect>", "simple": { "limit": 60, "period": 10 } },
|
|
380
|
+
],
|
|
381
|
+
}
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
`run_worker_first` also lists every route the preview build renders on demand (API routes, Actions, and `/_image` for
|
|
385
|
+
draft images). Every build checks the list, and on the Paid plan the rate limit, and fails with "run
|
|
386
|
+
`conloca connect --update --yes`" when one is missing, so an API route can never silently 404 in production. A
|
|
387
|
+
`wrangler.toml` can't carry these settings: convert it to `wrangler.jsonc` first. Keep `main` and `assets` out of
|
|
388
|
+
`env.<name>` blocks; both are inherited from the top level. To try previews locally, run
|
|
389
|
+
`wrangler dev --local-protocol https`: Safari refuses the preview's `Secure` cookies on plain-http `localhost`.
|
|
390
|
+
|
|
391
|
+
A static site can't hold an on-demand route itself: Astro refuses `export const prerender = false` without an adapter,
|
|
392
|
+
and an adapter would make the site preview from its own server deploy instead. Add such a route to the preview build
|
|
393
|
+
only, which runs with `CONLOCA_PREVIEW_BUILD=1`: the dispatcher then serves it next to the static site, and the build
|
|
394
|
+
reports it for `run_worker_first`. Keep its file outside `src/pages`:
|
|
395
|
+
|
|
396
|
+
```js
|
|
397
|
+
export default defineConfig({
|
|
398
|
+
integrations: [
|
|
399
|
+
// ...conlocaCMS(...), conlocaCloud({ previewBuild: {} }),
|
|
400
|
+
...(process.env.CONLOCA_PREVIEW_BUILD === '1'
|
|
401
|
+
? [
|
|
402
|
+
{
|
|
403
|
+
name: 'preview-only-routes',
|
|
404
|
+
hooks: {
|
|
405
|
+
'astro:config:setup': ({ injectRoute }) =>
|
|
406
|
+
injectRoute({ pattern: '/api/ping', entrypoint: './src/api/ping.ts', prerender: false }),
|
|
407
|
+
},
|
|
408
|
+
},
|
|
409
|
+
]
|
|
410
|
+
: []),
|
|
411
|
+
],
|
|
412
|
+
});
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
If the preview build fails and `run_worker_first` lists only the two preview entries, the site still builds and deploys,
|
|
416
|
+
and `/_conloca/preview/` answers "Preview couldn't load the draft". If it also lists your on-demand routes, or
|
|
417
|
+
`not_found_handling` is `"none"`, the build fails instead: the preview server is what serves those routes, and shipping
|
|
418
|
+
without it would break them.
|
|
419
|
+
|
|
420
|
+
On the Cloudflare Workers Paid plan the dispatcher limits each visitor to 60 requests under `/_conloca/preview/` per 10
|
|
421
|
+
seconds (the `ratelimits` binding, counted per Cloudflare location and approximately) and answers "Too many preview
|
|
422
|
+
requests — try again in a few seconds" over it. On the Free plan there is no limit: a blocked request would still count
|
|
423
|
+
against the day's requests, so a limit adds nothing there. A flood can then use up the day's requests and pause preview
|
|
424
|
+
until 00:00 UTC, but never the published pages, which don't run the dispatcher. A site with on-demand routes (API
|
|
425
|
+
routes, `/mcp`) still previews next to itself on the Free plan, since those routes need the dispatcher too, and
|
|
426
|
+
`conloca connect` and doctor (CC23) warn that previews and those routes share one daily request quota: a flood of
|
|
427
|
+
preview requests can stop those routes until 00:00 UTC. Cloudflare Workers Paid removes the daily limit. A rate-limiting
|
|
428
|
+
rule on `/_conloca/preview/*` in the Cloudflare dashboard (Security → WAF) stops a flood before it reaches the
|
|
429
|
+
dispatcher; it is optional, and doctor doesn't check it.
|
|
430
|
+
|
|
431
|
+
Not suited to this mode: sites that navigate on the client (view transitions, `navigate()`), call same-origin APIs that
|
|
432
|
+
should see drafts, load third-party tags that must not see draft content, open same-origin pages from scripts
|
|
433
|
+
(`window.open` would let the opener read a draft), or register a service worker that handles navigations (it would see
|
|
434
|
+
draft pages, and could cache them or answer published ones). Use a separate preview deploy.
|
|
435
|
+
|
|
436
|
+
### A separate preview deploy
|
|
437
|
+
|
|
438
|
+
Set `previewBuild: { separate: true }`. Your build then runs no preview build. Add a second deploy (for example a second
|
|
439
|
+
Cloudflare Workers Builds project) that builds with `CONLOCA_PREVIEW_BUILD=1 CLOUDFLARE_ENV=preview` before your build
|
|
440
|
+
command (`CLOUDFLARE_ENV` picks the Wrangler environment at build time, not at deploy) and deploys with a plain
|
|
441
|
+
`wrangler deploy`. Put its address in `sites.json`:
|
|
442
|
+
|
|
443
|
+
```json
|
|
444
|
+
{ "sites": { "default": { "previewUrl": { "en": "https://preview.example.com" } } } }
|
|
445
|
+
```
|
|
446
|
+
|
|
447
|
+
A workspace admin confirms the address in the editor once; from then on every preview link opens there.
|
|
341
448
|
|
|
342
449
|
## Doctor
|
|
343
450
|
|
|
344
451
|
This package is a `conloca doctor` extension (`conloca.doctor` in package.json): `conloca doctor` in a project that
|
|
345
452
|
depends on it runs this package's checks after the CMS ones, offline by default.
|
|
346
453
|
|
|
347
|
-
| Check | What it verifies
|
|
348
|
-
| ----- |
|
|
349
|
-
| CC1 | `conlocaCloud(...)` is wired next to `conlocaCMS(...)` (an absent `conlocaCMS` is an error); notes that the deployed `conloca.json` publishes the repository's name
|
|
350
|
-
| CC8 |
|
|
351
|
-
| CC9 | `sites.json` gives the site named `default` (or the only site) a bare host in `domains[defaultLocale]` and a valid `base`; Astro's `site` and `base`, when the config shows them, agree (warnings)
|
|
352
|
-
| CC10 | No committed `public/_headers`, `netlify.toml` or `vercel.json` sets `X-Frame-Options` or `frame-ancestors` for the whole site without a `/_conloca/editor/` rule; the error carries the rule to add
|
|
353
|
-
| CC11 | `--live`: `<host><base>_conloca/editor/conloca.json` is deployed, public, and names this repository and site; warns when it serves another commit than your checkout
|
|
354
|
-
| CC12 | `--live`: the deployed `/_conloca/editor/` may be framed by `https://*.conloca.com` and its `script-src` allows the editor's origin
|
|
355
|
-
| CC13 | `--live`: the page's protocol is in the range the editor publishes at `/host/protocols.json`
|
|
356
|
-
| CC14 | No tracked workflow and not the astro config still names `CONLOCA_BUILD_TOKEN`, `buildToken`, `publicBaseUrl`, `previewDomain` or `requireRegistration` (warnings)
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
`
|
|
454
|
+
| Check | What it verifies |
|
|
455
|
+
| ----- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
456
|
+
| CC1 | `conlocaCloud(...)` is wired next to `conlocaCMS(...)` (an absent `conlocaCMS` is an error); notes that the deployed `conloca.json` publishes the repository's name |
|
|
457
|
+
| CC8 | How the preview build serves drafts: next to a static site on Cloudflare Workers (D3), from the site's own server deploy (D2), or a separate deploy (D4) |
|
|
458
|
+
| CC9 | `sites.json` gives the site named `default` (or the only site) a bare host in `domains[defaultLocale]` and a valid `base`; Astro's `site` and `base`, when the config shows them, agree (warnings) |
|
|
459
|
+
| CC10 | No committed `public/_headers`, `netlify.toml` or `vercel.json` sets `X-Frame-Options` or `frame-ancestors` for the whole site without a `/_conloca/editor/` rule; the error carries the rule to add |
|
|
460
|
+
| CC11 | `--live`: `<host><base>_conloca/editor/conloca.json` is deployed, public, and names this repository and site; warns when it serves another commit than your checkout |
|
|
461
|
+
| CC12 | `--live`: the deployed `/_conloca/editor/` may be framed by `https://*.conloca.com` and its `script-src` allows the editor's origin |
|
|
462
|
+
| CC13 | `--live`: the page's protocol is in the range the editor publishes at `/host/protocols.json` |
|
|
463
|
+
| CC14 | No tracked workflow and not the astro config still names `CONLOCA_BUILD_TOKEN`, `buildToken`, `publicBaseUrl`, `previewDomain` or `requireRegistration` (warnings) |
|
|
464
|
+
| CC15 | D3/D4: a `wrangler.jsonc` deploys to Cloudflare Workers, not Pages; a `wrangler.toml` is asked to become `wrangler.jsonc` |
|
|
465
|
+
| CC16 | D3: the project's wrangler is 4.36 or newer (`run_worker_first` patterns and the `ratelimits` binding); a warning when it is not installed |
|
|
466
|
+
| CC17 | D3: `main` is the dispatcher, `nodejs_compat` is on, assets bind as `ASSETS`, `run_worker_first` covers the preview route (no `!` exclusion, at most 100 entries), no env block replaces `main` or `assets`, and 404 handling is not single-page-application. D4: `main` no longer names the D3 dispatcher, and without a `main` there is no assets `binding` and no `run_worker_first`, which Wrangler refuses on an assets-only deploy |
|
|
467
|
+
| CC18 | D3: `run_worker_first` lists every route the last build renders on demand |
|
|
468
|
+
| CC19 | D3: no `.wrangler/deploy/config.json` points a plain `wrangler deploy` at the preview server |
|
|
469
|
+
| CC20 | D3 (warning): the site has a 404 page (read from the build when there is one), unless `not_found_handling` is `"none"`; a middleware that negotiates responses gets the `"none"`-or-static choice |
|
|
470
|
+
| CC21 | D3: no tracked file loads a tag manager, which would run on draft pages (warning; recommends `separate: true`) |
|
|
471
|
+
| CC22 | D3, Paid plan (or none recorded): `wrangler.jsonc` (and every `env` block in it) has the `conlocaPreviewLimit` rate-limit binding at 60 requests per 10 s. Free plan: none expected, and one that is there is only noted. A rule in the Cloudflare dashboard is optional and not checked |
|
|
472
|
+
| CC23 | D3: `package.json` records the Cloudflare plan (`conloca.cfPlan`); on Free, a warning: with on-demand routes, that previews and those routes share one daily request quota |
|
|
473
|
+
| CC24 | `--live`, D4: `previewUrl`'s `conloca.json` answers as D4 and names the site's release |
|
|
474
|
+
|
|
475
|
+
`conloca doctor` reads the rate-limit binding and the recorded plan from your project's files; it never contacts
|
|
476
|
+
Cloudflare and needs no token. `conloca doctor --live` sends no credential: it contacts your site's host, its
|
|
477
|
+
`previewUrl` and the editor's public `/host/protocols.json`. When the config computes `endpoint` (for example from an
|
|
478
|
+
environment variable), set `CONLOCA_ENDPOINT` so doctor can read it.
|
|
361
479
|
|
|
362
480
|
The integration also scaffolds a one-page agent skill at `.claude/skills/conloca-cloud/SKILL.md` — in the nearest
|
|
363
481
|
`.claude/` directory between the Astro project and the git root — on any Astro command that loads the config (build,
|
|
364
482
|
dev, sync, check), once, never overwriting an existing file. Repos without a `.claude/` directory get nothing. Projects
|
|
365
|
-
outside a git repository get nothing either.
|
|
366
|
-
|
|
483
|
+
outside a git repository get nothing either. `conloca upgrade` refreshes it; an edited page is kept and the new one
|
|
484
|
+
written beside it as `SKILL.new.md`.
|
|
367
485
|
|
|
368
486
|
## Tests
|
|
369
487
|
|
package/dist/.build-inputs.json
CHANGED
|
@@ -2,48 +2,57 @@
|
|
|
2
2
|
"version": 1,
|
|
3
3
|
"files": {
|
|
4
4
|
"packages/cloud-astro/src/component-manifest.ts": "a044ac5b228b5f80d96f886affa86345decfd5738e2878ec098b8f4a77b58843",
|
|
5
|
-
"packages/cloud-astro/src/constants.ts": "
|
|
6
|
-
"packages/cloud-astro/src/
|
|
5
|
+
"packages/cloud-astro/src/constants.ts": "74ba5798175b395c4a16ddd31af0a04edd6bfaec550a7cf29cd85bdbfd7ebc8c",
|
|
6
|
+
"packages/cloud-astro/src/d3-build.ts": "0c5fb002a594a55c9ca3074b138b08fbd18b7aa8ce49a0a2b73070d8c54b765b",
|
|
7
|
+
"packages/cloud-astro/src/descriptors.ts": "73fe59f781ffcaee3a7ed3e552d3c4d3c52615c07f4b9cdb54e8fe12a4e14941",
|
|
7
8
|
"packages/cloud-astro/src/doctor.ts": "4181a530feba74a4316a790b42d4c22d717de696718e848c12378e403fd2d84a",
|
|
8
9
|
"packages/cloud-astro/src/doctor/checks-address.ts": "ce1735bcd468deb5628761e2314d23d613b16c3c976f3bb6cd3fb67e12f2c8d6",
|
|
9
|
-
"packages/cloud-astro/src/doctor/checks-live.ts": "
|
|
10
|
-
"packages/cloud-astro/src/doctor/checks-offline.ts": "
|
|
11
|
-
"packages/cloud-astro/src/doctor/
|
|
12
|
-
"packages/cloud-astro/src/doctor/
|
|
13
|
-
"packages/cloud-astro/src/doctor/
|
|
14
|
-
"packages/cloud-astro/src/
|
|
15
|
-
"packages/cloud-astro/src/
|
|
10
|
+
"packages/cloud-astro/src/doctor/checks-live.ts": "a9e138571d0de36591a1b318e721ca04171d69703a6a8666e1f5e8eb221e3f29",
|
|
11
|
+
"packages/cloud-astro/src/doctor/checks-offline.ts": "a0b60746a0418fd146d005849b10508300803e2a09bab0fd2863869b5f4f8179",
|
|
12
|
+
"packages/cloud-astro/src/doctor/checks-preview-limits.ts": "d3624ad22cd5a1a2e5f3572b264026a35365c47254aee53d629e21fc8dbe9a5e",
|
|
13
|
+
"packages/cloud-astro/src/doctor/checks-preview-live.ts": "a7cf80e32eb1da07acbf1a815d03099c9c4e78311017f2d718df5ff1ce9b0c02",
|
|
14
|
+
"packages/cloud-astro/src/doctor/checks-preview.ts": "4a97b8d8ff0f255a60451f8b40337996cb954e043976fc8f82fc8b0d8f4a026b",
|
|
15
|
+
"packages/cloud-astro/src/doctor/config-scan.ts": "74577495c251f1d66174f02cf27b43b0ac7ae62f67f18f0ff889bf2524271255",
|
|
16
|
+
"packages/cloud-astro/src/doctor/run.ts": "caf982615d4a0948b778ec0b3d4af8ac53d01ca8a10007f716cfb95c8eef8ca7",
|
|
17
|
+
"packages/cloud-astro/src/doctor/types.ts": "bb349030c2f95e1dd4d6c83e189d44f96c2653485e528d84948766b1fdf04dab",
|
|
18
|
+
"packages/cloud-astro/src/editor-page/bundle.ts": "ce6297a184658ed71c8cbb14efe1d7e1b2db982fdca11f03db5839dceb460084",
|
|
19
|
+
"packages/cloud-astro/src/editor-page/data-schemas.ts": "f338935a573a587ef16c271a6d270e5e11cbbff1e8f29e9361a4842dc310a7e8",
|
|
20
|
+
"packages/cloud-astro/src/editor-page/emit.ts": "b4fa9c83ec52017c0b8d42979f6e9dc1f85ed71a0d96a6e14b3441e20572fa17",
|
|
16
21
|
"packages/cloud-astro/src/editor-page/framing.ts": "6522fc1d49f05d332d798908bcb8c726d0064ababd8d74cdab71aecb8ccf2e6b",
|
|
17
22
|
"packages/cloud-astro/src/editor-page/page.ts": "f4987bdcd64c4063810f6320e1c5822b9bb3288b83d5d525fb18c35e30c9f724",
|
|
18
23
|
"packages/cloud-astro/src/editor-page/site-base.ts": "56fc5a4d6b3767e079d23ab9898d268feb26525642c68cabc5cfb750c6f2fb19",
|
|
19
24
|
"packages/cloud-astro/src/git.ts": "7e51995ef366ce9843ccb595214ea1f66f02481140c317e5ad6878fb44e5c44e",
|
|
20
|
-
"packages/cloud-astro/src/index.ts": "
|
|
21
|
-
"packages/cloud-astro/src/integration.ts": "
|
|
25
|
+
"packages/cloud-astro/src/index.ts": "1fd151a26ed463d612e8c9362c69785e3792abc3afadb903a29ac5616dad4d02",
|
|
26
|
+
"packages/cloud-astro/src/integration.ts": "0b15b7ec53e7f761bb1e93ee32499909439b2078b514d5cba5067274c6dfed11",
|
|
22
27
|
"packages/cloud-astro/src/message-of.ts": "ad147a15f10d89a0b8a193062d36b7fcd7ea670debceba69b44619985461d4a1",
|
|
23
28
|
"packages/cloud-astro/src/node.ts": "c8396ae7861b44898ebf36f2e79619eaffdd5eb2b57e0d0c99894525b1e58533",
|
|
24
29
|
"packages/cloud-astro/src/package-version.ts": "3b2507e61f60f68c5699076446547d25ad9ddc94f4692822e961d44d4af183ed",
|
|
25
|
-
"packages/cloud-astro/src/preview-build.ts": "
|
|
30
|
+
"packages/cloud-astro/src/preview-build.ts": "cacc590403ef4fec273742a1e97b0f553c45787c86f0c2177ac235af075271e5",
|
|
26
31
|
"packages/cloud-astro/src/preview-handler.d.ts": "a7671b653f29f493ef436f00ef046ac57215b88d5b48fd4b09faba9412fca7c4",
|
|
27
32
|
"packages/cloud-astro/src/preview.ts": "30da5511322ead3e3b2cad366a913d05c3b69f24c3bc7012005e213ace21ca77",
|
|
28
|
-
"packages/cloud-astro/src/preview/_dispatch.ts": "
|
|
29
|
-
"packages/cloud-astro/src/preview/_resolve-opts.ts": "
|
|
30
|
-
"packages/cloud-astro/src/preview/banner.ts": "
|
|
33
|
+
"packages/cloud-astro/src/preview/_dispatch.ts": "bbdc3f8827eb94d43520e016b27fd53b6aed357e5d341054663118f5a1c78a5d",
|
|
34
|
+
"packages/cloud-astro/src/preview/_resolve-opts.ts": "52f1a1c94a48dca2626af692c0012ce8ee76c12e1affbf1221d5423561d5a031",
|
|
35
|
+
"packages/cloud-astro/src/preview/banner.ts": "b5a09a82e0336474ecc0b779abfd3cd46ebdf7d9a2bd45b6b5c95c2c4ce8c530",
|
|
36
|
+
"packages/cloud-astro/src/preview/cloudflare-adapter.ts": "a776c04880a6cee2bef07bc7583794221ac3e8b462eddd2334161e6388540549",
|
|
31
37
|
"packages/cloud-astro/src/preview/content-api.ts": "0312073c6a145361a89800c4dbc9d345817d830d576da459905aa195b0194694",
|
|
32
|
-
"packages/cloud-astro/src/preview/cookie.ts": "
|
|
33
|
-
"packages/cloud-astro/src/preview/
|
|
38
|
+
"packages/cloud-astro/src/preview/cookie.ts": "d3989d1b5cb1f8a3935aae8fe13c1a1e4a451de9d7cbdae8dd4fedc0b813d7ff",
|
|
39
|
+
"packages/cloud-astro/src/preview/dispatcher.ts": "dc2a404a1258197235a414c246a5b417495e5a5311a7812c5b50d914c64e75fe",
|
|
40
|
+
"packages/cloud-astro/src/preview/entry-code.ts": "0736a2d6cdc97d81ad33e9950e21a0595c09d862911a83f186c32655221b655c",
|
|
41
|
+
"packages/cloud-astro/src/preview/headers.ts": "cba92a84dba8edefa72257ea2624cc6c6ed3caff25fafb5b8cf953b4bd2546e2",
|
|
34
42
|
"packages/cloud-astro/src/preview/label.ts": "a36eed2674aaa74427bdb2d52cedaa89f8ee2bca418f4b53ab3d44e6033270f7",
|
|
35
|
-
"packages/cloud-astro/src/preview/landing.ts": "
|
|
36
|
-
"packages/cloud-astro/src/preview/middleware.ts": "
|
|
37
|
-
"packages/cloud-astro/src/preview/preview-path.ts": "
|
|
43
|
+
"packages/cloud-astro/src/preview/landing.ts": "9f120b31bfa6ea853260a3b259d2e0dd2d0d22ffc11596bd670d910635dfe760",
|
|
44
|
+
"packages/cloud-astro/src/preview/middleware.ts": "20adb7a360fd510f1cfb810a2bbba6b2a48efa3a66e9682832eee137ccab2a03",
|
|
45
|
+
"packages/cloud-astro/src/preview/preview-path.ts": "28ac55a2fc5ed8bdbff5199443636d3890cb097203e817101545f58c8a1137d5",
|
|
46
|
+
"packages/cloud-astro/src/preview/redeem-url.ts": "6f264b872fba18ffa6734952483e046080bcde6f21df6d56218ebd8c25e6372c",
|
|
38
47
|
"packages/cloud-astro/src/preview/satteri-workerd.ts": "f48a7cfa9729317222a89cf058461c9130914e07043444f5723ce06e70e39c2a",
|
|
39
|
-
"packages/cloud-astro/src/preview/site-middleware.ts": "
|
|
48
|
+
"packages/cloud-astro/src/preview/site-middleware.ts": "bc4cb671263ad98d68254529a083a925729d399ffe72112b4fdf89f370f38e5a",
|
|
40
49
|
"packages/cloud-astro/src/preview/workerd-shim.ts": "7d4eaedac169a36a317f79c3066c026b92f374d0fae0067938a3192a71c48a55",
|
|
41
50
|
"packages/cloud-astro/src/repository.ts": "4b1a1ac9a7bb4e6b46f057b754802b8ee8a2c73f4de6ae58ec2fb8820436489b",
|
|
42
51
|
"packages/cloud-astro/src/resolve-options.ts": "4bedf9fcced55716fe887103f5bf03f42ae5aab3a502cde6861cbd292d8e08f8",
|
|
43
52
|
"packages/cloud-astro/src/site-id.ts": "4a836250ba2017a50683986b964fcedfc9a580559ca89b64f64e53ca80c786ce",
|
|
44
53
|
"packages/cloud-astro/src/site-middleware.ts": "edde690370d527471d5f5b46e44a24579684b900c4fd74f5d1406464fd8853f4",
|
|
45
|
-
"packages/cloud-astro/src/skill.ts": "
|
|
46
|
-
"packages/cloud-astro/src/types.ts": "
|
|
54
|
+
"packages/cloud-astro/src/skill.ts": "cb38815c3148adae55c10e3b85e52871e9ffe2f03b51c649c091f3298f895050",
|
|
55
|
+
"packages/cloud-astro/src/types.ts": "04d3a98fb678b579677960ffa7573143a87c73480f539ccaf61c4c615ab42948",
|
|
47
56
|
"packages/cloud-astro/src/virtual-modules.d.ts": "9d28d2ab0a6b8e7c0062c35cde71e0260f162a46deacb9472edf84d87fe8147b",
|
|
48
57
|
"packages/cloud-astro/tsconfig.lib.json": "82151563b73ee0cae4c54f46e865d1a26bac18e08c10093268309278de5539f9"
|
|
49
58
|
},
|
package/dist/src/constants.d.ts
CHANGED
|
@@ -4,11 +4,20 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export declare const PACKAGE_NAME = "@conloca/cloud-astro";
|
|
6
6
|
/**
|
|
7
|
-
* Environment variable that the
|
|
8
|
-
*
|
|
9
|
-
* it and skip the editor page and further recursion.
|
|
7
|
+
* Environment variable that makes a build the preview server: the site's build sets it on the child build it starts,
|
|
8
|
+
* and a separate preview deploy (D4) builds with it set.
|
|
10
9
|
*/
|
|
11
10
|
export declare const PREVIEW_BUILD_ENV_FLAG = "CONLOCA_PREVIEW_BUILD";
|
|
11
|
+
/**
|
|
12
|
+
* Environment variable the site's build names the child's mode in (`d2` or `d3`). A build started with
|
|
13
|
+
* {@link PREVIEW_BUILD_ENV_FLAG} alone, as a separate preview deploy runs it, has none: it is D4.
|
|
14
|
+
*/
|
|
15
|
+
export declare const PREVIEW_MODE_ENV = "CONLOCA_PREVIEW_MODE";
|
|
16
|
+
/**
|
|
17
|
+
* Environment variable the site's build names, for a D3 child, the routes it prerendered (a JSON list of their
|
|
18
|
+
* components): the child keeps exactly those prerendered, and every other route keeps its own setting.
|
|
19
|
+
*/
|
|
20
|
+
export declare const PREVIEW_PRERENDERED_ENV = "CONLOCA_PREVIEW_PRERENDERED";
|
|
12
21
|
/**
|
|
13
22
|
* Adapters the preview build is refused under: they write their deployable
|
|
14
23
|
* output at the project root whatever `outDir` says, so the preview build
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,YAAY,yBAAyB,CAAC;AAEnD
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,YAAY,yBAAyB,CAAC;AAEnD;;;GAGG;AACH,eAAO,MAAM,sBAAsB,0BAA0B,CAAC;AAE9D;;;GAGG;AACH,eAAO,MAAM,gBAAgB,yBAAyB,CAAC;AAEvD;;;GAGG;AACH,eAAO,MAAM,uBAAuB,gCAAgC,CAAC;AAErE;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,EAAE,SAAS,MAAM,EAA4C,CAAC"}
|
package/dist/src/constants.js
CHANGED
|
@@ -4,11 +4,20 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export const PACKAGE_NAME = '@conloca/cloud-astro';
|
|
6
6
|
/**
|
|
7
|
-
* Environment variable that the
|
|
8
|
-
*
|
|
9
|
-
* it and skip the editor page and further recursion.
|
|
7
|
+
* Environment variable that makes a build the preview server: the site's build sets it on the child build it starts,
|
|
8
|
+
* and a separate preview deploy (D4) builds with it set.
|
|
10
9
|
*/
|
|
11
10
|
export const PREVIEW_BUILD_ENV_FLAG = 'CONLOCA_PREVIEW_BUILD';
|
|
11
|
+
/**
|
|
12
|
+
* Environment variable the site's build names the child's mode in (`d2` or `d3`). A build started with
|
|
13
|
+
* {@link PREVIEW_BUILD_ENV_FLAG} alone, as a separate preview deploy runs it, has none: it is D4.
|
|
14
|
+
*/
|
|
15
|
+
export const PREVIEW_MODE_ENV = 'CONLOCA_PREVIEW_MODE';
|
|
16
|
+
/**
|
|
17
|
+
* Environment variable the site's build names, for a D3 child, the routes it prerendered (a JSON list of their
|
|
18
|
+
* components): the child keeps exactly those prerendered, and every other route keeps its own setting.
|
|
19
|
+
*/
|
|
20
|
+
export const PREVIEW_PRERENDERED_ENV = 'CONLOCA_PREVIEW_PRERENDERED';
|
|
12
21
|
/**
|
|
13
22
|
* Adapters the preview build is refused under: they write their deployable
|
|
14
23
|
* output at the project root whatever `outDir` says, so the preview build
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,sBAAsB,CAAC;AAEnD
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,sBAAsB,CAAC;AAEnD;;;GAGG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,uBAAuB,CAAC;AAE9D;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,sBAAsB,CAAC;AAEvD;;;GAGG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,6BAA6B,CAAC;AAErE;;;;GAIG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAsB,CAAC,iBAAiB,EAAE,kBAAkB,CAAC,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The site's build finishing a D3 preview: the preview server was built next to the static site (a child build),
|
|
3
|
+
* and this writes what Cloudflare Workers needs to serve both: the preview build's `_astro` files merged into the
|
|
4
|
+
* site's, the route list `wrangler.jsonc` must run the dispatcher on, and the dispatcher module and its config.
|
|
5
|
+
*/
|
|
6
|
+
import type { DispatcherExit } from './preview/dispatcher.js';
|
|
7
|
+
/** What the preview build tells the site's build: its pages, its on-demand routes and the exit values it baked. */
|
|
8
|
+
export interface PreviewRoutes {
|
|
9
|
+
/** Request paths without a trailing slash, under the base. */
|
|
10
|
+
prerendered: string[];
|
|
11
|
+
/** `run_worker_first` globs under the base. */
|
|
12
|
+
onDemand: string[];
|
|
13
|
+
/** What the dispatcher's exit route answers with. */
|
|
14
|
+
exit: DispatcherExit;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The routes the live site must hand to its dispatcher: everything the preview build renders on demand, except the
|
|
18
|
+
* CMS pages (prerendered in production), the preview route itself, redirects (the static site writes them as pages)
|
|
19
|
+
* and Astro's internals other than islands, actions and the image endpoint draft pages use.
|
|
20
|
+
*/
|
|
21
|
+
export declare function onDemandPatterns(routes: readonly {
|
|
22
|
+
pattern: string;
|
|
23
|
+
isPrerendered: boolean;
|
|
24
|
+
origin: string;
|
|
25
|
+
entrypoint: string;
|
|
26
|
+
type: string;
|
|
27
|
+
}[]): string[];
|
|
28
|
+
/** An Astro route pattern as a `run_worker_first` glob under the base: from the first dynamic segment on, `*`. */
|
|
29
|
+
export declare function workerFirstPattern(pattern: string, base: string): string;
|
|
30
|
+
export declare function writePreviewRoutes(previewOut: string, routes: PreviewRoutes): Promise<void>;
|
|
31
|
+
/** The preview build's report, or undefined when it wrote none (it failed, or is from an older release). */
|
|
32
|
+
export declare function readPreviewRoutes(previewOut: string): Promise<PreviewRoutes | undefined>;
|
|
33
|
+
/**
|
|
34
|
+
* Copies the preview build's built files into the site's, so the drafts' scripts and styles load from the one asset
|
|
35
|
+
* set the site serves. Content-hashed names mean the same name holds the same bytes; a name that holds other bytes
|
|
36
|
+
* copies nothing and answers false.
|
|
37
|
+
*/
|
|
38
|
+
export declare function mergeAssets(from: string, to: string): Promise<boolean>;
|
|
39
|
+
/**
|
|
40
|
+
* What `wrangler.jsonc` lacks for D3, as fix messages: `run_worker_first` entries per block that has its own
|
|
41
|
+
* `assets` (an env block's replaces the top level's), and, when the plan needs it, the rate limit in every block
|
|
42
|
+
* (bindings are not inherited).
|
|
43
|
+
*/
|
|
44
|
+
export declare function deployProblems(config: unknown, expected: readonly string[], needsLimit: boolean): string[];
|
|
45
|
+
/** The site's recorded Cloudflare plan (`package.json` `conloca.cfPlan`, written by `conloca connect`), or undefined. */
|
|
46
|
+
export declare function recordedCfPlan(root: string): Promise<'free' | 'paid' | undefined>;
|
|
47
|
+
/**
|
|
48
|
+
* What the preview server serves for the live site beyond the preview route, per the config: `run_worker_first`
|
|
49
|
+
* entries past the prefix pair and the image endpoint (only drafts use it), and `not_found_handling: "none"` (it
|
|
50
|
+
* answers every miss). A failed preview build must not ship over any of these.
|
|
51
|
+
*/
|
|
52
|
+
export declare function servedBeyondPrefix(config: unknown, base: string): string[];
|
|
53
|
+
/** The module `wrangler.jsonc` `main` names. Its preview server import is lazy, so a slow one never delays start-up. */
|
|
54
|
+
export declare function dispatcherModule(serverEntry: string | null): string;
|
|
55
|
+
export interface FinishD3Input {
|
|
56
|
+
root: string;
|
|
57
|
+
dist: string;
|
|
58
|
+
previewOut: string;
|
|
59
|
+
base: string;
|
|
60
|
+
endpoint: string;
|
|
61
|
+
/** Whether the preview build succeeded. */
|
|
62
|
+
built: boolean;
|
|
63
|
+
logger: {
|
|
64
|
+
info(message: string): void;
|
|
65
|
+
warn(message: string): void;
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
/** D3: everything after the preview build; it fails the site's build only where shipping would break it. */
|
|
69
|
+
export declare function finishD3Build(input: FinishD3Input): Promise<void>;
|
|
70
|
+
//# sourceMappingURL=d3-build.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"d3-build.d.ts","sourceRoot":"","sources":["../../src/d3-build.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AASH,OAAO,KAAK,EAAoB,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAGhF,mHAAmH;AACnH,MAAM,WAAW,aAAa;IAC5B,8DAA8D;IAC9D,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,+CAA+C;IAC/C,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,qDAAqD;IACrD,IAAI,EAAE,cAAc,CAAC;CACtB;AAMD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,SAAS;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE,GAC/G,MAAM,EAAE,CAOV;AAED,kHAAkH;AAClH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAKxE;AAED,wBAAsB,kBAAkB,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAGjG;AAiBD,4GAA4G;AAC5G,wBAAsB,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC,CAU9F;AAED;;;;GAIG;AACH,wBAAsB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAoB5E;AAgCD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,MAAM,EAAE,EAAE,UAAU,EAAE,OAAO,GAAG,MAAM,EAAE,CAY1G;AAED,yHAAyH;AACzH,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC,CASvF;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAa1E;AAED,wHAAwH;AACxH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAUnE;AA6BD,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,2CAA2C;IAC3C,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE;QAAE,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;CACtE;AAID,4GAA4G;AAC5G,wBAAsB,aAAa,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAiEvE"}
|