@coreframe/config 0.3.2 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dev-services.d.ts +4 -1
- package/dist/dev-services.js +1 -1
- package/dist/index.d.ts +4 -7
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/dev-services.d.ts
CHANGED
|
@@ -13,5 +13,8 @@ type DevServiceConfig = {
|
|
|
13
13
|
};
|
|
14
14
|
/** Internal environment transport from the dev command to the local Worker configuration. */
|
|
15
15
|
declare const devServiceWorkerBindingsEnv = "COREFRAME_DEV_SERVICE_WORKER_BINDINGS";
|
|
16
|
+
declare const devServiceDefaultReadinessTimeoutMs = 10000;
|
|
17
|
+
/** Validates configured service commands, readiness, and Worker binding names. */
|
|
18
|
+
declare function validateDevServices(services: Readonly<Record<string, DevServiceConfig>> | undefined): [string, DevServiceConfig][];
|
|
16
19
|
//#endregion
|
|
17
|
-
export { DevServiceConfig, devServiceWorkerBindingsEnv };
|
|
20
|
+
export { DevServiceConfig, devServiceDefaultReadinessTimeoutMs, devServiceWorkerBindingsEnv, validateDevServices };
|
package/dist/dev-services.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
import{coreframeGeneratedWorkerVariables as e,coreframeLocalWorkerVariables as t,coreframeManagedWorkerSecrets as n}from"./worker.js";const r=`COREFRAME_DEV_SERVICE_WORKER_BINDINGS`,i=1e4;function a(r){if(!r||typeof r!=`object`||Array.isArray(r))throw Error(`dev.services must be an object keyed by service name.`);let i=Object.entries(r),a=new Set([...e,...t,...n,`DATABASE_URL`]);for(let[e,t]of i){if(!/^[a-zA-Z0-9][a-zA-Z0-9_-]*$/.test(e))throw Error(`Invalid dev service name ${JSON.stringify(e)}.`);if(!t||t.start!==`on-connect`||typeof t.command!=`string`||!t.command.trim()||t.command.includes(`\0`)||!Array.isArray(t.args)||!t.args.every(e=>typeof e==`string`&&!e.includes(`\0`))||!t.args.some(e=>e.includes(`{port}`)))throw Error(`dev.services.${e} requires start: "on-connect", a command, and args containing {port}.`);let n=t.readinessTimeoutMs??1e4;if(!Number.isInteger(n)||n<1||n>12e4)throw Error(`dev.services.${e}.readinessTimeoutMs must be an integer from 1 through 120000.`);let r=t.workerEnv;if(r!==void 0){if(!r||typeof r.name!=`string`||!/^[A-Z][A-Z0-9_]*$/.test(r.name)||![`tcp`,`http`,`https`,`ws`,`wss`].includes(r.protocol)||r.path!==void 0&&(typeof r.path!=`string`||!r.path.startsWith(`/`)))throw Error(`Invalid dev.services.${e}.workerEnv. Specify an uppercase name, a supported protocol, and optionally a path starting with /.`);if(a.has(r.name))throw Error(`dev.services.${e}.workerEnv name "${r.name}" is already in use by development.`);a.add(r.name)}}return i}export{i as devServiceDefaultReadinessTimeoutMs,r as devServiceWorkerBindingsEnv,a as validateDevServices};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DevServiceConfig, devServiceWorkerBindingsEnv } from "./dev-services.js";
|
|
1
|
+
import { DevServiceConfig, devServiceDefaultReadinessTimeoutMs, devServiceWorkerBindingsEnv, validateDevServices } from "./dev-services.js";
|
|
2
2
|
import { JsonObject, JsonValue, PrimaryWorkerContributions, PrimaryWorkerEnvironment, WorkerConfig, WorkerDeployEnvironment, WorkerEnvironmentDeclaration, WorkerEnvironmentKind, WorkerEnvironmentVariableConfig, WranglerConfig, coreframeGeneratedWorkerVariables, coreframeLocalWorkerVariables, coreframeManagedWorkerSecrets, derivePrimaryWorkerConfig, normalizeWorkerEnvironment, primaryWorkerConfigPath, primaryWorkerEnvironments, validateWorkerInventoryOwnership, workerBindingNames, wranglerEnvironmentNames } from "./worker.js";
|
|
3
3
|
|
|
4
4
|
//#region src/index.d.ts
|
|
@@ -42,11 +42,8 @@ type AssetsConfig = {
|
|
|
42
42
|
sourceBucket: string;
|
|
43
43
|
};
|
|
44
44
|
type DashboardConfig = {
|
|
45
|
-
/** Whether the project builds, develops, and deploys the Coreframe dashboard. Defaults to true. */enabled?: boolean;
|
|
46
|
-
/**
|
|
47
|
-
* Development router. Client mode requires the dashboard's client-compatible route contract.
|
|
48
|
-
* Defaults to framework.
|
|
49
|
-
*/
|
|
45
|
+
/** Whether the project builds, develops, and deploys the Coreframe dashboard. Defaults to true. */enabled?: boolean; /** Router for dashboard development and builds. Defaults to "client". */
|
|
46
|
+
router?: "framework" | "client"; /** @deprecated Use `router` to select the dashboard router. */
|
|
50
47
|
devRouter?: "framework" | "client";
|
|
51
48
|
};
|
|
52
49
|
type DatabaseDialect = "postgres" | "sqlite";
|
|
@@ -256,4 +253,4 @@ declare function readProjectConfig({
|
|
|
256
253
|
declare function importProjectModule<T>(path: string, cwd?: string): Promise<T>;
|
|
257
254
|
declare function importProjectDependency<T>(specifier: string, cwd?: string): Promise<T>;
|
|
258
255
|
//#endregion
|
|
259
|
-
export { AssetsConfig, BreakpointsConfig, CoreframeConfig, DashboardConfig, DatabaseConfig, DatabaseDialect, DeployConfig, DeployContext, DeployEnvironment, DeployEnvironmentConfig, DeployMode, DeploySmokeCheck, DevConfig, DevPlatform, DevServiceConfig, I18nConfig, JobsConfig, JsonObject, JsonValue, PreviewAccessBypassConfig, PreviewAccessConfig, PreviewAccessIpContext, PreviewAccessIpResolver, PreviewConfig, PreviewTunnelConfig, PreviewWorkerConfig, PrimaryWorkerContributions, PrimaryWorkerEnvironment, ReviewerDeployContext, ReviewerDeployModule, StagingHostnameConfig, WorkerConfig, WorkerDeployEnvironment, WorkerEnvironmentDeclaration, WorkerEnvironmentKind, WorkerEnvironmentVariableConfig, WranglerConfig, breakpointNames, coreframeGeneratedWorkerVariables, coreframeLocalWorkerVariables, coreframeManagedWorkerSecrets, defineConfig, derivePrimaryWorkerConfig, devServiceWorkerBindingsEnv, importProjectDependency, importProjectModule, normalizeWorkerEnvironment, primaryWorkerConfigPath, primaryWorkerEnvironments, readProjectBreakpoints, readProjectConfig, validateBreakpoints, validateWorkerInventoryOwnership, workerBindingNames, wranglerEnvironmentNames };
|
|
256
|
+
export { AssetsConfig, BreakpointsConfig, CoreframeConfig, DashboardConfig, DatabaseConfig, DatabaseDialect, DeployConfig, DeployContext, DeployEnvironment, DeployEnvironmentConfig, DeployMode, DeploySmokeCheck, DevConfig, DevPlatform, DevServiceConfig, I18nConfig, JobsConfig, JsonObject, JsonValue, PreviewAccessBypassConfig, PreviewAccessConfig, PreviewAccessIpContext, PreviewAccessIpResolver, PreviewConfig, PreviewTunnelConfig, PreviewWorkerConfig, PrimaryWorkerContributions, PrimaryWorkerEnvironment, ReviewerDeployContext, ReviewerDeployModule, StagingHostnameConfig, WorkerConfig, WorkerDeployEnvironment, WorkerEnvironmentDeclaration, WorkerEnvironmentKind, WorkerEnvironmentVariableConfig, WranglerConfig, breakpointNames, coreframeGeneratedWorkerVariables, coreframeLocalWorkerVariables, coreframeManagedWorkerSecrets, defineConfig, derivePrimaryWorkerConfig, devServiceDefaultReadinessTimeoutMs, devServiceWorkerBindingsEnv, importProjectDependency, importProjectModule, normalizeWorkerEnvironment, primaryWorkerConfigPath, primaryWorkerEnvironments, readProjectBreakpoints, readProjectConfig, validateBreakpoints, validateDevServices, validateWorkerInventoryOwnership, workerBindingNames, wranglerEnvironmentNames };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{coreframeGeneratedWorkerVariables as e,coreframeLocalWorkerVariables as t,coreframeManagedWorkerSecrets as n,derivePrimaryWorkerConfig as r,normalizeWorkerEnvironment as i,primaryWorkerConfigPath as a,primaryWorkerEnvironments as o,validateWorkerInventoryOwnership as s,workerBindingNames as c,wranglerEnvironmentNames as l}from"./worker.js";import{devServiceDefaultReadinessTimeoutMs as u,devServiceWorkerBindingsEnv as d,validateDevServices as f}from"./dev-services.js";import{fs as p,process as m}from"./environment.js";import{resolve as h}from"node:path";import{pathToFileURL as g}from"node:url";import{resolve as _}from"import-meta-resolve";const v=[`sm`,`md`,`lg`,`xl`,`2xl`];function y(e){return e.breakpoints!==void 0&&b(e.breakpoints),e}function b(e){if(!S(e))throw Error(`coreframe.config.ts must configure breakpoints.sm, md, lg, xl, and 2xl as positive finite numbers.`);let t=Object.keys(e).sort(),n=[...v].sort();if(t.length!==n.length||t.some((e,t)=>e!==n[t]))throw Error(`coreframe.config.ts breakpoints must contain only sm, md, lg, xl, and 2xl.`);let r=0;for(let t of v){let n=e[t];if(typeof n!=`number`||!Number.isFinite(n)||n<=0)throw Error(`coreframe.config.ts breakpoints.${t} must be a positive finite number of logical pixels.`);if(n<=r)throw Error(`coreframe.config.ts breakpoints must increase strictly from sm through 2xl; breakpoints.${t} is not greater than the preceding value.`);r=n}return e}async function x({cwd:e=m.cwd()}={}){let t=await C({cwd:e});if(t.breakpoints===void 0)throw Error(`coreframe.config.ts must configure breakpoints.sm, md, lg, xl, and 2xl as positive finite numbers.`);return b(t.breakpoints)}function S(e){return!!(e&&typeof e==`object`&&!Array.isArray(e))}async function C({cwd:e=m.cwd()}={}){let t=h(e,`coreframe.config.ts`),n;try{n=(await p.stat(t,{bigint:!0})).mtimeNs}catch{return{}}let r=g(t);return r.searchParams.set(`modified`,n.toString()),(await import(r.href)).default??{}}async function w(e,t=m.cwd()){return await import(g(h(t,e)).href)}async function T(e,t=m.cwd()){return await import(_(e,g(h(t,`package.json`)).href))}export{v as breakpointNames,e as coreframeGeneratedWorkerVariables,t as coreframeLocalWorkerVariables,n as coreframeManagedWorkerSecrets,y as defineConfig,r as derivePrimaryWorkerConfig,u as devServiceDefaultReadinessTimeoutMs,d as devServiceWorkerBindingsEnv,T as importProjectDependency,w as importProjectModule,i as normalizeWorkerEnvironment,a as primaryWorkerConfigPath,o as primaryWorkerEnvironments,x as readProjectBreakpoints,C as readProjectConfig,b as validateBreakpoints,f as validateDevServices,s as validateWorkerInventoryOwnership,c as workerBindingNames,l as wranglerEnvironmentNames};
|