This commit is contained in:
lalBi94
2023-03-05 13:23:23 +01:00
commit 7bc56c09b5
14034 changed files with 1834369 additions and 0 deletions

101
node_modules/env-paths/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,101 @@
declare namespace envPaths {
export interface Options {
/**
__Don't use this option unless you really have to!__
Suffix appended to the project name to avoid name conflicts with native apps. Pass an empty string to disable it.
@default 'nodejs'
*/
readonly suffix?: string;
}
export interface Paths {
/**
Directory for data files.
Example locations (with the default `nodejs` suffix):
- macOS: `~/Library/Application Support/MyApp-nodejs`
- Windows: `%LOCALAPPDATA%\MyApp-nodejs\Data` (for example, `C:\Users\USERNAME\AppData\Local\MyApp-nodejs\Data`)
- Linux: `~/.local/share/MyApp-nodejs` (or `$XDG_DATA_HOME/MyApp-nodejs`)
*/
readonly data: string;
/**
Directory for data files.
Example locations (with the default `nodejs` suffix):
- macOS: `~/Library/Preferences/MyApp-nodejs`
- Windows: `%APPDATA%\MyApp-nodejs\Config` (for example, `C:\Users\USERNAME\AppData\Roaming\MyApp-nodejs\Config`)
- Linux: `~/.config/MyApp-nodejs` (or `$XDG_CONFIG_HOME/MyApp-nodejs`)
*/
readonly config: string;
/**
Directory for non-essential data files.
Example locations (with the default `nodejs` suffix):
- macOS: `~/Library/Caches/MyApp-nodejs`
- Windows: `%LOCALAPPDATA%\MyApp-nodejs\Cache` (for example, `C:\Users\USERNAME\AppData\Local\MyApp-nodejs\Cache`)
- Linux: `~/.cache/MyApp-nodejs` (or `$XDG_CACHE_HOME/MyApp-nodejs`)
*/
readonly cache: string;
/**
Directory for log files.
Example locations (with the default `nodejs` suffix):
- macOS: `~/Library/Logs/MyApp-nodejs`
- Windows: `%LOCALAPPDATA%\MyApp-nodejs\Log` (for example, `C:\Users\USERNAME\AppData\Local\MyApp-nodejs\Log`)
- Linux: `~/.local/state/MyApp-nodejs` (or `$XDG_STATE_HOME/MyApp-nodejs`)
*/
readonly log: string;
/**
Directory for temporary files.
Example locations (with the default `nodejs` suffix):
- macOS: `/var/folders/jf/f2twvvvs5jl_m49tf034ffpw0000gn/T/MyApp-nodejs`
- Windows: `%LOCALAPPDATA%\Temp\MyApp-nodejs` (for example, `C:\Users\USERNAME\AppData\Local\Temp\MyApp-nodejs`)
- Linux: `/tmp/USERNAME/MyApp-nodejs`
*/
readonly temp: string;
}
}
declare const envPaths: {
/**
Get paths for storing things like data, config, cache, etc.
Note: It only generates the path strings. It doesn't create the directories for you. You could use [`make-dir`](https://github.com/sindresorhus/make-dir) to create the directories.
@param name - Name of your project. Used to generate the paths.
@returns The paths to use for your project on current OS.
@example
```
import envPaths = require('env-paths');
const paths = envPaths('MyApp');
paths.data;
//=> '/home/sindresorhus/.local/share/MyApp-nodejs'
paths.config
//=> '/home/sindresorhus/.config/MyApp-nodejs'
```
*/
(name: string, options?: envPaths.Options): envPaths.Paths;
// TODO: Remove this for the next major release, refactor the whole definition to:
// declare function envPaths(name: string, options?: envPaths.Options): envPaths.Paths;
// export = envPaths;
default: typeof envPaths;
};
export = envPaths;

74
node_modules/env-paths/index.js generated vendored Normal file
View File

@@ -0,0 +1,74 @@
'use strict';
const path = require('path');
const os = require('os');
const homedir = os.homedir();
const tmpdir = os.tmpdir();
const {env} = process;
const macos = name => {
const library = path.join(homedir, 'Library');
return {
data: path.join(library, 'Application Support', name),
config: path.join(library, 'Preferences', name),
cache: path.join(library, 'Caches', name),
log: path.join(library, 'Logs', name),
temp: path.join(tmpdir, name)
};
};
const windows = name => {
const appData = env.APPDATA || path.join(homedir, 'AppData', 'Roaming');
const localAppData = env.LOCALAPPDATA || path.join(homedir, 'AppData', 'Local');
return {
// Data/config/cache/log are invented by me as Windows isn't opinionated about this
data: path.join(localAppData, name, 'Data'),
config: path.join(appData, name, 'Config'),
cache: path.join(localAppData, name, 'Cache'),
log: path.join(localAppData, name, 'Log'),
temp: path.join(tmpdir, name)
};
};
// https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
const linux = name => {
const username = path.basename(homedir);
return {
data: path.join(env.XDG_DATA_HOME || path.join(homedir, '.local', 'share'), name),
config: path.join(env.XDG_CONFIG_HOME || path.join(homedir, '.config'), name),
cache: path.join(env.XDG_CACHE_HOME || path.join(homedir, '.cache'), name),
// https://wiki.debian.org/XDGBaseDirectorySpecification#state
log: path.join(env.XDG_STATE_HOME || path.join(homedir, '.local', 'state'), name),
temp: path.join(tmpdir, username, name)
};
};
const envPaths = (name, options) => {
if (typeof name !== 'string') {
throw new TypeError(`Expected string, got ${typeof name}`);
}
options = Object.assign({suffix: 'nodejs'}, options);
if (options.suffix) {
// Add suffix to prevent possible conflict with native apps
name += `-${options.suffix}`;
}
if (process.platform === 'darwin') {
return macos(name);
}
if (process.platform === 'win32') {
return windows(name);
}
return linux(name);
};
module.exports = envPaths;
// TODO: Remove this for the next major release
module.exports.default = envPaths;

9
node_modules/env-paths/license generated vendored Normal file
View File

@@ -0,0 +1,9 @@
MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.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.

45
node_modules/env-paths/package.json generated vendored Normal file
View File

@@ -0,0 +1,45 @@
{
"name": "env-paths",
"version": "2.2.1",
"description": "Get paths for storing things like data, config, cache, etc",
"license": "MIT",
"repository": "sindresorhus/env-paths",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=6"
},
"scripts": {
"test": "xo && ava && tsd"
},
"files": [
"index.js",
"index.d.ts"
],
"keywords": [
"common",
"user",
"paths",
"env",
"environment",
"directory",
"dir",
"appdir",
"path",
"data",
"config",
"cache",
"logs",
"temp",
"linux",
"unix"
],
"devDependencies": {
"ava": "^1.4.1",
"tsd": "^0.7.1",
"xo": "^0.24.0"
}
}

115
node_modules/env-paths/readme.md generated vendored Normal file
View File

@@ -0,0 +1,115 @@
# env-paths
> Get paths for storing things like data, config, cache, etc
Uses the correct OS-specific paths. Most developers get this wrong.
## Install
```
$ npm install env-paths
```
## Usage
```js
const envPaths = require('env-paths');
const paths = envPaths('MyApp');
paths.data;
//=> '/home/sindresorhus/.local/share/MyApp-nodejs'
paths.config
//=> '/home/sindresorhus/.config/MyApp-nodejs'
```
## API
### paths = envPaths(name, options?)
Note: It only generates the path strings. It doesn't create the directories for you. You could use [`make-dir`](https://github.com/sindresorhus/make-dir) to create the directories.
#### name
Type: `string`
Name of your project. Used to generate the paths.
#### options
Type: `object`
##### suffix
Type: `string`<br>
Default: `'nodejs'`
**Don't use this option unless you really have to!**<br>
Suffix appended to the project name to avoid name conflicts with native
apps. Pass an empty string to disable it.
### paths.data
Directory for data files.
Example locations (with the default `nodejs` [suffix](#suffix)):
- macOS: `~/Library/Application Support/MyApp-nodejs`
- Windows: `%LOCALAPPDATA%\MyApp-nodejs\Data` (for example, `C:\Users\USERNAME\AppData\Local\MyApp-nodejs\Data`)
- Linux: `~/.local/share/MyApp-nodejs` (or `$XDG_DATA_HOME/MyApp-nodejs`)
### paths.config
Directory for config files.
Example locations (with the default `nodejs` [suffix](#suffix)):
- macOS: `~/Library/Preferences/MyApp-nodejs`
- Windows: `%APPDATA%\MyApp-nodejs\Config` (for example, `C:\Users\USERNAME\AppData\Roaming\MyApp-nodejs\Config`)
- Linux: `~/.config/MyApp-nodejs` (or `$XDG_CONFIG_HOME/MyApp-nodejs`)
### paths.cache
Directory for non-essential data files.
Example locations (with the default `nodejs` [suffix](#suffix)):
- macOS: `~/Library/Caches/MyApp-nodejs`
- Windows: `%LOCALAPPDATA%\MyApp-nodejs\Cache` (for example, `C:\Users\USERNAME\AppData\Local\MyApp-nodejs\Cache`)
- Linux: `~/.cache/MyApp-nodejs` (or `$XDG_CACHE_HOME/MyApp-nodejs`)
### paths.log
Directory for log files.
Example locations (with the default `nodejs` [suffix](#suffix)):
- macOS: `~/Library/Logs/MyApp-nodejs`
- Windows: `%LOCALAPPDATA%\MyApp-nodejs\Log` (for example, `C:\Users\USERNAME\AppData\Local\MyApp-nodejs\Log`)
- Linux: `~/.local/state/MyApp-nodejs` (or `$XDG_STATE_HOME/MyApp-nodejs`)
### paths.temp
Directory for temporary files.
Example locations (with the default `nodejs` [suffix](#suffix)):
- macOS: `/var/folders/jf/f2twvvvs5jl_m49tf034ffpw0000gn/T/MyApp-nodejs`
- Windows: `%LOCALAPPDATA%\Temp\MyApp-nodejs` (for example, `C:\Users\USERNAME\AppData\Local\Temp\MyApp-nodejs`)
- Linux: `/tmp/USERNAME/MyApp-nodejs`
---
<div align="center">
<b>
<a href="https://tidelift.com/subscription/pkg/npm-env-paths?utm_source=npm-env-paths&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
</b>
<br>
<sub>
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
</sub>
</div>