Skip to content
Snippets Groups Projects
Unverified Commit efa326a8 authored by Alex Yang's avatar Alex Yang Committed by GitHub
Browse files

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

parent 5765b637
No related branches found
No related tags found
No related merge requests found
---
"llamaindex": patch
"@llamaindex/env": patch
---
chore: update package.json
---
"@llamaindex/env": patch
---
refactor: remove usage of lodash
...@@ -4,6 +4,22 @@ ...@@ -4,6 +4,22 @@
"expectedMinorVersion": "3", "expectedMinorVersion": "3",
"license": "MIT", "license": "MIT",
"type": "module", "type": "module",
"keywords": [
"llm",
"llama",
"openai",
"gpt",
"data science",
"prompt",
"prompt engineering",
"chatgpt",
"machine learning",
"ml",
"embedding",
"vectorstore",
"data framework",
"llamaindex"
],
"dependencies": { "dependencies": {
"@anthropic-ai/sdk": "^0.20.6", "@anthropic-ai/sdk": "^0.20.6",
"@aws-crypto/sha256-js": "^5.2.0", "@aws-crypto/sha256-js": "^5.2.0",
......
# @llamaindex/env
> Environment wrapper, supports all JS environment including node, deno, bun, edge runtime, and cloudflare worker.
## LICENSE
MIT
...@@ -5,6 +5,22 @@ ...@@ -5,6 +5,22 @@
"type": "module", "type": "module",
"types": "dist/type/index.d.ts", "types": "dist/type/index.d.ts",
"main": "dist/cjs/index.js", "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": { "exports": {
".": { ".": {
"node": { "node": {
...@@ -67,8 +83,7 @@ ...@@ -67,8 +83,7 @@
}, },
"dependencies": { "dependencies": {
"@types/lodash": "^4.14.202", "@types/lodash": "^4.14.202",
"@types/node": "^20.12.7", "@types/node": "^20.12.7"
"lodash": "^4.17.21"
}, },
"peerDependencies": { "peerDependencies": {
"@aws-crypto/sha256-js": "^5.2.0", "@aws-crypto/sha256-js": "^5.2.0",
......
/**
* Polyfill implementation some node.js APIs.
*
* The code should be compatible with any JS runtime.
*
* @module
*/
import { Sha256 } from "@aws-crypto/sha256-js"; import { Sha256 } from "@aws-crypto/sha256-js";
import pathe from "pathe"; import pathe from "pathe";
import { InMemoryFileSystem, type CompleteFileSystem } from "./type.js"; import { InMemoryFileSystem, type CompleteFileSystem } from "./type.js";
......
import _ from "lodash";
/** /**
* A filesystem interface that is meant to be compatible with * A filesystem interface that is meant to be compatible with
* the 'fs' module from Node.js. * the 'fs' module from Node.js.
...@@ -41,14 +39,14 @@ export class InMemoryFileSystem implements CompleteFileSystem { ...@@ -41,14 +39,14 @@ export class InMemoryFileSystem implements CompleteFileSystem {
content: string, content: string,
options?: unknown, options?: unknown,
): Promise<void> { ): Promise<void> {
this.files[path] = _.cloneDeep(content); this.files[path] = structuredClone(content);
} }
async readFile(path: string): Promise<string> { async readFile(path: string): Promise<string> {
if (!(path in this.files)) { if (!(path in this.files)) {
throw new Error(`File ${path} does not exist`); throw new Error(`File ${path} does not exist`);
} }
return _.cloneDeep(this.files[path]); return structuredClone(this.files[path]);
} }
async access(path: string): Promise<void> { async access(path: string): Promise<void> {
...@@ -58,7 +56,7 @@ export class InMemoryFileSystem implements CompleteFileSystem { ...@@ -58,7 +56,7 @@ export class InMemoryFileSystem implements CompleteFileSystem {
} }
async mkdir(path: string): Promise<undefined> { 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[]> { async readdir(path: string): Promise<string[]> {
......
...@@ -628,9 +628,6 @@ importers: ...@@ -628,9 +628,6 @@ importers:
'@types/node': '@types/node':
specifier: ^20.12.7 specifier: ^20.12.7
version: 20.12.7 version: 20.12.7
lodash:
specifier: ^4.17.21
version: 4.17.21
devDependencies: devDependencies:
'@aws-crypto/sha256-js': '@aws-crypto/sha256-js':
specifier: ^5.2.0 specifier: ^5.2.0
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment