@coreframe/config 0.1.15-next.1 → 0.1.15-next.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.
@@ -6,6 +6,7 @@ declare const fs: {
6
6
  };
7
7
  declare const process: {
8
8
  cwd: () => string;
9
+ env: NodeJS.ProcessEnv;
9
10
  };
10
11
  //#endregion
11
12
  export { fs, process };
@@ -1 +1 @@
1
- import{stat as e}from"node:fs/promises";import t from"node:process";const n={stat:e},r={cwd:t.cwd.bind(t)};export{n as fs,r as process};
1
+ import{stat as e}from"node:fs/promises";import t from"node:process";const n={stat:e},r={cwd:t.cwd.bind(t),env:t.env};export{n as fs,r as process};
package/dist/index.d.ts CHANGED
@@ -5,14 +5,62 @@ type CoreframeConfig = {
5
5
  /** Object storage and public asset delivery settings. */assets?: AssetsConfig; /** Responsive layout breakpoints in logical CSS pixels. */
6
6
  breakpoints?: BreakpointsConfig; /** Database settings used by local and deployment workflows. */
7
7
  database?: DatabaseConfig; /** Deployment hooks, environments, checks, and release settings. */
8
- deploy?: DeployConfig; /** Local development settings. */
8
+ deploy?: DeployConfig; /** Explicitly enabled browser-extension lifecycle. */
9
+ extension?: ExtensionConfig; /** Local development settings. */
9
10
  dev?: DevConfig; /** Translation catalog and locale settings. */
10
11
  i18n?: I18nConfig; /** Local development job inspection and reset settings. */
11
12
  jobs?: JobsConfig; /** Flutter host integration settings. */
12
13
  flutter?: FlutterConfig; /** Local preview server and tunnel settings. */
13
- preview?: PreviewConfig; /** Worker build and runtime settings. */
14
+ preview?: PreviewConfig; /** Optional external secret source used by project workflows. */
15
+ secrets?: SecretsConfig; /** Worker build and runtime settings. */
14
16
  worker?: WorkerConfig;
15
17
  };
18
+ declare const secretResolutionTargets: readonly ["development", "preview", "staging", "production"];
19
+ type SecretResolutionTarget = (typeof secretResolutionTargets)[number];
20
+ type SecretResolutionContext = {
21
+ /** Project directory whose workflow is resolving secrets. */cwd: string; /** Environment inherited by the Coreframe workflow. */
22
+ env: NodeJS.ProcessEnv; /** Lifecycle environment being resolved. */
23
+ target: SecretResolutionTarget;
24
+ };
25
+ type SecretsAdapter = {
26
+ /** Stable provider identifier used in value-free diagnostics. */id: string; /** Fetches one fresh target-specific snapshot. */
27
+ resolve(context: SecretResolutionContext): Promise<Record<string, string>>;
28
+ };
29
+ type SecretsConfig = {
30
+ /** External secret provider used by Coreframe workflows. */adapter: SecretsAdapter;
31
+ };
32
+ /** Resolves and validates one fresh provider snapshot when a project has opted in. */
33
+ declare function resolveProjectSecrets({
34
+ config,
35
+ cwd,
36
+ env,
37
+ target
38
+ }: {
39
+ config: CoreframeConfig;
40
+ cwd?: string;
41
+ env?: NodeJS.ProcessEnv;
42
+ target: SecretResolutionTarget;
43
+ }): Promise<Record<string, string> | undefined>;
44
+ type ExtensionStore = "chrome" | "edge" | "firefox";
45
+ type ExtensionConfig = {
46
+ /** WXT project used for builds and store operations. */wxt: {
47
+ /** Project-relative WXT configuration file. */config: string; /** Directory in which WXT writes extension and source ZIPs. */
48
+ outputDirectory?: string;
49
+ }; /** Stores enabled for this extension. Omitted stores are never contacted. */
50
+ stores: {
51
+ chrome?: {
52
+ extensionId?: string;
53
+ publisherId?: string;
54
+ };
55
+ edge?: {
56
+ productId?: string;
57
+ };
58
+ firefox?: {
59
+ channel?: "listed" | "unlisted";
60
+ extensionId?: string;
61
+ };
62
+ };
63
+ };
16
64
  /** Named responsive layout breakpoints shared by Panda, web, and Flutter. */
17
65
  type BreakpointsConfig = Readonly<{
18
66
  "2xl": number;
@@ -49,9 +97,21 @@ type AssetsConfig = {
49
97
  };
50
98
  type DatabaseDialect = "postgres" | "sqlite";
51
99
  type DatabaseConfig = {
52
- /** Database engine used by project workflows. */dialect: DatabaseDialect; /** Project-relative module that seeds the database. */
100
+ /** Database engine used by project workflows. */dialect: DatabaseDialect; /** Explicit credential references for standalone and deploy-time database migrations. */
101
+ environments?: Partial<Record<"staging" | "production", DatabaseEnvironmentConfig>>; /** Project-relative module that seeds the database. */
53
102
  seed?: string;
54
103
  };
104
+ type DatabaseEnvironmentConfig = {
105
+ /** Environment variable containing the database URL. */urlEnv: string; /** Environment variable containing the libSQL authentication token. */
106
+ authTokenEnv?: string; /** PostgreSQL TLS options. URL query parameters remain supported. */
107
+ tls?: boolean | DatabaseTlsConfig;
108
+ };
109
+ type DatabaseTlsConfig = {
110
+ caEnv?: string;
111
+ certEnv?: string;
112
+ keyEnv?: string;
113
+ rejectUnauthorized?: boolean;
114
+ };
55
115
  type JobsConfig = {
56
116
  /** Project-relative module exporting the local development job administration contract. */entry: string;
57
117
  };
@@ -209,4 +269,4 @@ declare function readProjectConfig({
209
269
  declare function importProjectModule<T>(path: string, cwd?: string): Promise<T>;
210
270
  declare function importProjectDependency<T>(specifier: string, cwd?: string): Promise<T>;
211
271
  //#endregion
212
- export { AssetsConfig, BreakpointsConfig, CoreframeConfig, DatabaseConfig, DatabaseDialect, DeployConfig, DeployContext, DeployEnvironment, DeployEnvironmentConfig, DeployMode, DeploySmokeCheck, DevConfig, DevPlatform, FlutterConfig, FlutterDeepLinkConfig, I18nConfig, JobsConfig, 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 };
272
+ export { AssetsConfig, BreakpointsConfig, CoreframeConfig, DatabaseConfig, DatabaseDialect, DatabaseEnvironmentConfig, DatabaseTlsConfig, DeployConfig, DeployContext, DeployEnvironment, DeployEnvironmentConfig, DeployMode, DeploySmokeCheck, DevConfig, DevPlatform, ExtensionConfig, ExtensionStore, FlutterConfig, FlutterDeepLinkConfig, I18nConfig, JobsConfig, JsonObject, JsonValue, PreviewAccessBypassConfig, PreviewAccessConfig, PreviewAccessIpContext, PreviewAccessIpResolver, PreviewConfig, PreviewTunnelConfig, PreviewWorkerConfig, PrimaryWorkerContributions, PrimaryWorkerEnvironment, SecretResolutionContext, SecretResolutionTarget, SecretsAdapter, SecretsConfig, StagingHostnameConfig, WorkerConfig, WorkerDeployEnvironment, WorkerEnvironmentDeclaration, WorkerEnvironmentKind, WorkerEnvironmentVariableConfig, WranglerConfig, breakpointNames, coreframeGeneratedWorkerVariables, coreframeLocalWorkerVariables, coreframeManagedWorkerSecrets, defineConfig, derivePrimaryWorkerConfig, importProjectDependency, importProjectModule, normalizeWorkerEnvironment, primaryWorkerConfigPath, primaryWorkerEnvironments, readProjectBreakpoints, readProjectConfig, resolveProjectSecrets, secretResolutionTargets, 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";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};
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=[`development`,`preview`,`staging`,`production`],g=/^[A-Z][A-Z0-9_]*$/,_=new Set([`COREFRAME_ACCESS_TOKEN_SECRET`,`COREFRAME_LOCAL_POSTGRES`,`COREFRAME_LOCAL_TURSO`,`DOPPLER_TOKEN`]);async function v({config:e,cwd:n=t.cwd(),env:r=t.env,target:i}){let a=e.secrets?.adapter;if(!a)return;if(!a.id?.trim()||typeof a.resolve!=`function`)throw Error(`coreframe.config.ts secrets.adapter must define an id and resolve function.`);let o=await a.resolve({cwd:n,env:r,target:i});if(typeof o!=`object`||!o||Array.isArray(o)||!Object.entries(o).every(([e,t])=>g.test(e)&&typeof t==`string`))throw Error(`${a.id} returned an invalid ${i} secret snapshot.`);let s=Object.keys(o).filter(e=>_.has(e));if(s.length>0)throw Error(`${a.id} returned framework-owned or provider authentication values: ${s.sort().join(`, `)}.`);let c=Object.entries(e.worker?.environment??{}).filter(([e,t])=>e.startsWith(`VITE_`)&&t.kind===`secret`&&o[e]!==void 0).map(([e])=>e);if(c.length>0)throw Error(`Provider Worker secrets cannot use the public VITE_ prefix: ${c.sort().join(`, `)}.`);return{...o}}const y=[`sm`,`md`,`lg`,`xl`,`2xl`];function b(e){return e.breakpoints!==void 0&&x(e.breakpoints),e}function x(e){if(!C(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=[...y].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 y){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 S({cwd:e=t.cwd()}={}){let n=await w({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 x(n.breakpoints)}function C(e){return!!(e&&typeof e==`object`&&!Array.isArray(e))}async function w({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 T(e,n=t.cwd()){return await import(p(f(n,e)).href)}async function E(e,n=t.cwd()){return await import(m(e,p(f(n,`package.json`)).href))}export{y as breakpointNames,n as coreframeGeneratedWorkerVariables,r as coreframeLocalWorkerVariables,i as coreframeManagedWorkerSecrets,b as defineConfig,a as derivePrimaryWorkerConfig,E as importProjectDependency,T as importProjectModule,o as normalizeWorkerEnvironment,s as primaryWorkerConfigPath,c as primaryWorkerEnvironments,S as readProjectBreakpoints,w as readProjectConfig,v as resolveProjectSecrets,h as secretResolutionTargets,x 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.15-next.1",
3
+ "version": "0.1.15-next.3",
4
4
  "description": "Environment and project configuration utilities for Coreframe apps",
5
5
  "repository": {
6
6
  "type": "git",