@conloca/cloud-astro 0.2.2 → 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 -208
- 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 -408
- 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/_resolve-opts.d.ts +16 -10
- package/dist/src/preview/_resolve-opts.d.ts.map +1 -1
- package/dist/src/preview/_resolve-opts.js +21 -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 +25 -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 +16 -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 -69
- package/dist/src/types.d.ts.map +1 -1
- package/package.json +37 -13
- 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 -461
- package/src/node.ts +18 -2
- package/src/preview/_resolve-opts.ts +29 -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 +77 -66
- package/src/preview/preview-path.ts +26 -8
- package/src/preview/site-middleware.ts +16 -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 -70
- package/src/virtual-modules.d.ts +4 -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 -181
- 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 -570
- package/src/discovery.ts +0 -183
- package/src/register.ts +0 -180
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { existsSync } from 'node:fs';
|
|
3
|
+
import { cp, mkdir, writeFile } from 'node:fs/promises';
|
|
4
|
+
import { isAbsolute, join, relative, sep } from 'node:path';
|
|
5
|
+
import { readEditorDescriptors } from '@conloca/astro-cms/node';
|
|
6
|
+
import { isValidSiteBase } from '@conloca/content-api';
|
|
7
|
+
import { branchDeploysOf, contentPathsOf, EDITOR_HOST_PROTOCOL, EDITOR_PAGE_INFO_FORMATS, editorUiOrigin, isEditorPageInfo, isValidBranchName, } from '@conloca/content-api/editor-host';
|
|
8
|
+
import { readSitesConfig } from '@conloca/content-api/node';
|
|
9
|
+
import { buildSandboxSrcdoc } from '@conloca/mdx/sandbox-frame';
|
|
10
|
+
import { emitComponentManifest } from '../component-manifest.js';
|
|
11
|
+
import { PACKAGE_NAME } from '../constants.js';
|
|
12
|
+
import { resolveEditorDescriptors } from '../descriptors.js';
|
|
13
|
+
import { gitOutput, resolveBuildRef } from '../git.js';
|
|
14
|
+
import { packageVersion } from '../package-version.js';
|
|
15
|
+
import { resolveBuildSiteId } from '../site-id.js';
|
|
16
|
+
import { bundleEditorPage } from './bundle.js';
|
|
17
|
+
import { findFramingBlockers } from './framing.js';
|
|
18
|
+
import { renderEditorPage } from './page.js';
|
|
19
|
+
import { baseMismatch } from './site-base.js';
|
|
20
|
+
/** The folder, relative to the build output, that holds every file of the editor page. */
|
|
21
|
+
const EDITOR_DIR = '_conloca/editor';
|
|
22
|
+
/** Writes <dir>/_conloca/editor/. The endpoint was already checked to be an app. address at config load. */
|
|
23
|
+
export async function emitEditorPage(input) {
|
|
24
|
+
const { dir, inherited, logger } = input;
|
|
25
|
+
const origin = editorUiOrigin(input.endpoint);
|
|
26
|
+
if (origin === null)
|
|
27
|
+
throw new Error(`${PACKAGE_NAME}: endpoint ${input.endpoint} is not an app. address`);
|
|
28
|
+
const base = input.base.endsWith('/') ? input.base : `${input.base}/`;
|
|
29
|
+
if (!isValidSiteBase(base)) {
|
|
30
|
+
logger.warn(`base ${base} is not a plain path of letters, digits and . _ ~ - segments; the workspace editor will not open a page under it`);
|
|
31
|
+
}
|
|
32
|
+
const contentRoot = process.env.CONLOCA_CONTENT_ROOT;
|
|
33
|
+
const mismatch = contentRoot ? baseMismatch(await readSitesConfig(contentRoot), base) : undefined;
|
|
34
|
+
if (mismatch !== undefined)
|
|
35
|
+
logger.warn(mismatch);
|
|
36
|
+
for (const { file, header } of await findFramingBlockers(input.root)) {
|
|
37
|
+
logger.warn(`${file} sets ${header} for the whole site and has no /_conloca/editor/ rule, so the workspace editor cannot frame the editor page. Add the rule (npx @conloca/cli connect writes it).`);
|
|
38
|
+
}
|
|
39
|
+
const folder = join(dir, EDITOR_DIR);
|
|
40
|
+
if (existsSync(folder)) {
|
|
41
|
+
throw new Error(`${PACKAGE_NAME}: ${base}_conloca/editor/ already exists in the build output (a page or a public/ file claims it). That path is reserved for the editor page; move the content elsewhere.`);
|
|
42
|
+
}
|
|
43
|
+
const defines = Object.keys(input.vite.define ?? {});
|
|
44
|
+
if (defines.length > 0) {
|
|
45
|
+
logger.warn(`vite.define is applied to the editor page's public bundle too; make sure none of ${defines.join(', ')} holds a secret`);
|
|
46
|
+
}
|
|
47
|
+
const descriptors = await resolveEditorDescriptors(logger);
|
|
48
|
+
const bundle = await bundleEditorPage({
|
|
49
|
+
dir,
|
|
50
|
+
root: input.root,
|
|
51
|
+
vite: input.vite,
|
|
52
|
+
puckConfigPath: inherited.puckConfigPath,
|
|
53
|
+
styles: [...(inherited.siteStyles ?? []), ...(inherited.editorStyles ?? [])],
|
|
54
|
+
...(descriptors === undefined ? {} : { descriptors }),
|
|
55
|
+
logger,
|
|
56
|
+
});
|
|
57
|
+
let editorCssFile = null;
|
|
58
|
+
if (inherited.editorCss) {
|
|
59
|
+
const bytes = new TextEncoder().encode(inherited.editorCss);
|
|
60
|
+
editorCssFile = `editor.${createHash('sha256').update(bytes).digest('hex').slice(0, 16)}.css`;
|
|
61
|
+
await writeFile(join(folder, editorCssFile), bytes);
|
|
62
|
+
}
|
|
63
|
+
await writeFile(join(folder, 'sandbox-frame.html'), buildSandboxSrcdoc());
|
|
64
|
+
const channel = readEditorDescriptors(process.env);
|
|
65
|
+
// Only a build conlocaCMS is part of carries a vocabulary, as on the key path.
|
|
66
|
+
const componentManifest = channel === undefined
|
|
67
|
+
? undefined
|
|
68
|
+
: await emitComponentManifest({
|
|
69
|
+
dir,
|
|
70
|
+
folder: EDITOR_DIR,
|
|
71
|
+
puckConfigPath: inherited.puckConfigPath,
|
|
72
|
+
projectRoot: input.root,
|
|
73
|
+
logger,
|
|
74
|
+
});
|
|
75
|
+
const info = editorPageInfo(input, componentManifest);
|
|
76
|
+
if (!isEditorPageInfo(info)) {
|
|
77
|
+
throw new Error(`${PACKAGE_NAME}: internal error: conloca.json failed its own format check`);
|
|
78
|
+
}
|
|
79
|
+
const contentPaths = contentPathsFromBuild(channel?.contentPaths ?? [], gitOutput(['rev-parse', '--show-toplevel'], input.root));
|
|
80
|
+
const branchDeploys = branchDeploysFromEnv(process.env);
|
|
81
|
+
const written = {
|
|
82
|
+
...info,
|
|
83
|
+
...(branchDeploys === undefined ? {} : { branchDeploys }),
|
|
84
|
+
...(contentPaths === undefined ? {} : { contentPaths }),
|
|
85
|
+
};
|
|
86
|
+
await writeFile(join(folder, 'conloca.json'), `${JSON.stringify(written, null, 2)}\n`);
|
|
87
|
+
const url = (file) => `${base}${EDITOR_DIR}/${file}`;
|
|
88
|
+
const html = renderEditorPage({
|
|
89
|
+
protocol: info.protocol,
|
|
90
|
+
repo: info.repo,
|
|
91
|
+
siteId: info.siteId,
|
|
92
|
+
site: url(bundle.site),
|
|
93
|
+
css: bundle.css ? [url(bundle.css)] : [],
|
|
94
|
+
editorCss: editorCssFile === null ? null : url(editorCssFile),
|
|
95
|
+
sandboxFrame: url('sandbox-frame.html'),
|
|
96
|
+
info: url('conloca.json'),
|
|
97
|
+
}, origin);
|
|
98
|
+
await writeFile(join(folder, 'index.html'), html);
|
|
99
|
+
logger.info(`editor page written: ${base}${EDITOR_DIR}/`);
|
|
100
|
+
}
|
|
101
|
+
/** Copies <from>/_conloca/editor into <to>, for a preview child whose client folder serves the site. */
|
|
102
|
+
export async function mirrorEditorPage(fromDir, toDir) {
|
|
103
|
+
await mkdir(join(toDir, '_conloca'), { recursive: true });
|
|
104
|
+
await cp(join(fromDir, EDITOR_DIR), join(toDir, EDITOR_DIR), { recursive: true });
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* The Cloudflare Pages project that serves this site's branch builds: `CONLOCA_PAGES_PROJECT` (direct upload with
|
|
108
|
+
* wrangler) wins, else the project in a Pages build's `CF_PAGES_URL` (`https://<hash>.<project>.pages.dev`).
|
|
109
|
+
*/
|
|
110
|
+
export function branchDeploysFromEnv(env) {
|
|
111
|
+
// An empty variable counts as unset, so it never hides CF_PAGES_URL.
|
|
112
|
+
let project = env.CONLOCA_PAGES_PROJECT === '' ? undefined : env.CONLOCA_PAGES_PROJECT;
|
|
113
|
+
if (project === undefined && env.CF_PAGES_URL !== undefined) {
|
|
114
|
+
try {
|
|
115
|
+
const url = new URL(env.CF_PAGES_URL);
|
|
116
|
+
const labels = url.hostname.split('.');
|
|
117
|
+
if (url.protocol === 'https:' && labels.length === 4 && labels.slice(2).join('.') === 'pages.dev') {
|
|
118
|
+
project = labels[1];
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
catch {
|
|
122
|
+
return undefined;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
return project === undefined ? undefined : branchDeploysOf({ branchDeploys: { host: 'cloudflare-pages', project } });
|
|
126
|
+
}
|
|
127
|
+
/** Each content path under the repository root, written from that root ('' for the root itself); others are dropped. */
|
|
128
|
+
export function contentPathsFromBuild(paths, repoRoot) {
|
|
129
|
+
if (repoRoot === undefined)
|
|
130
|
+
return undefined;
|
|
131
|
+
const contentPaths = paths
|
|
132
|
+
.map((path) => relative(repoRoot, path))
|
|
133
|
+
.filter((path) => !isAbsolute(path))
|
|
134
|
+
.map((path) => path.split(sep))
|
|
135
|
+
.filter((segments) => segments[0] !== '..')
|
|
136
|
+
.map((segments) => segments.join('/'));
|
|
137
|
+
return contentPathsOf({ contentPaths });
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* conloca.json's facts. A repository, commit or branch that is unknown or fails its format is written as null with a
|
|
141
|
+
* warning; a `builtWith` that cannot be formed fails the build, since the workspace editor would refuse the page.
|
|
142
|
+
*/
|
|
143
|
+
function editorPageInfo(input, componentManifest) {
|
|
144
|
+
const { logger } = input;
|
|
145
|
+
let repo = null;
|
|
146
|
+
if (input.repoUri !== undefined && EDITOR_PAGE_INFO_FORMATS.repo.test(input.repoUri)) {
|
|
147
|
+
repo = input.repoUri;
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
logger.warn(`no GitHub repository resolved for this build (got ${input.repoUri ?? 'none'}); the workspace editor will refuse this page until conlocaCloud({ repoUri: 'owner/repo' }) names it`);
|
|
151
|
+
}
|
|
152
|
+
const ref = resolveBuildRef(process.env, (args) => gitOutput(args, input.root));
|
|
153
|
+
const commit = ref.gitSha !== undefined && EDITOR_PAGE_INFO_FORMATS.commit.test(ref.gitSha) ? ref.gitSha : null;
|
|
154
|
+
if (commit === null) {
|
|
155
|
+
logger.warn(ref.gitSha
|
|
156
|
+
? `commit ${ref.gitSha} is not a 40-character git commit hash; conloca.json lists the commit as null`
|
|
157
|
+
: 'no commit resolved for this build; conloca.json lists the commit as null');
|
|
158
|
+
}
|
|
159
|
+
const branch = ref.branch !== undefined && isValidBranchName(ref.branch) ? ref.branch : null;
|
|
160
|
+
if (branch === null) {
|
|
161
|
+
logger.warn(ref.branch
|
|
162
|
+
? `branch ${ref.branch} is not a valid git branch name; conloca.json lists the branch as null`
|
|
163
|
+
: 'no branch resolved for this build; conloca.json lists the branch as null');
|
|
164
|
+
}
|
|
165
|
+
const version = packageVersion();
|
|
166
|
+
if (version === undefined) {
|
|
167
|
+
throw new Error(`${PACKAGE_NAME}: could not read this package's version, so conloca.json cannot name the build and the workspace editor would refuse the page`);
|
|
168
|
+
}
|
|
169
|
+
const builtWith = `${PACKAGE_NAME}@${version}`;
|
|
170
|
+
if (!EDITOR_PAGE_INFO_FORMATS.builtWith.test(builtWith)) {
|
|
171
|
+
throw new Error(`${PACKAGE_NAME}: ${builtWith} is not a release version the workspace editor accepts`);
|
|
172
|
+
}
|
|
173
|
+
return {
|
|
174
|
+
protocol: EDITOR_HOST_PROTOCOL,
|
|
175
|
+
repo,
|
|
176
|
+
siteId: resolveBuildSiteId({ contentRoot: process.env.CONLOCA_CONTENT_ROOT, override: input.siteIdOverride }),
|
|
177
|
+
commit,
|
|
178
|
+
branch,
|
|
179
|
+
builtWith,
|
|
180
|
+
componentManifest: componentManifest === undefined ? null : { path: componentManifest.filename, sha256: componentManifest.hash },
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
//# sourceMappingURL=emit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emit.js","sourceRoot":"","sources":["../../../src/editor-page/emit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAEL,eAAe,EACf,cAAc,EACd,oBAAoB,EACpB,wBAAwB,EAExB,cAAc,EACd,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4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Y,IAAI,OAAO,EAAE,CAAC;IAC/C,IAAI,CAAC,wBAAwB,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;QACxD,MAAM,IAAI,KAAK,CAAC,GAAG,YAAY,KAAK,SAAS,wDAAwD,CAAC,CAAC;IACzG,CAAC;IAED,OAAO;QACL,QAAQ,EAAE,oBAAoB;QAC9B,IAAI;QACJ,MAAM,EAAE,kBAAkB,CAAC,EAAE,WAAW,EAAE,OAAO,CAAC,GAAG,CAAC,oBAAoB,EAAE,QAAQ,EAAE,KAAK,CAAC,cAAc,EAAE,CAAC;QAC7G,MAAM;QACN,MAAM;QACN,SAAS;QACT,iBAAiB,EACf,iBAAiB,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,iBAAiB,CAAC,IAAI,EAAE;KAChH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface FramingSnippets {
|
|
2
|
+
/** `public/_headers` for Cloudflare Pages and Cloudflare Workers static assets; goes after any site-wide rule. */
|
|
3
|
+
cloudflareHeaders: string;
|
|
4
|
+
/** `public/_headers` for Netlify, which has no syntax for removing a header. */
|
|
5
|
+
netlifyHeaders: string;
|
|
6
|
+
/** The `headers` entries for `vercel.json`. */
|
|
7
|
+
vercelHeaders: {
|
|
8
|
+
source: string;
|
|
9
|
+
headers: {
|
|
10
|
+
key: string;
|
|
11
|
+
value: string;
|
|
12
|
+
}[];
|
|
13
|
+
}[];
|
|
14
|
+
}
|
|
15
|
+
/** The /_conloca/editor/ header rules that let the workspace editor frame the page (§3.6). */
|
|
16
|
+
export declare function framingSnippets(editorRoot: string): FramingSnippets;
|
|
17
|
+
export interface FramingBlocker {
|
|
18
|
+
file: 'public/_headers' | 'netlify.toml' | 'vercel.json';
|
|
19
|
+
header: 'X-Frame-Options' | 'frame-ancestors';
|
|
20
|
+
}
|
|
21
|
+
/** Committed header files that forbid framing, when none of them carries a /_conloca/editor/ rule. */
|
|
22
|
+
export declare function findFramingBlockers(projectRoot: string): Promise<FramingBlocker[]>;
|
|
23
|
+
//# sourceMappingURL=framing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"framing.d.ts","sourceRoot":"","sources":["../../../src/editor-page/framing.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,eAAe;IAC9B,kHAAkH;IAClH,iBAAiB,EAAE,MAAM,CAAC;IAC1B,gFAAgF;IAChF,cAAc,EAAE,MAAM,CAAC;IACvB,+CAA+C;IAC/C,aAAa,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE;YAAE,GAAG,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAE,EAAE,CAAA;KAAE,EAAE,CAAC;CAChF;AAID,8FAA8F;AAC9F,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,eAAe,CAgBnE;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,iBAAiB,GAAG,cAAc,GAAG,aAAa,CAAC;IACzD,MAAM,EAAE,iBAAiB,GAAG,iBAAiB,CAAC;CAC/C;AAKD,sGAAsG;AACtG,wBAAsB,mBAAmB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAmBxF"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { readFile } from 'node:fs/promises';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
const SANDBOX_FRAME_RULE = '/_conloca/editor/sandbox-frame.html\n Content-Security-Policy: sandbox allow-scripts\n';
|
|
4
|
+
/** The /_conloca/editor/ header rules that let the workspace editor frame the page (§3.6). */
|
|
5
|
+
export function framingSnippets(editorRoot) {
|
|
6
|
+
const frameAncestors = `frame-ancestors 'self' https://*.${editorRoot}`;
|
|
7
|
+
const detach = ' ! X-Frame-Options\n ! Content-Security-Policy\n';
|
|
8
|
+
const pathRule = (removals) => `/_conloca/editor/*\n${removals} Content-Security-Policy: ${frameAncestors}\n\n${SANDBOX_FRAME_RULE}`;
|
|
9
|
+
return {
|
|
10
|
+
cloudflareHeaders: pathRule(detach),
|
|
11
|
+
netlifyHeaders: pathRule(''),
|
|
12
|
+
vercelHeaders: [
|
|
13
|
+
{ source: '/_conloca/editor/:path*', headers: [{ key: 'Content-Security-Policy', value: frameAncestors }] },
|
|
14
|
+
{
|
|
15
|
+
source: '/_conloca/editor/sandbox-frame.html',
|
|
16
|
+
headers: [{ key: 'Content-Security-Policy', value: 'sandbox allow-scripts' }],
|
|
17
|
+
},
|
|
18
|
+
],
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
const HEADER_FILES = ['public/_headers', 'netlify.toml', 'vercel.json'];
|
|
22
|
+
const FRAMING_HEADERS = ['X-Frame-Options', 'frame-ancestors'];
|
|
23
|
+
/** Committed header files that forbid framing, when none of them carries a /_conloca/editor/ rule. */
|
|
24
|
+
export async function findFramingBlockers(projectRoot) {
|
|
25
|
+
// shortcut: text match, not a parse of each format; doctor --live checks the real headers.
|
|
26
|
+
// shortcut: a site-wide CSP with frame-ancestors still blocks on Netlify and Vercel once the rule exists, since a
|
|
27
|
+
// second CSP header cannot loosen the first; this reports nothing then, and doctor --live finds it.
|
|
28
|
+
const texts = await Promise.all(HEADER_FILES.map((file) => readFile(join(projectRoot, file), 'utf8').then((text) => text.toLowerCase(), () => undefined)));
|
|
29
|
+
// connect may add the rule to a different file than the one that blocks (public/_headers for a netlify.toml rule).
|
|
30
|
+
if (texts.some((text) => text?.includes('/_conloca/editor/')))
|
|
31
|
+
return [];
|
|
32
|
+
return HEADER_FILES.flatMap((file, index) => {
|
|
33
|
+
const text = texts[index];
|
|
34
|
+
if (text === undefined)
|
|
35
|
+
return [];
|
|
36
|
+
return FRAMING_HEADERS.filter((header) => text.includes(header.toLowerCase())).map((header) => ({ file, header }));
|
|
37
|
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GAAG,MAAM,OAAO,CAAC,GAAG,CAC7B,YAAY,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CACxB,QAAQ,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC,IAAI,CAC5C,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,EAC5B,GAAG,EAAE,CAAC,SAAS,CAChB,CACF,CACF,CAAC;IACF,mHAAmH;IACnH,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,QAAQ,CAAC,mBAAmB,CAAC,CAAC;QAAE,OAAO,EAAE,CAAC;IACzE,OAAO,YAAY,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;QAC1C,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;QAC1B,IAAI,IAAI,KAAK,SAAS;YAAE,OAAO,EAAE,CAAC;QAClC,OAAO,eAAe,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;IACrH,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type EditorHostPageData } from '@conloca/content-api/editor-host';
|
|
2
|
+
/**
|
|
3
|
+
* The editor page's `index.html`: the editor UI from `<editorUiOrigin>/host/v<protocol>/`, its `importmap` script, and
|
|
4
|
+
* the page data as a JSON block that never executes. The meta CSP admits scripts only from the page itself, that path
|
|
5
|
+
* and the `importmap` script's hash; it leaves styles and fonts alone, so the editor UI's stylesheet may load its web
|
|
6
|
+
* font.
|
|
7
|
+
*/
|
|
8
|
+
export declare function renderEditorPage(data: EditorHostPageData, editorUiOrigin: string): string;
|
|
9
|
+
//# sourceMappingURL=page.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../../../src/editor-page/page.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,kBAAkB,EACxB,MAAM,kCAAkC,CAAC;AAE1C;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,GAAG,MAAM,CAuBzF"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { EDITOR_HOST_PROTOCOL, EDITOR_UI_MODULE_FILES, } from '@conloca/content-api/editor-host';
|
|
3
|
+
/**
|
|
4
|
+
* The editor page's `index.html`: the editor UI from `<editorUiOrigin>/host/v<protocol>/`, its `importmap` script, and
|
|
5
|
+
* the page data as a JSON block that never executes. The meta CSP admits scripts only from the page itself, that path
|
|
6
|
+
* and the `importmap` script's hash; it leaves styles and fonts alone, so the editor UI's stylesheet may load its web
|
|
7
|
+
* font.
|
|
8
|
+
*/
|
|
9
|
+
export function renderEditorPage(data, editorUiOrigin) {
|
|
10
|
+
const uiPath = `${editorUiOrigin}/host/v${EDITOR_HOST_PROTOCOL}/`;
|
|
11
|
+
const imports = Object.fromEntries(Object.entries(EDITOR_UI_MODULE_FILES).map(([specifier, file]) => [specifier, `${uiPath}${file}`]));
|
|
12
|
+
const importMapJson = JSON.stringify({ imports });
|
|
13
|
+
const importMapHash = createHash('sha256').update(importMapJson).digest('base64');
|
|
14
|
+
return [
|
|
15
|
+
'<!doctype html>',
|
|
16
|
+
'<html lang="en">',
|
|
17
|
+
'<head>',
|
|
18
|
+
'<meta charset="utf-8">',
|
|
19
|
+
'<meta name="robots" content="noindex, nofollow">',
|
|
20
|
+
`<meta http-equiv="Content-Security-Policy" content="script-src 'self' ${uiPath} 'sha256-${importMapHash}'; object-src 'none'; base-uri 'none'">`,
|
|
21
|
+
'<title>Conloca editor</title>',
|
|
22
|
+
`<script type="importmap">${importMapJson}</script>`,
|
|
23
|
+
// `<` escaped so no value can close the element; JSON.parse reads `\u003c` back as `<`.
|
|
24
|
+
`<script type="application/json" id="conloca-editor-host">${JSON.stringify(data).replaceAll('<', '\\u003c')}</script>`,
|
|
25
|
+
`<script type="module" src="${uiPath}entry.js"></script>`,
|
|
26
|
+
'</head>',
|
|
27
|
+
'<body><div id="root"></div></body>',
|
|
28
|
+
'</html>',
|
|
29
|
+
].join('\n');
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=page.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page.js","sourceRoot":"","sources":["../../../src/editor-page/page.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EACL,oBAAoB,EACpB,sBAAsB,GAEvB,MAAM,kCAAkC,CAAC;AAE1C;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAwB,EAAE,cAAsB;IAC/E,MAAM,MAAM,GAAG,GAAG,cAAc,UAAU,oBAAoB,GAAG,CAAC;IAClE,MAAM,OAAO,GAAG,MAAM,CAAC,WAAW,CAChC,MAAM,CAAC,OAAO,CAAC,sBAAsB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,SAAS,EAAE,GAAG,MAAM,GAAG,IAAI,EAAE,CAAC,CAAC,CACnG,CAAC;IACF,MAAM,aAAa,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;IAClD,MAAM,aAAa,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAClF,OAAO;QACL,iBAAiB;QACjB,kBAAkB;QAClB,QAAQ;QACR,wBAAwB;QACxB,kDAAkD;QAClD,yEAAyE,MAAM,YAAY,aAAa,yCAAyC;QACjJ,+BAA+B;QAC/B,4BAA4B,aAAa,WAAW;QACpD,wFAAwF;QACxF,4DAA4D,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,SAAS,CAAC,WAAW;QACtH,8BAA8B,MAAM,qBAAqB;QACzD,SAAS;QACT,oCAAoC;QACpC,SAAS;KACV,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type SitesConfig } from '@conloca/content-api';
|
|
2
|
+
/** The warning when Astro's base differs from the address site's base in sites.json, else undefined. */
|
|
3
|
+
export declare function baseMismatch(sites: SitesConfig, astroBase: string): string | undefined;
|
|
4
|
+
//# sourceMappingURL=site-base.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"site-base.d.ts","sourceRoot":"","sources":["../../../src/editor-page/site-base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEzE,wGAAwG;AACxG,wBAAgB,YAAY,CAAC,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAOtF"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { addressSiteName } from '@conloca/content-api';
|
|
2
|
+
/** The warning when Astro's base differs from the address site's base in sites.json, else undefined. */
|
|
3
|
+
export function baseMismatch(sites, astroBase) {
|
|
4
|
+
const name = addressSiteName(sites);
|
|
5
|
+
if (name === null)
|
|
6
|
+
return undefined;
|
|
7
|
+
const base = astroBase.endsWith('/') ? astroBase : `${astroBase}/`;
|
|
8
|
+
const siteBase = sites.sites[name]?.base ?? '/';
|
|
9
|
+
if (base === siteBase)
|
|
10
|
+
return undefined;
|
|
11
|
+
return `Astro's base is ${base} but sites.json gives the site "${name}" base ${siteBase}: the workspace editor looks for the editor page under ${siteBase}_conloca/editor/ and will not find it. Make them match.`;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=site-base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"site-base.js","sourceRoot":"","sources":["../../../src/editor-page/site-base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAoB,MAAM,sBAAsB,CAAC;AAEzE,wGAAwG;AACxG,MAAM,UAAU,YAAY,CAAC,KAAkB,EAAE,SAAiB;IAChE,MAAM,IAAI,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC;IACpC,IAAI,IAAI,KAAK,IAAI;QAAE,OAAO,SAAS,CAAC;IACpC,MAAM,IAAI,GAAG,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,SAAS,GAAG,CAAC;IACnE,MAAM,QAAQ,GAAG,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,IAAI,GAAG,CAAC;IAChD,IAAI,IAAI,KAAK,QAAQ;QAAE,OAAO,SAAS,CAAC;IACxC,OAAO,mBAAmB,IAAI,mCAAmC,IAAI,UAAU,QAAQ,0DAA0D,QAAQ,yDAAyD,CAAC;AACrN,CAAC"}
|
package/dist/src/git.d.ts
CHANGED
|
@@ -7,8 +7,9 @@ import { type RepositoryEnvironment } from './repository.js';
|
|
|
7
7
|
*/
|
|
8
8
|
export declare function gitOutput(args: string[], cwd?: string): string | undefined;
|
|
9
9
|
/**
|
|
10
|
-
* The resolved pair. An empty
|
|
11
|
-
* (`CF_PAGES_COMMIT_SHA=''` yields `gitSha: ''
|
|
10
|
+
* The resolved pair. An empty `CF_PAGES_COMMIT_SHA` is passed through
|
|
11
|
+
* unchanged (`CF_PAGES_COMMIT_SHA=''` yields `gitSha: ''`; the other hosts'
|
|
12
|
+
* empty commit variables count as unset); callers treat a falsy value
|
|
12
13
|
* as unresolved, exactly as the build hook's guard does. An empty BRANCH
|
|
13
14
|
* variable counts as unset instead: GitHub Actions exports GITHUB_HEAD_REF=''
|
|
14
15
|
* on every push build, which would otherwise hide GITHUB_REF_NAME.
|
|
@@ -18,17 +19,19 @@ interface BuildRef {
|
|
|
18
19
|
branch?: string;
|
|
19
20
|
}
|
|
20
21
|
/**
|
|
21
|
-
* The commit and branch this checkout stands on — the pair
|
|
22
|
-
*
|
|
22
|
+
* The commit and branch this checkout stands on — the pair conloca.json
|
|
23
|
+
* names, and the branch a preview build serves. CI metadata first,
|
|
24
|
+
* most-specific source per provider: Cloudflare Pages, Cloudflare Workers
|
|
25
|
+
* Builds, Netlify (whose `HEAD` and `COMMIT_REF` count only when `NETLIFY` is
|
|
26
|
+
* set, since other shells may export a `HEAD`), Vercel, Render, Amplify, then GitHub Actions. GitHub
|
|
23
27
|
* Actions checkouts are DETACHED, so the git fallback returns the literal
|
|
24
28
|
* 'HEAD' there — GITHUB_HEAD_REF (PR builds) / GITHUB_REF_NAME cover that
|
|
25
|
-
* case, and a surviving literal 'HEAD' is treated as unresolvable:
|
|
26
|
-
*
|
|
27
|
-
* branch-keyed lookup, silently registering dead weight.
|
|
29
|
+
* case, and a surviving literal 'HEAD' is treated as unresolvable: branch
|
|
30
|
+
* 'HEAD' would never match the editor's branch-keyed lookup.
|
|
28
31
|
*/
|
|
29
32
|
export declare function resolveBuildRef(env?: RepositoryEnvironment, git?: (args: string[]) => string | undefined): BuildRef;
|
|
30
33
|
/**
|
|
31
|
-
* The repository
|
|
34
|
+
* The repository the editor page names: the explicit option and CI
|
|
32
35
|
* metadata are free to read; git is spawned ONLY when neither resolved it.
|
|
33
36
|
* Config loading is a hot path in Astro and must not start a subprocess on
|
|
34
37
|
* every integration instance.
|
package/dist/src/git.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../../src/git.ts"],"names":[],"mappings":"AACA,OAAO,EAAuB,KAAK,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAElF;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAO1E;AAED
|
|
1
|
+
{"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../../src/git.ts"],"names":[],"mappings":"AACA,OAAO,EAAuB,KAAK,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAElF;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAO1E;AAED;;;;;;;GAOG;AACH,UAAU,QAAQ;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAC7B,GAAG,GAAE,qBAAmC,EACxC,GAAG,GAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,MAAM,GAAG,SAAqB,GACtD,QAAQ,CAsBV;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,GAAG,EAAE,qBAAqB,EAC1B,GAAG,GAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,MAAM,GAAG,SAAqB,GACtD,MAAM,GAAG,SAAS,CAKpB"}
|
package/dist/src/git.js
CHANGED
|
@@ -16,22 +16,39 @@ export function gitOutput(args, cwd) {
|
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
/**
|
|
19
|
-
* The commit and branch this checkout stands on — the pair
|
|
20
|
-
*
|
|
19
|
+
* The commit and branch this checkout stands on — the pair conloca.json
|
|
20
|
+
* names, and the branch a preview build serves. CI metadata first,
|
|
21
|
+
* most-specific source per provider: Cloudflare Pages, Cloudflare Workers
|
|
22
|
+
* Builds, Netlify (whose `HEAD` and `COMMIT_REF` count only when `NETLIFY` is
|
|
23
|
+
* set, since other shells may export a `HEAD`), Vercel, Render, Amplify, then GitHub Actions. GitHub
|
|
21
24
|
* Actions checkouts are DETACHED, so the git fallback returns the literal
|
|
22
25
|
* 'HEAD' there — GITHUB_HEAD_REF (PR builds) / GITHUB_REF_NAME cover that
|
|
23
|
-
* case, and a surviving literal 'HEAD' is treated as unresolvable:
|
|
24
|
-
*
|
|
25
|
-
* branch-keyed lookup, silently registering dead weight.
|
|
26
|
+
* case, and a surviving literal 'HEAD' is treated as unresolvable: branch
|
|
27
|
+
* 'HEAD' would never match the editor's branch-keyed lookup.
|
|
26
28
|
*/
|
|
27
29
|
export function resolveBuildRef(env = process.env, git = gitOutput) {
|
|
28
|
-
const
|
|
29
|
-
const
|
|
30
|
+
const netlify = env.NETLIFY === 'true';
|
|
31
|
+
const gitSha = env.CF_PAGES_COMMIT_SHA ??
|
|
32
|
+
(env.WORKERS_CI_COMMIT_SHA || undefined) ??
|
|
33
|
+
(netlify ? env.COMMIT_REF || undefined : undefined) ??
|
|
34
|
+
(env.VERCEL_GIT_COMMIT_SHA || undefined) ??
|
|
35
|
+
(env.RENDER_GIT_COMMIT || undefined) ??
|
|
36
|
+
(env.AWS_COMMIT_ID || undefined) ??
|
|
37
|
+
git(['rev-parse', 'HEAD']);
|
|
38
|
+
const rawBranch = env.CF_PAGES_BRANCH ||
|
|
39
|
+
env.WORKERS_CI_BRANCH ||
|
|
40
|
+
(netlify ? env.HEAD : undefined) ||
|
|
41
|
+
env.VERCEL_GIT_COMMIT_REF ||
|
|
42
|
+
env.RENDER_GIT_BRANCH ||
|
|
43
|
+
env.AWS_BRANCH ||
|
|
44
|
+
env.GITHUB_HEAD_REF ||
|
|
45
|
+
env.GITHUB_REF_NAME ||
|
|
46
|
+
git(['rev-parse', '--abbrev-ref', 'HEAD']);
|
|
30
47
|
const branch = rawBranch === 'HEAD' ? undefined : rawBranch;
|
|
31
48
|
return { ...(gitSha === undefined ? {} : { gitSha }), ...(branch === undefined ? {} : { branch }) };
|
|
32
49
|
}
|
|
33
50
|
/**
|
|
34
|
-
* The repository
|
|
51
|
+
* The repository the editor page names: the explicit option and CI
|
|
35
52
|
* metadata are free to read; git is spawned ONLY when neither resolved it.
|
|
36
53
|
* Config loading is a hot path in Astro and must not start a subprocess on
|
|
37
54
|
* every integration instance.
|
package/dist/src/git.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git.js","sourceRoot":"","sources":["../../src/git.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAA8B,MAAM,iBAAiB,CAAC;AAElF;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CAAC,IAAc,EAAE,GAAY;IACpD,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,YAAY,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;QAChH,OAAO,MAAM,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC;IAC5C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC;
|
|
1
|
+
{"version":3,"file":"git.js","sourceRoot":"","sources":["../../src/git.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAA8B,MAAM,iBAAiB,CAAC;AAElF;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CAAC,IAAc,EAAE,GAAY;IACpD,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,YAAY,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAA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AAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC;IAC5D,OAAO,EAAE,GAAG,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,GAAG,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;AACtG,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAClC,QAA4B,EAC5B,GAA0B,EAC1B,GAAG,GAA2C,SAAS;IAEvD,OAAO,CACL,mBAAmB,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC;QACtC,mBAAmB,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC,QAAQ,EAAE,OAAO,EAAE,mBAAmB,CAAC,CAAC,EAAE,CAAC,CACxF,CAAC;AACJ,CAAC"}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { DEFAULT_EDITOR_ENDPOINT, EDITOR_HOST_PROTOCOL, EDITOR_PAGE_PATH, type EditorHostPageData, type EditorPageInfo, } from '@conloca/content-api/editor-host';
|
|
2
|
+
export { type FramingBlocker, type FramingSnippets, findFramingBlockers, framingSnippets, } from './editor-page/framing.js';
|
|
3
|
+
export { conlocaCloud as default, conlocaCloud, PACKAGE_NAME, PREVIEW_BUILD_ENV_FLAG } from './integration.js';
|
|
2
4
|
export type { ConlocaCloudOptions, PreviewBuildOptions } from './types.js';
|
|
3
5
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,uBAAuB,EACvB,oBAAoB,EACpB,gBAAgB,EAChB,KAAK,kBAAkB,EACvB,KAAK,cAAc,GACpB,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,mBAAmB,EACnB,eAAe,GAChB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,YAAY,IAAI,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC/G,YAAY,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/src/index.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
// Public surface for `@conloca/cloud-astro` — the site's Astro
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
// Public surface for `@conloca/cloud-astro` — the site's Astro integration.
|
|
2
|
+
// Every `astro build` writes your site's editor page to /_conloca/editor/ from
|
|
3
|
+
// `astro:build:done`; the preview modules serve draft pages out of the
|
|
4
|
+
// recursive preview build and read their content through `PreviewContentAPI`.
|
|
5
|
+
export { DEFAULT_EDITOR_ENDPOINT, EDITOR_HOST_PROTOCOL, EDITOR_PAGE_PATH, } from '@conloca/content-api/editor-host';
|
|
6
|
+
// The /_conloca/editor/ header rules that `conloca connect` writes and doctor checks.
|
|
7
|
+
export { findFramingBlockers, framingSnippets, } from './editor-page/framing.js';
|
|
8
|
+
// The default export is what `astro add @conloca/cloud-astro` wires in.
|
|
9
|
+
export { conlocaCloud as default, conlocaCloud, PACKAGE_NAME, PREVIEW_BUILD_ENV_FLAG } from './integration.js';
|
|
7
10
|
//# sourceMappingURL=index.js.map
|
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,+
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,+EAA+E;AAC/E,uEAAuE;AACvE,8EAA8E;AAE9E,OAAO,EACL,uBAAuB,EACvB,oBAAoB,EACpB,gBAAgB,GAGjB,MAAM,kCAAkC,CAAC;AAC1C,sFAAsF;AACtF,OAAO,EAGL,mBAAmB,EACnB,eAAe,GAChB,MAAM,0BAA0B,CAAC;AAClC,wEAAwE;AACxE,OAAO,EAAE,YAAY,IAAI,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -2,5 +2,5 @@ import type { AstroIntegration } from 'astro';
|
|
|
2
2
|
import { PACKAGE_NAME, PREVIEW_BUILD_ENV_FLAG } from './constants.js';
|
|
3
3
|
import type { ConlocaCloudOptions } from './types.js';
|
|
4
4
|
export { PACKAGE_NAME, PREVIEW_BUILD_ENV_FLAG };
|
|
5
|
-
export declare function conlocaCloud(options
|
|
5
|
+
export declare function conlocaCloud(options?: ConlocaCloudOptions): AstroIntegration;
|
|
6
6
|
//# sourceMappingURL=integration.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integration.d.ts","sourceRoot":"","sources":["../../src/integration.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,
|
|
1
|
+
{"version":3,"file":"integration.d.ts","sourceRoot":"","sources":["../../src/integration.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAE9C,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAStE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAKtD,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,CAAC;AAuBhD,wBAAgB,YAAY,CAAC,OAAO,GAAE,mBAAwB,GAAG,gBAAgB,CAuThF"}
|