@coreframe/config 0.1.15-next.2 → 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.
- package/dist/environment.d.ts +1 -0
- package/dist/environment.js +1 -1
- package/dist/index.d.ts +29 -2
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/environment.d.ts
CHANGED
package/dist/environment.js
CHANGED
|
@@ -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
|
@@ -11,9 +11,36 @@ type CoreframeConfig = {
|
|
|
11
11
|
i18n?: I18nConfig; /** Local development job inspection and reset settings. */
|
|
12
12
|
jobs?: JobsConfig; /** Flutter host integration settings. */
|
|
13
13
|
flutter?: FlutterConfig; /** Local preview server and tunnel settings. */
|
|
14
|
-
preview?: PreviewConfig; /**
|
|
14
|
+
preview?: PreviewConfig; /** Optional external secret source used by project workflows. */
|
|
15
|
+
secrets?: SecretsConfig; /** Worker build and runtime settings. */
|
|
15
16
|
worker?: WorkerConfig;
|
|
16
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>;
|
|
17
44
|
type ExtensionStore = "chrome" | "edge" | "firefox";
|
|
18
45
|
type ExtensionConfig = {
|
|
19
46
|
/** WXT project used for builds and store operations. */wxt: {
|
|
@@ -242,4 +269,4 @@ declare function readProjectConfig({
|
|
|
242
269
|
declare function importProjectModule<T>(path: string, cwd?: string): Promise<T>;
|
|
243
270
|
declare function importProjectDependency<T>(specifier: string, cwd?: string): Promise<T>;
|
|
244
271
|
//#endregion
|
|
245
|
-
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, 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
|
|
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};
|