v4.1.0
Minor Changes
-
301367a: SMOODEV-617: fix
.getSync()for bundled consumers (Lambda, Vercel, Next.js)buildConfig(schema).<tier>.getSync(key)used to hang indefinitely when the SDK was bundled by esbuild — in AWS Lambda bundles, Vercel edge, or any tsup/rollup consumer. Root cause:createSyncFn(path)needs a physical.jsworker file on disk, but the consumer's bundler tree-shook it out.Fix: the SDK now bundles the synckit worker into a string constant at SDK build time (via
scripts/build-sync-worker.mjs), and at first-use writes that string tomkdtempSync()/sync-worker.mjsbefore handing thefile://URL tocreateSyncFn. Zero consumer configuration required — works out of the box inside Lambdas, Vercel fns, Fargate tasks, CLI scripts.What changed
-
New build step:
pnpm build:sync-workerruns beforepnpm tsup, emittingsrc/server/sync-worker-source.generated.tswith the full ESM worker source (every dep inlined except Node builtins, CJSrequirepolyfilled viacreateRequire(import.meta.url)). -
src/server/index.tsimportsWORKER_SOURCEand materializes it to/tmponce per process. -
Smoke tests confirm
.getSync()returns in ~50ms incl. worker spawn, matches.get()(async) output exactly.No API change
Consumers do not need to touch their code. Existing
buildConfig(schema).secretConfig.getSync('foo')calls just work once@smooai/configis bumped.
-