Update app and tooling

This commit is contained in:
Lawrence Chen 2026-01-29 17:36:26 -08:00
parent 3046531bdd
commit e620ec7349
4950 changed files with 2975120 additions and 10 deletions

16
node_modules/xdg-app-paths/index.d.ts generated vendored Normal file
View file

@ -0,0 +1,16 @@
// # spell-checker:ignore rivy
declare namespace XDGAppPaths {
function cache(dir_options?: boolean | {isolated: boolean}): string;
function config(dir_options?: boolean | {isolated: boolean}): string;
function data(dir_options?: boolean | {isolated: boolean}): string;
function runtime(dir_options?: boolean | {isolated: boolean}): string | undefined;
function state(dir_options?: boolean | {isolated: boolean}): string;
function configDirs(dir_options?: boolean | {isolated: boolean}): string[];
function dataDirs(dir_options?: boolean | {isolated: boolean}): string[];
function $name(): string;
function $isolated(): boolean;
}
declare function XDGAppPaths( options?: string | {name: string, suffix: string, isolated: boolean} ): typeof XDGAppPaths;
export = XDGAppPaths;

187
node_modules/xdg-app-paths/index.js generated vendored Normal file
View file

@ -0,0 +1,187 @@
// # spell-checker:ignore macos APPDATA LOCALAPPDATA
/* eslint-env es6, node */
'use strict';
const path = require('path');
const os = require('os');
const xdg = require('xdg-portable');
const isWinOS = /^win/i.test(process.platform);
function _normalizeOptions(options, isolated) {
options = options || {};
if (typeof options !== 'object') {
options = {isolated: options};
}
options.isolated = ((options.isolated === undefined) || (options.isolated === null)) ? isolated : options.isolated;
if (typeof options.isolated !== 'boolean') {
throw new TypeError(`Expected boolean for "isolated" argument, got ${typeof options.isolated}`);
}
return options;
}
const base = (name, isolated) => {
const object = {};
object.cache = (options = {isolated: null}) => {
options = _normalizeOptions(options, isolated);
return path.join(xdg.cache(), options.isolated ? name : '');
};
object.config = (options = {isolated: null}) => {
options = _normalizeOptions(options, isolated);
return path.join(xdg.config(), options.isolated ? name : '');
};
object.data = (options = {isolated: null}) => {
options = _normalizeOptions(options, isolated);
return path.join(xdg.data(), options.isolated ? name : '');
};
object.runtime = (options = {isolated: null}) => {
options = _normalizeOptions(options, isolated);
return xdg.runtime() ? path.join(xdg.runtime(), options.isolated ? name : '') : undefined;
};
object.state = (options = {isolated: null}) => {
options = _normalizeOptions(options, isolated);
return path.join(xdg.state(), options.isolated ? name : '');
};
object.configDirs = (options = {isolated: null}) => {
options = _normalizeOptions(options, isolated);
return (xdg.configDirs()).map(s => path.join(s, options.isolated ? name : ''));
};
object.dataDirs = (options = {isolated: null}) => {
options = _normalizeOptions(options, isolated);
return (xdg.dataDirs()).map(s => path.join(s, options.isolated ? name : ''));
};
return object;
};
const windows = (name, isolated) => {
const {env} = process;
const homedir = os.homedir();
const tmpdir = os.tmpdir();
// # ref: <https://www.thewindowsclub.com/local-localnow-roaming-folders-windows-10> @@ <http://archive.is/tDEPl>
const appData = env.APPDATA || path.join(homedir || tmpdir, 'AppData', 'Roaming'); // APPDATA == "AppData/Roaming" contains data which may follow user between machines
const localAppData = env.LOCALAPPDATA || path.join(homedir || tmpdir, 'AppData', 'Local'); // LOCALAPPDATA == "AppData/Local" contains local-machine-only user data
const object = {};
// Locations for data/config/cache/state are invented (Windows doesn't have a popular convention)
object.cache = (options = {isolated: null}) => {
options = _normalizeOptions(options, isolated);
return (!options.isolated || env.XDG_CACHE_HOME) ?
path.join(xdg.cache(), options.isolated ? name : '') :
path.join(localAppData, options.isolated ? name : '', 'Cache');
};
object.config = (options = {isolated: null}) => {
options = _normalizeOptions(options, isolated);
const config = (!options.isolated || env.XDG_CONFIG_HOME) ?
path.join(xdg.config(), options.isolated ? name : '') :
path.join(appData, options.isolated ? name : '', 'Config');
return config;
};
object.data = (options = {isolated: null}) => {
options = _normalizeOptions(options, isolated);
const data = (!options.isolated || env.XDG_DATA_HOME) ?
path.join(xdg.data(), options.isolated ? name : '') :
path.join(appData, options.isolated ? name : '', 'Data');
return data;
};
object.runtime = (options = {isolated: null}) => {
options = _normalizeOptions(options, isolated);
return xdg.runtime() ? path.join(xdg.runtime(), options.isolated ? name : '') : undefined;
};
object.state = (options = {isolated: null}) => {
options = _normalizeOptions(options, isolated);
return (!options.isolated || env.XDG_STATE_HOME) ?
path.join(xdg.state(), options.isolated ? name : '') :
path.join(localAppData, options.isolated ? name : '', 'State');
};
object.configDirs = (options = {isolated: null}) => {
options = _normalizeOptions(options, isolated);
const dirs = [object.config(options)];
if (env.XDG_CONFIG_DIRS) {
dirs.push(...env.XDG_CONFIG_DIRS.split(path.delimiter).map(s => path.join(s, options.isolated ? name : '')));
}
return dirs;
};
object.dataDirs = (options = {isolated: null}) => {
options = _normalizeOptions(options, isolated);
const dirs = [object.data(options)];
if (env.XDG_DATA_DIRS) {
dirs.push(...env.XDG_DATA_DIRS.split(path.delimiter).map(s => path.join(s, options.isolated ? name : '')));
}
return dirs;
};
return object;
};
class _XDGAppPaths {
constructor(options = {name: null, suffix: null, isolated: true}) {
const XDGAppPaths = function (options = {name: null, suffix: null, isolated: true}) {
return new _XDGAppPaths(options);
};
this._fn = XDGAppPaths;
options = options || {};
if (typeof options !== 'object') {
options = {name: options};
}
let name = options.name || '';
if (typeof name !== 'string') {
throw new TypeError(`Expected string for "name" argument, got ${typeof name}`);
}
const suffix = options.suffix || '';
if (typeof suffix !== 'string') {
throw new TypeError(`Expected string for "suffix" argument, got ${typeof suffix}`);
}
const isolated = ((options.isolated === undefined) || (options.isolated === null)) ? true : options.isolated;
if (typeof isolated !== 'boolean') {
throw new TypeError(`Expected boolean for "isolated" argument, got ${typeof isolated}`);
}
if (!name) {
// Find a suitable application name (ref: <https://stackoverflow.com/a/46110961/43774>)
name = path.parse(process.pkg ? process.execPath : (require.main ? require.main.filename : process.argv[0])).name;
}
if (suffix) {
name += suffix;
}
this._fn.$name = () => name;
this._fn.$isolated = () => isolated;
// Connect to platform-specific API functions by extension
const extension = isWinOS ? windows(name, isolated) : base(name, isolated);
Object.keys(extension).forEach(key => {
this._fn[key] = extension[key];
});
return this._fn;
}
}
module.exports = new _XDGAppPaths();

10
node_modules/xdg-app-paths/license generated vendored Normal file
View file

@ -0,0 +1,10 @@
MIT License
Copyright (c) Roy Ivy III <rivy.dev@gmail.com>
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.

56
node_modules/xdg-app-paths/package.json generated vendored Normal file
View file

@ -0,0 +1,56 @@
{
"name": "xdg-app-paths",
"version": "5.1.0",
"description": "Generate portable (and XDG-compatible) paths for storing cache, config, data, etc",
"license": "MIT",
"repository": "rivy/js.xdg-app-paths",
"author": {
"name": "Roy Ivy III",
"email": "rivy.dev@gmail.com"
},
"engines": {
"node": ">=6"
},
"scripts": {
"coverage": "nyc report --reporter=text-lcov | codecov --disable=gcov --pipe",
"test": "xo && nyc --silent ava && tsd"
},
"files": [
"index.js",
"index.d.ts"
],
"keywords": [
"appdir",
"cache",
"common",
"config",
"data",
"dir",
"directory",
"env",
"environment",
"linux",
"logs",
"path",
"paths",
"temp",
"unix",
"user",
"windows",
"xdg"
],
"devDependencies": {
"ava": "^1.4.1",
"codecov": "^3.5.0",
"coveralls": "^3.0.5",
"eslint": "^6.1.0",
"lodash": "^4.17.11",
"nyc": "^14.1.1",
"tsd": "^0.7.1",
"util": "^0.12.1",
"xo": "^0.24.0"
},
"dependencies": {
"xdg-portable": "^7.0.0"
}
}

250
node_modules/xdg-app-paths/readme.md generated vendored Normal file
View file

@ -0,0 +1,250 @@
<!DOCTYPE markdown><!-- markdownlint-disable no-inline-html -->
<meta charset="utf-8" content="text/markdown" lang="en">
<!-- -## editors ## (emacs/sublime) -*- coding: utf8-nix; tab-width: 4; mode: markdown; indent-tabs-mode: nil; basic-offset: 2; st-word_wrap: 'true' -*- ## (jEdit) :tabSize=4:indentSize=4:mode=markdown: ## (notepad++) vim:tabstop=4:syntax=markdown:expandtab:smarttab:softtabstop=2 ## modeline (see <https://archive.is/djTUD>@@<http://webcitation.org/66W3EhCAP> ) -->
<!-- spell-checker:ignore expandtab markdownlint modeline smarttab softtabstop -->
<!-- markdownlint-disable heading-increment ul-style -->
<!-- spell-checker:ignore rivy Sindre sindresorhus Sorhus -->
<!-- spell-checker:ignore APPDATA LOCALAPPDATA typeof -->
# [xdg-app-paths](https://github.com/rivy/js.xdg-app-paths)
> Get ([XDG](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html)-compatible) application-specific (and cross-platform) paths for storing things like cache, config, data, state, etc
[![License][license-image]][license-url]
[![Build status][travis-image]][travis-url]
[![Build status][appveyor-image]][appveyor-url]
[![Coverage status][coverage-image]][coverage-url]
[![Javascript Style Guide][style-image]][style-url]
<br/>
[![NPM version][npm-image]][npm-url]
[![Downloads][downloads-image]][downloads-url]
<!--
## References
// XDG references
// # ref: <https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html> @@ <https://archive.is/aAhtw>
// # ref: <https://specifications.freedesktop.org/basedir-spec/latest/ar01s03.html> @@ <https://archive.is/7N0TN>
// # ref: <https://wiki.archlinux.org/index.php/XDG_Base_Directory> @@ <https://archive.is/VdO9n>
// # ref: <https://wiki.debian.org/XDGBaseDirectorySpecification#state> @@ <http://archive.is/pahId>
// # ref: <https://ploum.net/207-modify-your-application-to-use-xdg-folders> @@ <https://archive.is/f43Gk>
-->
## Installation
```shell
npm install xdg-app-paths
```
## Usage
```js
// MyApp.js
const paths = require('xdg-app-paths');
paths.cache();
//(nix)=> '/home/rivy/.cache/MyApp.js'
//(win)=> 'C:\\Users\\rivy\\AppData\\Local\\MyApp\\Cache'
paths.config();
//(nix)=> '/home/rivy/.config/MyApp.js'
//(win)=> 'C:\\Users\\rivy\\AppData\\Roaming\\MyApp\\Config'
paths.data();
//(nix)=> '/home/rivy/.local/share/MyApp.js'
//(win)=> 'C:\\Users\\rivy\\AppData\\Roaming\\MyApp\\Data'
```
## API
### Initialization
#### `require('xdg-app-paths')( options? ): XDGAppPaths()`
```js
const xdgAppPaths = require('xdg-app-paths');
// or ...
const xdgAppPaths = require('xdg-app-paths')( options );
```
The object returned by the module constructor is an XDGAppPaths Function object, augmented with attached methods. When called directly (eg, `const p = xdgAppPaths(...)`), it acts as a constructor, returning a new, and unrelated, XDGAppPaths object.
> #### `options`
>
> ##### `options: string` => `{ name: string }`
>
> As a shortcut, when supplied as a `string`, options is interpreted as the options name property (ie, `options = { name: options }`).
>
> ##### `options: object`
>
> * default = `{ name: '', suffix: '', isolated: true }`
>
> ###### `options.name: string`
>
> * default = `''`
>
> Name of your application; used to generate the paths. If missing, `null`, or empty (`''`), it is generated automatically from the available process information.
>
> ###### `options.suffix: string`
>
> * default = `''`
>
> Suffix which is appended to the application name when generating the application paths.
>
> ###### `options.isolated: boolean`
>
> * default = `true`
>
> Default isolation flag.
### Methods
All returned path strings are simple, platform-compatible, strings and are *not* guaranteed to exist. The application is responsible for construction of the directories. If needed, [`make-dir`](https://www.npmjs.com/package/make-dir) or [`mkdirp`](https://www.npmjs.com/package/mkdirp) can be used to create the directories.
#### `xdgAppPaths.cache( dir_options? ): string`
Returns the directory for non-essential data files
#### `xdgAppPaths.config( dir_options? ): string`
Returns the directory for config files
#### `xdgAppPaths.data( dir_options? ): string`
Returns the directory for data files
#### `xdgAppPaths.runtime( dir_options? ): string?`
Returns the directory for runtime files; may return `undefined`
#### `xdgAppPaths.state( dir_options? ): string`
Returns the directory for state files.
#### `xdgAppPaths.configDirs( dir_options? ): string[]`
Returns a priority-sorted list of possible directories for configuration file storage (includes `paths.config()` as the first entry)
#### `xdgAppPaths.dataDirs( dir_options? ): string[]`
Returns a priority-sorted list of possible directories for data file storage (includes `paths.data()` as the first entry)
> #### `dir_options`
>
> ##### `dir_options: boolean` => `{ isolated: boolean }`
>
> As a shortcut, when supplied as a `boolean`, dir_options is interpreted as the dir_options isolated property (ie, `dir_options = { isolated: dir_options }`).
>
> ##### `dir_options: object`
>
> * default = `{ isolated: true }`
>
> ###### `dir_options.isolated: boolean`
>
> * default = `true`
>
> Isolation flag; used to override the default isolation mode, when needed.
#### `xdgAppPaths.$name(): string`
Application name used for path construction (from supplied or auto-generated information)
#### `xdgAppPaths.$isolated(): boolean`
Default isolation mode used by the particular XDGAppPaths instance
## Example
```js
// MyApp.js
const locatePath = require('locate-path');
const mkdirp = require('mkdirp');
const path = require('path');
const appPaths = require('xdg-app-paths');
// Extend appPaths with a "log" location
appPaths.log = (options = {isolated: appPaths.$isolated()}) => {
if (typeof options === 'boolean') {
options = {isolated: options};
}
const isolated = ((options.isolated === undefined) || (options.isolated === null)) ? appPaths.$isolated() : options.isolated;
return path.join(appPaths.state(options), (isolated ? '' : appPaths.$name() + '-') + 'log');
};
// log file
const logPath = path.join(appPaths.log(), 'debug.txt');
mkdirp.sync(path.dirname(logPath), 0o700);
// config file
// * search for config file within user preferred directories; otherwise, use preferred directory
const possibleConfigPaths = appPaths.configDirs()
.concat(appPaths.configDirs({isolated: !appPaths.$isolated()}))
.map(v => path.join(v, appPaths.$name() + '.json'));
const configPath = locatePath.sync(possibleConfigPaths) || possibleConfigPaths[0];
// debug(logPath, 'configPath="%s"', configPath);
mkdirp.sync(path.dirname(configPath), 0o700);
// cache file
const cacheDir = path.join(appPaths.cache());
// debug(logPath, 'cacheDir="%s"', cacheDir);
mkdirp.sync(cacheDir, 0o700);
const cachePath = {};
cachePath.orders = path.join(cacheDir, 'orders.json');
cachePath.customers = path.join(cacheDir, 'customers.json');
//...
```
## Discussion
The [XDG Base Directory Specification](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html) defines categories of user information (ie, "cache", "config", "data", ...), defines their standard storage locations, and defines the standard process for user configuration of those locations (using `XDG_CACHE_HOME`, etc).
Applications supporting the XDG convention are expected to store user-specific files within these locations, either within the common/shared directory (eg, `` `${xdg.cache()}/filename` ``) or within a more isolated application-defined subdirectory (eg, `` `${xdg.config()/dir/filename` ``; `dir` usually being the application name).
### Windows ("win32") specific notes
Windows has an alternate convention, offering just two standard locations for applications to persist data, either `%APPDATA%` (for files which may "roam" with the user between hosts) and `%LOCALAPPDATA%` (for local-machine-only files). All application files are expected to be stored within an application-unique subdirectory in one of those two locations, usually under a directory matching the application name. There is no further popular convention used to segregate the file types (ie, into "cache", "config", ...) in any way similar to the XDG specification.
So, to support basic XDG-like behavior (that is, segregating the information types into type-specific directories), this module supports a new convention for Windows hosts (taken from [`xdg-portable`](https://www.npmjs.com/package/xdg-portable)), placing the specific types of files into subdirectories under either `%APPDATA%` or `%LOCALAPPDATA%`, as appropriate for the file type. The default directories used for the windows platform are listed by [`xdg-portable`](https://www.npmjs.com/package/xdg-portable#api).
By default, this module returns paths which are isolated, application-specific sub-directories under the respective common/shared base directories. These sub-directories are purely dedicated to use by the application. If, however, the application requires access to the common/shared areas, the `isolated: false` option may be used during initialization (or as an optional override for specific function calls) to generate and return the common/shared paths. Note, that when using the command/shared directories, care must be taken not use file names which collide with those used by other applications.
### Origins
This module was forked from [sindresorhus/env-paths](https://github.com/sindresorhus/env-paths) in order to add cross-platform portability and support simpler cross-platform applications.
## Related
- [`xdg-portable`](https://www.npmjs.com/package/xdg-portable) ... XDG Base Directory paths (cross-platform)
- [`env-paths`](https://www.npmjs.com/package/env-paths) ... inspiration for this module
## License
MIT © [Roy Ivy III](https://github.com/rivy), [Sindre Sorhus](https://sindresorhus.com)
<!-- badge references -->
[npm-image]: https://img.shields.io/npm/v/xdg-app-paths.svg?style=flat
[npm-url]: https://npmjs.org/package/xdg-app-paths
<!-- [appveyor-image]: https://ci.appveyor.com/api/projects/status/.../branch/master?svg=true -->
[appveyor-image]: https://img.shields.io/appveyor/ci/rivy/js-xdg-app-paths/master.svg?style=flat&logo=AppVeyor&logoColor=silver
[appveyor-url]: https://ci.appveyor.com/project/rivy/js-xdg-app-paths
<!-- [travis-image]: https://travis-ci.org/rivy/js.xdg-app-paths.svg?branch=master -->
<!-- [travis-image]: https://img.shields.io/travis/rivy/js.xdg-app-paths/master.svg?style=flat&logo=Travis-CI&logoColor=silver -->
[travis-image]: https://img.shields.io/travis/rivy/js.xdg-app-paths/master.svg?style=flat
[travis-url]: https://travis-ci.org/rivy/js.xdg-app-paths
<!-- [coverage-image]: https://img.shields.io/coveralls/github/rivy/xdg-app-paths/master.svg -->
<!-- [coverage-url]: https://coveralls.io/github/rivy/xdg-app-paths -->
[coverage-image]: https://img.shields.io/codecov/c/github/rivy/js.xdg-app-paths/master.svg
[coverage-url]: https://codecov.io/gh/rivy/js.xdg-app-paths
[downloads-image]: http://img.shields.io/npm/dm/xdg-app-paths.svg?style=flat
[downloads-url]: https://npmjs.org/package/xdg-app-paths
[license-image]: https://img.shields.io/npm/l/xdg-app-paths.svg?style=flat
[license-url]: license
<!-- [style-image]: https://img.shields.io/badge/code_style-standard-darkcyan.svg -->
<!-- [style-url]: https://standardjs.com -->
[style-image]: https://img.shields.io/badge/code_style-XO-darkcyan.svg
[style-url]: https://github.com/xojs/xo