@llamaindex/env
Advanced tools
Comparing version 0.1.2 to 0.1.3
# @llamaindex/env | ||
## 0.1.3 | ||
### Patch Changes | ||
- e072c45: fix: remove non-standard API `pipeline` | ||
- 9e133ac: refactor: remove `defaultFS` from parameters | ||
We don't accept passing fs in the parameter since it's unnecessary for a determined JS environment. | ||
This was a polyfill way for the non-Node.js environment, but now we use another way to polyfill APIs. | ||
## 0.1.2 | ||
@@ -4,0 +15,0 @@ |
@@ -45,4 +45,4 @@ /** | ||
}, | ||
defaultFS: function() { | ||
return defaultFS; | ||
fs: function() { | ||
return _node.fs; | ||
}, | ||
@@ -58,5 +58,2 @@ getEnv: function() { | ||
}, | ||
pipeline: function() { | ||
return _promises1.pipeline; | ||
}, | ||
randomUUID: function() { | ||
@@ -71,7 +68,6 @@ return _nodecrypto.randomUUID; | ||
const _nodecrypto = require("node:crypto"); | ||
const _promises = /*#__PURE__*/ _interop_require_default(require("node:fs/promises")); | ||
const _nodeos = require("node:os"); | ||
const _nodepath = /*#__PURE__*/ _interop_require_default(require("node:path")); | ||
const _promises1 = require("node:stream/promises"); | ||
const _web = require("node:stream/web"); | ||
const _node = require("./fs/node.js"); | ||
const _utils = require("./utils.js"); | ||
@@ -94,16 +90,1 @@ function _interop_require_default(obj) { | ||
} | ||
const defaultFS = { | ||
writeFile: function(path, content) { | ||
return _promises.default.writeFile(path, content, "utf-8"); | ||
}, | ||
readRawFile (path) { | ||
return _promises.default.readFile(path); | ||
}, | ||
readFile: function(path) { | ||
return _promises.default.readFile(path, "utf-8"); | ||
}, | ||
access: _promises.default.access, | ||
mkdir: _promises.default.mkdir, | ||
readdir: _promises.default.readdir, | ||
stat: _promises.default.stat | ||
}; |
@@ -18,3 +18,3 @@ /** | ||
const _utils = require("./utils.js"); | ||
_export_star(require("./index.polyfill.js"), exports); | ||
_export_star(require("./polyfill.js"), exports); | ||
function _export_star(from, to) { | ||
@@ -21,0 +21,0 @@ Object.keys(from).forEach(function(k) { |
@@ -15,7 +15,6 @@ /** | ||
import { createHash, randomUUID } from "node:crypto"; | ||
import fs from "node:fs/promises"; | ||
import { EOL } from "node:os"; | ||
import path from "node:path"; | ||
import { pipeline } from "node:stream/promises"; | ||
import { ReadableStream, TransformStream, WritableStream } from "node:stream/web"; | ||
import { fs } from "./fs/node.js"; | ||
export function createSHA256() { | ||
@@ -32,18 +31,3 @@ const hash = createHash("sha256"); | ||
} | ||
export const defaultFS = { | ||
writeFile: function(path, content) { | ||
return fs.writeFile(path, content, "utf-8"); | ||
}, | ||
readRawFile (path) { | ||
return fs.readFile(path); | ||
}, | ||
readFile: function(path) { | ||
return fs.readFile(path, "utf-8"); | ||
}, | ||
access: fs.access, | ||
mkdir: fs.mkdir, | ||
readdir: fs.readdir, | ||
stat: fs.stat | ||
}; | ||
export { AsyncLocalStorage, CustomEvent, getEnv, setEnvs } from "./utils.js"; | ||
export { EOL, ReadableStream, TransformStream, WritableStream, ok, path, pipeline, randomUUID }; | ||
export { EOL, ReadableStream, TransformStream, WritableStream, fs, ok, path, randomUUID }; |
@@ -8,5 +8,5 @@ /** | ||
*/ import { INTERNAL_ENV } from "./utils.js"; | ||
export * from "./index.polyfill.js"; | ||
export * from "./polyfill.js"; | ||
export function getEnv(name) { | ||
return INTERNAL_ENV[name]; | ||
} |
@@ -6,3 +6,2 @@ /// <reference types="node" resolution-mode="require"/> | ||
/// <reference types="node" resolution-mode="require"/> | ||
/// <reference types="node" resolution-mode="require"/> | ||
/** | ||
@@ -25,10 +24,7 @@ * This module is under Node.js environment. | ||
import path from "node:path"; | ||
import { pipeline } from "node:stream/promises"; | ||
import { ReadableStream, TransformStream, WritableStream } from "node:stream/web"; | ||
import type { SHA256 } from "./index.polyfill.js"; | ||
import type { CompleteFileSystem } from "./type.js"; | ||
import { fs } from "./fs/node.js"; | ||
import type { SHA256 } from "./polyfill.js"; | ||
export declare function createSHA256(): SHA256; | ||
export declare const defaultFS: CompleteFileSystem; | ||
export type * from "./type.js"; | ||
export { AsyncLocalStorage, CustomEvent, getEnv, setEnvs } from "./utils.js"; | ||
export { EOL, ReadableStream, TransformStream, WritableStream, ok, path, pipeline, randomUUID, }; | ||
export { EOL, ReadableStream, TransformStream, WritableStream, fs, ok, path, randomUUID, }; |
@@ -1,2 +0,2 @@ | ||
export * from "./index.polyfill.js"; | ||
export * from "./polyfill.js"; | ||
export declare function getEnv(name: string): string | undefined; |
{ | ||
"name": "@llamaindex/env", | ||
"description": "environment wrapper, supports all JS environment including node, deno, bun, edge runtime, and cloudflare worker", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"type": "module", | ||
@@ -36,4 +36,4 @@ "types": "dist/type/index.d.ts", | ||
"edge-light": { | ||
"types": "./dist/type/index.polyfill.d.ts", | ||
"default": "./dist/index.polyfill.js" | ||
"types": "./dist/type/index.edge-light.d.ts", | ||
"default": "./dist/index.edge-light.js" | ||
}, | ||
@@ -48,12 +48,2 @@ "import": { | ||
} | ||
}, | ||
"./*": { | ||
"import": { | ||
"types": "./dist/type/*.d.ts", | ||
"default": "./dist/*.js" | ||
}, | ||
"require": { | ||
"types": "./dist/type/*.d.ts", | ||
"default": "./dist/cjs/*.js" | ||
} | ||
} | ||
@@ -72,16 +62,15 @@ }, | ||
"@aws-crypto/sha256-js": "^5.2.0", | ||
"@swc/cli": "^0.3.9", | ||
"@swc/core": "^1.4.2", | ||
"@swc/cli": "^0.3.12", | ||
"@swc/core": "^1.5.5", | ||
"concurrently": "^8.2.2", | ||
"pathe": "^1.1.2", | ||
"readable-stream": "^4.5.2" | ||
"vitest": "^1.6.0" | ||
}, | ||
"dependencies": { | ||
"@types/lodash": "^4.14.202", | ||
"@types/node": "^20.12.7" | ||
"@types/lodash": "^4.17.1", | ||
"@types/node": "^20.12.11" | ||
}, | ||
"peerDependencies": { | ||
"@aws-crypto/sha256-js": "^5.2.0", | ||
"pathe": "^1.1.2", | ||
"readable-stream": "^4.5.2" | ||
"pathe": "^1.1.2" | ||
}, | ||
@@ -94,5 +83,2 @@ "peerDependenciesMeta": { | ||
"optional": true | ||
}, | ||
"readable-stream": { | ||
"optional": true | ||
} | ||
@@ -106,4 +92,6 @@ }, | ||
"postbuild": "node -e \"require('fs').writeFileSync('./dist/cjs/package.json', JSON.stringify({ type: 'commonjs' }))\"", | ||
"dev": "concurrently \"pnpm run build:esm --watch\" \"pnpm run build:cjs --watch\" \"pnpm run build:type --watch\"" | ||
"dev": "concurrently \"pnpm run build:esm --watch\" \"pnpm run build:cjs --watch\" \"pnpm run build:type --watch\"", | ||
"circular-check": "madge -c ./src/index.ts", | ||
"test": "vitest" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 2 instances in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1005273
4
29
22977
20
7
- Removedabort-controller@3.0.0(transitive)
- Removedbase64-js@1.5.1(transitive)
- Removedbuffer@6.0.3(transitive)
- Removedevent-target-shim@5.0.1(transitive)
- Removedevents@3.3.0(transitive)
- Removedieee754@1.2.1(transitive)
- Removedprocess@0.11.10(transitive)
- Removedreadable-stream@4.5.2(transitive)
- Removedsafe-buffer@5.2.1(transitive)
- Removedstring_decoder@1.3.0(transitive)
Updated@types/lodash@^4.17.1
Updated@types/node@^20.12.11