Aktueller Stand

This commit is contained in:
2026-01-23 01:33:35 +01:00
parent 082dc5e110
commit 2766dd12c5
10109 changed files with 1578841 additions and 77685 deletions

20
backend/node_modules/empathic/access.d.ts generated vendored Normal file
View File

@@ -0,0 +1,20 @@
import type { PathLike } from "node:fs";
/**
* Does the current process have {@link mode} access?
* By default, checks if the path is visible to the proccess.
*
* @param mode A `fs.constants` value; default `F_OK`
*/
export declare function ok(path: PathLike, mode?: number): boolean;
/**
* Can the current process write to this path?
*/
export declare function writable(path: PathLike): boolean;
/**
* Can the current process read this path?
*/
export declare function readable(path: PathLike): boolean;
/**
* Can the current process execute this path?
*/
export declare function executable(path: PathLike): boolean;

39
backend/node_modules/empathic/access.js generated vendored Normal file
View File

@@ -0,0 +1,39 @@
// re-export existsSync?
const { accessSync, constants } = require("node:fs");
/**
* Does the current process have {@link mode} access?
* By default, checks if the path is visible to the proccess.
*
* @param mode A `fs.constants` value; default `F_OK`
*/
function ok(path, mode) {
try {
accessSync(path, mode);
return true;
} catch {
return false;
}
}
/**
* Can the current process write to this path?
*/
function writable(path) {
return ok(path, constants.W_OK);
}
/**
* Can the current process read this path?
*/
function readable(path) {
return ok(path, constants.R_OK);
}
/**
* Can the current process execute this path?
*/
function executable(path) {
return ok(path, constants.X_OK);
}
exports.ok = ok;
exports.writable = writable;
exports.readable = readable;
exports.executable = executable;

34
backend/node_modules/empathic/access.mjs generated vendored Normal file
View File

@@ -0,0 +1,34 @@
// re-export existsSync?
import { accessSync, constants } from "node:fs";
/**
* Does the current process have {@link mode} access?
* By default, checks if the path is visible to the proccess.
*
* @param mode A `fs.constants` value; default `F_OK`
*/
export function ok(path, mode) {
try {
accessSync(path, mode);
return true;
} catch {
return false;
}
}
/**
* Can the current process write to this path?
*/
export function writable(path) {
return ok(path, constants.W_OK);
}
/**
* Can the current process read this path?
*/
export function readable(path) {
return ok(path, constants.R_OK);
}
/**
* Can the current process execute this path?
*/
export function executable(path) {
return ok(path, constants.X_OK);
}

41
backend/node_modules/empathic/find.d.ts generated vendored Normal file
View File

@@ -0,0 +1,41 @@
import type { Options } from "empathic/walk";
export type { Options };
/**
* Find an item by name, walking parent directories until found.
*
* @param name The item name to find.
* @returns The absolute path to the item, if found.
*/
export declare function up(name: string, options?: Options): string | undefined;
/**
* Get the first path that matches any of the names provided.
*
* > [NOTE]
* > The order of {@link names} is respected.
*
* @param names The item names to find.
* @returns The absolute path of the first item found, if any.
*/
export declare function any(names: string[], options?: Options): string | undefined;
/**
* Find a file by name, walking parent directories until found.
*
* > [NOTE]
* > This function only returns a value for file matches.
* > A directory match with the same name will be ignored.
*
* @param name The file name to find.
* @returns The absolute path to the file, if found.
*/
export declare function file(name: string, options?: Options): string | undefined;
/**
* Find a directory by name, walking parent directories until found.
*
* > [NOTE]
* > This function only returns a value for directory matches.
* > A file match with the same name will be ignored.
*
* @param name The directory name to find.
* @returns The absolute path to the file, if found.
*/
export declare function dir(name: string, options?: Options): string | undefined;

81
backend/node_modules/empathic/find.js generated vendored Normal file
View File

@@ -0,0 +1,81 @@
const { join } = require("node:path");
const { existsSync, statSync } = require("node:fs");
const walk = require("empathic/walk");
/**
* Find an item by name, walking parent directories until found.
*
* @param name The item name to find.
* @returns The absolute path to the item, if found.
*/
function up(name, options) {
let dir, tmp;
let start = options && options.cwd || "";
for (dir of walk.up(start, options)) {
tmp = join(dir, name);
if (existsSync(tmp)) return tmp;
}
}
/**
* Get the first path that matches any of the names provided.
*
* > [NOTE]
* > The order of {@link names} is respected.
*
* @param names The item names to find.
* @returns The absolute path of the first item found, if any.
*/
function any(names, options) {
let dir, start = options && options.cwd || "";
let j = 0, len = names.length, tmp;
for (dir of walk.up(start, options)) {
for (j = 0; j < len; j++) {
tmp = join(dir, names[j]);
if (existsSync(tmp)) return tmp;
}
}
}
/**
* Find a file by name, walking parent directories until found.
*
* > [NOTE]
* > This function only returns a value for file matches.
* > A directory match with the same name will be ignored.
*
* @param name The file name to find.
* @returns The absolute path to the file, if found.
*/
function file(name, options) {
let dir, tmp;
let start = options && options.cwd || "";
for (dir of walk.up(start, options)) {
try {
tmp = join(dir, name);
if (statSync(tmp).isFile()) return tmp;
} catch {}
}
}
/**
* Find a directory by name, walking parent directories until found.
*
* > [NOTE]
* > This function only returns a value for directory matches.
* > A file match with the same name will be ignored.
*
* @param name The directory name to find.
* @returns The absolute path to the file, if found.
*/
function dir(name, options) {
let dir, tmp;
let start = options && options.cwd || "";
for (dir of walk.up(start, options)) {
try {
tmp = join(dir, name);
if (statSync(tmp).isDirectory()) return tmp;
} catch {}
}
}
exports.up = up;
exports.any = any;
exports.file = file;
exports.dir = dir;

76
backend/node_modules/empathic/find.mjs generated vendored Normal file
View File

@@ -0,0 +1,76 @@
import { join } from "node:path";
import { existsSync, statSync } from "node:fs";
import * as walk from "empathic/walk";
/**
* Find an item by name, walking parent directories until found.
*
* @param name The item name to find.
* @returns The absolute path to the item, if found.
*/
export function up(name, options) {
let dir, tmp;
let start = options && options.cwd || "";
for (dir of walk.up(start, options)) {
tmp = join(dir, name);
if (existsSync(tmp)) return tmp;
}
}
/**
* Get the first path that matches any of the names provided.
*
* > [NOTE]
* > The order of {@link names} is respected.
*
* @param names The item names to find.
* @returns The absolute path of the first item found, if any.
*/
export function any(names, options) {
let dir, start = options && options.cwd || "";
let j = 0, len = names.length, tmp;
for (dir of walk.up(start, options)) {
for (j = 0; j < len; j++) {
tmp = join(dir, names[j]);
if (existsSync(tmp)) return tmp;
}
}
}
/**
* Find a file by name, walking parent directories until found.
*
* > [NOTE]
* > This function only returns a value for file matches.
* > A directory match with the same name will be ignored.
*
* @param name The file name to find.
* @returns The absolute path to the file, if found.
*/
export function file(name, options) {
let dir, tmp;
let start = options && options.cwd || "";
for (dir of walk.up(start, options)) {
try {
tmp = join(dir, name);
if (statSync(tmp).isFile()) return tmp;
} catch {}
}
}
/**
* Find a directory by name, walking parent directories until found.
*
* > [NOTE]
* > This function only returns a value for directory matches.
* > A file match with the same name will be ignored.
*
* @param name The directory name to find.
* @returns The absolute path to the file, if found.
*/
export function dir(name, options) {
let dir, tmp;
let start = options && options.cwd || "";
for (dir of walk.up(start, options)) {
try {
tmp = join(dir, name);
if (statSync(tmp).isDirectory()) return tmp;
} catch {}
}
}

9
backend/node_modules/empathic/license generated vendored Normal file
View File

@@ -0,0 +1,9 @@
MIT License
Copyright (c) Luke Edwards <luke.edwards05@gmail.com> (lukeed.com)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

27
backend/node_modules/empathic/package.d.ts generated vendored Normal file
View File

@@ -0,0 +1,27 @@
import * as find from "empathic/find";
/**
* Find the closest "package.json" file while walking parent directories.
* @returns The absolute path to a "package.json", if found.
*/
export declare function up(options?: find.Options): string | undefined;
/**
* Construct a path to a `node_modules/.cache/<name>` directory.
*
* This may return `undefined` if:
* 1. no "package.json" could be found
* 2. the nearest "node_modules" directory is not writable
* 3. the "node_modules" parent directory is not writable
*
* > [NOTE]
* > You may define a `CACHE_DIR` environment variable, which will be
* > used (as defined) instead of traversing the filesystem for the
* > closest "package.json" and inferring a "node_modules" location.
*
* @see find-cache-dir for more information.
*
* @param name The name of your module/cache.
* @returns The absolute path of the cache directory, if found.
*/
export declare function cache(name: string, options?: find.Options & {
create?: boolean;
}): string | undefined;

55
backend/node_modules/empathic/package.js generated vendored Normal file
View File

@@ -0,0 +1,55 @@
const { env } = require("node:process");
const { dirname, join } = require("node:path");
const { existsSync, mkdirSync } = require("node:fs");
const { writable } = require("empathic/access");
const find = require("empathic/find");
/**
* Find the closest "package.json" file while walking parent directories.
* @returns The absolute path to a "package.json", if found.
*/
function up(options) {
return find.up("package.json", options);
}
/**
* Construct a path to a `node_modules/.cache/<name>` directory.
*
* This may return `undefined` if:
* 1. no "package.json" could be found
* 2. the nearest "node_modules" directory is not writable
* 3. the "node_modules" parent directory is not writable
*
* > [NOTE]
* > You may define a `CACHE_DIR` environment variable, which will be
* > used (as defined) instead of traversing the filesystem for the
* > closest "package.json" and inferring a "node_modules" location.
*
* @see find-cache-dir for more information.
*
* @param name The name of your module/cache.
* @returns The absolute path of the cache directory, if found.
*/
function cache(name, options) {
options = options || {};
let dir = env.CACHE_DIR;
if (!dir || /^(1|0|true|false)$/.test(dir)) {
let pkg = up(options);
if (dir = pkg && dirname(pkg)) {
let mods = join(dir, "node_modules");
let exists = existsSync(mods);
// exit cuz exists but not writable
// or cuz missing but parent not writable
if (!writable(exists ? mods : dir)) return;
dir = join(mods, ".cache");
}
}
if (dir) {
dir = join(dir, name);
if (options.create && !existsSync(dir)) {
mkdirSync(dir, { recursive: true });
}
return dir;
}
}
exports.up = up;
exports.cache = cache;

49
backend/node_modules/empathic/package.json generated vendored Normal file
View File

@@ -0,0 +1,49 @@
{
"name": "empathic",
"version": "2.0.0",
"repository": "lukeed/empathic",
"description": "A set of small and fast Node.js utilities to understand your pathing needs.",
"license": "MIT",
"author": {
"name": "Luke Edwards",
"email": "luke.edwards05@gmail.com",
"url": "https://lukeed.com"
},
"exports": {
"./access": {
"types": "./access.d.ts",
"import": "./access.mjs",
"require": "./access.js"
},
"./find": {
"types": "./find.d.ts",
"import": "./find.mjs",
"require": "./find.js"
},
"./package": {
"types": "./package.d.ts",
"import": "./package.mjs",
"require": "./package.js"
},
"./resolve": {
"types": "./resolve.d.ts",
"import": "./resolve.mjs",
"require": "./resolve.js"
},
"./walk": {
"types": "./walk.d.ts",
"import": "./walk.mjs",
"require": "./walk.js"
},
"./package.json": "./package.json"
},
"scripts": {
"test": "uvu"
},
"engines": {
"node": ">=14"
},
"devDependencies": {
"uvu": "0.5"
}
}

52
backend/node_modules/empathic/package.mjs generated vendored Normal file
View File

@@ -0,0 +1,52 @@
import { env } from "node:process";
import { dirname, join } from "node:path";
import { existsSync, mkdirSync } from "node:fs";
import { writable } from "empathic/access";
import * as find from "empathic/find";
/**
* Find the closest "package.json" file while walking parent directories.
* @returns The absolute path to a "package.json", if found.
*/
export function up(options) {
return find.up("package.json", options);
}
/**
* Construct a path to a `node_modules/.cache/<name>` directory.
*
* This may return `undefined` if:
* 1. no "package.json" could be found
* 2. the nearest "node_modules" directory is not writable
* 3. the "node_modules" parent directory is not writable
*
* > [NOTE]
* > You may define a `CACHE_DIR` environment variable, which will be
* > used (as defined) instead of traversing the filesystem for the
* > closest "package.json" and inferring a "node_modules" location.
*
* @see find-cache-dir for more information.
*
* @param name The name of your module/cache.
* @returns The absolute path of the cache directory, if found.
*/
export function cache(name, options) {
options = options || {};
let dir = env.CACHE_DIR;
if (!dir || /^(1|0|true|false)$/.test(dir)) {
let pkg = up(options);
if (dir = pkg && dirname(pkg)) {
let mods = join(dir, "node_modules");
let exists = existsSync(mods);
// exit cuz exists but not writable
// or cuz missing but parent not writable
if (!writable(exists ? mods : dir)) return;
dir = join(mods, ".cache");
}
}
if (dir) {
dir = join(dir, name);
if (options.create && !existsSync(dir)) {
mkdirSync(dir, { recursive: true });
}
return dir;
}
}

76
backend/node_modules/empathic/readme.md generated vendored Normal file
View File

@@ -0,0 +1,76 @@
# empathic [![CI](https://github.com/lukeed/empathic/workflows/CI/badge.svg)](https://github.com/lukeed/empathic/actions?query=workflow%3ACI) [![licenses](https://licenses.dev/b/npm/empathic)](https://licenses.dev/npm/empathic)
> A set of small and [fast](/benchmarks.md) Node.js utilities to understand your pathing needs.
Multiple submodules (eg, `empathic/find`) are offered, _each of which_ are:
* **fast** — 8x to 40x faster than popular alternatives
* **modern** — based on newer `node:*` native APIs
* **small** — ranging from 200b to 500b in size
* **safe** — zero-dependency & easy to read
## Install
```sh
$ npm install empathic
```
## Usage
```ts
import { resolve } from 'node:path';
import * as find from 'empathic/find';
import * as pkg from 'empathic/package';
// Assumed example structure:
let cwd = resolve('path/to/acme/websites/dashboard');
// Find closest "foobar.config.js" file
let file = find.up('foobar.config.js', { cwd });
//=> "/.../path/to/acme/foobar.config.js"
// Find closest "package.json" file
let pkgfile = pkg.up({ cwd });
//=> "/.../path/to/acme/package.json"
// Construct (optionally create) "foobar" cache dir
let cache = pkg.cache('foobar', { cwd, create: true });
//=> "/.../path/to/acme/node_modules/.cache/foobar"
```
## API
### `empathic/access`
> [Source](/src/access.ts) · **Size:** `259b`
Check for file access/permissions. Named [`fs.accessSync`](https://nodejs.org/docs/latest/api/fs.html#fsaccesssyncpath-mode) shortcuts.
### `empathic/find`
> [Source](/src/find.ts) · [Benchmark](/benchmarks.md#find) · **Size:** `569b`
Find files and/or directories by walking up parent directories.
### `empathic/package`
> [Source](/src/package.ts) · [Benchmark](/benchmarks.md#package) · **Size:** `505b`
Convenience helpers for dealing with `package.json` files and/or `node_modules` packages.
### `empathic/resolve`
> [Source](/src/resolve.ts) · [Benchmark](/benchmarks.md#resolve) · **Size:** `419b`
Resolve absolute paths to package identifiers, relative paths, file URL, and/or from other root directories.
### `empathic/walk`
> [Source](/src/walk.ts) · [Benchmark](/benchmarks.md#walk) · **Size:** `208b`
Collect all the parent directories of a target. Controlled via `cwd` and `last` options.
## License
MIT © [Luke Edwards](https://lukeed.com)

29
backend/node_modules/empathic/resolve.d.ts generated vendored Normal file
View File

@@ -0,0 +1,29 @@
/**
* Resolve an absolute path from {@link root}, but only
* if {@link input} isn't already absolute.
*
* @param input The path to resolve.
* @param root The base path; default = process.cwd()
* @returns The resolved absolute path.
*/
export declare function absolute(input: string, root?: string): string;
/**
* Resolve a module path from a given root directory.
*
* Emulates [`require.resolve`](https://nodejs.org/docs/latest/api/modules.html#requireresolverequest-options), so module identifiers are allowed.
*
* @see resolve-from
*/
export declare function from(root: URL | string, ident: string, silent: true): string | undefined;
export declare function from(root: URL | string, ident: string, silent?: false): string;
export declare function from(root: URL | string, ident: string, silent?: boolean): string | undefined;
/**
* Resolve a module path from the current working directory.
*
* Alias for {@link from} using the CWD as its root.
*
* @see resolve-cwd
*/
export declare function cwd(ident: string, silent: true): string | undefined;
export declare function cwd(ident: string, silent?: false): string;
export declare function cwd(ident: string, silent?: boolean): string | undefined;

31
backend/node_modules/empathic/resolve.js generated vendored Normal file
View File

@@ -0,0 +1,31 @@
const { createRequire } = require("node:module");
const { isAbsolute, join, resolve } = require("node:path");
const { fileURLToPath } = require("node:url");
/**
* Resolve an absolute path from {@link root}, but only
* if {@link input} isn't already absolute.
*
* @param input The path to resolve.
* @param root The base path; default = process.cwd()
* @returns The resolved absolute path.
*/
function absolute(input, root) {
return isAbsolute(input) ? input : resolve(root || ".", input);
}
function from(root, ident, silent) {
try {
// NOTE: dirs need a trailing "/" OR filename. With "/" route,
// Node adds "noop.js" as main file, so just do "noop.js" anyway.
let r = root instanceof URL || root.startsWith("file://") ? join(fileURLToPath(root), "noop.js") : join(absolute(root), "noop.js");
return createRequire(r).resolve(ident);
} catch (err) {
if (!silent) throw err;
}
}
function cwd(ident, silent) {
return from(resolve(), ident, silent);
}
exports.absolute = absolute;
exports.from = from;
exports.cwd = cwd;

27
backend/node_modules/empathic/resolve.mjs generated vendored Normal file
View File

@@ -0,0 +1,27 @@
import { createRequire } from "node:module";
import { isAbsolute, join, resolve } from "node:path";
import { fileURLToPath } from "node:url";
/**
* Resolve an absolute path from {@link root}, but only
* if {@link input} isn't already absolute.
*
* @param input The path to resolve.
* @param root The base path; default = process.cwd()
* @returns The resolved absolute path.
*/
export function absolute(input, root) {
return isAbsolute(input) ? input : resolve(root || ".", input);
}
export function from(root, ident, silent) {
try {
// NOTE: dirs need a trailing "/" OR filename. With "/" route,
// Node adds "noop.js" as main file, so just do "noop.js" anyway.
let r = root instanceof URL || root.startsWith("file://") ? join(fileURLToPath(root), "noop.js") : join(absolute(root), "noop.js");
return createRequire(r).resolve(ident);
} catch (err) {
if (!silent) throw err;
}
}
export function cwd(ident, silent) {
return from(resolve(), ident, silent);
}

23
backend/node_modules/empathic/walk.d.ts generated vendored Normal file
View File

@@ -0,0 +1,23 @@
export type Options = {
/**
* The CWD for the operation.
* @default "." (process.cwd)
*/
cwd?: string;
/**
* The last directory to traverse.
*
* > [NOTE]
* > This directory is INCLUSIVE.
*
* @default "/"
*/
last?: string;
};
/**
* Get all parent directories of {@link base}.
* Stops after {@link Options['last']} is processed.
*
* @returns An array of absolute paths of all parent directories.
*/
export declare function up(base: string, options?: Options): string[];

22
backend/node_modules/empathic/walk.js generated vendored Normal file
View File

@@ -0,0 +1,22 @@
const { dirname } = require("node:path");
const { absolute } = require("empathic/resolve");
/**
* Get all parent directories of {@link base}.
* Stops after {@link Options['last']} is processed.
*
* @returns An array of absolute paths of all parent directories.
*/
function up(base, options) {
let { last, cwd } = options || {};
let tmp = absolute(base, cwd);
let root = absolute(last || "/", cwd);
let prev, arr = [];
while (prev !== root) {
arr.push(tmp);
tmp = dirname(prev = tmp);
if (tmp === prev) break;
}
return arr;
}
exports.up = up;

20
backend/node_modules/empathic/walk.mjs generated vendored Normal file
View File

@@ -0,0 +1,20 @@
import { dirname } from "node:path";
import { absolute } from "empathic/resolve";
/**
* Get all parent directories of {@link base}.
* Stops after {@link Options['last']} is processed.
*
* @returns An array of absolute paths of all parent directories.
*/
export function up(base, options) {
let { last, cwd } = options || {};
let tmp = absolute(base, cwd);
let root = absolute(last || "/", cwd);
let prev, arr = [];
while (prev !== root) {
arr.push(tmp);
tmp = dirname(prev = tmp);
if (tmp === prev) break;
}
return arr;
}