This commit is contained in:
2022-09-30 05:39:11 +00:00
parent 41ee9463ae
commit 4687fa49bc
11418 changed files with 1312504 additions and 0 deletions

72
buildfiles/node_modules/y18n/CHANGELOG.md generated vendored Normal file
View File

@ -0,0 +1,72 @@
# Change Log
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
### [5.0.5](https://www.github.com/yargs/y18n/compare/v5.0.4...v5.0.5) (2020-10-25)
### Bug Fixes
* address prototype pollution issue ([#108](https://www.github.com/yargs/y18n/issues/108)) ([a9ac604](https://www.github.com/yargs/y18n/commit/a9ac604abf756dec9687be3843e2c93bfe581f25))
### [5.0.4](https://www.github.com/yargs/y18n/compare/v5.0.3...v5.0.4) (2020-10-16)
### Bug Fixes
* **exports:** node 13.0 and 13.1 require the dotted object form _with_ a string fallback ([#105](https://www.github.com/yargs/y18n/issues/105)) ([4f85d80](https://www.github.com/yargs/y18n/commit/4f85d80dbaae6d2c7899ae394f7ad97805df4886))
### [5.0.3](https://www.github.com/yargs/y18n/compare/v5.0.2...v5.0.3) (2020-10-16)
### Bug Fixes
* **exports:** node 13.0-13.6 require a string fallback ([#103](https://www.github.com/yargs/y18n/issues/103)) ([e39921e](https://www.github.com/yargs/y18n/commit/e39921e1017f88f5d8ea97ddea854ffe92d68e74))
### [5.0.2](https://www.github.com/yargs/y18n/compare/v5.0.1...v5.0.2) (2020-10-01)
### Bug Fixes
* **deno:** update types for deno ^1.4.0 ([#100](https://www.github.com/yargs/y18n/issues/100)) ([3834d9a](https://www.github.com/yargs/y18n/commit/3834d9ab1332f2937c935ada5e76623290efae81))
### [5.0.1](https://www.github.com/yargs/y18n/compare/v5.0.0...v5.0.1) (2020-09-05)
### Bug Fixes
* main had old index path ([#98](https://www.github.com/yargs/y18n/issues/98)) ([124f7b0](https://www.github.com/yargs/y18n/commit/124f7b047ba9596bdbdf64459988304e77f3de1b))
## [5.0.0](https://www.github.com/yargs/y18n/compare/v4.0.0...v5.0.0) (2020-09-05)
### ⚠ BREAKING CHANGES
* exports maps are now used, which modifies import behavior.
* drops Node 6 and 4. begin following Node.js LTS schedule (#89)
### Features
* add support for ESM and Deno [#95](https://www.github.com/yargs/y18n/issues/95)) ([4d7ae94](https://www.github.com/yargs/y18n/commit/4d7ae94bcb42e84164e2180366474b1cd321ed94))
### Build System
* drops Node 6 and 4. begin following Node.js LTS schedule ([#89](https://www.github.com/yargs/y18n/issues/89)) ([3cc0c28](https://www.github.com/yargs/y18n/commit/3cc0c287240727b84eaf1927f903612ec80f5e43))
## [4.0.0](https://github.com/yargs/y18n/compare/v3.2.1...v4.0.0) (2017-10-10)
### Bug Fixes
* allow support for falsy values like 0 in tagged literal ([#45](https://github.com/yargs/y18n/issues/45)) ([c926123](https://github.com/yargs/y18n/commit/c926123))
### Features
* **__:** added tagged template literal support ([#44](https://github.com/yargs/y18n/issues/44)) ([0598daf](https://github.com/yargs/y18n/commit/0598daf))
### BREAKING CHANGES
* **__:** dropping Node 0.10/Node 0.12 support

13
buildfiles/node_modules/y18n/LICENSE generated vendored Normal file
View File

@ -0,0 +1,13 @@
Copyright (c) 2015, Contributors
Permission to use, copy, modify, and/or distribute this software for any purpose
with or without fee is hereby granted, provided that the above copyright notice
and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
THIS SOFTWARE.

127
buildfiles/node_modules/y18n/README.md generated vendored Normal file
View File

@ -0,0 +1,127 @@
# y18n
[![NPM version][npm-image]][npm-url]
[![js-standard-style][standard-image]][standard-url]
[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)
The bare-bones internationalization library used by yargs.
Inspired by [i18n](https://www.npmjs.com/package/i18n).
## Examples
_simple string translation:_
```js
const __ = require('y18n')().__;
console.log(__('my awesome string %s', 'foo'));
```
output:
`my awesome string foo`
_using tagged template literals_
```js
const __ = require('y18n')().__;
const str = 'foo';
console.log(__`my awesome string ${str}`);
```
output:
`my awesome string foo`
_pluralization support:_
```js
const __n = require('y18n')().__n;
console.log(__n('one fish %s', '%d fishes %s', 2, 'foo'));
```
output:
`2 fishes foo`
## Deno Example
As of `v5` `y18n` supports [Deno](https://github.com/denoland/deno):
```typescript
import y18n from "https://deno.land/x/y18n/deno.ts";
const __ = y18n({
locale: 'pirate',
directory: './test/locales'
}).__
console.info(__`Hi, ${'Ben'} ${'Coe'}!`)
```
You will need to run with `--allow-read` to load alternative locales.
## JSON Language Files
The JSON language files should be stored in a `./locales` folder.
File names correspond to locales, e.g., `en.json`, `pirate.json`.
When strings are observed for the first time they will be
added to the JSON file corresponding to the current locale.
## Methods
### require('y18n')(config)
Create an instance of y18n with the config provided, options include:
* `directory`: the locale directory, default `./locales`.
* `updateFiles`: should newly observed strings be updated in file, default `true`.
* `locale`: what locale should be used.
* `fallbackToLanguage`: should fallback to a language-only file (e.g. `en.json`)
be allowed if a file matching the locale does not exist (e.g. `en_US.json`),
default `true`.
### y18n.\_\_(str, arg, arg, arg)
Print a localized string, `%s` will be replaced with `arg`s.
This function can also be used as a tag for a template literal. You can use it
like this: <code>__&#96;hello ${'world'}&#96;</code>. This will be equivalent to
`__('hello %s', 'world')`.
### y18n.\_\_n(singularString, pluralString, count, arg, arg, arg)
Print a localized string with appropriate pluralization. If `%d` is provided
in the string, the `count` will replace this placeholder.
### y18n.setLocale(str)
Set the current locale being used.
### y18n.getLocale()
What locale is currently being used?
### y18n.updateLocale(obj)
Update the current locale with the key value pairs in `obj`.
## Supported Node.js Versions
Libraries in this ecosystem make a best effort to track
[Node.js' release schedule](https://nodejs.org/en/about/releases/). Here's [a
post on why we think this is important](https://medium.com/the-node-js-collection/maintainers-should-consider-following-node-js-release-schedule-ab08ed4de71a).
## License
ISC
[npm-url]: https://npmjs.org/package/y18n
[npm-image]: https://img.shields.io/npm/v/y18n.svg
[standard-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg
[standard-url]: https://github.com/feross/standard

200
buildfiles/node_modules/y18n/build/index.cjs generated vendored Normal file
View File

@ -0,0 +1,200 @@
'use strict';
var fs = require('fs');
var util = require('util');
var path = require('path');
let shim;
class Y18N {
constructor(opts) {
// configurable options.
opts = opts || {};
this.directory = opts.directory || './locales';
this.updateFiles = typeof opts.updateFiles === 'boolean' ? opts.updateFiles : true;
this.locale = opts.locale || 'en';
this.fallbackToLanguage = typeof opts.fallbackToLanguage === 'boolean' ? opts.fallbackToLanguage : true;
// internal stuff.
this.cache = Object.create(null);
this.writeQueue = [];
}
__(...args) {
if (typeof arguments[0] !== 'string') {
return this._taggedLiteral(arguments[0], ...arguments);
}
const str = args.shift();
let cb = function () { }; // start with noop.
if (typeof args[args.length - 1] === 'function')
cb = args.pop();
cb = cb || function () { }; // noop.
if (!this.cache[this.locale])
this._readLocaleFile();
// we've observed a new string, update the language file.
if (!this.cache[this.locale][str] && this.updateFiles) {
this.cache[this.locale][str] = str;
// include the current directory and locale,
// since these values could change before the
// write is performed.
this._enqueueWrite({
directory: this.directory,
locale: this.locale,
cb
});
}
else {
cb();
}
return shim.format.apply(shim.format, [this.cache[this.locale][str] || str].concat(args));
}
__n() {
const args = Array.prototype.slice.call(arguments);
const singular = args.shift();
const plural = args.shift();
const quantity = args.shift();
let cb = function () { }; // start with noop.
if (typeof args[args.length - 1] === 'function')
cb = args.pop();
if (!this.cache[this.locale])
this._readLocaleFile();
let str = quantity === 1 ? singular : plural;
if (this.cache[this.locale][singular]) {
const entry = this.cache[this.locale][singular];
str = entry[quantity === 1 ? 'one' : 'other'];
}
// we've observed a new string, update the language file.
if (!this.cache[this.locale][singular] && this.updateFiles) {
this.cache[this.locale][singular] = {
one: singular,
other: plural
};
// include the current directory and locale,
// since these values could change before the
// write is performed.
this._enqueueWrite({
directory: this.directory,
locale: this.locale,
cb
});
}
else {
cb();
}
// if a %d placeholder is provided, add quantity
// to the arguments expanded by util.format.
var values = [str];
if (~str.indexOf('%d'))
values.push(quantity);
return shim.format.apply(shim.format, values.concat(args));
}
setLocale(locale) {
this.locale = locale;
}
getLocale() {
return this.locale;
}
updateLocale(obj) {
if (!this.cache[this.locale])
this._readLocaleFile();
for (const key in obj) {
if (Object.prototype.hasOwnProperty.call(obj, key)) {
this.cache[this.locale][key] = obj[key];
}
}
}
_taggedLiteral(parts, ...args) {
let str = '';
parts.forEach(function (part, i) {
var arg = args[i + 1];
str += part;
if (typeof arg !== 'undefined') {
str += '%s';
}
});
return this.__.apply(this, [str].concat([].slice.call(args, 1)));
}
_enqueueWrite(work) {
this.writeQueue.push(work);
if (this.writeQueue.length === 1)
this._processWriteQueue();
}
_processWriteQueue() {
var _this = this;
var work = this.writeQueue[0];
// destructure the enqueued work.
var directory = work.directory;
var locale = work.locale;
var cb = work.cb;
var languageFile = this._resolveLocaleFile(directory, locale);
var serializedLocale = JSON.stringify(this.cache[locale], null, 2);
shim.fs.writeFile(languageFile, serializedLocale, 'utf-8', function (err) {
_this.writeQueue.shift();
if (_this.writeQueue.length > 0)
_this._processWriteQueue();
cb(err);
});
}
_readLocaleFile() {
var localeLookup = {};
var languageFile = this._resolveLocaleFile(this.directory, this.locale);
try {
localeLookup = JSON.parse(shim.fs.readFileSync(languageFile, 'utf-8'));
}
catch (err) {
if (err instanceof SyntaxError) {
err.message = 'syntax error in ' + languageFile;
}
if (err.code === 'ENOENT')
localeLookup = {};
else
throw err;
}
this.cache[this.locale] = localeLookup;
}
_resolveLocaleFile(directory, locale) {
var file = shim.resolve(directory, './', locale + '.json');
if (this.fallbackToLanguage && !this._fileExistsSync(file) && ~locale.lastIndexOf('_')) {
// attempt fallback to language only
var languageFile = shim.resolve(directory, './', locale.split('_')[0] + '.json');
if (this._fileExistsSync(languageFile))
file = languageFile;
}
return file;
}
_fileExistsSync(file) {
return shim.exists(file);
}
}
function y18n(opts, _shim) {
shim = _shim;
const y18n = new Y18N(opts);
return {
__: y18n.__.bind(y18n),
__n: y18n.__n.bind(y18n),
setLocale: y18n.setLocale.bind(y18n),
getLocale: y18n.getLocale.bind(y18n),
updateLocale: y18n.updateLocale.bind(y18n),
locale: y18n.locale
};
}
var nodePlatformShim = {
fs: {
readFileSync: fs.readFileSync,
writeFile: fs.writeFile
},
format: util.format,
resolve: path.resolve,
exists: (file) => {
try {
return fs.statSync(file).isFile();
}
catch (err) {
return false;
}
}
};
const y18n$1 = (opts) => {
return y18n(opts, nodePlatformShim);
};
module.exports = y18n$1;

6
buildfiles/node_modules/y18n/build/lib/cjs.js generated vendored Normal file
View File

@ -0,0 +1,6 @@
import { y18n as _y18n } from './index.js';
import nodePlatformShim from './platform-shims/node.js';
const y18n = (opts) => {
return _y18n(opts, nodePlatformShim);
};
export default y18n;

171
buildfiles/node_modules/y18n/build/lib/index.js generated vendored Normal file
View File

@ -0,0 +1,171 @@
let shim;
class Y18N {
constructor(opts) {
// configurable options.
opts = opts || {};
this.directory = opts.directory || './locales';
this.updateFiles = typeof opts.updateFiles === 'boolean' ? opts.updateFiles : true;
this.locale = opts.locale || 'en';
this.fallbackToLanguage = typeof opts.fallbackToLanguage === 'boolean' ? opts.fallbackToLanguage : true;
// internal stuff.
this.cache = Object.create(null);
this.writeQueue = [];
}
__(...args) {
if (typeof arguments[0] !== 'string') {
return this._taggedLiteral(arguments[0], ...arguments);
}
const str = args.shift();
let cb = function () { }; // start with noop.
if (typeof args[args.length - 1] === 'function')
cb = args.pop();
cb = cb || function () { }; // noop.
if (!this.cache[this.locale])
this._readLocaleFile();
// we've observed a new string, update the language file.
if (!this.cache[this.locale][str] && this.updateFiles) {
this.cache[this.locale][str] = str;
// include the current directory and locale,
// since these values could change before the
// write is performed.
this._enqueueWrite({
directory: this.directory,
locale: this.locale,
cb
});
}
else {
cb();
}
return shim.format.apply(shim.format, [this.cache[this.locale][str] || str].concat(args));
}
__n() {
const args = Array.prototype.slice.call(arguments);
const singular = args.shift();
const plural = args.shift();
const quantity = args.shift();
let cb = function () { }; // start with noop.
if (typeof args[args.length - 1] === 'function')
cb = args.pop();
if (!this.cache[this.locale])
this._readLocaleFile();
let str = quantity === 1 ? singular : plural;
if (this.cache[this.locale][singular]) {
const entry = this.cache[this.locale][singular];
str = entry[quantity === 1 ? 'one' : 'other'];
}
// we've observed a new string, update the language file.
if (!this.cache[this.locale][singular] && this.updateFiles) {
this.cache[this.locale][singular] = {
one: singular,
other: plural
};
// include the current directory and locale,
// since these values could change before the
// write is performed.
this._enqueueWrite({
directory: this.directory,
locale: this.locale,
cb
});
}
else {
cb();
}
// if a %d placeholder is provided, add quantity
// to the arguments expanded by util.format.
var values = [str];
if (~str.indexOf('%d'))
values.push(quantity);
return shim.format.apply(shim.format, values.concat(args));
}
setLocale(locale) {
this.locale = locale;
}
getLocale() {
return this.locale;
}
updateLocale(obj) {
if (!this.cache[this.locale])
this._readLocaleFile();
for (const key in obj) {
if (Object.prototype.hasOwnProperty.call(obj, key)) {
this.cache[this.locale][key] = obj[key];
}
}
}
_taggedLiteral(parts, ...args) {
let str = '';
parts.forEach(function (part, i) {
var arg = args[i + 1];
str += part;
if (typeof arg !== 'undefined') {
str += '%s';
}
});
return this.__.apply(this, [str].concat([].slice.call(args, 1)));
}
_enqueueWrite(work) {
this.writeQueue.push(work);
if (this.writeQueue.length === 1)
this._processWriteQueue();
}
_processWriteQueue() {
var _this = this;
var work = this.writeQueue[0];
// destructure the enqueued work.
var directory = work.directory;
var locale = work.locale;
var cb = work.cb;
var languageFile = this._resolveLocaleFile(directory, locale);
var serializedLocale = JSON.stringify(this.cache[locale], null, 2);
shim.fs.writeFile(languageFile, serializedLocale, 'utf-8', function (err) {
_this.writeQueue.shift();
if (_this.writeQueue.length > 0)
_this._processWriteQueue();
cb(err);
});
}
_readLocaleFile() {
var localeLookup = {};
var languageFile = this._resolveLocaleFile(this.directory, this.locale);
try {
localeLookup = JSON.parse(shim.fs.readFileSync(languageFile, 'utf-8'));
}
catch (err) {
if (err instanceof SyntaxError) {
err.message = 'syntax error in ' + languageFile;
}
if (err.code === 'ENOENT')
localeLookup = {};
else
throw err;
}
this.cache[this.locale] = localeLookup;
}
_resolveLocaleFile(directory, locale) {
var file = shim.resolve(directory, './', locale + '.json');
if (this.fallbackToLanguage && !this._fileExistsSync(file) && ~locale.lastIndexOf('_')) {
// attempt fallback to language only
var languageFile = shim.resolve(directory, './', locale.split('_')[0] + '.json');
if (this._fileExistsSync(languageFile))
file = languageFile;
}
return file;
}
_fileExistsSync(file) {
return shim.exists(file);
}
}
export function y18n(opts, _shim) {
shim = _shim;
const y18n = new Y18N(opts);
return {
__: y18n.__.bind(y18n),
__n: y18n.__n.bind(y18n),
setLocale: y18n.setLocale.bind(y18n),
getLocale: y18n.getLocale.bind(y18n),
updateLocale: y18n.updateLocale.bind(y18n),
locale: y18n.locale
};
}

View File

@ -0,0 +1,19 @@
import { readFileSync, statSync, writeFile } from 'fs';
import { format } from 'util';
import { resolve } from 'path';
export default {
fs: {
readFileSync,
writeFile
},
format,
resolve,
exists: (file) => {
try {
return statSync(file).isFile();
}
catch (err) {
return false;
}
}
};

8
buildfiles/node_modules/y18n/index.mjs generated vendored Normal file
View File

@ -0,0 +1,8 @@
import shim from './build/lib/platform-shims/node.js'
import { y18n as _y18n } from './build/lib/index.js'
const y18n = (opts) => {
return _y18n(opts, shim)
}
export default y18n

101
buildfiles/node_modules/y18n/package.json generated vendored Normal file
View File

@ -0,0 +1,101 @@
{
"_from": "y18n@^5.0.5",
"_id": "y18n@5.0.5",
"_inBundle": false,
"_integrity": "sha512-hsRUr4FFrvhhRH12wOdfs38Gy7k2FFzB9qgN9v3aLykRq0dRcdcpz5C9FxdS2NuhOrI/628b/KSTJ3rwHysYSg==",
"_location": "/y18n",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "y18n@^5.0.5",
"name": "y18n",
"escapedName": "y18n",
"rawSpec": "^5.0.5",
"saveSpec": null,
"fetchSpec": "^5.0.5"
},
"_requiredBy": [
"/yargs"
],
"_resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.5.tgz",
"_shasum": "8769ec08d03b1ea2df2500acef561743bbb9ab18",
"_spec": "y18n@^5.0.5",
"_where": "/home/shihaam/www/freezer.shihaam.me/node_modules/yargs",
"author": {
"name": "Ben Coe",
"email": "bencoe@gmail.com"
},
"bugs": {
"url": "https://github.com/yargs/y18n/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "the bare-bones internationalization library used by yargs",
"devDependencies": {
"@types/node": "^14.6.4",
"@wessberg/rollup-plugin-ts": "^1.3.1",
"c8": "^7.3.0",
"chai": "^4.0.1",
"cross-env": "^7.0.2",
"gts": "^3.0.0",
"mocha": "^8.0.0",
"rimraf": "^3.0.2",
"rollup": "^2.26.10",
"standardx": "^5.0.0",
"ts-transform-default-export": "^1.0.2",
"typescript": "^4.0.0"
},
"engines": {
"node": ">=10"
},
"exports": {
".": [
{
"import": "./index.mjs",
"require": "./build/index.cjs"
},
"./build/index.cjs"
]
},
"files": [
"build",
"index.mjs",
"!*.d.ts"
],
"homepage": "https://github.com/yargs/y18n",
"keywords": [
"i18n",
"internationalization",
"yargs"
],
"license": "ISC",
"main": "./build/index.cjs",
"module": "./build/lib/index.js",
"name": "y18n",
"repository": {
"type": "git",
"url": "git+https://github.com/yargs/y18n.git"
},
"scripts": {
"build:cjs": "rollup -c",
"check": "standardx '**/*.ts' '**/*.cjs' '**/*.mjs'",
"compile": "tsc",
"coverage": "c8 report --check-coverage",
"fix": "standardx --fix '**/*.ts' '**/*.cjs' '**/*.mjs'",
"postcompile": "npm run build:cjs",
"posttest": "npm run check",
"precompile": "rimraf build",
"prepare": "npm run compile",
"pretest": "rimraf build && tsc -p tsconfig.test.json && cross-env NODE_ENV=test npm run build:cjs",
"test": "c8 --reporter=text --reporter=html mocha test/*.cjs",
"test:esm": "c8 --reporter=text --reporter=html mocha test/esm/*.mjs"
},
"standardx": {
"ignore": [
"build"
]
},
"type": "module",
"version": "5.0.5"
}