Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@jsenv/filesystem

Package Overview
Dependencies
Maintainers
2
Versions
95
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jsenv/filesystem - npm Package Compare versions

Comparing version 2.5.1 to 2.6.0

46

package.json
{
"name": "@jsenv/filesystem",
"version": "2.5.1",
"version": "2.6.0",
"description": "Collection of functions to interact with filesystem in Node.js",

@@ -16,7 +16,6 @@ "license": "MIT",

"engines": {
"node": ">=14.17.0"
"node": ">=16.13.0"
},
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org"
"access": "public"
},

@@ -26,4 +25,3 @@ "type": "module",

".": {
"import": "./main.js",
"require": "./dist/commonjs/jsenv_filesystem.cjs"
"import": "./main.js"
},

@@ -33,3 +31,2 @@ "./*": "./*"

"files": [
"/dist/",
"/src/",

@@ -39,14 +36,8 @@ "/main.js"

"scripts": {
"eslint-check": "node ./node_modules/eslint/bin/eslint.js .",
"generate-importmap": "node ./script/importmap/generate_importmap.mjs",
"measure-performances": "node ./script/performance/generate_performance_report.mjs --local",
"dist": "npm run build",
"build": "node --experimental-import-meta-resolve ./script/build/build.mjs",
"eslint": "node ./node_modules/eslint/bin/eslint.js .",
"importmap": "node ./script/importmap/importmap.mjs",
"performance": "node --expose-gc ./script/performance/performance.mjs --log",
"test": "node ./script/test/test.mjs",
"test-with-coverage": "npm run test -- --coverage",
"prettier-format": "node ./script/prettier/prettier_format.mjs",
"prettier-format-stage": "npm run prettier-format -- --staged",
"prettier-check": "npm run prettier-format -- --dry-run",
"prepublishOnly": "node ./script/publish/remove_postinstall.mjs && npm run dist",
"postpublish": "node ./script/publish/restore_postinstall.mjs"
"prettier": "prettier --write ."
},

@@ -58,17 +49,14 @@ "dependencies": {

"devDependencies": {
"@babel/core": "7.16.0",
"@babel/eslint-parser": "7.16.0",
"@jsenv/assert": "2.3.2",
"@jsenv/core": "23.2.2",
"@jsenv/eslint-config": "16.0.8",
"@jsenv/assert": "2.4.0",
"@jsenv/core": "24.5.8",
"@jsenv/eslint-config": "16.0.9",
"@jsenv/github-release-package": "1.2.3",
"@jsenv/importmap-eslint-resolver": "5.1.2",
"@jsenv/importmap-node-module": "2.4.1",
"@jsenv/importmap-eslint-resolver": "5.2.1",
"@jsenv/importmap-node-module": "2.8.0",
"@jsenv/package-publish": "1.6.2",
"@jsenv/performance-impact": "2.2.1",
"@jsenv/prettier-check-project": "5.6.1",
"eslint": "7.32.0",
"eslint-plugin-import": "2.25.2",
"prettier": "2.4.1"
"eslint": "8.4.1",
"eslint-plugin-import": "2.25.3",
"prettier": "2.5.1"
}
}
}

@@ -21,6 +21,9 @@ # Jsenv filesystem [![npm package](https://img.shields.io/npm/v/@jsenv/filesystem.svg?logo=npm&label=package)](https://www.npmjs.com/package/@jsenv/filesystem) [![github main](https://github.com/jsenv/filesystem/workflows/main/badge.svg)](https://github.com/jsenv/filesystem/actions?workflow=main) [![codecov coverage](https://codecov.io/gh/jsenv/filesystem/branch/main/graph/badge.svg)](https://codecov.io/gh/jsenv/filesystem)

const jsFiles = await listFilesMatching(
"./**/*.js",
new URL("./", import.meta.url),
)
const jsFiles = await listFilesMatching({
directoryUrl: new URL("./", import.meta.url),
patterns: {
"./**/*.js": true,
"./**/*.test.js": false,
},
})
```

@@ -27,0 +30,0 @@

import { collectFiles } from "./collectFiles.js"
export const listFilesMatching = async (
export const listFilesMatching = async ({
directoryUrl = process.cwd(),
patterns,
directoryUrl = process.cwd(),
signal,
) => {
if (typeof patterns === "string") {
patterns = [patterns]
} else if (Array.isArray(patterns)) {
throw new TypeError(
`patterns must be a string or an array of strings, got ${patterns}`,
)
}) => {
if (typeof patterns !== "object" || patterns === null) {
throw new TypeError(`patterns must be an object, got ${patterns}`)
}
const patternMap = {}
patterns.forEach((pattern, index) => {
if (typeof pattern !== "string") {
throw new TypeError(
`every pattern must be a string, found ${pattern} at index ${index}`,
)
}
patternMap[pattern] = true
})
const fileDatas = await collectFiles({

@@ -30,3 +16,3 @@ signal,

structuredMetaMap: {
matches: patternMap,
matches: patterns,
},

@@ -33,0 +19,0 @@ predicate: ({ matches }) => matches,

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc