@conloca/cloud-astro 0.2.1 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +261 -207
- package/dist/.build-inputs.json +60 -0
- package/dist/src/component-manifest.d.ts +5 -3
- package/dist/src/component-manifest.d.ts.map +1 -1
- package/dist/src/component-manifest.js +7 -7
- package/dist/src/component-manifest.js.map +1 -1
- package/dist/src/constants.d.ts +5 -13
- package/dist/src/constants.d.ts.map +1 -1
- package/dist/src/constants.js +5 -13
- package/dist/src/constants.js.map +1 -1
- package/dist/src/descriptors.d.ts +2 -2
- package/dist/src/descriptors.d.ts.map +1 -1
- package/dist/src/doctor/checks-address.d.ts +18 -0
- package/dist/src/doctor/checks-address.d.ts.map +1 -0
- package/dist/src/doctor/checks-address.js +163 -0
- package/dist/src/doctor/checks-address.js.map +1 -0
- package/dist/src/doctor/checks-live.d.ts +8 -5
- package/dist/src/doctor/checks-live.d.ts.map +1 -1
- package/dist/src/doctor/checks-live.js +220 -188
- package/dist/src/doctor/checks-live.js.map +1 -1
- package/dist/src/doctor/checks-offline.d.ts +8 -23
- package/dist/src/doctor/checks-offline.d.ts.map +1 -1
- package/dist/src/doctor/checks-offline.js +22 -239
- package/dist/src/doctor/checks-offline.js.map +1 -1
- package/dist/src/doctor/config-scan.d.ts +6 -3
- package/dist/src/doctor/config-scan.d.ts.map +1 -1
- package/dist/src/doctor/config-scan.js +21 -11
- package/dist/src/doctor/config-scan.js.map +1 -1
- package/dist/src/doctor/run.d.ts.map +1 -1
- package/dist/src/doctor/run.js +12 -10
- package/dist/src/doctor/run.js.map +1 -1
- package/dist/src/doctor/types.d.ts +7 -7
- package/dist/src/doctor/types.d.ts.map +1 -1
- package/dist/src/doctor/types.js +7 -7
- package/dist/src/doctor/types.js.map +1 -1
- package/dist/src/editor-page/bundle.d.ts +88 -0
- package/dist/src/editor-page/bundle.d.ts.map +1 -0
- package/dist/src/editor-page/bundle.js +370 -0
- package/dist/src/editor-page/bundle.js.map +1 -0
- package/dist/src/editor-page/emit.d.ts +33 -0
- package/dist/src/editor-page/emit.d.ts.map +1 -0
- package/dist/src/editor-page/emit.js +183 -0
- package/dist/src/editor-page/emit.js.map +1 -0
- package/dist/src/editor-page/framing.d.ts +23 -0
- package/dist/src/editor-page/framing.d.ts.map +1 -0
- package/dist/src/editor-page/framing.js +39 -0
- package/dist/src/editor-page/framing.js.map +1 -0
- package/dist/src/editor-page/page.d.ts +9 -0
- package/dist/src/editor-page/page.d.ts.map +1 -0
- package/dist/src/editor-page/page.js +31 -0
- package/dist/src/editor-page/page.js.map +1 -0
- package/dist/src/editor-page/site-base.d.ts +4 -0
- package/dist/src/editor-page/site-base.d.ts.map +1 -0
- package/dist/src/editor-page/site-base.js +13 -0
- package/dist/src/editor-page/site-base.js.map +1 -0
- package/dist/src/git.d.ts +11 -8
- package/dist/src/git.d.ts.map +1 -1
- package/dist/src/git.js +25 -8
- package/dist/src/git.js.map +1 -1
- package/dist/src/index.d.ts +3 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +9 -6
- package/dist/src/index.js.map +1 -1
- package/dist/src/integration.d.ts +1 -1
- package/dist/src/integration.d.ts.map +1 -1
- package/dist/src/integration.js +245 -396
- package/dist/src/integration.js.map +1 -1
- package/dist/src/node.d.ts +3 -1
- package/dist/src/node.d.ts.map +1 -1
- package/dist/src/node.js +7 -2
- package/dist/src/node.js.map +1 -1
- package/dist/src/preview/_dispatch.d.ts +5 -2
- package/dist/src/preview/_dispatch.d.ts.map +1 -1
- package/dist/src/preview/_dispatch.js +2 -0
- package/dist/src/preview/_dispatch.js.map +1 -1
- package/dist/src/preview/_resolve-opts.d.ts +18 -10
- package/dist/src/preview/_resolve-opts.d.ts.map +1 -1
- package/dist/src/preview/_resolve-opts.js +24 -10
- package/dist/src/preview/_resolve-opts.js.map +1 -1
- package/dist/src/preview/banner.d.ts.map +1 -1
- package/dist/src/preview/banner.js +2 -4
- package/dist/src/preview/banner.js.map +1 -1
- package/dist/src/preview/cookie.d.ts +5 -2
- package/dist/src/preview/cookie.d.ts.map +1 -1
- package/dist/src/preview/cookie.js +5 -2
- package/dist/src/preview/cookie.js.map +1 -1
- package/dist/src/preview/label.d.ts +8 -0
- package/dist/src/preview/label.d.ts.map +1 -0
- package/dist/src/preview/label.js +14 -0
- package/dist/src/preview/label.js.map +1 -0
- package/dist/src/preview/landing.d.ts +2 -2
- package/dist/src/preview/landing.js +2 -2
- package/dist/src/preview/middleware.d.ts +31 -20
- package/dist/src/preview/middleware.d.ts.map +1 -1
- package/dist/src/preview/middleware.js +56 -51
- package/dist/src/preview/middleware.js.map +1 -1
- package/dist/src/preview/preview-path.d.ts +18 -5
- package/dist/src/preview/preview-path.d.ts.map +1 -1
- package/dist/src/preview/preview-path.js +24 -8
- package/dist/src/preview/preview-path.js.map +1 -1
- package/dist/src/preview/site-middleware.d.ts +5 -5
- package/dist/src/preview/site-middleware.d.ts.map +1 -1
- package/dist/src/preview/site-middleware.js +17 -16
- package/dist/src/preview/site-middleware.js.map +1 -1
- package/dist/src/preview-build.d.ts +18 -15
- package/dist/src/preview-build.d.ts.map +1 -1
- package/dist/src/preview-build.js +36 -21
- package/dist/src/preview-build.js.map +1 -1
- package/dist/src/preview.d.ts +1 -1
- package/dist/src/preview.d.ts.map +1 -1
- package/dist/src/preview.js +1 -1
- package/dist/src/preview.js.map +1 -1
- package/dist/src/repository.d.ts +1 -1
- package/dist/src/repository.js +1 -1
- package/dist/src/resolve-options.d.ts +17 -0
- package/dist/src/resolve-options.d.ts.map +1 -0
- package/dist/src/resolve-options.js +21 -0
- package/dist/src/resolve-options.js.map +1 -0
- package/dist/src/site-id.d.ts +0 -2
- package/dist/src/site-id.d.ts.map +1 -1
- package/dist/src/site-id.js +2 -3
- package/dist/src/site-id.js.map +1 -1
- package/dist/src/types.d.ts +21 -59
- package/dist/src/types.d.ts.map +1 -1
- package/package.json +44 -15
- package/src/component-manifest.ts +11 -8
- package/src/constants.ts +5 -14
- package/src/descriptors.ts +2 -2
- package/src/doctor/checks-address.ts +190 -0
- package/src/doctor/checks-live.ts +256 -268
- package/src/doctor/checks-offline.ts +24 -262
- package/src/doctor/config-scan.ts +21 -9
- package/src/doctor/run.ts +14 -16
- package/src/doctor/types.ts +7 -7
- package/src/editor-page/bundle.ts +482 -0
- package/src/editor-page/emit.ts +246 -0
- package/src/editor-page/framing.ts +62 -0
- package/src/editor-page/page.ts +37 -0
- package/src/editor-page/site-base.ts +11 -0
- package/src/git.ts +29 -10
- package/src/index.ts +20 -6
- package/src/integration.ts +255 -449
- package/src/node.ts +18 -2
- package/src/preview/_dispatch.ts +6 -2
- package/src/preview/_resolve-opts.ts +34 -11
- package/src/preview/banner.ts +2 -4
- package/src/preview/cookie.ts +5 -2
- package/src/preview/label.ts +12 -0
- package/src/preview/landing.ts +2 -2
- package/src/preview/middleware.ts +83 -66
- package/src/preview/preview-path.ts +26 -8
- package/src/preview/site-middleware.ts +17 -21
- package/src/preview-build.ts +42 -26
- package/src/preview-handler.astro +10 -8
- package/src/preview.ts +0 -1
- package/src/repository.ts +1 -1
- package/src/resolve-options.ts +37 -0
- package/src/site-id.ts +2 -4
- package/src/skill/SKILL.md +51 -55
- package/src/types.ts +21 -60
- package/src/virtual-modules.d.ts +5 -1
- package/dist/src/build-commit.d.ts +0 -19
- package/dist/src/build-commit.d.ts.map +0 -1
- package/dist/src/build-commit.js +0 -6
- package/dist/src/build-commit.js.map +0 -1
- package/dist/src/bundle.d.ts +0 -173
- package/dist/src/bundle.d.ts.map +0 -1
- package/dist/src/bundle.js +0 -413
- package/dist/src/bundle.js.map +0 -1
- package/dist/src/discovery.d.ts +0 -58
- package/dist/src/discovery.d.ts.map +0 -1
- package/dist/src/discovery.js +0 -133
- package/dist/src/discovery.js.map +0 -1
- package/dist/src/register.d.ts +0 -98
- package/dist/src/register.d.ts.map +0 -1
- package/dist/src/register.js +0 -103
- package/dist/src/register.js.map +0 -1
- package/src/build-commit.ts +0 -22
- package/src/bundle.ts +0 -563
- package/src/discovery.ts +0 -183
- package/src/register.ts +0 -180
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 1,
|
|
3
|
+
"files": {
|
|
4
|
+
"packages/cloud-astro/src/component-manifest.ts": "a044ac5b228b5f80d96f886affa86345decfd5738e2878ec098b8f4a77b58843",
|
|
5
|
+
"packages/cloud-astro/src/constants.ts": "b2f60a5969cb9e82adaa0d096486e4864761d6b6eb549e3035e48445cf8ed8ab",
|
|
6
|
+
"packages/cloud-astro/src/descriptors.ts": "de58e29c79e2edc7664cf01a363bae18f01bce8b61b03a0f6e0aee23b0f79ef1",
|
|
7
|
+
"packages/cloud-astro/src/doctor.ts": "4181a530feba74a4316a790b42d4c22d717de696718e848c12378e403fd2d84a",
|
|
8
|
+
"packages/cloud-astro/src/doctor/checks-address.ts": "ce1735bcd468deb5628761e2314d23d613b16c3c976f3bb6cd3fb67e12f2c8d6",
|
|
9
|
+
"packages/cloud-astro/src/doctor/checks-live.ts": "19933648f5330a98bcaa3a54c91a1c257cdbe68e5e1bf75b4b89e72338ea582b",
|
|
10
|
+
"packages/cloud-astro/src/doctor/checks-offline.ts": "20826a86fb9e74bc752c9d6e94ed9951b5263e97961855bcf58e24a85a4b1d45",
|
|
11
|
+
"packages/cloud-astro/src/doctor/config-scan.ts": "9a964383b58754a915d3d58014157ef3379c5e0de5f34a0f610111b33c615607",
|
|
12
|
+
"packages/cloud-astro/src/doctor/run.ts": "414e15a89245a13ade974f497efa04772f72baa4fad8b39958a184df53a93c33",
|
|
13
|
+
"packages/cloud-astro/src/doctor/types.ts": "fc6dab637bacb3834969d4d3e936dac70f687dbbab9ce74f66c9cf4316096813",
|
|
14
|
+
"packages/cloud-astro/src/editor-page/bundle.ts": "75458adf4926b74fc7f24863cfc0dab86d7a66d8b5eef70d262fb19ebfe7ce1a",
|
|
15
|
+
"packages/cloud-astro/src/editor-page/emit.ts": "765486e3b1d48aa8364c56c3651e383edd161c39e6f0bba130db7eabfa22018f",
|
|
16
|
+
"packages/cloud-astro/src/editor-page/framing.ts": "6522fc1d49f05d332d798908bcb8c726d0064ababd8d74cdab71aecb8ccf2e6b",
|
|
17
|
+
"packages/cloud-astro/src/editor-page/page.ts": "f4987bdcd64c4063810f6320e1c5822b9bb3288b83d5d525fb18c35e30c9f724",
|
|
18
|
+
"packages/cloud-astro/src/editor-page/site-base.ts": "56fc5a4d6b3767e079d23ab9898d268feb26525642c68cabc5cfb750c6f2fb19",
|
|
19
|
+
"packages/cloud-astro/src/git.ts": "7e51995ef366ce9843ccb595214ea1f66f02481140c317e5ad6878fb44e5c44e",
|
|
20
|
+
"packages/cloud-astro/src/index.ts": "f43c4848ef6a3bd28218b2a742848dc3f6f85ebeec9abbf3374f575af46a4637",
|
|
21
|
+
"packages/cloud-astro/src/integration.ts": "e4be21431c20146c6a6a501a1e1760440d476d6880c977c7f4b325485ad8114b",
|
|
22
|
+
"packages/cloud-astro/src/message-of.ts": "ad147a15f10d89a0b8a193062d36b7fcd7ea670debceba69b44619985461d4a1",
|
|
23
|
+
"packages/cloud-astro/src/node.ts": "c8396ae7861b44898ebf36f2e79619eaffdd5eb2b57e0d0c99894525b1e58533",
|
|
24
|
+
"packages/cloud-astro/src/package-version.ts": "3b2507e61f60f68c5699076446547d25ad9ddc94f4692822e961d44d4af183ed",
|
|
25
|
+
"packages/cloud-astro/src/preview-build.ts": "7aa6afb6b26e18b3ba0d703e2f0ac69cbb459b344a95452c50e64edd3a15c432",
|
|
26
|
+
"packages/cloud-astro/src/preview-handler.d.ts": "a7671b653f29f493ef436f00ef046ac57215b88d5b48fd4b09faba9412fca7c4",
|
|
27
|
+
"packages/cloud-astro/src/preview.ts": "30da5511322ead3e3b2cad366a913d05c3b69f24c3bc7012005e213ace21ca77",
|
|
28
|
+
"packages/cloud-astro/src/preview/_dispatch.ts": "c2acc5a12f2e5c764101c6f1992c262c422fb021fe927390efa97592cb5b302f",
|
|
29
|
+
"packages/cloud-astro/src/preview/_resolve-opts.ts": "93c4f32aa993dbba6852acb2bf15feb3f7344ca1250911c54196a2dca72e317e",
|
|
30
|
+
"packages/cloud-astro/src/preview/banner.ts": "ce113a0787759b9a78c68cac5fc3dae522cbecf402f144c7625cec88ff7b99fe",
|
|
31
|
+
"packages/cloud-astro/src/preview/content-api.ts": "0312073c6a145361a89800c4dbc9d345817d830d576da459905aa195b0194694",
|
|
32
|
+
"packages/cloud-astro/src/preview/cookie.ts": "2fca192f4b7d82f90331192f03073787c914e69f08169dd25123515cfba183e5",
|
|
33
|
+
"packages/cloud-astro/src/preview/headers.ts": "a549b0f63a6eeb387b0ec803e0f5a4fe1fddb4a38d5644aaaaa5852b303c6b3b",
|
|
34
|
+
"packages/cloud-astro/src/preview/label.ts": "a36eed2674aaa74427bdb2d52cedaa89f8ee2bca418f4b53ab3d44e6033270f7",
|
|
35
|
+
"packages/cloud-astro/src/preview/landing.ts": "16ca58c5814ec3ece4b163cb8ed32b16dc6dbc9d310550dbd641c9798a106db1",
|
|
36
|
+
"packages/cloud-astro/src/preview/middleware.ts": "0de4267138c8b086c99c4648a93c5767849d25bb7f176f60e8ac51cbe3873e36",
|
|
37
|
+
"packages/cloud-astro/src/preview/preview-path.ts": "c1f6934854116f39f4b4b228cb158fe7905359980aee8401169db6f565e8d1ca",
|
|
38
|
+
"packages/cloud-astro/src/preview/satteri-workerd.ts": "f48a7cfa9729317222a89cf058461c9130914e07043444f5723ce06e70e39c2a",
|
|
39
|
+
"packages/cloud-astro/src/preview/site-middleware.ts": "cadc10728598805cd940d53ae2efa810590f12cddcdd228d3adfeea1f29aa951",
|
|
40
|
+
"packages/cloud-astro/src/preview/workerd-shim.ts": "7d4eaedac169a36a317f79c3066c026b92f374d0fae0067938a3192a71c48a55",
|
|
41
|
+
"packages/cloud-astro/src/repository.ts": "4b1a1ac9a7bb4e6b46f057b754802b8ee8a2c73f4de6ae58ec2fb8820436489b",
|
|
42
|
+
"packages/cloud-astro/src/resolve-options.ts": "4bedf9fcced55716fe887103f5bf03f42ae5aab3a502cde6861cbd292d8e08f8",
|
|
43
|
+
"packages/cloud-astro/src/site-id.ts": "4a836250ba2017a50683986b964fcedfc9a580559ca89b64f64e53ca80c786ce",
|
|
44
|
+
"packages/cloud-astro/src/site-middleware.ts": "edde690370d527471d5f5b46e44a24579684b900c4fd74f5d1406464fd8853f4",
|
|
45
|
+
"packages/cloud-astro/src/skill.ts": "13c9052d529b2edf906c12c00503fd1edef28e1fa7186821110b92b6e028254c",
|
|
46
|
+
"packages/cloud-astro/src/types.ts": "1ea53a94599be97977f937e81ff6c574d568105bf1bfdf3d4bbf55d4dfa95a8b",
|
|
47
|
+
"packages/cloud-astro/src/virtual-modules.d.ts": "9d28d2ab0a6b8e7c0062c35cde71e0260f162a46deacb9472edf84d87fe8147b",
|
|
48
|
+
"packages/cloud-astro/tsconfig.lib.json": "82151563b73ee0cae4c54f46e865d1a26bac18e08c10093268309278de5539f9"
|
|
49
|
+
},
|
|
50
|
+
"complete": [
|
|
51
|
+
":(glob)packages/cloud-astro/src/**/*.ts",
|
|
52
|
+
":(glob)packages/cloud-astro/src/**/*.d.ts",
|
|
53
|
+
":(exclude,glob)packages/cloud-astro/src/**/*.test.ts",
|
|
54
|
+
":(exclude,glob)packages/cloud-astro/src/__tests__/**/*"
|
|
55
|
+
],
|
|
56
|
+
"producer": {
|
|
57
|
+
"project": "cloud-astro",
|
|
58
|
+
"target": "tsc-js"
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
/** The emitted manifest: its site-relative URL and the full sha-256 hex of its bytes. */
|
|
1
|
+
/** The emitted manifest: its site-relative URL, its file name and the full sha-256 hex of its bytes. */
|
|
2
2
|
export interface ComponentManifestArtifact {
|
|
3
3
|
url: string;
|
|
4
|
+
filename: string;
|
|
4
5
|
hash: string;
|
|
5
6
|
}
|
|
6
7
|
type Logger = {
|
|
@@ -11,8 +12,7 @@ type Logger = {
|
|
|
11
12
|
* Writes the site's component vocabulary — every Puck component the config
|
|
12
13
|
* declares and what each accepts, read from source and never executed — as a
|
|
13
14
|
* content-addressed artifact beside the editor bundle:
|
|
14
|
-
*
|
|
15
|
-
* bundle wrote already covers it, and `mirrorEditorAssets` copies the dir.
|
|
15
|
+
* `<folder>/component-manifest.<hash16>.json`.
|
|
16
16
|
*
|
|
17
17
|
* Fail-soft: the manifest is metadata for agents, so a failure costs the
|
|
18
18
|
* manifest and warns — never the build. A config the reader cannot fully read
|
|
@@ -21,6 +21,8 @@ type Logger = {
|
|
|
21
21
|
*/
|
|
22
22
|
export declare function emitComponentManifest(input: {
|
|
23
23
|
dir: string;
|
|
24
|
+
/** Folder below `dir` to write into; `_conloca` unless given. */
|
|
25
|
+
folder?: string;
|
|
24
26
|
puckConfigPath: string;
|
|
25
27
|
projectRoot: string;
|
|
26
28
|
logger: Logger;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component-manifest.d.ts","sourceRoot":"","sources":["../../src/component-manifest.ts"],"names":[],"mappings":"AAMA,
|
|
1
|
+
{"version":3,"file":"component-manifest.d.ts","sourceRoot":"","sources":["../../src/component-manifest.ts"],"names":[],"mappings":"AAMA,wGAAwG;AACxG,MAAM,WAAW,yBAAyB;IACxC,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;CACd;AAKD,KAAK,MAAM,GAAG;IAAE,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC;AAE3E;;;;;;;;;;GAUG;AACH,wBAAsB,qBAAqB,CAAC,KAAK,EAAE;IACjD,GAAG,EAAE,MAAM,CAAC;IACZ,iEAAiE;IACjE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;CAChB,GAAG,OAAO,CAAC,yBAAyB,GAAG,SAAS,CAAC,CA2BjD"}
|
|
@@ -3,14 +3,13 @@ import { mkdir, writeFile } from 'node:fs/promises';
|
|
|
3
3
|
import { join } from 'node:path';
|
|
4
4
|
import { endpointReaderOptions, readPuckConfig } from '@conloca/astro-cms/puck-manifest';
|
|
5
5
|
import { COMPONENT_MANIFEST_LIMITS, measureJson } from '@conloca/content-api/component-vocabulary';
|
|
6
|
-
/** Metadata transport ceiling; larger metadata must not
|
|
6
|
+
/** Metadata transport ceiling; larger metadata must not ship as a usable artifact. */
|
|
7
7
|
const MAX_MANIFEST_BYTES = COMPONENT_MANIFEST_LIMITS.bytes;
|
|
8
8
|
/**
|
|
9
9
|
* Writes the site's component vocabulary — every Puck component the config
|
|
10
10
|
* declares and what each accepts, read from source and never executed — as a
|
|
11
11
|
* content-addressed artifact beside the editor bundle:
|
|
12
|
-
*
|
|
13
|
-
* bundle wrote already covers it, and `mirrorEditorAssets` copies the dir.
|
|
12
|
+
* `<folder>/component-manifest.<hash16>.json`.
|
|
14
13
|
*
|
|
15
14
|
* Fail-soft: the manifest is metadata for agents, so a failure costs the
|
|
16
15
|
* manifest and warns — never the build. A config the reader cannot fully read
|
|
@@ -18,6 +17,7 @@ const MAX_MANIFEST_BYTES = COMPONENT_MANIFEST_LIMITS.bytes;
|
|
|
18
17
|
* build log names what could not be read, where the developer looks.
|
|
19
18
|
*/
|
|
20
19
|
export async function emitComponentManifest(input) {
|
|
20
|
+
const folder = input.folder ?? '_conloca';
|
|
21
21
|
try {
|
|
22
22
|
const manifest = readPuckConfig(endpointReaderOptions({ puckConfigPath: input.puckConfigPath, projectRoot: input.projectRoot }));
|
|
23
23
|
const bytes = new TextEncoder().encode(JSON.stringify(manifest));
|
|
@@ -28,10 +28,10 @@ export async function emitComponentManifest(input) {
|
|
|
28
28
|
measureJson(manifest, COMPONENT_MANIFEST_LIMITS);
|
|
29
29
|
const hash = createHash('sha256').update(bytes).digest('hex');
|
|
30
30
|
const filename = `component-manifest.${hash.slice(0, 16)}.json`;
|
|
31
|
-
await mkdir(join(input.dir,
|
|
32
|
-
await writeFile(join(input.dir,
|
|
33
|
-
reportManifest(manifest,
|
|
34
|
-
return { url:
|
|
31
|
+
await mkdir(join(input.dir, folder), { recursive: true });
|
|
32
|
+
await writeFile(join(input.dir, folder, filename), bytes);
|
|
33
|
+
reportManifest(manifest, `/${folder}/${filename}`, input.logger);
|
|
34
|
+
return { url: `/${folder}/${filename}`, filename, hash };
|
|
35
35
|
}
|
|
36
36
|
catch (error) {
|
|
37
37
|
input.logger.warn('component manifest skipped — agents get no component vocabulary from this build ' +
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component-manifest.js","sourceRoot":"","sources":["../../src/component-manifest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,qBAAqB,EAAqB,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAC5G,OAAO,EAAE,yBAAyB,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAC;
|
|
1
|
+
{"version":3,"file":"component-manifest.js","sourceRoot":"","sources":["../../src/component-manifest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,qBAAqB,EAAqB,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAC5G,OAAO,EAAE,yBAAyB,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAC;AASnG,sFAAsF;AACtF,MAAM,kBAAkB,GAAG,yBAAyB,CAA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AG,EAAE,IAAI,MAAM,IAAI,QAAQ,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC3D,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,KAAK,CAAC,MAAM,CAAC,IAAI,CACf,kFAAkF;YAChF,IAAI,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAChE,CAAC;QACF,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC;AAED,8FAA8F;AAC9F,SAAS,cAAc,CAAC,QAAsB,EAAE,GAAW,EAAE,MAAc;IACzE,MAAM,CAAC,IAAI,CAAC,+BAA+B,GAAG,KAAK,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,MAAM,cAAc,CAAC,CAAC;IAC1G,IAAI,QAAQ,CAAC,UAAU,EAAE,CAAC;QACxB,MAAM,CAAC,IAAI,CACT,qCAAqC,QAAQ,CAAC,gBAAgB,IAAI,oCAAoC,EAAE,CACzG,CAAC;IACJ,CAAC;IACD,KAAK,MAAM,IAAI,IAAI,QAAQ,CAAC,UAAU,EAAE,CAAC;QACvC,MAAM,MAAM,GAAG,QAAQ,CAAC,iBAAiB,EAAE,CAAC,IAAI,CAAC,CAAC;QAClD,MAAM,CAAC,IAAI,CAAC,aAAa,IAAI,qBAAqB,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,MAAM,EAAE,EAAE,CAAC,CAAC;IACjG,CAAC;AACH,CAAC"}
|
package/dist/src/constants.d.ts
CHANGED
|
@@ -6,21 +6,13 @@ export declare const PACKAGE_NAME = "@conloca/cloud-astro";
|
|
|
6
6
|
/**
|
|
7
7
|
* Environment variable that the recursive preview build sets on the child
|
|
8
8
|
* Astro process so the integration's own `astro:build:done` hook can detect
|
|
9
|
-
* it and skip
|
|
9
|
+
* it and skip the editor page and further recursion.
|
|
10
10
|
*/
|
|
11
11
|
export declare const PREVIEW_BUILD_ENV_FLAG = "CONLOCA_PREVIEW_BUILD";
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
14
|
-
* the
|
|
15
|
-
*
|
|
13
|
+
* Adapters the preview build is refused under: they write their deployable
|
|
14
|
+
* output at the project root whatever `outDir` says, so the preview build
|
|
15
|
+
* could replace the live site.
|
|
16
16
|
*/
|
|
17
|
-
export declare const
|
|
18
|
-
/**
|
|
19
|
-
* Environment variable carrying the build token (`cbt_<id>.<secret>`),
|
|
20
|
-
* issued by the endpoint, that authenticates the site's build to the
|
|
21
|
-
* endpoint's registration route.
|
|
22
|
-
* Read when {@link ConlocaCloudOptions.buildToken} is not set, so CI can
|
|
23
|
-
* inject the credential without committing it to `astro.config.mjs`.
|
|
24
|
-
*/
|
|
25
|
-
export declare const BUILD_TOKEN_ENV_VAR = "CONLOCA_BUILD_TOKEN";
|
|
17
|
+
export declare const REFUSED_PREVIEW_ADAPTERS: readonly string[];
|
|
26
18
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,YAAY,yBAAyB,CAAC;AAEnD;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,0BAA0B,CAAC;AAE9D;;;;GAIG;AACH,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,YAAY,yBAAyB,CAAC;AAEnD;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,0BAA0B,CAAC;AAE9D;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,EAAE,SAAS,MAAM,EAA4C,CAAC"}
|
package/dist/src/constants.js
CHANGED
|
@@ -6,21 +6,13 @@ export const PACKAGE_NAME = '@conloca/cloud-astro';
|
|
|
6
6
|
/**
|
|
7
7
|
* Environment variable that the recursive preview build sets on the child
|
|
8
8
|
* Astro process so the integration's own `astro:build:done` hook can detect
|
|
9
|
-
* it and skip
|
|
9
|
+
* it and skip the editor page and further recursion.
|
|
10
10
|
*/
|
|
11
11
|
export const PREVIEW_BUILD_ENV_FLAG = 'CONLOCA_PREVIEW_BUILD';
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
14
|
-
* the
|
|
15
|
-
*
|
|
13
|
+
* Adapters the preview build is refused under: they write their deployable
|
|
14
|
+
* output at the project root whatever `outDir` says, so the preview build
|
|
15
|
+
* could replace the live site.
|
|
16
16
|
*/
|
|
17
|
-
export const
|
|
18
|
-
/**
|
|
19
|
-
* Environment variable carrying the build token (`cbt_<id>.<secret>`),
|
|
20
|
-
* issued by the endpoint, that authenticates the site's build to the
|
|
21
|
-
* endpoint's registration route.
|
|
22
|
-
* Read when {@link ConlocaCloudOptions.buildToken} is not set, so CI can
|
|
23
|
-
* inject the credential without committing it to `astro.config.mjs`.
|
|
24
|
-
*/
|
|
25
|
-
export const BUILD_TOKEN_ENV_VAR = 'CONLOCA_BUILD_TOKEN';
|
|
17
|
+
export const REFUSED_PREVIEW_ADAPTERS = ['@astrojs/vercel', '@astrojs/netlify'];
|
|
26
18
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,sBAAsB,CAAC;AAEnD;;;;GAIG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,uBAAuB,CAAC;AAE9D;;;;GAIG;AACH,MAAM,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,sBAAsB,CAAC;AAEnD;;;;GAIG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,uBAAuB,CAAC;AAE9D;;;;GAIG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAsB,CAAC,iBAAiB,EAAE,kBAAkB,CAAC,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { MdxRegistryScanOptions } from '@conloca/astro-cms/node';
|
|
2
|
-
import type { EditorBundleDescriptors } from './bundle.js';
|
|
2
|
+
import type { EditorBundleDescriptors } from './editor-page/bundle.js';
|
|
3
3
|
/**
|
|
4
4
|
* The MDX discovery seam, so tests can drive the failure path without a
|
|
5
|
-
* fixture project
|
|
5
|
+
* fixture project.
|
|
6
6
|
*/
|
|
7
7
|
export type MdxDescriptorScan = (options: MdxRegistryScanOptions) => Promise<readonly unknown[]>;
|
|
8
8
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"descriptors.d.ts","sourceRoot":"","sources":["../../src/descriptors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAOtE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"descriptors.d.ts","sourceRoot":"","sources":["../../src/descriptors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAOtE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAEvE;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,EAAE,sBAAsB,KAAK,OAAO,CAAC,SAAS,OAAO,EAAE,CAAC,CAAC;AAgBjG;;;;;;;;;;;;GAYG;AACH,wBAAsB,wBAAwB,CAC5C,MAAM,EAAE;IAAE,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,EACpE,GAAG,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAe,EACrD,IAAI,GAAE,iBAAsC,GAC3C,OAAO,CAAC,uBAAuB,GAAG,SAAS,CAAC,CA6C9C"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ConfigScan } from './config-scan.js';
|
|
2
|
+
import { type CheckOutcome, type DoctorDeps } from './types.js';
|
|
3
|
+
/** CC9's outcome and, when it passed, the address the live checks contact. */
|
|
4
|
+
interface SiteAddressCheck {
|
|
5
|
+
outcome: CheckOutcome;
|
|
6
|
+
address?: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* CC9 — the address the editor frames, `https://<domains[defaultLocale]><base>` of the site `addressSiteName` picks,
|
|
10
|
+
* by the same rule the server applies. Astro's own `site` and `base`, when the config text shows them, must agree.
|
|
11
|
+
*/
|
|
12
|
+
export declare function checkSiteAddress(scan: ConfigScan, contentRoot: string, deps: Pick<DoctorDeps, 'readFile'>): SiteAddressCheck;
|
|
13
|
+
/** CC10 — a committed header rule that keeps the workspace editor from framing /_conloca/editor/, with the fix. */
|
|
14
|
+
export declare function checkFramingHeaders(scan: ConfigScan, projectDir: string, endpoint: string | undefined, deps: Pick<DoctorDeps, 'exists'>): Promise<CheckOutcome>;
|
|
15
|
+
/** CC14 — each line of a tracked workflow or the astro config that still names the build key or one of its options. */
|
|
16
|
+
export declare function checkKeyLeftovers(scan: ConfigScan, projectDir: string, deps: DoctorDeps): CheckOutcome;
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=checks-address.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checks-address.d.ts","sourceRoot":"","sources":["../../../src/doctor/checks-address.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,UAAU,EAAsB,MAAM,YAAY,CAAC;AA6CpF,8EAA8E;AAC9E,UAAU,gBAAgB;IACxB,OAAO,EAAE,YAAY,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,UAAU,EAChB,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,IAAI,CAAC,UAAU,EAAE,UAAU,CAAC,GACjC,gBAAgB,CA4DlB;AAED,mHAAmH;AACnH,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,UAAU,EAChB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,IAAI,EAAE,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,GAC/B,OAAO,CAAC,YAAY,CAAC,CAwBvB;AAED,uHAAuH;AACvH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,YAAY,CA2BtG"}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { join, relative } from 'node:path';
|
|
2
|
+
import { addressSiteName, isValidSiteBase } from '@conloca/content-api';
|
|
3
|
+
import { isRecord } from '@conloca/content-api/component-vocabulary';
|
|
4
|
+
import { EDITOR_PAGE_PATH, editorUiOrigin, parentRoot } from '@conloca/content-api/editor-host';
|
|
5
|
+
import { findFramingBlockers, framingSnippets } from '../editor-page/framing.js';
|
|
6
|
+
import { baseMismatch } from '../editor-page/site-base.js';
|
|
7
|
+
import { INTEGRATION_NOT_CALLED } from './checks-offline.js';
|
|
8
|
+
import { outcomeOf, skipped } from './types.js';
|
|
9
|
+
/** The server's bare-host rule: lowercase dot-separated labels of letters, digits and inner hyphens; no scheme, port or path. */
|
|
10
|
+
const PLAIN_HOST = /^(?=.{1,253}$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/;
|
|
11
|
+
/**
|
|
12
|
+
* Why the editor's address rule refuses a bare host, else undefined.
|
|
13
|
+
* shortcut: the editor also refuses its own login host and private names; those surface only in the editor's setup
|
|
14
|
+
* list, since doctor cannot tell them without the editor's settings.
|
|
15
|
+
*/
|
|
16
|
+
function refusedHost(host) {
|
|
17
|
+
// WHATWG rewrites IPv4 shorthands (`127.1`) and refuses a host ending in a number that is no IPv4.
|
|
18
|
+
const parsed = URL.canParse(`https://${host}/`) ? new URL(`https://${host}/`).hostname : null;
|
|
19
|
+
if (parsed !== host || /^\d+(\.\d+){3}$/.test(host))
|
|
20
|
+
return 'an IP address';
|
|
21
|
+
if (host === 'localhost' || host.endsWith('.localhost'))
|
|
22
|
+
return 'localhost';
|
|
23
|
+
// Bare `conloca.com` is Conloca's own website, which the rule allows for that one repository.
|
|
24
|
+
if (host.endsWith('.conloca.com'))
|
|
25
|
+
return 'a conloca.com host';
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
/** What the build key setup left behind: its environment variable and the options that went with it. */
|
|
29
|
+
const LEFTOVER_KEY_NAMES = [
|
|
30
|
+
'CONLOCA_BUILD_TOKEN',
|
|
31
|
+
'buildToken',
|
|
32
|
+
'publicBaseUrl',
|
|
33
|
+
'previewDomain',
|
|
34
|
+
'requireRegistration',
|
|
35
|
+
];
|
|
36
|
+
const LEFTOVER_RE = new RegExp(`\\b(?:${LEFTOVER_KEY_NAMES.join('|')})\\b`, 'g');
|
|
37
|
+
/** The fields of sites.json the address reads; the rest is the editor's business. */
|
|
38
|
+
function isSitesConfig(value) {
|
|
39
|
+
return (isRecord(value) &&
|
|
40
|
+
isRecord(value.sites) &&
|
|
41
|
+
Object.values(value.sites).every((site) => isRecord(site) &&
|
|
42
|
+
typeof site.defaultLocale === 'string' &&
|
|
43
|
+
(site.domains === undefined || isRecord(site.domains)) &&
|
|
44
|
+
(site.base === undefined || typeof site.base === 'string')));
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* CC9 — the address the editor frames, `https://<domains[defaultLocale]><base>` of the site `addressSiteName` picks,
|
|
48
|
+
* by the same rule the server applies. Astro's own `site` and `base`, when the config text shows them, must agree.
|
|
49
|
+
*/
|
|
50
|
+
export function checkSiteAddress(scan, contentRoot, deps) {
|
|
51
|
+
if (scan.kind === 'read' && scan.config.conlocaCloud === 'absent') {
|
|
52
|
+
return { outcome: skipped('CC9', INTEGRATION_NOT_CALLED) };
|
|
53
|
+
}
|
|
54
|
+
const outcome = outcomeOf('CC9');
|
|
55
|
+
const sitesPath = join(contentRoot, 'sites.json');
|
|
56
|
+
const fail = (message) => {
|
|
57
|
+
outcome.problems.push({ check: 'CC9', level: 'error', message, path: sitesPath });
|
|
58
|
+
return { outcome };
|
|
59
|
+
};
|
|
60
|
+
let sites;
|
|
61
|
+
try {
|
|
62
|
+
sites = JSON.parse(deps.readFile(sitesPath));
|
|
63
|
+
}
|
|
64
|
+
catch {
|
|
65
|
+
return fail(`${sitesPath} is missing or not JSON — run conloca connect`);
|
|
66
|
+
}
|
|
67
|
+
if (!isSitesConfig(sites))
|
|
68
|
+
return fail(`${sitesPath} has no readable sites map`);
|
|
69
|
+
const name = addressSiteName(sites);
|
|
70
|
+
const site = name === null ? undefined : sites.sites[name];
|
|
71
|
+
if (name === null || site === undefined) {
|
|
72
|
+
return fail('sites.json lists several sites and none is named default, so the editor cannot tell which one gives the address');
|
|
73
|
+
}
|
|
74
|
+
const locale = site.defaultLocale;
|
|
75
|
+
const host = site.domains?.[locale];
|
|
76
|
+
if (host === undefined) {
|
|
77
|
+
return fail(`site "${name}" in sites.json has no domains.${locale} — run conloca connect, or add your site's host there`);
|
|
78
|
+
}
|
|
79
|
+
if (typeof host !== 'string' || !PLAIN_HOST.test(host)) {
|
|
80
|
+
return fail(`site "${name}" has domains.${locale} "${host}", which is not a bare host such as www.example.com`);
|
|
81
|
+
}
|
|
82
|
+
const refused = refusedHost(host);
|
|
83
|
+
if (refused !== undefined) {
|
|
84
|
+
return fail(`site "${name}" has domains.${locale} "${host}", which is ${refused}: the editor never frames a page there — use your site's public host`);
|
|
85
|
+
}
|
|
86
|
+
const base = site.base ?? '/';
|
|
87
|
+
if (!isValidSiteBase(base))
|
|
88
|
+
return fail(`site "${name}" has base "${base}", which is not a path such as /docs/`);
|
|
89
|
+
const address = `https://${host}${base}`;
|
|
90
|
+
outcome.detail = address;
|
|
91
|
+
if (scan.kind === 'read') {
|
|
92
|
+
const { url, base: astroBase } = scan.config.site;
|
|
93
|
+
const warn = (message) => outcome.problems.push({ check: 'CC9', level: 'warn', message, path: scan.config.path });
|
|
94
|
+
const astroHost = typeof url === 'string' && URL.canParse(url) ? new URL(url).hostname : undefined;
|
|
95
|
+
if (astroHost !== undefined && astroHost !== host) {
|
|
96
|
+
warn(`Astro's site is ${url} but sites.json gives the site "${name}" the host ${host}: the workspace editor opens ${address}${EDITOR_PAGE_PATH.slice(1)}. Make them match.`);
|
|
97
|
+
}
|
|
98
|
+
// An absent Astro base is `/`; a computed one is not judged.
|
|
99
|
+
const mismatch = astroBase === null ? undefined : baseMismatch(sites, astroBase ?? '/');
|
|
100
|
+
if (mismatch !== undefined)
|
|
101
|
+
warn(mismatch);
|
|
102
|
+
}
|
|
103
|
+
return { outcome, address };
|
|
104
|
+
}
|
|
105
|
+
/** CC10 — a committed header rule that keeps the workspace editor from framing /_conloca/editor/, with the fix. */
|
|
106
|
+
export async function checkFramingHeaders(scan, projectDir, endpoint, deps) {
|
|
107
|
+
if (scan.kind === 'read' && scan.config.conlocaCloud === 'absent')
|
|
108
|
+
return skipped('CC10', INTEGRATION_NOT_CALLED);
|
|
109
|
+
const origin = editorUiOrigin(endpoint);
|
|
110
|
+
const editorRoot = origin === null ? null : parentRoot(origin);
|
|
111
|
+
if (editorRoot === null)
|
|
112
|
+
return skipped('CC10', 'no editor UI origin');
|
|
113
|
+
const outcome = outcomeOf('CC10');
|
|
114
|
+
const snippets = framingSnippets(editorRoot);
|
|
115
|
+
// Netlify reads public/_headers too, but has no syntax for removing a header.
|
|
116
|
+
const headersRule = deps.exists(join(projectDir, 'netlify.toml'))
|
|
117
|
+
? snippets.netlifyHeaders
|
|
118
|
+
: snippets.cloudflareHeaders;
|
|
119
|
+
for (const { file, header } of await findFramingBlockers(projectDir)) {
|
|
120
|
+
const snippet = file === 'vercel.json' ? JSON.stringify(snippets.vercelHeaders, null, 2) : headersRule;
|
|
121
|
+
// A second header cannot loosen a site-wide frame-ancestors, so connect never writes around that one.
|
|
122
|
+
const fix = header === 'frame-ancestors' ? 'exclude /_conloca/editor/ from it, then add' : 'run conloca connect, or add';
|
|
123
|
+
outcome.problems.push({
|
|
124
|
+
check: 'CC10',
|
|
125
|
+
level: 'error',
|
|
126
|
+
message: `${file} sets ${header} for the whole site, so the workspace editor cannot frame /_conloca/editor/ — ${fix}:\n${snippet}`,
|
|
127
|
+
path: join(projectDir, file),
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
return outcome;
|
|
131
|
+
}
|
|
132
|
+
/** CC14 — each line of a tracked workflow or the astro config that still names the build key or one of its options. */
|
|
133
|
+
export function checkKeyLeftovers(scan, projectDir, deps) {
|
|
134
|
+
const outcome = outcomeOf('CC14');
|
|
135
|
+
// `:(top)` finds the repository's workflows from a project in a subfolder; git answers paths relative to projectDir.
|
|
136
|
+
const tracked = deps.git(['ls-files', '--', ':(top).github/workflows'], projectDir)?.split('\n') ?? [];
|
|
137
|
+
const paths = [
|
|
138
|
+
...tracked.filter((path) => /\.ya?ml$/.test(path)).map((path) => join(projectDir, path)),
|
|
139
|
+
...(scan.kind === 'read' ? [scan.config.path] : []),
|
|
140
|
+
];
|
|
141
|
+
for (const path of paths) {
|
|
142
|
+
let text;
|
|
143
|
+
try {
|
|
144
|
+
text = deps.readFile(path);
|
|
145
|
+
}
|
|
146
|
+
catch {
|
|
147
|
+
continue;
|
|
148
|
+
}
|
|
149
|
+
for (const [index, line] of text.split('\n').entries()) {
|
|
150
|
+
const names = [...new Set(line.match(LEFTOVER_RE))];
|
|
151
|
+
if (names.length === 0)
|
|
152
|
+
continue;
|
|
153
|
+
outcome.problems.push({
|
|
154
|
+
check: 'CC14',
|
|
155
|
+
level: 'warn',
|
|
156
|
+
message: `${relative(projectDir, path)}:${index + 1} still names ${names.join(', ')}, left from the build key the editor page no longer needs — remove it`,
|
|
157
|
+
path,
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
return outcome;
|
|
162
|
+
}
|
|
163
|
+
//# sourceMappingURL=checks-address.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checks-address.js","sourceRoot":"","sources":["../../../src/doctor/checks-address.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,eAAe,EAAoB,MAAM,sBAAsB,CAAC;AAC1F,OAAO,EAAE,QAAQ,EAAE,MAAM,2CAA2C,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAChG,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACjF,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,OAAO,EAAsC,SAAS,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAEpF,iIAAiI;AACjI,MAAM,UAAU,GAAG,gGAAgG,CAAC;AAEpH;;;;GAIG;AACH,SAAS,WAAW,CAAC,IAAY;IAC/B,mGAAmG;IACnG,MAAM,MAAM,GAAG,GAAG,CAAC,QAAQ,CAAC,WAAW,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,WAAW,IAAI,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC;IAC9F,IAAI,MAAM,KAAK,IAAI,IAAI,iBA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
|
|
9
|
-
/**
|
|
10
|
-
|
|
7
|
+
/** CC9's verdict: `https://<host><base>`, undefined when CC9 failed. */
|
|
8
|
+
address: string | undefined;
|
|
9
|
+
/** What the build writes as `repo`, undefined when it cannot tell. */
|
|
10
|
+
repoUri: string | undefined;
|
|
11
11
|
}
|
|
12
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* CC11–CC13. Networks only under --live, sends no credential, and contacts only the site's own domain and the editor UI's
|
|
14
|
+
* public protocols.json — so it runs anywhere, forks and Dependabot included.
|
|
15
|
+
*/
|
|
13
16
|
export declare function runLiveChecks(input: LiveInput): Promise<CheckOutcome[]>;
|
|
14
17
|
export {};
|
|
15
18
|
//# sourceMappingURL=checks-live.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checks-live.d.ts","sourceRoot":"","sources":["../../../src/doctor/checks-live.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"checks-live.d.ts","sourceRoot":"","sources":["../../../src/doctor/checks-live.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,KAAK,UAAU,EAAiB,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,UAAU,EAGhB,MAAM,YAAY,CAAC;AAWpB,UAAU,SAAS;IACjB,OAAO,EAAE,kBAAkB,CAAC;IAC5B,IAAI,EAAE,UAAU,CAAC;IACjB,IAAI,EAAE,UAAU,CAAC;IACjB,wEAAwE;IACxE,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,sEAAsE;IACtE,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;CAC7B;AAgQD;;;GAGG;AACH,wBAAsB,aAAa,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,CAW7E"}
|