Auto-commit 2026-04-29 16:31
This commit is contained in:
201
node_modules/@grpc/proto-loader/LICENSE
generated
vendored
Normal file
201
node_modules/@grpc/proto-loader/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,201 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "{}"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright {yyyy} {name of copyright owner}
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
140
node_modules/@grpc/proto-loader/README.md
generated
vendored
Normal file
140
node_modules/@grpc/proto-loader/README.md
generated
vendored
Normal file
@@ -0,0 +1,140 @@
|
||||
# gRPC Protobuf Loader
|
||||
|
||||
A utility package for loading `.proto` files for use with gRPC, using the latest Protobuf.js package.
|
||||
Please refer to [protobuf.js' documentation](https://github.com/dcodeIO/protobuf.js/blob/master/README.md)
|
||||
to understands its features and limitations.
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
npm install @grpc/proto-loader
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const protoLoader = require('@grpc/proto-loader');
|
||||
const grpcLibrary = require('grpc');
|
||||
// OR
|
||||
const grpcLibrary = require('@grpc/grpc-js');
|
||||
|
||||
protoLoader.load(protoFileName, options).then(packageDefinition => {
|
||||
const packageObject = grpcLibrary.loadPackageDefinition(packageDefinition);
|
||||
});
|
||||
// OR
|
||||
const packageDefinition = protoLoader.loadSync(protoFileName, options);
|
||||
const packageObject = grpcLibrary.loadPackageDefinition(packageDefinition);
|
||||
```
|
||||
|
||||
The options parameter is an object that can have the following optional properties:
|
||||
|
||||
| Field name | Valid values | Description
|
||||
|------------|--------------|------------
|
||||
| `keepCase` | `true` or `false` | Preserve field names. The default is to change them to camel case.
|
||||
| `longs` | `String` or `Number` | The type to use to represent `long` values. Defaults to a `Long` object type.
|
||||
| `enums` | `String` | The type to use to represent `enum` values. Defaults to the numeric value.
|
||||
| `bytes` | `Array` or `String` | The type to use to represent `bytes` values. Defaults to `Buffer`.
|
||||
| `defaults` | `true` or `false` | Set default values on output objects. Defaults to `false`.
|
||||
| `arrays` | `true` or `false` | Set empty arrays for missing array values even if `defaults` is `false` Defaults to `false`.
|
||||
| `objects` | `true` or `false` | Set empty objects for missing object values even if `defaults` is `false` Defaults to `false`.
|
||||
| `oneofs` | `true` or `false` | Set virtual oneof properties to the present field's name. Defaults to `false`.
|
||||
| `json` | `true` or `false` | Represent `Infinity` and `NaN` as strings in `float` fields, and automatically decode `google.protobuf.Any` values. Defaults to `false`
|
||||
| `includeDirs` | An array of strings | A list of search paths for imported `.proto` files.
|
||||
|
||||
The following options object closely approximates the existing behavior of `grpc.load`:
|
||||
|
||||
```js
|
||||
const options = {
|
||||
keepCase: true,
|
||||
longs: String,
|
||||
enums: String,
|
||||
defaults: true,
|
||||
oneofs: true
|
||||
}
|
||||
```
|
||||
|
||||
## Generating TypeScript types
|
||||
|
||||
The `proto-loader-gen-types` script distributed with this package can be used to generate TypeScript type information for the objects loaded at runtime. More information about how to use it can be found in [the *@grpc/proto-loader TypeScript Type Generator CLI Tool* proposal document](https://github.com/grpc/proposal/blob/master/L70-node-proto-loader-type-generator.md). The arguments mostly match the `load` function's options; the full usage information is as follows:
|
||||
|
||||
```console
|
||||
proto-loader-gen-types.js [options] filenames...
|
||||
|
||||
Options:
|
||||
--help Show help [boolean]
|
||||
--version Show version number [boolean]
|
||||
--keepCase Preserve the case of field names
|
||||
[boolean] [default: false]
|
||||
--longs The type that should be used to output 64 bit
|
||||
integer values. Can be String, Number
|
||||
[string] [default: "Long"]
|
||||
--enums The type that should be used to output enum fields.
|
||||
Can be String [string] [default: "number"]
|
||||
--bytes The type that should be used to output bytes
|
||||
fields. Can be String, Array
|
||||
[string] [default: "Buffer"]
|
||||
--defaults Output default values for omitted fields
|
||||
[boolean] [default: false]
|
||||
--arrays Output default values for omitted repeated fields
|
||||
even if --defaults is not set
|
||||
[boolean] [default: false]
|
||||
--objects Output default values for omitted message fields
|
||||
even if --defaults is not set
|
||||
[boolean] [default: false]
|
||||
--oneofs Output virtual oneof fields set to the present
|
||||
field's name [boolean] [default: false]
|
||||
--json Represent Infinity and NaN as strings in float
|
||||
fields. Also decode google.protobuf.Any
|
||||
automatically [boolean] [default: false]
|
||||
--includeComments Generate doc comments from comments in the original
|
||||
files [boolean] [default: false]
|
||||
-I, --includeDirs Directories to search for included files [array]
|
||||
-O, --outDir Directory in which to output files
|
||||
[string] [required]
|
||||
--grpcLib The gRPC implementation library that these types
|
||||
will be used with. If not provided, some types will
|
||||
not be generated [string]
|
||||
--inputTemplate Template for mapping input or "permissive" type
|
||||
names [string] [default: "%s"]
|
||||
--outputTemplate Template for mapping output or "restricted" type
|
||||
names [string] [default: "%s__Output"]
|
||||
--inputBranded Output property for branded type for "permissive"
|
||||
types with fullName of the Message as its value
|
||||
[boolean] [default: false]
|
||||
--outputBranded Output property for branded type for "restricted"
|
||||
types with fullName of the Message as its value
|
||||
[boolean] [default: false]
|
||||
--targetFileExtension File extension for generated files.
|
||||
[string] [default: ".ts"]
|
||||
--importFileExtension File extension for import specifiers in generated
|
||||
code. [string] [default: ""]
|
||||
```
|
||||
|
||||
### Example Usage
|
||||
|
||||
Generate the types:
|
||||
|
||||
```sh
|
||||
$(npm bin)/proto-loader-gen-types --longs=String --enums=String --defaults --oneofs --grpcLib=@grpc/grpc-js --outDir=proto/ proto/*.proto
|
||||
```
|
||||
|
||||
Consume the types:
|
||||
|
||||
```ts
|
||||
import * as grpc from '@grpc/grpc-js';
|
||||
import * as protoLoader from '@grpc/proto-loader';
|
||||
import type { ProtoGrpcType } from './proto/example.ts';
|
||||
import type { ExampleHandlers } from './proto/example_package/Example.ts';
|
||||
|
||||
const exampleServer: ExampleHandlers = {
|
||||
// server handlers implementation...
|
||||
};
|
||||
|
||||
const packageDefinition = protoLoader.loadSync('./proto/example.proto');
|
||||
const proto = (grpc.loadPackageDefinition(
|
||||
packageDefinition
|
||||
) as unknown) as ProtoGrpcType;
|
||||
|
||||
const server = new grpc.Server();
|
||||
server.addService(proto.example_package.Example.service, exampleServer);
|
||||
```
|
||||
913
node_modules/@grpc/proto-loader/build/bin/proto-loader-gen-types.js
generated
vendored
Executable file
913
node_modules/@grpc/proto-loader/build/bin/proto-loader-gen-types.js
generated
vendored
Executable file
@@ -0,0 +1,913 @@
|
||||
#!/usr/bin/env node
|
||||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2020 gRPC authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const Protobuf = require("protobufjs");
|
||||
const yargs = require("yargs");
|
||||
const camelCase = require("lodash.camelcase");
|
||||
const util_1 = require("../src/util");
|
||||
const templateStr = "%s";
|
||||
const useNameFmter = ({ outputTemplate, inputTemplate }) => {
|
||||
if (outputTemplate === inputTemplate) {
|
||||
throw new Error('inputTemplate and outputTemplate must differ');
|
||||
}
|
||||
return {
|
||||
outputName: (n) => outputTemplate.replace(templateStr, n),
|
||||
inputName: (n) => inputTemplate.replace(templateStr, n)
|
||||
};
|
||||
};
|
||||
class TextFormatter {
|
||||
constructor() {
|
||||
this.indentText = ' ';
|
||||
this.indentValue = 0;
|
||||
this.textParts = [];
|
||||
}
|
||||
indent() {
|
||||
this.indentValue += 1;
|
||||
}
|
||||
unindent() {
|
||||
this.indentValue -= 1;
|
||||
}
|
||||
writeLine(line) {
|
||||
for (let i = 0; i < this.indentValue; i += 1) {
|
||||
this.textParts.push(this.indentText);
|
||||
}
|
||||
this.textParts.push(line);
|
||||
this.textParts.push('\n');
|
||||
}
|
||||
getFullText() {
|
||||
return this.textParts.join('');
|
||||
}
|
||||
}
|
||||
// GENERATOR UTILITY FUNCTIONS
|
||||
function compareName(x, y) {
|
||||
if (x.name < y.name) {
|
||||
return -1;
|
||||
}
|
||||
else if (x.name > y.name) {
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
function isNamespaceBase(obj) {
|
||||
return Array.isArray(obj.nestedArray);
|
||||
}
|
||||
function stripLeadingPeriod(name) {
|
||||
return name.startsWith('.') ? name.substring(1) : name;
|
||||
}
|
||||
function getImportPath(to) {
|
||||
/* If the thing we are importing is defined in a message, it is generated in
|
||||
* the same file as that message. */
|
||||
if (to.parent instanceof Protobuf.Type) {
|
||||
return getImportPath(to.parent);
|
||||
}
|
||||
return stripLeadingPeriod(to.fullName).replace(/\./g, '/');
|
||||
}
|
||||
function getPath(to, options) {
|
||||
return stripLeadingPeriod(to.fullName).replace(/\./g, '/') + options.targetFileExtension;
|
||||
}
|
||||
function getPathToRoot(from) {
|
||||
const depth = stripLeadingPeriod(from.fullName).split('.').length - 1;
|
||||
if (depth === 0) {
|
||||
return './';
|
||||
}
|
||||
let path = '';
|
||||
for (let i = 0; i < depth; i++) {
|
||||
path += '../';
|
||||
}
|
||||
return path;
|
||||
}
|
||||
function getRelativeImportPath(from, to) {
|
||||
return getPathToRoot(from) + getImportPath(to);
|
||||
}
|
||||
function getTypeInterfaceName(type) {
|
||||
return type.fullName.replace(/\./g, '_');
|
||||
}
|
||||
function getImportLine(dependency, from, options) {
|
||||
const filePath = from === undefined ? './' + getImportPath(dependency) : getRelativeImportPath(from, dependency);
|
||||
const { outputName, inputName } = useNameFmter(options);
|
||||
const typeInterfaceName = getTypeInterfaceName(dependency);
|
||||
let importedTypes;
|
||||
/* If the dependency is defined within a message, it will be generated in that
|
||||
* message's file and exported using its typeInterfaceName. */
|
||||
if (dependency.parent instanceof Protobuf.Type) {
|
||||
if (dependency instanceof Protobuf.Type || dependency instanceof Protobuf.Enum) {
|
||||
importedTypes = `${inputName(typeInterfaceName)}, ${outputName(typeInterfaceName)}`;
|
||||
}
|
||||
else if (dependency instanceof Protobuf.Service) {
|
||||
importedTypes = `${typeInterfaceName}Client, ${typeInterfaceName}Definition`;
|
||||
}
|
||||
else {
|
||||
throw new Error('Invalid object passed to getImportLine');
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (dependency instanceof Protobuf.Type || dependency instanceof Protobuf.Enum) {
|
||||
importedTypes = `${inputName(dependency.name)} as ${inputName(typeInterfaceName)}, ${outputName(dependency.name)} as ${outputName(typeInterfaceName)}`;
|
||||
}
|
||||
else if (dependency instanceof Protobuf.Service) {
|
||||
importedTypes = `${dependency.name}Client as ${typeInterfaceName}Client, ${dependency.name}Definition as ${typeInterfaceName}Definition`;
|
||||
}
|
||||
else {
|
||||
throw new Error('Invalid object passed to getImportLine');
|
||||
}
|
||||
}
|
||||
return `import type { ${importedTypes} } from '${filePath}${options.importFileExtension}';`;
|
||||
}
|
||||
function getChildMessagesAndEnums(namespace) {
|
||||
const messageList = [];
|
||||
for (const nested of namespace.nestedArray) {
|
||||
if (nested instanceof Protobuf.Type || nested instanceof Protobuf.Enum) {
|
||||
messageList.push(nested);
|
||||
}
|
||||
if (isNamespaceBase(nested)) {
|
||||
messageList.push(...getChildMessagesAndEnums(nested));
|
||||
}
|
||||
}
|
||||
return messageList;
|
||||
}
|
||||
function formatComment(formatter, comment, options) {
|
||||
if (!comment && !(options === null || options === void 0 ? void 0 : options.deprecated)) {
|
||||
return;
|
||||
}
|
||||
formatter.writeLine('/**');
|
||||
if (comment) {
|
||||
for (const line of comment.split('\n')) {
|
||||
formatter.writeLine(` * ${line.replace(/\*\//g, '* /')}`);
|
||||
}
|
||||
}
|
||||
if (options === null || options === void 0 ? void 0 : options.deprecated) {
|
||||
formatter.writeLine(' * @deprecated');
|
||||
}
|
||||
formatter.writeLine(' */');
|
||||
}
|
||||
const typeBrandHint = `This field is a type brand and is not populated at runtime. Instances of this type should be created using type assertions.
|
||||
https://github.com/grpc/grpc-node/pull/2281`;
|
||||
function formatTypeBrand(formatter, messageType) {
|
||||
formatComment(formatter, typeBrandHint);
|
||||
formatter.writeLine(`__type: '${messageType.fullName}'`);
|
||||
}
|
||||
// GENERATOR FUNCTIONS
|
||||
function getTypeNamePermissive(fieldType, resolvedType, repeated, map, options) {
|
||||
const { inputName } = useNameFmter(options);
|
||||
switch (fieldType) {
|
||||
case 'double':
|
||||
case 'float':
|
||||
return 'number | string';
|
||||
case 'int32':
|
||||
case 'uint32':
|
||||
case 'sint32':
|
||||
case 'fixed32':
|
||||
case 'sfixed32':
|
||||
return 'number';
|
||||
case 'int64':
|
||||
case 'uint64':
|
||||
case 'sint64':
|
||||
case 'fixed64':
|
||||
case 'sfixed64':
|
||||
return 'number | string | Long';
|
||||
case 'bool':
|
||||
return 'boolean';
|
||||
case 'string':
|
||||
return 'string';
|
||||
case 'bytes':
|
||||
return 'Buffer | Uint8Array | string';
|
||||
default:
|
||||
if (resolvedType === null) {
|
||||
throw new Error('Found field with no usable type');
|
||||
}
|
||||
const typeInterfaceName = getTypeInterfaceName(resolvedType);
|
||||
if (resolvedType instanceof Protobuf.Type) {
|
||||
if (repeated || map) {
|
||||
return inputName(typeInterfaceName);
|
||||
}
|
||||
else {
|
||||
return `${inputName(typeInterfaceName)} | null`;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Enum
|
||||
return inputName(typeInterfaceName);
|
||||
}
|
||||
}
|
||||
}
|
||||
function getFieldTypePermissive(field, options) {
|
||||
const valueType = getTypeNamePermissive(field.type, field.resolvedType, field.repeated, field.map, options);
|
||||
if (field instanceof Protobuf.MapField) {
|
||||
const keyType = field.keyType === 'string' ? 'string' : 'number';
|
||||
return `{[key: ${keyType}]: ${valueType}}`;
|
||||
}
|
||||
else {
|
||||
return valueType;
|
||||
}
|
||||
}
|
||||
function generatePermissiveMessageInterface(formatter, messageType, options, nameOverride) {
|
||||
const { inputName } = useNameFmter(options);
|
||||
if (options.includeComments) {
|
||||
formatComment(formatter, messageType.comment, messageType.options);
|
||||
}
|
||||
if (messageType.fullName === '.google.protobuf.Any') {
|
||||
/* This describes the behavior of the Protobuf.js Any wrapper fromObject
|
||||
* replacement function */
|
||||
formatter.writeLine(`export type ${inputName('Any')} = AnyExtension | {`);
|
||||
formatter.writeLine(' type_url: string;');
|
||||
formatter.writeLine(' value: Buffer | Uint8Array | string;');
|
||||
formatter.writeLine('}');
|
||||
return;
|
||||
}
|
||||
formatter.writeLine(`export interface ${inputName(nameOverride !== null && nameOverride !== void 0 ? nameOverride : messageType.name)} {`);
|
||||
formatter.indent();
|
||||
for (const field of messageType.fieldsArray) {
|
||||
const repeatedString = field.repeated ? '[]' : '';
|
||||
const type = getFieldTypePermissive(field, options);
|
||||
if (options.includeComments) {
|
||||
formatComment(formatter, field.comment, field.options);
|
||||
}
|
||||
formatter.writeLine(`'${field.name}'?: (${type})${repeatedString};`);
|
||||
}
|
||||
for (const oneof of messageType.oneofsArray) {
|
||||
const typeString = oneof.fieldsArray.map(field => `"${field.name}"`).join('|');
|
||||
if (options.includeComments) {
|
||||
formatComment(formatter, oneof.comment, oneof.options);
|
||||
}
|
||||
formatter.writeLine(`'${oneof.name}'?: ${typeString};`);
|
||||
}
|
||||
if (options.inputBranded) {
|
||||
formatTypeBrand(formatter, messageType);
|
||||
}
|
||||
formatter.unindent();
|
||||
formatter.writeLine('}');
|
||||
}
|
||||
function getTypeNameRestricted(fieldType, resolvedType, repeated, map, options) {
|
||||
const { outputName } = useNameFmter(options);
|
||||
switch (fieldType) {
|
||||
case 'double':
|
||||
case 'float':
|
||||
if (options.json) {
|
||||
return 'number | string';
|
||||
}
|
||||
else {
|
||||
return 'number';
|
||||
}
|
||||
case 'int32':
|
||||
case 'uint32':
|
||||
case 'sint32':
|
||||
case 'fixed32':
|
||||
case 'sfixed32':
|
||||
return 'number';
|
||||
case 'int64':
|
||||
case 'uint64':
|
||||
case 'sint64':
|
||||
case 'fixed64':
|
||||
case 'sfixed64':
|
||||
if (options.longs === Number) {
|
||||
return 'number';
|
||||
}
|
||||
else if (options.longs === String) {
|
||||
return 'string';
|
||||
}
|
||||
else {
|
||||
return 'Long';
|
||||
}
|
||||
case 'bool':
|
||||
return 'boolean';
|
||||
case 'string':
|
||||
return 'string';
|
||||
case 'bytes':
|
||||
if (options.bytes === Array) {
|
||||
return 'Uint8Array';
|
||||
}
|
||||
else if (options.bytes === String) {
|
||||
return 'string';
|
||||
}
|
||||
else {
|
||||
return 'Buffer';
|
||||
}
|
||||
default:
|
||||
if (resolvedType === null) {
|
||||
throw new Error('Found field with no usable type');
|
||||
}
|
||||
const typeInterfaceName = getTypeInterfaceName(resolvedType);
|
||||
if (resolvedType instanceof Protobuf.Type) {
|
||||
/* null is only used to represent absent message values if the defaults
|
||||
* option is set, and only for non-repeated, non-map fields. */
|
||||
if (options.defaults && !repeated && !map) {
|
||||
return `${outputName(typeInterfaceName)} | null`;
|
||||
}
|
||||
else {
|
||||
return `${outputName(typeInterfaceName)}`;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Enum
|
||||
return outputName(typeInterfaceName);
|
||||
}
|
||||
}
|
||||
}
|
||||
function getFieldTypeRestricted(field, options) {
|
||||
const valueType = getTypeNameRestricted(field.type, field.resolvedType, field.repeated, field.map, options);
|
||||
if (field instanceof Protobuf.MapField) {
|
||||
const keyType = field.keyType === 'string' ? 'string' : 'number';
|
||||
return `{[key: ${keyType}]: ${valueType}}`;
|
||||
}
|
||||
else {
|
||||
return valueType;
|
||||
}
|
||||
}
|
||||
function generateRestrictedMessageInterface(formatter, messageType, options, nameOverride) {
|
||||
var _a, _b, _c;
|
||||
const { outputName } = useNameFmter(options);
|
||||
if (options.includeComments) {
|
||||
formatComment(formatter, messageType.comment, messageType.options);
|
||||
}
|
||||
if (messageType.fullName === '.google.protobuf.Any' && options.json) {
|
||||
/* This describes the behavior of the Protobuf.js Any wrapper toObject
|
||||
* replacement function */
|
||||
let optionalString = options.defaults ? '' : '?';
|
||||
formatter.writeLine(`export type ${outputName('Any')} = AnyExtension | {`);
|
||||
formatter.writeLine(` type_url${optionalString}: string;`);
|
||||
formatter.writeLine(` value${optionalString}: ${getTypeNameRestricted('bytes', null, false, false, options)};`);
|
||||
formatter.writeLine('}');
|
||||
return;
|
||||
}
|
||||
formatter.writeLine(`export interface ${outputName(nameOverride !== null && nameOverride !== void 0 ? nameOverride : messageType.name)} {`);
|
||||
formatter.indent();
|
||||
for (const field of messageType.fieldsArray) {
|
||||
let fieldGuaranteed;
|
||||
if (field.partOf) {
|
||||
// The field is not guaranteed populated if it is part of a oneof
|
||||
fieldGuaranteed = false;
|
||||
}
|
||||
else if (field.repeated) {
|
||||
fieldGuaranteed = (_a = (options.defaults || options.arrays)) !== null && _a !== void 0 ? _a : false;
|
||||
}
|
||||
else if (field.map) {
|
||||
fieldGuaranteed = (_b = (options.defaults || options.objects)) !== null && _b !== void 0 ? _b : false;
|
||||
}
|
||||
else {
|
||||
fieldGuaranteed = (_c = options.defaults) !== null && _c !== void 0 ? _c : false;
|
||||
}
|
||||
const optionalString = fieldGuaranteed ? '' : '?';
|
||||
const repeatedString = field.repeated ? '[]' : '';
|
||||
const type = getFieldTypeRestricted(field, options);
|
||||
if (options.includeComments) {
|
||||
formatComment(formatter, field.comment, field.options);
|
||||
}
|
||||
formatter.writeLine(`'${field.name}'${optionalString}: (${type})${repeatedString};`);
|
||||
}
|
||||
if (options.oneofs) {
|
||||
for (const oneof of messageType.oneofsArray) {
|
||||
const typeString = oneof.fieldsArray.map(field => `"${field.name}"`).join('|');
|
||||
if (options.includeComments) {
|
||||
formatComment(formatter, oneof.comment, oneof.options);
|
||||
}
|
||||
formatter.writeLine(`'${oneof.name}'?: ${typeString};`);
|
||||
}
|
||||
}
|
||||
if (options.outputBranded) {
|
||||
formatTypeBrand(formatter, messageType);
|
||||
}
|
||||
formatter.unindent();
|
||||
formatter.writeLine('}');
|
||||
}
|
||||
function generateMessageInterfaces(formatter, messageType, options) {
|
||||
var _a, _b;
|
||||
let usesLong = false;
|
||||
let seenDeps = new Set();
|
||||
const childTypes = getChildMessagesAndEnums(messageType);
|
||||
formatter.writeLine(`// Original file: ${(_b = ((_a = messageType.filename) !== null && _a !== void 0 ? _a : 'null')) === null || _b === void 0 ? void 0 : _b.replace(/\\/g, '/')}`);
|
||||
formatter.writeLine('');
|
||||
const isLongField = (field) => ['int64', 'uint64', 'sint64', 'fixed64', 'sfixed64'].includes(field.type);
|
||||
messageType.fieldsArray.sort((fieldA, fieldB) => fieldA.id - fieldB.id);
|
||||
for (const field of messageType.fieldsArray) {
|
||||
if (field.resolvedType && childTypes.indexOf(field.resolvedType) < 0) {
|
||||
const dependency = field.resolvedType;
|
||||
if (seenDeps.has(dependency.fullName)) {
|
||||
continue;
|
||||
}
|
||||
seenDeps.add(dependency.fullName);
|
||||
formatter.writeLine(getImportLine(dependency, messageType, options));
|
||||
}
|
||||
if (isLongField(field)) {
|
||||
usesLong = true;
|
||||
}
|
||||
}
|
||||
for (const childType of childTypes) {
|
||||
if (childType instanceof Protobuf.Type) {
|
||||
for (const field of childType.fieldsArray) {
|
||||
if (field.resolvedType && childTypes.indexOf(field.resolvedType) < 0) {
|
||||
const dependency = field.resolvedType;
|
||||
if (seenDeps.has(dependency.fullName)) {
|
||||
continue;
|
||||
}
|
||||
seenDeps.add(dependency.fullName);
|
||||
formatter.writeLine(getImportLine(dependency, messageType, options));
|
||||
}
|
||||
if (isLongField(field)) {
|
||||
usesLong = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (usesLong) {
|
||||
formatter.writeLine("import type { Long } from '@grpc/proto-loader';");
|
||||
}
|
||||
if (messageType.fullName === '.google.protobuf.Any') {
|
||||
formatter.writeLine("import type { AnyExtension } from '@grpc/proto-loader';");
|
||||
}
|
||||
formatter.writeLine('');
|
||||
for (const childType of childTypes.sort(compareName)) {
|
||||
const nameOverride = getTypeInterfaceName(childType);
|
||||
if (childType instanceof Protobuf.Type) {
|
||||
generatePermissiveMessageInterface(formatter, childType, options, nameOverride);
|
||||
formatter.writeLine('');
|
||||
generateRestrictedMessageInterface(formatter, childType, options, nameOverride);
|
||||
}
|
||||
else {
|
||||
generateEnumInterface(formatter, childType, options, nameOverride);
|
||||
}
|
||||
formatter.writeLine('');
|
||||
}
|
||||
generatePermissiveMessageInterface(formatter, messageType, options);
|
||||
formatter.writeLine('');
|
||||
generateRestrictedMessageInterface(formatter, messageType, options);
|
||||
}
|
||||
function generateEnumInterface(formatter, enumType, options, nameOverride) {
|
||||
var _a, _b, _c;
|
||||
const { inputName, outputName } = useNameFmter(options);
|
||||
const name = nameOverride !== null && nameOverride !== void 0 ? nameOverride : enumType.name;
|
||||
formatter.writeLine(`// Original file: ${(_b = ((_a = enumType.filename) !== null && _a !== void 0 ? _a : 'null')) === null || _b === void 0 ? void 0 : _b.replace(/\\/g, '/')}`);
|
||||
formatter.writeLine('');
|
||||
if (options.includeComments) {
|
||||
formatComment(formatter, enumType.comment, enumType.options);
|
||||
}
|
||||
formatter.writeLine(`export const ${name} = {`);
|
||||
formatter.indent();
|
||||
for (const key of Object.keys(enumType.values)) {
|
||||
if (options.includeComments) {
|
||||
formatComment(formatter, enumType.comments[key], ((_c = enumType.valuesOptions) !== null && _c !== void 0 ? _c : {})[key]);
|
||||
}
|
||||
formatter.writeLine(`${key}: ${options.enums == String ? `'${key}'` : enumType.values[key]},`);
|
||||
}
|
||||
formatter.unindent();
|
||||
formatter.writeLine('} as const;');
|
||||
// Permissive Type
|
||||
formatter.writeLine('');
|
||||
if (options.includeComments) {
|
||||
formatComment(formatter, enumType.comment, enumType.options);
|
||||
}
|
||||
formatter.writeLine(`export type ${inputName(name)} =`);
|
||||
formatter.indent();
|
||||
for (const key of Object.keys(enumType.values)) {
|
||||
if (options.includeComments) {
|
||||
formatComment(formatter, enumType.comments[key]);
|
||||
}
|
||||
formatter.writeLine(`| '${key}'`);
|
||||
formatter.writeLine(`| ${enumType.values[key]}`);
|
||||
}
|
||||
formatter.unindent();
|
||||
// Restrictive Type
|
||||
formatter.writeLine('');
|
||||
if (options.includeComments) {
|
||||
formatComment(formatter, enumType.comment, enumType.options);
|
||||
}
|
||||
formatter.writeLine(`export type ${outputName(name)} = typeof ${name}[keyof typeof ${name}]`);
|
||||
}
|
||||
/**
|
||||
* This is a list of methods that are exist in the generic Client class in the
|
||||
* gRPC libraries. TypeScript has a problem with methods in subclasses with the
|
||||
* same names as methods in the superclass, but with mismatched APIs. So, we
|
||||
* avoid generating methods with these names in the service client interfaces.
|
||||
* We always generate two service client methods per service method: one camel
|
||||
* cased, and one with the original casing. So we will still generate one
|
||||
* service client method for any conflicting name.
|
||||
*
|
||||
* Technically, at runtime conflicting name in the service client method
|
||||
* actually shadows the original method, but TypeScript does not have a good
|
||||
* way to represent that. So this change is not 100% accurate, but it gets the
|
||||
* generated code to compile.
|
||||
*
|
||||
* This is just a list of the methods in the Client class definitions in
|
||||
* grpc@1.24.11 and @grpc/grpc-js@1.4.0.
|
||||
*/
|
||||
const CLIENT_RESERVED_METHOD_NAMES = new Set([
|
||||
'close',
|
||||
'getChannel',
|
||||
'waitForReady',
|
||||
'makeUnaryRequest',
|
||||
'makeClientStreamRequest',
|
||||
'makeServerStreamRequest',
|
||||
'makeBidiStreamRequest',
|
||||
'resolveCallInterceptors',
|
||||
/* These methods are private, but TypeScript is not happy with overriding even
|
||||
* private methods with mismatched APIs. */
|
||||
'checkOptionalUnaryResponseArguments',
|
||||
'checkMetadataAndOptions'
|
||||
]);
|
||||
function generateServiceClientInterface(formatter, serviceType, options) {
|
||||
const { outputName, inputName } = useNameFmter(options);
|
||||
if (options.includeComments) {
|
||||
formatComment(formatter, serviceType.comment, serviceType.options);
|
||||
}
|
||||
formatter.writeLine(`export interface ${serviceType.name}Client extends grpc.Client {`);
|
||||
formatter.indent();
|
||||
for (const methodName of Object.keys(serviceType.methods).sort()) {
|
||||
const method = serviceType.methods[methodName];
|
||||
for (const name of new Set([methodName, camelCase(methodName)])) {
|
||||
if (CLIENT_RESERVED_METHOD_NAMES.has(name)) {
|
||||
continue;
|
||||
}
|
||||
if (options.includeComments) {
|
||||
formatComment(formatter, method.comment, method.options);
|
||||
}
|
||||
const requestType = inputName(getTypeInterfaceName(method.resolvedRequestType));
|
||||
const responseType = outputName(getTypeInterfaceName(method.resolvedResponseType));
|
||||
const callbackType = `grpc.requestCallback<${responseType}>`;
|
||||
if (method.requestStream) {
|
||||
if (method.responseStream) {
|
||||
// Bidi streaming
|
||||
const callType = `grpc.ClientDuplexStream<${requestType}, ${responseType}>`;
|
||||
formatter.writeLine(`${name}(metadata: grpc.Metadata, options?: grpc.CallOptions): ${callType};`);
|
||||
formatter.writeLine(`${name}(options?: grpc.CallOptions): ${callType};`);
|
||||
}
|
||||
else {
|
||||
// Client streaming
|
||||
const callType = `grpc.ClientWritableStream<${requestType}>`;
|
||||
formatter.writeLine(`${name}(metadata: grpc.Metadata, options: grpc.CallOptions, callback: ${callbackType}): ${callType};`);
|
||||
formatter.writeLine(`${name}(metadata: grpc.Metadata, callback: ${callbackType}): ${callType};`);
|
||||
formatter.writeLine(`${name}(options: grpc.CallOptions, callback: ${callbackType}): ${callType};`);
|
||||
formatter.writeLine(`${name}(callback: ${callbackType}): ${callType};`);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (method.responseStream) {
|
||||
// Server streaming
|
||||
const callType = `grpc.ClientReadableStream<${responseType}>`;
|
||||
formatter.writeLine(`${name}(argument: ${requestType}, metadata: grpc.Metadata, options?: grpc.CallOptions): ${callType};`);
|
||||
formatter.writeLine(`${name}(argument: ${requestType}, options?: grpc.CallOptions): ${callType};`);
|
||||
}
|
||||
else {
|
||||
// Unary
|
||||
const callType = 'grpc.ClientUnaryCall';
|
||||
formatter.writeLine(`${name}(argument: ${requestType}, metadata: grpc.Metadata, options: grpc.CallOptions, callback: ${callbackType}): ${callType};`);
|
||||
formatter.writeLine(`${name}(argument: ${requestType}, metadata: grpc.Metadata, callback: ${callbackType}): ${callType};`);
|
||||
formatter.writeLine(`${name}(argument: ${requestType}, options: grpc.CallOptions, callback: ${callbackType}): ${callType};`);
|
||||
formatter.writeLine(`${name}(argument: ${requestType}, callback: ${callbackType}): ${callType};`);
|
||||
}
|
||||
}
|
||||
}
|
||||
formatter.writeLine('');
|
||||
}
|
||||
formatter.unindent();
|
||||
formatter.writeLine('}');
|
||||
}
|
||||
function generateServiceHandlerInterface(formatter, serviceType, options) {
|
||||
const { inputName, outputName } = useNameFmter(options);
|
||||
if (options.includeComments) {
|
||||
formatComment(formatter, serviceType.comment, serviceType.options);
|
||||
}
|
||||
formatter.writeLine(`export interface ${serviceType.name}Handlers extends grpc.UntypedServiceImplementation {`);
|
||||
formatter.indent();
|
||||
for (const methodName of Object.keys(serviceType.methods).sort()) {
|
||||
const method = serviceType.methods[methodName];
|
||||
if (options.includeComments) {
|
||||
formatComment(formatter, method.comment, serviceType.options);
|
||||
}
|
||||
const requestType = outputName(getTypeInterfaceName(method.resolvedRequestType));
|
||||
const responseType = inputName(getTypeInterfaceName(method.resolvedResponseType));
|
||||
if (method.requestStream) {
|
||||
if (method.responseStream) {
|
||||
// Bidi streaming
|
||||
formatter.writeLine(`${methodName}: grpc.handleBidiStreamingCall<${requestType}, ${responseType}>;`);
|
||||
}
|
||||
else {
|
||||
// Client streaming
|
||||
formatter.writeLine(`${methodName}: grpc.handleClientStreamingCall<${requestType}, ${responseType}>;`);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (method.responseStream) {
|
||||
// Server streaming
|
||||
formatter.writeLine(`${methodName}: grpc.handleServerStreamingCall<${requestType}, ${responseType}>;`);
|
||||
}
|
||||
else {
|
||||
// Unary
|
||||
formatter.writeLine(`${methodName}: grpc.handleUnaryCall<${requestType}, ${responseType}>;`);
|
||||
}
|
||||
}
|
||||
formatter.writeLine('');
|
||||
}
|
||||
formatter.unindent();
|
||||
formatter.writeLine('}');
|
||||
}
|
||||
function generateServiceDefinitionInterface(formatter, serviceType, options) {
|
||||
const { inputName, outputName } = useNameFmter(options);
|
||||
if (options.grpcLib) {
|
||||
formatter.writeLine(`export interface ${serviceType.name}Definition extends grpc.ServiceDefinition {`);
|
||||
}
|
||||
else {
|
||||
formatter.writeLine(`export interface ${serviceType.name}Definition {`);
|
||||
}
|
||||
formatter.indent();
|
||||
for (const methodName of Object.keys(serviceType.methods).sort()) {
|
||||
const method = serviceType.methods[methodName];
|
||||
const requestType = getTypeInterfaceName(method.resolvedRequestType);
|
||||
const responseType = getTypeInterfaceName(method.resolvedResponseType);
|
||||
formatter.writeLine(`${methodName}: MethodDefinition<${inputName(requestType)}, ${inputName(responseType)}, ${outputName(requestType)}, ${outputName(responseType)}>`);
|
||||
}
|
||||
formatter.unindent();
|
||||
formatter.writeLine('}');
|
||||
}
|
||||
function generateServiceInterfaces(formatter, serviceType, options) {
|
||||
var _a, _b;
|
||||
formatter.writeLine(`// Original file: ${(_b = ((_a = serviceType.filename) !== null && _a !== void 0 ? _a : 'null')) === null || _b === void 0 ? void 0 : _b.replace(/\\/g, '/')}`);
|
||||
formatter.writeLine('');
|
||||
if (options.grpcLib) {
|
||||
const grpcImportPath = options.grpcLib.startsWith('.') ? getPathToRoot(serviceType) + options.grpcLib : options.grpcLib;
|
||||
formatter.writeLine(`import type * as grpc from '${grpcImportPath}'`);
|
||||
}
|
||||
formatter.writeLine(`import type { MethodDefinition } from '@grpc/proto-loader'`);
|
||||
const dependencies = new Set();
|
||||
for (const method of serviceType.methodsArray) {
|
||||
dependencies.add(method.resolvedRequestType);
|
||||
dependencies.add(method.resolvedResponseType);
|
||||
}
|
||||
for (const dep of Array.from(dependencies.values()).sort(compareName)) {
|
||||
formatter.writeLine(getImportLine(dep, serviceType, options));
|
||||
}
|
||||
formatter.writeLine('');
|
||||
if (options.grpcLib) {
|
||||
generateServiceClientInterface(formatter, serviceType, options);
|
||||
formatter.writeLine('');
|
||||
generateServiceHandlerInterface(formatter, serviceType, options);
|
||||
formatter.writeLine('');
|
||||
}
|
||||
generateServiceDefinitionInterface(formatter, serviceType, options);
|
||||
}
|
||||
function containsDefinition(definitionType, namespace) {
|
||||
for (const nested of namespace.nestedArray.sort(compareName)) {
|
||||
if (nested instanceof definitionType) {
|
||||
return true;
|
||||
}
|
||||
else if (isNamespaceBase(nested) && !(nested instanceof Protobuf.Type) && !(nested instanceof Protobuf.Enum) && containsDefinition(definitionType, nested)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function generateDefinitionImports(formatter, namespace, options) {
|
||||
const imports = [];
|
||||
if (containsDefinition(Protobuf.Enum, namespace)) {
|
||||
imports.push('EnumTypeDefinition');
|
||||
}
|
||||
if (containsDefinition(Protobuf.Type, namespace)) {
|
||||
imports.push('MessageTypeDefinition');
|
||||
}
|
||||
if (imports.length) {
|
||||
formatter.writeLine(`import type { ${imports.join(', ')} } from '@grpc/proto-loader';`);
|
||||
}
|
||||
}
|
||||
function generateServiceImports(formatter, namespace, options) {
|
||||
for (const nested of namespace.nestedArray.sort(compareName)) {
|
||||
if (nested instanceof Protobuf.Service) {
|
||||
formatter.writeLine(getImportLine(nested, undefined, options));
|
||||
}
|
||||
else if (isNamespaceBase(nested) && !(nested instanceof Protobuf.Type) && !(nested instanceof Protobuf.Enum)) {
|
||||
generateServiceImports(formatter, nested, options);
|
||||
}
|
||||
}
|
||||
}
|
||||
function generateSingleLoadedDefinitionType(formatter, nested, options) {
|
||||
if (nested instanceof Protobuf.Service) {
|
||||
if (options.includeComments) {
|
||||
formatComment(formatter, nested.comment, nested.options);
|
||||
}
|
||||
const typeInterfaceName = getTypeInterfaceName(nested);
|
||||
formatter.writeLine(`${nested.name}: SubtypeConstructor<typeof grpc.Client, ${typeInterfaceName}Client> & { service: ${typeInterfaceName}Definition }`);
|
||||
}
|
||||
else if (nested instanceof Protobuf.Enum) {
|
||||
formatter.writeLine(`${nested.name}: EnumTypeDefinition`);
|
||||
}
|
||||
else if (nested instanceof Protobuf.Type) {
|
||||
formatter.writeLine(`${nested.name}: MessageTypeDefinition`);
|
||||
}
|
||||
else if (isNamespaceBase(nested)) {
|
||||
generateLoadedDefinitionTypes(formatter, nested, options);
|
||||
}
|
||||
}
|
||||
function generateLoadedDefinitionTypes(formatter, namespace, options) {
|
||||
formatter.writeLine(`${namespace.name}: {`);
|
||||
formatter.indent();
|
||||
for (const nested of namespace.nestedArray.sort(compareName)) {
|
||||
generateSingleLoadedDefinitionType(formatter, nested, options);
|
||||
}
|
||||
formatter.unindent();
|
||||
formatter.writeLine('}');
|
||||
}
|
||||
function generateRootFile(formatter, root, options) {
|
||||
if (!options.grpcLib) {
|
||||
return;
|
||||
}
|
||||
formatter.writeLine(`import type * as grpc from '${options.grpcLib}';`);
|
||||
generateDefinitionImports(formatter, root, options);
|
||||
formatter.writeLine('');
|
||||
generateServiceImports(formatter, root, options);
|
||||
formatter.writeLine('');
|
||||
formatter.writeLine('type SubtypeConstructor<Constructor extends new (...args: any) => any, Subtype> = {');
|
||||
formatter.writeLine(' new(...args: ConstructorParameters<Constructor>): Subtype;');
|
||||
formatter.writeLine('};');
|
||||
formatter.writeLine('');
|
||||
formatter.writeLine('export interface ProtoGrpcType {');
|
||||
formatter.indent();
|
||||
for (const nested of root.nestedArray) {
|
||||
generateSingleLoadedDefinitionType(formatter, nested, options);
|
||||
}
|
||||
formatter.unindent();
|
||||
formatter.writeLine('}');
|
||||
formatter.writeLine('');
|
||||
}
|
||||
async function writeFile(filename, contents) {
|
||||
await fs.promises.mkdir(path.dirname(filename), { recursive: true });
|
||||
return fs.promises.writeFile(filename, contents);
|
||||
}
|
||||
function generateFilesForNamespace(namespace, options) {
|
||||
const filePromises = [];
|
||||
for (const nested of namespace.nestedArray) {
|
||||
const fileFormatter = new TextFormatter();
|
||||
if (nested instanceof Protobuf.Type) {
|
||||
generateMessageInterfaces(fileFormatter, nested, options);
|
||||
if (options.verbose) {
|
||||
console.log(`Writing ${options.outDir}/${getPath(nested, options)} from file ${nested.filename}`);
|
||||
}
|
||||
filePromises.push(writeFile(`${options.outDir}/${getPath(nested, options)}`, fileFormatter.getFullText()));
|
||||
}
|
||||
else if (nested instanceof Protobuf.Enum) {
|
||||
generateEnumInterface(fileFormatter, nested, options);
|
||||
if (options.verbose) {
|
||||
console.log(`Writing ${options.outDir}/${getPath(nested, options)} from file ${nested.filename}`);
|
||||
}
|
||||
filePromises.push(writeFile(`${options.outDir}/${getPath(nested, options)}`, fileFormatter.getFullText()));
|
||||
}
|
||||
else if (nested instanceof Protobuf.Service) {
|
||||
generateServiceInterfaces(fileFormatter, nested, options);
|
||||
if (options.verbose) {
|
||||
console.log(`Writing ${options.outDir}/${getPath(nested, options)} from file ${nested.filename}`);
|
||||
}
|
||||
filePromises.push(writeFile(`${options.outDir}/${getPath(nested, options)}`, fileFormatter.getFullText()));
|
||||
}
|
||||
else if (isNamespaceBase(nested)) {
|
||||
filePromises.push(...generateFilesForNamespace(nested, options));
|
||||
}
|
||||
}
|
||||
return filePromises;
|
||||
}
|
||||
function writeFilesForRoot(root, masterFileName, options) {
|
||||
const filePromises = [];
|
||||
const masterFileFormatter = new TextFormatter();
|
||||
if (options.grpcLib) {
|
||||
generateRootFile(masterFileFormatter, root, options);
|
||||
if (options.verbose) {
|
||||
console.log(`Writing ${options.outDir}/${masterFileName}`);
|
||||
}
|
||||
filePromises.push(writeFile(`${options.outDir}/${masterFileName}`, masterFileFormatter.getFullText()));
|
||||
}
|
||||
filePromises.push(...generateFilesForNamespace(root, options));
|
||||
return filePromises;
|
||||
}
|
||||
async function writeAllFiles(protoFiles, options) {
|
||||
await fs.promises.mkdir(options.outDir, { recursive: true });
|
||||
const basenameMap = new Map();
|
||||
for (const filename of protoFiles) {
|
||||
const basename = path.basename(filename).replace(/\.proto$/, options.targetFileExtension);
|
||||
if (basenameMap.has(basename)) {
|
||||
basenameMap.get(basename).push(filename);
|
||||
}
|
||||
else {
|
||||
basenameMap.set(basename, [filename]);
|
||||
}
|
||||
}
|
||||
for (const [basename, filenames] of basenameMap.entries()) {
|
||||
const loadedRoot = await (0, util_1.loadProtosWithOptions)(filenames, options);
|
||||
writeFilesForRoot(loadedRoot, basename, options);
|
||||
}
|
||||
}
|
||||
async function runScript() {
|
||||
const boolDefaultFalseOption = {
|
||||
boolean: true,
|
||||
default: false,
|
||||
};
|
||||
const argv = await yargs
|
||||
.parserConfiguration({
|
||||
'parse-positional-numbers': false
|
||||
})
|
||||
.option('keepCase', boolDefaultFalseOption)
|
||||
.option('longs', { string: true, default: 'Long' })
|
||||
.option('enums', { string: true, default: 'number' })
|
||||
.option('bytes', { string: true, default: 'Buffer' })
|
||||
.option('defaults', boolDefaultFalseOption)
|
||||
.option('arrays', boolDefaultFalseOption)
|
||||
.option('objects', boolDefaultFalseOption)
|
||||
.option('oneofs', boolDefaultFalseOption)
|
||||
.option('json', boolDefaultFalseOption)
|
||||
.boolean('verbose')
|
||||
.option('includeComments', boolDefaultFalseOption)
|
||||
.option('includeDirs', {
|
||||
normalize: true,
|
||||
array: true,
|
||||
alias: 'I'
|
||||
})
|
||||
.option('outDir', {
|
||||
alias: 'O',
|
||||
normalize: true,
|
||||
})
|
||||
.option('grpcLib', { string: true })
|
||||
.option('inputTemplate', { string: true, default: `${templateStr}` })
|
||||
.option('outputTemplate', { string: true, default: `${templateStr}__Output` })
|
||||
.option('inputBranded', boolDefaultFalseOption)
|
||||
.option('outputBranded', boolDefaultFalseOption)
|
||||
.option('targetFileExtension', { string: true, default: '.ts' })
|
||||
.option('importFileExtension', { string: true, default: '' })
|
||||
.coerce('longs', value => {
|
||||
switch (value) {
|
||||
case 'String': return String;
|
||||
case 'Number': return Number;
|
||||
default: return undefined;
|
||||
}
|
||||
}).coerce('enums', value => {
|
||||
if (value === 'String') {
|
||||
return String;
|
||||
}
|
||||
else {
|
||||
return undefined;
|
||||
}
|
||||
}).coerce('bytes', value => {
|
||||
switch (value) {
|
||||
case 'Array': return Array;
|
||||
case 'String': return String;
|
||||
default: return undefined;
|
||||
}
|
||||
})
|
||||
.alias({
|
||||
verbose: 'v'
|
||||
}).describe({
|
||||
keepCase: 'Preserve the case of field names',
|
||||
longs: 'The type that should be used to output 64 bit integer values. Can be String, Number',
|
||||
enums: 'The type that should be used to output enum fields. Can be String',
|
||||
bytes: 'The type that should be used to output bytes fields. Can be String, Array',
|
||||
defaults: 'Output default values for omitted fields',
|
||||
arrays: 'Output default values for omitted repeated fields even if --defaults is not set',
|
||||
objects: 'Output default values for omitted message fields even if --defaults is not set',
|
||||
oneofs: 'Output virtual oneof fields set to the present field\'s name',
|
||||
json: 'Represent Infinity and NaN as strings in float fields. Also decode google.protobuf.Any automatically',
|
||||
includeComments: 'Generate doc comments from comments in the original files',
|
||||
includeDirs: 'Directories to search for included files',
|
||||
outDir: 'Directory in which to output files',
|
||||
grpcLib: 'The gRPC implementation library that these types will be used with. If not provided, some types will not be generated',
|
||||
inputTemplate: 'Template for mapping input or "permissive" type names',
|
||||
outputTemplate: 'Template for mapping output or "restricted" type names',
|
||||
inputBranded: 'Output property for branded type for "permissive" types with fullName of the Message as its value',
|
||||
outputBranded: 'Output property for branded type for "restricted" types with fullName of the Message as its value',
|
||||
targetFileExtension: 'File extension for generated files.',
|
||||
importFileExtension: 'File extension for import specifiers in generated code.'
|
||||
}).demandOption(['outDir'])
|
||||
.demand(1)
|
||||
.usage('$0 [options] filenames...')
|
||||
.epilogue('WARNING: This tool is in alpha. The CLI and generated code are subject to change')
|
||||
.argv;
|
||||
if (argv.verbose) {
|
||||
console.log('Parsed arguments:', argv);
|
||||
}
|
||||
(0, util_1.addCommonProtos)();
|
||||
writeAllFiles(argv._, Object.assign(Object.assign({}, argv), { alternateCommentMode: true })).then(() => {
|
||||
if (argv.verbose) {
|
||||
console.log('Success');
|
||||
}
|
||||
}, (error) => {
|
||||
console.error(error);
|
||||
process.exit(1);
|
||||
});
|
||||
}
|
||||
if (require.main === module) {
|
||||
runScript();
|
||||
}
|
||||
//# sourceMappingURL=proto-loader-gen-types.js.map
|
||||
1
node_modules/@grpc/proto-loader/build/bin/proto-loader-gen-types.js.map
generated
vendored
Normal file
1
node_modules/@grpc/proto-loader/build/bin/proto-loader-gen-types.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
160
node_modules/@grpc/proto-loader/build/src/index.d.ts
generated
vendored
Normal file
160
node_modules/@grpc/proto-loader/build/src/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,160 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2018 gRPC authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
/// <reference types="node" />
|
||||
import * as Protobuf from 'protobufjs';
|
||||
import * as descriptor from 'protobufjs/ext/descriptor';
|
||||
import { Options } from './util';
|
||||
import Long = require('long');
|
||||
export { Options, Long };
|
||||
/**
|
||||
* This type exists for use with code generated by the proto-loader-gen-types
|
||||
* tool. This type should be used with another interface, e.g.
|
||||
* MessageType & AnyExtension for an object that is converted to or from a
|
||||
* google.protobuf.Any message.
|
||||
* For example, when processing an Any message:
|
||||
*
|
||||
* ```ts
|
||||
* if (isAnyExtension(message)) {
|
||||
* switch (message['@type']) {
|
||||
* case TYPE1_URL:
|
||||
* handleType1(message as AnyExtension & Type1);
|
||||
* break;
|
||||
* case TYPE2_URL:
|
||||
* handleType2(message as AnyExtension & Type2);
|
||||
* break;
|
||||
* // ...
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
export interface AnyExtension {
|
||||
/**
|
||||
* The fully qualified name of the message type that this object represents,
|
||||
* possibly including a URL prefix.
|
||||
*/
|
||||
'@type': string;
|
||||
}
|
||||
export declare function isAnyExtension(obj: object): obj is AnyExtension;
|
||||
declare module 'protobufjs' {
|
||||
interface Type {
|
||||
toDescriptor(protoVersion: string): Protobuf.Message<descriptor.IDescriptorProto> & descriptor.IDescriptorProto;
|
||||
}
|
||||
interface RootConstructor {
|
||||
new (options?: Options): Root;
|
||||
fromDescriptor(descriptorSet: descriptor.IFileDescriptorSet | Protobuf.Reader | Uint8Array): Root;
|
||||
fromJSON(json: Protobuf.INamespace, root?: Root): Root;
|
||||
}
|
||||
interface Root {
|
||||
toDescriptor(protoVersion: string): Protobuf.Message<descriptor.IFileDescriptorSet> & descriptor.IFileDescriptorSet;
|
||||
}
|
||||
interface Enum {
|
||||
toDescriptor(protoVersion: string): Protobuf.Message<descriptor.IEnumDescriptorProto> & descriptor.IEnumDescriptorProto;
|
||||
}
|
||||
}
|
||||
export interface Serialize<T> {
|
||||
(value: T): Buffer;
|
||||
}
|
||||
export interface Deserialize<T> {
|
||||
(bytes: Buffer): T;
|
||||
}
|
||||
export interface ProtobufTypeDefinition {
|
||||
format: string;
|
||||
type: object;
|
||||
fileDescriptorProtos: Buffer[];
|
||||
}
|
||||
export interface MessageTypeDefinition extends ProtobufTypeDefinition {
|
||||
format: 'Protocol Buffer 3 DescriptorProto';
|
||||
}
|
||||
export interface EnumTypeDefinition extends ProtobufTypeDefinition {
|
||||
format: 'Protocol Buffer 3 EnumDescriptorProto';
|
||||
}
|
||||
export declare enum IdempotencyLevel {
|
||||
IDEMPOTENCY_UNKNOWN = "IDEMPOTENCY_UNKNOWN",
|
||||
NO_SIDE_EFFECTS = "NO_SIDE_EFFECTS",
|
||||
IDEMPOTENT = "IDEMPOTENT"
|
||||
}
|
||||
export interface NamePart {
|
||||
name_part: string;
|
||||
is_extension: boolean;
|
||||
}
|
||||
export interface UninterpretedOption {
|
||||
name?: NamePart[];
|
||||
identifier_value?: string;
|
||||
positive_int_value?: number;
|
||||
negative_int_value?: number;
|
||||
double_value?: number;
|
||||
string_value?: string;
|
||||
aggregate_value?: string;
|
||||
}
|
||||
export interface MethodOptions {
|
||||
deprecated: boolean;
|
||||
idempotency_level: IdempotencyLevel;
|
||||
uninterpreted_option: UninterpretedOption[];
|
||||
[k: string]: unknown;
|
||||
}
|
||||
export interface MethodDefinition<RequestType, ResponseType, OutputRequestType = RequestType, OutputResponseType = ResponseType> {
|
||||
path: string;
|
||||
requestStream: boolean;
|
||||
responseStream: boolean;
|
||||
requestSerialize: Serialize<RequestType>;
|
||||
responseSerialize: Serialize<ResponseType>;
|
||||
requestDeserialize: Deserialize<OutputRequestType>;
|
||||
responseDeserialize: Deserialize<OutputResponseType>;
|
||||
originalName?: string;
|
||||
requestType: MessageTypeDefinition;
|
||||
responseType: MessageTypeDefinition;
|
||||
options: MethodOptions;
|
||||
}
|
||||
export interface ServiceDefinition {
|
||||
[index: string]: MethodDefinition<object, object>;
|
||||
}
|
||||
export declare type AnyDefinition = ServiceDefinition | MessageTypeDefinition | EnumTypeDefinition;
|
||||
export interface PackageDefinition {
|
||||
[index: string]: AnyDefinition;
|
||||
}
|
||||
/**
|
||||
* Load a .proto file with the specified options.
|
||||
* @param filename One or multiple file paths to load. Can be an absolute path
|
||||
* or relative to an include path.
|
||||
* @param options.keepCase Preserve field names. The default is to change them
|
||||
* to camel case.
|
||||
* @param options.longs The type that should be used to represent `long` values.
|
||||
* Valid options are `Number` and `String`. Defaults to a `Long` object type
|
||||
* from a library.
|
||||
* @param options.enums The type that should be used to represent `enum` values.
|
||||
* The only valid option is `String`. Defaults to the numeric value.
|
||||
* @param options.bytes The type that should be used to represent `bytes`
|
||||
* values. Valid options are `Array` and `String`. The default is to use
|
||||
* `Buffer`.
|
||||
* @param options.defaults Set default values on output objects. Defaults to
|
||||
* `false`.
|
||||
* @param options.arrays Set empty arrays for missing array values even if
|
||||
* `defaults` is `false`. Defaults to `false`.
|
||||
* @param options.objects Set empty objects for missing object values even if
|
||||
* `defaults` is `false`. Defaults to `false`.
|
||||
* @param options.oneofs Set virtual oneof properties to the present field's
|
||||
* name
|
||||
* @param options.json Represent Infinity and NaN as strings in float fields,
|
||||
* and automatically decode google.protobuf.Any values.
|
||||
* @param options.includeDirs Paths to search for imported `.proto` files.
|
||||
*/
|
||||
export declare function load(filename: string | string[], options?: Options): Promise<PackageDefinition>;
|
||||
export declare function loadSync(filename: string | string[], options?: Options): PackageDefinition;
|
||||
export declare function fromJSON(json: Protobuf.INamespace, options?: Options): PackageDefinition;
|
||||
export declare function loadFileDescriptorSetFromBuffer(descriptorSet: Buffer, options?: Options): PackageDefinition;
|
||||
export declare function loadFileDescriptorSetFromObject(descriptorSet: Parameters<typeof descriptor.FileDescriptorSet.fromObject>[0], options?: Options): PackageDefinition;
|
||||
244
node_modules/@grpc/proto-loader/build/src/index.js
generated
vendored
Normal file
244
node_modules/@grpc/proto-loader/build/src/index.js
generated
vendored
Normal file
@@ -0,0 +1,244 @@
|
||||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2018 gRPC authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.loadFileDescriptorSetFromObject = exports.loadFileDescriptorSetFromBuffer = exports.fromJSON = exports.loadSync = exports.load = exports.IdempotencyLevel = exports.isAnyExtension = exports.Long = void 0;
|
||||
const camelCase = require("lodash.camelcase");
|
||||
const Protobuf = require("protobufjs");
|
||||
const descriptor = require("protobufjs/ext/descriptor");
|
||||
const util_1 = require("./util");
|
||||
const Long = require("long");
|
||||
exports.Long = Long;
|
||||
function isAnyExtension(obj) {
|
||||
return ('@type' in obj) && (typeof obj['@type'] === 'string');
|
||||
}
|
||||
exports.isAnyExtension = isAnyExtension;
|
||||
var IdempotencyLevel;
|
||||
(function (IdempotencyLevel) {
|
||||
IdempotencyLevel["IDEMPOTENCY_UNKNOWN"] = "IDEMPOTENCY_UNKNOWN";
|
||||
IdempotencyLevel["NO_SIDE_EFFECTS"] = "NO_SIDE_EFFECTS";
|
||||
IdempotencyLevel["IDEMPOTENT"] = "IDEMPOTENT";
|
||||
})(IdempotencyLevel = exports.IdempotencyLevel || (exports.IdempotencyLevel = {}));
|
||||
const descriptorOptions = {
|
||||
longs: String,
|
||||
enums: String,
|
||||
bytes: String,
|
||||
defaults: true,
|
||||
oneofs: true,
|
||||
json: true,
|
||||
};
|
||||
function joinName(baseName, name) {
|
||||
if (baseName === '') {
|
||||
return name;
|
||||
}
|
||||
else {
|
||||
return baseName + '.' + name;
|
||||
}
|
||||
}
|
||||
function isHandledReflectionObject(obj) {
|
||||
return (obj instanceof Protobuf.Service ||
|
||||
obj instanceof Protobuf.Type ||
|
||||
obj instanceof Protobuf.Enum);
|
||||
}
|
||||
function isNamespaceBase(obj) {
|
||||
return obj instanceof Protobuf.Namespace || obj instanceof Protobuf.Root;
|
||||
}
|
||||
function getAllHandledReflectionObjects(obj, parentName) {
|
||||
const objName = joinName(parentName, obj.name);
|
||||
if (isHandledReflectionObject(obj)) {
|
||||
return [[objName, obj]];
|
||||
}
|
||||
else {
|
||||
if (isNamespaceBase(obj) && typeof obj.nested !== 'undefined') {
|
||||
return Object.keys(obj.nested)
|
||||
.map(name => {
|
||||
return getAllHandledReflectionObjects(obj.nested[name], objName);
|
||||
})
|
||||
.reduce((accumulator, currentValue) => accumulator.concat(currentValue), []);
|
||||
}
|
||||
}
|
||||
return [];
|
||||
}
|
||||
function createDeserializer(cls, options) {
|
||||
return function deserialize(argBuf) {
|
||||
return cls.toObject(cls.decode(argBuf), options);
|
||||
};
|
||||
}
|
||||
function createSerializer(cls) {
|
||||
return function serialize(arg) {
|
||||
if (Array.isArray(arg)) {
|
||||
throw new Error(`Failed to serialize message: expected object with ${cls.name} structure, got array instead`);
|
||||
}
|
||||
const message = cls.fromObject(arg);
|
||||
return cls.encode(message).finish();
|
||||
};
|
||||
}
|
||||
function mapMethodOptions(options) {
|
||||
return (options || []).reduce((obj, item) => {
|
||||
for (const [key, value] of Object.entries(item)) {
|
||||
switch (key) {
|
||||
case 'uninterpreted_option':
|
||||
obj.uninterpreted_option.push(item.uninterpreted_option);
|
||||
break;
|
||||
default:
|
||||
obj[key] = value;
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
}, {
|
||||
deprecated: false,
|
||||
idempotency_level: IdempotencyLevel.IDEMPOTENCY_UNKNOWN,
|
||||
uninterpreted_option: [],
|
||||
});
|
||||
}
|
||||
function createMethodDefinition(method, serviceName, options, fileDescriptors) {
|
||||
/* This is only ever called after the corresponding root.resolveAll(), so we
|
||||
* can assume that the resolved request and response types are non-null */
|
||||
const requestType = method.resolvedRequestType;
|
||||
const responseType = method.resolvedResponseType;
|
||||
return {
|
||||
path: '/' + serviceName + '/' + method.name,
|
||||
requestStream: !!method.requestStream,
|
||||
responseStream: !!method.responseStream,
|
||||
requestSerialize: createSerializer(requestType),
|
||||
requestDeserialize: createDeserializer(requestType, options),
|
||||
responseSerialize: createSerializer(responseType),
|
||||
responseDeserialize: createDeserializer(responseType, options),
|
||||
// TODO(murgatroid99): Find a better way to handle this
|
||||
originalName: camelCase(method.name),
|
||||
requestType: createMessageDefinition(requestType, fileDescriptors),
|
||||
responseType: createMessageDefinition(responseType, fileDescriptors),
|
||||
options: mapMethodOptions(method.parsedOptions),
|
||||
};
|
||||
}
|
||||
function createServiceDefinition(service, name, options, fileDescriptors) {
|
||||
const def = {};
|
||||
for (const method of service.methodsArray) {
|
||||
def[method.name] = createMethodDefinition(method, name, options, fileDescriptors);
|
||||
}
|
||||
return def;
|
||||
}
|
||||
function createMessageDefinition(message, fileDescriptors) {
|
||||
const messageDescriptor = message.toDescriptor('proto3');
|
||||
return {
|
||||
format: 'Protocol Buffer 3 DescriptorProto',
|
||||
type: messageDescriptor.$type.toObject(messageDescriptor, descriptorOptions),
|
||||
fileDescriptorProtos: fileDescriptors,
|
||||
};
|
||||
}
|
||||
function createEnumDefinition(enumType, fileDescriptors) {
|
||||
const enumDescriptor = enumType.toDescriptor('proto3');
|
||||
return {
|
||||
format: 'Protocol Buffer 3 EnumDescriptorProto',
|
||||
type: enumDescriptor.$type.toObject(enumDescriptor, descriptorOptions),
|
||||
fileDescriptorProtos: fileDescriptors,
|
||||
};
|
||||
}
|
||||
/**
|
||||
* function createDefinition(obj: Protobuf.Service, name: string, options:
|
||||
* Options): ServiceDefinition; function createDefinition(obj: Protobuf.Type,
|
||||
* name: string, options: Options): MessageTypeDefinition; function
|
||||
* createDefinition(obj: Protobuf.Enum, name: string, options: Options):
|
||||
* EnumTypeDefinition;
|
||||
*/
|
||||
function createDefinition(obj, name, options, fileDescriptors) {
|
||||
if (obj instanceof Protobuf.Service) {
|
||||
return createServiceDefinition(obj, name, options, fileDescriptors);
|
||||
}
|
||||
else if (obj instanceof Protobuf.Type) {
|
||||
return createMessageDefinition(obj, fileDescriptors);
|
||||
}
|
||||
else if (obj instanceof Protobuf.Enum) {
|
||||
return createEnumDefinition(obj, fileDescriptors);
|
||||
}
|
||||
else {
|
||||
throw new Error('Type mismatch in reflection object handling');
|
||||
}
|
||||
}
|
||||
function createPackageDefinition(root, options) {
|
||||
const def = {};
|
||||
root.resolveAll();
|
||||
const descriptorList = root.toDescriptor('proto3').file;
|
||||
const bufferList = descriptorList.map(value => Buffer.from(descriptor.FileDescriptorProto.encode(value).finish()));
|
||||
for (const [name, obj] of getAllHandledReflectionObjects(root, '')) {
|
||||
def[name] = createDefinition(obj, name, options, bufferList);
|
||||
}
|
||||
return def;
|
||||
}
|
||||
function createPackageDefinitionFromDescriptorSet(decodedDescriptorSet, options) {
|
||||
options = options || {};
|
||||
const root = Protobuf.Root.fromDescriptor(decodedDescriptorSet);
|
||||
root.resolveAll();
|
||||
return createPackageDefinition(root, options);
|
||||
}
|
||||
/**
|
||||
* Load a .proto file with the specified options.
|
||||
* @param filename One or multiple file paths to load. Can be an absolute path
|
||||
* or relative to an include path.
|
||||
* @param options.keepCase Preserve field names. The default is to change them
|
||||
* to camel case.
|
||||
* @param options.longs The type that should be used to represent `long` values.
|
||||
* Valid options are `Number` and `String`. Defaults to a `Long` object type
|
||||
* from a library.
|
||||
* @param options.enums The type that should be used to represent `enum` values.
|
||||
* The only valid option is `String`. Defaults to the numeric value.
|
||||
* @param options.bytes The type that should be used to represent `bytes`
|
||||
* values. Valid options are `Array` and `String`. The default is to use
|
||||
* `Buffer`.
|
||||
* @param options.defaults Set default values on output objects. Defaults to
|
||||
* `false`.
|
||||
* @param options.arrays Set empty arrays for missing array values even if
|
||||
* `defaults` is `false`. Defaults to `false`.
|
||||
* @param options.objects Set empty objects for missing object values even if
|
||||
* `defaults` is `false`. Defaults to `false`.
|
||||
* @param options.oneofs Set virtual oneof properties to the present field's
|
||||
* name
|
||||
* @param options.json Represent Infinity and NaN as strings in float fields,
|
||||
* and automatically decode google.protobuf.Any values.
|
||||
* @param options.includeDirs Paths to search for imported `.proto` files.
|
||||
*/
|
||||
function load(filename, options) {
|
||||
return (0, util_1.loadProtosWithOptions)(filename, options).then(loadedRoot => {
|
||||
return createPackageDefinition(loadedRoot, options);
|
||||
});
|
||||
}
|
||||
exports.load = load;
|
||||
function loadSync(filename, options) {
|
||||
const loadedRoot = (0, util_1.loadProtosWithOptionsSync)(filename, options);
|
||||
return createPackageDefinition(loadedRoot, options);
|
||||
}
|
||||
exports.loadSync = loadSync;
|
||||
function fromJSON(json, options) {
|
||||
options = options || {};
|
||||
const loadedRoot = Protobuf.Root.fromJSON(json);
|
||||
loadedRoot.resolveAll();
|
||||
return createPackageDefinition(loadedRoot, options);
|
||||
}
|
||||
exports.fromJSON = fromJSON;
|
||||
function loadFileDescriptorSetFromBuffer(descriptorSet, options) {
|
||||
const decodedDescriptorSet = descriptor.FileDescriptorSet.decode(descriptorSet);
|
||||
return createPackageDefinitionFromDescriptorSet(decodedDescriptorSet, options);
|
||||
}
|
||||
exports.loadFileDescriptorSetFromBuffer = loadFileDescriptorSetFromBuffer;
|
||||
function loadFileDescriptorSetFromObject(descriptorSet, options) {
|
||||
const decodedDescriptorSet = descriptor.FileDescriptorSet.fromObject(descriptorSet);
|
||||
return createPackageDefinitionFromDescriptorSet(decodedDescriptorSet, options);
|
||||
}
|
||||
exports.loadFileDescriptorSetFromObject = loadFileDescriptorSetFromObject;
|
||||
(0, util_1.addCommonProtos)();
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/@grpc/proto-loader/build/src/index.js.map
generated
vendored
Normal file
1
node_modules/@grpc/proto-loader/build/src/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
27
node_modules/@grpc/proto-loader/build/src/util.d.ts
generated
vendored
Normal file
27
node_modules/@grpc/proto-loader/build/src/util.d.ts
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2018 gRPC authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
import * as Protobuf from 'protobufjs';
|
||||
export declare type Options = Protobuf.IParseOptions & Protobuf.IConversionOptions & {
|
||||
includeDirs?: string[];
|
||||
};
|
||||
export declare function loadProtosWithOptions(filename: string | string[], options?: Options): Promise<Protobuf.Root>;
|
||||
export declare function loadProtosWithOptionsSync(filename: string | string[], options?: Options): Protobuf.Root;
|
||||
/**
|
||||
* Load Google's well-known proto files that aren't exposed by Protobuf.js.
|
||||
*/
|
||||
export declare function addCommonProtos(): void;
|
||||
89
node_modules/@grpc/proto-loader/build/src/util.js
generated
vendored
Normal file
89
node_modules/@grpc/proto-loader/build/src/util.js
generated
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2018 gRPC authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.addCommonProtos = exports.loadProtosWithOptionsSync = exports.loadProtosWithOptions = void 0;
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const Protobuf = require("protobufjs");
|
||||
function addIncludePathResolver(root, includePaths) {
|
||||
const originalResolvePath = root.resolvePath;
|
||||
root.resolvePath = (origin, target) => {
|
||||
if (path.isAbsolute(target)) {
|
||||
return target;
|
||||
}
|
||||
for (const directory of includePaths) {
|
||||
const fullPath = path.join(directory, target);
|
||||
try {
|
||||
fs.accessSync(fullPath, fs.constants.R_OK);
|
||||
return fullPath;
|
||||
}
|
||||
catch (err) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
process.emitWarning(`${target} not found in any of the include paths ${includePaths}`);
|
||||
return originalResolvePath(origin, target);
|
||||
};
|
||||
}
|
||||
async function loadProtosWithOptions(filename, options) {
|
||||
const root = new Protobuf.Root();
|
||||
options = options || {};
|
||||
if (!!options.includeDirs) {
|
||||
if (!Array.isArray(options.includeDirs)) {
|
||||
return Promise.reject(new Error('The includeDirs option must be an array'));
|
||||
}
|
||||
addIncludePathResolver(root, options.includeDirs);
|
||||
}
|
||||
const loadedRoot = await root.load(filename, options);
|
||||
loadedRoot.resolveAll();
|
||||
return loadedRoot;
|
||||
}
|
||||
exports.loadProtosWithOptions = loadProtosWithOptions;
|
||||
function loadProtosWithOptionsSync(filename, options) {
|
||||
const root = new Protobuf.Root();
|
||||
options = options || {};
|
||||
if (!!options.includeDirs) {
|
||||
if (!Array.isArray(options.includeDirs)) {
|
||||
throw new Error('The includeDirs option must be an array');
|
||||
}
|
||||
addIncludePathResolver(root, options.includeDirs);
|
||||
}
|
||||
const loadedRoot = root.loadSync(filename, options);
|
||||
loadedRoot.resolveAll();
|
||||
return loadedRoot;
|
||||
}
|
||||
exports.loadProtosWithOptionsSync = loadProtosWithOptionsSync;
|
||||
/**
|
||||
* Load Google's well-known proto files that aren't exposed by Protobuf.js.
|
||||
*/
|
||||
function addCommonProtos() {
|
||||
// Protobuf.js exposes: any, duration, empty, field_mask, struct, timestamp,
|
||||
// and wrappers. compiler/plugin is excluded in Protobuf.js and here.
|
||||
// Using constant strings for compatibility with tools like Webpack
|
||||
const apiDescriptor = require('protobufjs/google/protobuf/api.json');
|
||||
const descriptorDescriptor = require('protobufjs/google/protobuf/descriptor.json');
|
||||
const sourceContextDescriptor = require('protobufjs/google/protobuf/source_context.json');
|
||||
const typeDescriptor = require('protobufjs/google/protobuf/type.json');
|
||||
Protobuf.common('api', apiDescriptor.nested.google.nested.protobuf.nested);
|
||||
Protobuf.common('descriptor', descriptorDescriptor.nested.google.nested.protobuf.nested);
|
||||
Protobuf.common('source_context', sourceContextDescriptor.nested.google.nested.protobuf.nested);
|
||||
Protobuf.common('type', typeDescriptor.nested.google.nested.protobuf.nested);
|
||||
}
|
||||
exports.addCommonProtos = addCommonProtos;
|
||||
//# sourceMappingURL=util.js.map
|
||||
1
node_modules/@grpc/proto-loader/build/src/util.js.map
generated
vendored
Normal file
1
node_modules/@grpc/proto-loader/build/src/util.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/util.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;AAEH,yBAAyB;AACzB,6BAA6B;AAC7B,uCAAuC;AAEvC,SAAS,sBAAsB,CAAC,IAAmB,EAAE,YAAsB;IACzE,MAAM,mBAAmB,GAAG,IAAI,CAAC,WAAW,CAAC;IAC7C,IAAI,CAAC,WAAW,GAAG,CAAC,MAAc,EAAE,MAAc,EAAE,EAAE;QACpD,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE;YAC3B,OAAO,MAAM,CAAC;SACf;QACD,KAAK,MAAM,SAAS,IAAI,YAAY,EAAE;YACpC,MAAM,QAAQ,GAAW,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;YACtD,IAAI;gBACF,EAAE,CAAC,UAAU,CAAC,QAAQ,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;gBAC3C,OAAO,QAAQ,CAAC;aACjB;YAAC,OAAO,GAAG,EAAE;gBACZ,SAAS;aACV;SACF;QACD,OAAO,CAAC,WAAW,CAAC,GAAG,MAAM,0CAA0C,YAAY,EAAE,CAAC,CAAC;QACvF,OAAO,mBAAmB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7C,CAAC,CAAC;AACJ,CAAC;AAOM,KAAK,UAAU,qBAAqB,CACzC,QAA2B,EAC3B,OAAiB;IAEjB,MAAM,IAAI,GAAkB,IAAI,QAAQ,CAAC,IAAI,EAAE,CAAC;IAChD,OAAO,GAAG,OAAO,IAAI,EAAE,CAAC;IACxB,IAAI,CAAC,CAAC,OAAO,CAAC,WAAW,EAAE;QACzB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE;YACvC,OAAO,OAAO,CAAC,MAAM,CACnB,IAAI,KAAK,CAAC,yCAAyC,CAAC,CACrD,CAAC;SACH;QACD,sBAAsB,CAAC,IAAI,EAAE,OAAO,CAAC,WAAuB,CAAC,CAAC;KAC/D;IACD,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACtD,UAAU,CAAC,UAAU,EAAE,CAAC;IACxB,OAAO,UAAU,CAAC;AACpB,CAAC;AAjBD,sDAiBC;AAED,SAAgB,yBAAyB,CACvC,QAA2B,EAC3B,OAAiB;IAEjB,MAAM,IAAI,GAAkB,IAAI,QAAQ,CAAC,IAAI,EAAE,CAAC;IAChD,OAAO,GAAG,OAAO,IAAI,EAAE,CAAC;IACxB,IAAI,CAAC,CAAC,OAAO,CAAC,WAAW,EAAE;QACzB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE;YACvC,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;SAC5D;QACD,sBAAsB,CAAC,IAAI,EAAE,OAAO,CAAC,WAAuB,CAAC,CAAC;KAC/D;IACD,MAAM,UAAU,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACpD,UAAU,CAAC,UAAU,EAAE,CAAC;IACxB,OAAO,UAAU,CAAC;AACpB,CAAC;AAfD,8DAeC;AAED;;GAEG;AACH,SAAgB,eAAe;IAC7B,4EAA4E;IAC5E,qEAAqE;IAErE,mEAAmE;IACnE,MAAM,aAAa,GAAG,OAAO,CAAC,qCAAqC,CAAC,CAAC;IACrE,MAAM,oBAAoB,GAAG,OAAO,CAAC,4CAA4C,CAAC,CAAC;IACnF,MAAM,uBAAuB,GAAG,OAAO,CAAC,gDAAgD,CAAC,CAAC;IAC1F,MAAM,cAAc,GAAG,OAAO,CAAC,sCAAsC,CAAC,CAAC;IAEvE,QAAQ,CAAC,MAAM,CACb,KAAK,EACL,aAAa,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CACnD,CAAC;IACF,QAAQ,CAAC,MAAM,CACb,YAAY,EACZ,oBAAoB,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAC1D,CAAC;IACF,QAAQ,CAAC,MAAM,CACb,gBAAgB,EAChB,uBAAuB,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAC7D,CAAC;IACF,QAAQ,CAAC,MAAM,CACb,MAAM,EACN,cAAc,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CACpD,CAAC;AACJ,CAAC;AA1BD,0CA0BC"}
|
||||
139
node_modules/@grpc/proto-loader/node_modules/cliui/CHANGELOG.md
generated
vendored
Normal file
139
node_modules/@grpc/proto-loader/node_modules/cliui/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,139 @@
|
||||
# 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.
|
||||
|
||||
## [8.0.1](https://github.com/yargs/cliui/compare/v8.0.0...v8.0.1) (2022-10-01)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **deps:** move rollup-plugin-ts to dev deps ([#124](https://github.com/yargs/cliui/issues/124)) ([7c8bd6b](https://github.com/yargs/cliui/commit/7c8bd6ba024d61e4eeae310c7959ab8ab6829081))
|
||||
|
||||
## [8.0.0](https://github.com/yargs/cliui/compare/v7.0.4...v8.0.0) (2022-09-30)
|
||||
|
||||
|
||||
### ⚠ BREAKING CHANGES
|
||||
|
||||
* **deps:** drop Node 10 to release CVE-2021-3807 patch (#122)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **deps:** drop Node 10 to release CVE-2021-3807 patch ([#122](https://github.com/yargs/cliui/issues/122)) ([f156571](https://github.com/yargs/cliui/commit/f156571ce4f2ebf313335e3a53ad905589da5a30))
|
||||
|
||||
### [7.0.4](https://www.github.com/yargs/cliui/compare/v7.0.3...v7.0.4) (2020-11-08)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **deno:** import UIOptions from definitions ([#97](https://www.github.com/yargs/cliui/issues/97)) ([f04f343](https://www.github.com/yargs/cliui/commit/f04f3439bc78114c7e90f82ff56f5acf16268ea8))
|
||||
|
||||
### [7.0.3](https://www.github.com/yargs/cliui/compare/v7.0.2...v7.0.3) (2020-10-16)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **exports:** node 13.0 and 13.1 require the dotted object form _with_ a string fallback ([#93](https://www.github.com/yargs/cliui/issues/93)) ([eca16fc](https://www.github.com/yargs/cliui/commit/eca16fc05d26255df3280906c36d7f0e5b05c6e9))
|
||||
|
||||
### [7.0.2](https://www.github.com/yargs/cliui/compare/v7.0.1...v7.0.2) (2020-10-14)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **exports:** node 13.0-13.6 require a string fallback ([#91](https://www.github.com/yargs/cliui/issues/91)) ([b529d7e](https://www.github.com/yargs/cliui/commit/b529d7e432901af1af7848b23ed6cf634497d961))
|
||||
|
||||
### [7.0.1](https://www.github.com/yargs/cliui/compare/v7.0.0...v7.0.1) (2020-08-16)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **build:** main should be build/index.cjs ([dc29a3c](https://www.github.com/yargs/cliui/commit/dc29a3cc617a410aa850e06337b5954b04f2cb4d))
|
||||
|
||||
## [7.0.0](https://www.github.com/yargs/cliui/compare/v6.0.0...v7.0.0) (2020-08-16)
|
||||
|
||||
|
||||
### ⚠ BREAKING CHANGES
|
||||
|
||||
* tsc/ESM/Deno support (#82)
|
||||
* modernize deps and build (#80)
|
||||
|
||||
### Build System
|
||||
|
||||
* modernize deps and build ([#80](https://www.github.com/yargs/cliui/issues/80)) ([339d08d](https://www.github.com/yargs/cliui/commit/339d08dc71b15a3928aeab09042af94db2f43743))
|
||||
|
||||
|
||||
### Code Refactoring
|
||||
|
||||
* tsc/ESM/Deno support ([#82](https://www.github.com/yargs/cliui/issues/82)) ([4b777a5](https://www.github.com/yargs/cliui/commit/4b777a5fe01c5d8958c6708695d6aab7dbe5706c))
|
||||
|
||||
## [6.0.0](https://www.github.com/yargs/cliui/compare/v5.0.0...v6.0.0) (2019-11-10)
|
||||
|
||||
|
||||
### ⚠ BREAKING CHANGES
|
||||
|
||||
* update deps, drop Node 6
|
||||
|
||||
### Code Refactoring
|
||||
|
||||
* update deps, drop Node 6 ([62056df](https://www.github.com/yargs/cliui/commit/62056df))
|
||||
|
||||
## [5.0.0](https://github.com/yargs/cliui/compare/v4.1.0...v5.0.0) (2019-04-10)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Update wrap-ansi to fix compatibility with latest versions of chalk. ([#60](https://github.com/yargs/cliui/issues/60)) ([7bf79ae](https://github.com/yargs/cliui/commit/7bf79ae))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* Drop support for node < 6.
|
||||
|
||||
|
||||
|
||||
<a name="4.1.0"></a>
|
||||
## [4.1.0](https://github.com/yargs/cliui/compare/v4.0.0...v4.1.0) (2018-04-23)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add resetOutput method ([#57](https://github.com/yargs/cliui/issues/57)) ([7246902](https://github.com/yargs/cliui/commit/7246902))
|
||||
|
||||
|
||||
|
||||
<a name="4.0.0"></a>
|
||||
## [4.0.0](https://github.com/yargs/cliui/compare/v3.2.0...v4.0.0) (2017-12-18)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* downgrades strip-ansi to version 3.0.1 ([#54](https://github.com/yargs/cliui/issues/54)) ([5764c46](https://github.com/yargs/cliui/commit/5764c46))
|
||||
* set env variable FORCE_COLOR. ([#56](https://github.com/yargs/cliui/issues/56)) ([7350e36](https://github.com/yargs/cliui/commit/7350e36))
|
||||
|
||||
|
||||
### Chores
|
||||
|
||||
* drop support for node < 4 ([#53](https://github.com/yargs/cliui/issues/53)) ([b105376](https://github.com/yargs/cliui/commit/b105376))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add fallback for window width ([#45](https://github.com/yargs/cliui/issues/45)) ([d064922](https://github.com/yargs/cliui/commit/d064922))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* officially drop support for Node < 4
|
||||
|
||||
|
||||
|
||||
<a name="3.2.0"></a>
|
||||
## [3.2.0](https://github.com/yargs/cliui/compare/v3.1.2...v3.2.0) (2016-04-11)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* reduces tarball size ([acc6c33](https://github.com/yargs/cliui/commit/acc6c33))
|
||||
|
||||
### Features
|
||||
|
||||
* adds standard-version for release management ([ff84e32](https://github.com/yargs/cliui/commit/ff84e32))
|
||||
14
node_modules/@grpc/proto-loader/node_modules/cliui/LICENSE.txt
generated
vendored
Normal file
14
node_modules/@grpc/proto-loader/node_modules/cliui/LICENSE.txt
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
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.
|
||||
141
node_modules/@grpc/proto-loader/node_modules/cliui/README.md
generated
vendored
Normal file
141
node_modules/@grpc/proto-loader/node_modules/cliui/README.md
generated
vendored
Normal file
@@ -0,0 +1,141 @@
|
||||
# cliui
|
||||
|
||||

|
||||
[](https://www.npmjs.com/package/cliui)
|
||||
[](https://conventionalcommits.org)
|
||||

|
||||
|
||||
easily create complex multi-column command-line-interfaces.
|
||||
|
||||
## Example
|
||||
|
||||
```js
|
||||
const ui = require('cliui')()
|
||||
|
||||
ui.div('Usage: $0 [command] [options]')
|
||||
|
||||
ui.div({
|
||||
text: 'Options:',
|
||||
padding: [2, 0, 1, 0]
|
||||
})
|
||||
|
||||
ui.div(
|
||||
{
|
||||
text: "-f, --file",
|
||||
width: 20,
|
||||
padding: [0, 4, 0, 4]
|
||||
},
|
||||
{
|
||||
text: "the file to load." +
|
||||
chalk.green("(if this description is long it wraps).")
|
||||
,
|
||||
width: 20
|
||||
},
|
||||
{
|
||||
text: chalk.red("[required]"),
|
||||
align: 'right'
|
||||
}
|
||||
)
|
||||
|
||||
console.log(ui.toString())
|
||||
```
|
||||
|
||||
## Deno/ESM Support
|
||||
|
||||
As of `v7` `cliui` supports [Deno](https://github.com/denoland/deno) and
|
||||
[ESM](https://nodejs.org/api/esm.html#esm_ecmascript_modules):
|
||||
|
||||
```typescript
|
||||
import cliui from "https://deno.land/x/cliui/deno.ts";
|
||||
|
||||
const ui = cliui({})
|
||||
|
||||
ui.div('Usage: $0 [command] [options]')
|
||||
|
||||
ui.div({
|
||||
text: 'Options:',
|
||||
padding: [2, 0, 1, 0]
|
||||
})
|
||||
|
||||
ui.div({
|
||||
text: "-f, --file",
|
||||
width: 20,
|
||||
padding: [0, 4, 0, 4]
|
||||
})
|
||||
|
||||
console.log(ui.toString())
|
||||
```
|
||||
|
||||
<img width="500" src="screenshot.png">
|
||||
|
||||
## Layout DSL
|
||||
|
||||
cliui exposes a simple layout DSL:
|
||||
|
||||
If you create a single `ui.div`, passing a string rather than an
|
||||
object:
|
||||
|
||||
* `\n`: characters will be interpreted as new rows.
|
||||
* `\t`: characters will be interpreted as new columns.
|
||||
* `\s`: characters will be interpreted as padding.
|
||||
|
||||
**as an example...**
|
||||
|
||||
```js
|
||||
var ui = require('./')({
|
||||
width: 60
|
||||
})
|
||||
|
||||
ui.div(
|
||||
'Usage: node ./bin/foo.js\n' +
|
||||
' <regex>\t provide a regex\n' +
|
||||
' <glob>\t provide a glob\t [required]'
|
||||
)
|
||||
|
||||
console.log(ui.toString())
|
||||
```
|
||||
|
||||
**will output:**
|
||||
|
||||
```shell
|
||||
Usage: node ./bin/foo.js
|
||||
<regex> provide a regex
|
||||
<glob> provide a glob [required]
|
||||
```
|
||||
|
||||
## Methods
|
||||
|
||||
```js
|
||||
cliui = require('cliui')
|
||||
```
|
||||
|
||||
### cliui({width: integer})
|
||||
|
||||
Specify the maximum width of the UI being generated.
|
||||
If no width is provided, cliui will try to get the current window's width and use it, and if that doesn't work, width will be set to `80`.
|
||||
|
||||
### cliui({wrap: boolean})
|
||||
|
||||
Enable or disable the wrapping of text in a column.
|
||||
|
||||
### cliui.div(column, column, column)
|
||||
|
||||
Create a row with any number of columns, a column
|
||||
can either be a string, or an object with the following
|
||||
options:
|
||||
|
||||
* **text:** some text to place in the column.
|
||||
* **width:** the width of a column.
|
||||
* **align:** alignment, `right` or `center`.
|
||||
* **padding:** `[top, right, bottom, left]`.
|
||||
* **border:** should a border be placed around the div?
|
||||
|
||||
### cliui.span(column, column, column)
|
||||
|
||||
Similar to `div`, except the next row will be appended without
|
||||
a new line being created.
|
||||
|
||||
### cliui.resetOutput()
|
||||
|
||||
Resets the UI elements of the current cliui instance, maintaining the values
|
||||
set for `width` and `wrap`.
|
||||
302
node_modules/@grpc/proto-loader/node_modules/cliui/build/index.cjs
generated
vendored
Normal file
302
node_modules/@grpc/proto-loader/node_modules/cliui/build/index.cjs
generated
vendored
Normal file
@@ -0,0 +1,302 @@
|
||||
'use strict';
|
||||
|
||||
const align = {
|
||||
right: alignRight,
|
||||
center: alignCenter
|
||||
};
|
||||
const top = 0;
|
||||
const right = 1;
|
||||
const bottom = 2;
|
||||
const left = 3;
|
||||
class UI {
|
||||
constructor(opts) {
|
||||
var _a;
|
||||
this.width = opts.width;
|
||||
this.wrap = (_a = opts.wrap) !== null && _a !== void 0 ? _a : true;
|
||||
this.rows = [];
|
||||
}
|
||||
span(...args) {
|
||||
const cols = this.div(...args);
|
||||
cols.span = true;
|
||||
}
|
||||
resetOutput() {
|
||||
this.rows = [];
|
||||
}
|
||||
div(...args) {
|
||||
if (args.length === 0) {
|
||||
this.div('');
|
||||
}
|
||||
if (this.wrap && this.shouldApplyLayoutDSL(...args) && typeof args[0] === 'string') {
|
||||
return this.applyLayoutDSL(args[0]);
|
||||
}
|
||||
const cols = args.map(arg => {
|
||||
if (typeof arg === 'string') {
|
||||
return this.colFromString(arg);
|
||||
}
|
||||
return arg;
|
||||
});
|
||||
this.rows.push(cols);
|
||||
return cols;
|
||||
}
|
||||
shouldApplyLayoutDSL(...args) {
|
||||
return args.length === 1 && typeof args[0] === 'string' &&
|
||||
/[\t\n]/.test(args[0]);
|
||||
}
|
||||
applyLayoutDSL(str) {
|
||||
const rows = str.split('\n').map(row => row.split('\t'));
|
||||
let leftColumnWidth = 0;
|
||||
// simple heuristic for layout, make sure the
|
||||
// second column lines up along the left-hand.
|
||||
// don't allow the first column to take up more
|
||||
// than 50% of the screen.
|
||||
rows.forEach(columns => {
|
||||
if (columns.length > 1 && mixin.stringWidth(columns[0]) > leftColumnWidth) {
|
||||
leftColumnWidth = Math.min(Math.floor(this.width * 0.5), mixin.stringWidth(columns[0]));
|
||||
}
|
||||
});
|
||||
// generate a table:
|
||||
// replacing ' ' with padding calculations.
|
||||
// using the algorithmically generated width.
|
||||
rows.forEach(columns => {
|
||||
this.div(...columns.map((r, i) => {
|
||||
return {
|
||||
text: r.trim(),
|
||||
padding: this.measurePadding(r),
|
||||
width: (i === 0 && columns.length > 1) ? leftColumnWidth : undefined
|
||||
};
|
||||
}));
|
||||
});
|
||||
return this.rows[this.rows.length - 1];
|
||||
}
|
||||
colFromString(text) {
|
||||
return {
|
||||
text,
|
||||
padding: this.measurePadding(text)
|
||||
};
|
||||
}
|
||||
measurePadding(str) {
|
||||
// measure padding without ansi escape codes
|
||||
const noAnsi = mixin.stripAnsi(str);
|
||||
return [0, noAnsi.match(/\s*$/)[0].length, 0, noAnsi.match(/^\s*/)[0].length];
|
||||
}
|
||||
toString() {
|
||||
const lines = [];
|
||||
this.rows.forEach(row => {
|
||||
this.rowToString(row, lines);
|
||||
});
|
||||
// don't display any lines with the
|
||||
// hidden flag set.
|
||||
return lines
|
||||
.filter(line => !line.hidden)
|
||||
.map(line => line.text)
|
||||
.join('\n');
|
||||
}
|
||||
rowToString(row, lines) {
|
||||
this.rasterize(row).forEach((rrow, r) => {
|
||||
let str = '';
|
||||
rrow.forEach((col, c) => {
|
||||
const { width } = row[c]; // the width with padding.
|
||||
const wrapWidth = this.negatePadding(row[c]); // the width without padding.
|
||||
let ts = col; // temporary string used during alignment/padding.
|
||||
if (wrapWidth > mixin.stringWidth(col)) {
|
||||
ts += ' '.repeat(wrapWidth - mixin.stringWidth(col));
|
||||
}
|
||||
// align the string within its column.
|
||||
if (row[c].align && row[c].align !== 'left' && this.wrap) {
|
||||
const fn = align[row[c].align];
|
||||
ts = fn(ts, wrapWidth);
|
||||
if (mixin.stringWidth(ts) < wrapWidth) {
|
||||
ts += ' '.repeat((width || 0) - mixin.stringWidth(ts) - 1);
|
||||
}
|
||||
}
|
||||
// apply border and padding to string.
|
||||
const padding = row[c].padding || [0, 0, 0, 0];
|
||||
if (padding[left]) {
|
||||
str += ' '.repeat(padding[left]);
|
||||
}
|
||||
str += addBorder(row[c], ts, '| ');
|
||||
str += ts;
|
||||
str += addBorder(row[c], ts, ' |');
|
||||
if (padding[right]) {
|
||||
str += ' '.repeat(padding[right]);
|
||||
}
|
||||
// if prior row is span, try to render the
|
||||
// current row on the prior line.
|
||||
if (r === 0 && lines.length > 0) {
|
||||
str = this.renderInline(str, lines[lines.length - 1]);
|
||||
}
|
||||
});
|
||||
// remove trailing whitespace.
|
||||
lines.push({
|
||||
text: str.replace(/ +$/, ''),
|
||||
span: row.span
|
||||
});
|
||||
});
|
||||
return lines;
|
||||
}
|
||||
// if the full 'source' can render in
|
||||
// the target line, do so.
|
||||
renderInline(source, previousLine) {
|
||||
const match = source.match(/^ */);
|
||||
const leadingWhitespace = match ? match[0].length : 0;
|
||||
const target = previousLine.text;
|
||||
const targetTextWidth = mixin.stringWidth(target.trimRight());
|
||||
if (!previousLine.span) {
|
||||
return source;
|
||||
}
|
||||
// if we're not applying wrapping logic,
|
||||
// just always append to the span.
|
||||
if (!this.wrap) {
|
||||
previousLine.hidden = true;
|
||||
return target + source;
|
||||
}
|
||||
if (leadingWhitespace < targetTextWidth) {
|
||||
return source;
|
||||
}
|
||||
previousLine.hidden = true;
|
||||
return target.trimRight() + ' '.repeat(leadingWhitespace - targetTextWidth) + source.trimLeft();
|
||||
}
|
||||
rasterize(row) {
|
||||
const rrows = [];
|
||||
const widths = this.columnWidths(row);
|
||||
let wrapped;
|
||||
// word wrap all columns, and create
|
||||
// a data-structure that is easy to rasterize.
|
||||
row.forEach((col, c) => {
|
||||
// leave room for left and right padding.
|
||||
col.width = widths[c];
|
||||
if (this.wrap) {
|
||||
wrapped = mixin.wrap(col.text, this.negatePadding(col), { hard: true }).split('\n');
|
||||
}
|
||||
else {
|
||||
wrapped = col.text.split('\n');
|
||||
}
|
||||
if (col.border) {
|
||||
wrapped.unshift('.' + '-'.repeat(this.negatePadding(col) + 2) + '.');
|
||||
wrapped.push("'" + '-'.repeat(this.negatePadding(col) + 2) + "'");
|
||||
}
|
||||
// add top and bottom padding.
|
||||
if (col.padding) {
|
||||
wrapped.unshift(...new Array(col.padding[top] || 0).fill(''));
|
||||
wrapped.push(...new Array(col.padding[bottom] || 0).fill(''));
|
||||
}
|
||||
wrapped.forEach((str, r) => {
|
||||
if (!rrows[r]) {
|
||||
rrows.push([]);
|
||||
}
|
||||
const rrow = rrows[r];
|
||||
for (let i = 0; i < c; i++) {
|
||||
if (rrow[i] === undefined) {
|
||||
rrow.push('');
|
||||
}
|
||||
}
|
||||
rrow.push(str);
|
||||
});
|
||||
});
|
||||
return rrows;
|
||||
}
|
||||
negatePadding(col) {
|
||||
let wrapWidth = col.width || 0;
|
||||
if (col.padding) {
|
||||
wrapWidth -= (col.padding[left] || 0) + (col.padding[right] || 0);
|
||||
}
|
||||
if (col.border) {
|
||||
wrapWidth -= 4;
|
||||
}
|
||||
return wrapWidth;
|
||||
}
|
||||
columnWidths(row) {
|
||||
if (!this.wrap) {
|
||||
return row.map(col => {
|
||||
return col.width || mixin.stringWidth(col.text);
|
||||
});
|
||||
}
|
||||
let unset = row.length;
|
||||
let remainingWidth = this.width;
|
||||
// column widths can be set in config.
|
||||
const widths = row.map(col => {
|
||||
if (col.width) {
|
||||
unset--;
|
||||
remainingWidth -= col.width;
|
||||
return col.width;
|
||||
}
|
||||
return undefined;
|
||||
});
|
||||
// any unset widths should be calculated.
|
||||
const unsetWidth = unset ? Math.floor(remainingWidth / unset) : 0;
|
||||
return widths.map((w, i) => {
|
||||
if (w === undefined) {
|
||||
return Math.max(unsetWidth, _minWidth(row[i]));
|
||||
}
|
||||
return w;
|
||||
});
|
||||
}
|
||||
}
|
||||
function addBorder(col, ts, style) {
|
||||
if (col.border) {
|
||||
if (/[.']-+[.']/.test(ts)) {
|
||||
return '';
|
||||
}
|
||||
if (ts.trim().length !== 0) {
|
||||
return style;
|
||||
}
|
||||
return ' ';
|
||||
}
|
||||
return '';
|
||||
}
|
||||
// calculates the minimum width of
|
||||
// a column, based on padding preferences.
|
||||
function _minWidth(col) {
|
||||
const padding = col.padding || [];
|
||||
const minWidth = 1 + (padding[left] || 0) + (padding[right] || 0);
|
||||
if (col.border) {
|
||||
return minWidth + 4;
|
||||
}
|
||||
return minWidth;
|
||||
}
|
||||
function getWindowWidth() {
|
||||
/* istanbul ignore next: depends on terminal */
|
||||
if (typeof process === 'object' && process.stdout && process.stdout.columns) {
|
||||
return process.stdout.columns;
|
||||
}
|
||||
return 80;
|
||||
}
|
||||
function alignRight(str, width) {
|
||||
str = str.trim();
|
||||
const strWidth = mixin.stringWidth(str);
|
||||
if (strWidth < width) {
|
||||
return ' '.repeat(width - strWidth) + str;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
function alignCenter(str, width) {
|
||||
str = str.trim();
|
||||
const strWidth = mixin.stringWidth(str);
|
||||
/* istanbul ignore next */
|
||||
if (strWidth >= width) {
|
||||
return str;
|
||||
}
|
||||
return ' '.repeat((width - strWidth) >> 1) + str;
|
||||
}
|
||||
let mixin;
|
||||
function cliui(opts, _mixin) {
|
||||
mixin = _mixin;
|
||||
return new UI({
|
||||
width: (opts === null || opts === void 0 ? void 0 : opts.width) || getWindowWidth(),
|
||||
wrap: opts === null || opts === void 0 ? void 0 : opts.wrap
|
||||
});
|
||||
}
|
||||
|
||||
// Bootstrap cliui with CommonJS dependencies:
|
||||
const stringWidth = require('string-width');
|
||||
const stripAnsi = require('strip-ansi');
|
||||
const wrap = require('wrap-ansi');
|
||||
function ui(opts) {
|
||||
return cliui(opts, {
|
||||
stringWidth,
|
||||
stripAnsi,
|
||||
wrap
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = ui;
|
||||
43
node_modules/@grpc/proto-loader/node_modules/cliui/build/index.d.cts
generated
vendored
Normal file
43
node_modules/@grpc/proto-loader/node_modules/cliui/build/index.d.cts
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
interface UIOptions {
|
||||
width: number;
|
||||
wrap?: boolean;
|
||||
rows?: string[];
|
||||
}
|
||||
interface Column {
|
||||
text: string;
|
||||
width?: number;
|
||||
align?: "right" | "left" | "center";
|
||||
padding: number[];
|
||||
border?: boolean;
|
||||
}
|
||||
interface ColumnArray extends Array<Column> {
|
||||
span: boolean;
|
||||
}
|
||||
interface Line {
|
||||
hidden?: boolean;
|
||||
text: string;
|
||||
span?: boolean;
|
||||
}
|
||||
declare class UI {
|
||||
width: number;
|
||||
wrap: boolean;
|
||||
rows: ColumnArray[];
|
||||
constructor(opts: UIOptions);
|
||||
span(...args: ColumnArray): void;
|
||||
resetOutput(): void;
|
||||
div(...args: (Column | string)[]): ColumnArray;
|
||||
private shouldApplyLayoutDSL;
|
||||
private applyLayoutDSL;
|
||||
private colFromString;
|
||||
private measurePadding;
|
||||
toString(): string;
|
||||
rowToString(row: ColumnArray, lines: Line[]): Line[];
|
||||
// if the full 'source' can render in
|
||||
// the target line, do so.
|
||||
private renderInline;
|
||||
private rasterize;
|
||||
private negatePadding;
|
||||
private columnWidths;
|
||||
}
|
||||
declare function ui(opts: UIOptions): UI;
|
||||
export { ui as default };
|
||||
287
node_modules/@grpc/proto-loader/node_modules/cliui/build/lib/index.js
generated
vendored
Normal file
287
node_modules/@grpc/proto-loader/node_modules/cliui/build/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,287 @@
|
||||
'use strict';
|
||||
const align = {
|
||||
right: alignRight,
|
||||
center: alignCenter
|
||||
};
|
||||
const top = 0;
|
||||
const right = 1;
|
||||
const bottom = 2;
|
||||
const left = 3;
|
||||
export class UI {
|
||||
constructor(opts) {
|
||||
var _a;
|
||||
this.width = opts.width;
|
||||
this.wrap = (_a = opts.wrap) !== null && _a !== void 0 ? _a : true;
|
||||
this.rows = [];
|
||||
}
|
||||
span(...args) {
|
||||
const cols = this.div(...args);
|
||||
cols.span = true;
|
||||
}
|
||||
resetOutput() {
|
||||
this.rows = [];
|
||||
}
|
||||
div(...args) {
|
||||
if (args.length === 0) {
|
||||
this.div('');
|
||||
}
|
||||
if (this.wrap && this.shouldApplyLayoutDSL(...args) && typeof args[0] === 'string') {
|
||||
return this.applyLayoutDSL(args[0]);
|
||||
}
|
||||
const cols = args.map(arg => {
|
||||
if (typeof arg === 'string') {
|
||||
return this.colFromString(arg);
|
||||
}
|
||||
return arg;
|
||||
});
|
||||
this.rows.push(cols);
|
||||
return cols;
|
||||
}
|
||||
shouldApplyLayoutDSL(...args) {
|
||||
return args.length === 1 && typeof args[0] === 'string' &&
|
||||
/[\t\n]/.test(args[0]);
|
||||
}
|
||||
applyLayoutDSL(str) {
|
||||
const rows = str.split('\n').map(row => row.split('\t'));
|
||||
let leftColumnWidth = 0;
|
||||
// simple heuristic for layout, make sure the
|
||||
// second column lines up along the left-hand.
|
||||
// don't allow the first column to take up more
|
||||
// than 50% of the screen.
|
||||
rows.forEach(columns => {
|
||||
if (columns.length > 1 && mixin.stringWidth(columns[0]) > leftColumnWidth) {
|
||||
leftColumnWidth = Math.min(Math.floor(this.width * 0.5), mixin.stringWidth(columns[0]));
|
||||
}
|
||||
});
|
||||
// generate a table:
|
||||
// replacing ' ' with padding calculations.
|
||||
// using the algorithmically generated width.
|
||||
rows.forEach(columns => {
|
||||
this.div(...columns.map((r, i) => {
|
||||
return {
|
||||
text: r.trim(),
|
||||
padding: this.measurePadding(r),
|
||||
width: (i === 0 && columns.length > 1) ? leftColumnWidth : undefined
|
||||
};
|
||||
}));
|
||||
});
|
||||
return this.rows[this.rows.length - 1];
|
||||
}
|
||||
colFromString(text) {
|
||||
return {
|
||||
text,
|
||||
padding: this.measurePadding(text)
|
||||
};
|
||||
}
|
||||
measurePadding(str) {
|
||||
// measure padding without ansi escape codes
|
||||
const noAnsi = mixin.stripAnsi(str);
|
||||
return [0, noAnsi.match(/\s*$/)[0].length, 0, noAnsi.match(/^\s*/)[0].length];
|
||||
}
|
||||
toString() {
|
||||
const lines = [];
|
||||
this.rows.forEach(row => {
|
||||
this.rowToString(row, lines);
|
||||
});
|
||||
// don't display any lines with the
|
||||
// hidden flag set.
|
||||
return lines
|
||||
.filter(line => !line.hidden)
|
||||
.map(line => line.text)
|
||||
.join('\n');
|
||||
}
|
||||
rowToString(row, lines) {
|
||||
this.rasterize(row).forEach((rrow, r) => {
|
||||
let str = '';
|
||||
rrow.forEach((col, c) => {
|
||||
const { width } = row[c]; // the width with padding.
|
||||
const wrapWidth = this.negatePadding(row[c]); // the width without padding.
|
||||
let ts = col; // temporary string used during alignment/padding.
|
||||
if (wrapWidth > mixin.stringWidth(col)) {
|
||||
ts += ' '.repeat(wrapWidth - mixin.stringWidth(col));
|
||||
}
|
||||
// align the string within its column.
|
||||
if (row[c].align && row[c].align !== 'left' && this.wrap) {
|
||||
const fn = align[row[c].align];
|
||||
ts = fn(ts, wrapWidth);
|
||||
if (mixin.stringWidth(ts) < wrapWidth) {
|
||||
ts += ' '.repeat((width || 0) - mixin.stringWidth(ts) - 1);
|
||||
}
|
||||
}
|
||||
// apply border and padding to string.
|
||||
const padding = row[c].padding || [0, 0, 0, 0];
|
||||
if (padding[left]) {
|
||||
str += ' '.repeat(padding[left]);
|
||||
}
|
||||
str += addBorder(row[c], ts, '| ');
|
||||
str += ts;
|
||||
str += addBorder(row[c], ts, ' |');
|
||||
if (padding[right]) {
|
||||
str += ' '.repeat(padding[right]);
|
||||
}
|
||||
// if prior row is span, try to render the
|
||||
// current row on the prior line.
|
||||
if (r === 0 && lines.length > 0) {
|
||||
str = this.renderInline(str, lines[lines.length - 1]);
|
||||
}
|
||||
});
|
||||
// remove trailing whitespace.
|
||||
lines.push({
|
||||
text: str.replace(/ +$/, ''),
|
||||
span: row.span
|
||||
});
|
||||
});
|
||||
return lines;
|
||||
}
|
||||
// if the full 'source' can render in
|
||||
// the target line, do so.
|
||||
renderInline(source, previousLine) {
|
||||
const match = source.match(/^ */);
|
||||
const leadingWhitespace = match ? match[0].length : 0;
|
||||
const target = previousLine.text;
|
||||
const targetTextWidth = mixin.stringWidth(target.trimRight());
|
||||
if (!previousLine.span) {
|
||||
return source;
|
||||
}
|
||||
// if we're not applying wrapping logic,
|
||||
// just always append to the span.
|
||||
if (!this.wrap) {
|
||||
previousLine.hidden = true;
|
||||
return target + source;
|
||||
}
|
||||
if (leadingWhitespace < targetTextWidth) {
|
||||
return source;
|
||||
}
|
||||
previousLine.hidden = true;
|
||||
return target.trimRight() + ' '.repeat(leadingWhitespace - targetTextWidth) + source.trimLeft();
|
||||
}
|
||||
rasterize(row) {
|
||||
const rrows = [];
|
||||
const widths = this.columnWidths(row);
|
||||
let wrapped;
|
||||
// word wrap all columns, and create
|
||||
// a data-structure that is easy to rasterize.
|
||||
row.forEach((col, c) => {
|
||||
// leave room for left and right padding.
|
||||
col.width = widths[c];
|
||||
if (this.wrap) {
|
||||
wrapped = mixin.wrap(col.text, this.negatePadding(col), { hard: true }).split('\n');
|
||||
}
|
||||
else {
|
||||
wrapped = col.text.split('\n');
|
||||
}
|
||||
if (col.border) {
|
||||
wrapped.unshift('.' + '-'.repeat(this.negatePadding(col) + 2) + '.');
|
||||
wrapped.push("'" + '-'.repeat(this.negatePadding(col) + 2) + "'");
|
||||
}
|
||||
// add top and bottom padding.
|
||||
if (col.padding) {
|
||||
wrapped.unshift(...new Array(col.padding[top] || 0).fill(''));
|
||||
wrapped.push(...new Array(col.padding[bottom] || 0).fill(''));
|
||||
}
|
||||
wrapped.forEach((str, r) => {
|
||||
if (!rrows[r]) {
|
||||
rrows.push([]);
|
||||
}
|
||||
const rrow = rrows[r];
|
||||
for (let i = 0; i < c; i++) {
|
||||
if (rrow[i] === undefined) {
|
||||
rrow.push('');
|
||||
}
|
||||
}
|
||||
rrow.push(str);
|
||||
});
|
||||
});
|
||||
return rrows;
|
||||
}
|
||||
negatePadding(col) {
|
||||
let wrapWidth = col.width || 0;
|
||||
if (col.padding) {
|
||||
wrapWidth -= (col.padding[left] || 0) + (col.padding[right] || 0);
|
||||
}
|
||||
if (col.border) {
|
||||
wrapWidth -= 4;
|
||||
}
|
||||
return wrapWidth;
|
||||
}
|
||||
columnWidths(row) {
|
||||
if (!this.wrap) {
|
||||
return row.map(col => {
|
||||
return col.width || mixin.stringWidth(col.text);
|
||||
});
|
||||
}
|
||||
let unset = row.length;
|
||||
let remainingWidth = this.width;
|
||||
// column widths can be set in config.
|
||||
const widths = row.map(col => {
|
||||
if (col.width) {
|
||||
unset--;
|
||||
remainingWidth -= col.width;
|
||||
return col.width;
|
||||
}
|
||||
return undefined;
|
||||
});
|
||||
// any unset widths should be calculated.
|
||||
const unsetWidth = unset ? Math.floor(remainingWidth / unset) : 0;
|
||||
return widths.map((w, i) => {
|
||||
if (w === undefined) {
|
||||
return Math.max(unsetWidth, _minWidth(row[i]));
|
||||
}
|
||||
return w;
|
||||
});
|
||||
}
|
||||
}
|
||||
function addBorder(col, ts, style) {
|
||||
if (col.border) {
|
||||
if (/[.']-+[.']/.test(ts)) {
|
||||
return '';
|
||||
}
|
||||
if (ts.trim().length !== 0) {
|
||||
return style;
|
||||
}
|
||||
return ' ';
|
||||
}
|
||||
return '';
|
||||
}
|
||||
// calculates the minimum width of
|
||||
// a column, based on padding preferences.
|
||||
function _minWidth(col) {
|
||||
const padding = col.padding || [];
|
||||
const minWidth = 1 + (padding[left] || 0) + (padding[right] || 0);
|
||||
if (col.border) {
|
||||
return minWidth + 4;
|
||||
}
|
||||
return minWidth;
|
||||
}
|
||||
function getWindowWidth() {
|
||||
/* istanbul ignore next: depends on terminal */
|
||||
if (typeof process === 'object' && process.stdout && process.stdout.columns) {
|
||||
return process.stdout.columns;
|
||||
}
|
||||
return 80;
|
||||
}
|
||||
function alignRight(str, width) {
|
||||
str = str.trim();
|
||||
const strWidth = mixin.stringWidth(str);
|
||||
if (strWidth < width) {
|
||||
return ' '.repeat(width - strWidth) + str;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
function alignCenter(str, width) {
|
||||
str = str.trim();
|
||||
const strWidth = mixin.stringWidth(str);
|
||||
/* istanbul ignore next */
|
||||
if (strWidth >= width) {
|
||||
return str;
|
||||
}
|
||||
return ' '.repeat((width - strWidth) >> 1) + str;
|
||||
}
|
||||
let mixin;
|
||||
export function cliui(opts, _mixin) {
|
||||
mixin = _mixin;
|
||||
return new UI({
|
||||
width: (opts === null || opts === void 0 ? void 0 : opts.width) || getWindowWidth(),
|
||||
wrap: opts === null || opts === void 0 ? void 0 : opts.wrap
|
||||
});
|
||||
}
|
||||
27
node_modules/@grpc/proto-loader/node_modules/cliui/build/lib/string-utils.js
generated
vendored
Normal file
27
node_modules/@grpc/proto-loader/node_modules/cliui/build/lib/string-utils.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
// Minimal replacement for ansi string helpers "wrap-ansi" and "strip-ansi".
|
||||
// to facilitate ESM and Deno modules.
|
||||
// TODO: look at porting https://www.npmjs.com/package/wrap-ansi to ESM.
|
||||
// The npm application
|
||||
// Copyright (c) npm, Inc. and Contributors
|
||||
// Licensed on the terms of The Artistic License 2.0
|
||||
// See: https://github.com/npm/cli/blob/4c65cd952bc8627811735bea76b9b110cc4fc80e/lib/utils/ansi-trim.js
|
||||
const ansi = new RegExp('\x1b(?:\\[(?:\\d+[ABCDEFGJKSTm]|\\d+;\\d+[Hfm]|' +
|
||||
'\\d+;\\d+;\\d+m|6n|s|u|\\?25[lh])|\\w)', 'g');
|
||||
export function stripAnsi(str) {
|
||||
return str.replace(ansi, '');
|
||||
}
|
||||
export function wrap(str, width) {
|
||||
const [start, end] = str.match(ansi) || ['', ''];
|
||||
str = stripAnsi(str);
|
||||
let wrapped = '';
|
||||
for (let i = 0; i < str.length; i++) {
|
||||
if (i !== 0 && (i % width) === 0) {
|
||||
wrapped += '\n';
|
||||
}
|
||||
wrapped += str.charAt(i);
|
||||
}
|
||||
if (start && end) {
|
||||
wrapped = `${start}${wrapped}${end}`;
|
||||
}
|
||||
return wrapped;
|
||||
}
|
||||
13
node_modules/@grpc/proto-loader/node_modules/cliui/index.mjs
generated
vendored
Normal file
13
node_modules/@grpc/proto-loader/node_modules/cliui/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
// Bootstrap cliui with CommonJS dependencies:
|
||||
import { cliui } from './build/lib/index.js'
|
||||
import { wrap, stripAnsi } from './build/lib/string-utils.js'
|
||||
|
||||
export default function ui (opts) {
|
||||
return cliui(opts, {
|
||||
stringWidth: (str) => {
|
||||
return [...str].length
|
||||
},
|
||||
stripAnsi,
|
||||
wrap
|
||||
})
|
||||
}
|
||||
83
node_modules/@grpc/proto-loader/node_modules/cliui/package.json
generated
vendored
Normal file
83
node_modules/@grpc/proto-loader/node_modules/cliui/package.json
generated
vendored
Normal file
@@ -0,0 +1,83 @@
|
||||
{
|
||||
"name": "cliui",
|
||||
"version": "8.0.1",
|
||||
"description": "easily create complex multi-column command-line-interfaces",
|
||||
"main": "build/index.cjs",
|
||||
"exports": {
|
||||
".": [
|
||||
{
|
||||
"import": "./index.mjs",
|
||||
"require": "./build/index.cjs"
|
||||
},
|
||||
"./build/index.cjs"
|
||||
]
|
||||
},
|
||||
"type": "module",
|
||||
"module": "./index.mjs",
|
||||
"scripts": {
|
||||
"check": "standardx '**/*.ts' && standardx '**/*.js' && standardx '**/*.cjs'",
|
||||
"fix": "standardx --fix '**/*.ts' && standardx --fix '**/*.js' && standardx --fix '**/*.cjs'",
|
||||
"pretest": "rimraf build && tsc -p tsconfig.test.json && cross-env NODE_ENV=test npm run build:cjs",
|
||||
"test": "c8 mocha ./test/*.cjs",
|
||||
"test:esm": "c8 mocha ./test/esm/cliui-test.mjs",
|
||||
"postest": "check",
|
||||
"coverage": "c8 report --check-coverage",
|
||||
"precompile": "rimraf build",
|
||||
"compile": "tsc",
|
||||
"postcompile": "npm run build:cjs",
|
||||
"build:cjs": "rollup -c",
|
||||
"prepare": "npm run compile"
|
||||
},
|
||||
"repository": "yargs/cliui",
|
||||
"standard": {
|
||||
"ignore": [
|
||||
"**/example/**"
|
||||
],
|
||||
"globals": [
|
||||
"it"
|
||||
]
|
||||
},
|
||||
"keywords": [
|
||||
"cli",
|
||||
"command-line",
|
||||
"layout",
|
||||
"design",
|
||||
"console",
|
||||
"wrap",
|
||||
"table"
|
||||
],
|
||||
"author": "Ben Coe <ben@npmjs.com>",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"string-width": "^4.2.0",
|
||||
"strip-ansi": "^6.0.1",
|
||||
"wrap-ansi": "^7.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^14.0.27",
|
||||
"@typescript-eslint/eslint-plugin": "^4.0.0",
|
||||
"@typescript-eslint/parser": "^4.0.0",
|
||||
"c8": "^7.3.0",
|
||||
"chai": "^4.2.0",
|
||||
"chalk": "^4.1.0",
|
||||
"cross-env": "^7.0.2",
|
||||
"eslint": "^7.6.0",
|
||||
"eslint-plugin-import": "^2.22.0",
|
||||
"eslint-plugin-node": "^11.1.0",
|
||||
"gts": "^3.0.0",
|
||||
"mocha": "^10.0.0",
|
||||
"rimraf": "^3.0.2",
|
||||
"rollup": "^2.23.1",
|
||||
"rollup-plugin-ts": "^3.0.2",
|
||||
"standardx": "^7.0.0",
|
||||
"typescript": "^4.0.0"
|
||||
},
|
||||
"files": [
|
||||
"build",
|
||||
"index.mjs",
|
||||
"!*.d.ts"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
}
|
||||
216
node_modules/@grpc/proto-loader/node_modules/wrap-ansi/index.js
generated
vendored
Executable file
216
node_modules/@grpc/proto-loader/node_modules/wrap-ansi/index.js
generated
vendored
Executable file
@@ -0,0 +1,216 @@
|
||||
'use strict';
|
||||
const stringWidth = require('string-width');
|
||||
const stripAnsi = require('strip-ansi');
|
||||
const ansiStyles = require('ansi-styles');
|
||||
|
||||
const ESCAPES = new Set([
|
||||
'\u001B',
|
||||
'\u009B'
|
||||
]);
|
||||
|
||||
const END_CODE = 39;
|
||||
|
||||
const ANSI_ESCAPE_BELL = '\u0007';
|
||||
const ANSI_CSI = '[';
|
||||
const ANSI_OSC = ']';
|
||||
const ANSI_SGR_TERMINATOR = 'm';
|
||||
const ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
|
||||
|
||||
const wrapAnsi = code => `${ESCAPES.values().next().value}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
|
||||
const wrapAnsiHyperlink = uri => `${ESCAPES.values().next().value}${ANSI_ESCAPE_LINK}${uri}${ANSI_ESCAPE_BELL}`;
|
||||
|
||||
// Calculate the length of words split on ' ', ignoring
|
||||
// the extra characters added by ansi escape codes
|
||||
const wordLengths = string => string.split(' ').map(character => stringWidth(character));
|
||||
|
||||
// Wrap a long word across multiple rows
|
||||
// Ansi escape codes do not count towards length
|
||||
const wrapWord = (rows, word, columns) => {
|
||||
const characters = [...word];
|
||||
|
||||
let isInsideEscape = false;
|
||||
let isInsideLinkEscape = false;
|
||||
let visible = stringWidth(stripAnsi(rows[rows.length - 1]));
|
||||
|
||||
for (const [index, character] of characters.entries()) {
|
||||
const characterLength = stringWidth(character);
|
||||
|
||||
if (visible + characterLength <= columns) {
|
||||
rows[rows.length - 1] += character;
|
||||
} else {
|
||||
rows.push(character);
|
||||
visible = 0;
|
||||
}
|
||||
|
||||
if (ESCAPES.has(character)) {
|
||||
isInsideEscape = true;
|
||||
isInsideLinkEscape = characters.slice(index + 1).join('').startsWith(ANSI_ESCAPE_LINK);
|
||||
}
|
||||
|
||||
if (isInsideEscape) {
|
||||
if (isInsideLinkEscape) {
|
||||
if (character === ANSI_ESCAPE_BELL) {
|
||||
isInsideEscape = false;
|
||||
isInsideLinkEscape = false;
|
||||
}
|
||||
} else if (character === ANSI_SGR_TERMINATOR) {
|
||||
isInsideEscape = false;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
visible += characterLength;
|
||||
|
||||
if (visible === columns && index < characters.length - 1) {
|
||||
rows.push('');
|
||||
visible = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// It's possible that the last row we copy over is only
|
||||
// ansi escape characters, handle this edge-case
|
||||
if (!visible && rows[rows.length - 1].length > 0 && rows.length > 1) {
|
||||
rows[rows.length - 2] += rows.pop();
|
||||
}
|
||||
};
|
||||
|
||||
// Trims spaces from a string ignoring invisible sequences
|
||||
const stringVisibleTrimSpacesRight = string => {
|
||||
const words = string.split(' ');
|
||||
let last = words.length;
|
||||
|
||||
while (last > 0) {
|
||||
if (stringWidth(words[last - 1]) > 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
last--;
|
||||
}
|
||||
|
||||
if (last === words.length) {
|
||||
return string;
|
||||
}
|
||||
|
||||
return words.slice(0, last).join(' ') + words.slice(last).join('');
|
||||
};
|
||||
|
||||
// The wrap-ansi module can be invoked in either 'hard' or 'soft' wrap mode
|
||||
//
|
||||
// 'hard' will never allow a string to take up more than columns characters
|
||||
//
|
||||
// 'soft' allows long words to expand past the column length
|
||||
const exec = (string, columns, options = {}) => {
|
||||
if (options.trim !== false && string.trim() === '') {
|
||||
return '';
|
||||
}
|
||||
|
||||
let returnValue = '';
|
||||
let escapeCode;
|
||||
let escapeUrl;
|
||||
|
||||
const lengths = wordLengths(string);
|
||||
let rows = [''];
|
||||
|
||||
for (const [index, word] of string.split(' ').entries()) {
|
||||
if (options.trim !== false) {
|
||||
rows[rows.length - 1] = rows[rows.length - 1].trimStart();
|
||||
}
|
||||
|
||||
let rowLength = stringWidth(rows[rows.length - 1]);
|
||||
|
||||
if (index !== 0) {
|
||||
if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
|
||||
// If we start with a new word but the current row length equals the length of the columns, add a new row
|
||||
rows.push('');
|
||||
rowLength = 0;
|
||||
}
|
||||
|
||||
if (rowLength > 0 || options.trim === false) {
|
||||
rows[rows.length - 1] += ' ';
|
||||
rowLength++;
|
||||
}
|
||||
}
|
||||
|
||||
// In 'hard' wrap mode, the length of a line is never allowed to extend past 'columns'
|
||||
if (options.hard && lengths[index] > columns) {
|
||||
const remainingColumns = (columns - rowLength);
|
||||
const breaksStartingThisLine = 1 + Math.floor((lengths[index] - remainingColumns - 1) / columns);
|
||||
const breaksStartingNextLine = Math.floor((lengths[index] - 1) / columns);
|
||||
if (breaksStartingNextLine < breaksStartingThisLine) {
|
||||
rows.push('');
|
||||
}
|
||||
|
||||
wrapWord(rows, word, columns);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (rowLength + lengths[index] > columns && rowLength > 0 && lengths[index] > 0) {
|
||||
if (options.wordWrap === false && rowLength < columns) {
|
||||
wrapWord(rows, word, columns);
|
||||
continue;
|
||||
}
|
||||
|
||||
rows.push('');
|
||||
}
|
||||
|
||||
if (rowLength + lengths[index] > columns && options.wordWrap === false) {
|
||||
wrapWord(rows, word, columns);
|
||||
continue;
|
||||
}
|
||||
|
||||
rows[rows.length - 1] += word;
|
||||
}
|
||||
|
||||
if (options.trim !== false) {
|
||||
rows = rows.map(stringVisibleTrimSpacesRight);
|
||||
}
|
||||
|
||||
const pre = [...rows.join('\n')];
|
||||
|
||||
for (const [index, character] of pre.entries()) {
|
||||
returnValue += character;
|
||||
|
||||
if (ESCAPES.has(character)) {
|
||||
const {groups} = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`).exec(pre.slice(index).join('')) || {groups: {}};
|
||||
if (groups.code !== undefined) {
|
||||
const code = Number.parseFloat(groups.code);
|
||||
escapeCode = code === END_CODE ? undefined : code;
|
||||
} else if (groups.uri !== undefined) {
|
||||
escapeUrl = groups.uri.length === 0 ? undefined : groups.uri;
|
||||
}
|
||||
}
|
||||
|
||||
const code = ansiStyles.codes.get(Number(escapeCode));
|
||||
|
||||
if (pre[index + 1] === '\n') {
|
||||
if (escapeUrl) {
|
||||
returnValue += wrapAnsiHyperlink('');
|
||||
}
|
||||
|
||||
if (escapeCode && code) {
|
||||
returnValue += wrapAnsi(code);
|
||||
}
|
||||
} else if (character === '\n') {
|
||||
if (escapeCode && code) {
|
||||
returnValue += wrapAnsi(escapeCode);
|
||||
}
|
||||
|
||||
if (escapeUrl) {
|
||||
returnValue += wrapAnsiHyperlink(escapeUrl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
};
|
||||
|
||||
// For each newline, invoke the method separately
|
||||
module.exports = (string, columns, options) => {
|
||||
return String(string)
|
||||
.normalize()
|
||||
.replace(/\r\n/g, '\n')
|
||||
.split('\n')
|
||||
.map(line => exec(line, columns, options))
|
||||
.join('\n');
|
||||
};
|
||||
9
node_modules/@grpc/proto-loader/node_modules/wrap-ansi/license
generated
vendored
Normal file
9
node_modules/@grpc/proto-loader/node_modules/wrap-ansi/license
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://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.
|
||||
62
node_modules/@grpc/proto-loader/node_modules/wrap-ansi/package.json
generated
vendored
Normal file
62
node_modules/@grpc/proto-loader/node_modules/wrap-ansi/package.json
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
{
|
||||
"name": "wrap-ansi",
|
||||
"version": "7.0.0",
|
||||
"description": "Wordwrap a string with ANSI escape codes",
|
||||
"license": "MIT",
|
||||
"repository": "chalk/wrap-ansi",
|
||||
"funding": "https://github.com/chalk/wrap-ansi?sponsor=1",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "https://sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && nyc ava"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"wrap",
|
||||
"break",
|
||||
"wordwrap",
|
||||
"wordbreak",
|
||||
"linewrap",
|
||||
"ansi",
|
||||
"styles",
|
||||
"color",
|
||||
"colour",
|
||||
"colors",
|
||||
"terminal",
|
||||
"console",
|
||||
"cli",
|
||||
"string",
|
||||
"tty",
|
||||
"escape",
|
||||
"formatting",
|
||||
"rgb",
|
||||
"256",
|
||||
"shell",
|
||||
"xterm",
|
||||
"log",
|
||||
"logging",
|
||||
"command-line",
|
||||
"text"
|
||||
],
|
||||
"dependencies": {
|
||||
"ansi-styles": "^4.0.0",
|
||||
"string-width": "^4.1.0",
|
||||
"strip-ansi": "^6.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "^2.1.0",
|
||||
"chalk": "^4.0.0",
|
||||
"coveralls": "^3.0.3",
|
||||
"has-ansi": "^4.0.0",
|
||||
"nyc": "^15.0.1",
|
||||
"xo": "^0.29.1"
|
||||
}
|
||||
}
|
||||
91
node_modules/@grpc/proto-loader/node_modules/wrap-ansi/readme.md
generated
vendored
Normal file
91
node_modules/@grpc/proto-loader/node_modules/wrap-ansi/readme.md
generated
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
# wrap-ansi [](https://travis-ci.com/chalk/wrap-ansi) [](https://coveralls.io/github/chalk/wrap-ansi?branch=master)
|
||||
|
||||
> Wordwrap a string with [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles)
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install wrap-ansi
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const chalk = require('chalk');
|
||||
const wrapAnsi = require('wrap-ansi');
|
||||
|
||||
const input = 'The quick brown ' + chalk.red('fox jumped over ') +
|
||||
'the lazy ' + chalk.green('dog and then ran away with the unicorn.');
|
||||
|
||||
console.log(wrapAnsi(input, 20));
|
||||
```
|
||||
|
||||
<img width="331" src="screenshot.png">
|
||||
|
||||
## API
|
||||
|
||||
### wrapAnsi(string, columns, options?)
|
||||
|
||||
Wrap words to the specified column width.
|
||||
|
||||
#### string
|
||||
|
||||
Type: `string`
|
||||
|
||||
String with ANSI escape codes. Like one styled by [`chalk`](https://github.com/chalk/chalk). Newline characters will be normalized to `\n`.
|
||||
|
||||
#### columns
|
||||
|
||||
Type: `number`
|
||||
|
||||
Number of columns to wrap the text to.
|
||||
|
||||
#### options
|
||||
|
||||
Type: `object`
|
||||
|
||||
##### hard
|
||||
|
||||
Type: `boolean`\
|
||||
Default: `false`
|
||||
|
||||
By default the wrap is soft, meaning long words may extend past the column width. Setting this to `true` will make it hard wrap at the column width.
|
||||
|
||||
##### wordWrap
|
||||
|
||||
Type: `boolean`\
|
||||
Default: `true`
|
||||
|
||||
By default, an attempt is made to split words at spaces, ensuring that they don't extend past the configured columns. If wordWrap is `false`, each column will instead be completely filled splitting words as necessary.
|
||||
|
||||
##### trim
|
||||
|
||||
Type: `boolean`\
|
||||
Default: `true`
|
||||
|
||||
Whitespace on all lines is removed by default. Set this option to `false` if you don't want to trim.
|
||||
|
||||
## Related
|
||||
|
||||
- [slice-ansi](https://github.com/chalk/slice-ansi) - Slice a string with ANSI escape codes
|
||||
- [cli-truncate](https://github.com/sindresorhus/cli-truncate) - Truncate a string to a specific width in the terminal
|
||||
- [chalk](https://github.com/chalk/chalk) - Terminal string styling done right
|
||||
- [jsesc](https://github.com/mathiasbynens/jsesc) - Generate ASCII-only output from Unicode strings. Useful for creating test fixtures.
|
||||
|
||||
## Maintainers
|
||||
|
||||
- [Sindre Sorhus](https://github.com/sindresorhus)
|
||||
- [Josh Junon](https://github.com/qix-)
|
||||
- [Benjamin Coe](https://github.com/bcoe)
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<b>
|
||||
<a href="https://tidelift.com/subscription/pkg/npm-wrap_ansi?utm_source=npm-wrap-ansi&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>
|
||||
100
node_modules/@grpc/proto-loader/node_modules/y18n/CHANGELOG.md
generated
vendored
Normal file
100
node_modules/@grpc/proto-loader/node_modules/y18n/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
# 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.8](https://www.github.com/yargs/y18n/compare/v5.0.7...v5.0.8) (2021-04-07)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **deno:** force modern release for Deno ([b1c215a](https://www.github.com/yargs/y18n/commit/b1c215aed714bee5830e76de3e335504dc2c4dab))
|
||||
|
||||
### [5.0.7](https://www.github.com/yargs/y18n/compare/v5.0.6...v5.0.7) (2021-04-07)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **deno:** force release for deno ([#121](https://www.github.com/yargs/y18n/issues/121)) ([d3f2560](https://www.github.com/yargs/y18n/commit/d3f2560e6cedf2bfa2352e9eec044da53f9a06b2))
|
||||
|
||||
### [5.0.6](https://www.github.com/yargs/y18n/compare/v5.0.5...v5.0.6) (2021-04-05)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **webpack:** skip readFileSync if not defined ([#117](https://www.github.com/yargs/y18n/issues/117)) ([6966fa9](https://www.github.com/yargs/y18n/commit/6966fa91d2881cc6a6c531e836099e01f4da1616))
|
||||
|
||||
### [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.1 (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/7de58ca0d315990cdb38234e97fc66254cdbcd71))
|
||||
|
||||
## [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
node_modules/@grpc/proto-loader/node_modules/y18n/LICENSE
generated
vendored
Normal file
13
node_modules/@grpc/proto-loader/node_modules/y18n/LICENSE
generated
vendored
Normal 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
node_modules/@grpc/proto-loader/node_modules/y18n/README.md
generated
vendored
Normal file
127
node_modules/@grpc/proto-loader/node_modules/y18n/README.md
generated
vendored
Normal file
@@ -0,0 +1,127 @@
|
||||
# y18n
|
||||
|
||||
[![NPM version][npm-image]][npm-url]
|
||||
[![js-standard-style][standard-image]][standard-url]
|
||||
[](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>__`hello ${'world'}`</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
|
||||
203
node_modules/@grpc/proto-loader/node_modules/y18n/build/index.cjs
generated
vendored
Normal file
203
node_modules/@grpc/proto-loader/node_modules/y18n/build/index.cjs
generated
vendored
Normal file
@@ -0,0 +1,203 @@
|
||||
'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.
|
||||
const 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) {
|
||||
const 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() {
|
||||
const _this = this;
|
||||
const work = this.writeQueue[0];
|
||||
// destructure the enqueued work.
|
||||
const directory = work.directory;
|
||||
const locale = work.locale;
|
||||
const cb = work.cb;
|
||||
const languageFile = this._resolveLocaleFile(directory, locale);
|
||||
const 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() {
|
||||
let localeLookup = {};
|
||||
const languageFile = this._resolveLocaleFile(this.directory, this.locale);
|
||||
try {
|
||||
// When using a bundler such as webpack, readFileSync may not be defined:
|
||||
if (shim.fs.readFileSync) {
|
||||
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) {
|
||||
let file = shim.resolve(directory, './', locale + '.json');
|
||||
if (this.fallbackToLanguage && !this._fileExistsSync(file) && ~locale.lastIndexOf('_')) {
|
||||
// attempt fallback to language only
|
||||
const languageFile = shim.resolve(directory, './', locale.split('_')[0] + '.json');
|
||||
if (this._fileExistsSync(languageFile))
|
||||
file = languageFile;
|
||||
}
|
||||
return file;
|
||||
}
|
||||
_fileExistsSync(file) {
|
||||
return shim.exists(file);
|
||||
}
|
||||
}
|
||||
function y18n$1(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 = (opts) => {
|
||||
return y18n$1(opts, nodePlatformShim);
|
||||
};
|
||||
|
||||
module.exports = y18n;
|
||||
6
node_modules/@grpc/proto-loader/node_modules/y18n/build/lib/cjs.js
generated
vendored
Normal file
6
node_modules/@grpc/proto-loader/node_modules/y18n/build/lib/cjs.js
generated
vendored
Normal 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;
|
||||
174
node_modules/@grpc/proto-loader/node_modules/y18n/build/lib/index.js
generated
vendored
Normal file
174
node_modules/@grpc/proto-loader/node_modules/y18n/build/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,174 @@
|
||||
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.
|
||||
const 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) {
|
||||
const 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() {
|
||||
const _this = this;
|
||||
const work = this.writeQueue[0];
|
||||
// destructure the enqueued work.
|
||||
const directory = work.directory;
|
||||
const locale = work.locale;
|
||||
const cb = work.cb;
|
||||
const languageFile = this._resolveLocaleFile(directory, locale);
|
||||
const 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() {
|
||||
let localeLookup = {};
|
||||
const languageFile = this._resolveLocaleFile(this.directory, this.locale);
|
||||
try {
|
||||
// When using a bundler such as webpack, readFileSync may not be defined:
|
||||
if (shim.fs.readFileSync) {
|
||||
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) {
|
||||
let file = shim.resolve(directory, './', locale + '.json');
|
||||
if (this.fallbackToLanguage && !this._fileExistsSync(file) && ~locale.lastIndexOf('_')) {
|
||||
// attempt fallback to language only
|
||||
const 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
|
||||
};
|
||||
}
|
||||
19
node_modules/@grpc/proto-loader/node_modules/y18n/build/lib/platform-shims/node.js
generated
vendored
Normal file
19
node_modules/@grpc/proto-loader/node_modules/y18n/build/lib/platform-shims/node.js
generated
vendored
Normal 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
node_modules/@grpc/proto-loader/node_modules/y18n/index.mjs
generated
vendored
Normal file
8
node_modules/@grpc/proto-loader/node_modules/y18n/index.mjs
generated
vendored
Normal 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
|
||||
70
node_modules/@grpc/proto-loader/node_modules/y18n/package.json
generated
vendored
Normal file
70
node_modules/@grpc/proto-loader/node_modules/y18n/package.json
generated
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
{
|
||||
"name": "y18n",
|
||||
"version": "5.0.8",
|
||||
"description": "the bare-bones internationalization library used by yargs",
|
||||
"exports": {
|
||||
".": [
|
||||
{
|
||||
"import": "./index.mjs",
|
||||
"require": "./build/index.cjs"
|
||||
},
|
||||
"./build/index.cjs"
|
||||
]
|
||||
},
|
||||
"type": "module",
|
||||
"module": "./build/lib/index.js",
|
||||
"keywords": [
|
||||
"i18n",
|
||||
"internationalization",
|
||||
"yargs"
|
||||
],
|
||||
"homepage": "https://github.com/yargs/y18n",
|
||||
"bugs": {
|
||||
"url": "https://github.com/yargs/y18n/issues"
|
||||
},
|
||||
"repository": "yargs/y18n",
|
||||
"license": "ISC",
|
||||
"author": "Ben Coe <bencoe@gmail.com>",
|
||||
"main": "./build/index.cjs",
|
||||
"scripts": {
|
||||
"check": "standardx **/*.ts **/*.cjs **/*.mjs",
|
||||
"fix": "standardx --fix **/*.ts **/*.cjs **/*.mjs",
|
||||
"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",
|
||||
"posttest": "npm run check",
|
||||
"coverage": "c8 report --check-coverage",
|
||||
"precompile": "rimraf build",
|
||||
"compile": "tsc",
|
||||
"postcompile": "npm run build:cjs",
|
||||
"build:cjs": "rollup -c",
|
||||
"prepare": "npm run compile"
|
||||
},
|
||||
"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": "^7.0.0",
|
||||
"ts-transform-default-export": "^1.0.2",
|
||||
"typescript": "^4.0.0"
|
||||
},
|
||||
"files": [
|
||||
"build",
|
||||
"index.mjs",
|
||||
"!*.d.ts"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"standardx": {
|
||||
"ignore": [
|
||||
"build"
|
||||
]
|
||||
}
|
||||
}
|
||||
308
node_modules/@grpc/proto-loader/node_modules/yargs-parser/CHANGELOG.md
generated
vendored
Normal file
308
node_modules/@grpc/proto-loader/node_modules/yargs-parser/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,308 @@
|
||||
# Changelog
|
||||
|
||||
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.
|
||||
|
||||
## [21.1.1](https://github.com/yargs/yargs-parser/compare/yargs-parser-v21.1.0...yargs-parser-v21.1.1) (2022-08-04)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **typescript:** ignore .cts files during publish ([#454](https://github.com/yargs/yargs-parser/issues/454)) ([d69f9c3](https://github.com/yargs/yargs-parser/commit/d69f9c3a91c3ad2f9494d0a94e29a8b76c41b81b)), closes [#452](https://github.com/yargs/yargs-parser/issues/452)
|
||||
|
||||
## [21.1.0](https://github.com/yargs/yargs-parser/compare/yargs-parser-v21.0.1...yargs-parser-v21.1.0) (2022-08-03)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* allow the browser build to be imported ([#443](https://github.com/yargs/yargs-parser/issues/443)) ([a89259f](https://github.com/yargs/yargs-parser/commit/a89259ff41d6f5312b3ce8a30bef343a993f395a))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **halt-at-non-option:** prevent known args from being parsed when "unknown-options-as-args" is enabled ([#438](https://github.com/yargs/yargs-parser/issues/438)) ([c474bc1](https://github.com/yargs/yargs-parser/commit/c474bc10c3aa0ae864b95e5722730114ef15f573))
|
||||
* node version check now uses process.versions.node ([#450](https://github.com/yargs/yargs-parser/issues/450)) ([d07bcdb](https://github.com/yargs/yargs-parser/commit/d07bcdbe43075f7201fbe8a08e491217247fe1f1))
|
||||
* parse options ending with 3+ hyphens ([#434](https://github.com/yargs/yargs-parser/issues/434)) ([4f1060b](https://github.com/yargs/yargs-parser/commit/4f1060b50759fadbac3315c5117b0c3d65b0a7d8))
|
||||
|
||||
### [21.0.1](https://github.com/yargs/yargs-parser/compare/yargs-parser-v21.0.0...yargs-parser-v21.0.1) (2022-02-27)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* return deno env object ([#432](https://github.com/yargs/yargs-parser/issues/432)) ([b00eb87](https://github.com/yargs/yargs-parser/commit/b00eb87b4860a890dd2dab0d6058241bbfd2b3ec))
|
||||
|
||||
## [21.0.0](https://www.github.com/yargs/yargs-parser/compare/yargs-parser-v20.2.9...yargs-parser-v21.0.0) (2021-11-15)
|
||||
|
||||
|
||||
### ⚠ BREAKING CHANGES
|
||||
|
||||
* drops support for 10 (#421)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* esm json import ([#416](https://www.github.com/yargs/yargs-parser/issues/416)) ([90f970a](https://www.github.com/yargs/yargs-parser/commit/90f970a6482dd4f5b5eb18d38596dd6f02d73edf))
|
||||
* parser should preserve inner quotes ([#407](https://www.github.com/yargs/yargs-parser/issues/407)) ([ae11f49](https://www.github.com/yargs/yargs-parser/commit/ae11f496a8318ea8885aa25015d429b33713c314))
|
||||
|
||||
|
||||
### Code Refactoring
|
||||
|
||||
* drops support for 10 ([#421](https://www.github.com/yargs/yargs-parser/issues/421)) ([3aaf878](https://www.github.com/yargs/yargs-parser/commit/3aaf8784f5c7f2aec6108c1c6a55537fa7e3b5c1))
|
||||
|
||||
### [20.2.9](https://www.github.com/yargs/yargs-parser/compare/yargs-parser-v20.2.8...yargs-parser-v20.2.9) (2021-06-20)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **build:** fixed automated release pipeline ([1fe9135](https://www.github.com/yargs/yargs-parser/commit/1fe9135884790a083615419b2861683e2597dac3))
|
||||
|
||||
### [20.2.8](https://www.github.com/yargs/yargs-parser/compare/yargs-parser-v20.2.7...yargs-parser-v20.2.8) (2021-06-20)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **locale:** Turkish camelize and decamelize issues with toLocaleLowerCase/toLocaleUpperCase ([2617303](https://www.github.com/yargs/yargs-parser/commit/261730383e02448562f737b94bbd1f164aed5143))
|
||||
* **perf:** address slow parse when using unknown-options-as-args ([#394](https://www.github.com/yargs/yargs-parser/issues/394)) ([441f059](https://www.github.com/yargs/yargs-parser/commit/441f059d585d446551068ad213db79ac91daf83a))
|
||||
* **string-utils:** detect [0,1] ranged values as numbers ([#388](https://www.github.com/yargs/yargs-parser/issues/388)) ([efcc32c](https://www.github.com/yargs/yargs-parser/commit/efcc32c2d6b09aba31abfa2db9bd947befe5586b))
|
||||
|
||||
### [20.2.7](https://www.github.com/yargs/yargs-parser/compare/v20.2.6...v20.2.7) (2021-03-10)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **deno:** force release for Deno ([6687c97](https://www.github.com/yargs/yargs-parser/commit/6687c972d0f3ca7865a97908dde3080b05f8b026))
|
||||
|
||||
### [20.2.6](https://www.github.com/yargs/yargs-parser/compare/v20.2.5...v20.2.6) (2021-02-22)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **populate--:** -- should always be array ([#354](https://www.github.com/yargs/yargs-parser/issues/354)) ([585ae8f](https://www.github.com/yargs/yargs-parser/commit/585ae8ffad74cc02974f92d788e750137fd65146))
|
||||
|
||||
### [20.2.5](https://www.github.com/yargs/yargs-parser/compare/v20.2.4...v20.2.5) (2021-02-13)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* do not lowercase camel cased string ([#348](https://www.github.com/yargs/yargs-parser/issues/348)) ([5f4da1f](https://www.github.com/yargs/yargs-parser/commit/5f4da1f17d9d50542d2aaa206c9806ce3e320335))
|
||||
|
||||
### [20.2.4](https://www.github.com/yargs/yargs-parser/compare/v20.2.3...v20.2.4) (2020-11-09)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **deno:** address import issues in Deno ([#339](https://www.github.com/yargs/yargs-parser/issues/339)) ([3b54e5e](https://www.github.com/yargs/yargs-parser/commit/3b54e5eef6e9a7b7c6eec7c12bab3ba3b8ba8306))
|
||||
|
||||
### [20.2.3](https://www.github.com/yargs/yargs-parser/compare/v20.2.2...v20.2.3) (2020-10-16)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **exports:** node 13.0 and 13.1 require the dotted object form _with_ a string fallback ([#336](https://www.github.com/yargs/yargs-parser/issues/336)) ([3ae7242](https://www.github.com/yargs/yargs-parser/commit/3ae7242040ff876d28dabded60ac226e00150c88))
|
||||
|
||||
### [20.2.2](https://www.github.com/yargs/yargs-parser/compare/v20.2.1...v20.2.2) (2020-10-14)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **exports:** node 13.0-13.6 require a string fallback ([#333](https://www.github.com/yargs/yargs-parser/issues/333)) ([291aeda](https://www.github.com/yargs/yargs-parser/commit/291aeda06b685b7a015d83bdf2558e180b37388d))
|
||||
|
||||
### [20.2.1](https://www.github.com/yargs/yargs-parser/compare/v20.2.0...v20.2.1) (2020-10-01)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **deno:** update types for deno ^1.4.0 ([#330](https://www.github.com/yargs/yargs-parser/issues/330)) ([0ab92e5](https://www.github.com/yargs/yargs-parser/commit/0ab92e50b090f11196334c048c9c92cecaddaf56))
|
||||
|
||||
## [20.2.0](https://www.github.com/yargs/yargs-parser/compare/v20.1.0...v20.2.0) (2020-09-21)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **string-utils:** export looksLikeNumber helper ([#324](https://www.github.com/yargs/yargs-parser/issues/324)) ([c8580a2](https://www.github.com/yargs/yargs-parser/commit/c8580a2327b55f6342acecb6e72b62963d506750))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **unknown-options-as-args:** convert positionals that look like numbers ([#326](https://www.github.com/yargs/yargs-parser/issues/326)) ([f85ebb4](https://www.github.com/yargs/yargs-parser/commit/f85ebb4face9d4b0f56147659404cbe0002f3dad))
|
||||
|
||||
## [20.1.0](https://www.github.com/yargs/yargs-parser/compare/v20.0.0...v20.1.0) (2020-09-20)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* adds parse-positional-numbers configuration ([#321](https://www.github.com/yargs/yargs-parser/issues/321)) ([9cec00a](https://www.github.com/yargs/yargs-parser/commit/9cec00a622251292ffb7dce6f78f5353afaa0d4c))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **build:** update release-please; make labels kick off builds ([#323](https://www.github.com/yargs/yargs-parser/issues/323)) ([09f448b](https://www.github.com/yargs/yargs-parser/commit/09f448b4cd66e25d2872544718df46dab8af062a))
|
||||
|
||||
## [20.0.0](https://www.github.com/yargs/yargs-parser/compare/v19.0.4...v20.0.0) (2020-09-09)
|
||||
|
||||
|
||||
### ⚠ BREAKING CHANGES
|
||||
|
||||
* do not ship type definitions (#318)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* only strip camel case if hyphenated ([#316](https://www.github.com/yargs/yargs-parser/issues/316)) ([95a9e78](https://www.github.com/yargs/yargs-parser/commit/95a9e785127b9bbf2d1db1f1f808ca1fb100e82a)), closes [#315](https://www.github.com/yargs/yargs-parser/issues/315)
|
||||
|
||||
|
||||
### Code Refactoring
|
||||
|
||||
* do not ship type definitions ([#318](https://www.github.com/yargs/yargs-parser/issues/318)) ([8fbd56f](https://www.github.com/yargs/yargs-parser/commit/8fbd56f1d0b6c44c30fca62708812151ca0ce330))
|
||||
|
||||
### [19.0.4](https://www.github.com/yargs/yargs-parser/compare/v19.0.3...v19.0.4) (2020-08-27)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **build:** fixing publication ([#310](https://www.github.com/yargs/yargs-parser/issues/310)) ([5d3c6c2](https://www.github.com/yargs/yargs-parser/commit/5d3c6c29a9126248ba601920d9cf87c78e161ff5))
|
||||
|
||||
### [19.0.3](https://www.github.com/yargs/yargs-parser/compare/v19.0.2...v19.0.3) (2020-08-27)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **build:** switch to action for publish ([#308](https://www.github.com/yargs/yargs-parser/issues/308)) ([5c2f305](https://www.github.com/yargs/yargs-parser/commit/5c2f30585342bcd8aaf926407c863099d256d174))
|
||||
|
||||
### [19.0.2](https://www.github.com/yargs/yargs-parser/compare/v19.0.1...v19.0.2) (2020-08-27)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **types:** envPrefix should be optional ([#305](https://www.github.com/yargs/yargs-parser/issues/305)) ([ae3f180](https://www.github.com/yargs/yargs-parser/commit/ae3f180e14df2de2fd962145f4518f9aa0e76523))
|
||||
|
||||
### [19.0.1](https://www.github.com/yargs/yargs-parser/compare/v19.0.0...v19.0.1) (2020-08-09)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **build:** push tag created for deno ([2186a14](https://www.github.com/yargs/yargs-parser/commit/2186a14989749887d56189867602e39e6679f8b0))
|
||||
|
||||
## [19.0.0](https://www.github.com/yargs/yargs-parser/compare/v18.1.3...v19.0.0) (2020-08-09)
|
||||
|
||||
|
||||
### ⚠ BREAKING CHANGES
|
||||
|
||||
* adds support for ESM and Deno (#295)
|
||||
* **ts:** projects using `@types/yargs-parser` may see variations in type definitions.
|
||||
* drops Node 6. begin following Node.js LTS schedule (#278)
|
||||
|
||||
### Features
|
||||
|
||||
* adds support for ESM and Deno ([#295](https://www.github.com/yargs/yargs-parser/issues/295)) ([195bc4a](https://www.github.com/yargs/yargs-parser/commit/195bc4a7f20c2a8f8e33fbb6ba96ef6e9a0120a1))
|
||||
* expose camelCase and decamelize helpers ([#296](https://www.github.com/yargs/yargs-parser/issues/296)) ([39154ce](https://www.github.com/yargs/yargs-parser/commit/39154ceb5bdcf76b5f59a9219b34cedb79b67f26))
|
||||
* **deps:** update to latest camelcase/decamelize ([#281](https://www.github.com/yargs/yargs-parser/issues/281)) ([8931ab0](https://www.github.com/yargs/yargs-parser/commit/8931ab08f686cc55286f33a95a83537da2be5516))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* boolean numeric short option ([#294](https://www.github.com/yargs/yargs-parser/issues/294)) ([f600082](https://www.github.com/yargs/yargs-parser/commit/f600082c959e092076caf420bbbc9d7a231e2418))
|
||||
* raise permission error for Deno if config load fails ([#298](https://www.github.com/yargs/yargs-parser/issues/298)) ([1174e2b](https://www.github.com/yargs/yargs-parser/commit/1174e2b3f0c845a1cd64e14ffc3703e730567a84))
|
||||
* **deps:** update dependency decamelize to v3 ([#274](https://www.github.com/yargs/yargs-parser/issues/274)) ([4d98698](https://www.github.com/yargs/yargs-parser/commit/4d98698bc6767e84ec54a0842908191739be73b7))
|
||||
* **types:** switch back to using Partial types ([#293](https://www.github.com/yargs/yargs-parser/issues/293)) ([bdc80ba](https://www.github.com/yargs/yargs-parser/commit/bdc80ba59fa13bc3025ce0a85e8bad9f9da24ea7))
|
||||
|
||||
|
||||
### Build System
|
||||
|
||||
* drops Node 6. begin following Node.js LTS schedule ([#278](https://www.github.com/yargs/yargs-parser/issues/278)) ([9014ed7](https://www.github.com/yargs/yargs-parser/commit/9014ed722a32768b96b829e65a31705db5c1458a))
|
||||
|
||||
|
||||
### Code Refactoring
|
||||
|
||||
* **ts:** move index.js to TypeScript ([#292](https://www.github.com/yargs/yargs-parser/issues/292)) ([f78d2b9](https://www.github.com/yargs/yargs-parser/commit/f78d2b97567ac4828624406e420b4047c710b789))
|
||||
|
||||
### [18.1.3](https://www.github.com/yargs/yargs-parser/compare/v18.1.2...v18.1.3) (2020-04-16)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **setArg:** options using camel-case and dot-notation populated twice ([#268](https://www.github.com/yargs/yargs-parser/issues/268)) ([f7e15b9](https://www.github.com/yargs/yargs-parser/commit/f7e15b9800900b9856acac1a830a5f35847be73e))
|
||||
|
||||
### [18.1.2](https://www.github.com/yargs/yargs-parser/compare/v18.1.1...v18.1.2) (2020-03-26)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **array, nargs:** support -o=--value and --option=--value format ([#262](https://www.github.com/yargs/yargs-parser/issues/262)) ([41d3f81](https://www.github.com/yargs/yargs-parser/commit/41d3f8139e116706b28de9b0de3433feb08d2f13))
|
||||
|
||||
### [18.1.1](https://www.github.com/yargs/yargs-parser/compare/v18.1.0...v18.1.1) (2020-03-16)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* \_\_proto\_\_ will now be replaced with \_\_\_proto\_\_\_ in parse ([#258](https://www.github.com/yargs/yargs-parser/issues/258)), patching a potential
|
||||
prototype pollution vulnerability. This was reported by the Snyk Security Research Team.([63810ca](https://www.github.com/yargs/yargs-parser/commit/63810ca1ae1a24b08293a4d971e70e058c7a41e2))
|
||||
|
||||
## [18.1.0](https://www.github.com/yargs/yargs-parser/compare/v18.0.0...v18.1.0) (2020-03-07)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* introduce single-digit boolean aliases ([#255](https://www.github.com/yargs/yargs-parser/issues/255)) ([9c60265](https://www.github.com/yargs/yargs-parser/commit/9c60265fd7a03cb98e6df3e32c8c5e7508d9f56f))
|
||||
|
||||
## [18.0.0](https://www.github.com/yargs/yargs-parser/compare/v17.1.0...v18.0.0) (2020-03-02)
|
||||
|
||||
|
||||
### ⚠ BREAKING CHANGES
|
||||
|
||||
* the narg count is now enforced when parsing arrays.
|
||||
|
||||
### Features
|
||||
|
||||
* NaN can now be provided as a value for nargs, indicating "at least" one value is expected for array ([#251](https://www.github.com/yargs/yargs-parser/issues/251)) ([9db4be8](https://www.github.com/yargs/yargs-parser/commit/9db4be81417a2c7097128db34d86fe70ef4af70c))
|
||||
|
||||
## [17.1.0](https://www.github.com/yargs/yargs-parser/compare/v17.0.1...v17.1.0) (2020-03-01)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* introduce greedy-arrays config, for specifying whether arrays consume multiple positionals ([#249](https://www.github.com/yargs/yargs-parser/issues/249)) ([60e880a](https://www.github.com/yargs/yargs-parser/commit/60e880a837046314d89fa4725f923837fd33a9eb))
|
||||
|
||||
### [17.0.1](https://www.github.com/yargs/yargs-parser/compare/v17.0.0...v17.0.1) (2020-02-29)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* normalized keys were not enumerable ([#247](https://www.github.com/yargs/yargs-parser/issues/247)) ([57119f9](https://www.github.com/yargs/yargs-parser/commit/57119f9f17cf27499bd95e61c2f72d18314f11ba))
|
||||
|
||||
## [17.0.0](https://www.github.com/yargs/yargs-parser/compare/v16.1.0...v17.0.0) (2020-02-10)
|
||||
|
||||
|
||||
### ⚠ BREAKING CHANGES
|
||||
|
||||
* this reverts parsing behavior of booleans to that of yargs@14
|
||||
* objects used during parsing are now created with a null
|
||||
prototype. There may be some scenarios where this change in behavior
|
||||
leaks externally.
|
||||
|
||||
### Features
|
||||
|
||||
* boolean arguments will not be collected into an implicit array ([#236](https://www.github.com/yargs/yargs-parser/issues/236)) ([34c4e19](https://www.github.com/yargs/yargs-parser/commit/34c4e19bae4e7af63e3cb6fa654a97ed476e5eb5))
|
||||
* introduce nargs-eats-options config option ([#246](https://www.github.com/yargs/yargs-parser/issues/246)) ([d50822a](https://www.github.com/yargs/yargs-parser/commit/d50822ac10e1b05f2e9643671ca131ac251b6732))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* address bugs with "uknown-options-as-args" ([bc023e3](https://www.github.com/yargs/yargs-parser/commit/bc023e3b13e20a118353f9507d1c999bf388a346))
|
||||
* array should take precedence over nargs, but enforce nargs ([#243](https://www.github.com/yargs/yargs-parser/issues/243)) ([4cbc188](https://www.github.com/yargs/yargs-parser/commit/4cbc188b7abb2249529a19c090338debdad2fe6c))
|
||||
* support keys that collide with object prototypes ([#234](https://www.github.com/yargs/yargs-parser/issues/234)) ([1587b6d](https://www.github.com/yargs/yargs-parser/commit/1587b6d91db853a9109f1be6b209077993fee4de))
|
||||
* unknown options terminated with digits now handled by unknown-options-as-args ([#238](https://www.github.com/yargs/yargs-parser/issues/238)) ([d36cdfa](https://www.github.com/yargs/yargs-parser/commit/d36cdfa854254d7c7e0fe1d583818332ac46c2a5))
|
||||
|
||||
## [16.1.0](https://www.github.com/yargs/yargs-parser/compare/v16.0.0...v16.1.0) (2019-11-01)
|
||||
|
||||
|
||||
### ⚠ BREAKING CHANGES
|
||||
|
||||
* populate error if incompatible narg/count or array/count options are used (#191)
|
||||
|
||||
### Features
|
||||
|
||||
* options that have had their default value used are now tracked ([#211](https://www.github.com/yargs/yargs-parser/issues/211)) ([a525234](https://www.github.com/yargs/yargs-parser/commit/a525234558c847deedd73f8792e0a3b77b26e2c0))
|
||||
* populate error if incompatible narg/count or array/count options are used ([#191](https://www.github.com/yargs/yargs-parser/issues/191)) ([84a401f](https://www.github.com/yargs/yargs-parser/commit/84a401f0fa3095e0a19661670d1570d0c3b9d3c9))
|
||||
|
||||
|
||||
### Reverts
|
||||
|
||||
* revert 16.0.0 CHANGELOG entry ([920320a](https://www.github.com/yargs/yargs-parser/commit/920320ad9861bbfd58eda39221ae211540fc1daf))
|
||||
14
node_modules/@grpc/proto-loader/node_modules/yargs-parser/LICENSE.txt
generated
vendored
Normal file
14
node_modules/@grpc/proto-loader/node_modules/yargs-parser/LICENSE.txt
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
Copyright (c) 2016, 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.
|
||||
518
node_modules/@grpc/proto-loader/node_modules/yargs-parser/README.md
generated
vendored
Normal file
518
node_modules/@grpc/proto-loader/node_modules/yargs-parser/README.md
generated
vendored
Normal file
@@ -0,0 +1,518 @@
|
||||
# yargs-parser
|
||||
|
||||

|
||||
[](https://www.npmjs.com/package/yargs-parser)
|
||||
[](https://conventionalcommits.org)
|
||||

|
||||
|
||||
The mighty option parser used by [yargs](https://github.com/yargs/yargs).
|
||||
|
||||
visit the [yargs website](http://yargs.js.org/) for more examples, and thorough usage instructions.
|
||||
|
||||
<img width="250" src="https://raw.githubusercontent.com/yargs/yargs-parser/main/yargs-logo.png">
|
||||
|
||||
## Example
|
||||
|
||||
```sh
|
||||
npm i yargs-parser --save
|
||||
```
|
||||
|
||||
```js
|
||||
const argv = require('yargs-parser')(process.argv.slice(2))
|
||||
console.log(argv)
|
||||
```
|
||||
|
||||
```console
|
||||
$ node example.js --foo=33 --bar hello
|
||||
{ _: [], foo: 33, bar: 'hello' }
|
||||
```
|
||||
|
||||
_or parse a string!_
|
||||
|
||||
```js
|
||||
const argv = require('yargs-parser')('--foo=99 --bar=33')
|
||||
console.log(argv)
|
||||
```
|
||||
|
||||
```console
|
||||
{ _: [], foo: 99, bar: 33 }
|
||||
```
|
||||
|
||||
Convert an array of mixed types before passing to `yargs-parser`:
|
||||
|
||||
```js
|
||||
const parse = require('yargs-parser')
|
||||
parse(['-f', 11, '--zoom', 55].join(' ')) // <-- array to string
|
||||
parse(['-f', 11, '--zoom', 55].map(String)) // <-- array of strings
|
||||
```
|
||||
|
||||
## Deno Example
|
||||
|
||||
As of `v19` `yargs-parser` supports [Deno](https://github.com/denoland/deno):
|
||||
|
||||
```typescript
|
||||
import parser from "https://deno.land/x/yargs_parser/deno.ts";
|
||||
|
||||
const argv = parser('--foo=99 --bar=9987930', {
|
||||
string: ['bar']
|
||||
})
|
||||
console.log(argv)
|
||||
```
|
||||
|
||||
## ESM Example
|
||||
|
||||
As of `v19` `yargs-parser` supports ESM (_both in Node.js and in the browser_):
|
||||
|
||||
**Node.js:**
|
||||
|
||||
```js
|
||||
import parser from 'yargs-parser'
|
||||
|
||||
const argv = parser('--foo=99 --bar=9987930', {
|
||||
string: ['bar']
|
||||
})
|
||||
console.log(argv)
|
||||
```
|
||||
|
||||
**Browsers:**
|
||||
|
||||
```html
|
||||
<!doctype html>
|
||||
<body>
|
||||
<script type="module">
|
||||
import parser from "https://unpkg.com/yargs-parser@19.0.0/browser.js";
|
||||
|
||||
const argv = parser('--foo=99 --bar=9987930', {
|
||||
string: ['bar']
|
||||
})
|
||||
console.log(argv)
|
||||
</script>
|
||||
</body>
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### parser(args, opts={})
|
||||
|
||||
Parses command line arguments returning a simple mapping of keys and values.
|
||||
|
||||
**expects:**
|
||||
|
||||
* `args`: a string or array of strings representing the options to parse.
|
||||
* `opts`: provide a set of hints indicating how `args` should be parsed:
|
||||
* `opts.alias`: an object representing the set of aliases for a key: `{alias: {foo: ['f']}}`.
|
||||
* `opts.array`: indicate that keys should be parsed as an array: `{array: ['foo', 'bar']}`.<br>
|
||||
Indicate that keys should be parsed as an array and coerced to booleans / numbers:<br>
|
||||
`{array: [{ key: 'foo', boolean: true }, {key: 'bar', number: true}]}`.
|
||||
* `opts.boolean`: arguments should be parsed as booleans: `{boolean: ['x', 'y']}`.
|
||||
* `opts.coerce`: provide a custom synchronous function that returns a coerced value from the argument provided
|
||||
(or throws an error). For arrays the function is called only once for the entire array:<br>
|
||||
`{coerce: {foo: function (arg) {return modifiedArg}}}`.
|
||||
* `opts.config`: indicate a key that represents a path to a configuration file (this file will be loaded and parsed).
|
||||
* `opts.configObjects`: configuration objects to parse, their properties will be set as arguments:<br>
|
||||
`{configObjects: [{'x': 5, 'y': 33}, {'z': 44}]}`.
|
||||
* `opts.configuration`: provide configuration options to the yargs-parser (see: [configuration](#configuration)).
|
||||
* `opts.count`: indicate a key that should be used as a counter, e.g., `-vvv` = `{v: 3}`.
|
||||
* `opts.default`: provide default values for keys: `{default: {x: 33, y: 'hello world!'}}`.
|
||||
* `opts.envPrefix`: environment variables (`process.env`) with the prefix provided should be parsed.
|
||||
* `opts.narg`: specify that a key requires `n` arguments: `{narg: {x: 2}}`.
|
||||
* `opts.normalize`: `path.normalize()` will be applied to values set to this key.
|
||||
* `opts.number`: keys should be treated as numbers.
|
||||
* `opts.string`: keys should be treated as strings (even if they resemble a number `-x 33`).
|
||||
|
||||
**returns:**
|
||||
|
||||
* `obj`: an object representing the parsed value of `args`
|
||||
* `key/value`: key value pairs for each argument and their aliases.
|
||||
* `_`: an array representing the positional arguments.
|
||||
* [optional] `--`: an array with arguments after the end-of-options flag `--`.
|
||||
|
||||
### require('yargs-parser').detailed(args, opts={})
|
||||
|
||||
Parses a command line string, returning detailed information required by the
|
||||
yargs engine.
|
||||
|
||||
**expects:**
|
||||
|
||||
* `args`: a string or array of strings representing options to parse.
|
||||
* `opts`: provide a set of hints indicating how `args`, inputs are identical to `require('yargs-parser')(args, opts={})`.
|
||||
|
||||
**returns:**
|
||||
|
||||
* `argv`: an object representing the parsed value of `args`
|
||||
* `key/value`: key value pairs for each argument and their aliases.
|
||||
* `_`: an array representing the positional arguments.
|
||||
* [optional] `--`: an array with arguments after the end-of-options flag `--`.
|
||||
* `error`: populated with an error object if an exception occurred during parsing.
|
||||
* `aliases`: the inferred list of aliases built by combining lists in `opts.alias`.
|
||||
* `newAliases`: any new aliases added via camel-case expansion:
|
||||
* `boolean`: `{ fooBar: true }`
|
||||
* `defaulted`: any new argument created by `opts.default`, no aliases included.
|
||||
* `boolean`: `{ foo: true }`
|
||||
* `configuration`: given by default settings and `opts.configuration`.
|
||||
|
||||
<a name="configuration"></a>
|
||||
|
||||
### Configuration
|
||||
|
||||
The yargs-parser applies several automated transformations on the keys provided
|
||||
in `args`. These features can be turned on and off using the `configuration` field
|
||||
of `opts`.
|
||||
|
||||
```js
|
||||
var parsed = parser(['--no-dice'], {
|
||||
configuration: {
|
||||
'boolean-negation': false
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
### short option groups
|
||||
|
||||
* default: `true`.
|
||||
* key: `short-option-groups`.
|
||||
|
||||
Should a group of short-options be treated as boolean flags?
|
||||
|
||||
```console
|
||||
$ node example.js -abc
|
||||
{ _: [], a: true, b: true, c: true }
|
||||
```
|
||||
|
||||
_if disabled:_
|
||||
|
||||
```console
|
||||
$ node example.js -abc
|
||||
{ _: [], abc: true }
|
||||
```
|
||||
|
||||
### camel-case expansion
|
||||
|
||||
* default: `true`.
|
||||
* key: `camel-case-expansion`.
|
||||
|
||||
Should hyphenated arguments be expanded into camel-case aliases?
|
||||
|
||||
```console
|
||||
$ node example.js --foo-bar
|
||||
{ _: [], 'foo-bar': true, fooBar: true }
|
||||
```
|
||||
|
||||
_if disabled:_
|
||||
|
||||
```console
|
||||
$ node example.js --foo-bar
|
||||
{ _: [], 'foo-bar': true }
|
||||
```
|
||||
|
||||
### dot-notation
|
||||
|
||||
* default: `true`
|
||||
* key: `dot-notation`
|
||||
|
||||
Should keys that contain `.` be treated as objects?
|
||||
|
||||
```console
|
||||
$ node example.js --foo.bar
|
||||
{ _: [], foo: { bar: true } }
|
||||
```
|
||||
|
||||
_if disabled:_
|
||||
|
||||
```console
|
||||
$ node example.js --foo.bar
|
||||
{ _: [], "foo.bar": true }
|
||||
```
|
||||
|
||||
### parse numbers
|
||||
|
||||
* default: `true`
|
||||
* key: `parse-numbers`
|
||||
|
||||
Should keys that look like numbers be treated as such?
|
||||
|
||||
```console
|
||||
$ node example.js --foo=99.3
|
||||
{ _: [], foo: 99.3 }
|
||||
```
|
||||
|
||||
_if disabled:_
|
||||
|
||||
```console
|
||||
$ node example.js --foo=99.3
|
||||
{ _: [], foo: "99.3" }
|
||||
```
|
||||
|
||||
### parse positional numbers
|
||||
|
||||
* default: `true`
|
||||
* key: `parse-positional-numbers`
|
||||
|
||||
Should positional keys that look like numbers be treated as such.
|
||||
|
||||
```console
|
||||
$ node example.js 99.3
|
||||
{ _: [99.3] }
|
||||
```
|
||||
|
||||
_if disabled:_
|
||||
|
||||
```console
|
||||
$ node example.js 99.3
|
||||
{ _: ['99.3'] }
|
||||
```
|
||||
|
||||
### boolean negation
|
||||
|
||||
* default: `true`
|
||||
* key: `boolean-negation`
|
||||
|
||||
Should variables prefixed with `--no` be treated as negations?
|
||||
|
||||
```console
|
||||
$ node example.js --no-foo
|
||||
{ _: [], foo: false }
|
||||
```
|
||||
|
||||
_if disabled:_
|
||||
|
||||
```console
|
||||
$ node example.js --no-foo
|
||||
{ _: [], "no-foo": true }
|
||||
```
|
||||
|
||||
### combine arrays
|
||||
|
||||
* default: `false`
|
||||
* key: `combine-arrays`
|
||||
|
||||
Should arrays be combined when provided by both command line arguments and
|
||||
a configuration file.
|
||||
|
||||
### duplicate arguments array
|
||||
|
||||
* default: `true`
|
||||
* key: `duplicate-arguments-array`
|
||||
|
||||
Should arguments be coerced into an array when duplicated:
|
||||
|
||||
```console
|
||||
$ node example.js -x 1 -x 2
|
||||
{ _: [], x: [1, 2] }
|
||||
```
|
||||
|
||||
_if disabled:_
|
||||
|
||||
```console
|
||||
$ node example.js -x 1 -x 2
|
||||
{ _: [], x: 2 }
|
||||
```
|
||||
|
||||
### flatten duplicate arrays
|
||||
|
||||
* default: `true`
|
||||
* key: `flatten-duplicate-arrays`
|
||||
|
||||
Should array arguments be coerced into a single array when duplicated:
|
||||
|
||||
```console
|
||||
$ node example.js -x 1 2 -x 3 4
|
||||
{ _: [], x: [1, 2, 3, 4] }
|
||||
```
|
||||
|
||||
_if disabled:_
|
||||
|
||||
```console
|
||||
$ node example.js -x 1 2 -x 3 4
|
||||
{ _: [], x: [[1, 2], [3, 4]] }
|
||||
```
|
||||
|
||||
### greedy arrays
|
||||
|
||||
* default: `true`
|
||||
* key: `greedy-arrays`
|
||||
|
||||
Should arrays consume more than one positional argument following their flag.
|
||||
|
||||
```console
|
||||
$ node example --arr 1 2
|
||||
{ _: [], arr: [1, 2] }
|
||||
```
|
||||
|
||||
_if disabled:_
|
||||
|
||||
```console
|
||||
$ node example --arr 1 2
|
||||
{ _: [2], arr: [1] }
|
||||
```
|
||||
|
||||
**Note: in `v18.0.0` we are considering defaulting greedy arrays to `false`.**
|
||||
|
||||
### nargs eats options
|
||||
|
||||
* default: `false`
|
||||
* key: `nargs-eats-options`
|
||||
|
||||
Should nargs consume dash options as well as positional arguments.
|
||||
|
||||
### negation prefix
|
||||
|
||||
* default: `no-`
|
||||
* key: `negation-prefix`
|
||||
|
||||
The prefix to use for negated boolean variables.
|
||||
|
||||
```console
|
||||
$ node example.js --no-foo
|
||||
{ _: [], foo: false }
|
||||
```
|
||||
|
||||
_if set to `quux`:_
|
||||
|
||||
```console
|
||||
$ node example.js --quuxfoo
|
||||
{ _: [], foo: false }
|
||||
```
|
||||
|
||||
### populate --
|
||||
|
||||
* default: `false`.
|
||||
* key: `populate--`
|
||||
|
||||
Should unparsed flags be stored in `--` or `_`.
|
||||
|
||||
_If disabled:_
|
||||
|
||||
```console
|
||||
$ node example.js a -b -- x y
|
||||
{ _: [ 'a', 'x', 'y' ], b: true }
|
||||
```
|
||||
|
||||
_If enabled:_
|
||||
|
||||
```console
|
||||
$ node example.js a -b -- x y
|
||||
{ _: [ 'a' ], '--': [ 'x', 'y' ], b: true }
|
||||
```
|
||||
|
||||
### set placeholder key
|
||||
|
||||
* default: `false`.
|
||||
* key: `set-placeholder-key`.
|
||||
|
||||
Should a placeholder be added for keys not set via the corresponding CLI argument?
|
||||
|
||||
_If disabled:_
|
||||
|
||||
```console
|
||||
$ node example.js -a 1 -c 2
|
||||
{ _: [], a: 1, c: 2 }
|
||||
```
|
||||
|
||||
_If enabled:_
|
||||
|
||||
```console
|
||||
$ node example.js -a 1 -c 2
|
||||
{ _: [], a: 1, b: undefined, c: 2 }
|
||||
```
|
||||
|
||||
### halt at non-option
|
||||
|
||||
* default: `false`.
|
||||
* key: `halt-at-non-option`.
|
||||
|
||||
Should parsing stop at the first positional argument? This is similar to how e.g. `ssh` parses its command line.
|
||||
|
||||
_If disabled:_
|
||||
|
||||
```console
|
||||
$ node example.js -a run b -x y
|
||||
{ _: [ 'b' ], a: 'run', x: 'y' }
|
||||
```
|
||||
|
||||
_If enabled:_
|
||||
|
||||
```console
|
||||
$ node example.js -a run b -x y
|
||||
{ _: [ 'b', '-x', 'y' ], a: 'run' }
|
||||
```
|
||||
|
||||
### strip aliased
|
||||
|
||||
* default: `false`
|
||||
* key: `strip-aliased`
|
||||
|
||||
Should aliases be removed before returning results?
|
||||
|
||||
_If disabled:_
|
||||
|
||||
```console
|
||||
$ node example.js --test-field 1
|
||||
{ _: [], 'test-field': 1, testField: 1, 'test-alias': 1, testAlias: 1 }
|
||||
```
|
||||
|
||||
_If enabled:_
|
||||
|
||||
```console
|
||||
$ node example.js --test-field 1
|
||||
{ _: [], 'test-field': 1, testField: 1 }
|
||||
```
|
||||
|
||||
### strip dashed
|
||||
|
||||
* default: `false`
|
||||
* key: `strip-dashed`
|
||||
|
||||
Should dashed keys be removed before returning results? This option has no effect if
|
||||
`camel-case-expansion` is disabled.
|
||||
|
||||
_If disabled:_
|
||||
|
||||
```console
|
||||
$ node example.js --test-field 1
|
||||
{ _: [], 'test-field': 1, testField: 1 }
|
||||
```
|
||||
|
||||
_If enabled:_
|
||||
|
||||
```console
|
||||
$ node example.js --test-field 1
|
||||
{ _: [], testField: 1 }
|
||||
```
|
||||
|
||||
### unknown options as args
|
||||
|
||||
* default: `false`
|
||||
* key: `unknown-options-as-args`
|
||||
|
||||
Should unknown options be treated like regular arguments? An unknown option is one that is not
|
||||
configured in `opts`.
|
||||
|
||||
_If disabled_
|
||||
|
||||
```console
|
||||
$ node example.js --unknown-option --known-option 2 --string-option --unknown-option2
|
||||
{ _: [], unknownOption: true, knownOption: 2, stringOption: '', unknownOption2: true }
|
||||
```
|
||||
|
||||
_If enabled_
|
||||
|
||||
```console
|
||||
$ node example.js --unknown-option --known-option 2 --string-option --unknown-option2
|
||||
{ _: ['--unknown-option'], knownOption: 2, stringOption: '--unknown-option2' }
|
||||
```
|
||||
|
||||
## 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).
|
||||
|
||||
## Special Thanks
|
||||
|
||||
The yargs project evolves from optimist and minimist. It owes its
|
||||
existence to a lot of James Halliday's hard work. Thanks [substack](https://github.com/substack) **beep** **boop** \o/
|
||||
|
||||
## License
|
||||
|
||||
ISC
|
||||
29
node_modules/@grpc/proto-loader/node_modules/yargs-parser/browser.js
generated
vendored
Normal file
29
node_modules/@grpc/proto-loader/node_modules/yargs-parser/browser.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
// Main entrypoint for ESM web browser environments. Avoids using Node.js
|
||||
// specific libraries, such as "path".
|
||||
//
|
||||
// TODO: figure out reasonable web equivalents for "resolve", "normalize", etc.
|
||||
import { camelCase, decamelize, looksLikeNumber } from './build/lib/string-utils.js'
|
||||
import { YargsParser } from './build/lib/yargs-parser.js'
|
||||
const parser = new YargsParser({
|
||||
cwd: () => { return '' },
|
||||
format: (str, arg) => { return str.replace('%s', arg) },
|
||||
normalize: (str) => { return str },
|
||||
resolve: (str) => { return str },
|
||||
require: () => {
|
||||
throw Error('loading config from files not currently supported in browser')
|
||||
},
|
||||
env: () => {}
|
||||
})
|
||||
|
||||
const yargsParser = function Parser (args, opts) {
|
||||
const result = parser.parse(args.slice(), opts)
|
||||
return result.argv
|
||||
}
|
||||
yargsParser.detailed = function (args, opts) {
|
||||
return parser.parse(args.slice(), opts)
|
||||
}
|
||||
yargsParser.camelCase = camelCase
|
||||
yargsParser.decamelize = decamelize
|
||||
yargsParser.looksLikeNumber = looksLikeNumber
|
||||
|
||||
export default yargsParser
|
||||
1050
node_modules/@grpc/proto-loader/node_modules/yargs-parser/build/index.cjs
generated
vendored
Normal file
1050
node_modules/@grpc/proto-loader/node_modules/yargs-parser/build/index.cjs
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
62
node_modules/@grpc/proto-loader/node_modules/yargs-parser/build/lib/index.js
generated
vendored
Normal file
62
node_modules/@grpc/proto-loader/node_modules/yargs-parser/build/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
/**
|
||||
* @fileoverview Main entrypoint for libraries using yargs-parser in Node.js
|
||||
* CJS and ESM environments.
|
||||
*
|
||||
* @license
|
||||
* Copyright (c) 2016, Contributors
|
||||
* SPDX-License-Identifier: ISC
|
||||
*/
|
||||
var _a, _b, _c;
|
||||
import { format } from 'util';
|
||||
import { normalize, resolve } from 'path';
|
||||
import { camelCase, decamelize, looksLikeNumber } from './string-utils.js';
|
||||
import { YargsParser } from './yargs-parser.js';
|
||||
import { readFileSync } from 'fs';
|
||||
// See https://github.com/yargs/yargs-parser#supported-nodejs-versions for our
|
||||
// version support policy. The YARGS_MIN_NODE_VERSION is used for testing only.
|
||||
const minNodeVersion = (process && process.env && process.env.YARGS_MIN_NODE_VERSION)
|
||||
? Number(process.env.YARGS_MIN_NODE_VERSION)
|
||||
: 12;
|
||||
const nodeVersion = (_b = (_a = process === null || process === void 0 ? void 0 : process.versions) === null || _a === void 0 ? void 0 : _a.node) !== null && _b !== void 0 ? _b : (_c = process === null || process === void 0 ? void 0 : process.version) === null || _c === void 0 ? void 0 : _c.slice(1);
|
||||
if (nodeVersion) {
|
||||
const major = Number(nodeVersion.match(/^([^.]+)/)[1]);
|
||||
if (major < minNodeVersion) {
|
||||
throw Error(`yargs parser supports a minimum Node.js version of ${minNodeVersion}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);
|
||||
}
|
||||
}
|
||||
// Creates a yargs-parser instance using Node.js standard libraries:
|
||||
const env = process ? process.env : {};
|
||||
const parser = new YargsParser({
|
||||
cwd: process.cwd,
|
||||
env: () => {
|
||||
return env;
|
||||
},
|
||||
format,
|
||||
normalize,
|
||||
resolve,
|
||||
// TODO: figure out a way to combine ESM and CJS coverage, such that
|
||||
// we can exercise all the lines below:
|
||||
require: (path) => {
|
||||
if (typeof require !== 'undefined') {
|
||||
return require(path);
|
||||
}
|
||||
else if (path.match(/\.json$/)) {
|
||||
// Addresses: https://github.com/yargs/yargs/issues/2040
|
||||
return JSON.parse(readFileSync(path, 'utf8'));
|
||||
}
|
||||
else {
|
||||
throw Error('only .json config files are supported in ESM');
|
||||
}
|
||||
}
|
||||
});
|
||||
const yargsParser = function Parser(args, opts) {
|
||||
const result = parser.parse(args.slice(), opts);
|
||||
return result.argv;
|
||||
};
|
||||
yargsParser.detailed = function (args, opts) {
|
||||
return parser.parse(args.slice(), opts);
|
||||
};
|
||||
yargsParser.camelCase = camelCase;
|
||||
yargsParser.decamelize = decamelize;
|
||||
yargsParser.looksLikeNumber = looksLikeNumber;
|
||||
export default yargsParser;
|
||||
65
node_modules/@grpc/proto-loader/node_modules/yargs-parser/build/lib/string-utils.js
generated
vendored
Normal file
65
node_modules/@grpc/proto-loader/node_modules/yargs-parser/build/lib/string-utils.js
generated
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright (c) 2016, Contributors
|
||||
* SPDX-License-Identifier: ISC
|
||||
*/
|
||||
export function camelCase(str) {
|
||||
// Handle the case where an argument is provided as camel case, e.g., fooBar.
|
||||
// by ensuring that the string isn't already mixed case:
|
||||
const isCamelCase = str !== str.toLowerCase() && str !== str.toUpperCase();
|
||||
if (!isCamelCase) {
|
||||
str = str.toLowerCase();
|
||||
}
|
||||
if (str.indexOf('-') === -1 && str.indexOf('_') === -1) {
|
||||
return str;
|
||||
}
|
||||
else {
|
||||
let camelcase = '';
|
||||
let nextChrUpper = false;
|
||||
const leadingHyphens = str.match(/^-+/);
|
||||
for (let i = leadingHyphens ? leadingHyphens[0].length : 0; i < str.length; i++) {
|
||||
let chr = str.charAt(i);
|
||||
if (nextChrUpper) {
|
||||
nextChrUpper = false;
|
||||
chr = chr.toUpperCase();
|
||||
}
|
||||
if (i !== 0 && (chr === '-' || chr === '_')) {
|
||||
nextChrUpper = true;
|
||||
}
|
||||
else if (chr !== '-' && chr !== '_') {
|
||||
camelcase += chr;
|
||||
}
|
||||
}
|
||||
return camelcase;
|
||||
}
|
||||
}
|
||||
export function decamelize(str, joinString) {
|
||||
const lowercase = str.toLowerCase();
|
||||
joinString = joinString || '-';
|
||||
let notCamelcase = '';
|
||||
for (let i = 0; i < str.length; i++) {
|
||||
const chrLower = lowercase.charAt(i);
|
||||
const chrString = str.charAt(i);
|
||||
if (chrLower !== chrString && i > 0) {
|
||||
notCamelcase += `${joinString}${lowercase.charAt(i)}`;
|
||||
}
|
||||
else {
|
||||
notCamelcase += chrString;
|
||||
}
|
||||
}
|
||||
return notCamelcase;
|
||||
}
|
||||
export function looksLikeNumber(x) {
|
||||
if (x === null || x === undefined)
|
||||
return false;
|
||||
// if loaded from config, may already be a number.
|
||||
if (typeof x === 'number')
|
||||
return true;
|
||||
// hexadecimal.
|
||||
if (/^0x[0-9a-f]+$/i.test(x))
|
||||
return true;
|
||||
// don't treat 0123 as a number; as it drops the leading '0'.
|
||||
if (/^0[^.]/.test(x))
|
||||
return false;
|
||||
return /^[-]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x);
|
||||
}
|
||||
40
node_modules/@grpc/proto-loader/node_modules/yargs-parser/build/lib/tokenize-arg-string.js
generated
vendored
Normal file
40
node_modules/@grpc/proto-loader/node_modules/yargs-parser/build/lib/tokenize-arg-string.js
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright (c) 2016, Contributors
|
||||
* SPDX-License-Identifier: ISC
|
||||
*/
|
||||
// take an un-split argv string and tokenize it.
|
||||
export function tokenizeArgString(argString) {
|
||||
if (Array.isArray(argString)) {
|
||||
return argString.map(e => typeof e !== 'string' ? e + '' : e);
|
||||
}
|
||||
argString = argString.trim();
|
||||
let i = 0;
|
||||
let prevC = null;
|
||||
let c = null;
|
||||
let opening = null;
|
||||
const args = [];
|
||||
for (let ii = 0; ii < argString.length; ii++) {
|
||||
prevC = c;
|
||||
c = argString.charAt(ii);
|
||||
// split on spaces unless we're in quotes.
|
||||
if (c === ' ' && !opening) {
|
||||
if (!(prevC === ' ')) {
|
||||
i++;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
// don't split the string if we're in matching
|
||||
// opening or closing single and double quotes.
|
||||
if (c === opening) {
|
||||
opening = null;
|
||||
}
|
||||
else if ((c === "'" || c === '"') && !opening) {
|
||||
opening = c;
|
||||
}
|
||||
if (!args[i])
|
||||
args[i] = '';
|
||||
args[i] += c;
|
||||
}
|
||||
return args;
|
||||
}
|
||||
12
node_modules/@grpc/proto-loader/node_modules/yargs-parser/build/lib/yargs-parser-types.js
generated
vendored
Normal file
12
node_modules/@grpc/proto-loader/node_modules/yargs-parser/build/lib/yargs-parser-types.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright (c) 2016, Contributors
|
||||
* SPDX-License-Identifier: ISC
|
||||
*/
|
||||
export var DefaultValuesForTypeKey;
|
||||
(function (DefaultValuesForTypeKey) {
|
||||
DefaultValuesForTypeKey["BOOLEAN"] = "boolean";
|
||||
DefaultValuesForTypeKey["STRING"] = "string";
|
||||
DefaultValuesForTypeKey["NUMBER"] = "number";
|
||||
DefaultValuesForTypeKey["ARRAY"] = "array";
|
||||
})(DefaultValuesForTypeKey || (DefaultValuesForTypeKey = {}));
|
||||
1045
node_modules/@grpc/proto-loader/node_modules/yargs-parser/build/lib/yargs-parser.js
generated
vendored
Normal file
1045
node_modules/@grpc/proto-loader/node_modules/yargs-parser/build/lib/yargs-parser.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
92
node_modules/@grpc/proto-loader/node_modules/yargs-parser/package.json
generated
vendored
Normal file
92
node_modules/@grpc/proto-loader/node_modules/yargs-parser/package.json
generated
vendored
Normal file
@@ -0,0 +1,92 @@
|
||||
{
|
||||
"name": "yargs-parser",
|
||||
"version": "21.1.1",
|
||||
"description": "the mighty option parser used by yargs",
|
||||
"main": "build/index.cjs",
|
||||
"exports": {
|
||||
".": [
|
||||
{
|
||||
"import": "./build/lib/index.js",
|
||||
"require": "./build/index.cjs"
|
||||
},
|
||||
"./build/index.cjs"
|
||||
],
|
||||
"./browser": [
|
||||
"./browser.js"
|
||||
]
|
||||
},
|
||||
"type": "module",
|
||||
"module": "./build/lib/index.js",
|
||||
"scripts": {
|
||||
"check": "standardx '**/*.ts' && standardx '**/*.js' && standardx '**/*.cjs'",
|
||||
"fix": "standardx --fix '**/*.ts' && standardx --fix '**/*.js' && standardx --fix '**/*.cjs'",
|
||||
"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/*.mjs",
|
||||
"test:browser": "start-server-and-test 'serve ./ -p 8080' http://127.0.0.1:8080/package.json 'node ./test/browser/yargs-test.cjs'",
|
||||
"pretest:typescript": "npm run pretest",
|
||||
"test:typescript": "c8 mocha ./build/test/typescript/*.js",
|
||||
"coverage": "c8 report --check-coverage",
|
||||
"precompile": "rimraf build",
|
||||
"compile": "tsc",
|
||||
"postcompile": "npm run build:cjs",
|
||||
"build:cjs": "rollup -c",
|
||||
"prepare": "npm run compile"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/yargs/yargs-parser.git"
|
||||
},
|
||||
"keywords": [
|
||||
"argument",
|
||||
"parser",
|
||||
"yargs",
|
||||
"command",
|
||||
"cli",
|
||||
"parsing",
|
||||
"option",
|
||||
"args",
|
||||
"argument"
|
||||
],
|
||||
"author": "Ben Coe <ben@npmjs.com>",
|
||||
"license": "ISC",
|
||||
"devDependencies": {
|
||||
"@types/chai": "^4.2.11",
|
||||
"@types/mocha": "^9.0.0",
|
||||
"@types/node": "^16.11.4",
|
||||
"@typescript-eslint/eslint-plugin": "^3.10.1",
|
||||
"@typescript-eslint/parser": "^3.10.1",
|
||||
"c8": "^7.3.0",
|
||||
"chai": "^4.2.0",
|
||||
"cross-env": "^7.0.2",
|
||||
"eslint": "^7.0.0",
|
||||
"eslint-plugin-import": "^2.20.1",
|
||||
"eslint-plugin-node": "^11.0.0",
|
||||
"gts": "^3.0.0",
|
||||
"mocha": "^10.0.0",
|
||||
"puppeteer": "^16.0.0",
|
||||
"rimraf": "^3.0.2",
|
||||
"rollup": "^2.22.1",
|
||||
"rollup-plugin-cleanup": "^3.1.1",
|
||||
"rollup-plugin-ts": "^3.0.2",
|
||||
"serve": "^14.0.0",
|
||||
"standardx": "^7.0.0",
|
||||
"start-server-and-test": "^1.11.2",
|
||||
"ts-transform-default-export": "^1.0.2",
|
||||
"typescript": "^4.0.0"
|
||||
},
|
||||
"files": [
|
||||
"browser.js",
|
||||
"build",
|
||||
"!*.d.ts",
|
||||
"!*.d.cts"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"standardx": {
|
||||
"ignore": [
|
||||
"build"
|
||||
]
|
||||
}
|
||||
}
|
||||
21
node_modules/@grpc/proto-loader/node_modules/yargs/LICENSE
generated
vendored
Normal file
21
node_modules/@grpc/proto-loader/node_modules/yargs/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright 2010 James Halliday (mail@substack.net); Modified work Copyright 2014 Contributors (ben@npmjs.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.
|
||||
204
node_modules/@grpc/proto-loader/node_modules/yargs/README.md
generated
vendored
Normal file
204
node_modules/@grpc/proto-loader/node_modules/yargs/README.md
generated
vendored
Normal file
@@ -0,0 +1,204 @@
|
||||
<p align="center">
|
||||
<img width="250" src="https://raw.githubusercontent.com/yargs/yargs/main/yargs-logo.png">
|
||||
</p>
|
||||
<h1 align="center"> Yargs </h1>
|
||||
<p align="center">
|
||||
<b >Yargs be a node.js library fer hearties tryin' ter parse optstrings</b>
|
||||
</p>
|
||||
|
||||
<br>
|
||||
|
||||

|
||||
[![NPM version][npm-image]][npm-url]
|
||||
[![js-standard-style][standard-image]][standard-url]
|
||||
[![Coverage][coverage-image]][coverage-url]
|
||||
[![Conventional Commits][conventional-commits-image]][conventional-commits-url]
|
||||
[![Slack][slack-image]][slack-url]
|
||||
|
||||
## Description
|
||||
Yargs helps you build interactive command line tools, by parsing arguments and generating an elegant user interface.
|
||||
|
||||
It gives you:
|
||||
|
||||
* commands and (grouped) options (`my-program.js serve --port=5000`).
|
||||
* a dynamically generated help menu based on your arguments:
|
||||
|
||||
```
|
||||
mocha [spec..]
|
||||
|
||||
Run tests with Mocha
|
||||
|
||||
Commands
|
||||
mocha inspect [spec..] Run tests with Mocha [default]
|
||||
mocha init <path> create a client-side Mocha setup at <path>
|
||||
|
||||
Rules & Behavior
|
||||
--allow-uncaught Allow uncaught errors to propagate [boolean]
|
||||
--async-only, -A Require all tests to use a callback (async) or
|
||||
return a Promise [boolean]
|
||||
```
|
||||
|
||||
* bash-completion shortcuts for commands and options.
|
||||
* and [tons more](/docs/api.md).
|
||||
|
||||
## Installation
|
||||
|
||||
Stable version:
|
||||
```bash
|
||||
npm i yargs
|
||||
```
|
||||
|
||||
Bleeding edge version with the most recent features:
|
||||
```bash
|
||||
npm i yargs@next
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### Simple Example
|
||||
|
||||
```javascript
|
||||
#!/usr/bin/env node
|
||||
const yargs = require('yargs/yargs')
|
||||
const { hideBin } = require('yargs/helpers')
|
||||
const argv = yargs(hideBin(process.argv)).argv
|
||||
|
||||
if (argv.ships > 3 && argv.distance < 53.5) {
|
||||
console.log('Plunder more riffiwobbles!')
|
||||
} else {
|
||||
console.log('Retreat from the xupptumblers!')
|
||||
}
|
||||
```
|
||||
|
||||
```bash
|
||||
$ ./plunder.js --ships=4 --distance=22
|
||||
Plunder more riffiwobbles!
|
||||
|
||||
$ ./plunder.js --ships 12 --distance 98.7
|
||||
Retreat from the xupptumblers!
|
||||
```
|
||||
|
||||
> Note: `hideBin` is a shorthand for [`process.argv.slice(2)`](https://nodejs.org/en/knowledge/command-line/how-to-parse-command-line-arguments/). It has the benefit that it takes into account variations in some environments, e.g., [Electron](https://github.com/electron/electron/issues/4690).
|
||||
|
||||
### Complex Example
|
||||
|
||||
```javascript
|
||||
#!/usr/bin/env node
|
||||
const yargs = require('yargs/yargs')
|
||||
const { hideBin } = require('yargs/helpers')
|
||||
|
||||
yargs(hideBin(process.argv))
|
||||
.command('serve [port]', 'start the server', (yargs) => {
|
||||
return yargs
|
||||
.positional('port', {
|
||||
describe: 'port to bind on',
|
||||
default: 5000
|
||||
})
|
||||
}, (argv) => {
|
||||
if (argv.verbose) console.info(`start server on :${argv.port}`)
|
||||
serve(argv.port)
|
||||
})
|
||||
.option('verbose', {
|
||||
alias: 'v',
|
||||
type: 'boolean',
|
||||
description: 'Run with verbose logging'
|
||||
})
|
||||
.parse()
|
||||
```
|
||||
|
||||
Run the example above with `--help` to see the help for the application.
|
||||
|
||||
## Supported Platforms
|
||||
|
||||
### TypeScript
|
||||
|
||||
yargs has type definitions at [@types/yargs][type-definitions].
|
||||
|
||||
```
|
||||
npm i @types/yargs --save-dev
|
||||
```
|
||||
|
||||
See usage examples in [docs](/docs/typescript.md).
|
||||
|
||||
### Deno
|
||||
|
||||
As of `v16`, `yargs` supports [Deno](https://github.com/denoland/deno):
|
||||
|
||||
```typescript
|
||||
import yargs from 'https://deno.land/x/yargs/deno.ts'
|
||||
import { Arguments } from 'https://deno.land/x/yargs/deno-types.ts'
|
||||
|
||||
yargs(Deno.args)
|
||||
.command('download <files...>', 'download a list of files', (yargs: any) => {
|
||||
return yargs.positional('files', {
|
||||
describe: 'a list of files to do something with'
|
||||
})
|
||||
}, (argv: Arguments) => {
|
||||
console.info(argv)
|
||||
})
|
||||
.strictCommands()
|
||||
.demandCommand(1)
|
||||
.parse()
|
||||
```
|
||||
|
||||
### ESM
|
||||
|
||||
As of `v16`,`yargs` supports ESM imports:
|
||||
|
||||
```js
|
||||
import yargs from 'yargs'
|
||||
import { hideBin } from 'yargs/helpers'
|
||||
|
||||
yargs(hideBin(process.argv))
|
||||
.command('curl <url>', 'fetch the contents of the URL', () => {}, (argv) => {
|
||||
console.info(argv)
|
||||
})
|
||||
.demandCommand(1)
|
||||
.parse()
|
||||
```
|
||||
|
||||
### Usage in Browser
|
||||
|
||||
See examples of using yargs in the browser in [docs](/docs/browser.md).
|
||||
|
||||
## Community
|
||||
|
||||
Having problems? want to contribute? join our [community slack](http://devtoolscommunity.herokuapp.com).
|
||||
|
||||
## Documentation
|
||||
|
||||
### Table of Contents
|
||||
|
||||
* [Yargs' API](/docs/api.md)
|
||||
* [Examples](/docs/examples.md)
|
||||
* [Parsing Tricks](/docs/tricks.md)
|
||||
* [Stop the Parser](/docs/tricks.md#stop)
|
||||
* [Negating Boolean Arguments](/docs/tricks.md#negate)
|
||||
* [Numbers](/docs/tricks.md#numbers)
|
||||
* [Arrays](/docs/tricks.md#arrays)
|
||||
* [Objects](/docs/tricks.md#objects)
|
||||
* [Quotes](/docs/tricks.md#quotes)
|
||||
* [Advanced Topics](/docs/advanced.md)
|
||||
* [Composing Your App Using Commands](/docs/advanced.md#commands)
|
||||
* [Building Configurable CLI Apps](/docs/advanced.md#configuration)
|
||||
* [Customizing Yargs' Parser](/docs/advanced.md#customizing)
|
||||
* [Bundling yargs](/docs/bundling.md)
|
||||
* [Contributing](/contributing.md)
|
||||
|
||||
## 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).
|
||||
|
||||
[npm-url]: https://www.npmjs.com/package/yargs
|
||||
[npm-image]: https://img.shields.io/npm/v/yargs.svg
|
||||
[standard-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg
|
||||
[standard-url]: http://standardjs.com/
|
||||
[conventional-commits-image]: https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg
|
||||
[conventional-commits-url]: https://conventionalcommits.org/
|
||||
[slack-image]: http://devtoolscommunity.herokuapp.com/badge.svg
|
||||
[slack-url]: http://devtoolscommunity.herokuapp.com
|
||||
[type-definitions]: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/yargs
|
||||
[coverage-image]: https://img.shields.io/nycrc/yargs/yargs
|
||||
[coverage-url]: https://github.com/yargs/yargs/blob/main/.nycrc
|
||||
5
node_modules/@grpc/proto-loader/node_modules/yargs/browser.d.ts
generated
vendored
Normal file
5
node_modules/@grpc/proto-loader/node_modules/yargs/browser.d.ts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import {YargsFactory} from './build/lib/yargs-factory';
|
||||
|
||||
declare const Yargs: ReturnType<typeof YargsFactory>;
|
||||
|
||||
export default Yargs;
|
||||
7
node_modules/@grpc/proto-loader/node_modules/yargs/browser.mjs
generated
vendored
Normal file
7
node_modules/@grpc/proto-loader/node_modules/yargs/browser.mjs
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
// Bootstrap yargs for browser:
|
||||
import browserPlatformShim from './lib/platform-shims/browser.mjs';
|
||||
import {YargsFactory} from './build/lib/yargs-factory.js';
|
||||
|
||||
const Yargs = YargsFactory(browserPlatformShim);
|
||||
|
||||
export default Yargs;
|
||||
1
node_modules/@grpc/proto-loader/node_modules/yargs/build/index.cjs
generated
vendored
Normal file
1
node_modules/@grpc/proto-loader/node_modules/yargs/build/index.cjs
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
62
node_modules/@grpc/proto-loader/node_modules/yargs/build/lib/argsert.js
generated
vendored
Normal file
62
node_modules/@grpc/proto-loader/node_modules/yargs/build/lib/argsert.js
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
import { YError } from './yerror.js';
|
||||
import { parseCommand } from './parse-command.js';
|
||||
const positionName = ['first', 'second', 'third', 'fourth', 'fifth', 'sixth'];
|
||||
export function argsert(arg1, arg2, arg3) {
|
||||
function parseArgs() {
|
||||
return typeof arg1 === 'object'
|
||||
? [{ demanded: [], optional: [] }, arg1, arg2]
|
||||
: [
|
||||
parseCommand(`cmd ${arg1}`),
|
||||
arg2,
|
||||
arg3,
|
||||
];
|
||||
}
|
||||
try {
|
||||
let position = 0;
|
||||
const [parsed, callerArguments, _length] = parseArgs();
|
||||
const args = [].slice.call(callerArguments);
|
||||
while (args.length && args[args.length - 1] === undefined)
|
||||
args.pop();
|
||||
const length = _length || args.length;
|
||||
if (length < parsed.demanded.length) {
|
||||
throw new YError(`Not enough arguments provided. Expected ${parsed.demanded.length} but received ${args.length}.`);
|
||||
}
|
||||
const totalCommands = parsed.demanded.length + parsed.optional.length;
|
||||
if (length > totalCommands) {
|
||||
throw new YError(`Too many arguments provided. Expected max ${totalCommands} but received ${length}.`);
|
||||
}
|
||||
parsed.demanded.forEach(demanded => {
|
||||
const arg = args.shift();
|
||||
const observedType = guessType(arg);
|
||||
const matchingTypes = demanded.cmd.filter(type => type === observedType || type === '*');
|
||||
if (matchingTypes.length === 0)
|
||||
argumentTypeError(observedType, demanded.cmd, position);
|
||||
position += 1;
|
||||
});
|
||||
parsed.optional.forEach(optional => {
|
||||
if (args.length === 0)
|
||||
return;
|
||||
const arg = args.shift();
|
||||
const observedType = guessType(arg);
|
||||
const matchingTypes = optional.cmd.filter(type => type === observedType || type === '*');
|
||||
if (matchingTypes.length === 0)
|
||||
argumentTypeError(observedType, optional.cmd, position);
|
||||
position += 1;
|
||||
});
|
||||
}
|
||||
catch (err) {
|
||||
console.warn(err.stack);
|
||||
}
|
||||
}
|
||||
function guessType(arg) {
|
||||
if (Array.isArray(arg)) {
|
||||
return 'array';
|
||||
}
|
||||
else if (arg === null) {
|
||||
return 'null';
|
||||
}
|
||||
return typeof arg;
|
||||
}
|
||||
function argumentTypeError(observedType, allowedTypes, position) {
|
||||
throw new YError(`Invalid ${positionName[position] || 'manyith'} argument. Expected ${allowedTypes.join(' or ')} but received ${observedType}.`);
|
||||
}
|
||||
449
node_modules/@grpc/proto-loader/node_modules/yargs/build/lib/command.js
generated
vendored
Normal file
449
node_modules/@grpc/proto-loader/node_modules/yargs/build/lib/command.js
generated
vendored
Normal file
@@ -0,0 +1,449 @@
|
||||
import { assertNotStrictEqual, } from './typings/common-types.js';
|
||||
import { isPromise } from './utils/is-promise.js';
|
||||
import { applyMiddleware, commandMiddlewareFactory, } from './middleware.js';
|
||||
import { parseCommand } from './parse-command.js';
|
||||
import { isYargsInstance, } from './yargs-factory.js';
|
||||
import { maybeAsyncResult } from './utils/maybe-async-result.js';
|
||||
import whichModule from './utils/which-module.js';
|
||||
const DEFAULT_MARKER = /(^\*)|(^\$0)/;
|
||||
export class CommandInstance {
|
||||
constructor(usage, validation, globalMiddleware, shim) {
|
||||
this.requireCache = new Set();
|
||||
this.handlers = {};
|
||||
this.aliasMap = {};
|
||||
this.frozens = [];
|
||||
this.shim = shim;
|
||||
this.usage = usage;
|
||||
this.globalMiddleware = globalMiddleware;
|
||||
this.validation = validation;
|
||||
}
|
||||
addDirectory(dir, req, callerFile, opts) {
|
||||
opts = opts || {};
|
||||
if (typeof opts.recurse !== 'boolean')
|
||||
opts.recurse = false;
|
||||
if (!Array.isArray(opts.extensions))
|
||||
opts.extensions = ['js'];
|
||||
const parentVisit = typeof opts.visit === 'function' ? opts.visit : (o) => o;
|
||||
opts.visit = (obj, joined, filename) => {
|
||||
const visited = parentVisit(obj, joined, filename);
|
||||
if (visited) {
|
||||
if (this.requireCache.has(joined))
|
||||
return visited;
|
||||
else
|
||||
this.requireCache.add(joined);
|
||||
this.addHandler(visited);
|
||||
}
|
||||
return visited;
|
||||
};
|
||||
this.shim.requireDirectory({ require: req, filename: callerFile }, dir, opts);
|
||||
}
|
||||
addHandler(cmd, description, builder, handler, commandMiddleware, deprecated) {
|
||||
let aliases = [];
|
||||
const middlewares = commandMiddlewareFactory(commandMiddleware);
|
||||
handler = handler || (() => { });
|
||||
if (Array.isArray(cmd)) {
|
||||
if (isCommandAndAliases(cmd)) {
|
||||
[cmd, ...aliases] = cmd;
|
||||
}
|
||||
else {
|
||||
for (const command of cmd) {
|
||||
this.addHandler(command);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (isCommandHandlerDefinition(cmd)) {
|
||||
let command = Array.isArray(cmd.command) || typeof cmd.command === 'string'
|
||||
? cmd.command
|
||||
: this.moduleName(cmd);
|
||||
if (cmd.aliases)
|
||||
command = [].concat(command).concat(cmd.aliases);
|
||||
this.addHandler(command, this.extractDesc(cmd), cmd.builder, cmd.handler, cmd.middlewares, cmd.deprecated);
|
||||
return;
|
||||
}
|
||||
else if (isCommandBuilderDefinition(builder)) {
|
||||
this.addHandler([cmd].concat(aliases), description, builder.builder, builder.handler, builder.middlewares, builder.deprecated);
|
||||
return;
|
||||
}
|
||||
if (typeof cmd === 'string') {
|
||||
const parsedCommand = parseCommand(cmd);
|
||||
aliases = aliases.map(alias => parseCommand(alias).cmd);
|
||||
let isDefault = false;
|
||||
const parsedAliases = [parsedCommand.cmd].concat(aliases).filter(c => {
|
||||
if (DEFAULT_MARKER.test(c)) {
|
||||
isDefault = true;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
if (parsedAliases.length === 0 && isDefault)
|
||||
parsedAliases.push('$0');
|
||||
if (isDefault) {
|
||||
parsedCommand.cmd = parsedAliases[0];
|
||||
aliases = parsedAliases.slice(1);
|
||||
cmd = cmd.replace(DEFAULT_MARKER, parsedCommand.cmd);
|
||||
}
|
||||
aliases.forEach(alias => {
|
||||
this.aliasMap[alias] = parsedCommand.cmd;
|
||||
});
|
||||
if (description !== false) {
|
||||
this.usage.command(cmd, description, isDefault, aliases, deprecated);
|
||||
}
|
||||
this.handlers[parsedCommand.cmd] = {
|
||||
original: cmd,
|
||||
description,
|
||||
handler,
|
||||
builder: builder || {},
|
||||
middlewares,
|
||||
deprecated,
|
||||
demanded: parsedCommand.demanded,
|
||||
optional: parsedCommand.optional,
|
||||
};
|
||||
if (isDefault)
|
||||
this.defaultCommand = this.handlers[parsedCommand.cmd];
|
||||
}
|
||||
}
|
||||
getCommandHandlers() {
|
||||
return this.handlers;
|
||||
}
|
||||
getCommands() {
|
||||
return Object.keys(this.handlers).concat(Object.keys(this.aliasMap));
|
||||
}
|
||||
hasDefaultCommand() {
|
||||
return !!this.defaultCommand;
|
||||
}
|
||||
runCommand(command, yargs, parsed, commandIndex, helpOnly, helpOrVersionSet) {
|
||||
const commandHandler = this.handlers[command] ||
|
||||
this.handlers[this.aliasMap[command]] ||
|
||||
this.defaultCommand;
|
||||
const currentContext = yargs.getInternalMethods().getContext();
|
||||
const parentCommands = currentContext.commands.slice();
|
||||
const isDefaultCommand = !command;
|
||||
if (command) {
|
||||
currentContext.commands.push(command);
|
||||
currentContext.fullCommands.push(commandHandler.original);
|
||||
}
|
||||
const builderResult = this.applyBuilderUpdateUsageAndParse(isDefaultCommand, commandHandler, yargs, parsed.aliases, parentCommands, commandIndex, helpOnly, helpOrVersionSet);
|
||||
return isPromise(builderResult)
|
||||
? builderResult.then(result => this.applyMiddlewareAndGetResult(isDefaultCommand, commandHandler, result.innerArgv, currentContext, helpOnly, result.aliases, yargs))
|
||||
: this.applyMiddlewareAndGetResult(isDefaultCommand, commandHandler, builderResult.innerArgv, currentContext, helpOnly, builderResult.aliases, yargs);
|
||||
}
|
||||
applyBuilderUpdateUsageAndParse(isDefaultCommand, commandHandler, yargs, aliases, parentCommands, commandIndex, helpOnly, helpOrVersionSet) {
|
||||
const builder = commandHandler.builder;
|
||||
let innerYargs = yargs;
|
||||
if (isCommandBuilderCallback(builder)) {
|
||||
yargs.getInternalMethods().getUsageInstance().freeze();
|
||||
const builderOutput = builder(yargs.getInternalMethods().reset(aliases), helpOrVersionSet);
|
||||
if (isPromise(builderOutput)) {
|
||||
return builderOutput.then(output => {
|
||||
innerYargs = isYargsInstance(output) ? output : yargs;
|
||||
return this.parseAndUpdateUsage(isDefaultCommand, commandHandler, innerYargs, parentCommands, commandIndex, helpOnly);
|
||||
});
|
||||
}
|
||||
}
|
||||
else if (isCommandBuilderOptionDefinitions(builder)) {
|
||||
yargs.getInternalMethods().getUsageInstance().freeze();
|
||||
innerYargs = yargs.getInternalMethods().reset(aliases);
|
||||
Object.keys(commandHandler.builder).forEach(key => {
|
||||
innerYargs.option(key, builder[key]);
|
||||
});
|
||||
}
|
||||
return this.parseAndUpdateUsage(isDefaultCommand, commandHandler, innerYargs, parentCommands, commandIndex, helpOnly);
|
||||
}
|
||||
parseAndUpdateUsage(isDefaultCommand, commandHandler, innerYargs, parentCommands, commandIndex, helpOnly) {
|
||||
if (isDefaultCommand)
|
||||
innerYargs.getInternalMethods().getUsageInstance().unfreeze(true);
|
||||
if (this.shouldUpdateUsage(innerYargs)) {
|
||||
innerYargs
|
||||
.getInternalMethods()
|
||||
.getUsageInstance()
|
||||
.usage(this.usageFromParentCommandsCommandHandler(parentCommands, commandHandler), commandHandler.description);
|
||||
}
|
||||
const innerArgv = innerYargs
|
||||
.getInternalMethods()
|
||||
.runYargsParserAndExecuteCommands(null, undefined, true, commandIndex, helpOnly);
|
||||
return isPromise(innerArgv)
|
||||
? innerArgv.then(argv => ({
|
||||
aliases: innerYargs.parsed.aliases,
|
||||
innerArgv: argv,
|
||||
}))
|
||||
: {
|
||||
aliases: innerYargs.parsed.aliases,
|
||||
innerArgv: innerArgv,
|
||||
};
|
||||
}
|
||||
shouldUpdateUsage(yargs) {
|
||||
return (!yargs.getInternalMethods().getUsageInstance().getUsageDisabled() &&
|
||||
yargs.getInternalMethods().getUsageInstance().getUsage().length === 0);
|
||||
}
|
||||
usageFromParentCommandsCommandHandler(parentCommands, commandHandler) {
|
||||
const c = DEFAULT_MARKER.test(commandHandler.original)
|
||||
? commandHandler.original.replace(DEFAULT_MARKER, '').trim()
|
||||
: commandHandler.original;
|
||||
const pc = parentCommands.filter(c => {
|
||||
return !DEFAULT_MARKER.test(c);
|
||||
});
|
||||
pc.push(c);
|
||||
return `$0 ${pc.join(' ')}`;
|
||||
}
|
||||
handleValidationAndGetResult(isDefaultCommand, commandHandler, innerArgv, currentContext, aliases, yargs, middlewares, positionalMap) {
|
||||
if (!yargs.getInternalMethods().getHasOutput()) {
|
||||
const validation = yargs
|
||||
.getInternalMethods()
|
||||
.runValidation(aliases, positionalMap, yargs.parsed.error, isDefaultCommand);
|
||||
innerArgv = maybeAsyncResult(innerArgv, result => {
|
||||
validation(result);
|
||||
return result;
|
||||
});
|
||||
}
|
||||
if (commandHandler.handler && !yargs.getInternalMethods().getHasOutput()) {
|
||||
yargs.getInternalMethods().setHasOutput();
|
||||
const populateDoubleDash = !!yargs.getOptions().configuration['populate--'];
|
||||
yargs
|
||||
.getInternalMethods()
|
||||
.postProcess(innerArgv, populateDoubleDash, false, false);
|
||||
innerArgv = applyMiddleware(innerArgv, yargs, middlewares, false);
|
||||
innerArgv = maybeAsyncResult(innerArgv, result => {
|
||||
const handlerResult = commandHandler.handler(result);
|
||||
return isPromise(handlerResult)
|
||||
? handlerResult.then(() => result)
|
||||
: result;
|
||||
});
|
||||
if (!isDefaultCommand) {
|
||||
yargs.getInternalMethods().getUsageInstance().cacheHelpMessage();
|
||||
}
|
||||
if (isPromise(innerArgv) &&
|
||||
!yargs.getInternalMethods().hasParseCallback()) {
|
||||
innerArgv.catch(error => {
|
||||
try {
|
||||
yargs.getInternalMethods().getUsageInstance().fail(null, error);
|
||||
}
|
||||
catch (_err) {
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
if (!isDefaultCommand) {
|
||||
currentContext.commands.pop();
|
||||
currentContext.fullCommands.pop();
|
||||
}
|
||||
return innerArgv;
|
||||
}
|
||||
applyMiddlewareAndGetResult(isDefaultCommand, commandHandler, innerArgv, currentContext, helpOnly, aliases, yargs) {
|
||||
let positionalMap = {};
|
||||
if (helpOnly)
|
||||
return innerArgv;
|
||||
if (!yargs.getInternalMethods().getHasOutput()) {
|
||||
positionalMap = this.populatePositionals(commandHandler, innerArgv, currentContext, yargs);
|
||||
}
|
||||
const middlewares = this.globalMiddleware
|
||||
.getMiddleware()
|
||||
.slice(0)
|
||||
.concat(commandHandler.middlewares);
|
||||
const maybePromiseArgv = applyMiddleware(innerArgv, yargs, middlewares, true);
|
||||
return isPromise(maybePromiseArgv)
|
||||
? maybePromiseArgv.then(resolvedInnerArgv => this.handleValidationAndGetResult(isDefaultCommand, commandHandler, resolvedInnerArgv, currentContext, aliases, yargs, middlewares, positionalMap))
|
||||
: this.handleValidationAndGetResult(isDefaultCommand, commandHandler, maybePromiseArgv, currentContext, aliases, yargs, middlewares, positionalMap);
|
||||
}
|
||||
populatePositionals(commandHandler, argv, context, yargs) {
|
||||
argv._ = argv._.slice(context.commands.length);
|
||||
const demanded = commandHandler.demanded.slice(0);
|
||||
const optional = commandHandler.optional.slice(0);
|
||||
const positionalMap = {};
|
||||
this.validation.positionalCount(demanded.length, argv._.length);
|
||||
while (demanded.length) {
|
||||
const demand = demanded.shift();
|
||||
this.populatePositional(demand, argv, positionalMap);
|
||||
}
|
||||
while (optional.length) {
|
||||
const maybe = optional.shift();
|
||||
this.populatePositional(maybe, argv, positionalMap);
|
||||
}
|
||||
argv._ = context.commands.concat(argv._.map(a => '' + a));
|
||||
this.postProcessPositionals(argv, positionalMap, this.cmdToParseOptions(commandHandler.original), yargs);
|
||||
return positionalMap;
|
||||
}
|
||||
populatePositional(positional, argv, positionalMap) {
|
||||
const cmd = positional.cmd[0];
|
||||
if (positional.variadic) {
|
||||
positionalMap[cmd] = argv._.splice(0).map(String);
|
||||
}
|
||||
else {
|
||||
if (argv._.length)
|
||||
positionalMap[cmd] = [String(argv._.shift())];
|
||||
}
|
||||
}
|
||||
cmdToParseOptions(cmdString) {
|
||||
const parseOptions = {
|
||||
array: [],
|
||||
default: {},
|
||||
alias: {},
|
||||
demand: {},
|
||||
};
|
||||
const parsed = parseCommand(cmdString);
|
||||
parsed.demanded.forEach(d => {
|
||||
const [cmd, ...aliases] = d.cmd;
|
||||
if (d.variadic) {
|
||||
parseOptions.array.push(cmd);
|
||||
parseOptions.default[cmd] = [];
|
||||
}
|
||||
parseOptions.alias[cmd] = aliases;
|
||||
parseOptions.demand[cmd] = true;
|
||||
});
|
||||
parsed.optional.forEach(o => {
|
||||
const [cmd, ...aliases] = o.cmd;
|
||||
if (o.variadic) {
|
||||
parseOptions.array.push(cmd);
|
||||
parseOptions.default[cmd] = [];
|
||||
}
|
||||
parseOptions.alias[cmd] = aliases;
|
||||
});
|
||||
return parseOptions;
|
||||
}
|
||||
postProcessPositionals(argv, positionalMap, parseOptions, yargs) {
|
||||
const options = Object.assign({}, yargs.getOptions());
|
||||
options.default = Object.assign(parseOptions.default, options.default);
|
||||
for (const key of Object.keys(parseOptions.alias)) {
|
||||
options.alias[key] = (options.alias[key] || []).concat(parseOptions.alias[key]);
|
||||
}
|
||||
options.array = options.array.concat(parseOptions.array);
|
||||
options.config = {};
|
||||
const unparsed = [];
|
||||
Object.keys(positionalMap).forEach(key => {
|
||||
positionalMap[key].map(value => {
|
||||
if (options.configuration['unknown-options-as-args'])
|
||||
options.key[key] = true;
|
||||
unparsed.push(`--${key}`);
|
||||
unparsed.push(value);
|
||||
});
|
||||
});
|
||||
if (!unparsed.length)
|
||||
return;
|
||||
const config = Object.assign({}, options.configuration, {
|
||||
'populate--': false,
|
||||
});
|
||||
const parsed = this.shim.Parser.detailed(unparsed, Object.assign({}, options, {
|
||||
configuration: config,
|
||||
}));
|
||||
if (parsed.error) {
|
||||
yargs
|
||||
.getInternalMethods()
|
||||
.getUsageInstance()
|
||||
.fail(parsed.error.message, parsed.error);
|
||||
}
|
||||
else {
|
||||
const positionalKeys = Object.keys(positionalMap);
|
||||
Object.keys(positionalMap).forEach(key => {
|
||||
positionalKeys.push(...parsed.aliases[key]);
|
||||
});
|
||||
Object.keys(parsed.argv).forEach(key => {
|
||||
if (positionalKeys.includes(key)) {
|
||||
if (!positionalMap[key])
|
||||
positionalMap[key] = parsed.argv[key];
|
||||
if (!this.isInConfigs(yargs, key) &&
|
||||
!this.isDefaulted(yargs, key) &&
|
||||
Object.prototype.hasOwnProperty.call(argv, key) &&
|
||||
Object.prototype.hasOwnProperty.call(parsed.argv, key) &&
|
||||
(Array.isArray(argv[key]) || Array.isArray(parsed.argv[key]))) {
|
||||
argv[key] = [].concat(argv[key], parsed.argv[key]);
|
||||
}
|
||||
else {
|
||||
argv[key] = parsed.argv[key];
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
isDefaulted(yargs, key) {
|
||||
const { default: defaults } = yargs.getOptions();
|
||||
return (Object.prototype.hasOwnProperty.call(defaults, key) ||
|
||||
Object.prototype.hasOwnProperty.call(defaults, this.shim.Parser.camelCase(key)));
|
||||
}
|
||||
isInConfigs(yargs, key) {
|
||||
const { configObjects } = yargs.getOptions();
|
||||
return (configObjects.some(c => Object.prototype.hasOwnProperty.call(c, key)) ||
|
||||
configObjects.some(c => Object.prototype.hasOwnProperty.call(c, this.shim.Parser.camelCase(key))));
|
||||
}
|
||||
runDefaultBuilderOn(yargs) {
|
||||
if (!this.defaultCommand)
|
||||
return;
|
||||
if (this.shouldUpdateUsage(yargs)) {
|
||||
const commandString = DEFAULT_MARKER.test(this.defaultCommand.original)
|
||||
? this.defaultCommand.original
|
||||
: this.defaultCommand.original.replace(/^[^[\]<>]*/, '$0 ');
|
||||
yargs
|
||||
.getInternalMethods()
|
||||
.getUsageInstance()
|
||||
.usage(commandString, this.defaultCommand.description);
|
||||
}
|
||||
const builder = this.defaultCommand.builder;
|
||||
if (isCommandBuilderCallback(builder)) {
|
||||
return builder(yargs, true);
|
||||
}
|
||||
else if (!isCommandBuilderDefinition(builder)) {
|
||||
Object.keys(builder).forEach(key => {
|
||||
yargs.option(key, builder[key]);
|
||||
});
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
moduleName(obj) {
|
||||
const mod = whichModule(obj);
|
||||
if (!mod)
|
||||
throw new Error(`No command name given for module: ${this.shim.inspect(obj)}`);
|
||||
return this.commandFromFilename(mod.filename);
|
||||
}
|
||||
commandFromFilename(filename) {
|
||||
return this.shim.path.basename(filename, this.shim.path.extname(filename));
|
||||
}
|
||||
extractDesc({ describe, description, desc }) {
|
||||
for (const test of [describe, description, desc]) {
|
||||
if (typeof test === 'string' || test === false)
|
||||
return test;
|
||||
assertNotStrictEqual(test, true, this.shim);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
freeze() {
|
||||
this.frozens.push({
|
||||
handlers: this.handlers,
|
||||
aliasMap: this.aliasMap,
|
||||
defaultCommand: this.defaultCommand,
|
||||
});
|
||||
}
|
||||
unfreeze() {
|
||||
const frozen = this.frozens.pop();
|
||||
assertNotStrictEqual(frozen, undefined, this.shim);
|
||||
({
|
||||
handlers: this.handlers,
|
||||
aliasMap: this.aliasMap,
|
||||
defaultCommand: this.defaultCommand,
|
||||
} = frozen);
|
||||
}
|
||||
reset() {
|
||||
this.handlers = {};
|
||||
this.aliasMap = {};
|
||||
this.defaultCommand = undefined;
|
||||
this.requireCache = new Set();
|
||||
return this;
|
||||
}
|
||||
}
|
||||
export function command(usage, validation, globalMiddleware, shim) {
|
||||
return new CommandInstance(usage, validation, globalMiddleware, shim);
|
||||
}
|
||||
export function isCommandBuilderDefinition(builder) {
|
||||
return (typeof builder === 'object' &&
|
||||
!!builder.builder &&
|
||||
typeof builder.handler === 'function');
|
||||
}
|
||||
function isCommandAndAliases(cmd) {
|
||||
return cmd.every(c => typeof c === 'string');
|
||||
}
|
||||
export function isCommandBuilderCallback(builder) {
|
||||
return typeof builder === 'function';
|
||||
}
|
||||
function isCommandBuilderOptionDefinitions(builder) {
|
||||
return typeof builder === 'object';
|
||||
}
|
||||
export function isCommandHandlerDefinition(cmd) {
|
||||
return typeof cmd === 'object' && !Array.isArray(cmd);
|
||||
}
|
||||
48
node_modules/@grpc/proto-loader/node_modules/yargs/build/lib/completion-templates.js
generated
vendored
Normal file
48
node_modules/@grpc/proto-loader/node_modules/yargs/build/lib/completion-templates.js
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
export const completionShTemplate = `###-begin-{{app_name}}-completions-###
|
||||
#
|
||||
# yargs command completion script
|
||||
#
|
||||
# Installation: {{app_path}} {{completion_command}} >> ~/.bashrc
|
||||
# or {{app_path}} {{completion_command}} >> ~/.bash_profile on OSX.
|
||||
#
|
||||
_{{app_name}}_yargs_completions()
|
||||
{
|
||||
local cur_word args type_list
|
||||
|
||||
cur_word="\${COMP_WORDS[COMP_CWORD]}"
|
||||
args=("\${COMP_WORDS[@]}")
|
||||
|
||||
# ask yargs to generate completions.
|
||||
type_list=$({{app_path}} --get-yargs-completions "\${args[@]}")
|
||||
|
||||
COMPREPLY=( $(compgen -W "\${type_list}" -- \${cur_word}) )
|
||||
|
||||
# if no match was found, fall back to filename completion
|
||||
if [ \${#COMPREPLY[@]} -eq 0 ]; then
|
||||
COMPREPLY=()
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
complete -o bashdefault -o default -F _{{app_name}}_yargs_completions {{app_name}}
|
||||
###-end-{{app_name}}-completions-###
|
||||
`;
|
||||
export const completionZshTemplate = `#compdef {{app_name}}
|
||||
###-begin-{{app_name}}-completions-###
|
||||
#
|
||||
# yargs command completion script
|
||||
#
|
||||
# Installation: {{app_path}} {{completion_command}} >> ~/.zshrc
|
||||
# or {{app_path}} {{completion_command}} >> ~/.zprofile on OSX.
|
||||
#
|
||||
_{{app_name}}_yargs_completions()
|
||||
{
|
||||
local reply
|
||||
local si=$IFS
|
||||
IFS=$'\n' reply=($(COMP_CWORD="$((CURRENT-1))" COMP_LINE="$BUFFER" COMP_POINT="$CURSOR" {{app_path}} --get-yargs-completions "\${words[@]}"))
|
||||
IFS=$si
|
||||
_describe 'values' reply
|
||||
}
|
||||
compdef _{{app_name}}_yargs_completions {{app_name}}
|
||||
###-end-{{app_name}}-completions-###
|
||||
`;
|
||||
243
node_modules/@grpc/proto-loader/node_modules/yargs/build/lib/completion.js
generated
vendored
Normal file
243
node_modules/@grpc/proto-loader/node_modules/yargs/build/lib/completion.js
generated
vendored
Normal file
@@ -0,0 +1,243 @@
|
||||
import { isCommandBuilderCallback } from './command.js';
|
||||
import { assertNotStrictEqual } from './typings/common-types.js';
|
||||
import * as templates from './completion-templates.js';
|
||||
import { isPromise } from './utils/is-promise.js';
|
||||
import { parseCommand } from './parse-command.js';
|
||||
export class Completion {
|
||||
constructor(yargs, usage, command, shim) {
|
||||
var _a, _b, _c;
|
||||
this.yargs = yargs;
|
||||
this.usage = usage;
|
||||
this.command = command;
|
||||
this.shim = shim;
|
||||
this.completionKey = 'get-yargs-completions';
|
||||
this.aliases = null;
|
||||
this.customCompletionFunction = null;
|
||||
this.indexAfterLastReset = 0;
|
||||
this.zshShell =
|
||||
(_c = (((_a = this.shim.getEnv('SHELL')) === null || _a === void 0 ? void 0 : _a.includes('zsh')) ||
|
||||
((_b = this.shim.getEnv('ZSH_NAME')) === null || _b === void 0 ? void 0 : _b.includes('zsh')))) !== null && _c !== void 0 ? _c : false;
|
||||
}
|
||||
defaultCompletion(args, argv, current, done) {
|
||||
const handlers = this.command.getCommandHandlers();
|
||||
for (let i = 0, ii = args.length; i < ii; ++i) {
|
||||
if (handlers[args[i]] && handlers[args[i]].builder) {
|
||||
const builder = handlers[args[i]].builder;
|
||||
if (isCommandBuilderCallback(builder)) {
|
||||
this.indexAfterLastReset = i + 1;
|
||||
const y = this.yargs.getInternalMethods().reset();
|
||||
builder(y, true);
|
||||
return y.argv;
|
||||
}
|
||||
}
|
||||
}
|
||||
const completions = [];
|
||||
this.commandCompletions(completions, args, current);
|
||||
this.optionCompletions(completions, args, argv, current);
|
||||
this.choicesFromOptionsCompletions(completions, args, argv, current);
|
||||
this.choicesFromPositionalsCompletions(completions, args, argv, current);
|
||||
done(null, completions);
|
||||
}
|
||||
commandCompletions(completions, args, current) {
|
||||
const parentCommands = this.yargs
|
||||
.getInternalMethods()
|
||||
.getContext().commands;
|
||||
if (!current.match(/^-/) &&
|
||||
parentCommands[parentCommands.length - 1] !== current &&
|
||||
!this.previousArgHasChoices(args)) {
|
||||
this.usage.getCommands().forEach(usageCommand => {
|
||||
const commandName = parseCommand(usageCommand[0]).cmd;
|
||||
if (args.indexOf(commandName) === -1) {
|
||||
if (!this.zshShell) {
|
||||
completions.push(commandName);
|
||||
}
|
||||
else {
|
||||
const desc = usageCommand[1] || '';
|
||||
completions.push(commandName.replace(/:/g, '\\:') + ':' + desc);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
optionCompletions(completions, args, argv, current) {
|
||||
if ((current.match(/^-/) || (current === '' && completions.length === 0)) &&
|
||||
!this.previousArgHasChoices(args)) {
|
||||
const options = this.yargs.getOptions();
|
||||
const positionalKeys = this.yargs.getGroups()[this.usage.getPositionalGroupName()] || [];
|
||||
Object.keys(options.key).forEach(key => {
|
||||
const negable = !!options.configuration['boolean-negation'] &&
|
||||
options.boolean.includes(key);
|
||||
const isPositionalKey = positionalKeys.includes(key);
|
||||
if (!isPositionalKey &&
|
||||
!options.hiddenOptions.includes(key) &&
|
||||
!this.argsContainKey(args, key, negable)) {
|
||||
this.completeOptionKey(key, completions, current, negable && !!options.default[key]);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
choicesFromOptionsCompletions(completions, args, argv, current) {
|
||||
if (this.previousArgHasChoices(args)) {
|
||||
const choices = this.getPreviousArgChoices(args);
|
||||
if (choices && choices.length > 0) {
|
||||
completions.push(...choices.map(c => c.replace(/:/g, '\\:')));
|
||||
}
|
||||
}
|
||||
}
|
||||
choicesFromPositionalsCompletions(completions, args, argv, current) {
|
||||
if (current === '' &&
|
||||
completions.length > 0 &&
|
||||
this.previousArgHasChoices(args)) {
|
||||
return;
|
||||
}
|
||||
const positionalKeys = this.yargs.getGroups()[this.usage.getPositionalGroupName()] || [];
|
||||
const offset = Math.max(this.indexAfterLastReset, this.yargs.getInternalMethods().getContext().commands.length +
|
||||
1);
|
||||
const positionalKey = positionalKeys[argv._.length - offset - 1];
|
||||
if (!positionalKey) {
|
||||
return;
|
||||
}
|
||||
const choices = this.yargs.getOptions().choices[positionalKey] || [];
|
||||
for (const choice of choices) {
|
||||
if (choice.startsWith(current)) {
|
||||
completions.push(choice.replace(/:/g, '\\:'));
|
||||
}
|
||||
}
|
||||
}
|
||||
getPreviousArgChoices(args) {
|
||||
if (args.length < 1)
|
||||
return;
|
||||
let previousArg = args[args.length - 1];
|
||||
let filter = '';
|
||||
if (!previousArg.startsWith('-') && args.length > 1) {
|
||||
filter = previousArg;
|
||||
previousArg = args[args.length - 2];
|
||||
}
|
||||
if (!previousArg.startsWith('-'))
|
||||
return;
|
||||
const previousArgKey = previousArg.replace(/^-+/, '');
|
||||
const options = this.yargs.getOptions();
|
||||
const possibleAliases = [
|
||||
previousArgKey,
|
||||
...(this.yargs.getAliases()[previousArgKey] || []),
|
||||
];
|
||||
let choices;
|
||||
for (const possibleAlias of possibleAliases) {
|
||||
if (Object.prototype.hasOwnProperty.call(options.key, possibleAlias) &&
|
||||
Array.isArray(options.choices[possibleAlias])) {
|
||||
choices = options.choices[possibleAlias];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (choices) {
|
||||
return choices.filter(choice => !filter || choice.startsWith(filter));
|
||||
}
|
||||
}
|
||||
previousArgHasChoices(args) {
|
||||
const choices = this.getPreviousArgChoices(args);
|
||||
return choices !== undefined && choices.length > 0;
|
||||
}
|
||||
argsContainKey(args, key, negable) {
|
||||
const argsContains = (s) => args.indexOf((/^[^0-9]$/.test(s) ? '-' : '--') + s) !== -1;
|
||||
if (argsContains(key))
|
||||
return true;
|
||||
if (negable && argsContains(`no-${key}`))
|
||||
return true;
|
||||
if (this.aliases) {
|
||||
for (const alias of this.aliases[key]) {
|
||||
if (argsContains(alias))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
completeOptionKey(key, completions, current, negable) {
|
||||
var _a, _b, _c, _d;
|
||||
let keyWithDesc = key;
|
||||
if (this.zshShell) {
|
||||
const descs = this.usage.getDescriptions();
|
||||
const aliasKey = (_b = (_a = this === null || this === void 0 ? void 0 : this.aliases) === null || _a === void 0 ? void 0 : _a[key]) === null || _b === void 0 ? void 0 : _b.find(alias => {
|
||||
const desc = descs[alias];
|
||||
return typeof desc === 'string' && desc.length > 0;
|
||||
});
|
||||
const descFromAlias = aliasKey ? descs[aliasKey] : undefined;
|
||||
const desc = (_d = (_c = descs[key]) !== null && _c !== void 0 ? _c : descFromAlias) !== null && _d !== void 0 ? _d : '';
|
||||
keyWithDesc = `${key.replace(/:/g, '\\:')}:${desc
|
||||
.replace('__yargsString__:', '')
|
||||
.replace(/(\r\n|\n|\r)/gm, ' ')}`;
|
||||
}
|
||||
const startsByTwoDashes = (s) => /^--/.test(s);
|
||||
const isShortOption = (s) => /^[^0-9]$/.test(s);
|
||||
const dashes = !startsByTwoDashes(current) && isShortOption(key) ? '-' : '--';
|
||||
completions.push(dashes + keyWithDesc);
|
||||
if (negable) {
|
||||
completions.push(dashes + 'no-' + keyWithDesc);
|
||||
}
|
||||
}
|
||||
customCompletion(args, argv, current, done) {
|
||||
assertNotStrictEqual(this.customCompletionFunction, null, this.shim);
|
||||
if (isSyncCompletionFunction(this.customCompletionFunction)) {
|
||||
const result = this.customCompletionFunction(current, argv);
|
||||
if (isPromise(result)) {
|
||||
return result
|
||||
.then(list => {
|
||||
this.shim.process.nextTick(() => {
|
||||
done(null, list);
|
||||
});
|
||||
})
|
||||
.catch(err => {
|
||||
this.shim.process.nextTick(() => {
|
||||
done(err, undefined);
|
||||
});
|
||||
});
|
||||
}
|
||||
return done(null, result);
|
||||
}
|
||||
else if (isFallbackCompletionFunction(this.customCompletionFunction)) {
|
||||
return this.customCompletionFunction(current, argv, (onCompleted = done) => this.defaultCompletion(args, argv, current, onCompleted), completions => {
|
||||
done(null, completions);
|
||||
});
|
||||
}
|
||||
else {
|
||||
return this.customCompletionFunction(current, argv, completions => {
|
||||
done(null, completions);
|
||||
});
|
||||
}
|
||||
}
|
||||
getCompletion(args, done) {
|
||||
const current = args.length ? args[args.length - 1] : '';
|
||||
const argv = this.yargs.parse(args, true);
|
||||
const completionFunction = this.customCompletionFunction
|
||||
? (argv) => this.customCompletion(args, argv, current, done)
|
||||
: (argv) => this.defaultCompletion(args, argv, current, done);
|
||||
return isPromise(argv)
|
||||
? argv.then(completionFunction)
|
||||
: completionFunction(argv);
|
||||
}
|
||||
generateCompletionScript($0, cmd) {
|
||||
let script = this.zshShell
|
||||
? templates.completionZshTemplate
|
||||
: templates.completionShTemplate;
|
||||
const name = this.shim.path.basename($0);
|
||||
if ($0.match(/\.js$/))
|
||||
$0 = `./${$0}`;
|
||||
script = script.replace(/{{app_name}}/g, name);
|
||||
script = script.replace(/{{completion_command}}/g, cmd);
|
||||
return script.replace(/{{app_path}}/g, $0);
|
||||
}
|
||||
registerFunction(fn) {
|
||||
this.customCompletionFunction = fn;
|
||||
}
|
||||
setParsed(parsed) {
|
||||
this.aliases = parsed.aliases;
|
||||
}
|
||||
}
|
||||
export function completion(yargs, usage, command, shim) {
|
||||
return new Completion(yargs, usage, command, shim);
|
||||
}
|
||||
function isSyncCompletionFunction(completionFunction) {
|
||||
return completionFunction.length < 3;
|
||||
}
|
||||
function isFallbackCompletionFunction(completionFunction) {
|
||||
return completionFunction.length > 3;
|
||||
}
|
||||
88
node_modules/@grpc/proto-loader/node_modules/yargs/build/lib/middleware.js
generated
vendored
Normal file
88
node_modules/@grpc/proto-loader/node_modules/yargs/build/lib/middleware.js
generated
vendored
Normal file
@@ -0,0 +1,88 @@
|
||||
import { argsert } from './argsert.js';
|
||||
import { isPromise } from './utils/is-promise.js';
|
||||
export class GlobalMiddleware {
|
||||
constructor(yargs) {
|
||||
this.globalMiddleware = [];
|
||||
this.frozens = [];
|
||||
this.yargs = yargs;
|
||||
}
|
||||
addMiddleware(callback, applyBeforeValidation, global = true, mutates = false) {
|
||||
argsert('<array|function> [boolean] [boolean] [boolean]', [callback, applyBeforeValidation, global], arguments.length);
|
||||
if (Array.isArray(callback)) {
|
||||
for (let i = 0; i < callback.length; i++) {
|
||||
if (typeof callback[i] !== 'function') {
|
||||
throw Error('middleware must be a function');
|
||||
}
|
||||
const m = callback[i];
|
||||
m.applyBeforeValidation = applyBeforeValidation;
|
||||
m.global = global;
|
||||
}
|
||||
Array.prototype.push.apply(this.globalMiddleware, callback);
|
||||
}
|
||||
else if (typeof callback === 'function') {
|
||||
const m = callback;
|
||||
m.applyBeforeValidation = applyBeforeValidation;
|
||||
m.global = global;
|
||||
m.mutates = mutates;
|
||||
this.globalMiddleware.push(callback);
|
||||
}
|
||||
return this.yargs;
|
||||
}
|
||||
addCoerceMiddleware(callback, option) {
|
||||
const aliases = this.yargs.getAliases();
|
||||
this.globalMiddleware = this.globalMiddleware.filter(m => {
|
||||
const toCheck = [...(aliases[option] || []), option];
|
||||
if (!m.option)
|
||||
return true;
|
||||
else
|
||||
return !toCheck.includes(m.option);
|
||||
});
|
||||
callback.option = option;
|
||||
return this.addMiddleware(callback, true, true, true);
|
||||
}
|
||||
getMiddleware() {
|
||||
return this.globalMiddleware;
|
||||
}
|
||||
freeze() {
|
||||
this.frozens.push([...this.globalMiddleware]);
|
||||
}
|
||||
unfreeze() {
|
||||
const frozen = this.frozens.pop();
|
||||
if (frozen !== undefined)
|
||||
this.globalMiddleware = frozen;
|
||||
}
|
||||
reset() {
|
||||
this.globalMiddleware = this.globalMiddleware.filter(m => m.global);
|
||||
}
|
||||
}
|
||||
export function commandMiddlewareFactory(commandMiddleware) {
|
||||
if (!commandMiddleware)
|
||||
return [];
|
||||
return commandMiddleware.map(middleware => {
|
||||
middleware.applyBeforeValidation = false;
|
||||
return middleware;
|
||||
});
|
||||
}
|
||||
export function applyMiddleware(argv, yargs, middlewares, beforeValidation) {
|
||||
return middlewares.reduce((acc, middleware) => {
|
||||
if (middleware.applyBeforeValidation !== beforeValidation) {
|
||||
return acc;
|
||||
}
|
||||
if (middleware.mutates) {
|
||||
if (middleware.applied)
|
||||
return acc;
|
||||
middleware.applied = true;
|
||||
}
|
||||
if (isPromise(acc)) {
|
||||
return acc
|
||||
.then(initialObj => Promise.all([initialObj, middleware(initialObj, yargs)]))
|
||||
.then(([initialObj, middlewareObj]) => Object.assign(initialObj, middlewareObj));
|
||||
}
|
||||
else {
|
||||
const result = middleware(acc, yargs);
|
||||
return isPromise(result)
|
||||
? result.then(middlewareObj => Object.assign(acc, middlewareObj))
|
||||
: Object.assign(acc, result);
|
||||
}
|
||||
}, argv);
|
||||
}
|
||||
32
node_modules/@grpc/proto-loader/node_modules/yargs/build/lib/parse-command.js
generated
vendored
Normal file
32
node_modules/@grpc/proto-loader/node_modules/yargs/build/lib/parse-command.js
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
export function parseCommand(cmd) {
|
||||
const extraSpacesStrippedCommand = cmd.replace(/\s{2,}/g, ' ');
|
||||
const splitCommand = extraSpacesStrippedCommand.split(/\s+(?![^[]*]|[^<]*>)/);
|
||||
const bregex = /\.*[\][<>]/g;
|
||||
const firstCommand = splitCommand.shift();
|
||||
if (!firstCommand)
|
||||
throw new Error(`No command found in: ${cmd}`);
|
||||
const parsedCommand = {
|
||||
cmd: firstCommand.replace(bregex, ''),
|
||||
demanded: [],
|
||||
optional: [],
|
||||
};
|
||||
splitCommand.forEach((cmd, i) => {
|
||||
let variadic = false;
|
||||
cmd = cmd.replace(/\s/g, '');
|
||||
if (/\.+[\]>]/.test(cmd) && i === splitCommand.length - 1)
|
||||
variadic = true;
|
||||
if (/^\[/.test(cmd)) {
|
||||
parsedCommand.optional.push({
|
||||
cmd: cmd.replace(bregex, '').split('|'),
|
||||
variadic,
|
||||
});
|
||||
}
|
||||
else {
|
||||
parsedCommand.demanded.push({
|
||||
cmd: cmd.replace(bregex, '').split('|'),
|
||||
variadic,
|
||||
});
|
||||
}
|
||||
});
|
||||
return parsedCommand;
|
||||
}
|
||||
9
node_modules/@grpc/proto-loader/node_modules/yargs/build/lib/typings/common-types.js
generated
vendored
Normal file
9
node_modules/@grpc/proto-loader/node_modules/yargs/build/lib/typings/common-types.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
export function assertNotStrictEqual(actual, expected, shim, message) {
|
||||
shim.assert.notStrictEqual(actual, expected, message);
|
||||
}
|
||||
export function assertSingleKey(actual, shim) {
|
||||
shim.assert.strictEqual(typeof actual, 'string');
|
||||
}
|
||||
export function objectKeys(object) {
|
||||
return Object.keys(object);
|
||||
}
|
||||
1
node_modules/@grpc/proto-loader/node_modules/yargs/build/lib/typings/yargs-parser-types.js
generated
vendored
Normal file
1
node_modules/@grpc/proto-loader/node_modules/yargs/build/lib/typings/yargs-parser-types.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
584
node_modules/@grpc/proto-loader/node_modules/yargs/build/lib/usage.js
generated
vendored
Normal file
584
node_modules/@grpc/proto-loader/node_modules/yargs/build/lib/usage.js
generated
vendored
Normal file
@@ -0,0 +1,584 @@
|
||||
import { objFilter } from './utils/obj-filter.js';
|
||||
import { YError } from './yerror.js';
|
||||
import setBlocking from './utils/set-blocking.js';
|
||||
function isBoolean(fail) {
|
||||
return typeof fail === 'boolean';
|
||||
}
|
||||
export function usage(yargs, shim) {
|
||||
const __ = shim.y18n.__;
|
||||
const self = {};
|
||||
const fails = [];
|
||||
self.failFn = function failFn(f) {
|
||||
fails.push(f);
|
||||
};
|
||||
let failMessage = null;
|
||||
let globalFailMessage = null;
|
||||
let showHelpOnFail = true;
|
||||
self.showHelpOnFail = function showHelpOnFailFn(arg1 = true, arg2) {
|
||||
const [enabled, message] = typeof arg1 === 'string' ? [true, arg1] : [arg1, arg2];
|
||||
if (yargs.getInternalMethods().isGlobalContext()) {
|
||||
globalFailMessage = message;
|
||||
}
|
||||
failMessage = message;
|
||||
showHelpOnFail = enabled;
|
||||
return self;
|
||||
};
|
||||
let failureOutput = false;
|
||||
self.fail = function fail(msg, err) {
|
||||
const logger = yargs.getInternalMethods().getLoggerInstance();
|
||||
if (fails.length) {
|
||||
for (let i = fails.length - 1; i >= 0; --i) {
|
||||
const fail = fails[i];
|
||||
if (isBoolean(fail)) {
|
||||
if (err)
|
||||
throw err;
|
||||
else if (msg)
|
||||
throw Error(msg);
|
||||
}
|
||||
else {
|
||||
fail(msg, err, self);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (yargs.getExitProcess())
|
||||
setBlocking(true);
|
||||
if (!failureOutput) {
|
||||
failureOutput = true;
|
||||
if (showHelpOnFail) {
|
||||
yargs.showHelp('error');
|
||||
logger.error();
|
||||
}
|
||||
if (msg || err)
|
||||
logger.error(msg || err);
|
||||
const globalOrCommandFailMessage = failMessage || globalFailMessage;
|
||||
if (globalOrCommandFailMessage) {
|
||||
if (msg || err)
|
||||
logger.error('');
|
||||
logger.error(globalOrCommandFailMessage);
|
||||
}
|
||||
}
|
||||
err = err || new YError(msg);
|
||||
if (yargs.getExitProcess()) {
|
||||
return yargs.exit(1);
|
||||
}
|
||||
else if (yargs.getInternalMethods().hasParseCallback()) {
|
||||
return yargs.exit(1, err);
|
||||
}
|
||||
else {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
};
|
||||
let usages = [];
|
||||
let usageDisabled = false;
|
||||
self.usage = (msg, description) => {
|
||||
if (msg === null) {
|
||||
usageDisabled = true;
|
||||
usages = [];
|
||||
return self;
|
||||
}
|
||||
usageDisabled = false;
|
||||
usages.push([msg, description || '']);
|
||||
return self;
|
||||
};
|
||||
self.getUsage = () => {
|
||||
return usages;
|
||||
};
|
||||
self.getUsageDisabled = () => {
|
||||
return usageDisabled;
|
||||
};
|
||||
self.getPositionalGroupName = () => {
|
||||
return __('Positionals:');
|
||||
};
|
||||
let examples = [];
|
||||
self.example = (cmd, description) => {
|
||||
examples.push([cmd, description || '']);
|
||||
};
|
||||
let commands = [];
|
||||
self.command = function command(cmd, description, isDefault, aliases, deprecated = false) {
|
||||
if (isDefault) {
|
||||
commands = commands.map(cmdArray => {
|
||||
cmdArray[2] = false;
|
||||
return cmdArray;
|
||||
});
|
||||
}
|
||||
commands.push([cmd, description || '', isDefault, aliases, deprecated]);
|
||||
};
|
||||
self.getCommands = () => commands;
|
||||
let descriptions = {};
|
||||
self.describe = function describe(keyOrKeys, desc) {
|
||||
if (Array.isArray(keyOrKeys)) {
|
||||
keyOrKeys.forEach(k => {
|
||||
self.describe(k, desc);
|
||||
});
|
||||
}
|
||||
else if (typeof keyOrKeys === 'object') {
|
||||
Object.keys(keyOrKeys).forEach(k => {
|
||||
self.describe(k, keyOrKeys[k]);
|
||||
});
|
||||
}
|
||||
else {
|
||||
descriptions[keyOrKeys] = desc;
|
||||
}
|
||||
};
|
||||
self.getDescriptions = () => descriptions;
|
||||
let epilogs = [];
|
||||
self.epilog = msg => {
|
||||
epilogs.push(msg);
|
||||
};
|
||||
let wrapSet = false;
|
||||
let wrap;
|
||||
self.wrap = cols => {
|
||||
wrapSet = true;
|
||||
wrap = cols;
|
||||
};
|
||||
self.getWrap = () => {
|
||||
if (shim.getEnv('YARGS_DISABLE_WRAP')) {
|
||||
return null;
|
||||
}
|
||||
if (!wrapSet) {
|
||||
wrap = windowWidth();
|
||||
wrapSet = true;
|
||||
}
|
||||
return wrap;
|
||||
};
|
||||
const deferY18nLookupPrefix = '__yargsString__:';
|
||||
self.deferY18nLookup = str => deferY18nLookupPrefix + str;
|
||||
self.help = function help() {
|
||||
if (cachedHelpMessage)
|
||||
return cachedHelpMessage;
|
||||
normalizeAliases();
|
||||
const base$0 = yargs.customScriptName
|
||||
? yargs.$0
|
||||
: shim.path.basename(yargs.$0);
|
||||
const demandedOptions = yargs.getDemandedOptions();
|
||||
const demandedCommands = yargs.getDemandedCommands();
|
||||
const deprecatedOptions = yargs.getDeprecatedOptions();
|
||||
const groups = yargs.getGroups();
|
||||
const options = yargs.getOptions();
|
||||
let keys = [];
|
||||
keys = keys.concat(Object.keys(descriptions));
|
||||
keys = keys.concat(Object.keys(demandedOptions));
|
||||
keys = keys.concat(Object.keys(demandedCommands));
|
||||
keys = keys.concat(Object.keys(options.default));
|
||||
keys = keys.filter(filterHiddenOptions);
|
||||
keys = Object.keys(keys.reduce((acc, key) => {
|
||||
if (key !== '_')
|
||||
acc[key] = true;
|
||||
return acc;
|
||||
}, {}));
|
||||
const theWrap = self.getWrap();
|
||||
const ui = shim.cliui({
|
||||
width: theWrap,
|
||||
wrap: !!theWrap,
|
||||
});
|
||||
if (!usageDisabled) {
|
||||
if (usages.length) {
|
||||
usages.forEach(usage => {
|
||||
ui.div({ text: `${usage[0].replace(/\$0/g, base$0)}` });
|
||||
if (usage[1]) {
|
||||
ui.div({ text: `${usage[1]}`, padding: [1, 0, 0, 0] });
|
||||
}
|
||||
});
|
||||
ui.div();
|
||||
}
|
||||
else if (commands.length) {
|
||||
let u = null;
|
||||
if (demandedCommands._) {
|
||||
u = `${base$0} <${__('command')}>\n`;
|
||||
}
|
||||
else {
|
||||
u = `${base$0} [${__('command')}]\n`;
|
||||
}
|
||||
ui.div(`${u}`);
|
||||
}
|
||||
}
|
||||
if (commands.length > 1 || (commands.length === 1 && !commands[0][2])) {
|
||||
ui.div(__('Commands:'));
|
||||
const context = yargs.getInternalMethods().getContext();
|
||||
const parentCommands = context.commands.length
|
||||
? `${context.commands.join(' ')} `
|
||||
: '';
|
||||
if (yargs.getInternalMethods().getParserConfiguration()['sort-commands'] ===
|
||||
true) {
|
||||
commands = commands.sort((a, b) => a[0].localeCompare(b[0]));
|
||||
}
|
||||
const prefix = base$0 ? `${base$0} ` : '';
|
||||
commands.forEach(command => {
|
||||
const commandString = `${prefix}${parentCommands}${command[0].replace(/^\$0 ?/, '')}`;
|
||||
ui.span({
|
||||
text: commandString,
|
||||
padding: [0, 2, 0, 2],
|
||||
width: maxWidth(commands, theWrap, `${base$0}${parentCommands}`) + 4,
|
||||
}, { text: command[1] });
|
||||
const hints = [];
|
||||
if (command[2])
|
||||
hints.push(`[${__('default')}]`);
|
||||
if (command[3] && command[3].length) {
|
||||
hints.push(`[${__('aliases:')} ${command[3].join(', ')}]`);
|
||||
}
|
||||
if (command[4]) {
|
||||
if (typeof command[4] === 'string') {
|
||||
hints.push(`[${__('deprecated: %s', command[4])}]`);
|
||||
}
|
||||
else {
|
||||
hints.push(`[${__('deprecated')}]`);
|
||||
}
|
||||
}
|
||||
if (hints.length) {
|
||||
ui.div({
|
||||
text: hints.join(' '),
|
||||
padding: [0, 0, 0, 2],
|
||||
align: 'right',
|
||||
});
|
||||
}
|
||||
else {
|
||||
ui.div();
|
||||
}
|
||||
});
|
||||
ui.div();
|
||||
}
|
||||
const aliasKeys = (Object.keys(options.alias) || []).concat(Object.keys(yargs.parsed.newAliases) || []);
|
||||
keys = keys.filter(key => !yargs.parsed.newAliases[key] &&
|
||||
aliasKeys.every(alias => (options.alias[alias] || []).indexOf(key) === -1));
|
||||
const defaultGroup = __('Options:');
|
||||
if (!groups[defaultGroup])
|
||||
groups[defaultGroup] = [];
|
||||
addUngroupedKeys(keys, options.alias, groups, defaultGroup);
|
||||
const isLongSwitch = (sw) => /^--/.test(getText(sw));
|
||||
const displayedGroups = Object.keys(groups)
|
||||
.filter(groupName => groups[groupName].length > 0)
|
||||
.map(groupName => {
|
||||
const normalizedKeys = groups[groupName]
|
||||
.filter(filterHiddenOptions)
|
||||
.map(key => {
|
||||
if (aliasKeys.includes(key))
|
||||
return key;
|
||||
for (let i = 0, aliasKey; (aliasKey = aliasKeys[i]) !== undefined; i++) {
|
||||
if ((options.alias[aliasKey] || []).includes(key))
|
||||
return aliasKey;
|
||||
}
|
||||
return key;
|
||||
});
|
||||
return { groupName, normalizedKeys };
|
||||
})
|
||||
.filter(({ normalizedKeys }) => normalizedKeys.length > 0)
|
||||
.map(({ groupName, normalizedKeys }) => {
|
||||
const switches = normalizedKeys.reduce((acc, key) => {
|
||||
acc[key] = [key]
|
||||
.concat(options.alias[key] || [])
|
||||
.map(sw => {
|
||||
if (groupName === self.getPositionalGroupName())
|
||||
return sw;
|
||||
else {
|
||||
return ((/^[0-9]$/.test(sw)
|
||||
? options.boolean.includes(key)
|
||||
? '-'
|
||||
: '--'
|
||||
: sw.length > 1
|
||||
? '--'
|
||||
: '-') + sw);
|
||||
}
|
||||
})
|
||||
.sort((sw1, sw2) => isLongSwitch(sw1) === isLongSwitch(sw2)
|
||||
? 0
|
||||
: isLongSwitch(sw1)
|
||||
? 1
|
||||
: -1)
|
||||
.join(', ');
|
||||
return acc;
|
||||
}, {});
|
||||
return { groupName, normalizedKeys, switches };
|
||||
});
|
||||
const shortSwitchesUsed = displayedGroups
|
||||
.filter(({ groupName }) => groupName !== self.getPositionalGroupName())
|
||||
.some(({ normalizedKeys, switches }) => !normalizedKeys.every(key => isLongSwitch(switches[key])));
|
||||
if (shortSwitchesUsed) {
|
||||
displayedGroups
|
||||
.filter(({ groupName }) => groupName !== self.getPositionalGroupName())
|
||||
.forEach(({ normalizedKeys, switches }) => {
|
||||
normalizedKeys.forEach(key => {
|
||||
if (isLongSwitch(switches[key])) {
|
||||
switches[key] = addIndentation(switches[key], '-x, '.length);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
displayedGroups.forEach(({ groupName, normalizedKeys, switches }) => {
|
||||
ui.div(groupName);
|
||||
normalizedKeys.forEach(key => {
|
||||
const kswitch = switches[key];
|
||||
let desc = descriptions[key] || '';
|
||||
let type = null;
|
||||
if (desc.includes(deferY18nLookupPrefix))
|
||||
desc = __(desc.substring(deferY18nLookupPrefix.length));
|
||||
if (options.boolean.includes(key))
|
||||
type = `[${__('boolean')}]`;
|
||||
if (options.count.includes(key))
|
||||
type = `[${__('count')}]`;
|
||||
if (options.string.includes(key))
|
||||
type = `[${__('string')}]`;
|
||||
if (options.normalize.includes(key))
|
||||
type = `[${__('string')}]`;
|
||||
if (options.array.includes(key))
|
||||
type = `[${__('array')}]`;
|
||||
if (options.number.includes(key))
|
||||
type = `[${__('number')}]`;
|
||||
const deprecatedExtra = (deprecated) => typeof deprecated === 'string'
|
||||
? `[${__('deprecated: %s', deprecated)}]`
|
||||
: `[${__('deprecated')}]`;
|
||||
const extra = [
|
||||
key in deprecatedOptions
|
||||
? deprecatedExtra(deprecatedOptions[key])
|
||||
: null,
|
||||
type,
|
||||
key in demandedOptions ? `[${__('required')}]` : null,
|
||||
options.choices && options.choices[key]
|
||||
? `[${__('choices:')} ${self.stringifiedValues(options.choices[key])}]`
|
||||
: null,
|
||||
defaultString(options.default[key], options.defaultDescription[key]),
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join(' ');
|
||||
ui.span({
|
||||
text: getText(kswitch),
|
||||
padding: [0, 2, 0, 2 + getIndentation(kswitch)],
|
||||
width: maxWidth(switches, theWrap) + 4,
|
||||
}, desc);
|
||||
const shouldHideOptionExtras = yargs.getInternalMethods().getUsageConfiguration()['hide-types'] ===
|
||||
true;
|
||||
if (extra && !shouldHideOptionExtras)
|
||||
ui.div({ text: extra, padding: [0, 0, 0, 2], align: 'right' });
|
||||
else
|
||||
ui.div();
|
||||
});
|
||||
ui.div();
|
||||
});
|
||||
if (examples.length) {
|
||||
ui.div(__('Examples:'));
|
||||
examples.forEach(example => {
|
||||
example[0] = example[0].replace(/\$0/g, base$0);
|
||||
});
|
||||
examples.forEach(example => {
|
||||
if (example[1] === '') {
|
||||
ui.div({
|
||||
text: example[0],
|
||||
padding: [0, 2, 0, 2],
|
||||
});
|
||||
}
|
||||
else {
|
||||
ui.div({
|
||||
text: example[0],
|
||||
padding: [0, 2, 0, 2],
|
||||
width: maxWidth(examples, theWrap) + 4,
|
||||
}, {
|
||||
text: example[1],
|
||||
});
|
||||
}
|
||||
});
|
||||
ui.div();
|
||||
}
|
||||
if (epilogs.length > 0) {
|
||||
const e = epilogs
|
||||
.map(epilog => epilog.replace(/\$0/g, base$0))
|
||||
.join('\n');
|
||||
ui.div(`${e}\n`);
|
||||
}
|
||||
return ui.toString().replace(/\s*$/, '');
|
||||
};
|
||||
function maxWidth(table, theWrap, modifier) {
|
||||
let width = 0;
|
||||
if (!Array.isArray(table)) {
|
||||
table = Object.values(table).map(v => [v]);
|
||||
}
|
||||
table.forEach(v => {
|
||||
width = Math.max(shim.stringWidth(modifier ? `${modifier} ${getText(v[0])}` : getText(v[0])) + getIndentation(v[0]), width);
|
||||
});
|
||||
if (theWrap)
|
||||
width = Math.min(width, parseInt((theWrap * 0.5).toString(), 10));
|
||||
return width;
|
||||
}
|
||||
function normalizeAliases() {
|
||||
const demandedOptions = yargs.getDemandedOptions();
|
||||
const options = yargs.getOptions();
|
||||
(Object.keys(options.alias) || []).forEach(key => {
|
||||
options.alias[key].forEach(alias => {
|
||||
if (descriptions[alias])
|
||||
self.describe(key, descriptions[alias]);
|
||||
if (alias in demandedOptions)
|
||||
yargs.demandOption(key, demandedOptions[alias]);
|
||||
if (options.boolean.includes(alias))
|
||||
yargs.boolean(key);
|
||||
if (options.count.includes(alias))
|
||||
yargs.count(key);
|
||||
if (options.string.includes(alias))
|
||||
yargs.string(key);
|
||||
if (options.normalize.includes(alias))
|
||||
yargs.normalize(key);
|
||||
if (options.array.includes(alias))
|
||||
yargs.array(key);
|
||||
if (options.number.includes(alias))
|
||||
yargs.number(key);
|
||||
});
|
||||
});
|
||||
}
|
||||
let cachedHelpMessage;
|
||||
self.cacheHelpMessage = function () {
|
||||
cachedHelpMessage = this.help();
|
||||
};
|
||||
self.clearCachedHelpMessage = function () {
|
||||
cachedHelpMessage = undefined;
|
||||
};
|
||||
self.hasCachedHelpMessage = function () {
|
||||
return !!cachedHelpMessage;
|
||||
};
|
||||
function addUngroupedKeys(keys, aliases, groups, defaultGroup) {
|
||||
let groupedKeys = [];
|
||||
let toCheck = null;
|
||||
Object.keys(groups).forEach(group => {
|
||||
groupedKeys = groupedKeys.concat(groups[group]);
|
||||
});
|
||||
keys.forEach(key => {
|
||||
toCheck = [key].concat(aliases[key]);
|
||||
if (!toCheck.some(k => groupedKeys.indexOf(k) !== -1)) {
|
||||
groups[defaultGroup].push(key);
|
||||
}
|
||||
});
|
||||
return groupedKeys;
|
||||
}
|
||||
function filterHiddenOptions(key) {
|
||||
return (yargs.getOptions().hiddenOptions.indexOf(key) < 0 ||
|
||||
yargs.parsed.argv[yargs.getOptions().showHiddenOpt]);
|
||||
}
|
||||
self.showHelp = (level) => {
|
||||
const logger = yargs.getInternalMethods().getLoggerInstance();
|
||||
if (!level)
|
||||
level = 'error';
|
||||
const emit = typeof level === 'function' ? level : logger[level];
|
||||
emit(self.help());
|
||||
};
|
||||
self.functionDescription = fn => {
|
||||
const description = fn.name
|
||||
? shim.Parser.decamelize(fn.name, '-')
|
||||
: __('generated-value');
|
||||
return ['(', description, ')'].join('');
|
||||
};
|
||||
self.stringifiedValues = function stringifiedValues(values, separator) {
|
||||
let string = '';
|
||||
const sep = separator || ', ';
|
||||
const array = [].concat(values);
|
||||
if (!values || !array.length)
|
||||
return string;
|
||||
array.forEach(value => {
|
||||
if (string.length)
|
||||
string += sep;
|
||||
string += JSON.stringify(value);
|
||||
});
|
||||
return string;
|
||||
};
|
||||
function defaultString(value, defaultDescription) {
|
||||
let string = `[${__('default:')} `;
|
||||
if (value === undefined && !defaultDescription)
|
||||
return null;
|
||||
if (defaultDescription) {
|
||||
string += defaultDescription;
|
||||
}
|
||||
else {
|
||||
switch (typeof value) {
|
||||
case 'string':
|
||||
string += `"${value}"`;
|
||||
break;
|
||||
case 'object':
|
||||
string += JSON.stringify(value);
|
||||
break;
|
||||
default:
|
||||
string += value;
|
||||
}
|
||||
}
|
||||
return `${string}]`;
|
||||
}
|
||||
function windowWidth() {
|
||||
const maxWidth = 80;
|
||||
if (shim.process.stdColumns) {
|
||||
return Math.min(maxWidth, shim.process.stdColumns);
|
||||
}
|
||||
else {
|
||||
return maxWidth;
|
||||
}
|
||||
}
|
||||
let version = null;
|
||||
self.version = ver => {
|
||||
version = ver;
|
||||
};
|
||||
self.showVersion = level => {
|
||||
const logger = yargs.getInternalMethods().getLoggerInstance();
|
||||
if (!level)
|
||||
level = 'error';
|
||||
const emit = typeof level === 'function' ? level : logger[level];
|
||||
emit(version);
|
||||
};
|
||||
self.reset = function reset(localLookup) {
|
||||
failMessage = null;
|
||||
failureOutput = false;
|
||||
usages = [];
|
||||
usageDisabled = false;
|
||||
epilogs = [];
|
||||
examples = [];
|
||||
commands = [];
|
||||
descriptions = objFilter(descriptions, k => !localLookup[k]);
|
||||
return self;
|
||||
};
|
||||
const frozens = [];
|
||||
self.freeze = function freeze() {
|
||||
frozens.push({
|
||||
failMessage,
|
||||
failureOutput,
|
||||
usages,
|
||||
usageDisabled,
|
||||
epilogs,
|
||||
examples,
|
||||
commands,
|
||||
descriptions,
|
||||
});
|
||||
};
|
||||
self.unfreeze = function unfreeze(defaultCommand = false) {
|
||||
const frozen = frozens.pop();
|
||||
if (!frozen)
|
||||
return;
|
||||
if (defaultCommand) {
|
||||
descriptions = { ...frozen.descriptions, ...descriptions };
|
||||
commands = [...frozen.commands, ...commands];
|
||||
usages = [...frozen.usages, ...usages];
|
||||
examples = [...frozen.examples, ...examples];
|
||||
epilogs = [...frozen.epilogs, ...epilogs];
|
||||
}
|
||||
else {
|
||||
({
|
||||
failMessage,
|
||||
failureOutput,
|
||||
usages,
|
||||
usageDisabled,
|
||||
epilogs,
|
||||
examples,
|
||||
commands,
|
||||
descriptions,
|
||||
} = frozen);
|
||||
}
|
||||
};
|
||||
return self;
|
||||
}
|
||||
function isIndentedText(text) {
|
||||
return typeof text === 'object';
|
||||
}
|
||||
function addIndentation(text, indent) {
|
||||
return isIndentedText(text)
|
||||
? { text: text.text, indentation: text.indentation + indent }
|
||||
: { text, indentation: indent };
|
||||
}
|
||||
function getIndentation(text) {
|
||||
return isIndentedText(text) ? text.indentation : 0;
|
||||
}
|
||||
function getText(text) {
|
||||
return isIndentedText(text) ? text.text : text;
|
||||
}
|
||||
59
node_modules/@grpc/proto-loader/node_modules/yargs/build/lib/utils/apply-extends.js
generated
vendored
Normal file
59
node_modules/@grpc/proto-loader/node_modules/yargs/build/lib/utils/apply-extends.js
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
import { YError } from '../yerror.js';
|
||||
let previouslyVisitedConfigs = [];
|
||||
let shim;
|
||||
export function applyExtends(config, cwd, mergeExtends, _shim) {
|
||||
shim = _shim;
|
||||
let defaultConfig = {};
|
||||
if (Object.prototype.hasOwnProperty.call(config, 'extends')) {
|
||||
if (typeof config.extends !== 'string')
|
||||
return defaultConfig;
|
||||
const isPath = /\.json|\..*rc$/.test(config.extends);
|
||||
let pathToDefault = null;
|
||||
if (!isPath) {
|
||||
try {
|
||||
pathToDefault = require.resolve(config.extends);
|
||||
}
|
||||
catch (_err) {
|
||||
return config;
|
||||
}
|
||||
}
|
||||
else {
|
||||
pathToDefault = getPathToDefaultConfig(cwd, config.extends);
|
||||
}
|
||||
checkForCircularExtends(pathToDefault);
|
||||
previouslyVisitedConfigs.push(pathToDefault);
|
||||
defaultConfig = isPath
|
||||
? JSON.parse(shim.readFileSync(pathToDefault, 'utf8'))
|
||||
: require(config.extends);
|
||||
delete config.extends;
|
||||
defaultConfig = applyExtends(defaultConfig, shim.path.dirname(pathToDefault), mergeExtends, shim);
|
||||
}
|
||||
previouslyVisitedConfigs = [];
|
||||
return mergeExtends
|
||||
? mergeDeep(defaultConfig, config)
|
||||
: Object.assign({}, defaultConfig, config);
|
||||
}
|
||||
function checkForCircularExtends(cfgPath) {
|
||||
if (previouslyVisitedConfigs.indexOf(cfgPath) > -1) {
|
||||
throw new YError(`Circular extended configurations: '${cfgPath}'.`);
|
||||
}
|
||||
}
|
||||
function getPathToDefaultConfig(cwd, pathToExtend) {
|
||||
return shim.path.resolve(cwd, pathToExtend);
|
||||
}
|
||||
function mergeDeep(config1, config2) {
|
||||
const target = {};
|
||||
function isObject(obj) {
|
||||
return obj && typeof obj === 'object' && !Array.isArray(obj);
|
||||
}
|
||||
Object.assign(target, config1);
|
||||
for (const key of Object.keys(config2)) {
|
||||
if (isObject(config2[key]) && isObject(target[key])) {
|
||||
target[key] = mergeDeep(config1[key], config2[key]);
|
||||
}
|
||||
else {
|
||||
target[key] = config2[key];
|
||||
}
|
||||
}
|
||||
return target;
|
||||
}
|
||||
5
node_modules/@grpc/proto-loader/node_modules/yargs/build/lib/utils/is-promise.js
generated
vendored
Normal file
5
node_modules/@grpc/proto-loader/node_modules/yargs/build/lib/utils/is-promise.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
export function isPromise(maybePromise) {
|
||||
return (!!maybePromise &&
|
||||
!!maybePromise.then &&
|
||||
typeof maybePromise.then === 'function');
|
||||
}
|
||||
34
node_modules/@grpc/proto-loader/node_modules/yargs/build/lib/utils/levenshtein.js
generated
vendored
Normal file
34
node_modules/@grpc/proto-loader/node_modules/yargs/build/lib/utils/levenshtein.js
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
export function levenshtein(a, b) {
|
||||
if (a.length === 0)
|
||||
return b.length;
|
||||
if (b.length === 0)
|
||||
return a.length;
|
||||
const matrix = [];
|
||||
let i;
|
||||
for (i = 0; i <= b.length; i++) {
|
||||
matrix[i] = [i];
|
||||
}
|
||||
let j;
|
||||
for (j = 0; j <= a.length; j++) {
|
||||
matrix[0][j] = j;
|
||||
}
|
||||
for (i = 1; i <= b.length; i++) {
|
||||
for (j = 1; j <= a.length; j++) {
|
||||
if (b.charAt(i - 1) === a.charAt(j - 1)) {
|
||||
matrix[i][j] = matrix[i - 1][j - 1];
|
||||
}
|
||||
else {
|
||||
if (i > 1 &&
|
||||
j > 1 &&
|
||||
b.charAt(i - 2) === a.charAt(j - 1) &&
|
||||
b.charAt(i - 1) === a.charAt(j - 2)) {
|
||||
matrix[i][j] = matrix[i - 2][j - 2] + 1;
|
||||
}
|
||||
else {
|
||||
matrix[i][j] = Math.min(matrix[i - 1][j - 1] + 1, Math.min(matrix[i][j - 1] + 1, matrix[i - 1][j] + 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return matrix[b.length][a.length];
|
||||
}
|
||||
17
node_modules/@grpc/proto-loader/node_modules/yargs/build/lib/utils/maybe-async-result.js
generated
vendored
Normal file
17
node_modules/@grpc/proto-loader/node_modules/yargs/build/lib/utils/maybe-async-result.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
import { isPromise } from './is-promise.js';
|
||||
export function maybeAsyncResult(getResult, resultHandler, errorHandler = (err) => {
|
||||
throw err;
|
||||
}) {
|
||||
try {
|
||||
const result = isFunction(getResult) ? getResult() : getResult;
|
||||
return isPromise(result)
|
||||
? result.then((result) => resultHandler(result))
|
||||
: resultHandler(result);
|
||||
}
|
||||
catch (err) {
|
||||
return errorHandler(err);
|
||||
}
|
||||
}
|
||||
function isFunction(arg) {
|
||||
return typeof arg === 'function';
|
||||
}
|
||||
10
node_modules/@grpc/proto-loader/node_modules/yargs/build/lib/utils/obj-filter.js
generated
vendored
Normal file
10
node_modules/@grpc/proto-loader/node_modules/yargs/build/lib/utils/obj-filter.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
import { objectKeys } from '../typings/common-types.js';
|
||||
export function objFilter(original = {}, filter = () => true) {
|
||||
const obj = {};
|
||||
objectKeys(original).forEach(key => {
|
||||
if (filter(key, original[key])) {
|
||||
obj[key] = original[key];
|
||||
}
|
||||
});
|
||||
return obj;
|
||||
}
|
||||
17
node_modules/@grpc/proto-loader/node_modules/yargs/build/lib/utils/process-argv.js
generated
vendored
Normal file
17
node_modules/@grpc/proto-loader/node_modules/yargs/build/lib/utils/process-argv.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
function getProcessArgvBinIndex() {
|
||||
if (isBundledElectronApp())
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
function isBundledElectronApp() {
|
||||
return isElectronApp() && !process.defaultApp;
|
||||
}
|
||||
function isElectronApp() {
|
||||
return !!process.versions.electron;
|
||||
}
|
||||
export function hideBin(argv) {
|
||||
return argv.slice(getProcessArgvBinIndex() + 1);
|
||||
}
|
||||
export function getProcessArgvBin() {
|
||||
return process.argv[getProcessArgvBinIndex()];
|
||||
}
|
||||
12
node_modules/@grpc/proto-loader/node_modules/yargs/build/lib/utils/set-blocking.js
generated
vendored
Normal file
12
node_modules/@grpc/proto-loader/node_modules/yargs/build/lib/utils/set-blocking.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
export default function setBlocking(blocking) {
|
||||
if (typeof process === 'undefined')
|
||||
return;
|
||||
[process.stdout, process.stderr].forEach(_stream => {
|
||||
const stream = _stream;
|
||||
if (stream._handle &&
|
||||
stream.isTTY &&
|
||||
typeof stream._handle.setBlocking === 'function') {
|
||||
stream._handle.setBlocking(blocking);
|
||||
}
|
||||
});
|
||||
}
|
||||
10
node_modules/@grpc/proto-loader/node_modules/yargs/build/lib/utils/which-module.js
generated
vendored
Normal file
10
node_modules/@grpc/proto-loader/node_modules/yargs/build/lib/utils/which-module.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
export default function whichModule(exported) {
|
||||
if (typeof require === 'undefined')
|
||||
return null;
|
||||
for (let i = 0, files = Object.keys(require.cache), mod; i < files.length; i++) {
|
||||
mod = require.cache[files[i]];
|
||||
if (mod.exports === exported)
|
||||
return mod;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
305
node_modules/@grpc/proto-loader/node_modules/yargs/build/lib/validation.js
generated
vendored
Normal file
305
node_modules/@grpc/proto-loader/node_modules/yargs/build/lib/validation.js
generated
vendored
Normal file
@@ -0,0 +1,305 @@
|
||||
import { argsert } from './argsert.js';
|
||||
import { assertNotStrictEqual, } from './typings/common-types.js';
|
||||
import { levenshtein as distance } from './utils/levenshtein.js';
|
||||
import { objFilter } from './utils/obj-filter.js';
|
||||
const specialKeys = ['$0', '--', '_'];
|
||||
export function validation(yargs, usage, shim) {
|
||||
const __ = shim.y18n.__;
|
||||
const __n = shim.y18n.__n;
|
||||
const self = {};
|
||||
self.nonOptionCount = function nonOptionCount(argv) {
|
||||
const demandedCommands = yargs.getDemandedCommands();
|
||||
const positionalCount = argv._.length + (argv['--'] ? argv['--'].length : 0);
|
||||
const _s = positionalCount - yargs.getInternalMethods().getContext().commands.length;
|
||||
if (demandedCommands._ &&
|
||||
(_s < demandedCommands._.min || _s > demandedCommands._.max)) {
|
||||
if (_s < demandedCommands._.min) {
|
||||
if (demandedCommands._.minMsg !== undefined) {
|
||||
usage.fail(demandedCommands._.minMsg
|
||||
? demandedCommands._.minMsg
|
||||
.replace(/\$0/g, _s.toString())
|
||||
.replace(/\$1/, demandedCommands._.min.toString())
|
||||
: null);
|
||||
}
|
||||
else {
|
||||
usage.fail(__n('Not enough non-option arguments: got %s, need at least %s', 'Not enough non-option arguments: got %s, need at least %s', _s, _s.toString(), demandedCommands._.min.toString()));
|
||||
}
|
||||
}
|
||||
else if (_s > demandedCommands._.max) {
|
||||
if (demandedCommands._.maxMsg !== undefined) {
|
||||
usage.fail(demandedCommands._.maxMsg
|
||||
? demandedCommands._.maxMsg
|
||||
.replace(/\$0/g, _s.toString())
|
||||
.replace(/\$1/, demandedCommands._.max.toString())
|
||||
: null);
|
||||
}
|
||||
else {
|
||||
usage.fail(__n('Too many non-option arguments: got %s, maximum of %s', 'Too many non-option arguments: got %s, maximum of %s', _s, _s.toString(), demandedCommands._.max.toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
self.positionalCount = function positionalCount(required, observed) {
|
||||
if (observed < required) {
|
||||
usage.fail(__n('Not enough non-option arguments: got %s, need at least %s', 'Not enough non-option arguments: got %s, need at least %s', observed, observed + '', required + ''));
|
||||
}
|
||||
};
|
||||
self.requiredArguments = function requiredArguments(argv, demandedOptions) {
|
||||
let missing = null;
|
||||
for (const key of Object.keys(demandedOptions)) {
|
||||
if (!Object.prototype.hasOwnProperty.call(argv, key) ||
|
||||
typeof argv[key] === 'undefined') {
|
||||
missing = missing || {};
|
||||
missing[key] = demandedOptions[key];
|
||||
}
|
||||
}
|
||||
if (missing) {
|
||||
const customMsgs = [];
|
||||
for (const key of Object.keys(missing)) {
|
||||
const msg = missing[key];
|
||||
if (msg && customMsgs.indexOf(msg) < 0) {
|
||||
customMsgs.push(msg);
|
||||
}
|
||||
}
|
||||
const customMsg = customMsgs.length ? `\n${customMsgs.join('\n')}` : '';
|
||||
usage.fail(__n('Missing required argument: %s', 'Missing required arguments: %s', Object.keys(missing).length, Object.keys(missing).join(', ') + customMsg));
|
||||
}
|
||||
};
|
||||
self.unknownArguments = function unknownArguments(argv, aliases, positionalMap, isDefaultCommand, checkPositionals = true) {
|
||||
var _a;
|
||||
const commandKeys = yargs
|
||||
.getInternalMethods()
|
||||
.getCommandInstance()
|
||||
.getCommands();
|
||||
const unknown = [];
|
||||
const currentContext = yargs.getInternalMethods().getContext();
|
||||
Object.keys(argv).forEach(key => {
|
||||
if (!specialKeys.includes(key) &&
|
||||
!Object.prototype.hasOwnProperty.call(positionalMap, key) &&
|
||||
!Object.prototype.hasOwnProperty.call(yargs.getInternalMethods().getParseContext(), key) &&
|
||||
!self.isValidAndSomeAliasIsNotNew(key, aliases)) {
|
||||
unknown.push(key);
|
||||
}
|
||||
});
|
||||
if (checkPositionals &&
|
||||
(currentContext.commands.length > 0 ||
|
||||
commandKeys.length > 0 ||
|
||||
isDefaultCommand)) {
|
||||
argv._.slice(currentContext.commands.length).forEach(key => {
|
||||
if (!commandKeys.includes('' + key)) {
|
||||
unknown.push('' + key);
|
||||
}
|
||||
});
|
||||
}
|
||||
if (checkPositionals) {
|
||||
const demandedCommands = yargs.getDemandedCommands();
|
||||
const maxNonOptDemanded = ((_a = demandedCommands._) === null || _a === void 0 ? void 0 : _a.max) || 0;
|
||||
const expected = currentContext.commands.length + maxNonOptDemanded;
|
||||
if (expected < argv._.length) {
|
||||
argv._.slice(expected).forEach(key => {
|
||||
key = String(key);
|
||||
if (!currentContext.commands.includes(key) &&
|
||||
!unknown.includes(key)) {
|
||||
unknown.push(key);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
if (unknown.length) {
|
||||
usage.fail(__n('Unknown argument: %s', 'Unknown arguments: %s', unknown.length, unknown.map(s => (s.trim() ? s : `"${s}"`)).join(', ')));
|
||||
}
|
||||
};
|
||||
self.unknownCommands = function unknownCommands(argv) {
|
||||
const commandKeys = yargs
|
||||
.getInternalMethods()
|
||||
.getCommandInstance()
|
||||
.getCommands();
|
||||
const unknown = [];
|
||||
const currentContext = yargs.getInternalMethods().getContext();
|
||||
if (currentContext.commands.length > 0 || commandKeys.length > 0) {
|
||||
argv._.slice(currentContext.commands.length).forEach(key => {
|
||||
if (!commandKeys.includes('' + key)) {
|
||||
unknown.push('' + key);
|
||||
}
|
||||
});
|
||||
}
|
||||
if (unknown.length > 0) {
|
||||
usage.fail(__n('Unknown command: %s', 'Unknown commands: %s', unknown.length, unknown.join(', ')));
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
self.isValidAndSomeAliasIsNotNew = function isValidAndSomeAliasIsNotNew(key, aliases) {
|
||||
if (!Object.prototype.hasOwnProperty.call(aliases, key)) {
|
||||
return false;
|
||||
}
|
||||
const newAliases = yargs.parsed.newAliases;
|
||||
return [key, ...aliases[key]].some(a => !Object.prototype.hasOwnProperty.call(newAliases, a) || !newAliases[key]);
|
||||
};
|
||||
self.limitedChoices = function limitedChoices(argv) {
|
||||
const options = yargs.getOptions();
|
||||
const invalid = {};
|
||||
if (!Object.keys(options.choices).length)
|
||||
return;
|
||||
Object.keys(argv).forEach(key => {
|
||||
if (specialKeys.indexOf(key) === -1 &&
|
||||
Object.prototype.hasOwnProperty.call(options.choices, key)) {
|
||||
[].concat(argv[key]).forEach(value => {
|
||||
if (options.choices[key].indexOf(value) === -1 &&
|
||||
value !== undefined) {
|
||||
invalid[key] = (invalid[key] || []).concat(value);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
const invalidKeys = Object.keys(invalid);
|
||||
if (!invalidKeys.length)
|
||||
return;
|
||||
let msg = __('Invalid values:');
|
||||
invalidKeys.forEach(key => {
|
||||
msg += `\n ${__('Argument: %s, Given: %s, Choices: %s', key, usage.stringifiedValues(invalid[key]), usage.stringifiedValues(options.choices[key]))}`;
|
||||
});
|
||||
usage.fail(msg);
|
||||
};
|
||||
let implied = {};
|
||||
self.implies = function implies(key, value) {
|
||||
argsert('<string|object> [array|number|string]', [key, value], arguments.length);
|
||||
if (typeof key === 'object') {
|
||||
Object.keys(key).forEach(k => {
|
||||
self.implies(k, key[k]);
|
||||
});
|
||||
}
|
||||
else {
|
||||
yargs.global(key);
|
||||
if (!implied[key]) {
|
||||
implied[key] = [];
|
||||
}
|
||||
if (Array.isArray(value)) {
|
||||
value.forEach(i => self.implies(key, i));
|
||||
}
|
||||
else {
|
||||
assertNotStrictEqual(value, undefined, shim);
|
||||
implied[key].push(value);
|
||||
}
|
||||
}
|
||||
};
|
||||
self.getImplied = function getImplied() {
|
||||
return implied;
|
||||
};
|
||||
function keyExists(argv, val) {
|
||||
const num = Number(val);
|
||||
val = isNaN(num) ? val : num;
|
||||
if (typeof val === 'number') {
|
||||
val = argv._.length >= val;
|
||||
}
|
||||
else if (val.match(/^--no-.+/)) {
|
||||
val = val.match(/^--no-(.+)/)[1];
|
||||
val = !Object.prototype.hasOwnProperty.call(argv, val);
|
||||
}
|
||||
else {
|
||||
val = Object.prototype.hasOwnProperty.call(argv, val);
|
||||
}
|
||||
return val;
|
||||
}
|
||||
self.implications = function implications(argv) {
|
||||
const implyFail = [];
|
||||
Object.keys(implied).forEach(key => {
|
||||
const origKey = key;
|
||||
(implied[key] || []).forEach(value => {
|
||||
let key = origKey;
|
||||
const origValue = value;
|
||||
key = keyExists(argv, key);
|
||||
value = keyExists(argv, value);
|
||||
if (key && !value) {
|
||||
implyFail.push(` ${origKey} -> ${origValue}`);
|
||||
}
|
||||
});
|
||||
});
|
||||
if (implyFail.length) {
|
||||
let msg = `${__('Implications failed:')}\n`;
|
||||
implyFail.forEach(value => {
|
||||
msg += value;
|
||||
});
|
||||
usage.fail(msg);
|
||||
}
|
||||
};
|
||||
let conflicting = {};
|
||||
self.conflicts = function conflicts(key, value) {
|
||||
argsert('<string|object> [array|string]', [key, value], arguments.length);
|
||||
if (typeof key === 'object') {
|
||||
Object.keys(key).forEach(k => {
|
||||
self.conflicts(k, key[k]);
|
||||
});
|
||||
}
|
||||
else {
|
||||
yargs.global(key);
|
||||
if (!conflicting[key]) {
|
||||
conflicting[key] = [];
|
||||
}
|
||||
if (Array.isArray(value)) {
|
||||
value.forEach(i => self.conflicts(key, i));
|
||||
}
|
||||
else {
|
||||
conflicting[key].push(value);
|
||||
}
|
||||
}
|
||||
};
|
||||
self.getConflicting = () => conflicting;
|
||||
self.conflicting = function conflictingFn(argv) {
|
||||
Object.keys(argv).forEach(key => {
|
||||
if (conflicting[key]) {
|
||||
conflicting[key].forEach(value => {
|
||||
if (value && argv[key] !== undefined && argv[value] !== undefined) {
|
||||
usage.fail(__('Arguments %s and %s are mutually exclusive', key, value));
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
if (yargs.getInternalMethods().getParserConfiguration()['strip-dashed']) {
|
||||
Object.keys(conflicting).forEach(key => {
|
||||
conflicting[key].forEach(value => {
|
||||
if (value &&
|
||||
argv[shim.Parser.camelCase(key)] !== undefined &&
|
||||
argv[shim.Parser.camelCase(value)] !== undefined) {
|
||||
usage.fail(__('Arguments %s and %s are mutually exclusive', key, value));
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
self.recommendCommands = function recommendCommands(cmd, potentialCommands) {
|
||||
const threshold = 3;
|
||||
potentialCommands = potentialCommands.sort((a, b) => b.length - a.length);
|
||||
let recommended = null;
|
||||
let bestDistance = Infinity;
|
||||
for (let i = 0, candidate; (candidate = potentialCommands[i]) !== undefined; i++) {
|
||||
const d = distance(cmd, candidate);
|
||||
if (d <= threshold && d < bestDistance) {
|
||||
bestDistance = d;
|
||||
recommended = candidate;
|
||||
}
|
||||
}
|
||||
if (recommended)
|
||||
usage.fail(__('Did you mean %s?', recommended));
|
||||
};
|
||||
self.reset = function reset(localLookup) {
|
||||
implied = objFilter(implied, k => !localLookup[k]);
|
||||
conflicting = objFilter(conflicting, k => !localLookup[k]);
|
||||
return self;
|
||||
};
|
||||
const frozens = [];
|
||||
self.freeze = function freeze() {
|
||||
frozens.push({
|
||||
implied,
|
||||
conflicting,
|
||||
});
|
||||
};
|
||||
self.unfreeze = function unfreeze() {
|
||||
const frozen = frozens.pop();
|
||||
assertNotStrictEqual(frozen, undefined, shim);
|
||||
({ implied, conflicting } = frozen);
|
||||
};
|
||||
return self;
|
||||
}
|
||||
1512
node_modules/@grpc/proto-loader/node_modules/yargs/build/lib/yargs-factory.js
generated
vendored
Normal file
1512
node_modules/@grpc/proto-loader/node_modules/yargs/build/lib/yargs-factory.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
9
node_modules/@grpc/proto-loader/node_modules/yargs/build/lib/yerror.js
generated
vendored
Normal file
9
node_modules/@grpc/proto-loader/node_modules/yargs/build/lib/yerror.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
export class YError extends Error {
|
||||
constructor(msg) {
|
||||
super(msg || 'yargs error');
|
||||
this.name = 'YError';
|
||||
if (Error.captureStackTrace) {
|
||||
Error.captureStackTrace(this, YError);
|
||||
}
|
||||
}
|
||||
}
|
||||
10
node_modules/@grpc/proto-loader/node_modules/yargs/helpers/helpers.mjs
generated
vendored
Normal file
10
node_modules/@grpc/proto-loader/node_modules/yargs/helpers/helpers.mjs
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
import {applyExtends as _applyExtends} from '../build/lib/utils/apply-extends.js';
|
||||
import {hideBin} from '../build/lib/utils/process-argv.js';
|
||||
import Parser from 'yargs-parser';
|
||||
import shim from '../lib/platform-shims/esm.mjs';
|
||||
|
||||
const applyExtends = (config, cwd, mergeExtends) => {
|
||||
return _applyExtends(config, cwd, mergeExtends, shim);
|
||||
};
|
||||
|
||||
export {applyExtends, hideBin, Parser};
|
||||
14
node_modules/@grpc/proto-loader/node_modules/yargs/helpers/index.js
generated
vendored
Normal file
14
node_modules/@grpc/proto-loader/node_modules/yargs/helpers/index.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
const {
|
||||
applyExtends,
|
||||
cjsPlatformShim,
|
||||
Parser,
|
||||
processArgv,
|
||||
} = require('../build/index.cjs');
|
||||
|
||||
module.exports = {
|
||||
applyExtends: (config, cwd, mergeExtends) => {
|
||||
return applyExtends(config, cwd, mergeExtends, cjsPlatformShim);
|
||||
},
|
||||
hideBin: processArgv.hideBin,
|
||||
Parser,
|
||||
};
|
||||
3
node_modules/@grpc/proto-loader/node_modules/yargs/helpers/package.json
generated
vendored
Normal file
3
node_modules/@grpc/proto-loader/node_modules/yargs/helpers/package.json
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"type": "commonjs"
|
||||
}
|
||||
53
node_modules/@grpc/proto-loader/node_modules/yargs/index.cjs
generated
vendored
Normal file
53
node_modules/@grpc/proto-loader/node_modules/yargs/index.cjs
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
'use strict';
|
||||
// classic singleton yargs API, to use yargs
|
||||
// without running as a singleton do:
|
||||
// require('yargs/yargs')(process.argv.slice(2))
|
||||
const {Yargs, processArgv} = require('./build/index.cjs');
|
||||
|
||||
Argv(processArgv.hideBin(process.argv));
|
||||
|
||||
module.exports = Argv;
|
||||
|
||||
function Argv(processArgs, cwd) {
|
||||
const argv = Yargs(processArgs, cwd, require);
|
||||
singletonify(argv);
|
||||
// TODO(bcoe): warn if argv.parse() or argv.argv is used directly.
|
||||
return argv;
|
||||
}
|
||||
|
||||
function defineGetter(obj, key, getter) {
|
||||
Object.defineProperty(obj, key, {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
get: getter,
|
||||
});
|
||||
}
|
||||
function lookupGetter(obj, key) {
|
||||
const desc = Object.getOwnPropertyDescriptor(obj, key);
|
||||
if (typeof desc !== 'undefined') {
|
||||
return desc.get;
|
||||
}
|
||||
}
|
||||
|
||||
/* Hack an instance of Argv with process.argv into Argv
|
||||
so people can do
|
||||
require('yargs')(['--beeble=1','-z','zizzle']).argv
|
||||
to parse a list of args and
|
||||
require('yargs').argv
|
||||
to get a parsed version of process.argv.
|
||||
*/
|
||||
function singletonify(inst) {
|
||||
[
|
||||
...Object.keys(inst),
|
||||
...Object.getOwnPropertyNames(inst.constructor.prototype),
|
||||
].forEach(key => {
|
||||
if (key === 'argv') {
|
||||
defineGetter(Argv, key, lookupGetter(inst, key));
|
||||
} else if (typeof inst[key] === 'function') {
|
||||
Argv[key] = inst[key].bind(inst);
|
||||
} else {
|
||||
defineGetter(Argv, '$0', () => inst.$0);
|
||||
defineGetter(Argv, 'parsed', () => inst.parsed);
|
||||
}
|
||||
});
|
||||
}
|
||||
8
node_modules/@grpc/proto-loader/node_modules/yargs/index.mjs
generated
vendored
Normal file
8
node_modules/@grpc/proto-loader/node_modules/yargs/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
'use strict';
|
||||
|
||||
// Bootstraps yargs for ESM:
|
||||
import esmPlatformShim from './lib/platform-shims/esm.mjs';
|
||||
import {YargsFactory} from './build/lib/yargs-factory.js';
|
||||
|
||||
const Yargs = YargsFactory(esmPlatformShim);
|
||||
export default Yargs;
|
||||
95
node_modules/@grpc/proto-loader/node_modules/yargs/lib/platform-shims/browser.mjs
generated
vendored
Normal file
95
node_modules/@grpc/proto-loader/node_modules/yargs/lib/platform-shims/browser.mjs
generated
vendored
Normal file
@@ -0,0 +1,95 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
'use strict';
|
||||
|
||||
import cliui from 'https://unpkg.com/cliui@7.0.1/index.mjs'; // eslint-disable-line
|
||||
import Parser from 'https://unpkg.com/yargs-parser@19.0.0/browser.js'; // eslint-disable-line
|
||||
import {getProcessArgvBin} from '../../build/lib/utils/process-argv.js';
|
||||
import {YError} from '../../build/lib/yerror.js';
|
||||
|
||||
const REQUIRE_ERROR = 'require is not supported in browser';
|
||||
const REQUIRE_DIRECTORY_ERROR =
|
||||
'loading a directory of commands is not supported in browser';
|
||||
|
||||
export default {
|
||||
assert: {
|
||||
notStrictEqual: (a, b) => {
|
||||
// noop.
|
||||
},
|
||||
strictEqual: (a, b) => {
|
||||
// noop.
|
||||
},
|
||||
},
|
||||
cliui,
|
||||
findUp: () => undefined,
|
||||
getEnv: key => {
|
||||
// There is no environment in browser:
|
||||
return undefined;
|
||||
},
|
||||
inspect: console.log,
|
||||
getCallerFile: () => {
|
||||
throw new YError(REQUIRE_DIRECTORY_ERROR);
|
||||
},
|
||||
getProcessArgvBin,
|
||||
mainFilename: 'yargs',
|
||||
Parser,
|
||||
path: {
|
||||
basename: str => str,
|
||||
dirname: str => str,
|
||||
extname: str => str,
|
||||
relative: str => str,
|
||||
},
|
||||
process: {
|
||||
argv: () => [],
|
||||
cwd: () => '',
|
||||
emitWarning: (warning, name) => {},
|
||||
execPath: () => '',
|
||||
// exit is noop browser:
|
||||
exit: () => {},
|
||||
nextTick: cb => {
|
||||
// eslint-disable-next-line no-undef
|
||||
window.setTimeout(cb, 1);
|
||||
},
|
||||
stdColumns: 80,
|
||||
},
|
||||
readFileSync: () => {
|
||||
return '';
|
||||
},
|
||||
require: () => {
|
||||
throw new YError(REQUIRE_ERROR);
|
||||
},
|
||||
requireDirectory: () => {
|
||||
throw new YError(REQUIRE_DIRECTORY_ERROR);
|
||||
},
|
||||
stringWidth: str => {
|
||||
return [...str].length;
|
||||
},
|
||||
// TODO: replace this with y18n once it's ported to ESM:
|
||||
y18n: {
|
||||
__: (...str) => {
|
||||
if (str.length === 0) return '';
|
||||
const args = str.slice(1);
|
||||
return sprintf(str[0], ...args);
|
||||
},
|
||||
__n: (str1, str2, count, ...args) => {
|
||||
if (count === 1) {
|
||||
return sprintf(str1, ...args);
|
||||
} else {
|
||||
return sprintf(str2, ...args);
|
||||
}
|
||||
},
|
||||
getLocale: () => {
|
||||
return 'en_US';
|
||||
},
|
||||
setLocale: () => {},
|
||||
updateLocale: () => {},
|
||||
},
|
||||
};
|
||||
|
||||
function sprintf(_str, ...args) {
|
||||
let str = '';
|
||||
const split = _str.split('%s');
|
||||
split.forEach((token, i) => {
|
||||
str += `${token}${split[i + 1] !== undefined && args[i] ? args[i] : ''}`;
|
||||
});
|
||||
return str;
|
||||
}
|
||||
73
node_modules/@grpc/proto-loader/node_modules/yargs/lib/platform-shims/esm.mjs
generated
vendored
Normal file
73
node_modules/@grpc/proto-loader/node_modules/yargs/lib/platform-shims/esm.mjs
generated
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
'use strict'
|
||||
|
||||
import { notStrictEqual, strictEqual } from 'assert'
|
||||
import cliui from 'cliui'
|
||||
import escalade from 'escalade/sync'
|
||||
import { inspect } from 'util'
|
||||
import { readFileSync } from 'fs'
|
||||
import { fileURLToPath } from 'url';
|
||||
import Parser from 'yargs-parser'
|
||||
import { basename, dirname, extname, relative, resolve } from 'path'
|
||||
import { getProcessArgvBin } from '../../build/lib/utils/process-argv.js'
|
||||
import { YError } from '../../build/lib/yerror.js'
|
||||
import y18n from 'y18n'
|
||||
|
||||
const REQUIRE_ERROR = 'require is not supported by ESM'
|
||||
const REQUIRE_DIRECTORY_ERROR = 'loading a directory of commands is not supported yet for ESM'
|
||||
|
||||
let __dirname;
|
||||
try {
|
||||
__dirname = fileURLToPath(import.meta.url);
|
||||
} catch (e) {
|
||||
__dirname = process.cwd();
|
||||
}
|
||||
const mainFilename = __dirname.substring(0, __dirname.lastIndexOf('node_modules'));
|
||||
|
||||
export default {
|
||||
assert: {
|
||||
notStrictEqual,
|
||||
strictEqual
|
||||
},
|
||||
cliui,
|
||||
findUp: escalade,
|
||||
getEnv: (key) => {
|
||||
return process.env[key]
|
||||
},
|
||||
inspect,
|
||||
getCallerFile: () => {
|
||||
throw new YError(REQUIRE_DIRECTORY_ERROR)
|
||||
},
|
||||
getProcessArgvBin,
|
||||
mainFilename: mainFilename || process.cwd(),
|
||||
Parser,
|
||||
path: {
|
||||
basename,
|
||||
dirname,
|
||||
extname,
|
||||
relative,
|
||||
resolve
|
||||
},
|
||||
process: {
|
||||
argv: () => process.argv,
|
||||
cwd: process.cwd,
|
||||
emitWarning: (warning, type) => process.emitWarning(warning, type),
|
||||
execPath: () => process.execPath,
|
||||
exit: process.exit,
|
||||
nextTick: process.nextTick,
|
||||
stdColumns: typeof process.stdout.columns !== 'undefined' ? process.stdout.columns : null
|
||||
},
|
||||
readFileSync,
|
||||
require: () => {
|
||||
throw new YError(REQUIRE_ERROR)
|
||||
},
|
||||
requireDirectory: () => {
|
||||
throw new YError(REQUIRE_DIRECTORY_ERROR)
|
||||
},
|
||||
stringWidth: (str) => {
|
||||
return [...str].length
|
||||
},
|
||||
y18n: y18n({
|
||||
directory: resolve(__dirname, '../../../locales'),
|
||||
updateFiles: false
|
||||
})
|
||||
}
|
||||
46
node_modules/@grpc/proto-loader/node_modules/yargs/locales/be.json
generated
vendored
Normal file
46
node_modules/@grpc/proto-loader/node_modules/yargs/locales/be.json
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"Commands:": "Каманды:",
|
||||
"Options:": "Опцыі:",
|
||||
"Examples:": "Прыклады:",
|
||||
"boolean": "булевы тып",
|
||||
"count": "падлік",
|
||||
"string": "радковы тып",
|
||||
"number": "лік",
|
||||
"array": "масіў",
|
||||
"required": "неабходна",
|
||||
"default": "па змаўчанні",
|
||||
"default:": "па змаўчанні:",
|
||||
"choices:": "магчымасці:",
|
||||
"aliases:": "аліасы:",
|
||||
"generated-value": "згенераванае значэнне",
|
||||
"Not enough non-option arguments: got %s, need at least %s": {
|
||||
"one": "Недастаткова неапцыйных аргументаў: ёсць %s, трэба як мінімум %s",
|
||||
"other": "Недастаткова неапцыйных аргументаў: ёсць %s, трэба як мінімум %s"
|
||||
},
|
||||
"Too many non-option arguments: got %s, maximum of %s": {
|
||||
"one": "Занадта шмат неапцыйных аргументаў: ёсць %s, максімум дапушчальна %s",
|
||||
"other": "Занадта шмат неапцыйных аргументаў: ёсць %s, максімум дапушчальна %s"
|
||||
},
|
||||
"Missing argument value: %s": {
|
||||
"one": "Не хапае значэння аргументу: %s",
|
||||
"other": "Не хапае значэнняў аргументаў: %s"
|
||||
},
|
||||
"Missing required argument: %s": {
|
||||
"one": "Не хапае неабходнага аргументу: %s",
|
||||
"other": "Не хапае неабходных аргументаў: %s"
|
||||
},
|
||||
"Unknown argument: %s": {
|
||||
"one": "Невядомы аргумент: %s",
|
||||
"other": "Невядомыя аргументы: %s"
|
||||
},
|
||||
"Invalid values:": "Несапраўдныя значэння:",
|
||||
"Argument: %s, Given: %s, Choices: %s": "Аргумент: %s, Дадзенае значэнне: %s, Магчымасці: %s",
|
||||
"Argument check failed: %s": "Праверка аргументаў не ўдалася: %s",
|
||||
"Implications failed:": "Дадзены аргумент патрабуе наступны дадатковы аргумент:",
|
||||
"Not enough arguments following: %s": "Недастаткова наступных аргументаў: %s",
|
||||
"Invalid JSON config file: %s": "Несапраўдны файл канфігурацыі JSON: %s",
|
||||
"Path to JSON config file": "Шлях да файла канфігурацыі JSON",
|
||||
"Show help": "Паказаць дапамогу",
|
||||
"Show version number": "Паказаць нумар версіі",
|
||||
"Did you mean %s?": "Вы мелі на ўвазе %s?"
|
||||
}
|
||||
51
node_modules/@grpc/proto-loader/node_modules/yargs/locales/cs.json
generated
vendored
Normal file
51
node_modules/@grpc/proto-loader/node_modules/yargs/locales/cs.json
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
{
|
||||
"Commands:": "Příkazy:",
|
||||
"Options:": "Možnosti:",
|
||||
"Examples:": "Příklady:",
|
||||
"boolean": "logická hodnota",
|
||||
"count": "počet",
|
||||
"string": "řetězec",
|
||||
"number": "číslo",
|
||||
"array": "pole",
|
||||
"required": "povinné",
|
||||
"default": "výchozí",
|
||||
"default:": "výchozí:",
|
||||
"choices:": "volby:",
|
||||
"aliases:": "aliasy:",
|
||||
"generated-value": "generovaná-hodnota",
|
||||
"Not enough non-option arguments: got %s, need at least %s": {
|
||||
"one": "Nedostatek argumentů: zadáno %s, je potřeba alespoň %s",
|
||||
"other": "Nedostatek argumentů: zadáno %s, je potřeba alespoň %s"
|
||||
},
|
||||
"Too many non-option arguments: got %s, maximum of %s": {
|
||||
"one": "Příliš mnoho argumentů: zadáno %s, maximálně %s",
|
||||
"other": "Příliš mnoho argumentů: zadáno %s, maximálně %s"
|
||||
},
|
||||
"Missing argument value: %s": {
|
||||
"one": "Chybí hodnota argumentu: %s",
|
||||
"other": "Chybí hodnoty argumentů: %s"
|
||||
},
|
||||
"Missing required argument: %s": {
|
||||
"one": "Chybí požadovaný argument: %s",
|
||||
"other": "Chybí požadované argumenty: %s"
|
||||
},
|
||||
"Unknown argument: %s": {
|
||||
"one": "Neznámý argument: %s",
|
||||
"other": "Neznámé argumenty: %s"
|
||||
},
|
||||
"Invalid values:": "Neplatné hodnoty:",
|
||||
"Argument: %s, Given: %s, Choices: %s": "Argument: %s, Zadáno: %s, Možnosti: %s",
|
||||
"Argument check failed: %s": "Kontrola argumentů se nezdařila: %s",
|
||||
"Implications failed:": "Chybí závislé argumenty:",
|
||||
"Not enough arguments following: %s": "Následuje nedostatek argumentů: %s",
|
||||
"Invalid JSON config file: %s": "Neplatný konfigurační soubor JSON: %s",
|
||||
"Path to JSON config file": "Cesta ke konfiguračnímu souboru JSON",
|
||||
"Show help": "Zobrazit nápovědu",
|
||||
"Show version number": "Zobrazit číslo verze",
|
||||
"Did you mean %s?": "Měl jste na mysli %s?",
|
||||
"Arguments %s and %s are mutually exclusive" : "Argumenty %s a %s se vzájemně vylučují",
|
||||
"Positionals:": "Poziční:",
|
||||
"command": "příkaz",
|
||||
"deprecated": "zastaralé",
|
||||
"deprecated: %s": "zastaralé: %s"
|
||||
}
|
||||
46
node_modules/@grpc/proto-loader/node_modules/yargs/locales/de.json
generated
vendored
Normal file
46
node_modules/@grpc/proto-loader/node_modules/yargs/locales/de.json
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"Commands:": "Kommandos:",
|
||||
"Options:": "Optionen:",
|
||||
"Examples:": "Beispiele:",
|
||||
"boolean": "boolean",
|
||||
"count": "Zähler",
|
||||
"string": "string",
|
||||
"number": "Zahl",
|
||||
"array": "array",
|
||||
"required": "erforderlich",
|
||||
"default": "Standard",
|
||||
"default:": "Standard:",
|
||||
"choices:": "Möglichkeiten:",
|
||||
"aliases:": "Aliase:",
|
||||
"generated-value": "Generierter-Wert",
|
||||
"Not enough non-option arguments: got %s, need at least %s": {
|
||||
"one": "Nicht genügend Argumente ohne Optionen: %s vorhanden, mindestens %s benötigt",
|
||||
"other": "Nicht genügend Argumente ohne Optionen: %s vorhanden, mindestens %s benötigt"
|
||||
},
|
||||
"Too many non-option arguments: got %s, maximum of %s": {
|
||||
"one": "Zu viele Argumente ohne Optionen: %s vorhanden, maximal %s erlaubt",
|
||||
"other": "Zu viele Argumente ohne Optionen: %s vorhanden, maximal %s erlaubt"
|
||||
},
|
||||
"Missing argument value: %s": {
|
||||
"one": "Fehlender Argumentwert: %s",
|
||||
"other": "Fehlende Argumentwerte: %s"
|
||||
},
|
||||
"Missing required argument: %s": {
|
||||
"one": "Fehlendes Argument: %s",
|
||||
"other": "Fehlende Argumente: %s"
|
||||
},
|
||||
"Unknown argument: %s": {
|
||||
"one": "Unbekanntes Argument: %s",
|
||||
"other": "Unbekannte Argumente: %s"
|
||||
},
|
||||
"Invalid values:": "Unzulässige Werte:",
|
||||
"Argument: %s, Given: %s, Choices: %s": "Argument: %s, Gegeben: %s, Möglichkeiten: %s",
|
||||
"Argument check failed: %s": "Argumente-Check fehlgeschlagen: %s",
|
||||
"Implications failed:": "Fehlende abhängige Argumente:",
|
||||
"Not enough arguments following: %s": "Nicht genügend Argumente nach: %s",
|
||||
"Invalid JSON config file: %s": "Fehlerhafte JSON-Config Datei: %s",
|
||||
"Path to JSON config file": "Pfad zur JSON-Config Datei",
|
||||
"Show help": "Hilfe anzeigen",
|
||||
"Show version number": "Version anzeigen",
|
||||
"Did you mean %s?": "Meintest du %s?"
|
||||
}
|
||||
55
node_modules/@grpc/proto-loader/node_modules/yargs/locales/en.json
generated
vendored
Normal file
55
node_modules/@grpc/proto-loader/node_modules/yargs/locales/en.json
generated
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
{
|
||||
"Commands:": "Commands:",
|
||||
"Options:": "Options:",
|
||||
"Examples:": "Examples:",
|
||||
"boolean": "boolean",
|
||||
"count": "count",
|
||||
"string": "string",
|
||||
"number": "number",
|
||||
"array": "array",
|
||||
"required": "required",
|
||||
"default": "default",
|
||||
"default:": "default:",
|
||||
"choices:": "choices:",
|
||||
"aliases:": "aliases:",
|
||||
"generated-value": "generated-value",
|
||||
"Not enough non-option arguments: got %s, need at least %s": {
|
||||
"one": "Not enough non-option arguments: got %s, need at least %s",
|
||||
"other": "Not enough non-option arguments: got %s, need at least %s"
|
||||
},
|
||||
"Too many non-option arguments: got %s, maximum of %s": {
|
||||
"one": "Too many non-option arguments: got %s, maximum of %s",
|
||||
"other": "Too many non-option arguments: got %s, maximum of %s"
|
||||
},
|
||||
"Missing argument value: %s": {
|
||||
"one": "Missing argument value: %s",
|
||||
"other": "Missing argument values: %s"
|
||||
},
|
||||
"Missing required argument: %s": {
|
||||
"one": "Missing required argument: %s",
|
||||
"other": "Missing required arguments: %s"
|
||||
},
|
||||
"Unknown argument: %s": {
|
||||
"one": "Unknown argument: %s",
|
||||
"other": "Unknown arguments: %s"
|
||||
},
|
||||
"Unknown command: %s": {
|
||||
"one": "Unknown command: %s",
|
||||
"other": "Unknown commands: %s"
|
||||
},
|
||||
"Invalid values:": "Invalid values:",
|
||||
"Argument: %s, Given: %s, Choices: %s": "Argument: %s, Given: %s, Choices: %s",
|
||||
"Argument check failed: %s": "Argument check failed: %s",
|
||||
"Implications failed:": "Missing dependent arguments:",
|
||||
"Not enough arguments following: %s": "Not enough arguments following: %s",
|
||||
"Invalid JSON config file: %s": "Invalid JSON config file: %s",
|
||||
"Path to JSON config file": "Path to JSON config file",
|
||||
"Show help": "Show help",
|
||||
"Show version number": "Show version number",
|
||||
"Did you mean %s?": "Did you mean %s?",
|
||||
"Arguments %s and %s are mutually exclusive" : "Arguments %s and %s are mutually exclusive",
|
||||
"Positionals:": "Positionals:",
|
||||
"command": "command",
|
||||
"deprecated": "deprecated",
|
||||
"deprecated: %s": "deprecated: %s"
|
||||
}
|
||||
46
node_modules/@grpc/proto-loader/node_modules/yargs/locales/es.json
generated
vendored
Normal file
46
node_modules/@grpc/proto-loader/node_modules/yargs/locales/es.json
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"Commands:": "Comandos:",
|
||||
"Options:": "Opciones:",
|
||||
"Examples:": "Ejemplos:",
|
||||
"boolean": "booleano",
|
||||
"count": "cuenta",
|
||||
"string": "cadena de caracteres",
|
||||
"number": "número",
|
||||
"array": "tabla",
|
||||
"required": "requerido",
|
||||
"default": "defecto",
|
||||
"default:": "defecto:",
|
||||
"choices:": "selección:",
|
||||
"aliases:": "alias:",
|
||||
"generated-value": "valor-generado",
|
||||
"Not enough non-option arguments: got %s, need at least %s": {
|
||||
"one": "Hacen falta argumentos no-opcionales: Número recibido %s, necesita por lo menos %s",
|
||||
"other": "Hacen falta argumentos no-opcionales: Número recibido %s, necesita por lo menos %s"
|
||||
},
|
||||
"Too many non-option arguments: got %s, maximum of %s": {
|
||||
"one": "Demasiados argumentos no-opcionales: Número recibido %s, máximo es %s",
|
||||
"other": "Demasiados argumentos no-opcionales: Número recibido %s, máximo es %s"
|
||||
},
|
||||
"Missing argument value: %s": {
|
||||
"one": "Falta argumento: %s",
|
||||
"other": "Faltan argumentos: %s"
|
||||
},
|
||||
"Missing required argument: %s": {
|
||||
"one": "Falta argumento requerido: %s",
|
||||
"other": "Faltan argumentos requeridos: %s"
|
||||
},
|
||||
"Unknown argument: %s": {
|
||||
"one": "Argumento desconocido: %s",
|
||||
"other": "Argumentos desconocidos: %s"
|
||||
},
|
||||
"Invalid values:": "Valores inválidos:",
|
||||
"Argument: %s, Given: %s, Choices: %s": "Argumento: %s, Recibido: %s, Seleccionados: %s",
|
||||
"Argument check failed: %s": "Verificación de argumento ha fallado: %s",
|
||||
"Implications failed:": "Implicaciones fallidas:",
|
||||
"Not enough arguments following: %s": "No hay suficientes argumentos después de: %s",
|
||||
"Invalid JSON config file: %s": "Archivo de configuración JSON inválido: %s",
|
||||
"Path to JSON config file": "Ruta al archivo de configuración JSON",
|
||||
"Show help": "Muestra ayuda",
|
||||
"Show version number": "Muestra número de versión",
|
||||
"Did you mean %s?": "Quisiste decir %s?"
|
||||
}
|
||||
49
node_modules/@grpc/proto-loader/node_modules/yargs/locales/fi.json
generated
vendored
Normal file
49
node_modules/@grpc/proto-loader/node_modules/yargs/locales/fi.json
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
{
|
||||
"Commands:": "Komennot:",
|
||||
"Options:": "Valinnat:",
|
||||
"Examples:": "Esimerkkejä:",
|
||||
"boolean": "totuusarvo",
|
||||
"count": "lukumäärä",
|
||||
"string": "merkkijono",
|
||||
"number": "numero",
|
||||
"array": "taulukko",
|
||||
"required": "pakollinen",
|
||||
"default": "oletusarvo",
|
||||
"default:": "oletusarvo:",
|
||||
"choices:": "vaihtoehdot:",
|
||||
"aliases:": "aliakset:",
|
||||
"generated-value": "generoitu-arvo",
|
||||
"Not enough non-option arguments: got %s, need at least %s": {
|
||||
"one": "Liian vähän argumentteja, jotka eivät ole valintoja: annettu %s, vaaditaan vähintään %s",
|
||||
"other": "Liian vähän argumentteja, jotka eivät ole valintoja: annettu %s, vaaditaan vähintään %s"
|
||||
},
|
||||
"Too many non-option arguments: got %s, maximum of %s": {
|
||||
"one": "Liikaa argumentteja, jotka eivät ole valintoja: annettu %s, sallitaan enintään %s",
|
||||
"other": "Liikaa argumentteja, jotka eivät ole valintoja: annettu %s, sallitaan enintään %s"
|
||||
},
|
||||
"Missing argument value: %s": {
|
||||
"one": "Argumentin arvo puuttuu: %s",
|
||||
"other": "Argumentin arvot puuttuvat: %s"
|
||||
},
|
||||
"Missing required argument: %s": {
|
||||
"one": "Pakollinen argumentti puuttuu: %s",
|
||||
"other": "Pakollisia argumentteja puuttuu: %s"
|
||||
},
|
||||
"Unknown argument: %s": {
|
||||
"one": "Tuntematon argumentti: %s",
|
||||
"other": "Tuntemattomia argumentteja: %s"
|
||||
},
|
||||
"Invalid values:": "Virheelliset arvot:",
|
||||
"Argument: %s, Given: %s, Choices: %s": "Argumentti: %s, Annettu: %s, Vaihtoehdot: %s",
|
||||
"Argument check failed: %s": "Argumentin tarkistus epäonnistui: %s",
|
||||
"Implications failed:": "Riippuvia argumentteja puuttuu:",
|
||||
"Not enough arguments following: %s": "Argumentin perässä ei ole tarpeeksi argumentteja: %s",
|
||||
"Invalid JSON config file: %s": "Epävalidi JSON-asetustiedosto: %s",
|
||||
"Path to JSON config file": "JSON-asetustiedoston polku",
|
||||
"Show help": "Näytä ohje",
|
||||
"Show version number": "Näytä versionumero",
|
||||
"Did you mean %s?": "Tarkoititko %s?",
|
||||
"Arguments %s and %s are mutually exclusive" : "Argumentit %s ja %s eivät ole yhteensopivat",
|
||||
"Positionals:": "Sijaintiparametrit:",
|
||||
"command": "komento"
|
||||
}
|
||||
53
node_modules/@grpc/proto-loader/node_modules/yargs/locales/fr.json
generated
vendored
Normal file
53
node_modules/@grpc/proto-loader/node_modules/yargs/locales/fr.json
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
{
|
||||
"Commands:": "Commandes :",
|
||||
"Options:": "Options :",
|
||||
"Examples:": "Exemples :",
|
||||
"boolean": "booléen",
|
||||
"count": "compteur",
|
||||
"string": "chaîne de caractères",
|
||||
"number": "nombre",
|
||||
"array": "tableau",
|
||||
"required": "requis",
|
||||
"default": "défaut",
|
||||
"default:": "défaut :",
|
||||
"choices:": "choix :",
|
||||
"aliases:": "alias :",
|
||||
"generated-value": "valeur générée",
|
||||
"Not enough non-option arguments: got %s, need at least %s": {
|
||||
"one": "Pas assez d'arguments (hors options) : reçu %s, besoin d'au moins %s",
|
||||
"other": "Pas assez d'arguments (hors options) : reçus %s, besoin d'au moins %s"
|
||||
},
|
||||
"Too many non-option arguments: got %s, maximum of %s": {
|
||||
"one": "Trop d'arguments (hors options) : reçu %s, maximum de %s",
|
||||
"other": "Trop d'arguments (hors options) : reçus %s, maximum de %s"
|
||||
},
|
||||
"Missing argument value: %s": {
|
||||
"one": "Argument manquant : %s",
|
||||
"other": "Arguments manquants : %s"
|
||||
},
|
||||
"Missing required argument: %s": {
|
||||
"one": "Argument requis manquant : %s",
|
||||
"other": "Arguments requis manquants : %s"
|
||||
},
|
||||
"Unknown argument: %s": {
|
||||
"one": "Argument inconnu : %s",
|
||||
"other": "Arguments inconnus : %s"
|
||||
},
|
||||
"Unknown command: %s": {
|
||||
"one": "Commande inconnue : %s",
|
||||
"other": "Commandes inconnues : %s"
|
||||
},
|
||||
"Invalid values:": "Valeurs invalides :",
|
||||
"Argument: %s, Given: %s, Choices: %s": "Argument : %s, donné : %s, choix : %s",
|
||||
"Argument check failed: %s": "Echec de la vérification de l'argument : %s",
|
||||
"Implications failed:": "Arguments dépendants manquants :",
|
||||
"Not enough arguments following: %s": "Pas assez d'arguments après : %s",
|
||||
"Invalid JSON config file: %s": "Fichier de configuration JSON invalide : %s",
|
||||
"Path to JSON config file": "Chemin du fichier de configuration JSON",
|
||||
"Show help": "Affiche l'aide",
|
||||
"Show version number": "Affiche le numéro de version",
|
||||
"Did you mean %s?": "Vouliez-vous dire %s ?",
|
||||
"Arguments %s and %s are mutually exclusive" : "Les arguments %s et %s sont mutuellement exclusifs",
|
||||
"Positionals:": "Arguments positionnels :",
|
||||
"command": "commande"
|
||||
}
|
||||
49
node_modules/@grpc/proto-loader/node_modules/yargs/locales/hi.json
generated
vendored
Normal file
49
node_modules/@grpc/proto-loader/node_modules/yargs/locales/hi.json
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
{
|
||||
"Commands:": "आदेश:",
|
||||
"Options:": "विकल्प:",
|
||||
"Examples:": "उदाहरण:",
|
||||
"boolean": "सत्यता",
|
||||
"count": "संख्या",
|
||||
"string": "वर्णों का तार ",
|
||||
"number": "अंक",
|
||||
"array": "सरणी",
|
||||
"required": "आवश्यक",
|
||||
"default": "डिफॉल्ट",
|
||||
"default:": "डिफॉल्ट:",
|
||||
"choices:": "विकल्प:",
|
||||
"aliases:": "उपनाम:",
|
||||
"generated-value": "उत्पन्न-मूल्य",
|
||||
"Not enough non-option arguments: got %s, need at least %s": {
|
||||
"one": "पर्याप्त गैर-विकल्प तर्क प्राप्त नहीं: %s प्राप्त, कम से कम %s की आवश्यकता है",
|
||||
"other": "पर्याप्त गैर-विकल्प तर्क प्राप्त नहीं: %s प्राप्त, कम से कम %s की आवश्यकता है"
|
||||
},
|
||||
"Too many non-option arguments: got %s, maximum of %s": {
|
||||
"one": "बहुत सारे गैर-विकल्प तर्क: %s प्राप्त, अधिकतम %s मान्य",
|
||||
"other": "बहुत सारे गैर-विकल्प तर्क: %s प्राप्त, अधिकतम %s मान्य"
|
||||
},
|
||||
"Missing argument value: %s": {
|
||||
"one": "कुछ तर्को के मूल्य गुम हैं: %s",
|
||||
"other": "कुछ तर्को के मूल्य गुम हैं: %s"
|
||||
},
|
||||
"Missing required argument: %s": {
|
||||
"one": "आवश्यक तर्क गुम हैं: %s",
|
||||
"other": "आवश्यक तर्क गुम हैं: %s"
|
||||
},
|
||||
"Unknown argument: %s": {
|
||||
"one": "अज्ञात तर्क प्राप्त: %s",
|
||||
"other": "अज्ञात तर्क प्राप्त: %s"
|
||||
},
|
||||
"Invalid values:": "अमान्य मूल्य:",
|
||||
"Argument: %s, Given: %s, Choices: %s": "तर्क: %s, प्राप्त: %s, विकल्प: %s",
|
||||
"Argument check failed: %s": "तर्क जांच विफल: %s",
|
||||
"Implications failed:": "दिए गए तर्क के लिए अतिरिक्त तर्क की अपेक्षा है:",
|
||||
"Not enough arguments following: %s": "निम्नलिखित के बाद पर्याप्त तर्क नहीं प्राप्त: %s",
|
||||
"Invalid JSON config file: %s": "अमान्य JSON config फाइल: %s",
|
||||
"Path to JSON config file": "JSON config फाइल का पथ",
|
||||
"Show help": "सहायता दिखाएँ",
|
||||
"Show version number": "Version संख्या दिखाएँ",
|
||||
"Did you mean %s?": "क्या आपका मतलब है %s?",
|
||||
"Arguments %s and %s are mutually exclusive" : "तर्क %s और %s परस्पर अनन्य हैं",
|
||||
"Positionals:": "स्थानीय:",
|
||||
"command": "आदेश"
|
||||
}
|
||||
46
node_modules/@grpc/proto-loader/node_modules/yargs/locales/hu.json
generated
vendored
Normal file
46
node_modules/@grpc/proto-loader/node_modules/yargs/locales/hu.json
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"Commands:": "Parancsok:",
|
||||
"Options:": "Opciók:",
|
||||
"Examples:": "Példák:",
|
||||
"boolean": "boolean",
|
||||
"count": "számláló",
|
||||
"string": "szöveg",
|
||||
"number": "szám",
|
||||
"array": "tömb",
|
||||
"required": "kötelező",
|
||||
"default": "alapértelmezett",
|
||||
"default:": "alapértelmezett:",
|
||||
"choices:": "lehetőségek:",
|
||||
"aliases:": "aliaszok:",
|
||||
"generated-value": "generált-érték",
|
||||
"Not enough non-option arguments: got %s, need at least %s": {
|
||||
"one": "Nincs elég nem opcionális argumentum: %s van, legalább %s kell",
|
||||
"other": "Nincs elég nem opcionális argumentum: %s van, legalább %s kell"
|
||||
},
|
||||
"Too many non-option arguments: got %s, maximum of %s": {
|
||||
"one": "Túl sok nem opciánlis argumentum van: %s van, maximum %s lehet",
|
||||
"other": "Túl sok nem opciánlis argumentum van: %s van, maximum %s lehet"
|
||||
},
|
||||
"Missing argument value: %s": {
|
||||
"one": "Hiányzó argumentum érték: %s",
|
||||
"other": "Hiányzó argumentum értékek: %s"
|
||||
},
|
||||
"Missing required argument: %s": {
|
||||
"one": "Hiányzó kötelező argumentum: %s",
|
||||
"other": "Hiányzó kötelező argumentumok: %s"
|
||||
},
|
||||
"Unknown argument: %s": {
|
||||
"one": "Ismeretlen argumentum: %s",
|
||||
"other": "Ismeretlen argumentumok: %s"
|
||||
},
|
||||
"Invalid values:": "Érvénytelen érték:",
|
||||
"Argument: %s, Given: %s, Choices: %s": "Argumentum: %s, Megadott: %s, Lehetőségek: %s",
|
||||
"Argument check failed: %s": "Argumentum ellenőrzés sikertelen: %s",
|
||||
"Implications failed:": "Implikációk sikertelenek:",
|
||||
"Not enough arguments following: %s": "Nem elég argumentum követi: %s",
|
||||
"Invalid JSON config file: %s": "Érvénytelen JSON konfigurációs file: %s",
|
||||
"Path to JSON config file": "JSON konfigurációs file helye",
|
||||
"Show help": "Súgo megjelenítése",
|
||||
"Show version number": "Verziószám megjelenítése",
|
||||
"Did you mean %s?": "Erre gondoltál %s?"
|
||||
}
|
||||
50
node_modules/@grpc/proto-loader/node_modules/yargs/locales/id.json
generated
vendored
Normal file
50
node_modules/@grpc/proto-loader/node_modules/yargs/locales/id.json
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
|
||||
{
|
||||
"Commands:": "Perintah:",
|
||||
"Options:": "Pilihan:",
|
||||
"Examples:": "Contoh:",
|
||||
"boolean": "boolean",
|
||||
"count": "jumlah",
|
||||
"number": "nomor",
|
||||
"string": "string",
|
||||
"array": "larik",
|
||||
"required": "diperlukan",
|
||||
"default": "bawaan",
|
||||
"default:": "bawaan:",
|
||||
"aliases:": "istilah lain:",
|
||||
"choices:": "pilihan:",
|
||||
"generated-value": "nilai-yang-dihasilkan",
|
||||
"Not enough non-option arguments: got %s, need at least %s": {
|
||||
"one": "Argumen wajib kurang: hanya %s, minimal %s",
|
||||
"other": "Argumen wajib kurang: hanya %s, minimal %s"
|
||||
},
|
||||
"Too many non-option arguments: got %s, maximum of %s": {
|
||||
"one": "Terlalu banyak argumen wajib: ada %s, maksimal %s",
|
||||
"other": "Terlalu banyak argumen wajib: ada %s, maksimal %s"
|
||||
},
|
||||
"Missing argument value: %s": {
|
||||
"one": "Kurang argumen: %s",
|
||||
"other": "Kurang argumen: %s"
|
||||
},
|
||||
"Missing required argument: %s": {
|
||||
"one": "Kurang argumen wajib: %s",
|
||||
"other": "Kurang argumen wajib: %s"
|
||||
},
|
||||
"Unknown argument: %s": {
|
||||
"one": "Argumen tak diketahui: %s",
|
||||
"other": "Argumen tak diketahui: %s"
|
||||
},
|
||||
"Invalid values:": "Nilai-nilai tidak valid:",
|
||||
"Argument: %s, Given: %s, Choices: %s": "Argumen: %s, Diberikan: %s, Pilihan: %s",
|
||||
"Argument check failed: %s": "Pemeriksaan argument gagal: %s",
|
||||
"Implications failed:": "Implikasi gagal:",
|
||||
"Not enough arguments following: %s": "Kurang argumen untuk: %s",
|
||||
"Invalid JSON config file: %s": "Berkas konfigurasi JSON tidak valid: %s",
|
||||
"Path to JSON config file": "Alamat berkas konfigurasi JSON",
|
||||
"Show help": "Lihat bantuan",
|
||||
"Show version number": "Lihat nomor versi",
|
||||
"Did you mean %s?": "Maksud Anda: %s?",
|
||||
"Arguments %s and %s are mutually exclusive" : "Argumen %s dan %s saling eksklusif",
|
||||
"Positionals:": "Posisional-posisional:",
|
||||
"command": "perintah"
|
||||
}
|
||||
46
node_modules/@grpc/proto-loader/node_modules/yargs/locales/it.json
generated
vendored
Normal file
46
node_modules/@grpc/proto-loader/node_modules/yargs/locales/it.json
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"Commands:": "Comandi:",
|
||||
"Options:": "Opzioni:",
|
||||
"Examples:": "Esempi:",
|
||||
"boolean": "booleano",
|
||||
"count": "contatore",
|
||||
"string": "stringa",
|
||||
"number": "numero",
|
||||
"array": "vettore",
|
||||
"required": "richiesto",
|
||||
"default": "predefinito",
|
||||
"default:": "predefinito:",
|
||||
"choices:": "scelte:",
|
||||
"aliases:": "alias:",
|
||||
"generated-value": "valore generato",
|
||||
"Not enough non-option arguments: got %s, need at least %s": {
|
||||
"one": "Numero insufficiente di argomenti non opzione: inseriti %s, richiesti almeno %s",
|
||||
"other": "Numero insufficiente di argomenti non opzione: inseriti %s, richiesti almeno %s"
|
||||
},
|
||||
"Too many non-option arguments: got %s, maximum of %s": {
|
||||
"one": "Troppi argomenti non opzione: inseriti %s, massimo possibile %s",
|
||||
"other": "Troppi argomenti non opzione: inseriti %s, massimo possibile %s"
|
||||
},
|
||||
"Missing argument value: %s": {
|
||||
"one": "Argomento mancante: %s",
|
||||
"other": "Argomenti mancanti: %s"
|
||||
},
|
||||
"Missing required argument: %s": {
|
||||
"one": "Argomento richiesto mancante: %s",
|
||||
"other": "Argomenti richiesti mancanti: %s"
|
||||
},
|
||||
"Unknown argument: %s": {
|
||||
"one": "Argomento sconosciuto: %s",
|
||||
"other": "Argomenti sconosciuti: %s"
|
||||
},
|
||||
"Invalid values:": "Valori non validi:",
|
||||
"Argument: %s, Given: %s, Choices: %s": "Argomento: %s, Richiesto: %s, Scelte: %s",
|
||||
"Argument check failed: %s": "Controllo dell'argomento fallito: %s",
|
||||
"Implications failed:": "Argomenti dipendenti mancanti:",
|
||||
"Not enough arguments following: %s": "Argomenti insufficienti dopo: %s",
|
||||
"Invalid JSON config file: %s": "File di configurazione JSON non valido: %s",
|
||||
"Path to JSON config file": "Percorso del file di configurazione JSON",
|
||||
"Show help": "Mostra la schermata di aiuto",
|
||||
"Show version number": "Mostra il numero di versione",
|
||||
"Did you mean %s?": "Intendi forse %s?"
|
||||
}
|
||||
51
node_modules/@grpc/proto-loader/node_modules/yargs/locales/ja.json
generated
vendored
Normal file
51
node_modules/@grpc/proto-loader/node_modules/yargs/locales/ja.json
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
{
|
||||
"Commands:": "コマンド:",
|
||||
"Options:": "オプション:",
|
||||
"Examples:": "例:",
|
||||
"boolean": "真偽",
|
||||
"count": "カウント",
|
||||
"string": "文字列",
|
||||
"number": "数値",
|
||||
"array": "配列",
|
||||
"required": "必須",
|
||||
"default": "デフォルト",
|
||||
"default:": "デフォルト:",
|
||||
"choices:": "選択してください:",
|
||||
"aliases:": "エイリアス:",
|
||||
"generated-value": "生成された値",
|
||||
"Not enough non-option arguments: got %s, need at least %s": {
|
||||
"one": "オプションではない引数が %s 個では不足しています。少なくとも %s 個の引数が必要です:",
|
||||
"other": "オプションではない引数が %s 個では不足しています。少なくとも %s 個の引数が必要です:"
|
||||
},
|
||||
"Too many non-option arguments: got %s, maximum of %s": {
|
||||
"one": "オプションではない引数が %s 個では多すぎます。最大で %s 個までです:",
|
||||
"other": "オプションではない引数が %s 個では多すぎます。最大で %s 個までです:"
|
||||
},
|
||||
"Missing argument value: %s": {
|
||||
"one": "引数の値が見つかりません: %s",
|
||||
"other": "引数の値が見つかりません: %s"
|
||||
},
|
||||
"Missing required argument: %s": {
|
||||
"one": "必須の引数が見つかりません: %s",
|
||||
"other": "必須の引数が見つかりません: %s"
|
||||
},
|
||||
"Unknown argument: %s": {
|
||||
"one": "未知の引数です: %s",
|
||||
"other": "未知の引数です: %s"
|
||||
},
|
||||
"Invalid values:": "不正な値です:",
|
||||
"Argument: %s, Given: %s, Choices: %s": "引数は %s です。与えられた値: %s, 選択してください: %s",
|
||||
"Argument check failed: %s": "引数のチェックに失敗しました: %s",
|
||||
"Implications failed:": "オプションの組み合わせで不正が生じました:",
|
||||
"Not enough arguments following: %s": "次の引数が不足しています。: %s",
|
||||
"Invalid JSON config file: %s": "JSONの設定ファイルが不正です: %s",
|
||||
"Path to JSON config file": "JSONの設定ファイルまでのpath",
|
||||
"Show help": "ヘルプを表示",
|
||||
"Show version number": "バージョンを表示",
|
||||
"Did you mean %s?": "もしかして %s?",
|
||||
"Arguments %s and %s are mutually exclusive" : "引数 %s と %s は同時に指定できません",
|
||||
"Positionals:": "位置:",
|
||||
"command": "コマンド",
|
||||
"deprecated": "非推奨",
|
||||
"deprecated: %s": "非推奨: %s"
|
||||
}
|
||||
49
node_modules/@grpc/proto-loader/node_modules/yargs/locales/ko.json
generated
vendored
Normal file
49
node_modules/@grpc/proto-loader/node_modules/yargs/locales/ko.json
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
{
|
||||
"Commands:": "명령:",
|
||||
"Options:": "옵션:",
|
||||
"Examples:": "예시:",
|
||||
"boolean": "불리언",
|
||||
"count": "개수",
|
||||
"string": "문자열",
|
||||
"number": "숫자",
|
||||
"array": "배열",
|
||||
"required": "필수",
|
||||
"default": "기본값",
|
||||
"default:": "기본값:",
|
||||
"choices:": "선택지:",
|
||||
"aliases:": "별칭:",
|
||||
"generated-value": "생성된 값",
|
||||
"Not enough non-option arguments: got %s, need at least %s": {
|
||||
"one": "옵션이 아닌 인수가 충분하지 않습니다: %s개 입력받음, 최소 %s개 입력 필요",
|
||||
"other": "옵션이 아닌 인수가 충분하지 않습니다: %s개 입력받음, 최소 %s개 입력 필요"
|
||||
},
|
||||
"Too many non-option arguments: got %s, maximum of %s": {
|
||||
"one": "옵션이 아닌 인수가 너무 많습니다: %s개 입력받음, 최대 %s개 입력 가능",
|
||||
"other": "옵션이 아닌 인수가 너무 많습니다: %s개 입력받음, 최대 %s개 입력 가능"
|
||||
},
|
||||
"Missing argument value: %s": {
|
||||
"one": "인수가 주어지지 않았습니다: %s",
|
||||
"other": "인수가 주어지지 않았습니다: %s"
|
||||
},
|
||||
"Missing required argument: %s": {
|
||||
"one": "필수 인수가 주어지지 않았습니다: %s",
|
||||
"other": "필수 인수가 주어지지 않았습니다: %s"
|
||||
},
|
||||
"Unknown argument: %s": {
|
||||
"one": "알 수 없는 인수입니다: %s",
|
||||
"other": "알 수 없는 인수입니다: %s"
|
||||
},
|
||||
"Invalid values:": "유효하지 않은 값:",
|
||||
"Argument: %s, Given: %s, Choices: %s": "인수: %s, 주어진 값: %s, 선택지: %s",
|
||||
"Argument check failed: %s": "인수 체크에 실패했습니다: %s",
|
||||
"Implications failed:": "주어진 인수에 필요한 추가 인수가 주어지지 않았습니다:",
|
||||
"Not enough arguments following: %s": "다음 인수가 주어지지 않았습니다: %s",
|
||||
"Invalid JSON config file: %s": "유효하지 않은 JSON 설정 파일: %s",
|
||||
"Path to JSON config file": "JSON 설정 파일 경로",
|
||||
"Show help": "도움말 표시",
|
||||
"Show version number": "버전 표시",
|
||||
"Did you mean %s?": "%s을(를) 찾으시나요?",
|
||||
"Arguments %s and %s are mutually exclusive" : "인수 %s과(와) %s은(는) 동시에 지정할 수 없습니다",
|
||||
"Positionals:": "위치:",
|
||||
"command": "명령"
|
||||
}
|
||||
44
node_modules/@grpc/proto-loader/node_modules/yargs/locales/nb.json
generated
vendored
Normal file
44
node_modules/@grpc/proto-loader/node_modules/yargs/locales/nb.json
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
{
|
||||
"Commands:": "Kommandoer:",
|
||||
"Options:": "Alternativer:",
|
||||
"Examples:": "Eksempler:",
|
||||
"boolean": "boolsk",
|
||||
"count": "antall",
|
||||
"string": "streng",
|
||||
"number": "nummer",
|
||||
"array": "matrise",
|
||||
"required": "obligatorisk",
|
||||
"default": "standard",
|
||||
"default:": "standard:",
|
||||
"choices:": "valg:",
|
||||
"generated-value": "generert-verdi",
|
||||
"Not enough non-option arguments: got %s, need at least %s": {
|
||||
"one": "Ikke nok ikke-alternativ argumenter: fikk %s, trenger minst %s",
|
||||
"other": "Ikke nok ikke-alternativ argumenter: fikk %s, trenger minst %s"
|
||||
},
|
||||
"Too many non-option arguments: got %s, maximum of %s": {
|
||||
"one": "For mange ikke-alternativ argumenter: fikk %s, maksimum %s",
|
||||
"other": "For mange ikke-alternativ argumenter: fikk %s, maksimum %s"
|
||||
},
|
||||
"Missing argument value: %s": {
|
||||
"one": "Mangler argument verdi: %s",
|
||||
"other": "Mangler argument verdier: %s"
|
||||
},
|
||||
"Missing required argument: %s": {
|
||||
"one": "Mangler obligatorisk argument: %s",
|
||||
"other": "Mangler obligatoriske argumenter: %s"
|
||||
},
|
||||
"Unknown argument: %s": {
|
||||
"one": "Ukjent argument: %s",
|
||||
"other": "Ukjente argumenter: %s"
|
||||
},
|
||||
"Invalid values:": "Ugyldige verdier:",
|
||||
"Argument: %s, Given: %s, Choices: %s": "Argument: %s, Gitt: %s, Valg: %s",
|
||||
"Argument check failed: %s": "Argumentsjekk mislyktes: %s",
|
||||
"Implications failed:": "Konsekvensene mislyktes:",
|
||||
"Not enough arguments following: %s": "Ikke nok følgende argumenter: %s",
|
||||
"Invalid JSON config file: %s": "Ugyldig JSON konfigurasjonsfil: %s",
|
||||
"Path to JSON config file": "Bane til JSON konfigurasjonsfil",
|
||||
"Show help": "Vis hjelp",
|
||||
"Show version number": "Vis versjonsnummer"
|
||||
}
|
||||
49
node_modules/@grpc/proto-loader/node_modules/yargs/locales/nl.json
generated
vendored
Normal file
49
node_modules/@grpc/proto-loader/node_modules/yargs/locales/nl.json
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
{
|
||||
"Commands:": "Commando's:",
|
||||
"Options:": "Opties:",
|
||||
"Examples:": "Voorbeelden:",
|
||||
"boolean": "booleaans",
|
||||
"count": "aantal",
|
||||
"string": "string",
|
||||
"number": "getal",
|
||||
"array": "lijst",
|
||||
"required": "verplicht",
|
||||
"default": "standaard",
|
||||
"default:": "standaard:",
|
||||
"choices:": "keuzes:",
|
||||
"aliases:": "aliassen:",
|
||||
"generated-value": "gegenereerde waarde",
|
||||
"Not enough non-option arguments: got %s, need at least %s": {
|
||||
"one": "Niet genoeg niet-optie-argumenten: %s gekregen, minstens %s nodig",
|
||||
"other": "Niet genoeg niet-optie-argumenten: %s gekregen, minstens %s nodig"
|
||||
},
|
||||
"Too many non-option arguments: got %s, maximum of %s": {
|
||||
"one": "Te veel niet-optie-argumenten: %s gekregen, maximum is %s",
|
||||
"other": "Te veel niet-optie-argumenten: %s gekregen, maximum is %s"
|
||||
},
|
||||
"Missing argument value: %s": {
|
||||
"one": "Missende argumentwaarde: %s",
|
||||
"other": "Missende argumentwaarden: %s"
|
||||
},
|
||||
"Missing required argument: %s": {
|
||||
"one": "Missend verplicht argument: %s",
|
||||
"other": "Missende verplichte argumenten: %s"
|
||||
},
|
||||
"Unknown argument: %s": {
|
||||
"one": "Onbekend argument: %s",
|
||||
"other": "Onbekende argumenten: %s"
|
||||
},
|
||||
"Invalid values:": "Ongeldige waarden:",
|
||||
"Argument: %s, Given: %s, Choices: %s": "Argument: %s, Gegeven: %s, Keuzes: %s",
|
||||
"Argument check failed: %s": "Argumentcontrole mislukt: %s",
|
||||
"Implications failed:": "Ontbrekende afhankelijke argumenten:",
|
||||
"Not enough arguments following: %s": "Niet genoeg argumenten na: %s",
|
||||
"Invalid JSON config file: %s": "Ongeldig JSON-config-bestand: %s",
|
||||
"Path to JSON config file": "Pad naar JSON-config-bestand",
|
||||
"Show help": "Toon help",
|
||||
"Show version number": "Toon versienummer",
|
||||
"Did you mean %s?": "Bedoelde u misschien %s?",
|
||||
"Arguments %s and %s are mutually exclusive": "Argumenten %s en %s kunnen niet tegelijk gebruikt worden",
|
||||
"Positionals:": "Positie-afhankelijke argumenten",
|
||||
"command": "commando"
|
||||
}
|
||||
44
node_modules/@grpc/proto-loader/node_modules/yargs/locales/nn.json
generated
vendored
Normal file
44
node_modules/@grpc/proto-loader/node_modules/yargs/locales/nn.json
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
{
|
||||
"Commands:": "Kommandoar:",
|
||||
"Options:": "Alternativ:",
|
||||
"Examples:": "Døme:",
|
||||
"boolean": "boolsk",
|
||||
"count": "mengd",
|
||||
"string": "streng",
|
||||
"number": "nummer",
|
||||
"array": "matrise",
|
||||
"required": "obligatorisk",
|
||||
"default": "standard",
|
||||
"default:": "standard:",
|
||||
"choices:": "val:",
|
||||
"generated-value": "generert-verdi",
|
||||
"Not enough non-option arguments: got %s, need at least %s": {
|
||||
"one": "Ikkje nok ikkje-alternativ argument: fekk %s, treng minst %s",
|
||||
"other": "Ikkje nok ikkje-alternativ argument: fekk %s, treng minst %s"
|
||||
},
|
||||
"Too many non-option arguments: got %s, maximum of %s": {
|
||||
"one": "For mange ikkje-alternativ argument: fekk %s, maksimum %s",
|
||||
"other": "For mange ikkje-alternativ argument: fekk %s, maksimum %s"
|
||||
},
|
||||
"Missing argument value: %s": {
|
||||
"one": "Manglar argumentverdi: %s",
|
||||
"other": "Manglar argumentverdiar: %s"
|
||||
},
|
||||
"Missing required argument: %s": {
|
||||
"one": "Manglar obligatorisk argument: %s",
|
||||
"other": "Manglar obligatoriske argument: %s"
|
||||
},
|
||||
"Unknown argument: %s": {
|
||||
"one": "Ukjent argument: %s",
|
||||
"other": "Ukjende argument: %s"
|
||||
},
|
||||
"Invalid values:": "Ugyldige verdiar:",
|
||||
"Argument: %s, Given: %s, Choices: %s": "Argument: %s, Gjeve: %s, Val: %s",
|
||||
"Argument check failed: %s": "Argumentsjekk mislukkast: %s",
|
||||
"Implications failed:": "Konsekvensane mislukkast:",
|
||||
"Not enough arguments following: %s": "Ikkje nok fylgjande argument: %s",
|
||||
"Invalid JSON config file: %s": "Ugyldig JSON konfigurasjonsfil: %s",
|
||||
"Path to JSON config file": "Bane til JSON konfigurasjonsfil",
|
||||
"Show help": "Vis hjelp",
|
||||
"Show version number": "Vis versjonsnummer"
|
||||
}
|
||||
13
node_modules/@grpc/proto-loader/node_modules/yargs/locales/pirate.json
generated
vendored
Normal file
13
node_modules/@grpc/proto-loader/node_modules/yargs/locales/pirate.json
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"Commands:": "Choose yer command:",
|
||||
"Options:": "Options for me hearties!",
|
||||
"Examples:": "Ex. marks the spot:",
|
||||
"required": "requi-yar-ed",
|
||||
"Missing required argument: %s": {
|
||||
"one": "Ye be havin' to set the followin' argument land lubber: %s",
|
||||
"other": "Ye be havin' to set the followin' arguments land lubber: %s"
|
||||
},
|
||||
"Show help": "Parlay this here code of conduct",
|
||||
"Show version number": "'Tis the version ye be askin' fer",
|
||||
"Arguments %s and %s are mutually exclusive" : "Yon scurvy dogs %s and %s be as bad as rum and a prudish wench"
|
||||
}
|
||||
49
node_modules/@grpc/proto-loader/node_modules/yargs/locales/pl.json
generated
vendored
Normal file
49
node_modules/@grpc/proto-loader/node_modules/yargs/locales/pl.json
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
{
|
||||
"Commands:": "Polecenia:",
|
||||
"Options:": "Opcje:",
|
||||
"Examples:": "Przykłady:",
|
||||
"boolean": "boolean",
|
||||
"count": "ilość",
|
||||
"string": "ciąg znaków",
|
||||
"number": "liczba",
|
||||
"array": "tablica",
|
||||
"required": "wymagany",
|
||||
"default": "domyślny",
|
||||
"default:": "domyślny:",
|
||||
"choices:": "dostępne:",
|
||||
"aliases:": "aliasy:",
|
||||
"generated-value": "wygenerowana-wartość",
|
||||
"Not enough non-option arguments: got %s, need at least %s": {
|
||||
"one": "Niewystarczająca ilość argumentów: otrzymano %s, wymagane co najmniej %s",
|
||||
"other": "Niewystarczająca ilość argumentów: otrzymano %s, wymagane co najmniej %s"
|
||||
},
|
||||
"Too many non-option arguments: got %s, maximum of %s": {
|
||||
"one": "Zbyt duża ilość argumentów: otrzymano %s, wymagane co najwyżej %s",
|
||||
"other": "Zbyt duża ilość argumentów: otrzymano %s, wymagane co najwyżej %s"
|
||||
},
|
||||
"Missing argument value: %s": {
|
||||
"one": "Brak wartości dla argumentu: %s",
|
||||
"other": "Brak wartości dla argumentów: %s"
|
||||
},
|
||||
"Missing required argument: %s": {
|
||||
"one": "Brak wymaganego argumentu: %s",
|
||||
"other": "Brak wymaganych argumentów: %s"
|
||||
},
|
||||
"Unknown argument: %s": {
|
||||
"one": "Nieznany argument: %s",
|
||||
"other": "Nieznane argumenty: %s"
|
||||
},
|
||||
"Invalid values:": "Nieprawidłowe wartości:",
|
||||
"Argument: %s, Given: %s, Choices: %s": "Argument: %s, Otrzymano: %s, Dostępne: %s",
|
||||
"Argument check failed: %s": "Weryfikacja argumentów nie powiodła się: %s",
|
||||
"Implications failed:": "Założenia nie zostały spełnione:",
|
||||
"Not enough arguments following: %s": "Niewystarczająca ilość argumentów następujących po: %s",
|
||||
"Invalid JSON config file: %s": "Nieprawidłowy plik konfiguracyjny JSON: %s",
|
||||
"Path to JSON config file": "Ścieżka do pliku konfiguracyjnego JSON",
|
||||
"Show help": "Pokaż pomoc",
|
||||
"Show version number": "Pokaż numer wersji",
|
||||
"Did you mean %s?": "Czy chodziło Ci o %s?",
|
||||
"Arguments %s and %s are mutually exclusive": "Argumenty %s i %s wzajemnie się wykluczają",
|
||||
"Positionals:": "Pozycyjne:",
|
||||
"command": "polecenie"
|
||||
}
|
||||
45
node_modules/@grpc/proto-loader/node_modules/yargs/locales/pt.json
generated
vendored
Normal file
45
node_modules/@grpc/proto-loader/node_modules/yargs/locales/pt.json
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
{
|
||||
"Commands:": "Comandos:",
|
||||
"Options:": "Opções:",
|
||||
"Examples:": "Exemplos:",
|
||||
"boolean": "boolean",
|
||||
"count": "contagem",
|
||||
"string": "cadeia de caracteres",
|
||||
"number": "número",
|
||||
"array": "arranjo",
|
||||
"required": "requerido",
|
||||
"default": "padrão",
|
||||
"default:": "padrão:",
|
||||
"choices:": "escolhas:",
|
||||
"generated-value": "valor-gerado",
|
||||
"Not enough non-option arguments: got %s, need at least %s": {
|
||||
"one": "Argumentos insuficientes não opcionais: Argumento %s, necessário pelo menos %s",
|
||||
"other": "Argumentos insuficientes não opcionais: Argumento %s, necessário pelo menos %s"
|
||||
},
|
||||
"Too many non-option arguments: got %s, maximum of %s": {
|
||||
"one": "Excesso de argumentos não opcionais: recebido %s, máximo de %s",
|
||||
"other": "Excesso de argumentos não opcionais: recebido %s, máximo de %s"
|
||||
},
|
||||
"Missing argument value: %s": {
|
||||
"one": "Falta valor de argumento: %s",
|
||||
"other": "Falta valores de argumento: %s"
|
||||
},
|
||||
"Missing required argument: %s": {
|
||||
"one": "Falta argumento obrigatório: %s",
|
||||
"other": "Faltando argumentos obrigatórios: %s"
|
||||
},
|
||||
"Unknown argument: %s": {
|
||||
"one": "Argumento desconhecido: %s",
|
||||
"other": "Argumentos desconhecidos: %s"
|
||||
},
|
||||
"Invalid values:": "Valores inválidos:",
|
||||
"Argument: %s, Given: %s, Choices: %s": "Argumento: %s, Dado: %s, Escolhas: %s",
|
||||
"Argument check failed: %s": "Verificação de argumento falhou: %s",
|
||||
"Implications failed:": "Implicações falharam:",
|
||||
"Not enough arguments following: %s": "Insuficientes argumentos a seguir: %s",
|
||||
"Invalid JSON config file: %s": "Arquivo de configuração em JSON esta inválido: %s",
|
||||
"Path to JSON config file": "Caminho para o arquivo de configuração em JSON",
|
||||
"Show help": "Mostra ajuda",
|
||||
"Show version number": "Mostra número de versão",
|
||||
"Arguments %s and %s are mutually exclusive" : "Argumentos %s e %s são mutualmente exclusivos"
|
||||
}
|
||||
48
node_modules/@grpc/proto-loader/node_modules/yargs/locales/pt_BR.json
generated
vendored
Normal file
48
node_modules/@grpc/proto-loader/node_modules/yargs/locales/pt_BR.json
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
{
|
||||
"Commands:": "Comandos:",
|
||||
"Options:": "Opções:",
|
||||
"Examples:": "Exemplos:",
|
||||
"boolean": "booleano",
|
||||
"count": "contagem",
|
||||
"string": "string",
|
||||
"number": "número",
|
||||
"array": "array",
|
||||
"required": "obrigatório",
|
||||
"default:": "padrão:",
|
||||
"choices:": "opções:",
|
||||
"aliases:": "sinônimos:",
|
||||
"generated-value": "valor-gerado",
|
||||
"Not enough non-option arguments: got %s, need at least %s": {
|
||||
"one": "Argumentos insuficientes: Argumento %s, necessário pelo menos %s",
|
||||
"other": "Argumentos insuficientes: Argumento %s, necessário pelo menos %s"
|
||||
},
|
||||
"Too many non-option arguments: got %s, maximum of %s": {
|
||||
"one": "Excesso de argumentos: recebido %s, máximo de %s",
|
||||
"other": "Excesso de argumentos: recebido %s, máximo de %s"
|
||||
},
|
||||
"Missing argument value: %s": {
|
||||
"one": "Falta valor de argumento: %s",
|
||||
"other": "Falta valores de argumento: %s"
|
||||
},
|
||||
"Missing required argument: %s": {
|
||||
"one": "Falta argumento obrigatório: %s",
|
||||
"other": "Faltando argumentos obrigatórios: %s"
|
||||
},
|
||||
"Unknown argument: %s": {
|
||||
"one": "Argumento desconhecido: %s",
|
||||
"other": "Argumentos desconhecidos: %s"
|
||||
},
|
||||
"Invalid values:": "Valores inválidos:",
|
||||
"Argument: %s, Given: %s, Choices: %s": "Argumento: %s, Dado: %s, Opções: %s",
|
||||
"Argument check failed: %s": "Verificação de argumento falhou: %s",
|
||||
"Implications failed:": "Implicações falharam:",
|
||||
"Not enough arguments following: %s": "Argumentos insuficientes a seguir: %s",
|
||||
"Invalid JSON config file: %s": "Arquivo JSON de configuração inválido: %s",
|
||||
"Path to JSON config file": "Caminho para o arquivo JSON de configuração",
|
||||
"Show help": "Exibe ajuda",
|
||||
"Show version number": "Exibe a versão",
|
||||
"Did you mean %s?": "Você quis dizer %s?",
|
||||
"Arguments %s and %s are mutually exclusive" : "Argumentos %s e %s são mutualmente exclusivos",
|
||||
"Positionals:": "Posicionais:",
|
||||
"command": "comando"
|
||||
}
|
||||
51
node_modules/@grpc/proto-loader/node_modules/yargs/locales/ru.json
generated
vendored
Normal file
51
node_modules/@grpc/proto-loader/node_modules/yargs/locales/ru.json
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
{
|
||||
"Commands:": "Команды:",
|
||||
"Options:": "Опции:",
|
||||
"Examples:": "Примеры:",
|
||||
"boolean": "булевый тип",
|
||||
"count": "подсчет",
|
||||
"string": "строковой тип",
|
||||
"number": "число",
|
||||
"array": "массив",
|
||||
"required": "необходимо",
|
||||
"default": "по умолчанию",
|
||||
"default:": "по умолчанию:",
|
||||
"choices:": "возможности:",
|
||||
"aliases:": "алиасы:",
|
||||
"generated-value": "генерированное значение",
|
||||
"Not enough non-option arguments: got %s, need at least %s": {
|
||||
"one": "Недостаточно неопционных аргументов: есть %s, нужно как минимум %s",
|
||||
"other": "Недостаточно неопционных аргументов: есть %s, нужно как минимум %s"
|
||||
},
|
||||
"Too many non-option arguments: got %s, maximum of %s": {
|
||||
"one": "Слишком много неопционных аргументов: есть %s, максимум допустимо %s",
|
||||
"other": "Слишком много неопционных аргументов: есть %s, максимум допустимо %s"
|
||||
},
|
||||
"Missing argument value: %s": {
|
||||
"one": "Не хватает значения аргумента: %s",
|
||||
"other": "Не хватает значений аргументов: %s"
|
||||
},
|
||||
"Missing required argument: %s": {
|
||||
"one": "Не хватает необходимого аргумента: %s",
|
||||
"other": "Не хватает необходимых аргументов: %s"
|
||||
},
|
||||
"Unknown argument: %s": {
|
||||
"one": "Неизвестный аргумент: %s",
|
||||
"other": "Неизвестные аргументы: %s"
|
||||
},
|
||||
"Invalid values:": "Недействительные значения:",
|
||||
"Argument: %s, Given: %s, Choices: %s": "Аргумент: %s, Данное значение: %s, Возможности: %s",
|
||||
"Argument check failed: %s": "Проверка аргументов не удалась: %s",
|
||||
"Implications failed:": "Данный аргумент требует следующий дополнительный аргумент:",
|
||||
"Not enough arguments following: %s": "Недостаточно следующих аргументов: %s",
|
||||
"Invalid JSON config file: %s": "Недействительный файл конфигурации JSON: %s",
|
||||
"Path to JSON config file": "Путь к файлу конфигурации JSON",
|
||||
"Show help": "Показать помощь",
|
||||
"Show version number": "Показать номер версии",
|
||||
"Did you mean %s?": "Вы имели в виду %s?",
|
||||
"Arguments %s and %s are mutually exclusive": "Аргументы %s и %s являются взаимоисключающими",
|
||||
"Positionals:": "Позиционные аргументы:",
|
||||
"command": "команда",
|
||||
"deprecated": "устар.",
|
||||
"deprecated: %s": "устар.: %s"
|
||||
}
|
||||
46
node_modules/@grpc/proto-loader/node_modules/yargs/locales/th.json
generated
vendored
Normal file
46
node_modules/@grpc/proto-loader/node_modules/yargs/locales/th.json
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"Commands:": "คอมมาน",
|
||||
"Options:": "ออฟชั่น",
|
||||
"Examples:": "ตัวอย่าง",
|
||||
"boolean": "บูลีน",
|
||||
"count": "นับ",
|
||||
"string": "สตริง",
|
||||
"number": "ตัวเลข",
|
||||
"array": "อาเรย์",
|
||||
"required": "จำเป็น",
|
||||
"default": "ค่าเริ่มต้",
|
||||
"default:": "ค่าเริ่มต้น",
|
||||
"choices:": "ตัวเลือก",
|
||||
"aliases:": "เอเลียส",
|
||||
"generated-value": "ค่าที่ถูกสร้างขึ้น",
|
||||
"Not enough non-option arguments: got %s, need at least %s": {
|
||||
"one": "ใส่อาร์กิวเมนต์ไม่ครบตามจำนวนที่กำหนด: ใส่ค่ามาจำนวน %s ค่า, แต่ต้องการอย่างน้อย %s ค่า",
|
||||
"other": "ใส่อาร์กิวเมนต์ไม่ครบตามจำนวนที่กำหนด: ใส่ค่ามาจำนวน %s ค่า, แต่ต้องการอย่างน้อย %s ค่า"
|
||||
},
|
||||
"Too many non-option arguments: got %s, maximum of %s": {
|
||||
"one": "ใส่อาร์กิวเมนต์เกินจำนวนที่กำหนด: ใส่ค่ามาจำนวน %s ค่า, แต่ต้องการมากที่สุด %s ค่า",
|
||||
"other": "ใส่อาร์กิวเมนต์เกินจำนวนที่กำหนด: ใส่ค่ามาจำนวน %s ค่า, แต่ต้องการมากที่สุด %s ค่า"
|
||||
},
|
||||
"Missing argument value: %s": {
|
||||
"one": "ค่าอาร์กิวเมนต์ที่ขาดไป: %s",
|
||||
"other": "ค่าอาร์กิวเมนต์ที่ขาดไป: %s"
|
||||
},
|
||||
"Missing required argument: %s": {
|
||||
"one": "อาร์กิวเมนต์จำเป็นที่ขาดไป: %s",
|
||||
"other": "อาร์กิวเมนต์จำเป็นที่ขาดไป: %s"
|
||||
},
|
||||
"Unknown argument: %s": {
|
||||
"one": "อาร์กิวเมนต์ที่ไม่รู้จัก: %s",
|
||||
"other": "อาร์กิวเมนต์ที่ไม่รู้จัก: %s"
|
||||
},
|
||||
"Invalid values:": "ค่าไม่ถูกต้อง:",
|
||||
"Argument: %s, Given: %s, Choices: %s": "อาร์กิวเมนต์: %s, ได้รับ: %s, ตัวเลือก: %s",
|
||||
"Argument check failed: %s": "ตรวจสอบพบอาร์กิวเมนต์ที่ไม่ถูกต้อง: %s",
|
||||
"Implications failed:": "Implications ไม่สำเร็จ:",
|
||||
"Not enough arguments following: %s": "ใส่อาร์กิวเมนต์ไม่ครบ: %s",
|
||||
"Invalid JSON config file: %s": "ไฟล์คอนฟิค JSON ไม่ถูกต้อง: %s",
|
||||
"Path to JSON config file": "พาทไฟล์คอนฟิค JSON",
|
||||
"Show help": "ขอความช่วยเหลือ",
|
||||
"Show version number": "แสดงตัวเลขเวอร์ชั่น",
|
||||
"Did you mean %s?": "คุณหมายถึง %s?"
|
||||
}
|
||||
48
node_modules/@grpc/proto-loader/node_modules/yargs/locales/tr.json
generated
vendored
Normal file
48
node_modules/@grpc/proto-loader/node_modules/yargs/locales/tr.json
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
{
|
||||
"Commands:": "Komutlar:",
|
||||
"Options:": "Seçenekler:",
|
||||
"Examples:": "Örnekler:",
|
||||
"boolean": "boolean",
|
||||
"count": "sayı",
|
||||
"string": "string",
|
||||
"number": "numara",
|
||||
"array": "array",
|
||||
"required": "zorunlu",
|
||||
"default": "varsayılan",
|
||||
"default:": "varsayılan:",
|
||||
"choices:": "seçimler:",
|
||||
"aliases:": "takma adlar:",
|
||||
"generated-value": "oluşturulan-değer",
|
||||
"Not enough non-option arguments: got %s, need at least %s": {
|
||||
"one": "Seçenek dışı argümanlar yetersiz: %s bulundu, %s gerekli",
|
||||
"other": "Seçenek dışı argümanlar yetersiz: %s bulundu, %s gerekli"
|
||||
},
|
||||
"Too many non-option arguments: got %s, maximum of %s": {
|
||||
"one": "Seçenek dışı argümanlar gereğinden fazla: %s bulundu, azami %s",
|
||||
"other": "Seçenek dışı argümanlar gereğinden fazla: %s bulundu, azami %s"
|
||||
},
|
||||
"Missing argument value: %s": {
|
||||
"one": "Eksik argüman değeri: %s",
|
||||
"other": "Eksik argüman değerleri: %s"
|
||||
},
|
||||
"Missing required argument: %s": {
|
||||
"one": "Eksik zorunlu argüman: %s",
|
||||
"other": "Eksik zorunlu argümanlar: %s"
|
||||
},
|
||||
"Unknown argument: %s": {
|
||||
"one": "Bilinmeyen argüman: %s",
|
||||
"other": "Bilinmeyen argümanlar: %s"
|
||||
},
|
||||
"Invalid values:": "Geçersiz değerler:",
|
||||
"Argument: %s, Given: %s, Choices: %s": "Argüman: %s, Verilen: %s, Seçimler: %s",
|
||||
"Argument check failed: %s": "Argüman kontrolü başarısız oldu: %s",
|
||||
"Implications failed:": "Sonuçlar başarısız oldu:",
|
||||
"Not enough arguments following: %s": "%s için yeterli argüman bulunamadı",
|
||||
"Invalid JSON config file: %s": "Geçersiz JSON yapılandırma dosyası: %s",
|
||||
"Path to JSON config file": "JSON yapılandırma dosya konumu",
|
||||
"Show help": "Yardım detaylarını göster",
|
||||
"Show version number": "Versiyon detaylarını göster",
|
||||
"Did you mean %s?": "Bunu mu demek istediniz: %s?",
|
||||
"Positionals:": "Sıralılar:",
|
||||
"command": "komut"
|
||||
}
|
||||
51
node_modules/@grpc/proto-loader/node_modules/yargs/locales/uk_UA.json
generated
vendored
Normal file
51
node_modules/@grpc/proto-loader/node_modules/yargs/locales/uk_UA.json
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
{
|
||||
"Commands:": "Команди:",
|
||||
"Options:": "Опції:",
|
||||
"Examples:": "Приклади:",
|
||||
"boolean": "boolean",
|
||||
"count": "кількість",
|
||||
"string": "строка",
|
||||
"number": "число",
|
||||
"array": "масива",
|
||||
"required": "обов'язково",
|
||||
"default": "за замовчуванням",
|
||||
"default:": "за замовчуванням:",
|
||||
"choices:": "доступні варіанти:",
|
||||
"aliases:": "псевдоніми:",
|
||||
"generated-value": "згенероване значення",
|
||||
"Not enough non-option arguments: got %s, need at least %s": {
|
||||
"one": "Недостатньо аргументів: наразі %s, потрібно %s або більше",
|
||||
"other": "Недостатньо аргументів: наразі %s, потрібно %s або більше"
|
||||
},
|
||||
"Too many non-option arguments: got %s, maximum of %s": {
|
||||
"one": "Забагато аргументів: наразі %s, максимум %s",
|
||||
"other": "Too many non-option arguments: наразі %s, максимум of %s"
|
||||
},
|
||||
"Missing argument value: %s": {
|
||||
"one": "Відсутнє значення для аргументу: %s",
|
||||
"other": "Відсутні значення для аргументу: %s"
|
||||
},
|
||||
"Missing required argument: %s": {
|
||||
"one": "Відсутній обов'язковий аргумент: %s",
|
||||
"other": "Відсутні обов'язкові аргументи: %s"
|
||||
},
|
||||
"Unknown argument: %s": {
|
||||
"one": "Аргумент %s не підтримується",
|
||||
"other": "Аргументи %s не підтримуються"
|
||||
},
|
||||
"Invalid values:": "Некоректні значення:",
|
||||
"Argument: %s, Given: %s, Choices: %s": "Аргумент: %s, Введено: %s, Доступні варіанти: %s",
|
||||
"Argument check failed: %s": "Аргумент не пройшов перевірку: %s",
|
||||
"Implications failed:": "Відсутні залежні аргументи:",
|
||||
"Not enough arguments following: %s": "Не достатньо аргументів після: %s",
|
||||
"Invalid JSON config file: %s": "Некоректний JSON-файл конфігурації: %s",
|
||||
"Path to JSON config file": "Шлях до JSON-файлу конфігурації",
|
||||
"Show help": "Показати довідку",
|
||||
"Show version number": "Показати версію",
|
||||
"Did you mean %s?": "Можливо, ви мали на увазі %s?",
|
||||
"Arguments %s and %s are mutually exclusive" : "Аргументи %s та %s взаємовиключні",
|
||||
"Positionals:": "Позиційні:",
|
||||
"command": "команда",
|
||||
"deprecated": "застарілий",
|
||||
"deprecated: %s": "застарілий: %s"
|
||||
}
|
||||
52
node_modules/@grpc/proto-loader/node_modules/yargs/locales/uz.json
generated
vendored
Normal file
52
node_modules/@grpc/proto-loader/node_modules/yargs/locales/uz.json
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
{
|
||||
"Commands:": "Buyruqlar:",
|
||||
"Options:": "Imkoniyatlar:",
|
||||
"Examples:": "Misollar:",
|
||||
"boolean": "boolean",
|
||||
"count": "sanoq",
|
||||
"string": "satr",
|
||||
"number": "raqam",
|
||||
"array": "massiv",
|
||||
"required": "majburiy",
|
||||
"default": "boshlang'ich",
|
||||
"default:": "boshlang'ich:",
|
||||
"choices:": "tanlovlar:",
|
||||
"aliases:": "taxalluslar:",
|
||||
"generated-value": "yaratilgan-qiymat",
|
||||
"Not enough non-option arguments: got %s, need at least %s": {
|
||||
"one": "No-imkoniyat argumentlar yetarli emas: berilgan %s, minimum %s",
|
||||
"other": "No-imkoniyat argumentlar yetarli emas: berilgan %s, minimum %s"
|
||||
},
|
||||
"Too many non-option arguments: got %s, maximum of %s": {
|
||||
"one": "No-imkoniyat argumentlar juda ko'p: berilgan %s, maksimum %s",
|
||||
"other": "No-imkoniyat argumentlar juda ko'p: got %s, maksimum %s"
|
||||
},
|
||||
"Missing argument value: %s": {
|
||||
"one": "Argument qiymati berilmagan: %s",
|
||||
"other": "Argument qiymatlari berilmagan: %s"
|
||||
},
|
||||
"Missing required argument: %s": {
|
||||
"one": "Majburiy argument berilmagan: %s",
|
||||
"other": "Majburiy argumentlar berilmagan: %s"
|
||||
},
|
||||
"Unknown argument: %s": {
|
||||
"one": "Noma'lum argument berilmagan: %s",
|
||||
"other": "Noma'lum argumentlar berilmagan: %s"
|
||||
},
|
||||
"Invalid values:": "Nosoz qiymatlar:",
|
||||
"Argument: %s, Given: %s, Choices: %s": "Argument: %s, Berilgan: %s, Tanlovlar: %s",
|
||||
"Argument check failed: %s": "Muvaffaqiyatsiz argument tekshiruvi: %s",
|
||||
"Implications failed:": "Bog'liq argumentlar berilmagan:",
|
||||
"Not enough arguments following: %s": "Quyidagi argumentlar yetarli emas: %s",
|
||||
"Invalid JSON config file: %s": "Nosoz JSON konfiguratsiya fayli: %s",
|
||||
"Path to JSON config file": "JSON konfiguratsiya fayli joylashuvi",
|
||||
"Show help": "Yordam ko'rsatish",
|
||||
"Show version number": "Versiyani ko'rsatish",
|
||||
"Did you mean %s?": "%s ni nazarda tutyapsizmi?",
|
||||
"Arguments %s and %s are mutually exclusive" : "%s va %s argumentlari alohida",
|
||||
"Positionals:": "Positsionallar:",
|
||||
"command": "buyruq",
|
||||
"deprecated": "eskirgan",
|
||||
"deprecated: %s": "eskirgan: %s"
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user