Skip to content

Conversation

@aaronvg
Copy link
Contributor

@aaronvg aaronvg commented Nov 18, 2025

Note

Migrate the TypeScript client and generated SDKs to ESM, add .js import rewriting (incl. @boundaryml/baml/*), export watcher APIs, and update tests/configs accordingly.

  • TypeScript language client (ESM-only):
    • Switch to pure ESM (package.json type=module); convert runtime files to ESM (native.js, index.js, logging.js, errors.js, async_context_vars.js, stream.js, browser.js, cli.js).
    • Add browser-friendly Image/Audio/Video/Pdf implementations and SSR warning proxies in browser.*.
    • Re-export APIs from native.js; add BamlCtxManager, BamlStream, and typed BamlLogEvent exports.
  • Generator updates:
    • Emit .js suffixed imports for relative and @boundaryml/baml/* paths; extend regex and tests in src/lib.rs.
    • Generated clients now export watchers, resetBamlEnvVars, and error types; add new watchers.ts files.
    • Bump generated SDK version hints to 0.213.0.
    • Update type_builder template to ESM paths and export TypeBuilder.
  • Integration/tests:
    • Update ESM usage in samples and configs (Jest 30 ESM config, tsconfig NodeNext, Node>=20, .js import paths).
    • Add scripts to build debug ESM artifacts.

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

@aaronvg aaronvg temporarily deployed to boundary-tools-dev November 18, 2025 23:08 — with GitHub Actions Inactive
@aaronvg aaronvg temporarily deployed to boundary-tools-dev November 18, 2025 23:08 — with GitHub Actions Inactive
@aaronvg aaronvg temporarily deployed to boundary-tools-dev November 18, 2025 23:08 — with GitHub Actions Inactive
@vercel
Copy link

vercel bot commented Nov 18, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
promptfiddle Skipped Skipped Nov 18, 2025 11:08pm

@aaronvg
Copy link
Contributor Author

aaronvg commented Nov 18, 2025

need to migrate to vitest or add .js extensions in our test files like we do in https://github.com/BoundaryML/baml/pull/2489/files

@github-actions
Copy link

@github-actions
Copy link

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 1 to +9
#!/usr/bin/env node

if (require.main === module) {
if (!process.env.BAML_LOG) {
process.env.BAML_LOG = 'info'
}
import { invoke_runtime_cli } from './native.js'

const baml = require('./native')
baml.invoke_runtime_cli(process.argv.slice(1))
if (!process.env.BAML_LOG) {
process.env.BAML_LOG = 'info'
}

invoke_runtime_cli(process.argv.slice(1))

Choose a reason for hiding this comment

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

P1 Badge Execute CLI every time module is imported

The new ESM version of cli.js always calls invoke_runtime_cli(process.argv.slice(1)) at module load. Previously this logic lived under if (require.main === module) so it only ran when the file was invoked as a binary. Removing the guard means any consumer that imports @boundaryml/baml/cli.js for programmatic reuse or for bundling now immediately executes the CLI, which can spawn the native runtime and alter process state unexpectedly. Consider re‑introducing a main‑module check using import.meta.url to ensure the CLI runs only when invoked directly from the command line.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants