@conloca/cloud-astro 0.0.0-stage → 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 +177 -4
- 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
package/README.md
CHANGED
|
@@ -1,3 +1,328 @@
|
|
|
1
|
-
#
|
|
1
|
+
# `@conloca/cloud-astro`
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Astro integration that connects a Conloca CMS site to an editor endpoint. Add it to the site's `astro.config.mjs` next
|
|
4
|
+
to `conlocaCMS` to:
|
|
5
|
+
|
|
6
|
+
1. Compile the site's Puck config into a single editor bundle under `_conloca/` in the build output
|
|
7
|
+
(react/react-dom/jsx-runtime/`@puckeditor/core` stay external — the editor supplies them at runtime) and register the
|
|
8
|
+
build at `endpoint`, so the editor there loads this build's bundle for the branch it was built from.
|
|
9
|
+
2. Run a recursive preview build that emits SSR routes for draft content.
|
|
10
|
+
3. Wire preview SSR middleware that checks `/conloca_preview_<secret>/*` requests against the endpoint's token issuer
|
|
11
|
+
and serves draft pages.
|
|
12
|
+
4. Expose `PreviewContentAPI` for `.astro` pages to fetch draft content.
|
|
13
|
+
|
|
14
|
+
Items 2 to 4 serve draft previews, which are not available on your own deployment yet. The setup below keeps them off
|
|
15
|
+
with `previewBuild: false` (see [Draft previews](#draft-previews)).
|
|
16
|
+
|
|
17
|
+
## Setup
|
|
18
|
+
|
|
19
|
+
Before you start you need:
|
|
20
|
+
|
|
21
|
+
- An Astro site that already runs `@conloca/astro-cms` (its README covers that), in a GitHub repository.
|
|
22
|
+
- The repository connected to the editor at `endpoint`: sign in there with **Continue with GitHub**, choose **Connect
|
|
23
|
+
GitHub**, and pick the repository on GitHub's installation screen. If a GitHub organization owns the repository and
|
|
24
|
+
you are not one of its owners, an owner has to approve the installation; until then the editor shows **Waiting for
|
|
25
|
+
approval**.
|
|
26
|
+
- An owner or admin role in the editor's workspace: only they can create the build token in step 3. Whoever sets the
|
|
27
|
+
workspace up becomes its first owner.
|
|
28
|
+
|
|
29
|
+
### 1. Install
|
|
30
|
+
|
|
31
|
+
```sh
|
|
32
|
+
bun add @conloca/cloud-astro
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
It needs Astro 7.3.1 or a later 7.x release, and `@conloca/astro-cms` at its own version: the `@conloca/*` packages are
|
|
36
|
+
released together, so keep them on one version and update them together. Its other peers (`@astrojs/react`, `vite`) are
|
|
37
|
+
already in a site that runs `@conloca/astro-cms`.
|
|
38
|
+
|
|
39
|
+
### 2. Add it next to `conlocaCMS`
|
|
40
|
+
|
|
41
|
+
```js
|
|
42
|
+
// astro.config.mjs
|
|
43
|
+
import react from '@astrojs/react';
|
|
44
|
+
import { conlocaCMS } from '@conloca/astro-cms/node';
|
|
45
|
+
import { conlocaCloud } from '@conloca/cloud-astro';
|
|
46
|
+
import { defineConfig } from 'astro/config';
|
|
47
|
+
|
|
48
|
+
export default defineConfig({
|
|
49
|
+
// Keep your existing settings (output, adapter, ...) as they are.
|
|
50
|
+
integrations: [
|
|
51
|
+
react(),
|
|
52
|
+
conlocaCMS({
|
|
53
|
+
contentRoot: './content',
|
|
54
|
+
puckConfigPath: './src/puck.config.tsx',
|
|
55
|
+
layout: './src/layouts/Layout.astro',
|
|
56
|
+
}),
|
|
57
|
+
conlocaCloud({
|
|
58
|
+
endpoint: 'https://cms.example.com',
|
|
59
|
+
puckConfigPath: './src/puck.config.tsx',
|
|
60
|
+
publicBaseUrl: 'https://www.example.com',
|
|
61
|
+
previewBuild: false,
|
|
62
|
+
}),
|
|
63
|
+
],
|
|
64
|
+
});
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
- `conlocaCloud` is an add-on to `conlocaCMS`, not a replacement: keep both, with `react()` first. Doctor reports a
|
|
68
|
+
config without `conlocaCMS` as an error.
|
|
69
|
+
- `endpoint` is only the scheme and host of the address you open the editor at, such as `https://cms.example.com`. Leave
|
|
70
|
+
out any path the browser's address bar shows after the host, and the trailing slash.
|
|
71
|
+
- `puckConfigPath` is the value you already gave `conlocaCMS`. If your `conlocaCMS` options also set `siteStyles` or
|
|
72
|
+
`fragmentPreviewRoute`, give `conlocaCloud` the same values, so the editor renders your pages with your site's styles.
|
|
73
|
+
- `publicBaseUrl` is the address your deployed site is served from: the editor loads this build's editor files from
|
|
74
|
+
there. The integration does **not** read Astro's `site` option, so set `publicBaseUrl` even when `site` holds the same
|
|
75
|
+
address. Its only fallback is `CF_PAGES_URL`, which Cloudflare Pages sets when it runs the build itself. Without
|
|
76
|
+
either, the build succeeds but does not register, and the editor never updates.
|
|
77
|
+
- `previewBuild: false` keeps off the second build, the one that serves draft previews. Draft previews on your own
|
|
78
|
+
deployment are not available yet, so keep this line: without it, every build that registers also runs that second
|
|
79
|
+
build, which fails on a static site that has no SSR adapter.
|
|
80
|
+
|
|
81
|
+
### 3. Give the build a token
|
|
82
|
+
|
|
83
|
+
In the editor at `endpoint`, open the account menu (the round button with your initial), choose **Workspace settings**,
|
|
84
|
+
and go to **Build token**. The **Connect this site** screen of a site that has no build yet shows the same section.
|
|
85
|
+
Choose **Create build token**. The token is shown once, as the line `CONLOCA_BUILD_TOKEN=cbt_…`, and **Copy environment
|
|
86
|
+
variable** copies that whole line. Store it wherever `astro build` runs:
|
|
87
|
+
|
|
88
|
+
- Where the name and the value are separate fields — a GitHub Actions secret, a Cloudflare Pages variable, most hosts'
|
|
89
|
+
settings — the name is `CONLOCA_BUILD_TOKEN` and the value is **only** the part after `CONLOCA_BUILD_TOKEN=`, starting
|
|
90
|
+
with `cbt_`. Do not paste the whole copied line as the value.
|
|
91
|
+
- Where the input takes `NAME=value` lines, like a `.env` file, paste the whole line.
|
|
92
|
+
|
|
93
|
+
Give the secret only to the steps that need it: `conloca doctor` and the build (see the
|
|
94
|
+
[CI example](#ci-example-github-actions)), not to install scripts or deploy actions. Never write it into the config:
|
|
95
|
+
doctor warns when `buildToken` is committed.
|
|
96
|
+
|
|
97
|
+
One token serves the whole workspace. **Replace build token** creates a new one, and the old one stops working at once,
|
|
98
|
+
so update every place that holds it.
|
|
99
|
+
|
|
100
|
+
No Conloca-specific GitHub Action or OIDC setup is required. GitHub Actions, Vercel and GitLab provide the repository
|
|
101
|
+
automatically; elsewhere the integration reads the checkout's `remote.origin.url`. Use `repoUri` only for a checkout
|
|
102
|
+
where neither is available.
|
|
103
|
+
|
|
104
|
+
A build without the token still succeeds; it only skips registration (see
|
|
105
|
+
[When registration is skipped](#when-registration-is-skipped)). Once your CI is wired, set `requireRegistration: true`
|
|
106
|
+
so a deploy can never silently leave the editor behind.
|
|
107
|
+
|
|
108
|
+
### 4. Push, then build
|
|
109
|
+
|
|
110
|
+
A build registers the exact commit it was built from, and the endpoint refuses a commit it has not received from GitHub
|
|
111
|
+
yet. Push first, then build the pushed commit; a CI build that starts on push does this for you. A build of a commit the
|
|
112
|
+
endpoint does not have retries for about two and a half minutes and then fails with an error that says the commit
|
|
113
|
+
`is not ingested`. A local `astro build` of an unpushed commit with the token set fails the same way.
|
|
114
|
+
|
|
115
|
+
If you also build pull requests on GitHub Actions, give `actions/checkout` the pull request's own commit
|
|
116
|
+
(`ref: ${{ github.event.pull_request.head.sha || github.sha }}`). By default it checks out a merge commit that GitHub
|
|
117
|
+
makes for the pull request and never pushes, so the endpoint never receives it and the registration fails.
|
|
118
|
+
|
|
119
|
+
A pull-request build deployed somewhere other than `publicBaseUrl`, such as a host's preview deploy, must set
|
|
120
|
+
`publicBaseUrl` to the address that build is served from, for example from your host's deploy-URL variable (a full
|
|
121
|
+
`https://` address). The editor on that branch loads the build's editor files from `publicBaseUrl`, and your production
|
|
122
|
+
site does not serve the files only a pull request's build produced, so the editor would report that the bundle could not
|
|
123
|
+
be loaded or verified.
|
|
124
|
+
|
|
125
|
+
### 5. Deploy, and serve `/_conloca/*` cross-origin
|
|
126
|
+
|
|
127
|
+
The build writes the editor files under `_conloca/` in its output: `dist/_conloca/` for a static site, or the client
|
|
128
|
+
folder such as `dist/client/_conloca/` for a server-rendered one. Deploy the build the way you already do, to the
|
|
129
|
+
`publicBaseUrl` address.
|
|
130
|
+
|
|
131
|
+
The editor runs on another origin and fetches those files from your site, so every `/_conloca/*` response must be public
|
|
132
|
+
and carry `Access-Control-Allow-Origin: *`. Without the header the editor reports that this build's editor bundle could
|
|
133
|
+
not be loaded or verified, and rebuilding does not help.
|
|
134
|
+
|
|
135
|
+
The build writes that rule to a `_headers` file next to `_conloca/` (`dist/_headers`, or `dist/client/_headers` for a
|
|
136
|
+
server-rendered site): one rule for `/_conloca/*`, plus one for each folder of fonts and images your site styles
|
|
137
|
+
reference.
|
|
138
|
+
|
|
139
|
+
- **Cloudflare Pages and Netlify** apply `_headers` themselves. Nothing else to do.
|
|
140
|
+
- **Everywhere else**, `_headers` is ignored — including a Node server built with `@astrojs/node`, which has no setting
|
|
141
|
+
for headers on static files. Set the header for every path the generated `_headers` lists, in whatever serves the
|
|
142
|
+
site. A site made by `conloca create` is such a Node server: add the header in a proxy in front of it, or switch the
|
|
143
|
+
site to static output (remove `output: 'server'` and the adapter from `astro.config.mjs`) and deploy it to Cloudflare
|
|
144
|
+
Pages or Netlify. With Caddy in front of the Node server:
|
|
145
|
+
|
|
146
|
+
```caddyfile
|
|
147
|
+
www.example.com {
|
|
148
|
+
header /_conloca/* Access-Control-Allow-Origin *
|
|
149
|
+
reverse_proxy localhost:4321
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
With nginx in front of it:
|
|
154
|
+
|
|
155
|
+
```nginx
|
|
156
|
+
location /_conloca/ {
|
|
157
|
+
add_header Access-Control-Allow-Origin * always;
|
|
158
|
+
proxy_pass http://127.0.0.1:4321;
|
|
159
|
+
}
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
If nginx serves the files itself, keep your `root` or `try_files` lines in that `location` instead of `proxy_pass`. A
|
|
163
|
+
`location` with its own `add_header` drops the ones it would inherit from the `server` block, so repeat any you rely
|
|
164
|
+
on.
|
|
165
|
+
|
|
166
|
+
Check it after the deploy, with the file name from the build log line
|
|
167
|
+
`editor bundle written: /_conloca/editor-bundle.<hash>.js`:
|
|
168
|
+
|
|
169
|
+
```sh
|
|
170
|
+
curl -sI -H 'Origin: https://cms.example.com' https://www.example.com/_conloca/editor-bundle.<hash>.js
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
The answer must be `200` and include `access-control-allow-origin: *`. `conloca doctor --live` checks that the file is
|
|
174
|
+
deployed, not this header.
|
|
175
|
+
|
|
176
|
+
### CI example (GitHub Actions)
|
|
177
|
+
|
|
178
|
+
```yaml
|
|
179
|
+
# .github/workflows/deploy.yml
|
|
180
|
+
name: Build and deploy
|
|
181
|
+
|
|
182
|
+
on:
|
|
183
|
+
push:
|
|
184
|
+
branches: [main]
|
|
185
|
+
|
|
186
|
+
jobs:
|
|
187
|
+
deploy:
|
|
188
|
+
runs-on: ubuntu-latest
|
|
189
|
+
steps:
|
|
190
|
+
- uses: actions/checkout@v4
|
|
191
|
+
- uses: oven-sh/setup-bun@v2
|
|
192
|
+
- run: bun install --frozen-lockfile
|
|
193
|
+
# The token goes to doctor and the build only, not to install scripts or the deploy.
|
|
194
|
+
- run: bunx @conloca/cli doctor
|
|
195
|
+
env:
|
|
196
|
+
CONLOCA_BUILD_TOKEN: ${{ secrets.CONLOCA_BUILD_TOKEN }}
|
|
197
|
+
- run: bun run build
|
|
198
|
+
env:
|
|
199
|
+
CONLOCA_BUILD_TOKEN: ${{ secrets.CONLOCA_BUILD_TOKEN }}
|
|
200
|
+
# Deploy the build the way you already do.
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
### Check it
|
|
204
|
+
|
|
205
|
+
After the deploy finishes, run this in your repository, on the branch you built:
|
|
206
|
+
|
|
207
|
+
```sh
|
|
208
|
+
CONLOCA_BUILD_TOKEN=cbt_... bunx @conloca/cli doctor --live
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
`--live` asks the endpoint what it knows about this repository: whether it accepts the token, which commit registered
|
|
212
|
+
the editor for this branch and site and which version of this package built it, and whether that editor bundle is still
|
|
213
|
+
deployed. The token goes only to the `endpoint` in your config. If you did not keep a copy of the token, skip this step
|
|
214
|
+
rather than replacing the token (that stops the CI secret working at once); reloading the editor is enough.
|
|
215
|
+
|
|
216
|
+
Then reload the editor: it opens your site instead of **Connect this site**, and the **Build registration** row under
|
|
217
|
+
**Workspace settings → Build token** turns from **Waiting for Astro build** to **Connected**.
|
|
218
|
+
|
|
219
|
+
### Troubleshooting
|
|
220
|
+
|
|
221
|
+
- **The build log ends with `editor at … NOT updated by this build`.** Prerequisites were missing, and each `missing:`
|
|
222
|
+
line names one: `public base URL` means `publicBaseUrl` is not set (step 2), `build token` means the
|
|
223
|
+
`CONLOCA_BUILD_TOKEN` secret does not reach the build (step 3). See
|
|
224
|
+
[When registration is skipped](#when-registration-is-skipped).
|
|
225
|
+
- **Doctor says the build token value starts with `"CONLOCA_BUILD_TOKEN="`, or the build fails with
|
|
226
|
+
`registration rejected: HTTP 401` and the secret holds the whole copied line.** Change the value to the part starting
|
|
227
|
+
with `cbt_` and rebuild. The token itself is fine; you do not need a new one.
|
|
228
|
+
- **`registration rejected: HTTP 401` with a `cbt_…` value.** The token was replaced, which invalidates the old one at
|
|
229
|
+
once. Put the new token in the `CONLOCA_BUILD_TOKEN` secret everywhere the site builds, then rebuild.
|
|
230
|
+
- **The build fails with an error that says the commit `is not ingested`.** It built a commit the endpoint has not
|
|
231
|
+
received. Push the commit, then rebuild (step 4).
|
|
232
|
+
- **`registration rejected: HTTP 403` saying the repository is not covered by the workspace's GitHub installation.** Add
|
|
233
|
+
the repository to that installation in your GitHub settings, then rebuild.
|
|
234
|
+
- **The build log shows `registration complete`, but the editor still shows Connect this site.** Wait for the deploy to
|
|
235
|
+
finish, then reload the editor.
|
|
236
|
+
- **The editor says the editor bundle could not be loaded or verified.** `/_conloca/*` lacks the cross-origin header,
|
|
237
|
+
`publicBaseUrl` does not serve this build's files, or the deploy has not finished (step 5).
|
|
238
|
+
|
|
239
|
+
## Options
|
|
240
|
+
|
|
241
|
+
| Name | Required | Description |
|
|
242
|
+
| ---------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------ |
|
|
243
|
+
| `endpoint` | yes | Editor endpoint, scheme and host only, e.g. `https://cms.example.com`: no path, no trailing slash. URL-shape validated. |
|
|
244
|
+
| `puckConfigPath` | yes | Puck config entry to compile (same option name and value as in `@conloca/astro-cms`). |
|
|
245
|
+
| `publicBaseUrl` | no | Where the deployed site is served; the editor loads the bundle from there. Astro's `site` is not read. Falls back to `CF_PAGES_URL`. |
|
|
246
|
+
| `repoUri` | no | Advanced `owner/repo` override; normally detected from CI or the Git remote. |
|
|
247
|
+
| `siteId` | no | Advanced site-id override for CMS-less builds; sites.json is authoritative. |
|
|
248
|
+
| `buildToken` | no | Build token issued by the endpoint; use the `CONLOCA_BUILD_TOKEN` environment variable instead, so it is never committed. |
|
|
249
|
+
| `siteStyles` | no | Site CSS compiled into the canvas stylesheet, as in `conlocaCMS`. |
|
|
250
|
+
| `fragmentPreviewRoute` | no | Content route for build-time style discovery, as in `conlocaCMS`. |
|
|
251
|
+
| `previewDomain` | no | Dedicated preview domain. When set, switches to `preview-domain` mode and is used instead of `publicBaseUrl`. |
|
|
252
|
+
| `previewBuild` | no | `PreviewBuildOptions` or `false`. On by default; set `false`, since draft previews on your own deployment are not available yet. |
|
|
253
|
+
| `saasIssuer` | no | Draft previews only. JWT `iss` the preview middleware pins (the endpoint's token issuer). Baked in; else set at runtime. |
|
|
254
|
+
| `requireRegistration` | no | Fail the build when registration is skipped for a missing prerequisite. Recommended in CI once setup is done. |
|
|
255
|
+
|
|
256
|
+
The `conlocaCMS` options `schemasPath` and `mdxComponentFolders` reach the editor at `endpoint` automatically: the CMS
|
|
257
|
+
publishes what it resolved and this integration compiles the schemas and the discovered MDX components into the editor
|
|
258
|
+
bundle each build registers. The `conlocaCMS` options `editorStyles` and `editorCSS` have no effect on the editor at
|
|
259
|
+
`endpoint` (they configure the local dev editor only); `templates` and the `routing` data bindings reach it through the
|
|
260
|
+
same channel as `schemasPath`.
|
|
261
|
+
|
|
262
|
+
## Public render path
|
|
263
|
+
|
|
264
|
+
Zero runtime overhead in the site's PRODUCTION build — nothing from this package is mounted there. The preview route and
|
|
265
|
+
the preview interceptor exist only inside the generated preview build (below), so production pages render exactly as
|
|
266
|
+
they did before.
|
|
267
|
+
|
|
268
|
+
## Draft previews
|
|
269
|
+
|
|
270
|
+
Draft previews on your own deployment are not available yet. Keep `previewBuild: false` in your config: the preview
|
|
271
|
+
build stays off, and a build produces only your normal site.
|
|
272
|
+
|
|
273
|
+
## When registration is skipped
|
|
274
|
+
|
|
275
|
+
A build that lacks a prerequisite — no `CONLOCA_BUILD_TOKEN`, no repository identity, no git sha/branch, or no public
|
|
276
|
+
base URL — completes without registering and ends with one summary block, with a `missing:` line for each prerequisite
|
|
277
|
+
it lacks:
|
|
278
|
+
|
|
279
|
+
```plain
|
|
280
|
+
[@conloca/cloud-astro] editor at https://cms.example.com NOT updated by this build
|
|
281
|
+
missing: build token (set buildToken or CONLOCA_BUILD_TOKEN)
|
|
282
|
+
consequence: registration was skipped, so the editor keeps serving the previous build of this branch (or the default branch's, or nothing, if neither was ever registered)
|
|
283
|
+
check: conloca doctor --live
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
Set `requireRegistration: true` in CI to turn that into a build failure. An attempted registration that the endpoint
|
|
287
|
+
rejects always fails the build; there is no switch for that.
|
|
288
|
+
|
|
289
|
+
## Doctor
|
|
290
|
+
|
|
291
|
+
This package is a `conloca doctor` extension (`conloca.doctor` in package.json): `conloca doctor` in a project that
|
|
292
|
+
depends on it runs this package's checks after the CMS ones, offline by default.
|
|
293
|
+
|
|
294
|
+
| Check | What it verifies |
|
|
295
|
+
| ----- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
296
|
+
| CC1 | `conlocaCloud(...)` is wired next to `conlocaCMS(...)` (an absent `conlocaCMS` is an error) |
|
|
297
|
+
| CC2 | A build token is available (`CONLOCA_BUILD_TOKEN`; missing = error under CI, info locally) and parses as `cbt_…`, with its own message for a pasted `CONLOCA_BUILD_TOKEN=` prefix (skipped when `conlocaCloud` is not called) |
|
|
298
|
+
| CC3 | `endpoint` is a valid https URL (no trailing slash); `publicBaseUrl`/`previewDomain` when set, or `CF_PAGES_URL` under CI; skipped likewise |
|
|
299
|
+
| CC4 | `conlocaCMS` options the endpoint's editor ignores (`editorStyles`, `editorCSS`) |
|
|
300
|
+
| CC5 | `--live`: the endpoint accepts the token (a 401 means a replaced token — put the new one in the CI secret — or an endpoint without the status route) |
|
|
301
|
+
| CC6 | `--live`: a registration serves this branch and site — own row, inherited from the default branch, or none |
|
|
302
|
+
| CC7 | `--live`: the editor bundle the registration names is still deployed (catches a later deploy deleting it) and how stale it is; it does not check the cross-origin header |
|
|
303
|
+
| CC8 | `previewBuild` is `false`, or the preview build has an SSR adapter (the project's own or `previewBuild.adapter`); a static project with neither is an error, because every build that registers would fail |
|
|
304
|
+
|
|
305
|
+
`conloca doctor --live` sends the build token ONLY to the configured endpoint. When the config computes `endpoint` (for
|
|
306
|
+
example from an environment variable), set `CONLOCA_ENDPOINT` so doctor can read it.
|
|
307
|
+
|
|
308
|
+
The integration also scaffolds a one-page agent skill at `.claude/skills/conloca-cloud/SKILL.md` — in the nearest
|
|
309
|
+
`.claude/` directory between the Astro project and the git root — on any Astro command that loads the config (build,
|
|
310
|
+
dev, sync, check), once, never overwriting an existing file. Repos without a `.claude/` directory get nothing. Projects
|
|
311
|
+
outside a git repository get nothing either. The page is not auto-updated: copy the current one from this package's
|
|
312
|
+
`src/skill/SKILL.md` when it changes.
|
|
313
|
+
|
|
314
|
+
## Tests
|
|
315
|
+
|
|
316
|
+
```sh
|
|
317
|
+
nx run cloud-astro:test
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
Covers option validation, integration shape (which hooks are registered), preview build (spawned binary path + env
|
|
321
|
+
contract), preview middleware (JWT verification, 302/cookie/landing-page paths, banner injection, robots headers),
|
|
322
|
+
preview reader (304 fallback, embedded payloads), and the site middleware's verdict rendering. The `test-packed` target
|
|
323
|
+
installs the packed tarball in an empty project and resolves every export from it there.
|
|
324
|
+
|
|
325
|
+
## What's NOT in this package
|
|
326
|
+
|
|
327
|
+
- OAuth handshake (redirect, code exchange, refresh rotation) — handled by the endpoint.
|
|
328
|
+
- The token issuer and its JWKS endpoint (served by `endpoint`).
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The commit a registration names and the commit the artifact was built from.
|
|
3
|
+
* They differ only when CI hands over the branch's latest commit
|
|
4
|
+
* (`CF_PAGES_COMMIT_SHA`) while building another commit — a pull request's
|
|
5
|
+
* merge commit — because the endpoint can only serve a commit the branch
|
|
6
|
+
* actually carries.
|
|
7
|
+
*/
|
|
8
|
+
export interface RegistrationCommits {
|
|
9
|
+
gitSha: string | undefined;
|
|
10
|
+
buildId: string | undefined;
|
|
11
|
+
}
|
|
12
|
+
/** Resolves which commit the registration names and which commit produced the bundle. */
|
|
13
|
+
export declare function registrationCommits(input: {
|
|
14
|
+
/** The branch's latest commit, as CI hands it over through CF_PAGES_COMMIT_SHA. */
|
|
15
|
+
eventCommitSha: string | undefined;
|
|
16
|
+
/** git rev-parse HEAD in the build checkout. */
|
|
17
|
+
checkoutCommitSha: string | undefined;
|
|
18
|
+
}): RegistrationCommits;
|
|
19
|
+
//# sourceMappingURL=build-commit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-commit.d.ts","sourceRoot":"","sources":["../../src/build-commit.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;CAC7B;AAED,yFAAyF;AACzF,wBAAgB,mBAAmB,CAAC,KAAK,EAAE;IACzC,mFAAmF;IACnF,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,gDAAgD;IAChD,iBAAiB,EAAE,MAAM,GAAG,SAAS,CAAC;CACvC,GAAG,mBAAmB,CAGtB"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Resolves which commit the registration names and which commit produced the bundle. */
|
|
2
|
+
export function registrationCommits(input) {
|
|
3
|
+
const gitSha = input.eventCommitSha ?? input.checkoutCommitSha;
|
|
4
|
+
return { gitSha, buildId: input.checkoutCommitSha ?? gitSha };
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=build-commit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-commit.js","sourceRoot":"","sources":["../../src/build-commit.ts"],"names":[],"mappings":"AAYA,yFAAyF;AACzF,MAAM,UAAU,mBAAmB,CAAC,KAKnC;IACC,MAAM,MAAM,GAAG,KAAK,CAAC,cAAc,IAAI,KAAK,CAAC,iBAAiB,CAAC;IAC/D,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,CAAC,iBAAiB,IAAI,MAAM,EAAE,CAAC;AAChE,CAAC"}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import type { TemplateConfig } from '@conloca/astro-cms';
|
|
2
|
+
import type { EditorDataBindings } from '@conloca/content-api';
|
|
3
|
+
import { type UserConfig } from 'vite';
|
|
4
|
+
/**
|
|
5
|
+
* Modules the editor bundle must NEVER contain. The editor (served from
|
|
6
|
+
* `endpoint`) supplies them at runtime so the site's components
|
|
7
|
+
* execute on the editor's own React instance — a second bundled React breaks
|
|
8
|
+
* hooks/context. `@puckeditor/core` is the puck editor package the site's
|
|
9
|
+
* config builds its component definitions against.
|
|
10
|
+
*
|
|
11
|
+
* KEEP IN SYNC with the modules the editor at the endpoint supplies: the two lists
|
|
12
|
+
* are one contract, so every specifier externalized here needs an entry there
|
|
13
|
+
* or the site's bundle fails bare-specifier resolution in the browser. Each side
|
|
14
|
+
* pins the list in its own tests.
|
|
15
|
+
*/
|
|
16
|
+
export declare const EDITOR_BUNDLE_EXTERNALS: readonly ['react', 'react-dom', 'react/jsx-runtime', 'react/jsx-dev-runtime', 'react-dom/client', '@puckeditor/core'];
|
|
17
|
+
/**
|
|
18
|
+
* Editor descriptors compiled into the bundle, next to the puck config and
|
|
19
|
+
* the site styles. Sourced from what `conlocaCMS` resolved and published —
|
|
20
|
+
* this package never grows its own option for them.
|
|
21
|
+
*/
|
|
22
|
+
export interface EditorBundleDescriptors {
|
|
23
|
+
/**
|
|
24
|
+
* Absolute path of the host's schemas module (conlocaCMS `schemasPath`).
|
|
25
|
+
* Its `pageSchemas` / `dataSchemas` / `mdxComponents` exports are
|
|
26
|
+
* re-exported by the bundle, so the editor at the endpoint reads them off bytes it
|
|
27
|
+
* already hash-verified — no second fetch, no second trust decision.
|
|
28
|
+
*/
|
|
29
|
+
schemasPath?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Auto-discovered MDX descriptors (conlocaCMS `mdxComponentFolders`),
|
|
32
|
+
* serialized into the bundle verbatim. Opaque here on purpose: the shape
|
|
33
|
+
* is cms-spa's contract and this package only transports it.
|
|
34
|
+
*/
|
|
35
|
+
discoveredMdxComponents?: readonly unknown[];
|
|
36
|
+
/**
|
|
37
|
+
* Page-creation templates (conlocaCMS `templates`), serialized into the
|
|
38
|
+
* bundle verbatim. Typed by the `@conloca/astro-cms` peer, whose
|
|
39
|
+
* `readEditorDescriptors` produced the value this package transports.
|
|
40
|
+
*/
|
|
41
|
+
templates?: Record<string, TemplateConfig>;
|
|
42
|
+
/**
|
|
43
|
+
* The routing data bindings (conlocaCMS `routing`), serialized into the
|
|
44
|
+
* bundle verbatim, so the editor at the endpoint builds each page's data context from
|
|
45
|
+
* the same routes the published page resolves with.
|
|
46
|
+
*/
|
|
47
|
+
dataBindings?: EditorDataBindings;
|
|
48
|
+
}
|
|
49
|
+
export interface BundleEditorAssetsInput {
|
|
50
|
+
/** Build output directory (Astro's `dir`, as a filesystem path). */
|
|
51
|
+
dir: string;
|
|
52
|
+
/** The Astro project root, as a filesystem path: siteStyles resolve against it. */
|
|
53
|
+
root: string;
|
|
54
|
+
/** The site's own Vite config (Astro's `config.vite`), which compiles siteStyles. */
|
|
55
|
+
vite: UserConfig;
|
|
56
|
+
/** Entry module of the site's puck config (same option name as @conloca/astro-cms). */
|
|
57
|
+
puckConfigPath: string;
|
|
58
|
+
/**
|
|
59
|
+
* Site CSS for accurate preview rendering (the `siteStyles` option),
|
|
60
|
+
* compiled by the site's own Vite pipeline into the same registered
|
|
61
|
+
* stylesheet AHEAD of the component modules, so component rules keep the
|
|
62
|
+
* final word.
|
|
63
|
+
*/
|
|
64
|
+
siteStyles?: string | string[];
|
|
65
|
+
/**
|
|
66
|
+
* Public origin the deployed site answers on (the `publicBaseUrl` option).
|
|
67
|
+
* Root-relative asset URLs in the registered stylesheet are absolutized
|
|
68
|
+
* against it, since that stylesheet is applied inside the editor's canvas
|
|
69
|
+
* rather than on the site. Omitted: URLs stay as authored.
|
|
70
|
+
*/
|
|
71
|
+
publicBaseUrl?: string;
|
|
72
|
+
/**
|
|
73
|
+
* Editor descriptors published by conlocaCMS for this build. Absent for a
|
|
74
|
+
* CMS-less build, or when there is nothing to carry (no schemas module,
|
|
75
|
+
* discoverable MDX component, page template or data binding) — in which case
|
|
76
|
+
* the emitted bytes are identical to a pre-descriptor build (no gratuitous
|
|
77
|
+
* hash churn).
|
|
78
|
+
*/
|
|
79
|
+
descriptors?: EditorBundleDescriptors;
|
|
80
|
+
logger: {
|
|
81
|
+
info(message: string): void;
|
|
82
|
+
warn(message: string): void;
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
export interface BundledStylesheet {
|
|
86
|
+
/** Site-relative URL of the emitted stylesheet, e.g. `/_conloca/editor-bundle.<hash16>.css`. */
|
|
87
|
+
url: string;
|
|
88
|
+
/** FULL sha-256 hex of the stylesheet bytes — the editor hash-verifies against this. */
|
|
89
|
+
hash: string;
|
|
90
|
+
/** The emitted stylesheet bytes. */
|
|
91
|
+
bytes: Uint8Array;
|
|
92
|
+
}
|
|
93
|
+
export interface BundleEditorAssetsResult {
|
|
94
|
+
/** Site-relative URL of the emitted bundle, e.g. `/_conloca/editor-bundle.<hash16>.js`. */
|
|
95
|
+
url: string;
|
|
96
|
+
/** FULL sha-256 hex of the bundle bytes — the editor hash-verifies against this. */
|
|
97
|
+
hash: string;
|
|
98
|
+
/** The emitted bundle bytes. */
|
|
99
|
+
bytes: Uint8Array;
|
|
100
|
+
/**
|
|
101
|
+
* Companion stylesheet for the editing canvas (styled canvas):
|
|
102
|
+
* any siteStyles, then the config graph's compiled CSS/SCSS modules.
|
|
103
|
+
* Absent when neither carries styles.
|
|
104
|
+
*/
|
|
105
|
+
stylesheet?: BundledStylesheet;
|
|
106
|
+
/**
|
|
107
|
+
* `_headers` paths granted CORS for the stylesheet's own assets, so the
|
|
108
|
+
* mirrored asset set (a deployment that serves the site and the preview from
|
|
109
|
+
* one Cloudflare Worker) can be given the same rules.
|
|
110
|
+
*/
|
|
111
|
+
assetCorsPaths: string[];
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Bundles the site's puck config into a browser ESM file plus (when the
|
|
115
|
+
* graph carries styles) a companion stylesheet, both under `<dir>/_conloca/`,
|
|
116
|
+
* content-addressed by the first 16 hex chars of their sha-256, and ensures
|
|
117
|
+
* `<dir>/_headers` carries the CORS rule the editor needs to load them
|
|
118
|
+
* cross-origin.
|
|
119
|
+
*
|
|
120
|
+
* The siteStyles compile first, through the site's own Vite pipeline (see
|
|
121
|
+
* `compileSiteStyles`); one that fails to compile fails the build.
|
|
122
|
+
*
|
|
123
|
+
* Component styles compile in the SAME esbuild pass as the JS: CSS-module
|
|
124
|
+
* class names are hashed consistently across both outputs, so `styles.foo` in
|
|
125
|
+
* a component always matches a selector in the emitted stylesheet. SCSS
|
|
126
|
+
* compiles through `sass`; a component stylesheet that fails to compile is
|
|
127
|
+
* stripped with a warning instead of failing the build (one broken component
|
|
128
|
+
* stylesheet must not cost the site its registration).
|
|
129
|
+
*/
|
|
130
|
+
export declare function bundleEditorAssets(input: BundleEditorAssetsInput): Promise<BundleEditorAssetsResult>;
|
|
131
|
+
/**
|
|
132
|
+
* Re-points the registered stylesheet's asset references at the deployed site.
|
|
133
|
+
*
|
|
134
|
+
* Only ROOT-relative URLs (`/fonts/x.otf`) are rewritten — those name a path
|
|
135
|
+
* on the site and nothing else. That includes the `/_conloca/` assets the
|
|
136
|
+
* siteStyles build emitted, since Vite resolves their relative references.
|
|
137
|
+
* Path-relative ones (`./x.otf`, `../x.otf`, `x.otf`) cannot be resolved here
|
|
138
|
+
* and are reported instead of guessed: esbuild flattens every component
|
|
139
|
+
* stylesheet into ONE output and copies url() paths through verbatim, so by
|
|
140
|
+
* this point the emitted text no longer records WHICH source directory each
|
|
141
|
+
* one was relative to. Absolute, protocol-relative, `data:` and fragment
|
|
142
|
+
* (`#filter`) refs already resolve correctly and are left alone.
|
|
143
|
+
*
|
|
144
|
+
* Returns the rewritten CSS plus the `_headers` globs its assets need — one
|
|
145
|
+
* per distinct directory rather than one per file, which keeps a font family
|
|
146
|
+
* of forty weights to a single rule.
|
|
147
|
+
*/
|
|
148
|
+
export declare function rewriteStylesheetAssetUrls(css: string, publicBaseUrl: string, logger: BundleEditorAssetsInput['logger']): {
|
|
149
|
+
css: string;
|
|
150
|
+
assetCorsPaths: string[];
|
|
151
|
+
};
|
|
152
|
+
/**
|
|
153
|
+
* Writes the discovery route's collected CSS as a content-addressed artifact
|
|
154
|
+
* next to the editor bundle: `_conloca/route-css.<hash16>.css`.
|
|
155
|
+
* Same serving story as the editor stylesheet — the `/_conloca/*` CORS rule
|
|
156
|
+
* already covers it, and `mirrorEditorAssets` copies the whole dir.
|
|
157
|
+
*/
|
|
158
|
+
export declare function emitRouteCssArtifact(dir: string, css: string, publicBaseUrl: string | undefined, logger: BundleEditorAssetsInput['logger']): Promise<{
|
|
159
|
+
stylesheet: BundledStylesheet;
|
|
160
|
+
assetCorsPaths: string[];
|
|
161
|
+
} | undefined>;
|
|
162
|
+
/**
|
|
163
|
+
* Mirrors the emitted editor assets (`_conloca/` + the CORS rule) from the
|
|
164
|
+
* primary build's output into another asset directory — the recursive preview
|
|
165
|
+
* build's client dir. The bundle is only ever compiled into the PRIMARY
|
|
166
|
+
* build's dist (the child build short-circuits `astro:build:done` to avoid
|
|
167
|
+
* registration recursion), but in a deployment that serves the site and the
|
|
168
|
+
* preview from one Cloudflare Worker, the child's client dir is the asset set
|
|
169
|
+
* that actually serves the site, so without this mirror the editor at the
|
|
170
|
+
* endpoint cannot load its component bundle.
|
|
171
|
+
*/
|
|
172
|
+
export declare function mirrorEditorAssets(fromDir: string, toDir: string, assetCorsPaths?: string[]): Promise<void>;
|
|
173
|
+
//# sourceMappingURL=bundle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["../../src/bundle.ts"],"names":[],"mappings":"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"}
|