Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update package.json and usage of lodash #809

Merged
merged 2 commits into from
May 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/cold-pumas-join.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"llamaindex": patch
"@llamaindex/env": patch
---

chore: update package.json
5 changes: 5 additions & 0 deletions .changeset/thick-terms-nail.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@llamaindex/env": patch
---

refactor: remove usage of lodash
16 changes: 16 additions & 0 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
7 changes: 7 additions & 0 deletions packages/env/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# @llamaindex/env

> Environment wrapper, supports all JS environment including node, deno, bun, edge runtime, and cloudflare worker.

## LICENSE

MIT
19 changes: 17 additions & 2 deletions packages/env/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -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",
Expand Down
7 changes: 7 additions & 0 deletions packages/env/src/index.polyfill.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
8 changes: 3 additions & 5 deletions packages/env/src/type.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import _ from "lodash";

/**
* A filesystem interface that is meant to be compatible with
* the 'fs' module from Node.js.
Expand Down Expand Up @@ -41,14 +39,14 @@ export class InMemoryFileSystem implements CompleteFileSystem {
content: string,
options?: unknown,
): Promise<void> {
this.files[path] = _.cloneDeep(content);
this.files[path] = structuredClone(content);
}

async readFile(path: string): Promise<string> {
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<void> {
Expand All @@ -58,7 +56,7 @@ export class InMemoryFileSystem implements CompleteFileSystem {
}

async mkdir(path: string): Promise<undefined> {
this.files[path] = _.get(this.files, path, null);
this.files[path] = this.files[path] ?? null;
}

async readdir(path: string): Promise<string[]> {
Expand Down
3 changes: 0 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.