@neon/config-runtime
v1.6.2
Published
Imperative runtime for @neon/config: inspect/plan/apply a neon.ts policy against the Neon API and bundle + deploy Neon Functions. Pulls in esbuild; import this from CLIs and CI, not from neon.ts.
Readme
@neon/config-runtime
Imperative runtime for @neon/config: run a neon.ts policy against the Neon API — inspect, plan, apply (push/pull) — and bundle + deploy Neon Functions.
This package pulls in
esbuild, so import it from your CLI or CI — not from aneon.tspolicy. Keep policies side-effect-free; that's what@neon/configis for. New code should import from@neon/config-runtime/v1to pin a major.
Install
npm install @neon/config-runtimeRequirements: Node.js >= 20.19.
API
inspect/plan/apply— read the current branch state, diff a policy against it, and apply the changes.PushResult.customDomainslists declared hostnames withslugand, after apply,cnameTarget. StaticcustomDomainsapply only on the default branch; see@neon/config.pullConfig/pushConfig— lower-level pull/push primitives.createBranch— create a branch to target.buildFunctionBundle— ZIP a function for deploy, honoringbundler. Omit /"esbuild": a filesourceis the entry; a directory is searched forindex.ts, thenindex.js, thenindex.mjs."none": zipsourceas-is. An inline function: zip the file map it returns. On the esbuild path,externalPackagesare passed to esbuild'sexternal, and unless an entry setsincludeFiles: falsethe package's real files are staged into the archive. Reports a bundled-in native dependency that was never declared, as a warning.bundleAsIs— read a prebuilt directory orindex.mjs/index.jsfile into a file map without loading esbuild. The packaged CLI uses this forbundler: "none"/--no-bundleso it never pulls esbuild into its snapshot.buildFunctionBundlecalls it for"none"; call it directly when you need the file map (for example to write files forneon dev) rather than a ZIP.resolveEsbuildEntry— resolve a file or directorysourceto the esbuild entry path.traceNativePackages— install the packages a function stages for the runtime target (RUNTIME_TARGET: linux-arm64, glibc) into a throwaway directory, trace the files they reach, and return them keyed by archive path with thenode_moduleslayout preserved. Called bybuildFunctionBundle; exported for a CLI that supplies its own bundler.findUndeclaredNativePackages/describeNativeFinding— advisory detection of a native package that was bundled in without being declared, and the report text for it. Evidence only: it cannot prove the code path is reached, so it must never fail a deploy.assertZipWithinLimits— check a finished archive against the build service's size limits (DEFAULT_ARCHIVE_LIMITS), with an error naming the largest files.
import { inspect, plan, apply } from "@neon/config-runtime/v1";See @neon/config for authoring the neon.ts policy these operate on.
apply / pushConfig treat explicit dataApi: false as a Data API delete (override).
Omitting dataApi leaves an existing integration alone.
