Update app and tooling
This commit is contained in:
parent
3046531bdd
commit
e620ec7349
4950 changed files with 2975120 additions and 10 deletions
110
node_modules/xdg-portable/src/lib/index.d.ts
generated
vendored
Normal file
110
node_modules/xdg-portable/src/lib/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
// # spell-checker:ignore rivy
|
||||
|
||||
declare namespace XDG {
|
||||
/**
|
||||
Directory for user-specific non-essential data files.
|
||||
|
||||
@example
|
||||
```js
|
||||
import xdg = require('xdg-portable');
|
||||
|
||||
xdg.cache();
|
||||
//(mac)=> '/Users/rivy/Library/Caches'
|
||||
//(nix)=> '/home/rivy/.cache'
|
||||
//(win)=> 'C:\\Users\\rivy\\AppData\\Local\\cache'
|
||||
```
|
||||
*/
|
||||
function cache(): string;
|
||||
|
||||
/**
|
||||
Directory for user-specific configuration files.
|
||||
|
||||
@example
|
||||
```js
|
||||
import xdg = require('xdg-portable');
|
||||
|
||||
xdg.config();
|
||||
//(mac)=> '/Users/rivy/Library/Preferences'
|
||||
//(nix)=> '/home/rivy/.config'
|
||||
//(win)=> 'C:\\Users\\rivy\\AppData\\Roaming\\xdg.config'
|
||||
```
|
||||
*/
|
||||
function config(): string;
|
||||
|
||||
/**
|
||||
Directory for user-specific data files.
|
||||
|
||||
@example
|
||||
```js
|
||||
import xdg = require('xdg-portable');
|
||||
|
||||
xdg.data();
|
||||
//(mac)=> '/Users/rivy/Library/Application Support'
|
||||
//(nix)=> '/home/rivy/.local/share'
|
||||
//(win)=> 'C:\\Users\\rivy\\AppData\\Roaming\\xdg.data'
|
||||
```
|
||||
*/
|
||||
function data(): string;
|
||||
|
||||
/**
|
||||
Directory for user-specific non-essential runtime files and other file objects (such as sockets, named pipes, etc).
|
||||
|
||||
@example
|
||||
```js
|
||||
import xdg = require('xdg-portable');
|
||||
|
||||
xdg.runtime();
|
||||
//(mac)=> undefined
|
||||
//(nix)=> '/run/user/rivy'
|
||||
//(win)=> undefined
|
||||
```
|
||||
*/
|
||||
function runtime(): string | undefined;
|
||||
|
||||
/**
|
||||
Directory for user-specific state files (non-essential and more volatile than configuration files).
|
||||
|
||||
@example
|
||||
```js
|
||||
import xdg = require('xdg-portable');
|
||||
|
||||
xdg.state();
|
||||
//(mac)=> '/Users/rivy/Library/State'
|
||||
//(nix)=> '/home/rivy/.local/state'
|
||||
//(win)=> 'C:\\Users\\rivy\\AppData\\Local\\xdg.state'
|
||||
```
|
||||
*/
|
||||
function state(): string;
|
||||
|
||||
/**
|
||||
Preference-ordered array of base directories to search for configuration files; includes `.config()` directory as first entry.
|
||||
|
||||
@example
|
||||
```js
|
||||
import xdg = require('xdg-portable');
|
||||
|
||||
xdg.configDirs();
|
||||
//(mac)=> ['/Users/rivy/Library/Preferences']
|
||||
//(nix)=> ['/home/rivy/.config', '/etc/xdg']
|
||||
//(win)=> ['C:\\Users\\rivy\\AppData\\Roaming\\xdg.config']
|
||||
```
|
||||
*/
|
||||
function configDirs(): readonly string[];
|
||||
|
||||
/**
|
||||
Preference-ordered array of base directories to search for data files; include `.data()` directory as first entry.
|
||||
|
||||
@example
|
||||
```js
|
||||
import xdg = require('xdg-portable');
|
||||
|
||||
xdg.dataDirs();
|
||||
//(mac)=> ['/Users/rivy/Library/Preferences']
|
||||
//(nix)=> ['/home/rivy/.local/share', '/usr/local/share/', '/usr/share/']
|
||||
//(win)=> ['C:\\Users\\rivy\\AppData\\Roaming\\xdg.data']
|
||||
```
|
||||
*/
|
||||
function dataDirs(): readonly string[];
|
||||
}
|
||||
declare function XDG(): typeof XDG;
|
||||
export = XDG;
|
||||
127
node_modules/xdg-portable/src/lib/index.js
generated
vendored
Normal file
127
node_modules/xdg-portable/src/lib/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,127 @@
|
|||
// # spell-checker:ignore macos APPDATA LOCALAPPDATA
|
||||
/* eslint-env es6, node */
|
||||
'use strict';
|
||||
|
||||
const path = require('path');
|
||||
|
||||
const osPaths = require('os-paths');
|
||||
|
||||
// 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>
|
||||
|
||||
const linux = () => {
|
||||
const object = {};
|
||||
|
||||
object.cache = () =>
|
||||
process.env.XDG_CACHE_HOME || path.join(osPaths.home() || osPaths.temp(), '.cache');
|
||||
object.config = () =>
|
||||
process.env.XDG_CONFIG_HOME || path.join(osPaths.home() || osPaths.temp(), '.config');
|
||||
object.data = () =>
|
||||
process.env.XDG_DATA_HOME || path.join(osPaths.home() || osPaths.temp(), '.local', 'share');
|
||||
object.runtime = () => process.env.XDG_RUNTIME_DIR || undefined;
|
||||
object.state = () =>
|
||||
process.env.XDG_STATE_HOME || path.join(osPaths.home() || osPaths.temp(), '.local', 'state');
|
||||
|
||||
return object;
|
||||
};
|
||||
|
||||
const macos = () => {
|
||||
const object = {};
|
||||
|
||||
object.cache = () =>
|
||||
process.env.XDG_CACHE_HOME ||
|
||||
path.join(path.join(osPaths.home() || osPaths.temp(), 'Library'), 'Caches');
|
||||
object.config = () =>
|
||||
process.env.XDG_CONFIG_HOME ||
|
||||
path.join(path.join(osPaths.home() || osPaths.temp(), 'Library'), 'Preferences');
|
||||
object.data = () =>
|
||||
process.env.XDG_DATA_HOME ||
|
||||
path.join(path.join(osPaths.home() || osPaths.temp(), 'Library'), 'Application Support');
|
||||
object.runtime = () => process.env.XDG_RUNTIME_DIR || undefined;
|
||||
object.state = () =>
|
||||
process.env.XDG_STATE_HOME ||
|
||||
path.join(path.join(osPaths.home() || osPaths.temp(), 'Library'), 'State');
|
||||
|
||||
return object;
|
||||
};
|
||||
|
||||
const windows = () => {
|
||||
const object = {};
|
||||
// # ref: <https://www.thewindowsclub.com/local-localnow-roaming-folders-windows-10> @@ <http://archive.is/tDEPl>
|
||||
// Locations for cache/config/data/state are invented (Windows doesn't have a popular convention)
|
||||
|
||||
object.cache = () => {
|
||||
const localAppData =
|
||||
process.env.LOCALAPPDATA || path.join(osPaths.home() || osPaths.temp(), 'AppData', 'Local'); // "AppData/Local" contains local-machine-only user data
|
||||
return process.env.XDG_CACHE_HOME || path.join(localAppData, 'xdg.cache');
|
||||
};
|
||||
|
||||
object.config = () => {
|
||||
const appData =
|
||||
process.env.APPDATA || path.join(osPaths.home() || osPaths.temp(), 'AppData', 'Roaming'); // "AppData/Roaming" contains data which may follow user between machines
|
||||
return process.env.XDG_CONFIG_HOME || path.join(appData, 'xdg.config');
|
||||
};
|
||||
|
||||
object.data = () => {
|
||||
const appData =
|
||||
process.env.APPDATA || path.join(osPaths.home() || osPaths.temp(), 'AppData', 'Roaming'); // "AppData/Roaming" contains data which may follow user between machines
|
||||
return process.env.XDG_DATA_HOME || path.join(appData, 'xdg.data');
|
||||
};
|
||||
|
||||
object.runtime = () => process.env.XDG_RUNTIME_DIR || undefined;
|
||||
|
||||
object.state = () => {
|
||||
const localAppData =
|
||||
process.env.LOCALAPPDATA || path.join(osPaths.home() || osPaths.temp(), 'AppData', 'Local'); // "AppData/Local" contains local-machine-only user data
|
||||
return process.env.XDG_STATE_HOME || path.join(localAppData, 'xdg.state');
|
||||
};
|
||||
|
||||
return object;
|
||||
};
|
||||
|
||||
const _XDGPortable = () => {
|
||||
const XDGPortable = function () {
|
||||
return _XDGPortable();
|
||||
};
|
||||
|
||||
let extension = {};
|
||||
if (/^darwin$/i.test(process.platform)) {
|
||||
extension = macos();
|
||||
} else if (/^win/i.test(process.platform)) {
|
||||
extension = windows();
|
||||
} else {
|
||||
extension = linux();
|
||||
}
|
||||
|
||||
extension.configDirs = () => {
|
||||
const dirs = [];
|
||||
dirs.push(extension.config());
|
||||
if (process.env.XDG_CONFIG_DIRS) {
|
||||
dirs.push(...process.env.XDG_CONFIG_DIRS.split(path.delimiter));
|
||||
}
|
||||
|
||||
return dirs;
|
||||
};
|
||||
|
||||
extension.dataDirs = () => {
|
||||
const dirs = [];
|
||||
dirs.push(extension.data());
|
||||
if (process.env.XDG_DATA_DIRS) {
|
||||
dirs.push(...process.env.XDG_DATA_DIRS.split(path.delimiter));
|
||||
}
|
||||
|
||||
return dirs;
|
||||
};
|
||||
|
||||
Object.keys(extension).forEach((key) => {
|
||||
XDGPortable[key] = extension[key];
|
||||
});
|
||||
|
||||
return XDGPortable;
|
||||
};
|
||||
|
||||
module.exports = _XDGPortable();
|
||||
Loading…
Add table
Add a link
Reference in a new issue