@conloca/cloud-astro 0.0.0-stage → 0.2.2
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 +328 -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 +181 -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 +544 -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 +55 -0
- package/dist/src/preview/_dispatch.d.ts.map +1 -0
- package/dist/src/preview/_dispatch.js +72 -0
- package/dist/src/preview/_dispatch.js.map +1 -0
- package/dist/src/preview/_resolve-opts.d.ts +30 -0
- package/dist/src/preview/_resolve-opts.d.ts.map +1 -0
- package/dist/src/preview/_resolve-opts.js +73 -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 +118 -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 +160 -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 +135 -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 +182 -4
- package/src/build-commit.ts +22 -0
- package/src/bundle.ts +570 -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 +607 -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 +105 -0
- package/src/preview/_resolve-opts.ts +89 -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 +309 -0
- package/src/preview/preview-path.ts +28 -0
- package/src/preview/satteri-workerd.ts +24 -0
- package/src/preview/site-middleware.ts +210 -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 +137 -0
- package/src/virtual-modules.d.ts +52 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Astro middleware entrypoint for the recursive preview build.
|
|
3
|
+
*
|
|
4
|
+
* `addMiddleware({ entrypoint: '@conloca/cloud-astro/site-middleware' })` in
|
|
5
|
+
* the integration resolves to this module, so it must export `onRequest` —
|
|
6
|
+
* Astro's middleware contract. The verdict/render logic lives in
|
|
7
|
+
* `./preview/site-middleware.ts`, which is env-free and unit-testable; this
|
|
8
|
+
* file binds it to the runtime env resolution and to the site's own build
|
|
9
|
+
* graph: `astro:content` and the routing-config virtual module only resolve
|
|
10
|
+
* here, so the collection-backed baseline is constructed here and injected as
|
|
11
|
+
* a seam.
|
|
12
|
+
*
|
|
13
|
+
* Mounted ONLY inside the preview build (see `integration.ts`), never in the
|
|
14
|
+
* site's production build.
|
|
15
|
+
*/
|
|
16
|
+
import { getCollection } from 'astro:content';
|
|
17
|
+
import baked from 'virtual:conloca-preview-opts';
|
|
18
|
+
import routingConfig from 'virtual:conloca-routing-config';
|
|
19
|
+
import { createCollectionBackedContentAPI } from '@conloca/astro-cms';
|
|
20
|
+
import { resolveEndpointFetch, resolveFromBaked } from './preview/_resolve-opts.js';
|
|
21
|
+
import { createPreviewSiteMiddleware, } from './preview/site-middleware.js';
|
|
22
|
+
import { untagWorkerdProcess } from './preview/workerd-shim.js';
|
|
23
|
+
// At Cloudflare Worker start-up, before any render: workerd's nodejs_compat
|
|
24
|
+
// process can masquerade as Node's, sending Astro down a streaming branch whose
|
|
25
|
+
// body the Cloudflare Workers Response cannot consume — every on-demand page then renders as the
|
|
26
|
+
// literal string "[object Object]". See the shim's doc for the full chain.
|
|
27
|
+
untagWorkerdProcess();
|
|
28
|
+
// One baseline per process: the built collections are immutable at runtime,
|
|
29
|
+
// and constructing the collection-backed reader walks every collection.
|
|
30
|
+
let baselinePromise;
|
|
31
|
+
function baselineApi() {
|
|
32
|
+
baselinePromise ??= createCollectionBackedContentAPI({
|
|
33
|
+
getCollection: (name) => getCollection(name),
|
|
34
|
+
routing: routingConfig,
|
|
35
|
+
});
|
|
36
|
+
return baselinePromise;
|
|
37
|
+
}
|
|
38
|
+
export async function onRequest(context, next) {
|
|
39
|
+
const handler = createPreviewSiteMiddleware(() => resolveFromBaked(baked, (name) => process.env[name]), {
|
|
40
|
+
baselineApi,
|
|
41
|
+
site: routingConfig.siteName,
|
|
42
|
+
locale: routingConfig.locale,
|
|
43
|
+
fetchFn: await resolveEndpointFetch(),
|
|
44
|
+
});
|
|
45
|
+
return handler(context, next);
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=site-middleware.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"site-middleware.js","sourceRoot":"","sources":["../../src/site-middleware.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,MAAM,8BAA8B,CAAC;AACjD,OAAO,aAAa,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,gCAAgC,EAAE,MAAM,oBAAoB,CAAC;AAEtE,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACpF,OAAO,EACL,2BAA2B,GAG5B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAEhE,4EAA4E;AAC5E,gFAAgF;AAChF,iGAAiG;AACjG,2EAA2E;AAC3E,mBAAmB,EAAE,CAAC;AAEtB,4EAA4E;AAC5E,wEAAwE;AACxE,IAAI,eAAgD,CAAC;AACrD,SAAS,WAAW;IAClB,eAAe,KAAK,gCAAgC,CAAC;QACnD,aAAa,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC;QAC5C,OAAO,EAAE,aAAa;KACvB,CAAC,CAAC;IACH,OAAO,eAAe,CAAC;AACzB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,OAAiC,EAAE,IAA2B;IAC5F,MAAM,OAAO,GAAG,2BAA2B,CAAC,GAAG,EAAE,CAAC,gBAAgB,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,EAAE;QACtG,WAAW;QACX,IAAI,EAAE,aAAa,CAAC,QAAQ;QAC5B,MAAM,EAAE,aAAa,CAAC,MAAM;QAC5B,OAAO,EAAE,MAAM,oBAAoB,EAAE;KACtC,CAAC,CAAC;IACH,OAAO,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;AAChC,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export declare const SKILL_RELATIVE_PATH: string;
|
|
2
|
+
/**
|
|
3
|
+
* The canonical page, located from the package root (through the package's own `./package.json` export) so the
|
|
4
|
+
* built `dist/src/skill.js` and the source `src/skill.ts` reach the same shipped `src/skill/SKILL.md`. Resolved on
|
|
5
|
+
* demand, not at import: a copy running outside its package boundary must fail inside scaffoldSkill's
|
|
6
|
+
* fail-soft path, never while the site's Astro config is loading.
|
|
7
|
+
*/
|
|
8
|
+
export declare function skillTemplateUrl(): URL;
|
|
9
|
+
type SkillLogger = {
|
|
10
|
+
info(msg: string): void;
|
|
11
|
+
debug(msg: string): void;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* The nearest directory, from the Astro project root up to the git root, that
|
|
15
|
+
* carries a `.claude/`. Repo-root layouts are the real ones: a site's
|
|
16
|
+
* Astro project is usually a workspace member below the repo root. Needs a git
|
|
17
|
+
* root: a project outside any repository gets nothing.
|
|
18
|
+
*/
|
|
19
|
+
export declare function findClaudeHome(projectRoot: string): string | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* Write the skill page once — never overwrite, never throw. A read-only CI
|
|
22
|
+
* checkout must not break a build over documentation.
|
|
23
|
+
*/
|
|
24
|
+
export declare function scaffoldSkill(projectRoot: string, logger: SkillLogger): 'written' | 'exists' | 'skipped' | 'failed';
|
|
25
|
+
export {};
|
|
26
|
+
//# sourceMappingURL=skill.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skill.d.ts","sourceRoot":"","sources":["../../src/skill.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,mBAAmB,QAAyD,CAAC;AAE1F;;;;;GAKG;AACH,wBAAgB,gBAAgB,IAAI,GAAG,CAGtC;AAED,KAAK,WAAW,GAAG;IAAE,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC;AAEzE;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAYtE;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,CAoBnH"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import { createRequire } from 'node:module';
|
|
3
|
+
import { dirname, join } from 'node:path';
|
|
4
|
+
import { pathToFileURL } from 'node:url';
|
|
5
|
+
import { messageOf } from './message-of.js';
|
|
6
|
+
export const SKILL_RELATIVE_PATH = join('.claude', 'skills', 'conloca-cloud', 'SKILL.md');
|
|
7
|
+
/**
|
|
8
|
+
* The canonical page, located from the package root (through the package's own `./package.json` export) so the
|
|
9
|
+
* built `dist/src/skill.js` and the source `src/skill.ts` reach the same shipped `src/skill/SKILL.md`. Resolved on
|
|
10
|
+
* demand, not at import: a copy running outside its package boundary must fail inside scaffoldSkill's
|
|
11
|
+
* fail-soft path, never while the site's Astro config is loading.
|
|
12
|
+
*/
|
|
13
|
+
export function skillTemplateUrl() {
|
|
14
|
+
const packageRoot = dirname(createRequire(import.meta.url).resolve('@conloca/cloud-astro/package.json'));
|
|
15
|
+
return pathToFileURL(join(packageRoot, 'src', 'skill', 'SKILL.md'));
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The nearest directory, from the Astro project root up to the git root, that
|
|
19
|
+
* carries a `.claude/`. Repo-root layouts are the real ones: a site's
|
|
20
|
+
* Astro project is usually a workspace member below the repo root. Needs a git
|
|
21
|
+
* root: a project outside any repository gets nothing.
|
|
22
|
+
*/
|
|
23
|
+
export function findClaudeHome(projectRoot) {
|
|
24
|
+
let dir = projectRoot;
|
|
25
|
+
let home;
|
|
26
|
+
for (;;) {
|
|
27
|
+
if (home === undefined && existsSync(join(dir, '.claude')))
|
|
28
|
+
home = dir;
|
|
29
|
+
// The git root bounds the walk; without one there is no repo to scaffold into
|
|
30
|
+
// (a stray ~/.claude must never receive a global copy).
|
|
31
|
+
if (existsSync(join(dir, '.git')))
|
|
32
|
+
return home;
|
|
33
|
+
const parent = dirname(dir);
|
|
34
|
+
if (parent === dir)
|
|
35
|
+
return undefined;
|
|
36
|
+
dir = parent;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Write the skill page once — never overwrite, never throw. A read-only CI
|
|
41
|
+
* checkout must not break a build over documentation.
|
|
42
|
+
*/
|
|
43
|
+
export function scaffoldSkill(projectRoot, logger) {
|
|
44
|
+
const home = findClaudeHome(projectRoot);
|
|
45
|
+
if (home === undefined) {
|
|
46
|
+
logger.debug('no .claude/ directory between the project and the git root — agent skill not scaffolded');
|
|
47
|
+
return 'skipped';
|
|
48
|
+
}
|
|
49
|
+
const target = join(home, SKILL_RELATIVE_PATH);
|
|
50
|
+
if (existsSync(target))
|
|
51
|
+
return 'exists';
|
|
52
|
+
try {
|
|
53
|
+
mkdirSync(dirname(target), { recursive: true });
|
|
54
|
+
writeFileSync(target, readFileSync(skillTemplateUrl(), 'utf8'), { flag: 'wx' });
|
|
55
|
+
logger.info(`agent skill written to ${target}`);
|
|
56
|
+
return 'written';
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
// The exclusive write lost a race with a concurrent build (or a symlink sits
|
|
60
|
+
// at the path): the page is there, which is the truthful outcome.
|
|
61
|
+
if (error.code === 'EEXIST')
|
|
62
|
+
return 'exists';
|
|
63
|
+
logger.info(`agent skill not written to ${target} (${messageOf(error)})`);
|
|
64
|
+
return 'failed';
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=skill.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skill.js","sourceRoot":"","sources":["../../src/skill.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CAAC,SAAS,EAAE,QAAQ,EAAE,eAAe,EAAE,UAAU,CAAC,CAAC;AAE1F;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB;IAC9B,MAAM,WAAW,GAAG,OAAO,CAAC,aAAa,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,mCAAmC,CAAC,CAAC,CAAC;IACzG,OAAO,aAAa,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC;AACtE,CAAC;AAID;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,WAAmB;IAChD,IAAI,GAAG,GAAG,WAAW,CAAC;IACtB,IAAI,IAAwB,CAAC;IAC7B,SAAS,CAAC;QACR,IAAI,IAAI,KAAK,SAAS,IAAI,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;YAAE,IAAI,GAAG,GAAG,CAAC;QACvE,8EAA8E;QAC9E,wDAAwD;QACxD,IAAI,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;YAAE,OAAO,IAAI,CAAC;QAC/C,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;QAC5B,IAAI,MAAM,KAAK,GAAG;YAAE,OAAO,SAAS,CAAC;QACrC,GAAG,GAAG,MAAM,CAAC;IACf,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,WAAmB,EAAE,MAAmB;IACpE,MAAM,IAAI,GAAG,cAAc,CAAC,WAAW,CAAC,CAAC;IACzC,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,MAAM,CAAC,KAAK,CAAC,yFAAyF,CAAC,CAAC;QACxG,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,EAAE,mBAAmB,CAAC,CAAC;IAC/C,IAAI,UAAU,CAAC,MAAM,CAAC;QAAE,OAAO,QAAQ,CAAC;IACxC,IAAI,CAAC;QACH,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAChD,aAAa,CAAC,MAAM,EAAE,YAAY,CAAC,gBAAgB,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QAChF,MAAM,CAAC,IAAI,CAAC,0BAA0B,MAAM,EAAE,CAAC,CAAC;QAChD,OAAO,SAAS,CAAC;IACnB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,6EAA6E;QAC7E,kEAAkE;QAClE,IAAK,KAA+B,CAAC,IAAI,KAAK,QAAQ;YAAE,OAAO,QAAQ,CAAC;QACxE,MAAM,CAAC,IAAI,CAAC,8BAA8B,MAAM,KAAK,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC1E,OAAO,QAAQ,CAAC;IAClB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import type { AstroIntegration } from 'astro';
|
|
2
|
+
import type { Plugin as EsbuildPlugin } from 'esbuild';
|
|
3
|
+
/**
|
|
4
|
+
* Configuration for a recursive preview build that runs immediately after the
|
|
5
|
+
* site's production build completes. The preview build emits the SSR routes
|
|
6
|
+
* that serve draft preview.
|
|
7
|
+
*
|
|
8
|
+
* Set to `false` to explicitly opt out of preview builds for sites that do not
|
|
9
|
+
* need a draft/preview pipeline.
|
|
10
|
+
*/
|
|
11
|
+
export interface PreviewBuildOptions {
|
|
12
|
+
/**
|
|
13
|
+
* Optional alternative Astro adapter to use for the preview build.
|
|
14
|
+
* Falls back to the project's default adapter when omitted.
|
|
15
|
+
*/
|
|
16
|
+
adapter?: AstroIntegration;
|
|
17
|
+
/**
|
|
18
|
+
* Adapter-specific config overrides forwarded to the recursive build.
|
|
19
|
+
*/
|
|
20
|
+
config?: Record<string, unknown>;
|
|
21
|
+
/**
|
|
22
|
+
* Output directory for the preview build. Defaults to `.conloca/preview-server`
|
|
23
|
+
* — outside `dist/`, so the secret-baked artifact can never ride a wholesale
|
|
24
|
+
* static upload of the site and Astro's dist-clearing cannot wipe it.
|
|
25
|
+
*/
|
|
26
|
+
outDir?: string;
|
|
27
|
+
/**
|
|
28
|
+
* If true, fail the parent build when the preview build fails. Defaults to
|
|
29
|
+
* true; set false while setting up.
|
|
30
|
+
*/
|
|
31
|
+
required?: boolean;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Options accepted by {@link conlocaCloud}.
|
|
35
|
+
*
|
|
36
|
+
* Registration authenticates with one build token (`cbt_<id>.<secret>`)
|
|
37
|
+
* issued by the endpoint. Repository identity is normally detected from CI metadata or the Git
|
|
38
|
+
* checkout.
|
|
39
|
+
*/
|
|
40
|
+
export interface ConlocaCloudOptions {
|
|
41
|
+
/** Editor endpoint, e.g. 'https://cms.example.com', no trailing slash. */
|
|
42
|
+
endpoint: string;
|
|
43
|
+
/**
|
|
44
|
+
* Advanced override for repository identity, normalized to `owner/repo`.
|
|
45
|
+
* Normally omit this: Conloca detects GitHub, Vercel, or GitLab CI metadata,
|
|
46
|
+
* then falls back to the checkout's `remote.origin.url`. Registration is
|
|
47
|
+
* rejected when the token does not cover the detected repo.
|
|
48
|
+
*/
|
|
49
|
+
repoUri?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Advanced override for the deployable-site id, for CMS-less builds where
|
|
52
|
+
* `conlocaCMS` does not publish CONLOCA_CONTENT_ROOT. When the CMS channel IS
|
|
53
|
+
* present, the content root's sites.json is authoritative and an override
|
|
54
|
+
* that contradicts it fails the build — never a silent pick.
|
|
55
|
+
*/
|
|
56
|
+
siteId?: string;
|
|
57
|
+
/**
|
|
58
|
+
* Build token issued by the endpoint. Prefer injecting it via the
|
|
59
|
+
* CONLOCA_BUILD_TOKEN environment variable instead of committing it here;
|
|
60
|
+
* when neither is present the build skips registration (fail soft, unless
|
|
61
|
+
* `requireRegistration` is set).
|
|
62
|
+
*/
|
|
63
|
+
buildToken?: string;
|
|
64
|
+
/**
|
|
65
|
+
* Entry module of the puck config to compile into the editor bundle,
|
|
66
|
+
* e.g. './src/puck.config.tsx'. Same option name as @conloca/astro-cms.
|
|
67
|
+
*/
|
|
68
|
+
puckConfigPath: string;
|
|
69
|
+
/**
|
|
70
|
+
* Site CSS for accurate preview rendering — same option name and shape
|
|
71
|
+
* as `conlocaCMS({ siteStyles })`, and compiled the same way: by the site's
|
|
72
|
+
* own Vite pipeline (its plugins, PostCSS config and preprocessors), into
|
|
73
|
+
* the canvas stylesheet each build registers, ahead of the
|
|
74
|
+
* component modules, e.g. './src/styles/index.scss'. Paths resolve against
|
|
75
|
+
* the project root. The assets these stylesheets reference are emitted under
|
|
76
|
+
* `/_conloca/`, and an entry that fails to compile fails the build. Component
|
|
77
|
+
* `*.module.(s)css` imports compile in automatically — list here only what
|
|
78
|
+
* lives outside the component graph.
|
|
79
|
+
*/
|
|
80
|
+
siteStyles?: string | string[];
|
|
81
|
+
/**
|
|
82
|
+
* esbuild plugins for the editor bundle (puck config, its components and the
|
|
83
|
+
* conlocaCMS schemas module). That bundle is built with esbuild, outside the
|
|
84
|
+
* site's Vite pipeline, so a source transform the site's Vite plugins apply
|
|
85
|
+
* — e.g. Typia's `createValidate<T>()` generation in page schemas — must be
|
|
86
|
+
* passed here in its esbuild form too, or the bundle carries untransformed
|
|
87
|
+
* calls that throw when the editor loads it.
|
|
88
|
+
*/
|
|
89
|
+
editorBundlePlugins?: EsbuildPlugin[];
|
|
90
|
+
/**
|
|
91
|
+
* Representative content route for build-time style discovery — the SAME
|
|
92
|
+
* name and meaning as `conlocaCMS`'s option: the page whose styles and
|
|
93
|
+
* content-wrapper shape prose editing should adopt. When set, the build
|
|
94
|
+
* reads that route's rendered page (a prerendered file, or the booted node
|
|
95
|
+
* server entry), collects its CSS and wrapper shape, and registers them
|
|
96
|
+
* alongside the bundle. Unset: discovery is skipped and the editor falls
|
|
97
|
+
* back to the prose-safe derived tier.
|
|
98
|
+
*
|
|
99
|
+
* @example '/blog/welcome-post'
|
|
100
|
+
*/
|
|
101
|
+
fragmentPreviewRoute?: string;
|
|
102
|
+
/**
|
|
103
|
+
* Public base URL of the deployed site, used to absolutize the editor
|
|
104
|
+
* bundle URL when no dedicated preview domain is configured. Falls back to
|
|
105
|
+
* the CF_PAGES_URL env var; without either, registration is skipped.
|
|
106
|
+
*/
|
|
107
|
+
publicBaseUrl?: string;
|
|
108
|
+
/**
|
|
109
|
+
* Optional dedicated preview deployment as a hostname or absolute URL. A
|
|
110
|
+
* hostname is normalized to HTTPS. When set, editor assets and preview links
|
|
111
|
+
* use this deployment instead of the production site's public base URL.
|
|
112
|
+
*/
|
|
113
|
+
previewDomain?: string;
|
|
114
|
+
/**
|
|
115
|
+
* Recursive preview build configuration. Set to `false` to opt out.
|
|
116
|
+
* Defaults to enabled with project defaults.
|
|
117
|
+
*/
|
|
118
|
+
previewBuild?: PreviewBuildOptions | false;
|
|
119
|
+
/**
|
|
120
|
+
* The token issuer (the JWT `iss` the preview middleware pins).
|
|
121
|
+
* Set it to bake the value into the preview artifact; otherwise the
|
|
122
|
+
* deployment must supply `CONLOCA_SAAS_ISSUER` at runtime.
|
|
123
|
+
*/
|
|
124
|
+
saasIssuer?: string;
|
|
125
|
+
/**
|
|
126
|
+
* Fail the build when registration is SKIPPED for a missing prerequisite
|
|
127
|
+
* (no build token, no repository identity, no git sha/branch, no public
|
|
128
|
+
* base URL). Default false, so a plain `astro build` without the token
|
|
129
|
+
* stays untouched. Turn it on in CI once setup is done: a deploy can
|
|
130
|
+
* then never silently leave the editor at the endpoint stale. An ATTEMPTED
|
|
131
|
+
* registration that fails always fails the build, regardless of this.
|
|
132
|
+
*/
|
|
133
|
+
requireRegistration?: boolean;
|
|
134
|
+
}
|
|
135
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAC9C,OAAO,KAAK,EAAE,MAAM,IAAI,aAAa,EAAE,MAAM,SAAS,CAAC;AAEvD;;;;;;;GAOG;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;;;;;;GAMG;AACH,MAAM,WAAW,mBAAmB;IAClC,0EAA0E;IAC1E,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB;;;;;;;;;;OAUG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC/B;;;;;;;OAOG;IACH,mBAAmB,CAAC,EAAE,aAAa,EAAE,CAAC;IACtC;;;;;;;;;;OAUG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAE9B;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,YAAY,CAAC,EAAE,mBAAmB,GAAG,KAAK,CAAC;IAC3C;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;;;;OAOG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,184 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@conloca/cloud-astro",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
|
|
6
|
-
}
|
|
3
|
+
"version": "0.2.2",
|
|
4
|
+
"publishConfig": {
|
|
5
|
+
"access": "public"
|
|
6
|
+
},
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/conloca/conloca.git",
|
|
10
|
+
"directory": "packages/cloud-astro"
|
|
11
|
+
},
|
|
12
|
+
"license": "FSL-1.1-ALv2",
|
|
13
|
+
"description": "Astro integration that registers each build's editor bundle at an editor endpoint",
|
|
14
|
+
"type": "module",
|
|
15
|
+
"sideEffects": false,
|
|
16
|
+
"main": "./dist/src/index.js",
|
|
17
|
+
"module": "./dist/src/index.js",
|
|
18
|
+
"types": "./dist/src/index.d.ts",
|
|
19
|
+
"exports": {
|
|
20
|
+
"./package.json": "./package.json",
|
|
21
|
+
".": {
|
|
22
|
+
"types": "./dist/src/index.d.ts",
|
|
23
|
+
"import": "./dist/src/index.js",
|
|
24
|
+
"default": "./dist/src/index.js"
|
|
25
|
+
},
|
|
26
|
+
"./node": {
|
|
27
|
+
"types": "./dist/src/node.d.ts",
|
|
28
|
+
"import": "./dist/src/node.js",
|
|
29
|
+
"default": "./dist/src/node.js"
|
|
30
|
+
},
|
|
31
|
+
"./preview": {
|
|
32
|
+
"types": "./dist/src/preview.d.ts",
|
|
33
|
+
"import": "./dist/src/preview.js",
|
|
34
|
+
"default": "./dist/src/preview.js"
|
|
35
|
+
},
|
|
36
|
+
"./site-middleware": {
|
|
37
|
+
"types": "./dist/src/site-middleware.d.ts",
|
|
38
|
+
"import": "./dist/src/site-middleware.js",
|
|
39
|
+
"default": "./dist/src/site-middleware.js"
|
|
40
|
+
},
|
|
41
|
+
"./bundle": {
|
|
42
|
+
"types": "./dist/src/bundle.d.ts",
|
|
43
|
+
"import": "./dist/src/bundle.js",
|
|
44
|
+
"default": "./dist/src/bundle.js"
|
|
45
|
+
},
|
|
46
|
+
"./doctor": {
|
|
47
|
+
"types": "./dist/src/doctor.d.ts",
|
|
48
|
+
"import": "./dist/src/doctor.js",
|
|
49
|
+
"default": "./dist/src/doctor.js"
|
|
50
|
+
},
|
|
51
|
+
"./satteri-workerd": {
|
|
52
|
+
"types": "./dist/src/preview/satteri-workerd.d.ts",
|
|
53
|
+
"import": "./dist/src/preview/satteri-workerd.js",
|
|
54
|
+
"default": "./dist/src/preview/satteri-workerd.js"
|
|
55
|
+
},
|
|
56
|
+
"./preview-handler": {
|
|
57
|
+
"types": "./src/preview-handler.d.ts",
|
|
58
|
+
"default": "./src/preview-handler.astro"
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"files": [
|
|
62
|
+
"dist",
|
|
63
|
+
"src",
|
|
64
|
+
"!src/__tests__",
|
|
65
|
+
"!**/*.tsbuildinfo"
|
|
66
|
+
],
|
|
67
|
+
"scripts": {
|
|
68
|
+
"test": "nx run cloud-astro:test --outputStyle=stream"
|
|
69
|
+
},
|
|
70
|
+
"peerDependencies": {
|
|
71
|
+
"@astrojs/react": "^6.0.5",
|
|
72
|
+
"@conloca/astro-cms": "0.2.2",
|
|
73
|
+
"astro": "^7.3.1",
|
|
74
|
+
"vite": "^8.2.2"
|
|
75
|
+
},
|
|
76
|
+
"dependencies": {
|
|
77
|
+
"@conloca/content-api": "0.2.2",
|
|
78
|
+
"esbuild": "^0.28.2",
|
|
79
|
+
"hast-util-from-html": "^2.0.3",
|
|
80
|
+
"jose": "^6.2.10",
|
|
81
|
+
"sass": "^1.103.1",
|
|
82
|
+
"tslib": "^2.8.1"
|
|
83
|
+
},
|
|
84
|
+
"devDependencies": {
|
|
85
|
+
"@astrojs/check": "^0.9.10",
|
|
86
|
+
"@conloca/astro-cms": "0.2.2",
|
|
87
|
+
"astro": "^7.3.1",
|
|
88
|
+
"typescript": "^6.0.3",
|
|
89
|
+
"vite": "^8.2.2"
|
|
90
|
+
},
|
|
91
|
+
"engines": {
|
|
92
|
+
"node": ">=20.0.0"
|
|
93
|
+
},
|
|
94
|
+
"conloca": {
|
|
95
|
+
"doctor": "./dist/src/doctor.js"
|
|
96
|
+
},
|
|
97
|
+
"nx": {
|
|
98
|
+
"name": "cloud-astro",
|
|
99
|
+
"tags": [
|
|
100
|
+
"npm:public"
|
|
101
|
+
],
|
|
102
|
+
"targets": {
|
|
103
|
+
"clean": {},
|
|
104
|
+
"lint": {},
|
|
105
|
+
"typecheck": {
|
|
106
|
+
"dependsOn": [
|
|
107
|
+
"^*-js",
|
|
108
|
+
"typecheck-astro"
|
|
109
|
+
]
|
|
110
|
+
},
|
|
111
|
+
"typecheck-astro": {
|
|
112
|
+
"executor": "nx:run-commands",
|
|
113
|
+
"cache": true,
|
|
114
|
+
"dependsOn": [
|
|
115
|
+
"^*-js"
|
|
116
|
+
],
|
|
117
|
+
"inputs": [
|
|
118
|
+
"versionlessProduction",
|
|
119
|
+
"^production",
|
|
120
|
+
"{workspaceRoot}/tsconfig.base.json",
|
|
121
|
+
{
|
|
122
|
+
"json": "{workspaceRoot}/package.json",
|
|
123
|
+
"excludeFields": [
|
|
124
|
+
"version"
|
|
125
|
+
]
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
"json": "{workspaceRoot}/bun.lock",
|
|
129
|
+
"excludeFields": [
|
|
130
|
+
"workspaces"
|
|
131
|
+
]
|
|
132
|
+
},
|
|
133
|
+
"{projectRoot}/tsconfig.astro.json"
|
|
134
|
+
],
|
|
135
|
+
"outputs": [],
|
|
136
|
+
"options": {
|
|
137
|
+
"command": "astro check --noSync --tsconfig tsconfig.astro.json --minimumSeverity warning --minimumFailingSeverity warning",
|
|
138
|
+
"cwd": "{projectRoot}"
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
"test": {
|
|
142
|
+
"//": "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.",
|
|
143
|
+
"executor": "@smoothbricks/nx-plugin:bounded-exec",
|
|
144
|
+
"dependsOn": [
|
|
145
|
+
"typecheck-tests",
|
|
146
|
+
"build",
|
|
147
|
+
"test-packed"
|
|
148
|
+
],
|
|
149
|
+
"inputs": [
|
|
150
|
+
"{projectRoot}/**/*",
|
|
151
|
+
"^default"
|
|
152
|
+
],
|
|
153
|
+
"options": {
|
|
154
|
+
"command": "bun test --timeout=0 ./src",
|
|
155
|
+
"cwd": "{projectRoot}",
|
|
156
|
+
"idleTimeoutMs": 180000,
|
|
157
|
+
"killAfterMs": 10000
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
"test-packed": {
|
|
161
|
+
"//": "The packed shape is a function of the built outputs, the manifest and the locked dependency closure; cached on exactly those.",
|
|
162
|
+
"executor": "nx:run-commands",
|
|
163
|
+
"cache": true,
|
|
164
|
+
"inputs": [
|
|
165
|
+
{
|
|
166
|
+
"dependentTasksOutputFiles": "**/*",
|
|
167
|
+
"transitive": true
|
|
168
|
+
},
|
|
169
|
+
"{projectRoot}/package.json",
|
|
170
|
+
"{workspaceRoot}/bun.lock",
|
|
171
|
+
"{workspaceRoot}/tooling/packaging/**/*"
|
|
172
|
+
],
|
|
173
|
+
"dependsOn": [
|
|
174
|
+
"build",
|
|
175
|
+
"^build"
|
|
176
|
+
],
|
|
177
|
+
"options": {
|
|
178
|
+
"command": "bun tooling/packaging/test-packed.ts cloud-astro",
|
|
179
|
+
"cwd": "{workspaceRoot}"
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
|
|
13
|
+
/** Resolves which commit the registration names and which commit produced the bundle. */
|
|
14
|
+
export function registrationCommits(input: {
|
|
15
|
+
/** The branch's latest commit, as CI hands it over through CF_PAGES_COMMIT_SHA. */
|
|
16
|
+
eventCommitSha: string | undefined;
|
|
17
|
+
/** git rev-parse HEAD in the build checkout. */
|
|
18
|
+
checkoutCommitSha: string | undefined;
|
|
19
|
+
}): RegistrationCommits {
|
|
20
|
+
const gitSha = input.eventCommitSha ?? input.checkoutCommitSha;
|
|
21
|
+
return { gitSha, buildId: input.checkoutCommitSha ?? gitSha };
|
|
22
|
+
}
|