diff --git a/.changeset/cold-pumas-join.md b/.changeset/cold-pumas-join.md new file mode 100644 index 0000000000..12dd40bff1 --- /dev/null +++ b/.changeset/cold-pumas-join.md @@ -0,0 +1,6 @@ +--- +"llamaindex": patch +"@llamaindex/env": patch +--- + +chore: update package.json diff --git a/.changeset/thick-terms-nail.md b/.changeset/thick-terms-nail.md new file mode 100644 index 0000000000..45005f5141 --- /dev/null +++ b/.changeset/thick-terms-nail.md @@ -0,0 +1,5 @@ +--- +"@llamaindex/env": patch +--- + +refactor: remove usage of lodash diff --git a/packages/core/package.json b/packages/core/package.json index 98ee926b0b..5a2d23b18b 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -4,6 +4,22 @@ "expectedMinorVersion": "3", "license": "MIT", "type": "module", + "keywords": [ + "llm", + "llama", + "openai", + "gpt", + "data science", + "prompt", + "prompt engineering", + "chatgpt", + "machine learning", + "ml", + "embedding", + "vectorstore", + "data framework", + "llamaindex" + ], "dependencies": { "@anthropic-ai/sdk": "^0.20.6", "@aws-crypto/sha256-js": "^5.2.0", diff --git a/packages/env/README.md b/packages/env/README.md new file mode 100644 index 0000000000..c5b3181552 --- /dev/null +++ b/packages/env/README.md @@ -0,0 +1,7 @@ +# @llamaindex/env + +> Environment wrapper, supports all JS environment including node, deno, bun, edge runtime, and cloudflare worker. + +## LICENSE + +MIT diff --git a/packages/env/package.json b/packages/env/package.json index 7d415e8a89..b352d2da3d 100644 --- a/packages/env/package.json +++ b/packages/env/package.json @@ -5,6 +5,22 @@ "type": "module", "types": "dist/type/index.d.ts", "main": "dist/cjs/index.js", + "keywords": [ + "llm", + "llama", + "openai", + "gpt", + "data science", + "prompt", + "prompt engineering", + "chatgpt", + "machine learning", + "ml", + "embedding", + "vectorstore", + "data framework", + "llamaindex" + ], "exports": { ".": { "node": { @@ -67,8 +83,7 @@ }, "dependencies": { "@types/lodash": "^4.14.202", - "@types/node": "^20.12.7", - "lodash": "^4.17.21" + "@types/node": "^20.12.7" }, "peerDependencies": { "@aws-crypto/sha256-js": "^5.2.0", diff --git a/packages/env/src/index.polyfill.ts b/packages/env/src/index.polyfill.ts index 35149f8cb1..88521fd06b 100644 --- a/packages/env/src/index.polyfill.ts +++ b/packages/env/src/index.polyfill.ts @@ -1,3 +1,10 @@ +/** + * Polyfill implementation some node.js APIs. + * + * The code should be compatible with any JS runtime. + * + * @module + */ import { Sha256 } from "@aws-crypto/sha256-js"; import pathe from "pathe"; import { InMemoryFileSystem, type CompleteFileSystem } from "./type.js"; diff --git a/packages/env/src/type.ts b/packages/env/src/type.ts index c8e80295b0..4cb7f65994 100644 --- a/packages/env/src/type.ts +++ b/packages/env/src/type.ts @@ -1,5 +1,3 @@ -import _ from "lodash"; - /** * A filesystem interface that is meant to be compatible with * the 'fs' module from Node.js. @@ -41,14 +39,14 @@ export class InMemoryFileSystem implements CompleteFileSystem { content: string, options?: unknown, ): Promise { - this.files[path] = _.cloneDeep(content); + this.files[path] = structuredClone(content); } async readFile(path: string): Promise { if (!(path in this.files)) { throw new Error(`File ${path} does not exist`); } - return _.cloneDeep(this.files[path]); + return structuredClone(this.files[path]); } async access(path: string): Promise { @@ -58,7 +56,7 @@ export class InMemoryFileSystem implements CompleteFileSystem { } async mkdir(path: string): Promise { - this.files[path] = _.get(this.files, path, null); + this.files[path] = this.files[path] ?? null; } async readdir(path: string): Promise { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a448407393..58bc36220d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -628,9 +628,6 @@ importers: '@types/node': specifier: ^20.12.7 version: 20.12.7 - lodash: - specifier: ^4.17.21 - version: 4.17.21 devDependencies: '@aws-crypto/sha256-js': specifier: ^5.2.0