@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,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.silentLogger = exports.consoleLogger = void 0;
|
|
4
|
+
/** Default logger that writes to the console. Useful for the CLI and local runs. */
|
|
5
|
+
exports.consoleLogger = {
|
|
6
|
+
debug: (message, ...args) => console.debug(message, ...args),
|
|
7
|
+
info: (message, ...args) => console.info(message, ...args),
|
|
8
|
+
warn: (message, ...args) => console.warn(message, ...args),
|
|
9
|
+
error: (message, ...args) => console.error(message, ...args),
|
|
10
|
+
};
|
|
11
|
+
/** Logger that drops everything. Useful for tests and headless callers. */
|
|
12
|
+
exports.silentLogger = {
|
|
13
|
+
debug: () => { },
|
|
14
|
+
info: () => { },
|
|
15
|
+
warn: () => { },
|
|
16
|
+
error: () => { },
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/ports/logger.ts"],"names":[],"mappings":";;;AAkBA,oFAAoF;AACvE,QAAA,aAAa,GAAW;IACnC,KAAK,EAAE,CAAC,OAAO,EAAE,GAAG,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC;IAC5D,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC;IAC1D,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC;IAC1D,KAAK,EAAE,CAAC,OAAO,EAAE,GAAG,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC;CAC7D,CAAC;AAEF,2EAA2E;AAC9D,QAAA,YAAY,GAAW;IAClC,KAAK,EAAE,GAAG,EAAE,GAAE,CAAC;IACf,IAAI,EAAE,GAAG,EAAE,GAAE,CAAC;IACd,IAAI,EAAE,GAAG,EAAE,GAAE,CAAC;IACd,KAAK,EAAE,GAAG,EAAE,GAAE,CAAC;CAChB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Telemetry port.
|
|
3
|
+
*
|
|
4
|
+
* The engine emits spans for the build phases (detect, install, build,
|
|
5
|
+
* dry-run) through this port. cosmic-builder wraps `dd-trace` so its existing
|
|
6
|
+
* Datadog dashboards keep working; the CLI and headless hosts pass the no-op.
|
|
7
|
+
* Keeping `dd-trace` out of the engine is what lets it stay public and
|
|
8
|
+
* dependency-light.
|
|
9
|
+
*/
|
|
10
|
+
export type TagValue = string | number | boolean;
|
|
11
|
+
export interface Span {
|
|
12
|
+
/** Attach a tag to the span (e.g. `framework`, `deployment.type`). */
|
|
13
|
+
setTag(key: string, value: TagValue): void;
|
|
14
|
+
/** Finish the span. Pass an error to mark it failed. */
|
|
15
|
+
end(error?: unknown): void;
|
|
16
|
+
}
|
|
17
|
+
export interface Telemetry {
|
|
18
|
+
/** Start a span for a build phase. Tags may be supplied up front. */
|
|
19
|
+
startSpan(name: string, tags?: Record<string, TagValue>): Span;
|
|
20
|
+
}
|
|
21
|
+
/** Telemetry that records nothing. Default when a host injects none. */
|
|
22
|
+
export declare const noopTelemetry: Telemetry;
|
|
23
|
+
//# sourceMappingURL=telemetry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetry.d.ts","sourceRoot":"","sources":["../../src/ports/telemetry.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAEjD,MAAM,WAAW,IAAI;IACnB,sEAAsE;IACtE,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,GAAG,IAAI,CAAC;IAC3C,wDAAwD;IACxD,GAAG,CAAC,KAAK,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;CAC5B;AAED,MAAM,WAAW,SAAS;IACxB,qEAAqE;IACrE,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,IAAI,CAAC;CAChE;AAOD,wEAAwE;AACxE,eAAO,MAAM,aAAa,EAAE,SAE3B,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.noopTelemetry = void 0;
|
|
4
|
+
const noopSpan = {
|
|
5
|
+
setTag: () => { },
|
|
6
|
+
end: () => { },
|
|
7
|
+
};
|
|
8
|
+
/** Telemetry that records nothing. Default when a host injects none. */
|
|
9
|
+
exports.noopTelemetry = {
|
|
10
|
+
startSpan: () => noopSpan,
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=telemetry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetry.js","sourceRoot":"","sources":["../../src/ports/telemetry.ts"],"names":[],"mappings":";;;AAuBA,MAAM,QAAQ,GAAS;IACrB,MAAM,EAAE,GAAG,EAAE,GAAE,CAAC;IAChB,GAAG,EAAE,GAAG,EAAE,GAAE,CAAC;CACd,CAAC;AAEF,wEAAwE;AAC3D,QAAA,aAAa,GAAc;IACtC,SAAS,EAAE,GAAG,EAAE,CAAC,QAAQ;CAC1B,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { WebflowAppError } from '../errors';
|
|
2
|
+
import type { NodeVersionDeclarationSource } from './types';
|
|
3
|
+
export type NodeToolchainFailurePhase = 'provisioning' | 'verification';
|
|
4
|
+
/** Stable, customer-safe categories a host can persist and render. */
|
|
5
|
+
export type NodeToolchainFailureCode = 'NVM_PROVISION_FAILED' | 'NODE_RUNTIME_VERIFICATION_FAILED';
|
|
6
|
+
export interface NodeToolchainErrorOptions {
|
|
7
|
+
code: NodeToolchainFailureCode;
|
|
8
|
+
phase: NodeToolchainFailurePhase;
|
|
9
|
+
declarationSource?: NodeVersionDeclarationSource;
|
|
10
|
+
requestedVersion?: string;
|
|
11
|
+
resolvedVersion?: string;
|
|
12
|
+
remediation: string;
|
|
13
|
+
/** Provisioning and verification errors may be retried by a host. */
|
|
14
|
+
retryable: boolean;
|
|
15
|
+
cause?: unknown;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* A Node-toolchain failure with a stable code and safe remediation. Hosts can
|
|
19
|
+
* log its cause privately while sending only these fields to customer surfaces.
|
|
20
|
+
*/
|
|
21
|
+
export declare class NodeToolchainError extends WebflowAppError {
|
|
22
|
+
readonly code: NodeToolchainFailureCode;
|
|
23
|
+
readonly phase: NodeToolchainFailurePhase;
|
|
24
|
+
readonly declarationSource?: NodeVersionDeclarationSource;
|
|
25
|
+
readonly requestedVersion?: string;
|
|
26
|
+
readonly resolvedVersion?: string;
|
|
27
|
+
readonly remediation: string;
|
|
28
|
+
readonly retryable: boolean;
|
|
29
|
+
readonly cause?: unknown;
|
|
30
|
+
constructor(message: string, options: NodeToolchainErrorOptions);
|
|
31
|
+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
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NodeToolchainError = void 0;
|
|
4
|
+
const errors_1 = require("../errors");
|
|
5
|
+
/**
|
|
6
|
+
* A Node-toolchain failure with a stable code and safe remediation. Hosts can
|
|
7
|
+
* log its cause privately while sending only these fields to customer surfaces.
|
|
8
|
+
*/
|
|
9
|
+
class NodeToolchainError extends errors_1.WebflowAppError {
|
|
10
|
+
code;
|
|
11
|
+
phase;
|
|
12
|
+
declarationSource;
|
|
13
|
+
requestedVersion;
|
|
14
|
+
resolvedVersion;
|
|
15
|
+
remediation;
|
|
16
|
+
retryable;
|
|
17
|
+
cause;
|
|
18
|
+
constructor(message, options) {
|
|
19
|
+
super(message);
|
|
20
|
+
this.code = options.code;
|
|
21
|
+
this.phase = options.phase;
|
|
22
|
+
this.declarationSource = options.declarationSource;
|
|
23
|
+
this.requestedVersion = options.requestedVersion;
|
|
24
|
+
this.resolvedVersion = options.resolvedVersion;
|
|
25
|
+
this.remediation = options.remediation;
|
|
26
|
+
this.retryable = options.retryable;
|
|
27
|
+
this.cause = options.cause;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.NodeToolchainError = NodeToolchainError;
|
|
31
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/toolchain/errors.ts"],"names":[],"mappings":";;;AAAA,sCAA4C;AAqB5C;;;GAGG;AACH,MAAa,kBAAmB,SAAQ,wBAAe;IAC5C,IAAI,CAA2B;IAC/B,KAAK,CAA4B;IACjC,iBAAiB,CAAgC;IACjD,gBAAgB,CAAU;IAC1B,eAAe,CAAU;IACzB,WAAW,CAAS;IACpB,SAAS,CAAU;IACnB,KAAK,CAAW;IAEzB,YAAY,OAAe,EAAE,OAAkC;QAC7D,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QACzB,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;QAC3B,IAAI,CAAC,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC;QACnD,IAAI,CAAC,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC;QACjD,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC;QAC/C,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;QACvC,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;QACnC,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;IAC7B,CAAC;CACF;AArBD,gDAqBC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { PackageJson } from '../config/package-json';
|
|
2
|
+
import type { NodeToolchainPolicy, ResolvedNodeToolchain } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Initial hosted-build policy. The resolver accepts a policy from the host so
|
|
5
|
+
* later LTS releases do not require changing customer-facing resolution logic.
|
|
6
|
+
*/
|
|
7
|
+
export declare const DEFAULT_NODE_TOOLCHAIN_POLICY: NodeToolchainPolicy;
|
|
8
|
+
export interface ResolveNodeToolchainOptions {
|
|
9
|
+
/** Ephemeral project workspace containing version files and package.json. */
|
|
10
|
+
projectDir: string;
|
|
11
|
+
packageJson: PackageJson;
|
|
12
|
+
/** Omit to use the initial Node 24 policy. */
|
|
13
|
+
policy?: NodeToolchainPolicy;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Resolve a project's Node declaration to one exact version allowed by the
|
|
17
|
+
* policy. Version declarations use the Cloud contract's precedence order:
|
|
18
|
+
* .nvmrc, then .node-version, then package.json engines. Lower-priority
|
|
19
|
+
* declarations are ignored unless they resolve to a different supported
|
|
20
|
+
* release, in which case the result is marked as conflicting. An invalid or
|
|
21
|
+
* unsupported selected declaration falls back to the host default and returns
|
|
22
|
+
* a customer-safe warning.
|
|
23
|
+
*/
|
|
24
|
+
export declare function resolveNodeToolchain(options: ResolveNodeToolchainOptions): ResolvedNodeToolchain;
|
|
25
|
+
//# sourceMappingURL=resolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../../src/toolchain/resolver.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAE1D,OAAO,KAAK,EACV,mBAAmB,EAEnB,qBAAqB,EACtB,MAAM,SAAS,CAAC;AAEjB;;;GAGG;AACH,eAAO,MAAM,6BAA6B,EAAE,mBAI3C,CAAC;AAEF,MAAM,WAAW,2BAA2B;IAC1C,6EAA6E;IAC7E,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,WAAW,CAAC;IACzB,8CAA8C;IAC9C,MAAM,CAAC,EAAE,mBAAmB,CAAC;CAC9B;AAuBD;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,2BAA2B,GAAG,qBAAqB,CA4EhG"}
|
|
@@ -0,0 +1,200 @@
|
|
|
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.DEFAULT_NODE_TOOLCHAIN_POLICY = void 0;
|
|
37
|
+
exports.resolveNodeToolchain = resolveNodeToolchain;
|
|
38
|
+
const fs = __importStar(require("node:fs"));
|
|
39
|
+
const path = __importStar(require("node:path"));
|
|
40
|
+
const semver = __importStar(require("semver"));
|
|
41
|
+
/**
|
|
42
|
+
* Initial hosted-build policy. The resolver accepts a policy from the host so
|
|
43
|
+
* later LTS releases do not require changing customer-facing resolution logic.
|
|
44
|
+
*/
|
|
45
|
+
exports.DEFAULT_NODE_TOOLCHAIN_POLICY = {
|
|
46
|
+
defaultVersion: '24.15.0',
|
|
47
|
+
supportedVersions: ['24.15.0'],
|
|
48
|
+
supportedLtsVersions: ['24.15.0'],
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Resolve a project's Node declaration to one exact version allowed by the
|
|
52
|
+
* policy. Version declarations use the Cloud contract's precedence order:
|
|
53
|
+
* .nvmrc, then .node-version, then package.json engines. Lower-priority
|
|
54
|
+
* declarations are ignored unless they resolve to a different supported
|
|
55
|
+
* release, in which case the result is marked as conflicting. An invalid or
|
|
56
|
+
* unsupported selected declaration falls back to the host default and returns
|
|
57
|
+
* a customer-safe warning.
|
|
58
|
+
*/
|
|
59
|
+
function resolveNodeToolchain(options) {
|
|
60
|
+
const policy = normalizePolicy(options.policy ?? exports.DEFAULT_NODE_TOOLCHAIN_POLICY);
|
|
61
|
+
const declarations = readDeclarations(options.projectDir, options.packageJson);
|
|
62
|
+
const declaration = declarations[0];
|
|
63
|
+
if (!declaration) {
|
|
64
|
+
return {
|
|
65
|
+
declarationSource: 'default',
|
|
66
|
+
resolvedVersion: policy.defaultVersion,
|
|
67
|
+
resolution: 'default',
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
if (!isValidDeclaration(declaration)) {
|
|
71
|
+
return {
|
|
72
|
+
declarationSource: declaration.source,
|
|
73
|
+
requestedVersion: declaration.requestedVersion,
|
|
74
|
+
resolvedVersion: policy.defaultVersion,
|
|
75
|
+
resolution: 'invalid',
|
|
76
|
+
warning: `The Node.js version declared in ${sourceLabel(declaration.source)} is invalid` +
|
|
77
|
+
`${declaration.requestedVersion ? ` (${declaration.requestedVersion})` : ''}. ` +
|
|
78
|
+
`Using the baseline Node.js ${policy.defaultVersion} instead.`,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
const resolvedVersion = resolveSupportedVersion(declaration, policy);
|
|
82
|
+
if (!resolvedVersion) {
|
|
83
|
+
return {
|
|
84
|
+
declarationSource: declaration.source,
|
|
85
|
+
requestedVersion: declaration.requestedVersion,
|
|
86
|
+
resolvedVersion: policy.defaultVersion,
|
|
87
|
+
resolution: declaration.kind === 'lts' ? 'unresolvable' : 'unsupported',
|
|
88
|
+
warning: declaration.kind === 'lts'
|
|
89
|
+
? `The Node.js LTS version requested by ${sourceLabel(declaration.source)} could not be resolved ` +
|
|
90
|
+
`from Webflow Cloud's supported LTS releases. Using the baseline Node.js ${policy.defaultVersion} instead.`
|
|
91
|
+
: `The Node.js version requested by ${sourceLabel(declaration.source)} (${declaration.requestedVersion}) ` +
|
|
92
|
+
`is not supported by Webflow Cloud. Using the baseline Node.js ${policy.defaultVersion} instead.`,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
const conflictingDeclarationSources = declarations
|
|
96
|
+
.slice(1)
|
|
97
|
+
.filter(isValidDeclaration)
|
|
98
|
+
.flatMap((lowerPriority) => {
|
|
99
|
+
const lowerPriorityVersion = resolveSupportedVersion(lowerPriority, policy);
|
|
100
|
+
return lowerPriorityVersion && lowerPriorityVersion !== resolvedVersion
|
|
101
|
+
? [lowerPriority.source]
|
|
102
|
+
: [];
|
|
103
|
+
});
|
|
104
|
+
if (conflictingDeclarationSources.length > 0) {
|
|
105
|
+
return {
|
|
106
|
+
declarationSource: declaration.source,
|
|
107
|
+
requestedVersion: declaration.requestedVersion,
|
|
108
|
+
resolvedVersion,
|
|
109
|
+
resolution: 'conflicting',
|
|
110
|
+
conflictingDeclarationSources,
|
|
111
|
+
warning: `Conflicting Node.js version declarations were found. Using ${sourceLabel(declaration.source)} ` +
|
|
112
|
+
`(${declaration.requestedVersion}) according to precedence.`,
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
return {
|
|
116
|
+
declarationSource: declaration.source,
|
|
117
|
+
requestedVersion: declaration.requestedVersion,
|
|
118
|
+
resolvedVersion,
|
|
119
|
+
resolution: 'declared',
|
|
120
|
+
warning: declaration.requestedVersion === resolvedVersion
|
|
121
|
+
? undefined
|
|
122
|
+
: `Resolved ${sourceLabel(declaration.source)} (${declaration.requestedVersion}) to supported Node.js ${resolvedVersion}.`,
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
function normalizePolicy(policy) {
|
|
126
|
+
const supportedVersions = policy.supportedVersions.map((version) => semver.valid(version));
|
|
127
|
+
if (supportedVersions.some((version) => version === null)) {
|
|
128
|
+
throw new TypeError('Node toolchain policy supportedVersions must contain exact semver versions.');
|
|
129
|
+
}
|
|
130
|
+
const defaultVersion = semver.valid(policy.defaultVersion);
|
|
131
|
+
if (!defaultVersion || !supportedVersions.includes(defaultVersion)) {
|
|
132
|
+
throw new TypeError('Node toolchain policy defaultVersion must be an exact supported semver version.');
|
|
133
|
+
}
|
|
134
|
+
const supportedLtsVersions = policy.supportedLtsVersions.map((version) => semver.valid(version));
|
|
135
|
+
if (supportedLtsVersions.some((version) => version === null) ||
|
|
136
|
+
supportedLtsVersions.some((version) => !supportedVersions.includes(version))) {
|
|
137
|
+
throw new TypeError('Node toolchain policy supportedLtsVersions must contain exact supported semver versions.');
|
|
138
|
+
}
|
|
139
|
+
return {
|
|
140
|
+
defaultVersion,
|
|
141
|
+
supportedVersions: supportedVersions.sort(semver.rcompare),
|
|
142
|
+
supportedLtsVersions: supportedLtsVersions.sort(semver.rcompare),
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
function readDeclarations(projectDir, packageJson) {
|
|
146
|
+
const declarations = [];
|
|
147
|
+
const nvmrc = readVersionFile(projectDir, '.nvmrc');
|
|
148
|
+
if (nvmrc !== undefined) {
|
|
149
|
+
declarations.push(parseDeclaration('nvmrc', nvmrc));
|
|
150
|
+
}
|
|
151
|
+
const nodeVersion = readVersionFile(projectDir, '.node-version');
|
|
152
|
+
if (nodeVersion !== undefined) {
|
|
153
|
+
declarations.push(parseDeclaration('node-version', nodeVersion));
|
|
154
|
+
}
|
|
155
|
+
if (packageJson.engines?.node !== undefined) {
|
|
156
|
+
declarations.push(parseDeclaration('package-engines', packageJson.engines.node));
|
|
157
|
+
}
|
|
158
|
+
return declarations;
|
|
159
|
+
}
|
|
160
|
+
function readVersionFile(projectDir, filename) {
|
|
161
|
+
const filePath = path.join(projectDir, filename);
|
|
162
|
+
if (!fs.statSync(filePath, { throwIfNoEntry: false })) {
|
|
163
|
+
return undefined;
|
|
164
|
+
}
|
|
165
|
+
const declaration = fs.readFileSync(filePath, 'utf8').trim();
|
|
166
|
+
return declaration || undefined;
|
|
167
|
+
}
|
|
168
|
+
function parseDeclaration(source, raw) {
|
|
169
|
+
if (typeof raw !== 'string' || raw.trim() === '') {
|
|
170
|
+
return { source, requestedVersion: typeof raw === 'string' ? raw : undefined };
|
|
171
|
+
}
|
|
172
|
+
const requestedVersion = raw.trim();
|
|
173
|
+
// NVM's generic LTS alias can safely resolve to the host's current LTS
|
|
174
|
+
// allowlist. Named LTS aliases are intentionally not supported in v1.
|
|
175
|
+
if (source !== 'package-engines' && requestedVersion === 'lts/*') {
|
|
176
|
+
return { source, requestedVersion, kind: 'lts' };
|
|
177
|
+
}
|
|
178
|
+
const range = semver.validRange(requestedVersion.startsWith('v') ? requestedVersion.slice(1) : requestedVersion);
|
|
179
|
+
if (range === null) {
|
|
180
|
+
return { source, requestedVersion };
|
|
181
|
+
}
|
|
182
|
+
return { source, requestedVersion, kind: 'range', range };
|
|
183
|
+
}
|
|
184
|
+
function isValidDeclaration(declaration) {
|
|
185
|
+
return 'kind' in declaration;
|
|
186
|
+
}
|
|
187
|
+
function resolveSupportedVersion(declaration, policy) {
|
|
188
|
+
if (declaration.kind === 'lts') {
|
|
189
|
+
return policy.supportedLtsVersions[0];
|
|
190
|
+
}
|
|
191
|
+
return policy.supportedVersions.find((version) => semver.satisfies(version, declaration.range));
|
|
192
|
+
}
|
|
193
|
+
function sourceLabel(source) {
|
|
194
|
+
if (source === 'nvmrc')
|
|
195
|
+
return '.nvmrc';
|
|
196
|
+
if (source === 'node-version')
|
|
197
|
+
return '.node-version';
|
|
198
|
+
return 'package.json#engines.node';
|
|
199
|
+
}
|
|
200
|
+
//# sourceMappingURL=resolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolver.js","sourceRoot":"","sources":["../../src/toolchain/resolver.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6DA,oDA4EC;AAzID,4CAA8B;AAC9B,gDAAkC;AAElC,+CAAiC;AAUjC;;;GAGG;AACU,QAAA,6BAA6B,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,OAAO,MAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,OAAO,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC;AAClG,CAAC;AAED,SAAS,WAAW,CAAC,MAAwD;IAC3E,IAAI,MAAM,KAAK,OAAO;QAAE,OAAO,QAAQ,CAAC;IACxC,IAAI,MAAM,KAAK,cAAc;QAAE,OAAO,eAAe,CAAC;IACtD,OAAO,2BAA2B,CAAC;AACrC,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node runtime selection types.
|
|
3
|
+
*
|
|
4
|
+
* These are intentionally host-agnostic: the resolver determines what a
|
|
5
|
+
* project requests, while a host-provided runtime adapter decides how to make
|
|
6
|
+
* that version available.
|
|
7
|
+
*/
|
|
8
|
+
/** The file or manifest field that selected the Node version. */
|
|
9
|
+
export type NodeVersionDeclarationSource = 'nvmrc' | 'node-version' | 'package-engines' | 'default';
|
|
10
|
+
/**
|
|
11
|
+
* Stable outcome of resolving a repository's Node declaration. Hosts can use
|
|
12
|
+
* this for telemetry and customer-facing behavior without matching warnings.
|
|
13
|
+
*/
|
|
14
|
+
export type NodeToolchainResolution = 'declared' | 'default' | 'invalid' | 'unsupported' | 'unresolvable' | 'conflicting';
|
|
15
|
+
/** Node releases a host permits for customer builds. Values must be exact semver versions. */
|
|
16
|
+
export interface NodeToolchainPolicy {
|
|
17
|
+
/** Exact version used when the project does not declare one. */
|
|
18
|
+
defaultVersion: string;
|
|
19
|
+
/** Exact versions the host is prepared to provision. */
|
|
20
|
+
supportedVersions: readonly string[];
|
|
21
|
+
/** Exact supported releases the host designates as LTS. */
|
|
22
|
+
supportedLtsVersions: readonly string[];
|
|
23
|
+
}
|
|
24
|
+
/** The resolved, exact Node runtime a build should use. */
|
|
25
|
+
export interface ResolvedNodeToolchain {
|
|
26
|
+
declarationSource: NodeVersionDeclarationSource;
|
|
27
|
+
/** Raw version declaration from the repository, omitted when the host default is used. */
|
|
28
|
+
requestedVersion?: string;
|
|
29
|
+
/** Exact supported Node release selected for this build. */
|
|
30
|
+
resolvedVersion: string;
|
|
31
|
+
/** Machine-readable resolution outcome. */
|
|
32
|
+
resolution: NodeToolchainResolution;
|
|
33
|
+
/** Lower-priority sources that requested a different supported release. */
|
|
34
|
+
conflictingDeclarationSources?: readonly Exclude<NodeVersionDeclarationSource, 'default'>[];
|
|
35
|
+
/** Non-fatal information a host may choose to expose in build logs. */
|
|
36
|
+
warning?: string;
|
|
37
|
+
}
|
|
38
|
+
/** Environment and version returned by a host's provisioned Node runtime. */
|
|
39
|
+
export interface PreparedNodeRuntime {
|
|
40
|
+
/** Exact version that was provisioned and verified. */
|
|
41
|
+
version: string;
|
|
42
|
+
/** Environment that ensures `node` and `npm` resolve to this runtime. */
|
|
43
|
+
commandEnv: Record<string, string>;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Host-provided runtime implementation. `@webflow/cloud-app` never installs Node on
|
|
47
|
+
* its own; Cosmic can use NVM while other hosts provide a suitable adapter.
|
|
48
|
+
*/
|
|
49
|
+
export interface NodeRuntimePort {
|
|
50
|
+
prepare(toolchain: ResolvedNodeToolchain): Promise<PreparedNodeRuntime>;
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/toolchain/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,iEAAiE;AACjE,MAAM,MAAM,4BAA4B,GAAG,OAAO,GAAG,cAAc,GAAG,iBAAiB,GAAG,SAAS,CAAC;AAEpG;;;GAGG;AACH,MAAM,MAAM,uBAAuB,GACjC,UAAU,GAAG,SAAS,GAAG,SAAS,GAAG,aAAa,GAAG,cAAc,GAAG,aAAa,CAAC;AAEtF,8FAA8F;AAC9F,MAAM,WAAW,mBAAmB;IAClC,gEAAgE;IAChE,cAAc,EAAE,MAAM,CAAC;IACvB,wDAAwD;IACxD,iBAAiB,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,2DAA2D;IAC3D,oBAAoB,EAAE,SAAS,MAAM,EAAE,CAAC;CACzC;AAED,2DAA2D;AAC3D,MAAM,WAAW,qBAAqB;IACpC,iBAAiB,EAAE,4BAA4B,CAAC;IAChD,0FAA0F;IAC1F,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,4DAA4D;IAC5D,eAAe,EAAE,MAAM,CAAC;IACxB,2CAA2C;IAC3C,UAAU,EAAE,uBAAuB,CAAC;IACpC,2EAA2E;IAC3E,6BAA6B,CAAC,EAAE,SAAS,OAAO,CAAC,4BAA4B,EAAE,SAAS,CAAC,EAAE,CAAC;IAC5F,uEAAuE;IACvE,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,6EAA6E;AAC7E,MAAM,WAAW,mBAAmB;IAClC,uDAAuD;IACvD,OAAO,EAAE,MAAM,CAAC;IAChB,yEAAyE;IACzE,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACpC;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,OAAO,CAAC,SAAS,EAAE,qBAAqB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;CACzE"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Node runtime selection types.
|
|
4
|
+
*
|
|
5
|
+
* These are intentionally host-agnostic: the resolver determines what a
|
|
6
|
+
* project requests, while a host-provided runtime adapter decides how to make
|
|
7
|
+
* that version available.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/toolchain/types.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public types for the build engine.
|
|
3
|
+
*
|
|
4
|
+
* Framework / deployment vocabulary is re-used from
|
|
5
|
+
* `@webflow/cosmic-deploy-contract` so there's a single source of truth shared
|
|
6
|
+
* with the deployer — the engine never re-declares these.
|
|
7
|
+
*/
|
|
8
|
+
import type { Framework, DeploymentType, WebflowJsonV1 } from '@webflow/cosmic-deploy-contract';
|
|
9
|
+
import type { Logger, CommandRunner, Telemetry, FileSystemPort } from './ports';
|
|
10
|
+
/**
|
|
11
|
+
* Host-injected capabilities. `logger` and `runCommand` are required (every
|
|
12
|
+
* host has its own); `telemetry` and `fs` fall back to the no-op / node
|
|
13
|
+
* defaults when omitted.
|
|
14
|
+
*/
|
|
15
|
+
export interface BuildPorts {
|
|
16
|
+
logger: Logger;
|
|
17
|
+
runCommand: CommandRunner;
|
|
18
|
+
telemetry?: Telemetry;
|
|
19
|
+
fs?: FileSystemPort;
|
|
20
|
+
}
|
|
21
|
+
export interface BuildOptions {
|
|
22
|
+
/** The user's project root. Treated as read-only — never mutated in place. */
|
|
23
|
+
projectDir: string;
|
|
24
|
+
/** Where the worker-ready output (entry + assets + webflow.json) is emitted. */
|
|
25
|
+
outputDir: string;
|
|
26
|
+
/**
|
|
27
|
+
* Ephemeral build directory. The project is copied here, mutated, and built,
|
|
28
|
+
* leaving `projectDir` pristine. Defaults to a fresh temp directory.
|
|
29
|
+
*/
|
|
30
|
+
workspaceDir?: string;
|
|
31
|
+
/** URL mount path the app is served under (a.k.a. COSMIC_MOUNT_PATH). */
|
|
32
|
+
mountPath?: string;
|
|
33
|
+
/** Deploy URL, substituted into generated framework config where needed. */
|
|
34
|
+
deployUrl?: string;
|
|
35
|
+
/** Framework override; normally read from `webflow.json#cloud.framework`. */
|
|
36
|
+
frameworkHint?: Framework;
|
|
37
|
+
/** Extra environment variables made available to the build. */
|
|
38
|
+
env?: Record<string, string>;
|
|
39
|
+
/** Host-injected ports. */
|
|
40
|
+
ports: BuildPorts;
|
|
41
|
+
}
|
|
42
|
+
export interface BuildResult {
|
|
43
|
+
/** Detected framework (the contract's coarse vocabulary: astro | nextjs | vite). */
|
|
44
|
+
framework: Framework;
|
|
45
|
+
/** Deployment type the deployer uses to pick its wrangler template. */
|
|
46
|
+
deploymentType: DeploymentType;
|
|
47
|
+
/** Path to the bundled worker entry, relative to `outputDir`. */
|
|
48
|
+
entrypointPath: string;
|
|
49
|
+
/** The contract-validated webflow.json that was emitted. */
|
|
50
|
+
webflowJson: WebflowJsonV1;
|
|
51
|
+
/** Directory containing the worker entry, static assets, and webflow.json. */
|
|
52
|
+
outputDir: string;
|
|
53
|
+
}
|
|
54
|
+
export interface FrameworkDetection {
|
|
55
|
+
/** Detected framework (coarse vocabulary). */
|
|
56
|
+
framework: Framework;
|
|
57
|
+
/**
|
|
58
|
+
* Builder major when a framework ships incompatible majors the engine treats
|
|
59
|
+
* as distinct internally (e.g. Astro 5 vs 6). Undefined when not applicable.
|
|
60
|
+
*/
|
|
61
|
+
major?: number;
|
|
62
|
+
/** Human-readable explanation of how it was detected, for logging. */
|
|
63
|
+
reason: string;
|
|
64
|
+
}
|
|
65
|
+
export type { Framework, DeploymentType, WebflowJsonV1 } from '@webflow/cosmic-deploy-contract';
|
|
66
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAEhG,OAAO,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEhF;;;;GAIG;AACH,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,aAAa,CAAC;IAC1B,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,EAAE,CAAC,EAAE,cAAc,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC3B,8EAA8E;IAC9E,UAAU,EAAE,MAAM,CAAC;IACnB,gFAAgF;IAChF,SAAS,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,yEAAyE;IACzE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,4EAA4E;IAC5E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6EAA6E;IAC7E,aAAa,CAAC,EAAE,SAAS,CAAC;IAC1B,+DAA+D;IAC/D,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,2BAA2B;IAC3B,KAAK,EAAE,UAAU,CAAC;CACnB;AAED,MAAM,WAAW,WAAW;IAC1B,oFAAoF;IACpF,SAAS,EAAE,SAAS,CAAC;IACrB,uEAAuE;IACvE,cAAc,EAAE,cAAc,CAAC;IAC/B,iEAAiE;IACjE,cAAc,EAAE,MAAM,CAAC;IACvB,4DAA4D;IAC5D,WAAW,EAAE,aAAa,CAAC;IAC3B,8EAA8E;IAC9E,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,kBAAkB;IACjC,8CAA8C;IAC9C,SAAS,EAAE,SAAS,CAAC;IACrB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sEAAsE;IACtE,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,YAAY,EAAE,SAAS,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Logger } from '../ports';
|
|
2
|
+
export interface RecursiveCopyOptions {
|
|
3
|
+
/** Pattern(s) to exclude from copying (matched against the basename). */
|
|
4
|
+
exclude?: string | string[];
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Recursively copy directory contents.
|
|
8
|
+
*
|
|
9
|
+
* @returns Number of files copied.
|
|
10
|
+
*/
|
|
11
|
+
export declare function recursiveCopy(log: Logger, src: string, dest: string, options?: RecursiveCopyOptions): number;
|
|
12
|
+
/** Check if a file exists. */
|
|
13
|
+
export declare function fileExists(filePath: string): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Match a basename against a simple glob pattern where `*` matches any run of
|
|
16
|
+
* non-`/` characters. A pattern without `*` is an exact-name match. Used by the
|
|
17
|
+
* static builder's asset-exclusion policy.
|
|
18
|
+
*/
|
|
19
|
+
export declare function matchesExcludePattern(name: string, pattern: string): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Rename a user config file to a `clouduser.*` prefix.
|
|
22
|
+
*
|
|
23
|
+
* Searches for a config file with the given base name and extensions, renaming
|
|
24
|
+
* the first found to `clouduser.{baseName}.{ext}`.
|
|
25
|
+
*
|
|
26
|
+
* @returns Path to the renamed file, or null if no config found.
|
|
27
|
+
*/
|
|
28
|
+
export declare function renameUserConfig(log: Logger, cwd: string, baseName: string, extensions: string[]): string | null;
|
|
29
|
+
//# sourceMappingURL=fs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fs.d.ts","sourceRoot":"","sources":["../../src/utils/fs.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC,MAAM,WAAW,oBAAoB;IACnC,yEAAyE;IACzE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAC7B;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAC3B,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,oBAAoB,GAC7B,MAAM,CAqCR;AAED,8BAA8B;AAC9B,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAEpD;AAOD;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAM5E;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAAE,GACnB,MAAM,GAAG,IAAI,CAWf"}
|