From e7709fd74bdea6904a7b484e7e830a1b23c4ede3 Mon Sep 17 00:00:00 2001 From: Brace Sproul Date: Tue, 16 Jan 2024 14:35:05 -0800 Subject: [PATCH] add entrypoints (#7) * add entrypoints * update tsconfig * fix circ dep --- .gitignore | 2 ++ langgraph/.gitignore | 5 +++-- langgraph/package.json | 10 +++++++++- langgraph/scripts/create-entrypoints.js | 1 + langgraph/src/graph/index.ts | 2 +- langgraph/src/index.ts | 2 +- langgraph/tsconfig.json | 19 +------------------ package.json | 16 +--------------- tsconfig.json | 22 ++++++++++++++++++++++ 9 files changed, 41 insertions(+), 38 deletions(-) create mode 100644 tsconfig.json diff --git a/.gitignore b/.gitignore index b2b9d6fa..1766895c 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,5 @@ node_modules dist .yarn .turbo +**/.turbo +**/.eslintcache diff --git a/langgraph/.gitignore b/langgraph/.gitignore index 4d8ace58..b03842a2 100644 --- a/langgraph/.gitignore +++ b/langgraph/.gitignore @@ -1,8 +1,9 @@ index.cjs index.js index.d.ts +pregel.cjs +pregel.js +pregel.d.ts node_modules dist .yarn -.turbo -.eslintcache diff --git a/langgraph/package.json b/langgraph/package.json index 85057ba1..c73e0dda 100644 --- a/langgraph/package.json +++ b/langgraph/package.json @@ -70,12 +70,20 @@ "import": "./index.js", "require": "./index.cjs" }, + "./pregel": { + "types": "./pregel.d.ts", + "import": "./pregel.js", + "require": "./pregel.cjs" + }, "./package.json": "./package.json" }, "files": [ "dist/", "index.cjs", "index.js", - "index.d.ts" + "index.d.ts", + "pregel.cjs", + "pregel.js", + "pregel.d.ts" ] } diff --git a/langgraph/scripts/create-entrypoints.js b/langgraph/scripts/create-entrypoints.js index 01a4daeb..dc0b6610 100644 --- a/langgraph/scripts/create-entrypoints.js +++ b/langgraph/scripts/create-entrypoints.js @@ -11,6 +11,7 @@ const DEFAULT_GITIGNORE_PATHS = ["node_modules", "dist", ".yarn"]; // Order is not important. const entrypoints = { index: "index", + pregel: "pregel/index", }; // Entrypoints in this list require an optional dependency to be installed. diff --git a/langgraph/src/graph/index.ts b/langgraph/src/graph/index.ts index df6e09a8..6ba2447c 100644 --- a/langgraph/src/graph/index.ts +++ b/langgraph/src/graph/index.ts @@ -4,8 +4,8 @@ import { RunnableLike, _coerceToRunnable, } from "@langchain/core/runnables"; -import { Channel, Pregel } from "../index.js"; import { ChannelBatch, ChannelInvoke } from "../pregel/read.js"; +import { Channel, Pregel } from "../pregel/index.js"; export const END = "__end__"; diff --git a/langgraph/src/index.ts b/langgraph/src/index.ts index 59818a0a..6895ab2e 100644 --- a/langgraph/src/index.ts +++ b/langgraph/src/index.ts @@ -1 +1 @@ -export { type PregelInterface, Pregel, Channel } from "./pregel/index.js"; +export { END, Graph } from "./graph/index.js"; diff --git a/langgraph/tsconfig.json b/langgraph/tsconfig.json index e31d50de..6b5fed2f 100644 --- a/langgraph/tsconfig.json +++ b/langgraph/tsconfig.json @@ -1,22 +1,5 @@ { - "extends": "@tsconfig/recommended", - "compilerOptions": { - "outDir": "../dist", - "target": "ES2021", - "lib": ["ES2021", "ES2022.Object", "DOM"], - "module": "ES2020", - "moduleResolution": "nodenext", - "esModuleInterop": true, - "declaration": true, - "noImplicitReturns": true, - "noFallthroughCasesInSwitch": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "useDefineForClassFields": true, - "strictPropertyInitialization": false, - "allowJs": true, - "strict": true - }, + "extends": "../tsconfig.json", "include": ["src/**/*.ts", "examples/**/*.ts"], "exclude": ["node_modules", "dist", "docs"] } diff --git a/package.json b/package.json index cdcf49d2..43ec9778 100644 --- a/package.json +++ b/package.json @@ -55,19 +55,5 @@ }, "publishConfig": { "access": "public" - }, - "exports": { - ".": { - "types": "./index.d.ts", - "import": "./index.js", - "require": "./index.cjs" - }, - "./package.json": "./package.json" - }, - "files": [ - "dist/", - "index.cjs", - "index.js", - "index.d.ts" - ] + } } diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 00000000..50d06e11 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,22 @@ +{ + "extends": "@tsconfig/recommended", + "compilerOptions": { + "outDir": "./langgraph/dist", + "rootDir": "./langgraph/src", + "target": "ES2021", + "lib": ["ES2021", "ES2022.Object", "DOM"], + "module": "ES2020", + "moduleResolution": "nodenext", + "esModuleInterop": true, + "declaration": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "useDefineForClassFields": true, + "strictPropertyInitialization": false, + "allowJs": true, + "strict": true + }, + "exclude": ["node_modules"] +}