You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
compile(cjs): esbuild __export getter helper inside a require cycle is not seen as defining the exports — perry prints node's 'Accessing non-existent property … inside circular dependency' warning (@vercel/oidc via @ai-sdk/gateway; semver range↔comparator) where node and bun are silent #10178
Parent: #10107 (OpenCode v1.18.30). Cousin of #10153 / PR #10156 (Babel-style getter re-exports): this is esbuild's __export getter helper inside a CommonJS cycle.
Symptom
Every real OpenCode command prints, before anything else:
(node:PID) Warning: Accessing non-existent property 'getVercelDataDir' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
Neither the official bun binary nor node 26 prints anything for the same package. Standalone repro (338 modules, 2.5 min on the build host, --no-auto-optimize):
perry: prints gateway: functionand the warning; bun/node: no warning.
The shape
@vercel/oidc@3.2.0/dist/{auth-config,token-util}.js (esbuild CJS output) form a cycle: auth-config.js:38 require("./token-util") and token-util.js:46 require("./auth-config"). Both files define their exports up front with esbuild's helper:
var__export=(target,all)=>{for(varnameinall)__defProp(target,name,{get: all[name],enumerable: true});};__export(token_util_exports,{getVercelDataDir: ()=>getVercelDataDir, … });// top of token-util.js…functiongetVercelDataDir(){…}// hoisted declaration, line 49
and auth-config.js:40 reads it only inside a function: const dataDir = (0, import_token_util.getVercelDataDir)();. Under node the partially-loaded exports object already carries the getter, so the cycle is harmless. Perry's CJS wrapper does not recognise the __export(target, { name: () => local }) helper as defining the properties (PR #10156 covered direct Object.defineProperty(exports, …, { get })), so at the cycle re-entry the consumer's view of token-util lacks getVercelDataDir and the node-style warning fires; the later call would throw TypeError: (0 , import_token_util.getVercelDataDir) is not a function for anyone using the Vercel AI gateway / OIDC token path.
Two more 'ANY' warnings in the full OpenCode graph come from semver's classes/range.js ↔ classes/comparator.js cycle (semver@7.8.1 and 7.8.5 are both in the graph); a standalone range-first import is clean under perry, so that one depends on module init order — noted here, separate repro pending.
Acceptance
The gateway repro prints no warning and getVercelDataDir is callable through the cycle.
Regression fixture: two esbuild-style CJS files using __export + a require cycle, imported from ESM; assert no warning on stderr and the live value.
The full OpenCode build starts without the three warnings.
The PR retains the module record during partial publication, fixes the failing esbuild cycle call, and removes the comparator-first semver ANY warnings. It includes baseline/fixed evidence, regression fixtures, and a require-heavy benchmark (111.55 ms before, 111.36 ms after). Full OpenCode compilation was not run, per the lane constraint.
Activity
proggeramlug commentedon Sep 15, 2026
Ready for review: #10282
The PR retains the module record during partial publication, fixes the failing esbuild cycle call, and removes the comparator-first semver ANY warnings. It includes baseline/fixed evidence, regression fixtures, and a require-heavy benchmark (111.55 ms before, 111.36 ms after). Full OpenCode compilation was not run, per the lane constraint.