Skip to content

Commit ec58abf

Browse files
committed
test
1 parent 23fd357 commit ec58abf

File tree

5 files changed

+12
-3
lines changed

5 files changed

+12
-3
lines changed

packages/inference/package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@
3737
"types": "./dist/src/index.d.ts",
3838
"require": "./dist/index.cjs",
3939
"import": "./dist/index.js"
40+
},
41+
"./snippets": {
42+
"types": "./dist/snippets/index.d.ts",
43+
"require": "./dist/snippets/index.cjs",
44+
"import": "./dist/snippets/index.js"
4045
}
4146
},
4247
"browser": {

packages/inference/src/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,8 @@ export { InferenceOutputError } from "./lib/InferenceOutputError";
33
export * from "./types";
44
export * from "./tasks";
55

6-
import * as snippets from "./snippets/index.js";
6+
let snippets = {};
7+
if (typeof window === "undefined") {
8+
snippets = import("./snippets").then((mod) => mod.default);
9+
}
710
export { snippets };

packages/inference/src/snippets/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ import * as curl from "./curl.js";
22
import * as python from "./python.js";
33
import * as js from "./js.js";
44

5-
export { curl, python, js };
5+
export default { curl, python, js };

packages/inference/tsup.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ const nodeConfig: Options = {
1515
const browserConfig: Options = {
1616
...baseConfig,
1717
platform: "browser",
18+
target: "es2018",
1819
splitting: true,
1920
outDir: "dist/browser",
2021
};

packages/tasks-gen/scripts/generate-snippets-fixtures.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { existsSync as pathExists } from "node:fs";
1919
import * as fs from "node:fs/promises";
2020
import * as path from "node:path/posix";
2121

22-
import { snippets } from "@huggingface/inference";
22+
import { snippets } from "@huggingface/inference/snippets";
2323
import type { SnippetInferenceProvider, InferenceSnippet, ModelDataMinimal } from "@huggingface/tasks";
2424

2525
type LANGUAGE = "sh" | "js" | "py";

0 commit comments

Comments
 (0)