@coreframe/config 0.1.10 → 0.1.12

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/index.d.ts CHANGED
@@ -2,7 +2,8 @@ import { JsonObject, JsonValue, PrimaryWorkerContributions, PrimaryWorkerEnviron
2
2
 
3
3
  //#region src/index.d.ts
4
4
  type CoreframeConfig = {
5
- /** Object storage and public asset delivery settings. */assets?: AssetsConfig; /** Database settings used by local and deployment workflows. */
5
+ /** Object storage and public asset delivery settings. */assets?: AssetsConfig; /** Responsive layout breakpoints in logical CSS pixels. */
6
+ breakpoints?: BreakpointsConfig; /** Database settings used by local and deployment workflows. */
6
7
  database?: DatabaseConfig; /** Deployment hooks, environments, checks, and release settings. */
7
8
  deploy?: DeployConfig; /** Local development settings. */
8
9
  dev?: DevConfig; /** Translation catalog and locale settings. */
@@ -11,6 +12,24 @@ type CoreframeConfig = {
11
12
  preview?: PreviewConfig; /** Worker build and runtime settings. */
12
13
  worker?: WorkerConfig;
13
14
  };
15
+ /** Named responsive layout breakpoints shared by Panda, web, and Flutter. */
16
+ type BreakpointsConfig = Readonly<{
17
+ "2xl": number;
18
+ lg: number;
19
+ md: number;
20
+ sm: number;
21
+ xl: number;
22
+ }>;
23
+ declare const breakpointNames: readonly ["sm", "md", "lg", "xl", "2xl"];
24
+ declare function defineConfig(config: CoreframeConfig): CoreframeConfig;
25
+ /** Validates and returns the project's required breakpoint contract. */
26
+ declare function validateBreakpoints(value: unknown): BreakpointsConfig;
27
+ /** Loads and validates the project's required breakpoint contract. */
28
+ declare function readProjectBreakpoints({
29
+ cwd
30
+ }?: {
31
+ cwd?: string;
32
+ }): Promise<BreakpointsConfig>;
14
33
  type FlutterConfig = {
15
34
  /** Custom URL origin accepted for navigation into the Flutter app. */deepLink: FlutterDeepLinkConfig;
16
35
  };
@@ -42,6 +61,23 @@ type PreviewTunnelConfig = {
42
61
  name: string; /** Credential profile used to manage the tunnel. */
43
62
  profile: string;
44
63
  };
64
+ type PreviewAccessIpContext = {
65
+ /** Exact HTTPS origin configured for the preview application. */appOrigin: string; /** Public hostname assigned to the preview tunnel. */
66
+ hostname: string; /** Identity of the Coreframe-managed preview tunnel. */
67
+ tunnel: {
68
+ name: string;
69
+ profile: string;
70
+ };
71
+ };
72
+ type PreviewAccessIpResolver = (context: PreviewAccessIpContext) => string | readonly string[] | Promise<string | readonly string[]>;
73
+ type PreviewAccessBypassConfig = {
74
+ /** Name of the application policy Coreframe creates or updates. */policyName?: string; /** One or more IPv4/IPv6 addresses or CIDR ranges, or a resolver evaluated at preview startup. */
75
+ ips: string | readonly string[] | PreviewAccessIpResolver;
76
+ };
77
+ type PreviewAccessConfig = {
78
+ /** Existing self-hosted Cloudflare Access application UUID. */applicationId?: string; /** Access policy used to bypass authentication for the resolved client IP ranges. */
79
+ bypass: PreviewAccessBypassConfig;
80
+ };
45
81
  type PreviewConfig = {
46
82
  /** Exact HTTPS origin used by browser-facing application URLs. */appOrigin?: string; /** Network interface on which the local preview server listens. */
47
83
  host?: string; /** TCP port on which the local preview server listens. */
@@ -63,7 +99,8 @@ type PreviewConfig = {
63
99
  * },
64
100
  * })
65
101
  */
66
- tunnel?: PreviewTunnelConfig; /** Worker bindings supplied during preview. */
102
+ tunnel?: PreviewTunnelConfig; /** Optional Cloudflare Access policy for a public preview tunnel. */
103
+ access?: PreviewAccessConfig; /** Worker bindings supplied during preview. */
67
104
  worker?: PreviewWorkerConfig;
68
105
  };
69
106
  type PreviewWorkerConfig = {
@@ -161,7 +198,6 @@ type DeployConfig = {
161
198
  */
162
199
  stagingHostname?: StagingHostnameConfig;
163
200
  };
164
- declare function defineConfig(config: CoreframeConfig): CoreframeConfig;
165
201
  declare function readProjectConfig({
166
202
  cwd
167
203
  }?: {
@@ -170,4 +206,4 @@ declare function readProjectConfig({
170
206
  declare function importProjectModule<T>(path: string, cwd?: string): Promise<T>;
171
207
  declare function importProjectDependency<T>(specifier: string, cwd?: string): Promise<T>;
172
208
  //#endregion
173
- export { AssetsConfig, CoreframeConfig, DatabaseConfig, DatabaseDialect, DeployConfig, DeployContext, DeployEnvironment, DeployEnvironmentConfig, DeployMode, DeploySmokeCheck, DevConfig, DevPlatform, FlutterConfig, FlutterDeepLinkConfig, I18nConfig, JsonObject, JsonValue, PreviewConfig, PreviewTunnelConfig, PreviewWorkerConfig, PrimaryWorkerContributions, PrimaryWorkerEnvironment, StagingHostnameConfig, WorkerConfig, WorkerDeployEnvironment, WorkerEnvironmentDeclaration, WorkerEnvironmentKind, WorkerEnvironmentVariableConfig, WranglerConfig, coreframeGeneratedWorkerVariables, coreframeLocalWorkerVariables, coreframeManagedWorkerSecrets, defineConfig, derivePrimaryWorkerConfig, importProjectDependency, importProjectModule, normalizeWorkerEnvironment, primaryWorkerConfigPath, primaryWorkerEnvironments, readProjectConfig, validateWorkerInventoryOwnership, workerBindingNames, wranglerEnvironmentNames };
209
+ export { AssetsConfig, BreakpointsConfig, CoreframeConfig, DatabaseConfig, DatabaseDialect, DeployConfig, DeployContext, DeployEnvironment, DeployEnvironmentConfig, DeployMode, DeploySmokeCheck, DevConfig, DevPlatform, FlutterConfig, FlutterDeepLinkConfig, I18nConfig, JsonObject, JsonValue, PreviewAccessBypassConfig, PreviewAccessConfig, PreviewAccessIpContext, PreviewAccessIpResolver, PreviewConfig, PreviewTunnelConfig, PreviewWorkerConfig, PrimaryWorkerContributions, PrimaryWorkerEnvironment, StagingHostnameConfig, WorkerConfig, WorkerDeployEnvironment, WorkerEnvironmentDeclaration, WorkerEnvironmentKind, WorkerEnvironmentVariableConfig, WranglerConfig, breakpointNames, coreframeGeneratedWorkerVariables, coreframeLocalWorkerVariables, coreframeManagedWorkerSecrets, defineConfig, derivePrimaryWorkerConfig, importProjectDependency, importProjectModule, normalizeWorkerEnvironment, primaryWorkerConfigPath, primaryWorkerEnvironments, readProjectBreakpoints, readProjectConfig, validateBreakpoints, validateWorkerInventoryOwnership, workerBindingNames, wranglerEnvironmentNames };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{fs as e,process as t}from"./environment.js";import{coreframeGeneratedWorkerVariables as n,coreframeLocalWorkerVariables as r,coreframeManagedWorkerSecrets as i,derivePrimaryWorkerConfig as a,normalizeWorkerEnvironment as o,primaryWorkerConfigPath as s,primaryWorkerEnvironments as c,validateWorkerInventoryOwnership as l,workerBindingNames as u,wranglerEnvironmentNames as d}from"./worker.js";import{resolve as f}from"node:path";import{pathToFileURL as p}from"node:url";import{resolve as m}from"import-meta-resolve";function h(e){return e}async function g({cwd:n=t.cwd()}={}){let r=f(n,`coreframe.config.ts`),i;try{i=(await e.stat(r,{bigint:!0})).mtimeNs}catch{return{}}let a=p(r);return a.searchParams.set(`modified`,i.toString()),(await import(a.href)).default??{}}async function _(e,n=t.cwd()){return await import(p(f(n,e)).href)}async function v(e,n=t.cwd()){return await import(m(e,p(f(n,`package.json`)).href))}export{n as coreframeGeneratedWorkerVariables,r as coreframeLocalWorkerVariables,i as coreframeManagedWorkerSecrets,h as defineConfig,a as derivePrimaryWorkerConfig,v as importProjectDependency,_ as importProjectModule,o as normalizeWorkerEnvironment,s as primaryWorkerConfigPath,c as primaryWorkerEnvironments,g as readProjectConfig,l as validateWorkerInventoryOwnership,u as workerBindingNames,d as wranglerEnvironmentNames};
1
+ import{fs as e,process as t}from"./environment.js";import{coreframeGeneratedWorkerVariables as n,coreframeLocalWorkerVariables as r,coreframeManagedWorkerSecrets as i,derivePrimaryWorkerConfig as a,normalizeWorkerEnvironment as o,primaryWorkerConfigPath as s,primaryWorkerEnvironments as c,validateWorkerInventoryOwnership as l,workerBindingNames as u,wranglerEnvironmentNames as d}from"./worker.js";import{resolve as f}from"node:path";import{pathToFileURL as p}from"node:url";import{resolve as m}from"import-meta-resolve";const h=[`sm`,`md`,`lg`,`xl`,`2xl`];function g(e){return e.breakpoints!==void 0&&_(e.breakpoints),e}function _(e){if(!y(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=[...h].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 h){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 v({cwd:e=t.cwd()}={}){let n=await b({cwd:e});if(n.breakpoints===void 0)throw Error(`coreframe.config.ts must configure breakpoints.sm, md, lg, xl, and 2xl as positive finite numbers.`);return _(n.breakpoints)}function y(e){return!!(e&&typeof e==`object`&&!Array.isArray(e))}async function b({cwd:n=t.cwd()}={}){let r=f(n,`coreframe.config.ts`),i;try{i=(await e.stat(r,{bigint:!0})).mtimeNs}catch{return{}}let a=p(r);return a.searchParams.set(`modified`,i.toString()),(await import(a.href)).default??{}}async function x(e,n=t.cwd()){return await import(p(f(n,e)).href)}async function S(e,n=t.cwd()){return await import(m(e,p(f(n,`package.json`)).href))}export{h as breakpointNames,n as coreframeGeneratedWorkerVariables,r as coreframeLocalWorkerVariables,i as coreframeManagedWorkerSecrets,g as defineConfig,a as derivePrimaryWorkerConfig,S as importProjectDependency,x as importProjectModule,o as normalizeWorkerEnvironment,s as primaryWorkerConfigPath,c as primaryWorkerEnvironments,v as readProjectBreakpoints,b as readProjectConfig,_ as validateBreakpoints,l as validateWorkerInventoryOwnership,u as workerBindingNames,d as wranglerEnvironmentNames};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coreframe/config",
3
- "version": "0.1.10",
3
+ "version": "0.1.12",
4
4
  "description": "Environment and project configuration utilities for Coreframe apps",
5
5
  "repository": {
6
6
  "type": "git",