@conloca/cloud-astro 0.2.1 → 0.2.3
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 +261 -207
- package/dist/.build-inputs.json +60 -0
- package/dist/src/component-manifest.d.ts +5 -3
- package/dist/src/component-manifest.d.ts.map +1 -1
- package/dist/src/component-manifest.js +7 -7
- package/dist/src/component-manifest.js.map +1 -1
- package/dist/src/constants.d.ts +5 -13
- package/dist/src/constants.d.ts.map +1 -1
- package/dist/src/constants.js +5 -13
- package/dist/src/constants.js.map +1 -1
- package/dist/src/descriptors.d.ts +2 -2
- package/dist/src/descriptors.d.ts.map +1 -1
- package/dist/src/doctor/checks-address.d.ts +18 -0
- package/dist/src/doctor/checks-address.d.ts.map +1 -0
- package/dist/src/doctor/checks-address.js +163 -0
- package/dist/src/doctor/checks-address.js.map +1 -0
- package/dist/src/doctor/checks-live.d.ts +8 -5
- package/dist/src/doctor/checks-live.d.ts.map +1 -1
- package/dist/src/doctor/checks-live.js +220 -188
- package/dist/src/doctor/checks-live.js.map +1 -1
- package/dist/src/doctor/checks-offline.d.ts +8 -23
- package/dist/src/doctor/checks-offline.d.ts.map +1 -1
- package/dist/src/doctor/checks-offline.js +22 -239
- package/dist/src/doctor/checks-offline.js.map +1 -1
- package/dist/src/doctor/config-scan.d.ts +6 -3
- package/dist/src/doctor/config-scan.d.ts.map +1 -1
- package/dist/src/doctor/config-scan.js +21 -11
- 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 +12 -10
- package/dist/src/doctor/run.js.map +1 -1
- package/dist/src/doctor/types.d.ts +7 -7
- package/dist/src/doctor/types.d.ts.map +1 -1
- package/dist/src/doctor/types.js +7 -7
- package/dist/src/doctor/types.js.map +1 -1
- package/dist/src/editor-page/bundle.d.ts +88 -0
- package/dist/src/editor-page/bundle.d.ts.map +1 -0
- package/dist/src/editor-page/bundle.js +370 -0
- package/dist/src/editor-page/bundle.js.map +1 -0
- package/dist/src/editor-page/emit.d.ts +33 -0
- package/dist/src/editor-page/emit.d.ts.map +1 -0
- package/dist/src/editor-page/emit.js +183 -0
- package/dist/src/editor-page/emit.js.map +1 -0
- package/dist/src/editor-page/framing.d.ts +23 -0
- package/dist/src/editor-page/framing.d.ts.map +1 -0
- package/dist/src/editor-page/framing.js +39 -0
- package/dist/src/editor-page/framing.js.map +1 -0
- package/dist/src/editor-page/page.d.ts +9 -0
- package/dist/src/editor-page/page.d.ts.map +1 -0
- package/dist/src/editor-page/page.js +31 -0
- package/dist/src/editor-page/page.js.map +1 -0
- package/dist/src/editor-page/site-base.d.ts +4 -0
- package/dist/src/editor-page/site-base.d.ts.map +1 -0
- package/dist/src/editor-page/site-base.js +13 -0
- package/dist/src/editor-page/site-base.js.map +1 -0
- package/dist/src/git.d.ts +11 -8
- package/dist/src/git.d.ts.map +1 -1
- package/dist/src/git.js +25 -8
- package/dist/src/git.js.map +1 -1
- package/dist/src/index.d.ts +3 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +9 -6
- package/dist/src/index.js.map +1 -1
- package/dist/src/integration.d.ts +1 -1
- package/dist/src/integration.d.ts.map +1 -1
- package/dist/src/integration.js +245 -396
- package/dist/src/integration.js.map +1 -1
- package/dist/src/node.d.ts +3 -1
- package/dist/src/node.d.ts.map +1 -1
- package/dist/src/node.js +7 -2
- package/dist/src/node.js.map +1 -1
- package/dist/src/preview/_dispatch.d.ts +5 -2
- package/dist/src/preview/_dispatch.d.ts.map +1 -1
- package/dist/src/preview/_dispatch.js +2 -0
- package/dist/src/preview/_dispatch.js.map +1 -1
- package/dist/src/preview/_resolve-opts.d.ts +18 -10
- package/dist/src/preview/_resolve-opts.d.ts.map +1 -1
- package/dist/src/preview/_resolve-opts.js +24 -10
- package/dist/src/preview/_resolve-opts.js.map +1 -1
- package/dist/src/preview/banner.d.ts.map +1 -1
- package/dist/src/preview/banner.js +2 -4
- package/dist/src/preview/banner.js.map +1 -1
- package/dist/src/preview/cookie.d.ts +5 -2
- package/dist/src/preview/cookie.d.ts.map +1 -1
- package/dist/src/preview/cookie.js +5 -2
- package/dist/src/preview/cookie.js.map +1 -1
- package/dist/src/preview/label.d.ts +8 -0
- package/dist/src/preview/label.d.ts.map +1 -0
- package/dist/src/preview/label.js +14 -0
- package/dist/src/preview/label.js.map +1 -0
- package/dist/src/preview/landing.d.ts +2 -2
- package/dist/src/preview/landing.js +2 -2
- package/dist/src/preview/middleware.d.ts +31 -20
- package/dist/src/preview/middleware.d.ts.map +1 -1
- package/dist/src/preview/middleware.js +56 -51
- package/dist/src/preview/middleware.js.map +1 -1
- package/dist/src/preview/preview-path.d.ts +18 -5
- package/dist/src/preview/preview-path.d.ts.map +1 -1
- package/dist/src/preview/preview-path.js +24 -8
- package/dist/src/preview/preview-path.js.map +1 -1
- package/dist/src/preview/site-middleware.d.ts +5 -5
- package/dist/src/preview/site-middleware.d.ts.map +1 -1
- package/dist/src/preview/site-middleware.js +17 -16
- package/dist/src/preview/site-middleware.js.map +1 -1
- package/dist/src/preview-build.d.ts +18 -15
- package/dist/src/preview-build.d.ts.map +1 -1
- package/dist/src/preview-build.js +36 -21
- package/dist/src/preview-build.js.map +1 -1
- package/dist/src/preview.d.ts +1 -1
- package/dist/src/preview.d.ts.map +1 -1
- package/dist/src/preview.js +1 -1
- package/dist/src/preview.js.map +1 -1
- package/dist/src/repository.d.ts +1 -1
- package/dist/src/repository.js +1 -1
- package/dist/src/resolve-options.d.ts +17 -0
- package/dist/src/resolve-options.d.ts.map +1 -0
- package/dist/src/resolve-options.js +21 -0
- package/dist/src/resolve-options.js.map +1 -0
- package/dist/src/site-id.d.ts +0 -2
- package/dist/src/site-id.d.ts.map +1 -1
- package/dist/src/site-id.js +2 -3
- package/dist/src/site-id.js.map +1 -1
- package/dist/src/types.d.ts +21 -59
- package/dist/src/types.d.ts.map +1 -1
- package/package.json +44 -15
- package/src/component-manifest.ts +11 -8
- package/src/constants.ts +5 -14
- package/src/descriptors.ts +2 -2
- package/src/doctor/checks-address.ts +190 -0
- package/src/doctor/checks-live.ts +256 -268
- package/src/doctor/checks-offline.ts +24 -262
- package/src/doctor/config-scan.ts +21 -9
- package/src/doctor/run.ts +14 -16
- package/src/doctor/types.ts +7 -7
- package/src/editor-page/bundle.ts +482 -0
- package/src/editor-page/emit.ts +246 -0
- package/src/editor-page/framing.ts +62 -0
- package/src/editor-page/page.ts +37 -0
- package/src/editor-page/site-base.ts +11 -0
- package/src/git.ts +29 -10
- package/src/index.ts +20 -6
- package/src/integration.ts +255 -449
- package/src/node.ts +18 -2
- package/src/preview/_dispatch.ts +6 -2
- package/src/preview/_resolve-opts.ts +34 -11
- package/src/preview/banner.ts +2 -4
- package/src/preview/cookie.ts +5 -2
- package/src/preview/label.ts +12 -0
- package/src/preview/landing.ts +2 -2
- package/src/preview/middleware.ts +83 -66
- package/src/preview/preview-path.ts +26 -8
- package/src/preview/site-middleware.ts +17 -21
- package/src/preview-build.ts +42 -26
- package/src/preview-handler.astro +10 -8
- package/src/preview.ts +0 -1
- package/src/repository.ts +1 -1
- package/src/resolve-options.ts +37 -0
- package/src/site-id.ts +2 -4
- package/src/skill/SKILL.md +51 -55
- package/src/types.ts +21 -60
- package/src/virtual-modules.d.ts +5 -1
- package/dist/src/build-commit.d.ts +0 -19
- package/dist/src/build-commit.d.ts.map +0 -1
- package/dist/src/build-commit.js +0 -6
- package/dist/src/build-commit.js.map +0 -1
- package/dist/src/bundle.d.ts +0 -173
- package/dist/src/bundle.d.ts.map +0 -1
- package/dist/src/bundle.js +0 -413
- package/dist/src/bundle.js.map +0 -1
- package/dist/src/discovery.d.ts +0 -58
- package/dist/src/discovery.d.ts.map +0 -1
- package/dist/src/discovery.js +0 -133
- package/dist/src/discovery.js.map +0 -1
- package/dist/src/register.d.ts +0 -98
- package/dist/src/register.d.ts.map +0 -1
- package/dist/src/register.js +0 -103
- package/dist/src/register.js.map +0 -1
- package/src/build-commit.ts +0 -22
- package/src/bundle.ts +0 -563
- package/src/discovery.ts +0 -183
- package/src/register.ts +0 -180
|
@@ -1,22 +1,42 @@
|
|
|
1
1
|
import { spawn } from 'node:child_process';
|
|
2
2
|
import { existsSync } from 'node:fs';
|
|
3
3
|
import { join } from 'node:path';
|
|
4
|
-
import { PACKAGE_NAME, PREVIEW_BUILD_ENV_FLAG,
|
|
5
|
-
|
|
4
|
+
import { PACKAGE_NAME, PREVIEW_BUILD_ENV_FLAG, REFUSED_PREVIEW_ADAPTERS } from './constants.js';
|
|
5
|
+
/**
|
|
6
|
+
* Whether the recursive preview build runs: only when `previewBuild` is given
|
|
7
|
+
* as an object (strict opt-in, so a plain deploy never gets a second build),
|
|
8
|
+
* and then only with an SSR adapter that is not refused. Throws for a refused
|
|
9
|
+
* adapter or a missing one, so the build fails before it deploys anything.
|
|
10
|
+
*/
|
|
11
|
+
export function previewBuildMode(previewBuild, adapterName) {
|
|
12
|
+
if (!previewBuild)
|
|
13
|
+
return 'off';
|
|
14
|
+
if (adapterName === undefined) {
|
|
15
|
+
throw new Error(`${PACKAGE_NAME}: the preview build needs an SSR adapter — the project is static and ` +
|
|
16
|
+
'previewBuild.adapter is not set. Pass one (e.g. previewBuild: { adapter: cloudflare() }) ' +
|
|
17
|
+
'or remove previewBuild.');
|
|
18
|
+
}
|
|
19
|
+
if (REFUSED_PREVIEW_ADAPTERS.includes(adapterName)) {
|
|
20
|
+
throw new Error(`${PACKAGE_NAME}: previewBuild is not supported with ${adapterName} yet: that adapter writes its deployable ` +
|
|
21
|
+
'output at the project root, so the preview build could replace the live site. ' +
|
|
22
|
+
'Remove previewBuild from conlocaCloud(...).');
|
|
23
|
+
}
|
|
24
|
+
return 'on';
|
|
25
|
+
}
|
|
6
26
|
/**
|
|
7
27
|
* Pure constructor for the child-process environment passed to the recursive
|
|
8
|
-
* preview build. Extracted so tests can verify the contract (env flag +
|
|
9
|
-
*
|
|
28
|
+
* preview build. Extracted so tests can verify the contract (env flag +
|
|
29
|
+
* parent-env inheritance) without spinning up a child process — and so the
|
|
10
30
|
* real-process smoke test can call it the same way the integration does.
|
|
11
31
|
*
|
|
12
32
|
* Inherits the parent environment so PATH, credentials, and any host-specific
|
|
13
|
-
* build vars (CF_PAGES_*, GITHUB_*) reach the child
|
|
33
|
+
* build vars (CF_PAGES_*, WORKERS_CI_*, GITHUB_*) reach the child, which reads
|
|
34
|
+
* the branch and commit it serves from them.
|
|
14
35
|
*/
|
|
15
|
-
export function buildPreviewChildEnv(parentEnv
|
|
36
|
+
export function buildPreviewChildEnv(parentEnv) {
|
|
16
37
|
return {
|
|
17
38
|
...parentEnv,
|
|
18
39
|
[PREVIEW_BUILD_ENV_FLAG]: '1',
|
|
19
|
-
[PREVIEW_SECRET_ENV_FLAG]: previewSecret,
|
|
20
40
|
};
|
|
21
41
|
}
|
|
22
42
|
/**
|
|
@@ -47,13 +67,10 @@ export function resolveAstroBin(cwd = process.cwd()) {
|
|
|
47
67
|
* Spawns the recursive preview `astro build` from the primary build's
|
|
48
68
|
* `astro:build:done` hook.
|
|
49
69
|
*
|
|
50
|
-
* The child process inherits the parent environment and additionally receives
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
* - {@link PREVIEW_SECRET_ENV_FLAG} set to the per-branch secret so the
|
|
55
|
-
* child's `astro:config:setup` can inject the literal secret-scoped
|
|
56
|
-
* preview route (`/conloca_preview_${SECRET}/[...path]`).
|
|
70
|
+
* The child process inherits the parent environment and additionally receives
|
|
71
|
+
* {@link PREVIEW_BUILD_ENV_FLAG} set to `'1'`: the child's `astro:config:setup`
|
|
72
|
+
* mounts the preview route on it, and its `astro:build:done` short-circuits
|
|
73
|
+
* on it (recursion guard contract).
|
|
57
74
|
*
|
|
58
75
|
* If this function is itself called from within a recursive build (i.e. the
|
|
59
76
|
* env flag is already set to `'1'`), it returns immediately without spawning,
|
|
@@ -64,8 +81,8 @@ export function resolveAstroBin(cwd = process.cwd()) {
|
|
|
64
81
|
* - `false` → resolves and logs a warning so onboarding setups can continue
|
|
65
82
|
* when the preview build is not yet wired correctly.
|
|
66
83
|
*/
|
|
67
|
-
export async function spawnPreviewBuild(
|
|
68
|
-
await _spawnPreviewBuildWith(spawn,
|
|
84
|
+
export async function spawnPreviewBuild(opts) {
|
|
85
|
+
await _spawnPreviewBuildWith(spawn, opts);
|
|
69
86
|
}
|
|
70
87
|
/**
|
|
71
88
|
* Internal seam that takes the spawn function as a parameter so tests can
|
|
@@ -75,20 +92,18 @@ export async function spawnPreviewBuild(previewSecret, opts) {
|
|
|
75
92
|
* and not part of the package's public surface; it is not re-exported from
|
|
76
93
|
* `src/index.ts` or `src/node.ts`.
|
|
77
94
|
*/
|
|
78
|
-
|
|
95
|
+
// oxlint-disable-next-line no-underscore-dangle -- the internal test seam.
|
|
96
|
+
export async function _spawnPreviewBuildWith(spawnFn, opts) {
|
|
79
97
|
// Recursion guard: bail out before doing any work if we're already inside
|
|
80
98
|
// a recursive preview build. This matches the short-circuit in the
|
|
81
99
|
// integration's `astro:build:done` hook.
|
|
82
100
|
if (process.env[PREVIEW_BUILD_ENV_FLAG] === '1') {
|
|
83
101
|
return;
|
|
84
102
|
}
|
|
85
|
-
if (!previewSecret) {
|
|
86
|
-
throw new Error(`${PACKAGE_NAME}: preview secret is required to spawn the preview build`);
|
|
87
|
-
}
|
|
88
103
|
const required = opts.required ?? true;
|
|
89
104
|
const astroBin = resolveAstroBin();
|
|
90
105
|
const child = spawnFn(astroBin, ['build'], {
|
|
91
|
-
env: buildPreviewChildEnv(process.env
|
|
106
|
+
env: buildPreviewChildEnv(process.env),
|
|
92
107
|
stdio: 'inherit',
|
|
93
108
|
});
|
|
94
109
|
await new Promise((resolve, reject) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preview-build.js","sourceRoot":"","sources":["../../src/preview-build.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,UAA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AE;QAC1C,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,IAAmB,EAAE,EAAE;YACvC,IAAI,IAAI,KAAK,CAAC,EAAE,CAAC;gBACf,OAAO,EAAE,CAAC;gBACV,OAAO;YACT,CAAC;YACD,MAAM,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,IAAI,EAAE,CAAC;YACzD,IAAI,QAAQ,EAAE,CAAC;gBACb,MAAM,CAAC,IAAI,KAAK,CAAC,GAAG,YAAY,2BAA2B,MAAM,GAAG,CAAC,CAAC,CAAC;gBACvE,OAAO;YACT,CAAC;YACD,mEAAmE;YACnE,wEAAwE;YACxE,kEAAkE;YAClE,wDAAwD;YACxD,qEAAqE;YACrE,OAAO,CAAC,IAAI,CAAC,GAAG,YAAY,2BAA2B,MAAM,4CAA4C,CAAC,CAAC;YAC3G,OAAO,EAAE,CAAC;QACZ,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/src/preview.d.ts
CHANGED
|
@@ -2,5 +2,5 @@ export { getBannerScriptText, injectPreviewBanner } from './preview/banner.js';
|
|
|
2
2
|
export { embeddedKey, PreviewContentAPI, type PreviewContentAPIOptions, } from './preview/content-api.js';
|
|
3
3
|
export { applyPreviewHeaders } from './preview/headers.js';
|
|
4
4
|
export { renderNoPreviewLanding } from './preview/landing.js';
|
|
5
|
-
export { handlePreviewRequest, type PreviewContext, type PreviewMiddlewareOptions, type PreviewVerdict,
|
|
5
|
+
export { handlePreviewRequest, type PreviewContext, type PreviewMiddlewareOptions, type PreviewVerdict, } from './preview/middleware.js';
|
|
6
6
|
//# sourceMappingURL=preview.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preview.d.ts","sourceRoot":"","sources":["../../src/preview.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,KAAK,wBAAwB,GAC9B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EACL,oBAAoB,EACpB,KAAK,cAAc,EACnB,KAAK,wBAAwB,EAC7B,KAAK,cAAc,
|
|
1
|
+
{"version":3,"file":"preview.d.ts","sourceRoot":"","sources":["../../src/preview.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,KAAK,wBAAwB,GAC9B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EACL,oBAAoB,EACpB,KAAK,cAAc,EACnB,KAAK,wBAAwB,EAC7B,KAAK,cAAc,GACpB,MAAM,yBAAyB,CAAC"}
|
package/dist/src/preview.js
CHANGED
|
@@ -8,5 +8,5 @@ export { getBannerScriptText, injectPreviewBanner } from './preview/banner.js';
|
|
|
8
8
|
export { embeddedKey, PreviewContentAPI, } from './preview/content-api.js';
|
|
9
9
|
export { applyPreviewHeaders } from './preview/headers.js';
|
|
10
10
|
export { renderNoPreviewLanding } from './preview/landing.js';
|
|
11
|
-
export { handlePreviewRequest,
|
|
11
|
+
export { handlePreviewRequest, } from './preview/middleware.js';
|
|
12
12
|
//# sourceMappingURL=preview.js.map
|
package/dist/src/preview.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preview.js","sourceRoot":"","sources":["../../src/preview.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,EAAE;AACF,0EAA0E;AAC1E,oEAAoE;AACpE,6EAA6E;AAC7E,6DAA6D;AAE7D,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EACL,WAAW,EACX,iBAAiB,GAElB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EACL,oBAAoB,
|
|
1
|
+
{"version":3,"file":"preview.js","sourceRoot":"","sources":["../../src/preview.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,EAAE;AACF,0EAA0E;AAC1E,oEAAoE;AACpE,6EAA6E;AAC7E,6DAA6D;AAE7D,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EACL,WAAW,EACX,iBAAiB,GAElB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EACL,oBAAoB,GAIrB,MAAM,yBAAyB,CAAC"}
|
package/dist/src/repository.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export interface DetectRepositoryUriInput {
|
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
11
|
* Normalize a provider full_name or common Git remote into `owner/repo`.
|
|
12
|
-
* Deliberately rejects local paths and nested groups:
|
|
12
|
+
* Deliberately rejects local paths and nested groups: the editor page names
|
|
13
13
|
* its repository GitHub-style, as two segments.
|
|
14
14
|
*/
|
|
15
15
|
export declare function normalizeRepositoryUri(input: string | undefined): string | undefined;
|
package/dist/src/repository.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const REPO_SEGMENT = /^[A-Za-z0-9_.-]+$/;
|
|
2
2
|
/**
|
|
3
3
|
* Normalize a provider full_name or common Git remote into `owner/repo`.
|
|
4
|
-
* Deliberately rejects local paths and nested groups:
|
|
4
|
+
* Deliberately rejects local paths and nested groups: the editor page names
|
|
5
5
|
* its repository GitHub-style, as two segments.
|
|
6
6
|
*/
|
|
7
7
|
export function normalizeRepositoryUri(input) {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { EditorDescriptorChannel } from '@conloca/astro-cms/node';
|
|
2
|
+
import type { ConlocaCloudOptions } from './types.js';
|
|
3
|
+
/** The editor options `conlocaCMS` already holds, settled for this build. */
|
|
4
|
+
export interface InheritedOptions {
|
|
5
|
+
puckConfigPath: string;
|
|
6
|
+
siteStyles?: string[];
|
|
7
|
+
editorStyles?: string[];
|
|
8
|
+
editorCss?: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Each option given to `conlocaCloud()` wins; the channel `conlocaCMS`
|
|
12
|
+
* published fills the rest. `editorStyles` and `editorCss` come from the
|
|
13
|
+
* channel only. Only `puckConfigPath` is mandatory: without it there is no
|
|
14
|
+
* editor to build.
|
|
15
|
+
*/
|
|
16
|
+
export declare function resolveInheritedOptions(options: Pick<ConlocaCloudOptions, 'puckConfigPath' | 'siteStyles'>, channel: Pick<EditorDescriptorChannel, 'puckConfigPath' | 'siteStyles' | 'editorStyles' | 'editorCSS'> | undefined): InheritedOptions;
|
|
17
|
+
//# sourceMappingURL=resolve-options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-options.d.ts","sourceRoot":"","sources":["../../src/resolve-options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAEvE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEtD,6EAA6E;AAC7E,MAAM,WAAW,gBAAgB;IAC/B,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,IAAI,CAAC,mBAAmB,EAAE,gBAAgB,GAAG,YAAY,CAAC,EACnE,OAAO,EAAE,IAAI,CAAC,uBAAuB,EAAE,gBAAgB,GAAG,YAAY,GAAG,cAAc,GAAG,WAAW,CAAC,GAAG,SAAS,GACjH,gBAAgB,CAelB"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { PACKAGE_NAME } from './constants.js';
|
|
2
|
+
/**
|
|
3
|
+
* Each option given to `conlocaCloud()` wins; the channel `conlocaCMS`
|
|
4
|
+
* published fills the rest. `editorStyles` and `editorCss` come from the
|
|
5
|
+
* channel only. Only `puckConfigPath` is mandatory: without it there is no
|
|
6
|
+
* editor to build.
|
|
7
|
+
*/
|
|
8
|
+
export function resolveInheritedOptions(options, channel) {
|
|
9
|
+
const puckConfigPath = options.puckConfigPath ?? channel?.puckConfigPath;
|
|
10
|
+
if (!puckConfigPath) {
|
|
11
|
+
throw new Error(`${PACKAGE_NAME}: puckConfigPath is required: add it to conlocaCloud(), or add conlocaCMS() to this site's integrations`);
|
|
12
|
+
}
|
|
13
|
+
const siteStyles = typeof options.siteStyles === 'string' ? [options.siteStyles] : (options.siteStyles ?? channel?.siteStyles);
|
|
14
|
+
return {
|
|
15
|
+
puckConfigPath,
|
|
16
|
+
...(siteStyles === undefined ? {} : { siteStyles }),
|
|
17
|
+
...(channel?.editorStyles === undefined ? {} : { editorStyles: channel.editorStyles }),
|
|
18
|
+
...(channel?.editorCSS === undefined ? {} : { editorCss: channel.editorCSS }),
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=resolve-options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-options.js","sourceRoot":"","sources":["../../src/resolve-options.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAW9C;;;;;GAKG;AACH,MAAM,UAAU,uBAAuB,CACrC,OAAmE,EACnE,OAAkH;IAElH,MAAM,cAAc,GAAG,OAAO,CAAC,cAAc,IAAI,OAAO,EAAE,cAAc,CAAC;IACzE,IAAI,CAAC,cAAc,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CACb,GAAG,YAAY,yGAAyG,CACzH,CAAC;IACJ,CAAC;IACD,MAAM,UAAU,GACd,OAAO,OAAO,CAAC,UAAU,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,IAAI,OAAO,EAAE,UAAU,CAAC,CAAC;IAC9G,OAAO;QACL,cAAc;QACd,GAAG,CAAC,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC;QACnD,GAAG,CAAC,OAAO,EAAE,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,OAAO,CAAC,YAAY,EAAE,CAAC;QACtF,GAAG,CAAC,OAAO,EAAE,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,CAAC;KAC9E,CAAC;AACJ,CAAC"}
|
package/dist/src/site-id.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/** The site-id grammar: lowercase alphanumerics and dashes, 1-64 chars, alphanumeric first. */
|
|
2
|
-
export declare const SITE_ID_RE: RegExp;
|
|
3
1
|
/**
|
|
4
2
|
* Resolve the build's deployable-site id. STRICT: malformed input fails the
|
|
5
3
|
* build — a silent mis-attach is the same "deployed, but the editor points at
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"site-id.d.ts","sourceRoot":"","sources":["../../src/site-id.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"site-id.d.ts","sourceRoot":"","sources":["../../src/site-id.ts"],"names":[],"mappings":"AAKA;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE;IACvC,mFAAmF;IACnF,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,8DAA8D;IAC9D,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,uDAAuD;IACvD,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;CACrC,GAAG,MAAM,CA0DT"}
|
package/dist/src/site-id.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { readFileSync } from 'node:fs';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
|
+
import { SITE_ID_RE } from '@conloca/content-api/editor-host';
|
|
3
4
|
import { PACKAGE_NAME } from './constants.js';
|
|
4
|
-
/** The site-id grammar: lowercase alphanumerics and dashes, 1-64 chars, alphanumeric first. */
|
|
5
|
-
export const SITE_ID_RE = /^[a-z0-9][a-z0-9-]{0,63}$/;
|
|
6
5
|
/**
|
|
7
6
|
* Resolve the build's deployable-site id. STRICT: malformed input fails the
|
|
8
7
|
* build — a silent mis-attach is the same "deployed, but the editor points at
|
|
@@ -42,7 +41,7 @@ export function resolveBuildSiteId(opts) {
|
|
|
42
41
|
record.sites === null ||
|
|
43
42
|
typeof record.sites !== 'object' ||
|
|
44
43
|
Array.isArray(record.sites)) {
|
|
45
|
-
throw new Error(`${PACKAGE_NAME}: ${path} has no "sites" object — refusing to
|
|
44
|
+
throw new Error(`${PACKAGE_NAME}: ${path} has no "sites" object — refusing to build on a broken content model`);
|
|
46
45
|
}
|
|
47
46
|
let resolved;
|
|
48
47
|
if ('siteId' in record) {
|
package/dist/src/site-id.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"site-id.js","sourceRoot":"","sources":["../../src/site-id.ts"],"names":[],"mappings":"AAAA,O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AAC;AAClB,CAAC;AAED,SAAS,UAAU,CAAC,KAAa,EAAE,KAAa;IAC9C,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAI,KAAK,CAAC,GAAG,YAAY,KAAK,KAAK,KAAK,KAAK,+BAA+B,UAAU,GAAG,CAAC,CAAC;IACnG,CAAC;AACH,CAAC"}
|
package/dist/src/types.d.ts
CHANGED
|
@@ -4,8 +4,9 @@ import type { AstroIntegration } from 'astro';
|
|
|
4
4
|
* site's production build completes. The preview build emits the SSR routes
|
|
5
5
|
* that serve draft preview.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
7
|
+
* Off unless given as an object: the second build that serves draft previews.
|
|
8
|
+
* It needs an SSR adapter (the project's own or `adapter` here) and is refused
|
|
9
|
+
* under `@astrojs/vercel` and `@astrojs/netlify`.
|
|
9
10
|
*/
|
|
10
11
|
export interface PreviewBuildOptions {
|
|
11
12
|
/**
|
|
@@ -19,8 +20,8 @@ export interface PreviewBuildOptions {
|
|
|
19
20
|
config?: Record<string, unknown>;
|
|
20
21
|
/**
|
|
21
22
|
* Output directory for the preview build. Defaults to `.conloca/preview-server`
|
|
22
|
-
* — outside `dist/`, so the
|
|
23
|
-
*
|
|
23
|
+
* — outside `dist/`, so the preview server can never ride a wholesale static
|
|
24
|
+
* upload of the site and Astro's dist-clearing cannot wipe it.
|
|
24
25
|
*/
|
|
25
26
|
outDir?: string;
|
|
26
27
|
/**
|
|
@@ -30,20 +31,20 @@ export interface PreviewBuildOptions {
|
|
|
30
31
|
required?: boolean;
|
|
31
32
|
}
|
|
32
33
|
/**
|
|
33
|
-
* Options accepted by {@link conlocaCloud}.
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* issued by the endpoint. Repository identity is normally detected from CI metadata or the Git
|
|
37
|
-
* checkout.
|
|
34
|
+
* Options accepted by {@link conlocaCloud}. Every one is optional: repository
|
|
35
|
+
* identity is normally detected from CI metadata or the Git checkout, and the
|
|
36
|
+
* editor options come from `conlocaCMS`.
|
|
38
37
|
*/
|
|
39
38
|
export interface ConlocaCloudOptions {
|
|
40
|
-
/**
|
|
41
|
-
|
|
39
|
+
/**
|
|
40
|
+
* The workspace editor's address, no trailing slash. Defaults to
|
|
41
|
+
* 'https://app.conloca.com'. Its host must start with `app.`.
|
|
42
|
+
*/
|
|
43
|
+
endpoint?: string;
|
|
42
44
|
/**
|
|
43
45
|
* Advanced override for repository identity, normalized to `owner/repo`.
|
|
44
46
|
* Normally omit this: Conloca detects GitHub, Vercel, or GitLab CI metadata,
|
|
45
|
-
* then falls back to the checkout's `remote.origin.url`.
|
|
46
|
-
* rejected when the token does not cover the detected repo.
|
|
47
|
+
* then falls back to the checkout's `remote.origin.url`.
|
|
47
48
|
*/
|
|
48
49
|
repoUri?: string;
|
|
49
50
|
/**
|
|
@@ -53,57 +54,27 @@ export interface ConlocaCloudOptions {
|
|
|
53
54
|
* that contradicts it fails the build — never a silent pick.
|
|
54
55
|
*/
|
|
55
56
|
siteId?: string;
|
|
56
|
-
/**
|
|
57
|
-
* Build token issued by the endpoint. Prefer injecting it via the
|
|
58
|
-
* CONLOCA_BUILD_TOKEN environment variable instead of committing it here;
|
|
59
|
-
* when neither is present the build skips registration (fail soft, unless
|
|
60
|
-
* `requireRegistration` is set).
|
|
61
|
-
*/
|
|
62
|
-
buildToken?: string;
|
|
63
57
|
/**
|
|
64
58
|
* Entry module of the puck config to compile into the editor bundle,
|
|
65
59
|
* e.g. './src/puck.config.tsx'. Same option name as @conloca/astro-cms.
|
|
60
|
+
* Defaults to the `conlocaCMS` value.
|
|
66
61
|
*/
|
|
67
|
-
puckConfigPath
|
|
62
|
+
puckConfigPath?: string;
|
|
68
63
|
/**
|
|
69
64
|
* Site CSS for accurate preview rendering — same option name and shape
|
|
70
65
|
* as `conlocaCMS({ siteStyles })`, and compiled the same way: by the site's
|
|
71
66
|
* own Vite pipeline (its plugins, PostCSS config and preprocessors), into
|
|
72
|
-
* the canvas stylesheet
|
|
67
|
+
* the editor page's canvas stylesheet, ahead of the
|
|
73
68
|
* component modules, e.g. './src/styles/index.scss'. Paths resolve against
|
|
74
69
|
* the project root. The assets these stylesheets reference are emitted under
|
|
75
|
-
* `/_conloca/`, and an entry that fails to compile fails the build. Component
|
|
70
|
+
* `/_conloca/editor/`, and an entry that fails to compile fails the build. Component
|
|
76
71
|
* `*.module.(s)css` imports compile in automatically — list here only what
|
|
77
|
-
* lives outside the component graph.
|
|
72
|
+
* lives outside the component graph. Defaults to the `conlocaCMS` value.
|
|
78
73
|
*/
|
|
79
74
|
siteStyles?: string | string[];
|
|
80
75
|
/**
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
* content-wrapper shape prose editing should adopt. When set, the build
|
|
84
|
-
* reads that route's rendered page (a prerendered file, or the booted node
|
|
85
|
-
* server entry), collects its CSS and wrapper shape, and registers them
|
|
86
|
-
* alongside the bundle. Unset: discovery is skipped and the editor falls
|
|
87
|
-
* back to the prose-safe derived tier.
|
|
88
|
-
*
|
|
89
|
-
* @example '/blog/welcome-post'
|
|
90
|
-
*/
|
|
91
|
-
fragmentPreviewRoute?: string;
|
|
92
|
-
/**
|
|
93
|
-
* Public base URL of the deployed site, used to absolutize the editor
|
|
94
|
-
* bundle URL when no dedicated preview domain is configured. Falls back to
|
|
95
|
-
* the CF_PAGES_URL env var; without either, registration is skipped.
|
|
96
|
-
*/
|
|
97
|
-
publicBaseUrl?: string;
|
|
98
|
-
/**
|
|
99
|
-
* Optional dedicated preview deployment as a hostname or absolute URL. A
|
|
100
|
-
* hostname is normalized to HTTPS. When set, editor assets and preview links
|
|
101
|
-
* use this deployment instead of the production site's public base URL.
|
|
102
|
-
*/
|
|
103
|
-
previewDomain?: string;
|
|
104
|
-
/**
|
|
105
|
-
* Recursive preview build configuration. Set to `false` to opt out.
|
|
106
|
-
* Defaults to enabled with project defaults.
|
|
76
|
+
* Off unless given as an object; the second build that serves draft
|
|
77
|
+
* previews. Refused under @astrojs/vercel and @astrojs/netlify.
|
|
107
78
|
*/
|
|
108
79
|
previewBuild?: PreviewBuildOptions | false;
|
|
109
80
|
/**
|
|
@@ -112,14 +83,5 @@ export interface ConlocaCloudOptions {
|
|
|
112
83
|
* deployment must supply `CONLOCA_SAAS_ISSUER` at runtime.
|
|
113
84
|
*/
|
|
114
85
|
saasIssuer?: string;
|
|
115
|
-
/**
|
|
116
|
-
* Fail the build when registration is SKIPPED for a missing prerequisite
|
|
117
|
-
* (no build token, no repository identity, no git sha/branch, no public
|
|
118
|
-
* base URL). Default false, so a plain `astro build` without the token
|
|
119
|
-
* stays untouched. Turn it on in CI once setup is done: a deploy can
|
|
120
|
-
* then never silently leave the editor at the endpoint stale. An ATTEMPTED
|
|
121
|
-
* registration that fails always fails the build, regardless of this.
|
|
122
|
-
*/
|
|
123
|
-
requireRegistration?: boolean;
|
|
124
86
|
}
|
|
125
87
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/src/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAE9C
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAE9C;;;;;;;;GAQG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,OAAO,CAAC,EAAE,gBAAgB,CAAC;IAC3B;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;;;;;;;;OAUG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC/B;;;OAGG;IACH,YAAY,CAAC,EAAE,mBAAmB,GAAG,KAAK,CAAC;IAC3C;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@conloca/cloud-astro",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -9,8 +9,13 @@
|
|
|
9
9
|
"url": "git+https://github.com/conloca/conloca.git",
|
|
10
10
|
"directory": "packages/cloud-astro"
|
|
11
11
|
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"astro-integration",
|
|
14
|
+
"withastro",
|
|
15
|
+
"conloca"
|
|
16
|
+
],
|
|
12
17
|
"license": "FSL-1.1-ALv2",
|
|
13
|
-
"description": "Astro integration that
|
|
18
|
+
"description": "Astro integration that writes your site's editor page to /_conloca/editor/, plus the modules that serve draft previews",
|
|
14
19
|
"type": "module",
|
|
15
20
|
"sideEffects": false,
|
|
16
21
|
"main": "./dist/src/index.js",
|
|
@@ -38,11 +43,6 @@
|
|
|
38
43
|
"import": "./dist/src/site-middleware.js",
|
|
39
44
|
"default": "./dist/src/site-middleware.js"
|
|
40
45
|
},
|
|
41
|
-
"./bundle": {
|
|
42
|
-
"types": "./dist/src/bundle.d.ts",
|
|
43
|
-
"import": "./dist/src/bundle.js",
|
|
44
|
-
"default": "./dist/src/bundle.js"
|
|
45
|
-
},
|
|
46
46
|
"./doctor": {
|
|
47
47
|
"types": "./dist/src/doctor.d.ts",
|
|
48
48
|
"import": "./dist/src/doctor.js",
|
|
@@ -69,13 +69,13 @@
|
|
|
69
69
|
},
|
|
70
70
|
"peerDependencies": {
|
|
71
71
|
"@astrojs/react": "^6.0.5",
|
|
72
|
-
"@conloca/astro-cms": "0.2.
|
|
72
|
+
"@conloca/astro-cms": "0.2.3",
|
|
73
73
|
"astro": "^7.3.1",
|
|
74
74
|
"vite": "^8.2.2"
|
|
75
75
|
},
|
|
76
76
|
"dependencies": {
|
|
77
|
-
"@conloca/content-api": "0.2.
|
|
78
|
-
"
|
|
77
|
+
"@conloca/content-api": "0.2.3",
|
|
78
|
+
"@conloca/mdx": "0.2.3",
|
|
79
79
|
"hast-util-from-html": "^2.0.3",
|
|
80
80
|
"jose": "^6.2.10",
|
|
81
81
|
"sass": "^1.103.1",
|
|
@@ -83,10 +83,13 @@
|
|
|
83
83
|
},
|
|
84
84
|
"devDependencies": {
|
|
85
85
|
"@astrojs/check": "^0.9.10",
|
|
86
|
-
"@
|
|
86
|
+
"@astrojs/cloudflare": "14.3.2",
|
|
87
|
+
"@astrojs/sitemap": "^3.7.3",
|
|
88
|
+
"@conloca/astro-cms": "0.2.3",
|
|
87
89
|
"astro": "^7.3.1",
|
|
88
90
|
"typescript": "^6.0.3",
|
|
89
|
-
"vite": "^8.2.2"
|
|
91
|
+
"vite": "^8.2.2",
|
|
92
|
+
"wrangler": "^4.130.0"
|
|
90
93
|
},
|
|
91
94
|
"engines": {
|
|
92
95
|
"node": ">=20.0.0"
|
|
@@ -139,16 +142,42 @@
|
|
|
139
142
|
}
|
|
140
143
|
},
|
|
141
144
|
"test": {
|
|
145
|
+
"//": "The tests read the shipped skill page and the README section a warning points to. The default input excludes every Markdown file, and that exclusion wins over a file listed by name, so the project's own files are hashed in full.",
|
|
142
146
|
"executor": "@smoothbricks/nx-plugin:bounded-exec",
|
|
143
147
|
"dependsOn": [
|
|
144
148
|
"typecheck-tests",
|
|
145
149
|
"build",
|
|
146
|
-
"test-packed"
|
|
150
|
+
"test-packed",
|
|
151
|
+
"test-editor-build"
|
|
152
|
+
],
|
|
153
|
+
"inputs": [
|
|
154
|
+
"{projectRoot}/**/*",
|
|
155
|
+
"^default"
|
|
156
|
+
],
|
|
157
|
+
"options": {
|
|
158
|
+
"command": "bun test --timeout=0 ./src",
|
|
159
|
+
"cwd": "{projectRoot}",
|
|
160
|
+
"idleTimeoutMs": 180000,
|
|
161
|
+
"killAfterMs": 10000
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
"test-editor-build": {
|
|
165
|
+
"//": "Real Astro builds of generated fixture sites: slower than the unit lane, and about five times slower on GitHub's 2-core runners, so it has its own budget.",
|
|
166
|
+
"executor": "@smoothbricks/nx-plugin:bounded-exec",
|
|
167
|
+
"cache": true,
|
|
168
|
+
"inputs": [
|
|
169
|
+
"default",
|
|
170
|
+
"^production",
|
|
171
|
+
"{workspaceRoot}/bun.lock"
|
|
172
|
+
],
|
|
173
|
+
"dependsOn": [
|
|
174
|
+
"build",
|
|
175
|
+
"^build"
|
|
147
176
|
],
|
|
148
177
|
"options": {
|
|
149
|
-
"command": "bun test --timeout=
|
|
178
|
+
"command": "bun test --timeout=180000 ./test-editor-build",
|
|
150
179
|
"cwd": "{projectRoot}",
|
|
151
|
-
"timeoutMs":
|
|
180
|
+
"timeoutMs": 900000,
|
|
152
181
|
"killAfterMs": 10000
|
|
153
182
|
}
|
|
154
183
|
},
|
|
@@ -4,13 +4,14 @@ import { join } from 'node:path';
|
|
|
4
4
|
import { endpointReaderOptions, type PuckManifest, readPuckConfig } from '@conloca/astro-cms/puck-manifest';
|
|
5
5
|
import { COMPONENT_MANIFEST_LIMITS, measureJson } from '@conloca/content-api/component-vocabulary';
|
|
6
6
|
|
|
7
|
-
/** The emitted manifest: its site-relative URL and the full sha-256 hex of its bytes. */
|
|
7
|
+
/** The emitted manifest: its site-relative URL, its file name and the full sha-256 hex of its bytes. */
|
|
8
8
|
export interface ComponentManifestArtifact {
|
|
9
9
|
url: string;
|
|
10
|
+
filename: string;
|
|
10
11
|
hash: string;
|
|
11
12
|
}
|
|
12
13
|
|
|
13
|
-
/** Metadata transport ceiling; larger metadata must not
|
|
14
|
+
/** Metadata transport ceiling; larger metadata must not ship as a usable artifact. */
|
|
14
15
|
const MAX_MANIFEST_BYTES = COMPONENT_MANIFEST_LIMITS.bytes;
|
|
15
16
|
|
|
16
17
|
type Logger = { info(message: string): void; warn(message: string): void };
|
|
@@ -19,8 +20,7 @@ type Logger = { info(message: string): void; warn(message: string): void };
|
|
|
19
20
|
* Writes the site's component vocabulary — every Puck component the config
|
|
20
21
|
* declares and what each accepts, read from source and never executed — as a
|
|
21
22
|
* content-addressed artifact beside the editor bundle:
|
|
22
|
-
*
|
|
23
|
-
* bundle wrote already covers it, and `mirrorEditorAssets` copies the dir.
|
|
23
|
+
* `<folder>/component-manifest.<hash16>.json`.
|
|
24
24
|
*
|
|
25
25
|
* Fail-soft: the manifest is metadata for agents, so a failure costs the
|
|
26
26
|
* manifest and warns — never the build. A config the reader cannot fully read
|
|
@@ -29,10 +29,13 @@ type Logger = { info(message: string): void; warn(message: string): void };
|
|
|
29
29
|
*/
|
|
30
30
|
export async function emitComponentManifest(input: {
|
|
31
31
|
dir: string;
|
|
32
|
+
/** Folder below `dir` to write into; `_conloca` unless given. */
|
|
33
|
+
folder?: string;
|
|
32
34
|
puckConfigPath: string;
|
|
33
35
|
projectRoot: string;
|
|
34
36
|
logger: Logger;
|
|
35
37
|
}): Promise<ComponentManifestArtifact | undefined> {
|
|
38
|
+
const folder = input.folder ?? '_conloca';
|
|
36
39
|
try {
|
|
37
40
|
const manifest = readPuckConfig(
|
|
38
41
|
endpointReaderOptions({ puckConfigPath: input.puckConfigPath, projectRoot: input.projectRoot }),
|
|
@@ -47,10 +50,10 @@ export async function emitComponentManifest(input: {
|
|
|
47
50
|
measureJson(manifest, COMPONENT_MANIFEST_LIMITS);
|
|
48
51
|
const hash = createHash('sha256').update(bytes).digest('hex');
|
|
49
52
|
const filename = `component-manifest.${hash.slice(0, 16)}.json`;
|
|
50
|
-
await mkdir(join(input.dir,
|
|
51
|
-
await writeFile(join(input.dir,
|
|
52
|
-
reportManifest(manifest,
|
|
53
|
-
return { url:
|
|
53
|
+
await mkdir(join(input.dir, folder), { recursive: true });
|
|
54
|
+
await writeFile(join(input.dir, folder, filename), bytes);
|
|
55
|
+
reportManifest(manifest, `/${folder}/${filename}`, input.logger);
|
|
56
|
+
return { url: `/${folder}/${filename}`, filename, hash };
|
|
54
57
|
} catch (error) {
|
|
55
58
|
input.logger.warn(
|
|
56
59
|
'component manifest skipped — agents get no component vocabulary from this build ' +
|
package/src/constants.ts
CHANGED
|
@@ -7,22 +7,13 @@ export const PACKAGE_NAME = '@conloca/cloud-astro';
|
|
|
7
7
|
/**
|
|
8
8
|
* Environment variable that the recursive preview build sets on the child
|
|
9
9
|
* Astro process so the integration's own `astro:build:done` hook can detect
|
|
10
|
-
* it and skip
|
|
10
|
+
* it and skip the editor page and further recursion.
|
|
11
11
|
*/
|
|
12
12
|
export const PREVIEW_BUILD_ENV_FLAG = 'CONLOCA_PREVIEW_BUILD';
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
16
|
-
* the
|
|
17
|
-
*
|
|
15
|
+
* Adapters the preview build is refused under: they write their deployable
|
|
16
|
+
* output at the project root whatever `outDir` says, so the preview build
|
|
17
|
+
* could replace the live site.
|
|
18
18
|
*/
|
|
19
|
-
export const
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Environment variable carrying the build token (`cbt_<id>.<secret>`),
|
|
23
|
-
* issued by the endpoint, that authenticates the site's build to the
|
|
24
|
-
* endpoint's registration route.
|
|
25
|
-
* Read when {@link ConlocaCloudOptions.buildToken} is not set, so CI can
|
|
26
|
-
* inject the credential without committing it to `astro.config.mjs`.
|
|
27
|
-
*/
|
|
28
|
-
export const BUILD_TOKEN_ENV_VAR = 'CONLOCA_BUILD_TOKEN';
|
|
19
|
+
export const REFUSED_PREVIEW_ADAPTERS: readonly string[] = ['@astrojs/vercel', '@astrojs/netlify'];
|
package/src/descriptors.ts
CHANGED
|
@@ -5,11 +5,11 @@ import {
|
|
|
5
5
|
readEditorDescriptors,
|
|
6
6
|
toPortableImports,
|
|
7
7
|
} from '@conloca/astro-cms/node';
|
|
8
|
-
import type { EditorBundleDescriptors } from './bundle.js';
|
|
8
|
+
import type { EditorBundleDescriptors } from './editor-page/bundle.js';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* The MDX discovery seam, so tests can drive the failure path without a
|
|
12
|
-
* fixture project
|
|
12
|
+
* fixture project.
|
|
13
13
|
*/
|
|
14
14
|
export type MdxDescriptorScan = (options: MdxRegistryScanOptions) => Promise<readonly unknown[]>;
|
|
15
15
|
|