Skip to content

ai-credentials exports are ESM-only, blocking CommonJS consumers like Positron's extensions/authentication #89

Description

@sharon-wang

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    positronaffects positron or will be worked on by Positron team (if added to Positron project board)

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions