@conloca/cloud-astro 0.0.0-bootstrap.0 → 0.2.1
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 +327 -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 +173 -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 +532 -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 +52 -0
- package/dist/src/preview/_dispatch.d.ts.map +1 -0
- package/dist/src/preview/_dispatch.js +70 -0
- package/dist/src/preview/_dispatch.js.map +1 -0
- package/dist/src/preview/_resolve-opts.d.ts +28 -0
- package/dist/src/preview/_resolve-opts.d.ts.map +1 -0
- package/dist/src/preview/_resolve-opts.js +70 -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 +112 -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 +159 -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 +125 -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 +170 -5
- package/src/build-commit.ts +22 -0
- package/src/bundle.ts +563 -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 +595 -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 +101 -0
- package/src/preview/_resolve-opts.ts +84 -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 +303 -0
- package/src/preview/preview-path.ts +28 -0
- package/src/preview/satteri-workerd.ts +24 -0
- package/src/preview/site-middleware.ts +209 -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 +127 -0
- package/src/virtual-modules.d.ts +51 -0
|
@@ -0,0 +1,532 @@
|
|
|
1
|
+
import { existsSync } from 'node:fs';
|
|
2
|
+
import { createRequire } from 'node:module';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
import { readEditorDescriptors } from '@conloca/astro-cms/node';
|
|
5
|
+
import { registrationCommits } from './build-commit.js';
|
|
6
|
+
import { bundleEditorAssets, emitRouteCssArtifact, mirrorEditorAssets } from './bundle.js';
|
|
7
|
+
import { emitComponentManifest } from './component-manifest.js';
|
|
8
|
+
import { BUILD_TOKEN_ENV_VAR, PACKAGE_NAME, PREVIEW_BUILD_ENV_FLAG, PREVIEW_SECRET_ENV_FLAG } from './constants.js';
|
|
9
|
+
import { resolveEditorDescriptors } from './descriptors.js';
|
|
10
|
+
import { discoverStyleContext } from './discovery.js';
|
|
11
|
+
import { gitOutput, resolveBuildRef, resolveRepositoryUri } from './git.js';
|
|
12
|
+
import { packageVersion } from './package-version.js';
|
|
13
|
+
import { spawnPreviewBuild } from './preview-build.js';
|
|
14
|
+
import { postRegistration } from './register.js';
|
|
15
|
+
import { resolveBuildSiteId } from './site-id.js';
|
|
16
|
+
import { scaffoldSkill } from './skill.js';
|
|
17
|
+
// Re-export the constants that moved out of this module when the preview
|
|
18
|
+
// wiring broke the circular import. Public callers (and tests) import them
|
|
19
|
+
// from `./index.js`, which threads through here.
|
|
20
|
+
export { PACKAGE_NAME, PREVIEW_BUILD_ENV_FLAG };
|
|
21
|
+
/**
|
|
22
|
+
* Returns the site's Astro integration that hooks into `astro:build:done`
|
|
23
|
+
* to bundle editor assets, register the build at `endpoint`, and
|
|
24
|
+
* (optionally) trigger a recursive preview build.
|
|
25
|
+
*
|
|
26
|
+
* The build:done pipeline:
|
|
27
|
+
*
|
|
28
|
+
* 1. esbuild the site's puck config into one browser ESM bundle under
|
|
29
|
+
* `dist/_conloca/` with react/react-dom/jsx-runtime/puck externalized
|
|
30
|
+
* (the editor supplies them at runtime), plus a `_headers` CORS
|
|
31
|
+
* rule so the editor's origin can load it cross-origin. For a conlocaCMS
|
|
32
|
+
* build it also writes the component manifest there (what each
|
|
33
|
+
* component accepts, read from source) and registers its URL + hash
|
|
34
|
+
* with the bundle.
|
|
35
|
+
* 2. POST the registration (repo, git sha, branch, bundle URL + hash) to the
|
|
36
|
+
* endpoint, authenticated by the build token. An ATTEMPTED
|
|
37
|
+
* registration that is rejected FAILS THE BUILD — the error carries the
|
|
38
|
+
* endpoint's exact status and body. Only a never-attempted registration (no
|
|
39
|
+
* build token, repo identity, git sha/branch, or public base URL) skips,
|
|
40
|
+
* ending the build with one summary block — or failing it when
|
|
41
|
+
* `requireRegistration` is set.
|
|
42
|
+
* 3. Spawn the recursive preview build with the preview secret
|
|
43
|
+
* returned by registration (or the env override).
|
|
44
|
+
*/
|
|
45
|
+
const VIRTUAL_PREVIEW_OPTS = 'virtual:conloca-preview-opts';
|
|
46
|
+
const RESOLVED_PREVIEW_OPTS = `\0${VIRTUAL_PREVIEW_OPTS}`;
|
|
47
|
+
export function conlocaCloud(options) {
|
|
48
|
+
validateOptions(options);
|
|
49
|
+
const repoUri = resolveRepositoryUri(options.repoUri, process.env);
|
|
50
|
+
// Populated during the preview build's config:setup and read by the virtual
|
|
51
|
+
// module below. Server-only — never reaches a browser bundle.
|
|
52
|
+
let previewOptsModule;
|
|
53
|
+
// The project root, captured in config:setup: astro:build:done only hands
|
|
54
|
+
// over the build's own outDir, but the siteStyles resolve against the root,
|
|
55
|
+
// and locating the CHILD build's client dir (for the editor-asset mirror)
|
|
56
|
+
// needs the root the child resolves against.
|
|
57
|
+
let projectRoot;
|
|
58
|
+
// Adapter name, finalized only at config:done. Discovery boots the built
|
|
59
|
+
// server entry for `output: 'server'` sites, and only the node adapter's
|
|
60
|
+
// entry is a plain bootable process (see discovery.ts).
|
|
61
|
+
let adapterName;
|
|
62
|
+
// The site's Vite config, finalized at config:done: the siteStyles compile
|
|
63
|
+
// through it, as they do in conlocaCMS's dev editor.
|
|
64
|
+
let viteConfig;
|
|
65
|
+
return {
|
|
66
|
+
name: PACKAGE_NAME,
|
|
67
|
+
hooks: {
|
|
68
|
+
'astro:config:setup': ({ logger, injectRoute, updateConfig, config, addMiddleware }) => {
|
|
69
|
+
// Optional-chained: unit tests drive this hook with a bare { logger }.
|
|
70
|
+
projectRoot = config?.root;
|
|
71
|
+
// The agent skill: write-if-not-exists, fail-soft, and
|
|
72
|
+
// never from the recursive preview child (it would race the parent).
|
|
73
|
+
if (process.env[PREVIEW_BUILD_ENV_FLAG] !== '1' && config?.root) {
|
|
74
|
+
scaffoldSkill(fileURLToPath(config.root), logger);
|
|
75
|
+
}
|
|
76
|
+
logger.info(`integration registered (endpoint=${options.endpoint}, previewMode=${options.previewDomain ? 'preview-domain' : 'same-domain-runtime'})`);
|
|
77
|
+
// Only the recursive preview build (which sets PREVIEW_BUILD_ENV_FLAG)
|
|
78
|
+
// mounts the secret-scoped SSR catch-all that renders previews. A
|
|
79
|
+
// site's normal build must never expose it; the per-branch secret in
|
|
80
|
+
// the path is the load guard (JWT validation in the handler is the real
|
|
81
|
+
// auth boundary). Without a secret there is nothing to scope, so skip.
|
|
82
|
+
if (process.env[PREVIEW_BUILD_ENV_FLAG] === '1') {
|
|
83
|
+
const secret = process.env[PREVIEW_SECRET_ENV_FLAG];
|
|
84
|
+
if (secret) {
|
|
85
|
+
if (!repoUri) {
|
|
86
|
+
throw new Error(`${PACKAGE_NAME}: could not determine repository identity for the preview build ` +
|
|
87
|
+
'(build in a Git checkout or set repoUri as an advanced override)');
|
|
88
|
+
}
|
|
89
|
+
injectRoute({
|
|
90
|
+
pattern: `/conloca_preview_${secret}/[...path]`,
|
|
91
|
+
entrypoint: '@conloca/cloud-astro/preview-handler',
|
|
92
|
+
prerender: false,
|
|
93
|
+
});
|
|
94
|
+
// The prefixed route above is the ENTRY DOOR — the only URL the
|
|
95
|
+
// endpoint can link to before a cookie exists. This interceptor is the
|
|
96
|
+
// serving surface: once the init hop sets the `Path=/` cookie, the
|
|
97
|
+
// browser sends the credential on every same-origin request, so
|
|
98
|
+
// internal links keep rendering drafts instead of silently falling
|
|
99
|
+
// back to published content after one page view. Fail-open — an
|
|
100
|
+
// uncredentialed visitor gets the ordinary page.
|
|
101
|
+
addMiddleware({ entrypoint: '@conloca/cloud-astro/site-middleware', order: 'pre' });
|
|
102
|
+
// Bake the middleware's configuration into the artifact. Every
|
|
103
|
+
// value is already known here — the secret arrived with
|
|
104
|
+
// registration, endpoint/audience are integration options — so a
|
|
105
|
+
// correctly built preview deployment needs NO env vars set on it.
|
|
106
|
+
// That also closes a chicken-and-egg loop: the secret is generated
|
|
107
|
+
// DURING this build, but the deployment that would carry it as an
|
|
108
|
+
// env var only happens afterwards. `saasIssuer` stays unbaked
|
|
109
|
+
// unless configured: it is a property of the endpoint, not of the site.
|
|
110
|
+
previewOptsModule = {
|
|
111
|
+
secret,
|
|
112
|
+
saasEndpoint: options.endpoint,
|
|
113
|
+
// The token's `aud` is the repo URI as registered — the same
|
|
114
|
+
// string this integration posts at registration time.
|
|
115
|
+
saasAudience: repoUri,
|
|
116
|
+
...(options.saasIssuer ? { saasIssuer: options.saasIssuer } : {}),
|
|
117
|
+
};
|
|
118
|
+
// Preview-build path: the child build must emit an SSR
|
|
119
|
+
// artifact even when the primary build is fully static. Switch to
|
|
120
|
+
// server output, apply the preview adapter (the project's own
|
|
121
|
+
// adapter stays in force when it already has one), and write to a
|
|
122
|
+
// SEPARATE outDir so the child never clobbers the primary dist/.
|
|
123
|
+
const previewBuild = options.previewBuild === false ? {} : (options.previewBuild ?? {});
|
|
124
|
+
const adapter = previewBuild.adapter ?? config.adapter;
|
|
125
|
+
if (!adapter) {
|
|
126
|
+
throw new Error(`${PACKAGE_NAME}: the preview build needs an SSR adapter — the project is static and ` +
|
|
127
|
+
'previewBuild.adapter is not set. Pass one (e.g. previewBuild: { adapter: cloudflare() }) ' +
|
|
128
|
+
'or set previewBuild: false to opt out of draft preview.');
|
|
129
|
+
}
|
|
130
|
+
// Astro allows exactly one deployment integration. Adding
|
|
131
|
+
// previewBuild.adapter next to the project's own would make the
|
|
132
|
+
// child build die on Astro's adapter-conflict error, which names
|
|
133
|
+
// neither this integration nor the option — fail here with the
|
|
134
|
+
// actual cause. The child inherits the project adapter, so the
|
|
135
|
+
// option is unnecessary on SSR projects.
|
|
136
|
+
if (previewBuild.adapter && config.adapter) {
|
|
137
|
+
const projectAdapterName = config.adapter.name ?? 'the project adapter';
|
|
138
|
+
throw new Error(`${PACKAGE_NAME}: previewBuild.adapter conflicts with the project's own adapter ` +
|
|
139
|
+
`(${projectAdapterName}) — Astro allows only one deployment integration per build. ` +
|
|
140
|
+
'Remove previewBuild.adapter; the preview build inherits the project adapter.');
|
|
141
|
+
}
|
|
142
|
+
// Trailing slash so URL-joining treats it as a directory. Astro
|
|
143
|
+
// derives build.client/build.server from outDir BEFORE hooks run,
|
|
144
|
+
// so overriding outDir alone still writes into the primary dist/ —
|
|
145
|
+
// all three must move together.
|
|
146
|
+
// OUTSIDE dist/ on purpose, against the original design: the
|
|
147
|
+
// artifact bakes the preview secret, so a wholesale static upload
|
|
148
|
+
// of dist/ must never be able to publish it — and Astro clears
|
|
149
|
+
// dist/ at the start of a build, which would wipe a sibling
|
|
150
|
+
// artifact parked inside it.
|
|
151
|
+
const previewOut = new URL(`${previewBuild.outDir ?? '.conloca/preview-server'}/`, config.root);
|
|
152
|
+
// The site's extra config goes through its OWN updateConfig
|
|
153
|
+
// call: Astro deep-merges successive calls (concatenating
|
|
154
|
+
// vite.plugins and integrations), whereas spreading it into the
|
|
155
|
+
// object below would shallow-replace whole keys — a user `vite`
|
|
156
|
+
// entry silently dropped the required virtual-module plugin.
|
|
157
|
+
// Ours comes second so the required scalars (output, outDir,
|
|
158
|
+
// build dirs) always win; previewBuild.outDir is the supported
|
|
159
|
+
// override for the artifact location.
|
|
160
|
+
if (previewBuild.config) {
|
|
161
|
+
updateConfig(previewBuild.config);
|
|
162
|
+
}
|
|
163
|
+
updateConfig({
|
|
164
|
+
output: 'server',
|
|
165
|
+
outDir: previewOut,
|
|
166
|
+
build: { client: new URL('client/', previewOut), server: new URL('server/', previewOut) },
|
|
167
|
+
vite: {
|
|
168
|
+
// The middleware dynamically imports Cloudflare's runtime
|
|
169
|
+
// module (binding transport). The Cloudflare adapter resolves
|
|
170
|
+
// the scheme itself; every other adapter's Rollup pass fails
|
|
171
|
+
// the child build on it unless externalized. Off Cloudflare
|
|
172
|
+
// Workers the runtime import rejects and the middleware falls
|
|
173
|
+
// back to the global fetch.
|
|
174
|
+
build: { rollupOptions: { external: [/^cloudflare:/] } },
|
|
175
|
+
// Starlight renders Steps, Tabs and FileTree with satteri's
|
|
176
|
+
// htmlToHast. On Cloudflare Workers satteri resolves to a
|
|
177
|
+
// binding that can be neither installed nor run on workerd, so the child
|
|
178
|
+
// build fails to resolve it — swap in a stand-in there. The
|
|
179
|
+
// target is an absolute path: a bare name would be looked up
|
|
180
|
+
// from the Starlight file, which cannot see this package in an
|
|
181
|
+
// isolated (non-hoisted) node_modules layout.
|
|
182
|
+
...(adapter.name === '@astrojs/cloudflare'
|
|
183
|
+
? {
|
|
184
|
+
resolve: {
|
|
185
|
+
alias: [
|
|
186
|
+
{
|
|
187
|
+
find: /^satteri$/,
|
|
188
|
+
replacement: resolveSatteriStandIn(),
|
|
189
|
+
},
|
|
190
|
+
],
|
|
191
|
+
},
|
|
192
|
+
}
|
|
193
|
+
: {}),
|
|
194
|
+
plugins: [
|
|
195
|
+
{
|
|
196
|
+
name: 'conloca-preview-opts',
|
|
197
|
+
resolveId(id) {
|
|
198
|
+
return id === VIRTUAL_PREVIEW_OPTS ? RESOLVED_PREVIEW_OPTS : undefined;
|
|
199
|
+
},
|
|
200
|
+
load(id) {
|
|
201
|
+
if (id !== RESOLVED_PREVIEW_OPTS)
|
|
202
|
+
return undefined;
|
|
203
|
+
// Read lazily so the values assigned above are captured.
|
|
204
|
+
return `export default ${JSON.stringify(previewOptsModule ?? {})};`;
|
|
205
|
+
},
|
|
206
|
+
},
|
|
207
|
+
],
|
|
208
|
+
},
|
|
209
|
+
// The adapter must ride in BOTH ways: as `adapter` because the
|
|
210
|
+
// build gate checks `config.adapter` before creating the SSR
|
|
211
|
+
// bundle, and as an integration because only the adapter's own
|
|
212
|
+
// astro:config:done hook calls setAdapter — which is what the
|
|
213
|
+
// build pipeline actually renders through. (Astro unshifts
|
|
214
|
+
// config.adapter into the integration list BEFORE any hook runs,
|
|
215
|
+
// so setting `adapter` alone here is too late for the hooks.)
|
|
216
|
+
// A project that is already SSR keeps its own adapter untouched.
|
|
217
|
+
...(previewBuild.adapter ? { adapter: previewBuild.adapter, integrations: [previewBuild.adapter] } : {}),
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
},
|
|
222
|
+
/**
|
|
223
|
+
* Force the CMS content routes — and only those — on demand for the
|
|
224
|
+
* preview build.
|
|
225
|
+
*
|
|
226
|
+
* Astro never runs middleware for a prerendered route — the adapter
|
|
227
|
+
* serves the built file directly — so the preview interceptor could
|
|
228
|
+
* never fire while content routes stayed prerendered. Draft preview
|
|
229
|
+
* requires exactly this scope: the preview build uses `output: 'server'`
|
|
230
|
+
* AND non-prerendered Conloca content routes. Everything else stays
|
|
231
|
+
* prerendered: a preview of a non-CMS page is by definition its
|
|
232
|
+
* published bytes, and keeping those routes static preserves the
|
|
233
|
+
* path-space partitioning between root catch-alls (see the inline note).
|
|
234
|
+
*
|
|
235
|
+
* This hook, not `astro:routes:resolved`: that one hands integrations a
|
|
236
|
+
* COPY of each route (`toIntegrationResolvedRoute` builds a new object)
|
|
237
|
+
* and discards any mutation. `astro:route:setup` receives the live
|
|
238
|
+
* record, runs AFTER the `export const prerender` source parse, and
|
|
239
|
+
* Astro reads `prerender` back after every integration has run.
|
|
240
|
+
*
|
|
241
|
+
* Gated on the secret as well as the flag, mirroring the config hook: no
|
|
242
|
+
* secret means no interceptor was mounted, so stripping the site's
|
|
243
|
+
* static output would buy nothing.
|
|
244
|
+
*/
|
|
245
|
+
'astro:route:setup': ({ route, logger }) => {
|
|
246
|
+
if (process.env[PREVIEW_BUILD_ENV_FLAG] !== '1')
|
|
247
|
+
return;
|
|
248
|
+
if (!process.env[PREVIEW_SECRET_ENV_FLAG])
|
|
249
|
+
return;
|
|
250
|
+
// `type` exists at runtime but is absent from the public RouteOptions
|
|
251
|
+
// type. Endpoints keep their prerendered data files: they emit no HTML
|
|
252
|
+
// to intercept, and one built from getStaticPaths would break on demand.
|
|
253
|
+
const routeType = route.type;
|
|
254
|
+
if (routeType !== undefined && routeType !== 'page')
|
|
255
|
+
return;
|
|
256
|
+
if (route.prerender === false)
|
|
257
|
+
return;
|
|
258
|
+
// ONLY the CMS page routes go on demand. Forcing every route stripped
|
|
259
|
+
// the getStaticPaths path-space partitioning: two root catch-alls (the
|
|
260
|
+
// CMS pages route and e.g. Starlight's docs route) both match any path
|
|
261
|
+
// once on demand, and Astro's tie-break hands the win to whichever
|
|
262
|
+
// injected first — CMS pathnames rendered the docs 404. Non-CMS routes
|
|
263
|
+
// keep their static output (served by the adapter before the app), and
|
|
264
|
+
// App.match falls through a prerendered dynamic match to the first
|
|
265
|
+
// on-demand route — exactly the CMS handler for CMS pathnames.
|
|
266
|
+
if (!route.component.endsWith('/internal/page-handler.astro'))
|
|
267
|
+
return;
|
|
268
|
+
route.prerender = false;
|
|
269
|
+
logger.debug(`preview build: forcing on-demand rendering for ${route.component}`);
|
|
270
|
+
},
|
|
271
|
+
'astro:config:done': ({ config }) => {
|
|
272
|
+
adapterName = config.adapter?.name;
|
|
273
|
+
viteConfig = config.vite;
|
|
274
|
+
},
|
|
275
|
+
'astro:build:done': async ({ dir, logger }) => {
|
|
276
|
+
if (process.env[PREVIEW_BUILD_ENV_FLAG] === '1') {
|
|
277
|
+
// The recursive preview build sets this flag on the child
|
|
278
|
+
// Astro process. Re-entering registration there would create an
|
|
279
|
+
// infinite build loop, so we short-circuit.
|
|
280
|
+
logger.info('skipping registration: recursive preview build detected');
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
// Astro always runs the config hooks first. No fallback: compiling
|
|
284
|
+
// against the working directory would build the canvas stylesheet for
|
|
285
|
+
// the wrong project without a word.
|
|
286
|
+
if (projectRoot === undefined || viteConfig === undefined) {
|
|
287
|
+
throw new Error(`${PACKAGE_NAME}: astro:build:done ran before the config hooks recorded the project root and Vite config`);
|
|
288
|
+
}
|
|
289
|
+
// Editor descriptors (the bundle's third leg): the host's schemas
|
|
290
|
+
// module and the auto-discovered MDX registry, both resolved by
|
|
291
|
+
// conlocaCMS and read off its channel. The scan runs here because the
|
|
292
|
+
// editor at the endpoint has no dev server to serve `/api/registry` from.
|
|
293
|
+
const descriptors = await resolveEditorDescriptors(logger);
|
|
294
|
+
const bundle = await bundleEditorAssets({
|
|
295
|
+
dir: fileURLToPath(dir),
|
|
296
|
+
root: fileURLToPath(projectRoot),
|
|
297
|
+
vite: viteConfig,
|
|
298
|
+
puckConfigPath: options.puckConfigPath,
|
|
299
|
+
siteStyles: options.siteStyles,
|
|
300
|
+
publicBaseUrl: resolveDeploymentUrl(options),
|
|
301
|
+
...(descriptors === undefined ? {} : { descriptors }),
|
|
302
|
+
logger,
|
|
303
|
+
});
|
|
304
|
+
// The component vocabulary for agents, read from the config the bundle
|
|
305
|
+
// just compiled. Only a build conlocaCMS is part of carries one (its
|
|
306
|
+
// descriptor channel is how this add-on knows): without the CMS there
|
|
307
|
+
// are no pages for an agent to compose. Gated on the channel itself,
|
|
308
|
+
// not on `descriptors` — that is also undefined for a CMS build with
|
|
309
|
+
// no schemas module, MDX components or templates, which still has a
|
|
310
|
+
// Puck vocabulary. An unreadable channel already warned above.
|
|
311
|
+
const componentManifest = readEditorDescriptors(process.env) === undefined
|
|
312
|
+
? undefined
|
|
313
|
+
: await emitComponentManifest({
|
|
314
|
+
dir: fileURLToPath(dir),
|
|
315
|
+
puckConfigPath: options.puckConfigPath,
|
|
316
|
+
projectRoot: process.cwd(),
|
|
317
|
+
logger,
|
|
318
|
+
});
|
|
319
|
+
// Build-time style discovery: read the discovery
|
|
320
|
+
// route's rendered page, collect its CSS, run the shared wrapper
|
|
321
|
+
// heuristic; results ride registration below. Opt-in via the option —
|
|
322
|
+
// and fail-soft throughout: a build must never die over preview
|
|
323
|
+
// styling.
|
|
324
|
+
let discovery;
|
|
325
|
+
let routeCssArtifact;
|
|
326
|
+
if (options.fragmentPreviewRoute) {
|
|
327
|
+
const clientDir = fileURLToPath(dir);
|
|
328
|
+
const nodeEntry = fileURLToPath(new URL('../server/entry.mjs', dir));
|
|
329
|
+
discovery = await discoverStyleContext({
|
|
330
|
+
clientDir,
|
|
331
|
+
serverEntry: adapterName === '@astrojs/node' && existsSync(nodeEntry) ? nodeEntry : undefined,
|
|
332
|
+
route: options.fragmentPreviewRoute,
|
|
333
|
+
logger,
|
|
334
|
+
});
|
|
335
|
+
if (discovery?.routeCss) {
|
|
336
|
+
routeCssArtifact = await emitRouteCssArtifact(clientDir, discovery.routeCss, resolveDeploymentUrl(options), logger);
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
const registration = await registerBuild(options, repoUri, bundle, logger, {
|
|
340
|
+
hostWrappers: discovery?.hostWrappers,
|
|
341
|
+
routeCssArtifact: routeCssArtifact?.stylesheet,
|
|
342
|
+
componentManifest,
|
|
343
|
+
});
|
|
344
|
+
let registeredSecret;
|
|
345
|
+
if ('missing' in registration)
|
|
346
|
+
reportSkippedRegistration(registration.missing, options, logger);
|
|
347
|
+
else
|
|
348
|
+
registeredSecret = registration.previewSecret;
|
|
349
|
+
if (options.previewBuild === false) {
|
|
350
|
+
// The site explicitly opted out of the recursive preview build.
|
|
351
|
+
return;
|
|
352
|
+
}
|
|
353
|
+
// Prefer the secret returned by registration; the env override lets
|
|
354
|
+
// CI smoke-test the recursive build path without a reachable endpoint.
|
|
355
|
+
const previewSecret = registeredSecret ?? process.env[PREVIEW_SECRET_ENV_FLAG];
|
|
356
|
+
if (!previewSecret) {
|
|
357
|
+
return;
|
|
358
|
+
}
|
|
359
|
+
await spawnPreviewBuild(previewSecret, options.previewBuild ?? {});
|
|
360
|
+
// The child build cannot compile the editor bundle itself (it
|
|
361
|
+
// short-circuits this hook — see the recursion guard above), but in
|
|
362
|
+
// a deployment that serves the site and the preview from one
|
|
363
|
+
// Cloudflare Worker its client dir is THE asset set serving the site,
|
|
364
|
+
// so the editor at the endpoint loads `/_conloca/*` from it. Mirror
|
|
365
|
+
// the bundle + its CORS rule from this build's dist into it.
|
|
366
|
+
// previewBuild === false already returned above, so only the options
|
|
367
|
+
// object (or undefined) reaches this point.
|
|
368
|
+
const previewOut = new URL(`${options.previewBuild?.outDir ?? '.conloca/preview-server'}/`, projectRoot);
|
|
369
|
+
await mirrorEditorAssets(fileURLToPath(dir), fileURLToPath(new URL('client/', previewOut)), [
|
|
370
|
+
...bundle.assetCorsPaths,
|
|
371
|
+
...(routeCssArtifact?.assetCorsPaths ?? []),
|
|
372
|
+
]);
|
|
373
|
+
logger.info('editor assets mirrored into the preview client dir');
|
|
374
|
+
},
|
|
375
|
+
},
|
|
376
|
+
};
|
|
377
|
+
}
|
|
378
|
+
/** Absolute path of the satteri stand-in the Cloudflare preview build aliases `satteri` to. */
|
|
379
|
+
function resolveSatteriStandIn() {
|
|
380
|
+
try {
|
|
381
|
+
return createRequire(import.meta.url).resolve('@conloca/cloud-astro/satteri-workerd');
|
|
382
|
+
}
|
|
383
|
+
catch (cause) {
|
|
384
|
+
throw new Error(`${PACKAGE_NAME}: could not resolve the satteri stand-in (@conloca/cloud-astro/satteri-workerd) that the ` +
|
|
385
|
+
'Cloudflare preview build uses in place of satteri — is the package installed and built?', { cause });
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* The origin the deployed site answers on. Used for two things that must agree:
|
|
390
|
+
* absolutizing the bundle/stylesheet URLs a registration carries, and re-pointing the
|
|
391
|
+
* stylesheet's own asset URLs at the site (they would otherwise resolve
|
|
392
|
+
* against the editor's origin — see `rewriteStylesheetAssetUrls`).
|
|
393
|
+
*/
|
|
394
|
+
function resolveDeploymentUrl(options) {
|
|
395
|
+
if (!options.previewDomain) {
|
|
396
|
+
return options.publicBaseUrl ?? process.env.CF_PAGES_URL;
|
|
397
|
+
}
|
|
398
|
+
const previewUrl = new URL(options.previewDomain.includes('://') ? options.previewDomain : `https://${options.previewDomain}`);
|
|
399
|
+
return previewUrl.origin;
|
|
400
|
+
}
|
|
401
|
+
/**
|
|
402
|
+
* ONE end-of-build block for a skipped registration — every prerequisite that
|
|
403
|
+
* was missing and what it costs — the last thing the integration prints.
|
|
404
|
+
* With `requireRegistration` it fails the build instead.
|
|
405
|
+
*/
|
|
406
|
+
function reportSkippedRegistration(missing, options, logger) {
|
|
407
|
+
const summary = [
|
|
408
|
+
`editor at ${options.endpoint} NOT updated by this build`,
|
|
409
|
+
...missing.map((prerequisite) => ` missing: ${prerequisite}`),
|
|
410
|
+
" consequence: registration was skipped, so the editor keeps serving the previous build of this branch (or the default branch's, or nothing, if neither was ever registered)",
|
|
411
|
+
' check: conloca doctor --live',
|
|
412
|
+
].join('\n');
|
|
413
|
+
if (options.requireRegistration) {
|
|
414
|
+
throw new Error(`${PACKAGE_NAME}: ${summary}\n requireRegistration is on, so this build fails.`);
|
|
415
|
+
}
|
|
416
|
+
logger.warn(summary);
|
|
417
|
+
}
|
|
418
|
+
/**
|
|
419
|
+
* Registers the freshly built editor bundle at the endpoint. Soft-skip ONLY
|
|
420
|
+
* when registration was never attempted: the pre-request guards (no build
|
|
421
|
+
* token, no repo identity, no sha/branch, no base URL) each warn, and every
|
|
422
|
+
* missing prerequisite is returned at once, so one build names all that setup
|
|
423
|
+
* still lacks and an unregistered deploy still completes — the hook turns
|
|
424
|
+
* that into one end-of-build summary (or a failure under
|
|
425
|
+
* `requireRegistration`). Once a registration IS attempted, its failure
|
|
426
|
+
* FAILS THE BUILD: postRegistration throws on any
|
|
427
|
+
* deterministic 4xx and after exhausting the ≥500 retry backoff, and that
|
|
428
|
+
* error — carrying the HTTP status and response body — propagates. A green
|
|
429
|
+
* deploy whose registration silently went missing is the "deployed but
|
|
430
|
+
* editor unregistered" class this project exists to kill.
|
|
431
|
+
*/
|
|
432
|
+
async function registerBuild(options, repoUri, bundle, logger, discovery = {}) {
|
|
433
|
+
const missing = [];
|
|
434
|
+
const buildToken = options.buildToken ?? process.env[BUILD_TOKEN_ENV_VAR];
|
|
435
|
+
if (!buildToken) {
|
|
436
|
+
logger.warn(`skipping registration: no build token (set buildToken or ${BUILD_TOKEN_ENV_VAR})`);
|
|
437
|
+
missing.push(`build token (set buildToken or ${BUILD_TOKEN_ENV_VAR})`);
|
|
438
|
+
}
|
|
439
|
+
if (!repoUri) {
|
|
440
|
+
logger.warn('skipping registration: could not determine repository identity ' +
|
|
441
|
+
'(build in a supported CI environment or Git checkout, or set repoUri)');
|
|
442
|
+
missing.push('repository identity (build in a supported CI environment or Git checkout, or set repoUri)');
|
|
443
|
+
}
|
|
444
|
+
const { branch } = resolveBuildRef();
|
|
445
|
+
// CI may hand over the branch's latest commit to register; the checkout is what was built.
|
|
446
|
+
const commits = registrationCommits({
|
|
447
|
+
eventCommitSha: process.env.CF_PAGES_COMMIT_SHA,
|
|
448
|
+
checkoutCommitSha: gitOutput(['rev-parse', 'HEAD']),
|
|
449
|
+
});
|
|
450
|
+
const gitSha = commits.gitSha;
|
|
451
|
+
if (!gitSha || !branch) {
|
|
452
|
+
logger.warn('skipping registration: could not resolve the git sha/branch ' +
|
|
453
|
+
'(set CF_PAGES_COMMIT_SHA and CF_PAGES_BRANCH, or build inside a git checkout)');
|
|
454
|
+
missing.push('git sha/branch (set CF_PAGES_COMMIT_SHA and CF_PAGES_BRANCH, or build inside a git checkout)');
|
|
455
|
+
}
|
|
456
|
+
const deploymentUrl = resolveDeploymentUrl(options);
|
|
457
|
+
const baseUrl = deploymentUrl;
|
|
458
|
+
if (!baseUrl) {
|
|
459
|
+
logger.warn('skipping registration: no public base URL for the editor bundle (set previewDomain, publicBaseUrl, or CF_PAGES_URL)');
|
|
460
|
+
missing.push('public base URL for the editor bundle (set previewDomain, publicBaseUrl, or CF_PAGES_URL)');
|
|
461
|
+
}
|
|
462
|
+
// Restates the guards above, so the values below are typed as set.
|
|
463
|
+
if (!buildToken || !repoUri || !gitSha || !branch || !baseUrl)
|
|
464
|
+
return { missing };
|
|
465
|
+
// Resolve the deployable-site id (STRICT): a throw here FAILS THE BUILD —
|
|
466
|
+
// after the soft skip guards above, so only a build that is actually
|
|
467
|
+
// registering can die on it. A silently mis-attached registration points
|
|
468
|
+
// the editor at the wrong site, which is the same miss as never having
|
|
469
|
+
// registered at all. The channel is CONLOCA_CONTENT_ROOT (published by
|
|
470
|
+
// conlocaCMS); options.siteId is the CMS-less-build override.
|
|
471
|
+
const siteId = resolveBuildSiteId({
|
|
472
|
+
contentRoot: process.env.CONLOCA_CONTENT_ROOT,
|
|
473
|
+
override: options.siteId,
|
|
474
|
+
});
|
|
475
|
+
// NO catch: from here on the registration is ATTEMPTED, and an attempted
|
|
476
|
+
// registration's failure fails the build. postRegistration already retried
|
|
477
|
+
// transient (≥500 / network) failures with backoff; what escapes is either
|
|
478
|
+
// a deterministic 4xx (unknown siteId, bad token — fix and rebuild) or an
|
|
479
|
+
// exhausted retry budget, and the error message carries the HTTP status +
|
|
480
|
+
// response body verbatim.
|
|
481
|
+
logger.info('registering at the endpoint (transient failures retry, with up to ~2.5 minutes of waiting between attempts)');
|
|
482
|
+
const { previewSecret } = await postRegistration({
|
|
483
|
+
endpoint: options.endpoint,
|
|
484
|
+
buildToken,
|
|
485
|
+
repoUri,
|
|
486
|
+
gitSha,
|
|
487
|
+
siteId,
|
|
488
|
+
branch,
|
|
489
|
+
editorBundleUrl: new URL(bundle.url, baseUrl).toString(),
|
|
490
|
+
bundleHash: bundle.hash,
|
|
491
|
+
...(bundle.stylesheet === undefined
|
|
492
|
+
? {}
|
|
493
|
+
: {
|
|
494
|
+
stylesheetUrl: new URL(bundle.stylesheet.url, baseUrl).toString(),
|
|
495
|
+
stylesheetHash: bundle.stylesheet.hash,
|
|
496
|
+
}),
|
|
497
|
+
...(discovery.hostWrappers === undefined ? {} : { hostWrappers: discovery.hostWrappers }),
|
|
498
|
+
...(discovery.routeCssArtifact === undefined
|
|
499
|
+
? {}
|
|
500
|
+
: {
|
|
501
|
+
routeCssUrl: new URL(discovery.routeCssArtifact.url, baseUrl).toString(),
|
|
502
|
+
routeCssHash: discovery.routeCssArtifact.hash,
|
|
503
|
+
}),
|
|
504
|
+
...(discovery.componentManifest === undefined
|
|
505
|
+
? {}
|
|
506
|
+
: {
|
|
507
|
+
componentManifestUrl: new URL(discovery.componentManifest.url, baseUrl).toString(),
|
|
508
|
+
componentManifestHash: discovery.componentManifest.hash,
|
|
509
|
+
}),
|
|
510
|
+
deploymentUrl,
|
|
511
|
+
buildId: commits.buildId,
|
|
512
|
+
clientVersion: packageVersion(),
|
|
513
|
+
});
|
|
514
|
+
logger.info(`registration complete (gitSha=${gitSha}, branch=${branch}, buildId=${commits.buildId})`);
|
|
515
|
+
return { previewSecret };
|
|
516
|
+
}
|
|
517
|
+
function validateOptions(options) {
|
|
518
|
+
if (!options.endpoint) {
|
|
519
|
+
throw new Error(`${PACKAGE_NAME}: endpoint is required`);
|
|
520
|
+
}
|
|
521
|
+
if (!options.puckConfigPath) {
|
|
522
|
+
throw new Error(`${PACKAGE_NAME}: puckConfigPath is required`);
|
|
523
|
+
}
|
|
524
|
+
try {
|
|
525
|
+
// Throws on malformed URLs; we don't keep the parsed value.
|
|
526
|
+
new URL(options.endpoint);
|
|
527
|
+
}
|
|
528
|
+
catch {
|
|
529
|
+
throw new Error(`${PACKAGE_NAME}: endpoint must be a valid URL, got ${options.endpoint}`);
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
//# sourceMappingURL=integration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integration.js","sourceRoot":"","sources":["../../src/integration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAGhE,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAC3F,OAAO,EAAkC,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChG,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AACpH,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAE5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO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3,"file":"message-of.d.ts","sourceRoot":"","sources":["../../src/message-of.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAEhD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message-of.js","sourceRoot":"","sources":["../../src/message-of.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,MAAM,UAAU,SAAS,CAAC,KAAc;IACtC,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAChE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../src/node.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AACtF,YAAY,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/src/node.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.js","sourceRoot":"","sources":["../../src/node.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,4DAA4D;AAE5D,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The installed version of this package, read from its own package.json through the `./package.json` export
|
|
3
|
+
* (self-reference by name resolves in Node and Bun; the skill template is located the same way). Undefined when the
|
|
4
|
+
* lookup fails — a copy running outside its package boundary must not fail a site's build over a cosmetic field.
|
|
5
|
+
*/
|
|
6
|
+
export declare function packageVersion(): string | undefined;
|
|
7
|
+
//# sourceMappingURL=package-version.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-version.d.ts","sourceRoot":"","sources":["../../src/package-version.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,wBAAgB,cAAc,IAAI,MAAM,GAAG,SAAS,CAOnD"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';
|
|
2
|
+
import { PACKAGE_NAME } from './constants.js';
|
|
3
|
+
/**
|
|
4
|
+
* The installed version of this package, read from its own package.json through the `./package.json` export
|
|
5
|
+
* (self-reference by name resolves in Node and Bun; the skill template is located the same way). Undefined when the
|
|
6
|
+
* lookup fails — a copy running outside its package boundary must not fail a site's build over a cosmetic field.
|
|
7
|
+
*/
|
|
8
|
+
export function packageVersion() {
|
|
9
|
+
try {
|
|
10
|
+
const pkg = createRequire(import.meta.url)(`${PACKAGE_NAME}/package.json`);
|
|
11
|
+
return typeof pkg.version === 'string' ? pkg.version : undefined;
|
|
12
|
+
}
|
|
13
|
+
catch {
|
|
14
|
+
return undefined;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=package-version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-version.js","sourceRoot":"","sources":["../../src/package-version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C;;;;GAIG;AACH,MAAM,UAAU,cAAc;IAC5B,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,aAAa,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,YAAY,eAAe,CAA0B,CAAC;QACpG,OAAO,OAAO,GAAG,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;IACnE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC"}
|