Problem
extensions/authentication in Positron can't import from ai-credentials, even though it wants CUSTOM_CLIENT_KIND_AUTH_MAP from ai-credentials/types instead of keeping its own local copy.
Why
extensions/authentication compiles to CommonJS (no "type": "module", module: nodenext). Node resolves a package's CommonJS require() calls using the require condition in that package's exports map. ai-credentials/package.json only defines types and import conditions, no require, so it's ESM-only and can't be loaded from a CommonJS consumer.
For comparison, ai-config (which Positron already depends on) defines both import and require for its exports, which is why that one works fine as a dependency here.
Ask
Add a require condition to ai-credentials's package.json exports map, matching the pattern already used by ai-config, so CommonJS consumers like Positron's extensions/authentication can depend on it directly instead of duplicating its types/constants locally.
Note for whoever picks this up
Double-check there isn't a deliberate reason ai-credentials was kept import-only (e.g. it pulls in something without a safe CJS story) before just copying the ai-config exports shape over.
Reference
posit-dev/positron#15675
Problem
extensions/authenticationin Positron can't import fromai-credentials, even though it wantsCUSTOM_CLIENT_KIND_AUTH_MAPfromai-credentials/typesinstead of keeping its own local copy.Why
extensions/authenticationcompiles to CommonJS (no"type": "module",module: nodenext). Node resolves a package's CommonJSrequire()calls using therequirecondition in that package'sexportsmap.ai-credentials/package.jsononly definestypesandimportconditions, norequire, so it's ESM-only and can't be loaded from a CommonJS consumer.For comparison,
ai-config(which Positron already depends on) defines bothimportandrequirefor its exports, which is why that one works fine as a dependency here.Ask
Add a
requirecondition toai-credentials'spackage.jsonexports map, matching the pattern already used byai-config, so CommonJS consumers like Positron'sextensions/authenticationcan depend on it directly instead of duplicating its types/constants locally.Note for whoever picks this up
Double-check there isn't a deliberate reason
ai-credentialswas kept import-only (e.g. it pulls in something without a safe CJS story) before just copying theai-configexports shape over.Reference
posit-dev/positron#15675