@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,60 @@
|
|
|
1
|
+
import type { gitOutput } from '../git.js';
|
|
2
|
+
import type { RepositoryEnvironment } from '../repository.js';
|
|
3
|
+
/**
|
|
4
|
+
* Structural mirror of @conloca/cli's doctor report types. The CLI ships no
|
|
5
|
+
* type exports; the extension contract is documented in its README and pinned
|
|
6
|
+
* by `contractVersion`.
|
|
7
|
+
*/
|
|
8
|
+
export interface DoctorProblem {
|
|
9
|
+
check: string;
|
|
10
|
+
level: 'error' | 'warn';
|
|
11
|
+
message: string;
|
|
12
|
+
path?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface CheckOutcome {
|
|
15
|
+
id: string;
|
|
16
|
+
label: string;
|
|
17
|
+
problems: DoctorProblem[];
|
|
18
|
+
/** Extra context for the human pass/fail line. The doctor has no info level; this is where infos go. */
|
|
19
|
+
detail?: string;
|
|
20
|
+
/** Why a prerequisite kept the check from running. */
|
|
21
|
+
skipped?: string;
|
|
22
|
+
}
|
|
23
|
+
/** What the CLI hands the extension (doctor extension contract 1). */
|
|
24
|
+
export interface CloudDoctorContext {
|
|
25
|
+
contractVersion: 1;
|
|
26
|
+
projectDir: string;
|
|
27
|
+
contentRoot: string;
|
|
28
|
+
/** Only under `conloca doctor --live` may the checks network — and only to the configured endpoint. */
|
|
29
|
+
live: boolean;
|
|
30
|
+
}
|
|
31
|
+
export interface CloudDoctorResult {
|
|
32
|
+
contractVersion: 1;
|
|
33
|
+
checks: CheckOutcome[];
|
|
34
|
+
}
|
|
35
|
+
/** Seams for tests: every side effect the checks perform goes through here. */
|
|
36
|
+
export interface DoctorDeps {
|
|
37
|
+
env: RepositoryEnvironment;
|
|
38
|
+
exists(path: string): boolean;
|
|
39
|
+
readFile(path: string): string;
|
|
40
|
+
git: typeof gitOutput;
|
|
41
|
+
/** The callable half of fetch: Bun's `typeof fetch` also demands the `preconnect` static, which a test fake never has. */
|
|
42
|
+
fetch: (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
|
|
43
|
+
}
|
|
44
|
+
/** Insertion order is the report order. */
|
|
45
|
+
declare const CHECK_LABELS: {
|
|
46
|
+
readonly CC1: 'conlocaCloud is wired next to conlocaCMS';
|
|
47
|
+
readonly CC2: 'build token is available and well-formed';
|
|
48
|
+
readonly CC3: 'endpoint and public base URL are usable';
|
|
49
|
+
readonly CC4: "conlocaCMS options the endpoint's editor ignores";
|
|
50
|
+
readonly CC5: 'the endpoint answers the build token';
|
|
51
|
+
readonly CC6: 'a registration serves this branch and site';
|
|
52
|
+
readonly CC7: 'the registered editor assets are still deployed';
|
|
53
|
+
readonly CC8: 'the preview build has an SSR adapter, or is off';
|
|
54
|
+
};
|
|
55
|
+
/** A typo in a check id fails tsc here; the CLI would otherwise drop a label-less outcome silently. */
|
|
56
|
+
export type CheckId = keyof typeof CHECK_LABELS;
|
|
57
|
+
export declare function outcomeOf(id: CheckId): CheckOutcome;
|
|
58
|
+
export declare function skipped(id: CheckId, reason: string): CheckOutcome;
|
|
59
|
+
export {};
|
|
60
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/doctor/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,KAAK,EAAE,qBAAqB,EAAE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aACvD,GAAG,EAAE,sCAAsC;aAC3C,GAAG,EAAE,4CAA4C;aACjD,GAAG,EAAE,iDAAiD;aACtD,GAAG,EAAE,iDAAiD;CAC9C,CAAC;AAEX,uGAAuG;AACvG,MAAM,MAAM,OAAO,GAAG,MAAM,OAAO,YAAY,CAAC;AAEhD,wBAAgB,SAAS,CAAC,EAAE,EAAE,OAAO,GAAG,YAAY,CAEnD;AAED,wBAAgB,OAAO,CAAC,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,YAAY,CAEjE"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** Insertion order is the report order. */
|
|
2
|
+
const CHECK_LABELS = {
|
|
3
|
+
CC1: 'conlocaCloud is wired next to conlocaCMS',
|
|
4
|
+
CC2: 'build token is available and well-formed',
|
|
5
|
+
CC3: 'endpoint and public base URL are usable',
|
|
6
|
+
CC4: "conlocaCMS options the endpoint's editor ignores",
|
|
7
|
+
CC5: 'the endpoint answers the build token',
|
|
8
|
+
CC6: 'a registration serves this branch and site',
|
|
9
|
+
CC7: 'the registered editor assets are still deployed',
|
|
10
|
+
CC8: 'the preview build has an SSR adapter, or is off',
|
|
11
|
+
};
|
|
12
|
+
export function outcomeOf(id) {
|
|
13
|
+
return { id, label: CHECK_LABELS[id], problems: [] };
|
|
14
|
+
}
|
|
15
|
+
export function skipped(id, reason) {
|
|
16
|
+
return { ...outcomeOf(id), skipped: reason };
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/doctor/types.ts"],"names":[],"mappings":"AAiDA,2CAA2C;AAC3C,MAAM,YAAY,GAAG;IACnB,GAAG,EAAE,0CAA0C;IAC/C,GAAG,EAAE,0CAA0C;IAC/C,GAAG,EAAE,yCAAyC;IAC9C,GAAG,EAAE,kDAAkD;IACvD,GAAG,EAAE,sCAAsC;IAC3C,GAAG,EAAE,4CAA4C;IACjD,GAAG,EAAE,iDAAiD;IACtD,GAAG,EAAE,iDAAiD;CAC9C,CAAC;AAKX,MAAM,UAAU,SAAS,CAAC,EAAW;IACnC,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,YAAY,CAAC,EAAE,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;AACvD,CAAC;AAED,MAAM,UAAU,OAAO,CAAC,EAAW,EAAE,MAAc;IACjD,OAAO,EAAE,GAAG,SAAS,CAAC,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;AAC/C,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { CloudDoctorContext, CloudDoctorResult } from './doctor/types.js';
|
|
2
|
+
export type { CloudDoctorContext, CloudDoctorResult };
|
|
3
|
+
/**
|
|
4
|
+
* `conloca doctor` extension entry (package.json `conloca.doctor`). The CLI
|
|
5
|
+
* calls it with its contract object; an unknown contract gets an empty
|
|
6
|
+
* contract-1 answer, so the CLI reports the mismatch instead of crashing.
|
|
7
|
+
*/
|
|
8
|
+
export default function doctorExtension(context: CloudDoctorContext): Promise<CloudDoctorResult>;
|
|
9
|
+
//# sourceMappingURL=doctor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/doctor.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAE/E,YAAY,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,CAAC;AAEtD;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAG/F"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { runDoctor } from './doctor/run.js';
|
|
2
|
+
/**
|
|
3
|
+
* `conloca doctor` extension entry (package.json `conloca.doctor`). The CLI
|
|
4
|
+
* calls it with its contract object; an unknown contract gets an empty
|
|
5
|
+
* contract-1 answer, so the CLI reports the mismatch instead of crashing.
|
|
6
|
+
*/
|
|
7
|
+
export default function doctorExtension(context) {
|
|
8
|
+
if (context.contractVersion !== 1)
|
|
9
|
+
return Promise.resolve({ contractVersion: 1, checks: [] });
|
|
10
|
+
return runDoctor(context);
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=doctor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doctor.js","sourceRoot":"","sources":["../../src/doctor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAK5C;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,OAA2B;IACjE,IAAI,OAAO,CAAC,eAAe,KAAK,CAAC;QAAE,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,eAAe,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC;IAC9F,OAAO,SAAS,CAAC,OAAO,CAAC,CAAC;AAC5B,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type RepositoryEnvironment } from './repository.js';
|
|
2
|
+
/**
|
|
3
|
+
* Runs `git <args>` and returns trimmed stdout, or undefined when git is
|
|
4
|
+
* unavailable or the directory is not a checkout (e.g. tarball-based CI).
|
|
5
|
+
* `cwd` names the checkout to ask; without it git resolves against the
|
|
6
|
+
* process's own directory, which is the build's project but NOT the doctor's.
|
|
7
|
+
*/
|
|
8
|
+
export declare function gitOutput(args: string[], cwd?: string): string | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* The resolved pair. An empty commit variable is passed through unchanged
|
|
11
|
+
* (`CF_PAGES_COMMIT_SHA=''` yields `gitSha: ''`); callers treat a falsy value
|
|
12
|
+
* as unresolved, exactly as the build hook's guard does. An empty BRANCH
|
|
13
|
+
* variable counts as unset instead: GitHub Actions exports GITHUB_HEAD_REF=''
|
|
14
|
+
* on every push build, which would otherwise hide GITHUB_REF_NAME.
|
|
15
|
+
*/
|
|
16
|
+
interface BuildRef {
|
|
17
|
+
gitSha?: string;
|
|
18
|
+
branch?: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The commit and branch this checkout stands on — the pair a registration is
|
|
22
|
+
* keyed by. CI metadata first, most-specific source per provider. GitHub
|
|
23
|
+
* Actions checkouts are DETACHED, so the git fallback returns the literal
|
|
24
|
+
* 'HEAD' there — GITHUB_HEAD_REF (PR builds) / GITHUB_REF_NAME cover that
|
|
25
|
+
* case, and a surviving literal 'HEAD' is treated as unresolvable: a
|
|
26
|
+
* registration under branch 'HEAD' would never match the editor's
|
|
27
|
+
* branch-keyed lookup, silently registering dead weight.
|
|
28
|
+
*/
|
|
29
|
+
export declare function resolveBuildRef(env?: RepositoryEnvironment, git?: (args: string[]) => string | undefined): BuildRef;
|
|
30
|
+
/**
|
|
31
|
+
* The repository a registration is filed under: the explicit option and CI
|
|
32
|
+
* metadata are free to read; git is spawned ONLY when neither resolved it.
|
|
33
|
+
* Config loading is a hot path in Astro and must not start a subprocess on
|
|
34
|
+
* every integration instance.
|
|
35
|
+
*/
|
|
36
|
+
export declare function resolveRepositoryUri(explicit: string | undefined, env: RepositoryEnvironment, git?: (args: string[]) => string | undefined): string | undefined;
|
|
37
|
+
export {};
|
|
38
|
+
//# sourceMappingURL=git.d.ts.map
|
|
@@ -0,0 +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;;;;;;GAMG;AACH,UAAU,QAAQ;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAC7B,GAAG,GAAE,qBAAmC,EACxC,GAAG,GAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,MAAM,GAAG,SAAqB,GACtD,QAAQ,CAMV;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
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { execFileSync } from 'node:child_process';
|
|
2
|
+
import { detectRepositoryUri } from './repository.js';
|
|
3
|
+
/**
|
|
4
|
+
* Runs `git <args>` and returns trimmed stdout, or undefined when git is
|
|
5
|
+
* unavailable or the directory is not a checkout (e.g. tarball-based CI).
|
|
6
|
+
* `cwd` names the checkout to ask; without it git resolves against the
|
|
7
|
+
* process's own directory, which is the build's project but NOT the doctor's.
|
|
8
|
+
*/
|
|
9
|
+
export function gitOutput(args, cwd) {
|
|
10
|
+
try {
|
|
11
|
+
const output = execFileSync('git', args, { encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'], cwd }).trim();
|
|
12
|
+
return output === '' ? undefined : output;
|
|
13
|
+
}
|
|
14
|
+
catch {
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The commit and branch this checkout stands on — the pair a registration is
|
|
20
|
+
* keyed by. CI metadata first, most-specific source per provider. GitHub
|
|
21
|
+
* Actions checkouts are DETACHED, so the git fallback returns the literal
|
|
22
|
+
* 'HEAD' there — GITHUB_HEAD_REF (PR builds) / GITHUB_REF_NAME cover that
|
|
23
|
+
* case, and a surviving literal 'HEAD' is treated as unresolvable: a
|
|
24
|
+
* registration under branch 'HEAD' would never match the editor's
|
|
25
|
+
* branch-keyed lookup, silently registering dead weight.
|
|
26
|
+
*/
|
|
27
|
+
export function resolveBuildRef(env = process.env, git = gitOutput) {
|
|
28
|
+
const gitSha = env.CF_PAGES_COMMIT_SHA ?? git(['rev-parse', 'HEAD']);
|
|
29
|
+
const rawBranch = env.CF_PAGES_BRANCH || env.GITHUB_HEAD_REF || env.GITHUB_REF_NAME || git(['rev-parse', '--abbrev-ref', 'HEAD']);
|
|
30
|
+
const branch = rawBranch === 'HEAD' ? undefined : rawBranch;
|
|
31
|
+
return { ...(gitSha === undefined ? {} : { gitSha }), ...(branch === undefined ? {} : { branch }) };
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The repository a registration is filed under: the explicit option and CI
|
|
35
|
+
* metadata are free to read; git is spawned ONLY when neither resolved it.
|
|
36
|
+
* Config loading is a hot path in Astro and must not start a subprocess on
|
|
37
|
+
* every integration instance.
|
|
38
|
+
*/
|
|
39
|
+
export function resolveRepositoryUri(explicit, env, git = gitOutput) {
|
|
40
|
+
return (detectRepositoryUri({ explicit, env }) ??
|
|
41
|
+
detectRepositoryUri({ env: {}, remote: git(['config', '--get', 'remote.origin.url']) }));
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=git.js.map
|
|
@@ -0,0 +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,E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AAE,CAAC,CACxF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AACtF,YAAY,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Public surface for `@conloca/cloud-astro` — the site's Astro
|
|
2
|
+
// integration. The build pipeline (editor-bundle compile + registration POST)
|
|
3
|
+
// runs from `astro:build:done`; the preview modules serve draft pages out of
|
|
4
|
+
// the recursive preview build and read their content through
|
|
5
|
+
// `PreviewContentAPI`.
|
|
6
|
+
export { conlocaCloud, PACKAGE_NAME, PREVIEW_BUILD_ENV_FLAG } from './integration.js';
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,8EAA8E;AAC9E,6EAA6E;AAC7E,6DAA6D;AAC7D,uBAAuB;AAEvB,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { AstroIntegration } from 'astro';
|
|
2
|
+
import { PACKAGE_NAME, PREVIEW_BUILD_ENV_FLAG } from './constants.js';
|
|
3
|
+
import type { ConlocaCloudOptions } from './types.js';
|
|
4
|
+
export { PACKAGE_NAME, PREVIEW_BUILD_ENV_FLAG };
|
|
5
|
+
export declare function conlocaCloud(options: ConlocaCloudOptions): AstroIntegration;
|
|
6
|
+
//# sourceMappingURL=integration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integration.d.ts","sourceRoot":"","sources":["../../src/integration.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAA0B,MAAM,OAAO,CAAC;AAMtE,OAAO,EAAuB,YAAY,EAAE,sBAAsB,EAA2B,MAAM,gBAAgB,CAAC;AAUpH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAKtD,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,CAAC;AA6BhD,wBAAgB,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,gBAAgB,CAyW3E"}
|