Skip to content

Commit 1bd1021

Browse files
lukeramsdenaaronvgantoniosarosi
authored
Add exports map with index, native, type_builder, errors, and browser (#2299)
Relates to #2298 These are all the sub-paths that I can see that there are examples of importing from: https://github.com/search?q=repo%3ABoundaryML%2Fbaml+from+%27%40boundaryml%2Fbaml%2F&type=code&p=1 <!-- ELLIPSIS_HIDDEN --> ---- > [!IMPORTANT] > Add exports map to `package.json` for specific entry points in `engine/language_client_typescript`. > > - **Exports Map**: > - Adds `exports` field in `package.json` to define entry points for `./index.js`, `./native.js`, `./type_builder.js`, `./errors.js`, and `./browser.js`. > > <sup>This description was created by </sup>[<img alt="Ellipsis" src="https://img.shields.io/badge/Ellipsis-blue?color=175173">](https://www.ellipsis.dev?ref=BoundaryML%2Fbaml&utm_source=github&utm_medium=referral)<sup> for fc4c9e4. You can [customize](https://app.ellipsis.dev/BoundaryML/settings/summaries) this summary. It will automatically update as commits are pushed.</sup> <!-- ELLIPSIS_HIDDEN --> --------- Co-authored-by: aaronvg <aaron@boundaryml.com> Co-authored-by: Antonio Sarosi <sarosiantonio@gmail.com>
1 parent e7a05ab commit 1bd1021

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

‎engine/language_client_typescript/package.json‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,14 @@
4242
],
4343
"main": "./index.js",
4444
"types": "./index.d.ts",
45+
"exports": {
46+
".": "./index.js",
47+
"./native": "./native.js",
48+
"./type_builder": "./type_builder.js",
49+
"./errors": "./errors.js",
50+
"./browser": "./browser.js",
51+
"./logging": "./logging.js"
52+
},
4553
"napi": {
4654
"binaryName": "baml",
4755
"targets": [

‎integ-tests/typescript-esm/main.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
import { b } from "./baml_client/index.js";
22
// import { Image} from "@boundaryml/baml";
33
import pkg from "@boundaryml/baml";
4+
// Force another import for the logging path.
5+
import { setLogLevel } from "./baml_client/config.js";
6+
47
const { Image } = pkg;
8+
9+
setLogLevel("info");
10+
511
const result = await b.DescribeImage( Image.fromUrl('https://upload.wikimedia.org/wikipedia/en/4/4d/Shrek_%28character%29.png'));
612

713
console.log(result);

0 commit comments

Comments
 (0)