esa-pcg-cli 0.1.18 → 0.1.20-beta.0

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.
Files changed (57) hide show
  1. package/README.md +86 -27
  2. package/dist/_inline-overrides.js +3 -3
  3. package/dist/_protocol/endpoints.d.ts +1 -0
  4. package/dist/_protocol/endpoints.js +2 -1
  5. package/dist/_protocol/keys.d.ts +14 -0
  6. package/dist/_protocol/keys.js +14 -2
  7. package/dist/_protocol/types.d.ts +84 -0
  8. package/dist/_protocol/types.js +1 -1
  9. package/dist/adapters/wrappers/node-server.d.ts +7 -1
  10. package/dist/adapters/wrappers/node-server.js +6 -3
  11. package/dist/artifacts/layout.d.ts +20 -0
  12. package/dist/artifacts/layout.js +168 -0
  13. package/dist/artifacts/next.d.ts +8 -0
  14. package/dist/artifacts/next.js +202 -0
  15. package/dist/artifacts/nuxt.d.ts +7 -0
  16. package/dist/artifacts/nuxt.js +72 -0
  17. package/dist/astro/build-metadata.d.ts +23 -0
  18. package/dist/astro/build-metadata.js +4 -0
  19. package/dist/astro/compatibility/matrix.d.ts +36 -0
  20. package/dist/astro/compatibility/matrix.js +131 -0
  21. package/dist/astro/overlay/config-overlay.d.ts +16 -0
  22. package/dist/astro/overlay/config-overlay.js +330 -0
  23. package/dist/astro/packaging/artifact-layout.d.ts +11 -0
  24. package/dist/astro/packaging/artifact-layout.js +190 -0
  25. package/dist/astro/packaging/integrity.d.ts +11 -0
  26. package/dist/astro/packaging/integrity.js +97 -0
  27. package/dist/astro/packaging/trace-server.d.ts +23 -0
  28. package/dist/astro/packaging/trace-server.js +182 -0
  29. package/dist/astro-runtime/cache-provider.mjs +665 -0
  30. package/dist/astro-runtime/gateway-client.mjs +81 -0
  31. package/dist/astro-runtime/image-endpoint.mjs +161 -0
  32. package/dist/astro-runtime/request-header-logger.mjs +68 -0
  33. package/dist/astro-runtime/session-driver-core.mjs +71 -0
  34. package/dist/astro-runtime/session-driver-v5.mjs +9 -0
  35. package/dist/astro-runtime/session-driver-v6plus.mjs +9 -0
  36. package/dist/bin/cli.d.ts +1 -0
  37. package/dist/bin/cli.js +3 -2
  38. package/dist/commands/build-astro.d.ts +13 -0
  39. package/dist/commands/build-astro.js +232 -0
  40. package/dist/commands/build-next.d.ts +15 -0
  41. package/dist/commands/build-next.js +233 -0
  42. package/dist/commands/build-nuxt.d.ts +21 -0
  43. package/dist/commands/build-nuxt.js +239 -0
  44. package/dist/commands/build.d.ts +4 -0
  45. package/dist/commands/build.js +79 -185
  46. package/dist/commands/deploy.js +4 -4
  47. package/dist/commands/purge.js +2 -2
  48. package/dist/commands/serve.d.ts +6 -1
  49. package/dist/commands/serve.js +104 -74
  50. package/dist/index.d.ts +1 -1
  51. package/dist/index.js +1 -1
  52. package/dist/nitro-preset/driver.mjs +304 -0
  53. package/dist/nitro-preset/index.mjs +49 -0
  54. package/dist/nitro-preset/package.json +30 -0
  55. package/dist/runtime/gateway-auth.d.ts +6 -3
  56. package/dist/runtime/gateway-auth.js +12 -12
  57. package/package.json +8 -5
@@ -0,0 +1,81 @@
1
+ // Shared signed HTTP client used by all Astro Gateway-backed runtimes.
2
+
3
+ import { createHash } from 'node:crypto';
4
+
5
+ const DEFAULT_TTL_MS = 5 * 60 * 1000;
6
+ const DEFAULT_TIMEOUT_MS = 5000;
7
+
8
+ export function loadGatewayConfig() {
9
+ const gatewayUrl = process.env.ESA_CACHE_GW_GATEWAY_ENDPOINT;
10
+ const secret = process.env.ESA_CACHE_GW_AUTH_KEY;
11
+ const aliuid = process.env.ESA_CACHE_GW_ALIUID;
12
+ const routinename = process.env.ESA_CACHE_GW_ROUTINENAME;
13
+ const version = process.env.ESA_CACHE_GW_VERSION;
14
+ if (!gatewayUrl || !secret || !aliuid || !routinename || !version) {
15
+ return null;
16
+ }
17
+ return {
18
+ gatewayUrl: gatewayUrl.replace(/\/+$/, ''),
19
+ secret,
20
+ aliuid,
21
+ routinename,
22
+ version,
23
+ appId: `${aliuid}/${routinename}`,
24
+ };
25
+ }
26
+
27
+ export function signGatewayHeaders(config, ttlMs = DEFAULT_TTL_MS) {
28
+ const expires = String(Date.now() + ttlMs);
29
+ const md5 = createHash('md5')
30
+ .update(
31
+ `${config.secret}${expires}${config.aliuid}${config.routinename}${config.version}`
32
+ )
33
+ .digest('hex');
34
+ return {
35
+ Authorization: `${expires}-${md5}`,
36
+ AliUid: config.aliuid,
37
+ RoutineName: config.routinename,
38
+ Version: config.version,
39
+ };
40
+ }
41
+
42
+ export async function gatewayFetch(
43
+ config,
44
+ pathOrUrl,
45
+ { timeoutMs = DEFAULT_TIMEOUT_MS, ...init } = {}
46
+ ) {
47
+ const url = pathOrUrl.startsWith('/')
48
+ ? `${config.gatewayUrl}${pathOrUrl}`
49
+ : pathOrUrl;
50
+ const headers = new Headers(init.headers);
51
+ for (const [name, value] of Object.entries(signGatewayHeaders(config))) {
52
+ headers.set(name, value);
53
+ }
54
+ const controller = new AbortController();
55
+ const timer = setTimeout(() => controller.abort(), timeoutMs);
56
+ const signal = init.signal
57
+ ? AbortSignal.any([init.signal, controller.signal])
58
+ : controller.signal;
59
+ try {
60
+ return await fetch(url, {
61
+ ...init,
62
+ headers,
63
+ signal,
64
+ });
65
+ } finally {
66
+ clearTimeout(timer);
67
+ }
68
+ }
69
+
70
+ export async function gatewayJson(config, path, init = {}) {
71
+ const response = await gatewayFetch(config, path, init);
72
+ if (!response.ok) {
73
+ const error = new Error(
74
+ `Gateway ${init.method || 'GET'} ${path} failed with ${response.status}`
75
+ );
76
+ error.status = response.status;
77
+ throw error;
78
+ }
79
+ if (response.status === 204) return undefined;
80
+ return response.json();
81
+ }
@@ -0,0 +1,161 @@
1
+ // Wraps Astro's image endpoint and delegates production transforms to Gateway.
2
+
3
+ import { gatewayFetch, loadGatewayConfig } from './gateway-client.mjs';
4
+
5
+ const TRANSFORM_PARAMS = ['w', 'h', 'q', 'f', 'fit', 'position', 'background'];
6
+ const PASSTHROUGH_HEADERS = [
7
+ 'content-type',
8
+ 'content-length',
9
+ 'cache-control',
10
+ 'etag',
11
+ 'last-modified',
12
+ 'vary',
13
+ 'content-disposition',
14
+ 'content-security-policy',
15
+ 'x-image-cache',
16
+ ];
17
+
18
+ function isRemoteSource(source) {
19
+ try {
20
+ const url = new URL(source);
21
+ return url.protocol === 'http:' || url.protocol === 'https:';
22
+ } catch {
23
+ return false;
24
+ }
25
+ }
26
+
27
+ function isLoopbackHost(hostname) {
28
+ const normalized = hostname.toLowerCase().replace(/^\[|\]$/g, '');
29
+ return (
30
+ normalized === 'localhost' ||
31
+ normalized.endsWith('.localhost') ||
32
+ normalized === '::1' ||
33
+ /^127(?:\.\d{1,3}){3}$/.test(normalized)
34
+ );
35
+ }
36
+
37
+ function validInternalSource(source) {
38
+ if (
39
+ !source.startsWith('/') ||
40
+ source.includes('\\') ||
41
+ source.includes('\0')
42
+ ) {
43
+ return false;
44
+ }
45
+ let decoded = source;
46
+ for (let pass = 0; pass < 2; pass++) {
47
+ try {
48
+ decoded = decodeURIComponent(decoded);
49
+ } catch {
50
+ return false;
51
+ }
52
+ if (
53
+ decoded.includes('\\') ||
54
+ decoded.includes('\0') ||
55
+ decoded.split('/').some(segment => segment === '..')
56
+ ) {
57
+ return false;
58
+ }
59
+ }
60
+ return true;
61
+ }
62
+
63
+ function gatewayResponse(response) {
64
+ const headers = new Headers();
65
+ for (const name of PASSTHROUGH_HEADERS) {
66
+ const value = response.headers.get(name);
67
+ if (value !== null) headers.set(name, value);
68
+ }
69
+ headers.set('X-PCG-Astro-Image', 'gateway');
70
+ return new Response(response.body, {
71
+ status: response.status,
72
+ statusText: response.statusText,
73
+ headers,
74
+ });
75
+ }
76
+
77
+ /**
78
+ * Wrap Astro's official Node image endpoint. Local builds/serve keep the
79
+ * official implementation; production requests use Gateway after applying
80
+ * Astro's own remote allow-list predicate.
81
+ */
82
+ export function createGatewayImageEndpoint({
83
+ fallbackGet,
84
+ imageConfig,
85
+ isRemoteAllowed,
86
+ }) {
87
+ return async function GET(context) {
88
+ if (
89
+ process.env.PCG_ASTRO_BUILD === '1' ||
90
+ process.env.PCG_ASTRO_LOCAL_IMAGE === '1'
91
+ ) {
92
+ return fallbackGet(context);
93
+ }
94
+
95
+ const requestUrl = new URL(context.request.url);
96
+ const source = requestUrl.searchParams.get('href');
97
+ if (!source) {
98
+ return new Response('Missing required image parameter: href', {
99
+ status: 400,
100
+ });
101
+ }
102
+ if (isRemoteSource(source)) {
103
+ if (!isRemoteAllowed(source, imageConfig)) {
104
+ return new Response('Forbidden', { status: 403 });
105
+ }
106
+ } else if (!validInternalSource(source)) {
107
+ return new Response('Invalid internal image path', { status: 400 });
108
+ }
109
+
110
+ // A local Gateway must never fetch a loopback URL: its SSRF guard rejects
111
+ // that request, and relaxing the guard would expose private-network data.
112
+ // The official endpoint can read packaged /_astro assets from dist/client,
113
+ // so only this local, internal-source case stays inside the Astro process.
114
+ // Remote images requested from the same local app still exercise Gateway.
115
+ if (!isRemoteSource(source) && isLoopbackHost(requestUrl.hostname)) {
116
+ return fallbackGet(context);
117
+ }
118
+
119
+ const gateway = loadGatewayConfig();
120
+ if (!gateway) {
121
+ return new Response('Image Gateway is unavailable', { status: 503 });
122
+ }
123
+ // Keep relative image paths relative so Gateway uses its tenant-scoped
124
+ // internal asset lookup instead of fetching the application's public or
125
+ // access-controlled debug origin.
126
+ const params = new URLSearchParams({ href: source });
127
+ for (const name of TRANSFORM_PARAMS) {
128
+ const value = requestUrl.searchParams.get(name);
129
+ if (value !== null && value !== '') params.set(name, value);
130
+ }
131
+ const headers = new Headers();
132
+ const accept = context.request.headers.get('accept');
133
+ if (accept) headers.set('Accept', accept);
134
+ const conditional = ['if-none-match', 'if-modified-since'];
135
+ for (const name of conditional) {
136
+ const value = context.request.headers.get(name);
137
+ if (value) headers.set(name, value);
138
+ }
139
+ try {
140
+ const response = await gatewayFetch(
141
+ gateway,
142
+ `/image/optimize?${params.toString()}`,
143
+ {
144
+ method: 'GET',
145
+ headers,
146
+ signal: context.request.signal,
147
+ timeoutMs: 15_000,
148
+ }
149
+ );
150
+ return gatewayResponse(response);
151
+ } catch (error) {
152
+ if (context.request.signal.aborted) {
153
+ return new Response('Client Closed Request', { status: 499 });
154
+ }
155
+ console.error(
156
+ `[pcg astro image] Gateway request failed: ${String(error)}`
157
+ );
158
+ return new Response('Image Gateway request failed', { status: 502 });
159
+ }
160
+ };
161
+ }
@@ -0,0 +1,68 @@
1
+ /** Temporary EFC invalidate request-header probe for Astro deployments. */
2
+
3
+ import { appendFileSync, mkdirSync } from 'node:fs';
4
+ import { Server } from 'node:http';
5
+ import { dirname } from 'node:path';
6
+
7
+ const PATCHED = Symbol.for('pcg.astro.efc-request-header-logger');
8
+ const LOG_PATH =
9
+ process.env.PCG_ASTRO_REQUEST_HEADER_LOG_PATH ||
10
+ '/tmp/pcg-astro-request-headers.ndjson';
11
+
12
+ let warned = false;
13
+
14
+ function copyHeaders(headers) {
15
+ return Object.fromEntries(
16
+ Object.entries(headers || {}).map(([name, value]) => [
17
+ name,
18
+ Array.isArray(value) ? [...value] : value,
19
+ ])
20
+ );
21
+ }
22
+
23
+ function isInvalidateRequest(request) {
24
+ const value = typeof request.url === 'string' ? request.url : '';
25
+ let pathname;
26
+ try {
27
+ pathname = new URL(value, 'http://localhost').pathname;
28
+ } catch {
29
+ pathname = value.split('?', 1)[0];
30
+ }
31
+ return pathname.replace(/\/+$/, '').endsWith('/invalidate');
32
+ }
33
+
34
+ function writeRequest(request) {
35
+ try {
36
+ mkdirSync(dirname(LOG_PATH), { recursive: true, mode: 0o700 });
37
+ appendFileSync(
38
+ LOG_PATH,
39
+ `${JSON.stringify({
40
+ timestamp: new Date().toISOString(),
41
+ method: request.method ?? null,
42
+ url: typeof request.url === 'string' ? request.url : '',
43
+ headers: copyHeaders(request.headers),
44
+ rawHeaders: Array.isArray(request.rawHeaders)
45
+ ? [...request.rawHeaders]
46
+ : [],
47
+ })}\n`,
48
+ { encoding: 'utf8', flag: 'a', mode: 0o600 }
49
+ );
50
+ } catch (error) {
51
+ if (warned) return;
52
+ warned = true;
53
+ console.error(
54
+ `[pcg astro headers] unable to write ${LOG_PATH}: ${String(error)}`
55
+ );
56
+ }
57
+ }
58
+
59
+ if (!Server.prototype[PATCHED]) {
60
+ const originalEmit = Server.prototype.emit;
61
+ Object.defineProperty(Server.prototype, PATCHED, { value: true });
62
+ Server.prototype.emit = function patchedEmit(event, ...args) {
63
+ if (event === 'request' && args[0] && isInvalidateRequest(args[0])) {
64
+ writeRequest(args[0]);
65
+ }
66
+ return Reflect.apply(originalEmit, this, [event, ...args]);
67
+ };
68
+ }
@@ -0,0 +1,71 @@
1
+ // Astro Session implementation that persists through the PCG Gateway.
2
+
3
+ import { gatewayFetch, loadGatewayConfig } from './gateway-client.mjs';
4
+
5
+ function normalizeTtl(config) {
6
+ const value = Number(config?.defaultTtlSeconds ?? 86400);
7
+ return Number.isFinite(value) && value > 0 ? Math.floor(value) : 86400;
8
+ }
9
+
10
+ function gatewayOrThrow() {
11
+ const gateway = loadGatewayConfig();
12
+ if (!gateway) {
13
+ throw new Error(
14
+ '[pcg astro session] Gateway environment is incomplete; Gateway-backed sessions are required.'
15
+ );
16
+ }
17
+ return gateway;
18
+ }
19
+
20
+ export function createGatewaySessionDriver(config = {}) {
21
+ const ttlSeconds = normalizeTtl(config);
22
+ return {
23
+ name: 'pcg-astro-session',
24
+ async getItem(key) {
25
+ const gateway = gatewayOrThrow();
26
+ const response = await gatewayFetch(
27
+ gateway,
28
+ `/astro/v1/sessions/${encodeURIComponent(key)}`,
29
+ { method: 'GET' }
30
+ );
31
+ if (response.status === 404) return null;
32
+ if (!response.ok) {
33
+ throw new Error(
34
+ `[pcg astro session] GET failed with status ${response.status}`
35
+ );
36
+ }
37
+ const body = await response.json();
38
+ return typeof body.value === 'string' ? body.value : null;
39
+ },
40
+ async setItem(key, value) {
41
+ const gateway = gatewayOrThrow();
42
+ const response = await gatewayFetch(
43
+ gateway,
44
+ `/astro/v1/sessions/${encodeURIComponent(key)}`,
45
+ {
46
+ method: 'PUT',
47
+ headers: { 'Content-Type': 'application/json' },
48
+ body: JSON.stringify({ value, ttlSeconds }),
49
+ }
50
+ );
51
+ if (!response.ok) {
52
+ throw new Error(
53
+ `[pcg astro session] PUT failed with status ${response.status}`
54
+ );
55
+ }
56
+ },
57
+ async removeItem(key) {
58
+ const gateway = gatewayOrThrow();
59
+ const response = await gatewayFetch(
60
+ gateway,
61
+ `/astro/v1/sessions/${encodeURIComponent(key)}`,
62
+ { method: 'DELETE' }
63
+ );
64
+ if (!response.ok && response.status !== 404) {
65
+ throw new Error(
66
+ `[pcg astro session] DELETE failed with status ${response.status}`
67
+ );
68
+ }
69
+ },
70
+ };
71
+ }
@@ -0,0 +1,9 @@
1
+ // Adapts the shared Gateway Session driver to Astro 5's driver factory contract.
2
+
3
+ import { createGatewaySessionDriver } from './session-driver-core.mjs';
4
+
5
+ // Astro 5 resolves a string entrypoint and passes `session.options` to this
6
+ // unstorage-compatible driver factory.
7
+ export default function pcgAstro5SessionDriver(options) {
8
+ return createGatewaySessionDriver(options);
9
+ }
@@ -0,0 +1,9 @@
1
+ // Adapts the shared Gateway Session driver to the Astro 6/7 driver contract.
2
+
3
+ import { createGatewaySessionDriver } from './session-driver-core.mjs';
4
+
5
+ // Astro 6/7 resolve the SessionDriverConfig entrypoint and call this factory
6
+ // with the serializable `driver.config` object.
7
+ export default function pcgAstroSessionDriver(config) {
8
+ return createGatewaySessionDriver(config);
9
+ }
package/dist/bin/cli.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  #!/usr/bin/env node
2
+ /** Registers the shared PCG commands used by Next.js, Astro and Nuxt projects. */
2
3
  export {};
package/dist/bin/cli.js CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  "use strict";
3
+ /** Registers the shared PCG commands used by Next.js, Astro and Nuxt projects. */
3
4
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
5
  if (k2 === undefined) k2 = k;
5
6
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -36,7 +37,7 @@ const program = new commander_1.Command();
36
37
  const packageJson = JSON.parse(fs.readFileSync(path.resolve(__dirname, '../../package.json'), 'utf8'));
37
38
  program
38
39
  .name('pcg')
39
- .description('CLI tool for building and deploying Next.js apps to pages-cache-gateway')
40
+ .description('CLI tool for building Next.js, Astro and Nuxt apps for pages-cache-gateway')
40
41
  .version(packageJson.version);
41
42
  program.addCommand((0, build_1.createBuildCommand)());
42
43
  program.addCommand((0, deploy_1.createDeployCommand)());
@@ -44,4 +45,4 @@ program.addCommand((0, upload_cache_1.createUploadCacheCommand)());
44
45
  program.addCommand((0, serve_1.createServeCommand)());
45
46
  program.addCommand((0, purge_1.createPurgeCommand)());
46
47
  program.parse(process.argv);
47
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2xpLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2Jpbi9jbGkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7QUFFQSx1Q0FBeUI7QUFDekIsMkNBQTZCO0FBQzdCLHlDQUFvQztBQUNwQyw2Q0FBdUQ7QUFDdkQsK0NBQXlEO0FBQ3pELDJEQUFvRTtBQUNwRSw2Q0FBdUQ7QUFDdkQsNkNBQXVEO0FBRXZELE1BQU0sT0FBTyxHQUFHLElBQUksbUJBQU8sRUFBRSxDQUFDO0FBQzlCLE1BQU0sV0FBVyxHQUFHLElBQUksQ0FBQyxLQUFLLENBQzVCLEVBQUUsQ0FBQyxZQUFZLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQyxTQUFTLEVBQUUsb0JBQW9CLENBQUMsRUFBRSxNQUFNLENBQUMsQ0FDaEQsQ0FBQztBQUV6QixPQUFPO0tBQ0osSUFBSSxDQUFDLEtBQUssQ0FBQztLQUNYLFdBQVcsQ0F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RDb21tYW5kKGNyZWF0ZURlcGxveUNvbW1hbmQoKSk7XG5wcm9ncmFtLmFkZENvbW1hbmQoY3JlYXRlVXBsb2FkQ2FjaGVDb21tYW5kKCkpO1xucHJvZ3JhbS5hZGRDb21tYW5kKGNyZWF0ZVNlcnZlQ29tbWFuZCgpKTtcbnByb2dyYW0uYWRkQ29tbWFuZChjcmVhdGVQdXJnZUNvbW1hbmQoKSk7XG5cbnByb2dyYW0ucGFyc2UocHJvY2Vzcy5hcmd2KTtcbiJdfQ==
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Orchestrates a certified Astro build without permanently changing user files.
3
+ * It validates versions, applies a temporary config overlay, runs Astro, and
4
+ * materializes the unified PCG artifact.
5
+ */
6
+ export interface AstroBuildOptions {
7
+ dir: string;
8
+ outDir: string;
9
+ config?: string;
10
+ debug?: boolean;
11
+ dryRun?: boolean;
12
+ }
13
+ export declare function runAstroBuild(opts: AstroBuildOptions): Promise<void>;