Skip to content

Commit d0f9fde

Browse files
committed
⚗️ Merge remote-tracking branch 'origin/fix-tasks-types' into extension-fix
2 parents 5c89e98 + 451a223 commit d0f9fde

File tree

3 files changed

+22
-3
lines changed

3 files changed

+22
-3
lines changed

packages/tasks/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@
99
},
1010
"main": "./dist/index.cjs",
1111
"module": "./dist/index.js",
12-
"types": "./dist/src/index.d.ts",
12+
"types": "./dist/index.d.ts",
1313
"exports": {
1414
".": {
15-
"types": "./dist/src/index.d.ts",
1615
"require": "./dist/index.cjs",
1716
"import": "./dist/index.js"
1817
}
@@ -24,13 +23,14 @@
2423
"format": "prettier --write .",
2524
"format:check": "prettier --check .",
2625
"prepublishOnly": "pnpm run inference-codegen && git diff --name-only --exit-code src && pnpm run build",
27-
"build": "tsup src/index.ts --format cjs,esm --clean && tsc --emitDeclarationOnly --declaration",
26+
"build": "tsup src/index.ts --format cjs,esm --clean && tsc --emitDeclarationOnly --declaration && pnpm run generate-cts",
2827
"watch:export": "tsup src/index.ts --format cjs,esm --watch",
2928
"watch:types": "tsc --emitDeclarationOnly --declaration --watch",
3029
"watch": "npm-run-all --parallel watch:export watch:types",
3130
"prepare": "pnpm run build",
3231
"check": "tsc",
3332
"test": "vitest run",
33+
"generate-cts": "tsx scripts/generate-cts.ts",
3434
"inference-codegen": "tsx scripts/inference-codegen.ts && prettier --write src/tasks/*/inference.ts",
3535
"inference-tgi-import": "tsx scripts/inference-tgi-import.ts && prettier --write src/tasks/text-generation/spec/*.json && prettier --write src/tasks/chat-completion/spec/*.json",
3636
"inference-tei-import": "tsx scripts/inference-tei-import.ts && prettier --write src/tasks/feature-extraction/spec/*.json"
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { readdirSync, readFileSync, statSync, writeFileSync } from "node:fs";
2+
import { join } from "node:path";
3+
4+
function recursiveCopy(path: string) {
5+
for (const item of readdirSync(path)) {
6+
if (item.endsWith(".d.ts")) {
7+
const content = readFileSync(join(path, item), "utf-8");
8+
writeFileSync(join(path, item.replace(".d.ts", ".d.cts")), content.replaceAll(".d.ts.map", ".d.cts.map"));
9+
} else if (item.endsWith(".d.ts.map")) {
10+
const content = readFileSync(join(path, item), "utf-8");
11+
writeFileSync(join(path, item.replace(".d.ts.map", ".d.cts.map")), content.replaceAll(".d.ts", ".d.cts"));
12+
} else if (statSync(join(path, item)).isDirectory()) {
13+
recursiveCopy(join(path, item));
14+
}
15+
}
16+
}
17+
18+
recursiveCopy("dist");

packages/tasks/src/snippets/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@ import * as inputs from "./inputs.js";
22
import * as curl from "./curl.js";
33
import * as python from "./python.js";
44
import * as js from "./js.js";
5+
export * from "./types.js";
56

67
export { inputs, curl, python, js };

0 commit comments

Comments
 (0)