Skip to content

Conversation

@cephalization
Copy link
Contributor

@cephalization cephalization commented Dec 5, 2025

Import and require appear to both work in my sample repo. require does not get type information though, users will need to write esm and compile/execute to commonjs for typings (which is common).

In addition will need to bump https://github.com/mastra-ai/mastra/blob/d7509c2b59f3772a91c8f32c37b9e93b64c7da7d/observability/arize/package.json#L34


Note

Add CommonJS build and dual ESM/CJS exports for @arizeai/openinference-genai, updating build scripts and TS configs, with a patch changeset.

  • Build/Packaging:
    • Add CommonJS build via tsconfig.commonjs.json; update build to compile both CJS and ESM.
    • Enable dual exports in package.json with "require" entries for ., ./attributes, ./utils, and ./types; set "main" to dist/src/index.js, "module" to dist/esm/index.js, and update "types".
    • Adjust ESM/TS configs: use module: "preserve", moduleResolution: "bundler", set noEmit and tsBuildInfoFile paths.
  • Release:
    • Add changeset for a patch release of @arizeai/openinference-genai.

Written by Cursor Bugbot for commit b81b766. This will update automatically on new commits. Configure here.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Dec 5, 2025

Open in StackBlitz

@arizeai/openinference-core

npm i https://pkg.pr.new/Arize-ai/openinference/@arizeai/openinference-core@2505

@arizeai/openinference-genai

npm i https://pkg.pr.new/Arize-ai/openinference/@arizeai/openinference-genai@2505

@arizeai/openinference-instrumentation-anthropic

npm i https://pkg.pr.new/Arize-ai/openinference/@arizeai/openinference-instrumentation-anthropic@2505

@arizeai/openinference-instrumentation-bedrock

npm i https://pkg.pr.new/Arize-ai/openinference/@arizeai/openinference-instrumentation-bedrock@2505

@arizeai/openinference-instrumentation-bedrock-agent-runtime

npm i https://pkg.pr.new/Arize-ai/openinference/@arizeai/openinference-instrumentation-bedrock-agent-runtime@2505

@arizeai/openinference-instrumentation-beeai

npm i https://pkg.pr.new/Arize-ai/openinference/@arizeai/openinference-instrumentation-beeai@2505

@arizeai/openinference-instrumentation-langchain

npm i https://pkg.pr.new/Arize-ai/openinference/@arizeai/openinference-instrumentation-langchain@2505

@arizeai/openinference-instrumentation-langchain-v0

npm i https://pkg.pr.new/Arize-ai/openinference/@arizeai/openinference-instrumentation-langchain-v0@2505

@arizeai/openinference-instrumentation-mcp

npm i https://pkg.pr.new/Arize-ai/openinference/@arizeai/openinference-instrumentation-mcp@2505

@arizeai/openinference-instrumentation-openai

npm i https://pkg.pr.new/Arize-ai/openinference/@arizeai/openinference-instrumentation-openai@2505

@arizeai/openinference-mastra

npm i https://pkg.pr.new/Arize-ai/openinference/@arizeai/openinference-mastra@2505

@arizeai/openinference-semantic-conventions

npm i https://pkg.pr.new/Arize-ai/openinference/@arizeai/openinference-semantic-conventions@2505

@arizeai/openinference-vercel

npm i https://pkg.pr.new/Arize-ai/openinference/@arizeai/openinference-vercel@2505

commit: b81b766

@cephalization cephalization marked this pull request as ready for review December 9, 2025 15:58
@cephalization cephalization requested a review from a team as a code owner December 9, 2025 15:58
@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Dec 9, 2025
"types": "dist/esm/index.d.ts",
"main": "dist/src/index.js",
"module": "dist/esm/index.js",
"types": "dist/src/index.d.ts",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Main and types fields point to non-existent paths

The main and types fields point to dist/src/index.js and dist/src/index.d.ts, but the build script only generates output to dist/commonjs/ and dist/esm/ directories. The tsconfig.commonjs.json has outDir: "dist/commonjs" with rootDir: "src", so files compile to dist/commonjs/index.js. The dist/src/ directory will never be created, causing Node.js to fail to resolve the package when these fallback fields are used.

Fix in Cursor Fix in Web

"./types": {
"types": "./dist/esm/types.d.ts"
"types": "./dist/esm/types.d.ts",
"require": "./dist/commonjs/types.d.ts"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Require condition points to type definition file instead of JavaScript

The require condition for the ./types export points to ./dist/commonjs/types.d.ts, which is a TypeScript declaration file, not executable JavaScript. When CommonJS consumers use require("@arizeai/openinference-genai/types"), Node.js will attempt to load the .d.ts file as JavaScript and fail. The require condition needs to point to a .js file (e.g., ./dist/commonjs/types.js).

Fix in Cursor Fix in Web

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Dec 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer size:M This PR changes 30-99 lines, ignoring generated files.

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants