@webflow/cloud-app 0.1.0-beta.7
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/LICENSE +21 -0
- package/README.md +93 -0
- package/dist/bindings.d.ts +185 -0
- package/dist/bindings.d.ts.map +1 -0
- package/dist/bindings.js +120 -0
- package/dist/bindings.js.map +1 -0
- package/dist/config/package-json.d.ts +57 -0
- package/dist/config/package-json.d.ts.map +1 -0
- package/dist/config/package-json.js +94 -0
- package/dist/config/package-json.js.map +1 -0
- package/dist/config/webflow-json.d.ts +53 -0
- package/dist/config/webflow-json.d.ts.map +1 -0
- package/dist/config/webflow-json.js +72 -0
- package/dist/config/webflow-json.js.map +1 -0
- package/dist/create-webflow-json.d.ts +24 -0
- package/dist/create-webflow-json.d.ts.map +1 -0
- package/dist/create-webflow-json.js +170 -0
- package/dist/create-webflow-json.js.map +1 -0
- package/dist/errors.d.ts +13 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +23 -0
- package/dist/errors.js.map +1 -0
- package/dist/frameworks/astro/adapter-patches/ensure-fixed-cloudflare-adapter.d.ts +36 -0
- package/dist/frameworks/astro/adapter-patches/ensure-fixed-cloudflare-adapter.d.ts.map +1 -0
- package/dist/frameworks/astro/adapter-patches/ensure-fixed-cloudflare-adapter.js +94 -0
- package/dist/frameworks/astro/adapter-patches/ensure-fixed-cloudflare-adapter.js.map +1 -0
- package/dist/frameworks/astro/adapter-patches/strip-cloudflare-base-nesting.d.ts +2 -0
- package/dist/frameworks/astro/adapter-patches/strip-cloudflare-base-nesting.d.ts.map +1 -0
- package/dist/frameworks/astro/adapter-patches/strip-cloudflare-base-nesting.js +97 -0
- package/dist/frameworks/astro/adapter-patches/strip-cloudflare-base-nesting.js.map +1 -0
- package/dist/frameworks/astro/astro5.d.ts +28 -0
- package/dist/frameworks/astro/astro5.d.ts.map +1 -0
- package/dist/frameworks/astro/astro5.js +259 -0
- package/dist/frameworks/astro/astro5.js.map +1 -0
- package/dist/frameworks/astro/astro6.d.ts +28 -0
- package/dist/frameworks/astro/astro6.d.ts.map +1 -0
- package/dist/frameworks/astro/astro6.js +286 -0
- package/dist/frameworks/astro/astro6.js.map +1 -0
- package/dist/frameworks/astro/astro7.d.ts +28 -0
- package/dist/frameworks/astro/astro7.d.ts.map +1 -0
- package/dist/frameworks/astro/astro7.js +283 -0
- package/dist/frameworks/astro/astro7.js.map +1 -0
- package/dist/frameworks/astro/index.d.ts +10 -0
- package/dist/frameworks/astro/index.d.ts.map +1 -0
- package/dist/frameworks/astro/index.js +16 -0
- package/dist/frameworks/astro/index.js.map +1 -0
- package/dist/frameworks/astro/templates/astro.config.webflow.ts +61 -0
- package/dist/frameworks/astro/templates/v5/astro.config.mjs.template +25 -0
- package/dist/frameworks/astro/templates/v5/webflow-loader.ts +103 -0
- package/dist/frameworks/astro/templates/v5/wrangler.json +6 -0
- package/dist/frameworks/astro/templates/v6/astro.config.mjs.template +35 -0
- package/dist/frameworks/astro/templates/v6/webflow-loader.ts +112 -0
- package/dist/frameworks/astro/templates/v6/wrangler.json +9 -0
- package/dist/frameworks/astro/templates/v7/astro.config.mjs.template +34 -0
- package/dist/frameworks/astro/templates/v7/webflow-loader.ts +113 -0
- package/dist/frameworks/astro/templates/v7/wrangler.json +9 -0
- package/dist/frameworks/base.d.ts +134 -0
- package/dist/frameworks/base.d.ts.map +1 -0
- package/dist/frameworks/base.js +175 -0
- package/dist/frameworks/base.js.map +1 -0
- package/dist/frameworks/errors.d.ts +72 -0
- package/dist/frameworks/errors.d.ts.map +1 -0
- package/dist/frameworks/errors.js +120 -0
- package/dist/frameworks/errors.js.map +1 -0
- package/dist/frameworks/nextjs/adapter-resolver.d.ts +72 -0
- package/dist/frameworks/nextjs/adapter-resolver.d.ts.map +1 -0
- package/dist/frameworks/nextjs/adapter-resolver.js +246 -0
- package/dist/frameworks/nextjs/adapter-resolver.js.map +1 -0
- package/dist/frameworks/nextjs/index.d.ts +38 -0
- package/dist/frameworks/nextjs/index.d.ts.map +1 -0
- package/dist/frameworks/nextjs/index.js +268 -0
- package/dist/frameworks/nextjs/index.js.map +1 -0
- package/dist/frameworks/nextjs/templates/next.config.ts.template +13 -0
- package/dist/frameworks/nextjs/templates/next.config.webflow.ts +46 -0
- package/dist/frameworks/nextjs/templates/open-next.config.ts +3 -0
- package/dist/frameworks/nextjs/templates/webflow-loader.ts +44 -0
- package/dist/frameworks/nextjs/templates/wrangler.json +6 -0
- package/dist/frameworks/registry.d.ts +127 -0
- package/dist/frameworks/registry.d.ts.map +1 -0
- package/dist/frameworks/registry.js +257 -0
- package/dist/frameworks/registry.js.map +1 -0
- package/dist/frameworks/static/index.d.ts +93 -0
- package/dist/frameworks/static/index.d.ts.map +1 -0
- package/dist/frameworks/static/index.js +352 -0
- package/dist/frameworks/static/index.js.map +1 -0
- package/dist/frameworks/static/templates/wrangler.json +7 -0
- package/dist/frameworks/types.d.ts +138 -0
- package/dist/frameworks/types.d.ts.map +1 -0
- package/dist/frameworks/types.js +3 -0
- package/dist/frameworks/types.js.map +1 -0
- package/dist/frameworks/vite/index.d.ts +46 -0
- package/dist/frameworks/vite/index.d.ts.map +1 -0
- package/dist/frameworks/vite/index.js +303 -0
- package/dist/frameworks/vite/index.js.map +1 -0
- package/dist/frameworks/vite/templates/vite.config.ts.template +14 -0
- package/dist/frameworks/vite/templates/vite.config.webflow.ts +52 -0
- package/dist/frameworks/vite/templates/wrangler.json +10 -0
- package/dist/index.d.ts +44 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +118 -0
- package/dist/index.js.map +1 -0
- package/dist/pipeline.d.ts +8 -0
- package/dist/pipeline.d.ts.map +1 -0
- package/dist/pipeline.js +263 -0
- package/dist/pipeline.js.map +1 -0
- package/dist/ports/command-runner.d.ts +60 -0
- package/dist/ports/command-runner.d.ts.map +1 -0
- package/dist/ports/command-runner.js +116 -0
- package/dist/ports/command-runner.js.map +1 -0
- package/dist/ports/filesystem.d.ts +19 -0
- package/dist/ports/filesystem.d.ts.map +1 -0
- package/dist/ports/filesystem.js +68 -0
- package/dist/ports/filesystem.js.map +1 -0
- package/dist/ports/index.d.ts +17 -0
- package/dist/ports/index.d.ts.map +1 -0
- package/dist/ports/index.js +14 -0
- package/dist/ports/index.js.map +1 -0
- package/dist/ports/logger.d.ts +22 -0
- package/dist/ports/logger.d.ts.map +1 -0
- package/dist/ports/logger.js +18 -0
- package/dist/ports/logger.js.map +1 -0
- package/dist/ports/telemetry.d.ts +23 -0
- package/dist/ports/telemetry.d.ts.map +1 -0
- package/dist/ports/telemetry.js +12 -0
- package/dist/ports/telemetry.js.map +1 -0
- package/dist/toolchain/errors.d.ts +32 -0
- package/dist/toolchain/errors.d.ts.map +1 -0
- package/dist/toolchain/errors.js +31 -0
- package/dist/toolchain/errors.js.map +1 -0
- package/dist/toolchain/resolver.d.ts +25 -0
- package/dist/toolchain/resolver.d.ts.map +1 -0
- package/dist/toolchain/resolver.js +200 -0
- package/dist/toolchain/resolver.js.map +1 -0
- package/dist/toolchain/types.d.ts +52 -0
- package/dist/toolchain/types.d.ts.map +1 -0
- package/dist/toolchain/types.js +10 -0
- package/dist/toolchain/types.js.map +1 -0
- package/dist/types.d.ts +66 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/fs.d.ts +29 -0
- package/dist/utils/fs.d.ts.map +1 -0
- package/dist/utils/fs.js +126 -0
- package/dist/utils/fs.js.map +1 -0
- package/dist/utils/index.d.ts +11 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +27 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/node-version.d.ts +20 -0
- package/dist/utils/node-version.d.ts.map +1 -0
- package/dist/utils/node-version.js +113 -0
- package/dist/utils/node-version.js.map +1 -0
- package/dist/utils/process.d.ts +25 -0
- package/dist/utils/process.d.ts.map +1 -0
- package/dist/utils/process.js +40 -0
- package/dist/utils/process.js.map +1 -0
- package/dist/utils/reserved-env.d.ts +26 -0
- package/dist/utils/reserved-env.d.ts.map +1 -0
- package/dist/utils/reserved-env.js +51 -0
- package/dist/utils/reserved-env.js.map +1 -0
- package/dist/utils/template.d.ts +15 -0
- package/dist/utils/template.d.ts.map +1 -0
- package/dist/utils/template.js +75 -0
- package/dist/utils/template.js.map +1 -0
- package/dist/utils/version.d.ts +9 -0
- package/dist/utils/version.d.ts.map +1 -0
- package/dist/utils/version.js +52 -0
- package/dist/utils/version.js.map +1 -0
- package/dist/wrangler.d.ts +192 -0
- package/dist/wrangler.d.ts.map +1 -0
- package/dist/wrangler.js +246 -0
- package/dist/wrangler.js.map +1 -0
- package/package.json +47 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Webflow Image Loader for Astro 6
|
|
3
|
+
*
|
|
4
|
+
* This is the same loader as Astro 5 — it handles image optimization through
|
|
5
|
+
* Cloudflare's image resizing service.
|
|
6
|
+
*
|
|
7
|
+
* Note: Astro 6 defaults to 'cloudflare-binding' for imageService, but we use
|
|
8
|
+
* 'custom' to maintain compatibility with our CDN setup.
|
|
9
|
+
*/
|
|
10
|
+
import type { ExternalImageService, ImageTransform, AstroConfig } from 'astro';
|
|
11
|
+
|
|
12
|
+
function normalizeSrc(src: string, deployUrl?: string, mountPath?: string) {
|
|
13
|
+
// For local assets, include the mount path but not the deploy url, and remove the leading slash
|
|
14
|
+
if (deployUrl && src.startsWith(deployUrl)) {
|
|
15
|
+
return `${src.slice(deployUrl.length)}`.slice(1);
|
|
16
|
+
} else if (mountPath && src.startsWith(mountPath)) {
|
|
17
|
+
return src.slice(1);
|
|
18
|
+
} else if (src.startsWith('/')) {
|
|
19
|
+
return `${mountPath}${src}`.slice(1);
|
|
20
|
+
}
|
|
21
|
+
return src;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Default implementation copied from Astro's baseService
|
|
25
|
+
function getTargetDimensions(options: ImageTransform) {
|
|
26
|
+
let targetWidth = options.width;
|
|
27
|
+
let targetHeight = options.height;
|
|
28
|
+
|
|
29
|
+
// For ESM imported images, calculate missing dimensions based on aspect ratio
|
|
30
|
+
if (typeof options.src === 'object' && 'width' in options.src && 'height' in options.src) {
|
|
31
|
+
const aspectRatio = options.src.width / options.src.height;
|
|
32
|
+
if (targetHeight && !targetWidth) {
|
|
33
|
+
targetWidth = Math.round(targetHeight * aspectRatio);
|
|
34
|
+
} else if (targetWidth && !targetHeight) {
|
|
35
|
+
targetHeight = Math.round(targetWidth / aspectRatio);
|
|
36
|
+
} else if (!targetWidth && !targetHeight) {
|
|
37
|
+
targetWidth = options.src.width;
|
|
38
|
+
targetHeight = options.src.height;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return {
|
|
43
|
+
targetWidth,
|
|
44
|
+
targetHeight,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const cloudflareLoader: ExternalImageService = {
|
|
49
|
+
getURL(options: ImageTransform, imageConfig: AstroConfig['image']) {
|
|
50
|
+
const normalizedSrc = normalizeSrc(
|
|
51
|
+
typeof options.src === 'object' ? options.src.src : options.src,
|
|
52
|
+
imageConfig.service.config.deployUrl,
|
|
53
|
+
imageConfig.service.config.mountPath,
|
|
54
|
+
);
|
|
55
|
+
// Our cloudflare zone doesn't allow optimizing external images for security reasons, so just load the original image
|
|
56
|
+
// For now, also skip optimization for images hosted on regular webflow sites (cdn.website-files.com)
|
|
57
|
+
// because optimizing them would result in two bandwidth charges: one from the website-files zone (for the full image)
|
|
58
|
+
// and one from the cosmic.webflow.services zone (for the resized image)
|
|
59
|
+
if (normalizedSrc.startsWith('http://') || normalizedSrc.startsWith('https://')) {
|
|
60
|
+
return normalizedSrc;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const supportedOptions = ['width', 'height', 'quality', 'format'];
|
|
64
|
+
const params = [];
|
|
65
|
+
for (const option of supportedOptions) {
|
|
66
|
+
if (options[option]) {
|
|
67
|
+
params.push(`${option}=${options[option]}`);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const workerUrl = imageConfig.service.config.deployUrl;
|
|
72
|
+
// Skip resizing svgs, since it doesn't do anything
|
|
73
|
+
const isSvg =
|
|
74
|
+
typeof options.src === 'object' ? options.src.format === 'svg' : options.src.endsWith('.svg');
|
|
75
|
+
if (isSvg || params.length === 0) {
|
|
76
|
+
return `${workerUrl}/${normalizedSrc}`;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const paramsString = params.join(',');
|
|
80
|
+
return `${workerUrl}/cdn-cgi/image/${paramsString}/${normalizedSrc}`;
|
|
81
|
+
},
|
|
82
|
+
|
|
83
|
+
// Default implementation copied from Astro's baseService
|
|
84
|
+
getHTMLAttributes(options: ImageTransform) {
|
|
85
|
+
const { targetWidth, targetHeight } = getTargetDimensions(options);
|
|
86
|
+
const {
|
|
87
|
+
src,
|
|
88
|
+
width,
|
|
89
|
+
height,
|
|
90
|
+
format,
|
|
91
|
+
quality,
|
|
92
|
+
densities,
|
|
93
|
+
widths,
|
|
94
|
+
formats,
|
|
95
|
+
layout,
|
|
96
|
+
priority,
|
|
97
|
+
fit,
|
|
98
|
+
position,
|
|
99
|
+
...attributes
|
|
100
|
+
} = options;
|
|
101
|
+
|
|
102
|
+
return {
|
|
103
|
+
...attributes,
|
|
104
|
+
width: targetWidth,
|
|
105
|
+
height: targetHeight,
|
|
106
|
+
loading: attributes.loading ?? 'lazy',
|
|
107
|
+
decoding: attributes.decoding ?? 'async',
|
|
108
|
+
};
|
|
109
|
+
},
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
export default cloudflareLoader;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// Generated by the Webflow Cloud builder. Merge logic lives in ./astro.config.webflow.ts.
|
|
2
|
+
import { defineConfig } from 'astro/config';
|
|
3
|
+
import { readFileSync } from 'node:fs';
|
|
4
|
+
import cloudflare from '@astrojs/cloudflare';
|
|
5
|
+
import react from '@astrojs/react';
|
|
6
|
+
import userConfig from './clouduser.astro.config';
|
|
7
|
+
import { withWebflowOverrides } from './astro.config.webflow';
|
|
8
|
+
|
|
9
|
+
// Detect React 19+ so we know whether to alias react-dom/server -> .edge.
|
|
10
|
+
let isReact19 = false;
|
|
11
|
+
try {
|
|
12
|
+
const pkg = JSON.parse(readFileSync('./package.json', 'utf8'));
|
|
13
|
+
const reactVersion = pkg.dependencies?.react || pkg.devDependencies?.react || '';
|
|
14
|
+
// Match versions like "19", "^19", "~19", "19.0.0", "^19.0.0", etc.
|
|
15
|
+
isReact19 = /(?:^|[^\d])19(?:\.|$)/.test(reactVersion);
|
|
16
|
+
} catch {
|
|
17
|
+
// Could not read package.json, assume not React 19.
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default defineConfig(
|
|
21
|
+
withWebflowOverrides(userConfig, {
|
|
22
|
+
mountPath: '${COSMIC_MOUNT_PATH}',
|
|
23
|
+
deployUrl: '${COSMIC_DEPLOY_URL}',
|
|
24
|
+
adapter: cloudflare({
|
|
25
|
+
imageService: 'custom',
|
|
26
|
+
// Note: platformProxy removed in Astro 6+ — workerd runs natively via @cloudflare/vite-plugin.
|
|
27
|
+
}),
|
|
28
|
+
reactIntegration: react(),
|
|
29
|
+
// Only React 19+ has react-dom/server.edge. React 18 has only .browser, which doesn't run in edge runtimes.
|
|
30
|
+
reactDomServerAlias: import.meta.env.PROD && isReact19
|
|
31
|
+
? { 'react-dom/server': 'react-dom/server.edge' }
|
|
32
|
+
: undefined,
|
|
33
|
+
})
|
|
34
|
+
);
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Webflow Image Loader for Astro 7
|
|
3
|
+
*
|
|
4
|
+
* This is the same loader as Astro 5 and 6 - it handles image optimization
|
|
5
|
+
* through Cloudflare's image resizing service.
|
|
6
|
+
*
|
|
7
|
+
* Note: Astro 7 defaults to 'cloudflare-binding' for imageService,
|
|
8
|
+
* but we use 'custom' to maintain compatibility with our CDN setup.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type { ExternalImageService, ImageTransform, AstroConfig } from 'astro';
|
|
12
|
+
|
|
13
|
+
function normalizeSrc(src: string, deployUrl?: string, mountPath?: string) {
|
|
14
|
+
// For local assets, include the mount path but not the deploy url, and remove the leading slash
|
|
15
|
+
if (deployUrl && src.startsWith(deployUrl)) {
|
|
16
|
+
return `${src.slice(deployUrl.length)}`.slice(1);
|
|
17
|
+
} else if (mountPath && src.startsWith(mountPath)) {
|
|
18
|
+
return src.slice(1);
|
|
19
|
+
} else if (src.startsWith('/')) {
|
|
20
|
+
return `${mountPath}${src}`.slice(1);
|
|
21
|
+
}
|
|
22
|
+
return src;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Default implementation copied from Astro's baseService
|
|
26
|
+
function getTargetDimensions(options: ImageTransform) {
|
|
27
|
+
let targetWidth = options.width;
|
|
28
|
+
let targetHeight = options.height;
|
|
29
|
+
|
|
30
|
+
// For ESM imported images, calculate missing dimensions based on aspect ratio
|
|
31
|
+
if (typeof options.src === 'object' && 'width' in options.src && 'height' in options.src) {
|
|
32
|
+
const aspectRatio = options.src.width / options.src.height;
|
|
33
|
+
if (targetHeight && !targetWidth) {
|
|
34
|
+
targetWidth = Math.round(targetHeight * aspectRatio);
|
|
35
|
+
} else if (targetWidth && !targetHeight) {
|
|
36
|
+
targetHeight = Math.round(targetWidth / aspectRatio);
|
|
37
|
+
} else if (!targetWidth && !targetHeight) {
|
|
38
|
+
targetWidth = options.src.width;
|
|
39
|
+
targetHeight = options.src.height;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return {
|
|
44
|
+
targetWidth,
|
|
45
|
+
targetHeight,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const cloudflareLoader: ExternalImageService = {
|
|
50
|
+
getURL(options: ImageTransform, imageConfig: AstroConfig['image']) {
|
|
51
|
+
const normalizedSrc = normalizeSrc(
|
|
52
|
+
typeof options.src === 'object' ? options.src.src : options.src,
|
|
53
|
+
imageConfig.service.config.deployUrl,
|
|
54
|
+
imageConfig.service.config.mountPath,
|
|
55
|
+
);
|
|
56
|
+
// Our cloudflare zone doesn't allow optimizing external images for security reasons, so just load the original image
|
|
57
|
+
// For now, also skip optimization for images hosted on regular webflow sites (cdn.website-files.com)
|
|
58
|
+
// because optimizing them would result in two bandwidth charges: one from the website-files zone (for the full image)
|
|
59
|
+
// and one from the cosmic.webflow.services zone (for the resized image)
|
|
60
|
+
if (normalizedSrc.startsWith('http://') || normalizedSrc.startsWith('https://')) {
|
|
61
|
+
return normalizedSrc;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const supportedOptions = ['width', 'height', 'quality', 'format'];
|
|
65
|
+
const params = [];
|
|
66
|
+
for (const option of supportedOptions) {
|
|
67
|
+
if (options[option]) {
|
|
68
|
+
params.push(`${option}=${options[option]}`);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const workerUrl = imageConfig.service.config.deployUrl;
|
|
73
|
+
// Skip resizing svgs, since it doesn't do anything
|
|
74
|
+
const isSvg =
|
|
75
|
+
typeof options.src === 'object' ? options.src.format === 'svg' : options.src.endsWith('.svg');
|
|
76
|
+
if (isSvg || params.length === 0) {
|
|
77
|
+
return `${workerUrl}/${normalizedSrc}`;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const paramsString = params.join(',');
|
|
81
|
+
return `${workerUrl}/cdn-cgi/image/${paramsString}/${normalizedSrc}`;
|
|
82
|
+
},
|
|
83
|
+
|
|
84
|
+
// Default implementation copied from Astro's baseService
|
|
85
|
+
getHTMLAttributes(options: ImageTransform) {
|
|
86
|
+
const { targetWidth, targetHeight } = getTargetDimensions(options);
|
|
87
|
+
const {
|
|
88
|
+
src,
|
|
89
|
+
width,
|
|
90
|
+
height,
|
|
91
|
+
format,
|
|
92
|
+
quality,
|
|
93
|
+
densities,
|
|
94
|
+
widths,
|
|
95
|
+
formats,
|
|
96
|
+
layout,
|
|
97
|
+
priority,
|
|
98
|
+
fit,
|
|
99
|
+
position,
|
|
100
|
+
...attributes
|
|
101
|
+
} = options;
|
|
102
|
+
|
|
103
|
+
return {
|
|
104
|
+
...attributes,
|
|
105
|
+
width: targetWidth,
|
|
106
|
+
height: targetHeight,
|
|
107
|
+
loading: attributes.loading ?? 'lazy',
|
|
108
|
+
decoding: attributes.decoding ?? 'async',
|
|
109
|
+
};
|
|
110
|
+
},
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
export default cloudflareLoader;
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import type { BuildContext, BuildOutput, FrameworkInfo, PackageJson, WebflowJson, DetectionResult, AdapterPackage, IntegrationPackage, WebflowLoaderConfig, NodeVersionRequirement } from './types';
|
|
2
|
+
export declare abstract class FrameworkBuilder {
|
|
3
|
+
/**
|
|
4
|
+
* Canonical framework name (e.g. 'nextjs', 'astro', 'vite').
|
|
5
|
+
* Subclasses override this static field; matches `info.name` on the instance.
|
|
6
|
+
*/
|
|
7
|
+
static frameworkName: string;
|
|
8
|
+
protected ctx: BuildContext;
|
|
9
|
+
constructor(ctx: BuildContext);
|
|
10
|
+
/**
|
|
11
|
+
* Framework identification. Returns info about this specific framework and version.
|
|
12
|
+
*/
|
|
13
|
+
abstract get info(): FrameworkInfo;
|
|
14
|
+
/**
|
|
15
|
+
* Detect if this builder handles the project.
|
|
16
|
+
*
|
|
17
|
+
* Returns true if this builder can handle the project. Detection order in the
|
|
18
|
+
* registry determines precedence (first match wins).
|
|
19
|
+
*/
|
|
20
|
+
static detect(_packageJson: PackageJson, _webflowJson?: WebflowJson): DetectionResult;
|
|
21
|
+
/**
|
|
22
|
+
* Detect this framework from a built output directory.
|
|
23
|
+
*
|
|
24
|
+
* Used at deploy time when webflow.json may be missing (e.g. CLI-built
|
|
25
|
+
* output). Each framework recognizes its own bundled artifact signature
|
|
26
|
+
* inside `cwd`. Default returns false; frameworks that can be detected from
|
|
27
|
+
* output override.
|
|
28
|
+
*/
|
|
29
|
+
static detectFromBuiltOutput(_cwd: string): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Static deploy metadata: framework name + entrypoint + deployment type.
|
|
32
|
+
*
|
|
33
|
+
* Same shape as `getOutputDeployMetadata()` but callable without constructing
|
|
34
|
+
* a builder, so the deploy phase (which has no BuildContext) can use it.
|
|
35
|
+
*/
|
|
36
|
+
static getOutputDeployMetadata(): BuildOutput;
|
|
37
|
+
/**
|
|
38
|
+
* Validate that the project meets requirements for this framework.
|
|
39
|
+
*
|
|
40
|
+
* @throws FrameworkValidationError if validation fails
|
|
41
|
+
*/
|
|
42
|
+
abstract validate(): Promise<void>;
|
|
43
|
+
/**
|
|
44
|
+
* Install required dependencies that are missing. Should be idempotent.
|
|
45
|
+
*/
|
|
46
|
+
abstract installDependencies(): Promise<void>;
|
|
47
|
+
/**
|
|
48
|
+
* Prepare configuration files (astro.config, wrangler.json, etc.). Handles
|
|
49
|
+
* renaming user configs and merging with templates.
|
|
50
|
+
*/
|
|
51
|
+
abstract prepareConfig(): Promise<void>;
|
|
52
|
+
/**
|
|
53
|
+
* Get the build command to execute, e.g. "astro build",
|
|
54
|
+
* "opennextjs-cloudflare build". Returns null for frameworks with no build
|
|
55
|
+
* step (the no-framework static builder), in which case the host skips the
|
|
56
|
+
* build phase.
|
|
57
|
+
*/
|
|
58
|
+
abstract getBuildCommand(): string | null;
|
|
59
|
+
/**
|
|
60
|
+
* Instance accessor for deploy metadata. Wraps the static method on the
|
|
61
|
+
* concrete class so existing instance-based call sites keep working.
|
|
62
|
+
*/
|
|
63
|
+
getOutputDeployMetadata(): BuildOutput;
|
|
64
|
+
/** Get the wrangler template path for this framework. */
|
|
65
|
+
abstract getWranglerTemplatePath(): string;
|
|
66
|
+
/**
|
|
67
|
+
* Get the Cloudflare adapter package to install. Returns null if the
|
|
68
|
+
* framework doesn't need one (e.g., pure SPA).
|
|
69
|
+
*/
|
|
70
|
+
abstract getCloudflareAdapter(): AdapterPackage | null;
|
|
71
|
+
/**
|
|
72
|
+
* Get Webflow-specific integrations required for Webflow component support.
|
|
73
|
+
* Installed in addition to user dependencies.
|
|
74
|
+
*/
|
|
75
|
+
abstract getRequiredIntegrations(): IntegrationPackage[];
|
|
76
|
+
/**
|
|
77
|
+
* Get the Webflow loader configuration for image optimization. Returns null
|
|
78
|
+
* if the framework doesn't need a loader.
|
|
79
|
+
*/
|
|
80
|
+
abstract getWebflowLoader(): WebflowLoaderConfig | null;
|
|
81
|
+
/**
|
|
82
|
+
* Get Node.js version requirements for this framework. Returns null if no
|
|
83
|
+
* specific version is required.
|
|
84
|
+
*/
|
|
85
|
+
abstract getNodeVersionRequirement(): NodeVersionRequirement | null;
|
|
86
|
+
/**
|
|
87
|
+
* Post-build hook for any cleanup or modifications. Called after the build
|
|
88
|
+
* command succeeds.
|
|
89
|
+
*/
|
|
90
|
+
postBuild(): Promise<void>;
|
|
91
|
+
/**
|
|
92
|
+
* Get additional config files to copy (beyond webflow-loader). Returns an
|
|
93
|
+
* array of full paths to files that should be copied to the project root.
|
|
94
|
+
*/
|
|
95
|
+
getAdditionalConfigFiles(): string[];
|
|
96
|
+
/**
|
|
97
|
+
* Get patterns for user config files that need to be renamed, e.g.
|
|
98
|
+
* ['astro.config.mjs', 'astro.config.ts', 'astro.config.js'].
|
|
99
|
+
*/
|
|
100
|
+
getUserConfigPatterns(): string[];
|
|
101
|
+
/**
|
|
102
|
+
* Resolve the user's installed framework version from package.json, coerced
|
|
103
|
+
* to a valid semver string (e.g. "14.2.3"). Returns undefined when the
|
|
104
|
+
* package isn't in the user's deps or the version spec can't be coerced.
|
|
105
|
+
*
|
|
106
|
+
* Subclasses override to point at the correct npm package (`next`, `astro`,
|
|
107
|
+
* `vite`). The default returns undefined — when that happens the producer
|
|
108
|
+
* omits `framework_version` from webflow.json (the field is optional under
|
|
109
|
+
* the deploy contract). CLD-1785.
|
|
110
|
+
*/
|
|
111
|
+
getFrameworkVersion(): string | undefined;
|
|
112
|
+
/** Check if a dependency exists in package.json (deps or devDeps). */
|
|
113
|
+
protected hasDependency(name: string): boolean;
|
|
114
|
+
/** Get a dependency version from package.json (deps or devDeps). */
|
|
115
|
+
protected getDependencyVersion(name: string): string | undefined;
|
|
116
|
+
/**
|
|
117
|
+
* Read a dependency's version spec from the user's package.json and coerce it
|
|
118
|
+
* to a valid semver string. Returns undefined when the package isn't installed
|
|
119
|
+
* or the spec doesn't coerce (e.g. `workspace:*`, `latest`, a git URL). Used
|
|
120
|
+
* by `getFrameworkVersion` overrides.
|
|
121
|
+
*/
|
|
122
|
+
protected resolveFrameworkVersion(pkgName: string): string | undefined;
|
|
123
|
+
/** Logger port from context. */
|
|
124
|
+
protected get log(): import("..").Logger;
|
|
125
|
+
/** Command-runner port from context. */
|
|
126
|
+
protected get runCommand(): import("..").CommandRunner;
|
|
127
|
+
/** Telemetry port from context. */
|
|
128
|
+
protected get telemetry(): import("..").Telemetry;
|
|
129
|
+
/** Filesystem port from context. */
|
|
130
|
+
protected get fs(): import("..").FileSystemPort;
|
|
131
|
+
/** Working directory (the build workspace) from context. */
|
|
132
|
+
protected get cwd(): string;
|
|
133
|
+
}
|
|
134
|
+
//# sourceMappingURL=base.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/frameworks/base.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EACV,YAAY,EACZ,WAAW,EACX,aAAa,EACb,WAAW,EACX,WAAW,EACX,eAAe,EACf,cAAc,EACd,kBAAkB,EAClB,mBAAmB,EACnB,sBAAsB,EACvB,MAAM,SAAS,CAAC;AAEjB,8BAAsB,gBAAgB;IACpC;;;OAGG;IACH,MAAM,CAAC,aAAa,SAAM;IAE1B,SAAS,CAAC,GAAG,EAAE,YAAY,CAAC;gBAEhB,GAAG,EAAE,YAAY;IAQ7B;;OAEG;IACH,QAAQ,KAAK,IAAI,IAAI,a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AAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAKhE;;;;;OAKG;IACH,SAAS,CAAC,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAMtE,gCAAgC;IAChC,SAAS,KAAK,GAAG,wBAEhB;IAED,wCAAwC;IACxC,SAAS,KAAK,UAAU,+BAEvB;IAED,mCAAmC;IACnC,SAAS,KAAK,SAAS,2BAEtB;IAED,oCAAoC;IACpC,SAAS,KAAK,EAAE,gCAEf;IAED,4DAA4D;IAC5D,SAAS,KAAK,GAAG,WAEhB;CACF"}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.FrameworkBuilder = void 0;
|
|
37
|
+
/**
|
|
38
|
+
* Abstract base class for framework builders.
|
|
39
|
+
*
|
|
40
|
+
* Each framework (Astro, Next.js, Vite) extends this class to implement
|
|
41
|
+
* framework-specific build logic. The base is framework-agnostic and reaches
|
|
42
|
+
* the outside world only through the ports carried on `BuildContext`.
|
|
43
|
+
*/
|
|
44
|
+
const semver = __importStar(require("semver"));
|
|
45
|
+
class FrameworkBuilder {
|
|
46
|
+
/**
|
|
47
|
+
* Canonical framework name (e.g. 'nextjs', 'astro', 'vite').
|
|
48
|
+
* Subclasses override this static field; matches `info.name` on the instance.
|
|
49
|
+
*/
|
|
50
|
+
static frameworkName = '';
|
|
51
|
+
ctx;
|
|
52
|
+
constructor(ctx) {
|
|
53
|
+
this.ctx = ctx;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Detect if this builder handles the project.
|
|
57
|
+
*
|
|
58
|
+
* Returns true if this builder can handle the project. Detection order in the
|
|
59
|
+
* registry determines precedence (first match wins).
|
|
60
|
+
*/
|
|
61
|
+
static detect(_packageJson, _webflowJson) {
|
|
62
|
+
return { detected: false };
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Detect this framework from a built output directory.
|
|
66
|
+
*
|
|
67
|
+
* Used at deploy time when webflow.json may be missing (e.g. CLI-built
|
|
68
|
+
* output). Each framework recognizes its own bundled artifact signature
|
|
69
|
+
* inside `cwd`. Default returns false; frameworks that can be detected from
|
|
70
|
+
* output override.
|
|
71
|
+
*/
|
|
72
|
+
static detectFromBuiltOutput(_cwd) {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Static deploy metadata: framework name + entrypoint + deployment type.
|
|
77
|
+
*
|
|
78
|
+
* Same shape as `getOutputDeployMetadata()` but callable without constructing
|
|
79
|
+
* a builder, so the deploy phase (which has no BuildContext) can use it.
|
|
80
|
+
*/
|
|
81
|
+
static getOutputDeployMetadata() {
|
|
82
|
+
throw new Error('getOutputDeployMetadata must be implemented by the framework subclass');
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Instance accessor for deploy metadata. Wraps the static method on the
|
|
86
|
+
* concrete class so existing instance-based call sites keep working.
|
|
87
|
+
*/
|
|
88
|
+
getOutputDeployMetadata() {
|
|
89
|
+
return this.constructor.getOutputDeployMetadata();
|
|
90
|
+
}
|
|
91
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
92
|
+
// OPTIONAL METHODS WITH DEFAULT IMPLEMENTATIONS
|
|
93
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
94
|
+
/**
|
|
95
|
+
* Post-build hook for any cleanup or modifications. Called after the build
|
|
96
|
+
* command succeeds.
|
|
97
|
+
*/
|
|
98
|
+
async postBuild() {
|
|
99
|
+
// Default: no-op
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Get additional config files to copy (beyond webflow-loader). Returns an
|
|
103
|
+
* array of full paths to files that should be copied to the project root.
|
|
104
|
+
*/
|
|
105
|
+
getAdditionalConfigFiles() {
|
|
106
|
+
return [];
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Get patterns for user config files that need to be renamed, e.g.
|
|
110
|
+
* ['astro.config.mjs', 'astro.config.ts', 'astro.config.js'].
|
|
111
|
+
*/
|
|
112
|
+
getUserConfigPatterns() {
|
|
113
|
+
return [];
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Resolve the user's installed framework version from package.json, coerced
|
|
117
|
+
* to a valid semver string (e.g. "14.2.3"). Returns undefined when the
|
|
118
|
+
* package isn't in the user's deps or the version spec can't be coerced.
|
|
119
|
+
*
|
|
120
|
+
* Subclasses override to point at the correct npm package (`next`, `astro`,
|
|
121
|
+
* `vite`). The default returns undefined — when that happens the producer
|
|
122
|
+
* omits `framework_version` from webflow.json (the field is optional under
|
|
123
|
+
* the deploy contract). CLD-1785.
|
|
124
|
+
*/
|
|
125
|
+
getFrameworkVersion() {
|
|
126
|
+
return undefined;
|
|
127
|
+
}
|
|
128
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
129
|
+
// PROTECTED HELPER METHODS
|
|
130
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
131
|
+
/** Check if a dependency exists in package.json (deps or devDeps). */
|
|
132
|
+
hasDependency(name) {
|
|
133
|
+
const { packageJson } = this.ctx;
|
|
134
|
+
return name in (packageJson.dependencies || {}) || name in (packageJson.devDependencies || {});
|
|
135
|
+
}
|
|
136
|
+
/** Get a dependency version from package.json (deps or devDeps). */
|
|
137
|
+
getDependencyVersion(name) {
|
|
138
|
+
const { packageJson } = this.ctx;
|
|
139
|
+
return packageJson.dependencies?.[name] || packageJson.devDependencies?.[name];
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Read a dependency's version spec from the user's package.json and coerce it
|
|
143
|
+
* to a valid semver string. Returns undefined when the package isn't installed
|
|
144
|
+
* or the spec doesn't coerce (e.g. `workspace:*`, `latest`, a git URL). Used
|
|
145
|
+
* by `getFrameworkVersion` overrides.
|
|
146
|
+
*/
|
|
147
|
+
resolveFrameworkVersion(pkgName) {
|
|
148
|
+
const spec = this.getDependencyVersion(pkgName);
|
|
149
|
+
if (!spec)
|
|
150
|
+
return undefined;
|
|
151
|
+
return semver.coerce(spec)?.version;
|
|
152
|
+
}
|
|
153
|
+
/** Logger port from context. */
|
|
154
|
+
get log() {
|
|
155
|
+
return this.ctx.log;
|
|
156
|
+
}
|
|
157
|
+
/** Command-runner port from context. */
|
|
158
|
+
get runCommand() {
|
|
159
|
+
return this.ctx.runCommand;
|
|
160
|
+
}
|
|
161
|
+
/** Telemetry port from context. */
|
|
162
|
+
get telemetry() {
|
|
163
|
+
return this.ctx.telemetry;
|
|
164
|
+
}
|
|
165
|
+
/** Filesystem port from context. */
|
|
166
|
+
get fs() {
|
|
167
|
+
return this.ctx.fs;
|
|
168
|
+
}
|
|
169
|
+
/** Working directory (the build workspace) from context. */
|
|
170
|
+
get cwd() {
|
|
171
|
+
return this.ctx.cwd;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
exports.FrameworkBuilder = FrameworkBuilder;
|
|
175
|
+
//# sourceMappingURL=base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/frameworks/base.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;GAMG;AACH,+CAAiC;AAejC,MAAsB,gBAAgB;IACpC;;;OAGG;IACH,MAAM,CAAC,aAAa,GAAG,EAAE,CAAC;IAEhB,GAAG,CAAe;IAE5B,YAAY,GAAiB;QAC3B,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACjB,CAAC;IAWD;;;;;OAKG;IACH,MAAM,CAAC,MAAM,CAAC,YAAyB,EAAE,YAA0B;QACjE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;IAC7B,CAAC;IAED;;;;;;;OAOG;IACH,MAAM,CAAC,qBAAqB,CAAC,IAAY;QACvC,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,uBAAuB;QAC5B,MAAM,IAAI,KAAK,CAAC,uEAAuE,CAAC,CAAC;IAC3F,CAAC;IA4BD;;;OAGG;IACH,uBAAuB;QACrB,OAAQ,IAAI,CAAC,WAAuC,CAAC,uBAAuB,EAAE,CAAC;IACjF,CAAC;IAiCD,8EAA8E;IAC9E,gDAAgD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AAS;QACrB,OAAO,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC;IAC5B,CAAC;IAED,oCAAoC;IACpC,IAAc,EAAE;QACd,OAAO,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;IACrB,CAAC;IAED,4DAA4D;IAC5D,IAAc,GAAG;QACf,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;IACtB,CAAC;;AApNH,4CAqNC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom error types for framework builders.
|
|
3
|
+
*
|
|
4
|
+
* These errors carry remediation hints, documentation links, and
|
|
5
|
+
* framework-specific context so hosts can render actionable failures.
|
|
6
|
+
*/
|
|
7
|
+
export interface FrameworkErrorOptions {
|
|
8
|
+
cause?: Error;
|
|
9
|
+
remediation?: string;
|
|
10
|
+
documentationUrl?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Base error for all framework-related errors.
|
|
14
|
+
* Includes optional remediation hints and documentation links.
|
|
15
|
+
*/
|
|
16
|
+
export declare class FrameworkError extends Error {
|
|
17
|
+
readonly remediation?: string;
|
|
18
|
+
readonly documentationUrl?: string;
|
|
19
|
+
readonly cause?: unknown;
|
|
20
|
+
constructor(message: string, options?: FrameworkErrorOptions);
|
|
21
|
+
/**
|
|
22
|
+
* Format the error for display, including remediation if available.
|
|
23
|
+
*/
|
|
24
|
+
toDisplayString(): string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Thrown when project validation fails.
|
|
28
|
+
*
|
|
29
|
+
* Examples:
|
|
30
|
+
* - Wrong Node.js version
|
|
31
|
+
* - Missing required dependencies
|
|
32
|
+
* - Invalid configuration
|
|
33
|
+
* - Unsupported framework version
|
|
34
|
+
*/
|
|
35
|
+
export declare class FrameworkValidationError extends FrameworkError {
|
|
36
|
+
constructor(message: string, options?: FrameworkErrorOptions);
|
|
37
|
+
}
|
|
38
|
+
export interface FrameworkBuildErrorOptions extends FrameworkErrorOptions {
|
|
39
|
+
buildCommand?: string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Thrown when the build command fails.
|
|
43
|
+
* Includes framework-specific debugging hints.
|
|
44
|
+
*/
|
|
45
|
+
export declare class FrameworkBuildError extends FrameworkError {
|
|
46
|
+
readonly buildCommand?: string;
|
|
47
|
+
constructor(message: string, options?: FrameworkBuildErrorOptions);
|
|
48
|
+
toDisplayString(): string;
|
|
49
|
+
}
|
|
50
|
+
export interface FrameworkConfigErrorOptions extends FrameworkErrorOptions {
|
|
51
|
+
configFile?: string;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Thrown when configuration is invalid or cannot be processed.
|
|
55
|
+
*
|
|
56
|
+
* Examples:
|
|
57
|
+
* - Malformed astro.config.mjs
|
|
58
|
+
* - Invalid wrangler.json
|
|
59
|
+
* - Missing required config fields
|
|
60
|
+
*/
|
|
61
|
+
export declare class FrameworkConfigError extends FrameworkError {
|
|
62
|
+
readonly configFile?: string;
|
|
63
|
+
constructor(message: string, options?: FrameworkConfigErrorOptions);
|
|
64
|
+
toDisplayString(): string;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Thrown when framework cannot be detected.
|
|
68
|
+
*/
|
|
69
|
+
export declare class FrameworkDetectionError extends FrameworkError {
|
|
70
|
+
constructor(message: string, options?: FrameworkErrorOptions);
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/frameworks/errors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,MAAM,WAAW,qBAAqB;IACpC,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;GAGG;AACH,qBAAa,cAAe,SAAQ,KAAK;IACvC,SAAgB,WAA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