This commit is contained in:
Stephen Franceschelli 2019-07-30 13:41:05 -04:00
parent 596a6da241
commit c1a589c5b6
7078 changed files with 1882834 additions and 319 deletions

114
node_modules/os-locale/index.js generated vendored Normal file
View file

@ -0,0 +1,114 @@
'use strict';
const execa = require('execa');
const lcid = require('lcid');
const mem = require('mem');
const defaultOptions = {spawn: true};
const defaultLocale = 'en_US';
function getEnvLocale(env = process.env) {
return env.LC_ALL || env.LC_MESSAGES || env.LANG || env.LANGUAGE;
}
function parseLocale(string) {
const env = string.split('\n').reduce((env, def) => {
const [key, value] = def.split('=');
env[key] = value.replace(/^"|"$/g, '');
return env;
}, {});
return getEnvLocale(env);
}
function getLocale(string) {
return (string && string.replace(/[.:].*/, ''));
}
function getLocales() {
return execa.stdout('locale', ['-a']);
}
function getLocalesSync() {
return execa.sync('locale', ['-a']).stdout;
}
function getSupportedLocale(locale, locales = '') {
return locales.includes(locale) ? locale : defaultLocale;
}
function getAppleLocale() {
return Promise.all([
execa.stdout('defaults', ['read', '-globalDomain', 'AppleLocale']),
getLocales()
]).then(results => getSupportedLocale(results[0], results[1]));
}
function getAppleLocaleSync() {
return getSupportedLocale(
execa.sync('defaults', ['read', '-globalDomain', 'AppleLocale']).stdout,
getLocalesSync()
);
}
function getUnixLocale() {
if (process.platform === 'darwin') {
return getAppleLocale();
}
return execa.stdout('locale')
.then(stdout => getLocale(parseLocale(stdout)));
}
function getUnixLocaleSync() {
if (process.platform === 'darwin') {
return getAppleLocaleSync();
}
return getLocale(parseLocale(execa.sync('locale').stdout));
}
function getWinLocale() {
return execa.stdout('wmic', ['os', 'get', 'locale'])
.then(stdout => {
const lcidCode = parseInt(stdout.replace('Locale', ''), 16);
return lcid.from(lcidCode);
});
}
function getWinLocaleSync() {
const {stdout} = execa.sync('wmic', ['os', 'get', 'locale']);
const lcidCode = parseInt(stdout.replace('Locale', ''), 16);
return lcid.from(lcidCode);
}
module.exports = mem((options = defaultOptions) => {
const envLocale = getEnvLocale();
let thenable;
if (envLocale || options.spawn === false) {
thenable = Promise.resolve(getLocale(envLocale));
} else if (process.platform === 'win32') {
thenable = getWinLocale();
} else {
thenable = getUnixLocale();
}
return thenable
.then(locale => locale || defaultLocale)
.catch(() => defaultLocale);
});
module.exports.sync = mem((options = defaultOptions) => {
const envLocale = getEnvLocale();
let res;
if (envLocale || options.spawn === false) {
res = getLocale(envLocale);
} else {
try {
res = process.platform === 'win32' ? getWinLocaleSync() : getUnixLocaleSync();
} catch (_) {}
}
return res || defaultLocale;
});

9
node_modules/os-locale/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.

77
node_modules/os-locale/package.json generated vendored Normal file
View file

@ -0,0 +1,77 @@
{
"_from": "os-locale@^3.0.0",
"_id": "os-locale@3.1.0",
"_inBundle": false,
"_integrity": "sha512-Z8l3R4wYWM40/52Z+S265okfFj8Kt2cC2MKY+xNi3kFs+XGI7WXu/I309QQQYbRW4ijiZ+yxs9pqEhJh0DqW3Q==",
"_location": "/os-locale",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "os-locale@^3.0.0",
"name": "os-locale",
"escapedName": "os-locale",
"rawSpec": "^3.0.0",
"saveSpec": null,
"fetchSpec": "^3.0.0"
},
"_requiredBy": [
"/yargs"
],
"_resolved": "https://registry.npmjs.org/os-locale/-/os-locale-3.1.0.tgz",
"_shasum": "a802a6ee17f24c10483ab9935719cef4ed16bf1a",
"_spec": "os-locale@^3.0.0",
"_where": "E:\\github\\setup-java\\node_modules\\yargs",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"bugs": {
"url": "https://github.com/sindresorhus/os-locale/issues"
},
"bundleDependencies": false,
"dependencies": {
"execa": "^1.0.0",
"lcid": "^2.0.0",
"mem": "^4.0.0"
},
"deprecated": false,
"description": "Get the system locale",
"devDependencies": {
"ava": "^1.0.1",
"import-fresh": "^3.0.0",
"xo": "^0.23.0"
},
"engines": {
"node": ">=6"
},
"files": [
"index.js"
],
"homepage": "https://github.com/sindresorhus/os-locale#readme",
"keywords": [
"locale",
"lang",
"language",
"system",
"os",
"string",
"str",
"user",
"country",
"id",
"identifier",
"region"
],
"license": "MIT",
"name": "os-locale",
"repository": {
"type": "git",
"url": "git+https://github.com/sindresorhus/os-locale.git"
},
"scripts": {
"test": "xo && ava"
},
"version": "3.1.0"
}

71
node_modules/os-locale/readme.md generated vendored Normal file
View file

@ -0,0 +1,71 @@
# os-locale [![Build Status](https://travis-ci.org/sindresorhus/os-locale.svg?branch=master)](https://travis-ci.org/sindresorhus/os-locale)
> Get the system [locale](https://en.wikipedia.org/wiki/Locale_(computer_software))
Useful for localizing your module or app.
POSIX systems: The returned locale refers to the [`LC_MESSAGE`](http://www.gnu.org/software/libc/manual/html_node/Locale-Categories.html#Locale-Categories) category, suitable for selecting the language used in the user interface for message translation.
---
<div align="center">
<b>
<a href="https://tidelift.com/subscription/pkg/npm-os-locale?utm_source=npm-os-locale&utm_medium=referral&utm_campaign=readme">Get professional support for 'os-locale' 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>
---
## Install
```
$ npm install os-locale
```
## Usage
```js
const osLocale = require('os-locale');
(async () => {
console.log(await osLocale());
//=> 'en_US'
})();
```
## API
### osLocale([options])
Returns a `Promise` for the locale.
### osLocale.sync([options])
Returns the locale.
#### options
Type: `Object`
##### spawn
Type: `boolean`<br>
Default: `true`
Set to `false` to avoid spawning subprocesses and instead only resolve the locale from environment variables.
## Security
To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure.
## License
MIT © [Sindre Sorhus](https://sindresorhus.com)