Updated the files.
This commit is contained in:
parent
1553e6b971
commit
753967d4f5
23418 changed files with 3784666 additions and 0 deletions
22
my-app/node_modules/cosmiconfig/LICENSE
generated
vendored
Executable file
22
my-app/node_modules/cosmiconfig/LICENSE
generated
vendored
Executable file
|
@ -0,0 +1,22 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 David Clark
|
||||
|
||||
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.
|
||||
|
685
my-app/node_modules/cosmiconfig/README.md
generated
vendored
Executable file
685
my-app/node_modules/cosmiconfig/README.md
generated
vendored
Executable file
|
@ -0,0 +1,685 @@
|
|||
# cosmiconfig
|
||||
|
||||
[](https://codecov.io/gh/cosmiconfig/cosmiconfig)
|
||||
|
||||
Cosmiconfig searches for and loads configuration for your program.
|
||||
|
||||
It features smart defaults based on conventional expectations in the JavaScript ecosystem.
|
||||
But it's also flexible enough to search wherever you'd like to search, and load whatever you'd like to load.
|
||||
|
||||
By default, Cosmiconfig will start where you tell it to start and search up the directory tree for the following:
|
||||
|
||||
- a `package.json` property
|
||||
- a JSON or YAML, extensionless "rc file"
|
||||
- an "rc file" with the extensions `.json`, `.yaml`, `.yml`, `.js`, `.ts`, `.mjs`, or `.cjs`
|
||||
- any of the above two inside a `.config` subdirectory
|
||||
- a `.config.js`, `.config.ts`, `.config.mjs`, or `.config.cjs` file
|
||||
|
||||
For example, if your module's name is "myapp", cosmiconfig will search up the directory tree for configuration in the following places:
|
||||
|
||||
- a `myapp` property in `package.json`
|
||||
- a `.myapprc` file in JSON or YAML format
|
||||
- a `.myapprc.json`, `.myapprc.yaml`, `.myapprc.yml`, `.myapprc.js`, `.myapprc.ts`, `.myapprc.mjs`, or `.myapprc.cjs` file
|
||||
- a `myapprc`, `myapprc.json`, `myapprc.yaml`, `myapprc.yml`, `myapprc.js`, `myapprc.ts` or `myapprc.cjs` file inside a `.config` subdirectory
|
||||
- a `myapp.config.js`, `myapp.config.ts`, `myapp.config.mjs`, or `myapp.config.cjs` file
|
||||
|
||||
Cosmiconfig continues to search up the directory tree, checking each of these places in each directory, until it finds some acceptable configuration (or hits the home directory).
|
||||
|
||||
## Table of contents
|
||||
|
||||
- [Installation](#installation)
|
||||
- [Usage for tooling developers](#usage-for-tooling-developers)
|
||||
- [Result](#result)
|
||||
- [Asynchronous API](#asynchronous-api)
|
||||
- [cosmiconfig()](#cosmiconfig-1)
|
||||
- [explorer.search()](#explorersearch)
|
||||
- [explorer.load()](#explorerload)
|
||||
- [explorer.clearLoadCache()](#explorerclearloadcache)
|
||||
- [explorer.clearSearchCache()](#explorerclearsearchcache)
|
||||
- [explorer.clearCaches()](#explorerclearcaches)
|
||||
- [Synchronous API](#synchronous-api)
|
||||
- [cosmiconfigSync()](#cosmiconfigsync)
|
||||
- [explorerSync.search()](#explorersyncsearch)
|
||||
- [explorerSync.load()](#explorersyncload)
|
||||
- [explorerSync.clearLoadCache()](#explorersyncclearloadcache)
|
||||
- [explorerSync.clearSearchCache()](#explorersyncclearsearchcache)
|
||||
- [explorerSync.clearCaches()](#explorersyncclearcaches)
|
||||
- [cosmiconfigOptions](#cosmiconfigoptions)
|
||||
- [searchPlaces](#searchplaces)
|
||||
- [loaders](#loaders)
|
||||
- [packageProp](#packageprop)
|
||||
- [stopDir](#stopdir)
|
||||
- [cache](#cache)
|
||||
- [transform](#transform)
|
||||
- [ignoreEmptySearchPlaces](#ignoreemptysearchplaces)
|
||||
- [Loading JS modules](#loading-js-modules)
|
||||
- [Caching](#caching)
|
||||
- [Differences from rc](#differences-from-rc)
|
||||
- [Usage for end users](#usage-for-end-users)
|
||||
- [Contributing & Development](#contributing--development)
|
||||
|
||||
## Installation
|
||||
|
||||
```
|
||||
npm install cosmiconfig
|
||||
```
|
||||
|
||||
Tested in Node 14+.
|
||||
|
||||
## Usage for tooling developers
|
||||
|
||||
*If you are an end user (i.e. a user of a tool that uses cosmiconfig, like `prettier` or `stylelint`),
|
||||
you can skip down to [the end user section](#usage-for-end-users).*
|
||||
|
||||
Create a Cosmiconfig explorer, then either `search` for or directly `load` a configuration file.
|
||||
|
||||
```js
|
||||
const { cosmiconfig, cosmiconfigSync } = require('cosmiconfig');
|
||||
// ...
|
||||
const explorer = cosmiconfig(moduleName);
|
||||
|
||||
// Search for a configuration by walking up directories.
|
||||
// See documentation for search, below.
|
||||
explorer.search()
|
||||
.then((result) => {
|
||||
// result.config is the parsed configuration object.
|
||||
// result.filepath is the path to the config file that was found.
|
||||
// result.isEmpty is true if there was nothing to parse in the config file.
|
||||
})
|
||||
.catch((error) => {
|
||||
// Do something constructive.
|
||||
});
|
||||
|
||||
// Load a configuration directly when you know where it should be.
|
||||
// The result object is the same as for search.
|
||||
// See documentation for load, below.
|
||||
explorer.load(pathToConfig).then(..);
|
||||
|
||||
// You can also search and load synchronously.
|
||||
const explorerSync = cosmiconfigSync(moduleName);
|
||||
|
||||
const searchedFor = explorerSync.search();
|
||||
const loaded = explorerSync.load(pathToConfig);
|
||||
```
|
||||
|
||||
## Result
|
||||
|
||||
The result object you get from `search` or `load` has the following properties:
|
||||
|
||||
- **config:** The parsed configuration object. `undefined` if the file is empty.
|
||||
- **filepath:** The path to the configuration file that was found.
|
||||
- **isEmpty:** `true` if the configuration file is empty. This property will not be present if the configuration file is not empty.
|
||||
|
||||
## Asynchronous API
|
||||
|
||||
### cosmiconfig()
|
||||
|
||||
```js
|
||||
const { cosmiconfig } = require('cosmiconfig');
|
||||
const explorer = cosmiconfig(moduleName[, cosmiconfigOptions])
|
||||
```
|
||||
|
||||
Creates a cosmiconfig instance ("explorer") configured according to the arguments, and initializes its caches.
|
||||
|
||||
#### moduleName
|
||||
|
||||
Type: `string`. **Required.**
|
||||
|
||||
Your module name. This is used to create the default [`searchPlaces`] and [`packageProp`].
|
||||
|
||||
If your [`searchPlaces`] value will include files, as it does by default (e.g. `${moduleName}rc`), your `moduleName` must consist of characters allowed in filenames. That means you should not copy scoped package names, such as `@my-org/my-package`, directly into `moduleName`.
|
||||
|
||||
**[`cosmiconfigOptions`] are documented below.**
|
||||
You may not need them, and should first read about the functions you'll use.
|
||||
|
||||
### explorer.search()
|
||||
|
||||
```js
|
||||
explorer.search([searchFrom]).then(result => {..})
|
||||
```
|
||||
|
||||
Searches for a configuration file. Returns a Promise that resolves with a [result] or with `null`, if no configuration file is found.
|
||||
|
||||
You can do the same thing synchronously with [`explorerSync.search()`].
|
||||
|
||||
Let's say your module name is `goldengrahams` so you initialized with `const explorer = cosmiconfig('goldengrahams');`.
|
||||
Here's how your default [`search()`] will work:
|
||||
|
||||
- Starting from `process.cwd()` (or some other directory defined by the `searchFrom` argument to [`search()`]), look for configuration objects in the following places:
|
||||
1. A `goldengrahams` property in a `package.json` file.
|
||||
2. A `.goldengrahamsrc` file with JSON or YAML syntax.
|
||||
3. A `.goldengrahamsrc.json`, `.goldengrahamsrc.yaml`, `.goldengrahamsrc.yml`, `.goldengrahamsrc.js`, `.goldengrahamsrc.ts`, or `.goldengrahamsrc.cjs` file. (To learn more about how JS files are loaded, see ["Loading JS modules"].)
|
||||
4. A `goldengrahamsrc`, `goldengrahamsrc.json`, `goldengrahamsrc.yaml`, `goldengrahamsrc.yml`, `goldengrahamsrc.js`, `goldengrahamsrc.ts`, or `goldengrahamsrc.cjs` file in the `.config` subdirectory.
|
||||
5. A `goldengrahams.config.js`, `goldengrahams.config.ts`, `goldengrahams.config.mjs`, or `goldengrahams.config.cjs` file. (To learn more about how JS files are loaded, see ["Loading JS modules"].)
|
||||
- If none of those searches reveal a configuration object, move up one directory level and try again.
|
||||
So the search continues in `./`, `../`, `../../`, `../../../`, etc., checking the same places in each directory.
|
||||
- Continue searching until arriving at your home directory (or some other directory defined by the cosmiconfig option [`stopDir`]).
|
||||
- For JS files,
|
||||
- If at any point a parsable configuration is found, the [`search()`] Promise resolves with its [result] \(or, with [`explorerSync.search()`], the [result] is returned).
|
||||
- If no configuration object is found, the [`search()`] Promise resolves with `null` (or, with [`explorerSync.search()`], `null` is returned).
|
||||
- If a configuration object is found *but is malformed* (causing a parsing error), the [`search()`] Promise rejects with that error (so you should `.catch()` it). (Or, with [`explorerSync.search()`], the error is thrown.)
|
||||
|
||||
**If you know exactly where your configuration file should be, you can use [`load()`], instead.**
|
||||
|
||||
**The search process is highly customizable.**
|
||||
Use the cosmiconfig options [`searchPlaces`] and [`loaders`] to precisely define where you want to look for configurations and how you want to load them.
|
||||
|
||||
#### searchFrom
|
||||
|
||||
Type: `string`.
|
||||
Default: `process.cwd()`.
|
||||
|
||||
A filename.
|
||||
[`search()`] will start its search here.
|
||||
|
||||
If the value is a directory, that's where the search starts.
|
||||
If it's a file, the search starts in that file's directory.
|
||||
|
||||
### explorer.load()
|
||||
|
||||
```js
|
||||
explorer.load(loadPath).then(result => {..})
|
||||
```
|
||||
|
||||
Loads a configuration file. Returns a Promise that resolves with a [result] or rejects with an error (if the file does not exist or cannot be loaded).
|
||||
|
||||
Use `load` if you already know where the configuration file is and you just need to load it.
|
||||
|
||||
```js
|
||||
explorer.load('load/this/file.json'); // Tries to load load/this/file.json.
|
||||
```
|
||||
|
||||
If you load a `package.json` file, the result will be derived from whatever property is specified as your [`packageProp`].
|
||||
|
||||
You can do the same thing synchronously with [`explorerSync.load()`].
|
||||
|
||||
### explorer.clearLoadCache()
|
||||
|
||||
Clears the cache used in [`load()`].
|
||||
|
||||
### explorer.clearSearchCache()
|
||||
|
||||
Clears the cache used in [`search()`].
|
||||
|
||||
### explorer.clearCaches()
|
||||
|
||||
Performs both [`clearLoadCache()`] and [`clearSearchCache()`].
|
||||
|
||||
## Synchronous API
|
||||
|
||||
### cosmiconfigSync()
|
||||
|
||||
```js
|
||||
const { cosmiconfigSync } = require('cosmiconfig');
|
||||
const explorerSync = cosmiconfigSync(moduleName[, cosmiconfigOptions])
|
||||
```
|
||||
|
||||
Creates a *synchronous* cosmiconfig instance ("explorerSync") configured according to the arguments, and initializes its caches.
|
||||
|
||||
See [`cosmiconfig()`](#cosmiconfig-1).
|
||||
|
||||
### explorerSync.search()
|
||||
|
||||
```js
|
||||
const result = explorerSync.search([searchFrom]);
|
||||
```
|
||||
|
||||
Synchronous version of [`explorer.search()`].
|
||||
|
||||
Returns a [result] or `null`.
|
||||
|
||||
### explorerSync.load()
|
||||
|
||||
```js
|
||||
const result = explorerSync.load(loadPath);
|
||||
```
|
||||
|
||||
Synchronous version of [`explorer.load()`].
|
||||
|
||||
Returns a [result].
|
||||
|
||||
### explorerSync.clearLoadCache()
|
||||
|
||||
Clears the cache used in [`load()`].
|
||||
|
||||
### explorerSync.clearSearchCache()
|
||||
|
||||
Clears the cache used in [`search()`].
|
||||
|
||||
### explorerSync.clearCaches()
|
||||
|
||||
Performs both [`clearLoadCache()`] and [`clearSearchCache()`].
|
||||
|
||||
## cosmiconfigOptions
|
||||
|
||||
Type: `Object`.
|
||||
|
||||
Possible options are documented below.
|
||||
|
||||
### searchPlaces
|
||||
|
||||
Type: `Array<string>`.
|
||||
Default: See below.
|
||||
|
||||
An array of places that [`search()`] will check in each directory as it moves up the directory tree.
|
||||
Each place is relative to the directory being searched, and the places are checked in the specified order.
|
||||
|
||||
**Default `searchPlaces`:**
|
||||
|
||||
For the [asynchronous API](#asynchronous-api), these are the default `searchPlaces`:
|
||||
|
||||
```js
|
||||
[
|
||||
'package.json',
|
||||
`.${moduleName}rc`,
|
||||
`.${moduleName}rc.json`,
|
||||
`.${moduleName}rc.yaml`,
|
||||
`.${moduleName}rc.yml`,
|
||||
`.${moduleName}rc.js`,
|
||||
`.${moduleName}rc.ts`,
|
||||
`.${moduleName}rc.mjs`,
|
||||
`.${moduleName}rc.cjs`,
|
||||
`.config/${moduleName}rc`,
|
||||
`.config/${moduleName}rc.json`,
|
||||
`.config/${moduleName}rc.yaml`,
|
||||
`.config/${moduleName}rc.yml`,
|
||||
`.config/${moduleName}rc.js`,
|
||||
`.config/${moduleName}rc.ts`,
|
||||
`.config/${moduleName}rc.cjs`,
|
||||
`${moduleName}.config.js`,
|
||||
`${moduleName}.config.ts`,
|
||||
`${moduleName}.config.mjs`,
|
||||
`${moduleName}.config.cjs`,
|
||||
];
|
||||
```
|
||||
|
||||
For the [synchronous API](#synchronous-api), the only difference is that `.mjs` files are not included. See ["Loading JS modules"] for more information.
|
||||
|
||||
Create your own array to search more, fewer, or altogether different places.
|
||||
|
||||
Every item in `searchPlaces` needs to have a loader in [`loaders`] that corresponds to its extension.
|
||||
(Common extensions are covered by default loaders.)
|
||||
Read more about [`loaders`] below.
|
||||
|
||||
`package.json` is a special value: When it is included in `searchPlaces`, Cosmiconfig will always parse it as JSON and load a property within it, not the whole file.
|
||||
That property is defined with the [`packageProp`] option, and defaults to your module name.
|
||||
|
||||
Examples, with a module named `porgy`:
|
||||
|
||||
```js
|
||||
// Disallow extensions on rc files:
|
||||
['package.json', '.porgyrc', 'porgy.config.js'][
|
||||
// Limit the options dramatically:
|
||||
('package.json', '.porgyrc')
|
||||
][
|
||||
// Maybe you want to look for a wide variety of JS flavors:
|
||||
('porgy.config.js',
|
||||
'porgy.config.mjs',
|
||||
'porgy.config.ts',
|
||||
'porgy.config.coffee')
|
||||
][
|
||||
// ^^ You will need to designate custom loaders to tell
|
||||
// Cosmiconfig how to handle `.ts` and `.coffee` files.
|
||||
|
||||
// Look within a .config/ subdirectory of every searched directory:
|
||||
('package.json',
|
||||
'.porgyrc',
|
||||
'.config/.porgyrc',
|
||||
'.porgyrc.json',
|
||||
'.config/.porgyrc.json')
|
||||
];
|
||||
```
|
||||
|
||||
### loaders
|
||||
|
||||
Type: `Object`.
|
||||
Default: See below.
|
||||
|
||||
An object that maps extensions to the loader functions responsible for loading and parsing files with those extensions.
|
||||
|
||||
Cosmiconfig exposes its default loaders on the named export `defaultLoaders` and `defaultLoadersSync`.
|
||||
|
||||
**Default `loaders`:**
|
||||
|
||||
```js
|
||||
const { defaultLoaders, defaultLoadersSync } = require('cosmiconfig');
|
||||
|
||||
console.log(Object.entries(defaultLoaders));
|
||||
// [
|
||||
// [ '.mjs', [Function: loadJs] ],
|
||||
// [ '.cjs', [Function: loadJs] ],
|
||||
// [ '.js', [Function: loadJs] ],
|
||||
// [ '.ts', [Function: loadTs] ],
|
||||
// [ '.json', [Function: loadJson] ],
|
||||
// [ '.yaml', [Function: loadYaml] ],
|
||||
// [ '.yml', [Function: loadYaml] ],
|
||||
// [ 'noExt', [Function: loadYaml] ]
|
||||
// ]
|
||||
|
||||
console.log(Object.entries(defaultLoadersSync));
|
||||
// [
|
||||
// [ '.cjs', [Function: loadJsSync] ],
|
||||
// [ '.js', [Function: loadJsSync] ],
|
||||
// [ '.ts', [Function: loadTsSync] ],
|
||||
// [ '.json', [Function: loadJson] ],
|
||||
// [ '.yaml', [Function: loadYaml] ],
|
||||
// [ '.yml', [Function: loadYaml] ],
|
||||
// [ 'noExt', [Function: loadYaml] ]
|
||||
// ]
|
||||
```
|
||||
|
||||
(YAML is a superset of JSON; which means YAML parsers can parse JSON; which is how extensionless files can be either YAML *or* JSON with only one parser.)
|
||||
|
||||
**If you provide a `loaders` object, your object will be *merged* with the defaults.**
|
||||
So you can override one or two without having to override them all.
|
||||
|
||||
**Keys in `loaders`** are extensions (starting with a period), or `noExt` to specify the loader for files *without* extensions, like `.myapprc`.
|
||||
|
||||
**Values in `loaders`** are a loader function (described below) whose values are loader functions.
|
||||
|
||||
**The most common use case for custom loaders value is to load extensionless `rc` files as strict JSON**, instead of JSON *or* YAML (the default).
|
||||
To accomplish that, provide the following `loaders` value:
|
||||
|
||||
```js
|
||||
{
|
||||
noExt: defaultLoaders['.json'];
|
||||
}
|
||||
```
|
||||
|
||||
If you want to load files that are not handled by the loader functions Cosmiconfig exposes, you can write a custom loader function or use one from NPM if it exists.
|
||||
|
||||
**Third-party loaders:**
|
||||
|
||||
- [cosmiconfig-typescript-loader](https://github.com/codex-/cosmiconfig-typescript-loader)
|
||||
|
||||
**Use cases for custom loader function:**
|
||||
|
||||
- Allow configuration syntaxes that aren't handled by Cosmiconfig's defaults, like JSON5, INI, or XML.
|
||||
- Allow ES2015 modules from `.mjs` configuration files.
|
||||
- Parse JS files with Babel before deriving the configuration.
|
||||
|
||||
**Custom loader functions** have the following signature:
|
||||
|
||||
```js
|
||||
// Sync
|
||||
(filepath: string, content: string) => Object | null
|
||||
|
||||
// Async
|
||||
(filepath: string, content: string) => Object | null | Promise<Object | null>
|
||||
```
|
||||
|
||||
Cosmiconfig reads the file when it checks whether the file exists, so it will provide you with both the file's path and its content.
|
||||
Do whatever you need to, and return either a configuration object or `null` (or, for async-only loaders, a Promise that resolves with one of those).
|
||||
`null` indicates that no real configuration was found and the search should continue.
|
||||
|
||||
A few things to note:
|
||||
|
||||
- If you use a custom loader, be aware of whether it's sync or async: you cannot use async customer loaders with the sync API ([`cosmiconfigSync()`]).
|
||||
- **Special JS syntax can also be handled by using a `require` hook**, because `defaultLoaders['.js']` just uses `require`.
|
||||
Whether you use custom loaders or a `require` hook is up to you.
|
||||
|
||||
Examples:
|
||||
|
||||
```js
|
||||
// Allow JSON5 syntax:
|
||||
{
|
||||
'.json': json5Loader
|
||||
}
|
||||
|
||||
// Allow a special configuration syntax of your own creation:
|
||||
{
|
||||
'.special': specialLoader
|
||||
}
|
||||
|
||||
// Allow many flavors of JS, using custom loaders:
|
||||
{
|
||||
'.coffee': coffeeScriptLoader
|
||||
}
|
||||
|
||||
// Allow many flavors of JS but rely on require hooks:
|
||||
{
|
||||
'.coffee': defaultLoaders['.js']
|
||||
}
|
||||
```
|
||||
|
||||
### packageProp
|
||||
|
||||
Type: `string | Array<string>`.
|
||||
Default: `` `${moduleName}` ``.
|
||||
|
||||
Name of the property in `package.json` to look for.
|
||||
|
||||
Use a period-delimited string or an array of strings to describe a path to nested properties.
|
||||
|
||||
For example, the value `'configs.myPackage'` or `['configs', 'myPackage']` will get you the `"myPackage"` value in a `package.json` like this:
|
||||
|
||||
```json
|
||||
{
|
||||
"configs": {
|
||||
"myPackage": {..}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
If nested property names within the path include periods, you need to use an array of strings. For example, the value `['configs', 'foo.bar', 'baz']` will get you the `"baz"` value in a `package.json` like this:
|
||||
|
||||
```json
|
||||
{
|
||||
"configs": {
|
||||
"foo.bar": {
|
||||
"baz": {..}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
If a string includes period but corresponds to a top-level property name, it will not be interpreted as a period-delimited path. For example, the value `'one.two'` will get you the `"three"` value in a `package.json` like this:
|
||||
|
||||
```json
|
||||
{
|
||||
"one.two": "three",
|
||||
"one": {
|
||||
"two": "four"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### stopDir
|
||||
|
||||
Type: `string`.
|
||||
Default: Absolute path to your home directory.
|
||||
|
||||
Directory where the search will stop.
|
||||
|
||||
### cache
|
||||
|
||||
Type: `boolean`.
|
||||
Default: `true`.
|
||||
|
||||
If `false`, no caches will be used.
|
||||
Read more about ["Caching"](#caching) below.
|
||||
|
||||
### transform
|
||||
|
||||
Type: `(Result) => Promise<Result> | Result`.
|
||||
|
||||
A function that transforms the parsed configuration. Receives the [result].
|
||||
|
||||
If using [`search()`] or [`load()`] \(which are async), the transform function can return the transformed result or return a Promise that resolves with the transformed result.
|
||||
If using `cosmiconfigSync`, [`search()`] or [`load()`], the function must be synchronous and return the transformed result.
|
||||
|
||||
The reason you might use this option — instead of simply applying your transform function some other way — is that *the transformed result will be cached*. If your transformation involves additional filesystem I/O or other potentially slow processing, you can use this option to avoid repeating those steps every time a given configuration is searched or loaded.
|
||||
|
||||
### ignoreEmptySearchPlaces
|
||||
|
||||
Type: `boolean`.
|
||||
Default: `true`.
|
||||
|
||||
By default, if [`search()`] encounters an empty file (containing nothing but whitespace) in one of the [`searchPlaces`], it will ignore the empty file and move on.
|
||||
If you'd like to load empty configuration files, instead, set this option to `false`.
|
||||
|
||||
Why might you want to load empty configuration files?
|
||||
If you want to throw an error, or if an empty configuration file means something to your program.
|
||||
|
||||
## Loading JS modules
|
||||
|
||||
Your end users can provide JS configuration files as ECMAScript modules (ESM) under the following conditions:
|
||||
|
||||
- You (the cosmiconfig user) use cosmiconfig's [asynchronous API](#asynchronous-api).
|
||||
- Your end user runs a version of Node that supports ESM ([>=12.17.0](https://nodejs.org/en/blog/release/v12.17.0/), or earlier with the `--experimental-modules` flag).
|
||||
- Your end user provides an `.mjs` configuration file, or a `.js` file whose nearest parent `package.json` file contains `"type": "module"`. (See [Node's method for determining a file's module system](https://nodejs.org/api/packages.html#packages_determining_module_system).)
|
||||
|
||||
With cosmiconfig's [asynchronous API](#asynchronous-api), the default [`searchPlaces`] include `.js`, `.ts`, `.mjs`, and `.cjs` files. Cosmiconfig loads all these file types with the [dynamic `import` function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import#dynamic_imports).
|
||||
|
||||
With the [synchronous API](#synchronous-api), JS configuration files are always treated as CommonJS, and `.mjs` files are ignored, because there is no synchronous API for the dynamic `import` function.
|
||||
|
||||
## Caching
|
||||
|
||||
As of v2, cosmiconfig uses caching to reduce the need for repetitious reading of the filesystem or expensive transforms. Every new cosmiconfig instance (created with `cosmiconfig()`) has its own caches.
|
||||
|
||||
To avoid or work around caching, you can do the following:
|
||||
|
||||
- Set the `cosmiconfig` option [`cache`] to `false`.
|
||||
- Use the cache-clearing methods [`clearLoadCache()`], [`clearSearchCache()`], and [`clearCaches()`].
|
||||
- Create separate instances of cosmiconfig (separate "explorers").
|
||||
|
||||
## Differences from [rc](https://github.com/dominictarr/rc)
|
||||
|
||||
[rc](https://github.com/dominictarr/rc) serves its focused purpose well. cosmiconfig differs in a few key ways — making it more useful for some projects, less useful for others:
|
||||
|
||||
- Looks for configuration in some different places: in a `package.json` property, an rc file, a `.config.js` file, and rc files with extensions.
|
||||
- Built-in support for JSON, YAML, and CommonJS formats.
|
||||
- Stops at the first configuration found, instead of finding all that can be found up the directory tree and merging them automatically.
|
||||
- Options.
|
||||
- Asynchronous by default (though can be run synchronously).
|
||||
|
||||
## Usage for end users
|
||||
|
||||
When configuring a tool, you can use multiple file formats and put these in multiple places.
|
||||
|
||||
Usually, a tool would mention this in its own README file,
|
||||
but by default, these are the following places, where `{NAME}` represents the name of the tool:
|
||||
|
||||
```
|
||||
package.json
|
||||
.{NAME}rc
|
||||
.{NAME}rc.json
|
||||
.{NAME}rc.yaml
|
||||
.{NAME}rc.yml
|
||||
.{NAME}rc.js
|
||||
.{NAME}rc.ts
|
||||
.{NAME}rc.cjs
|
||||
.config/{NAME}rc
|
||||
.config/{NAME}rc.json
|
||||
.config/{NAME}rc.yaml
|
||||
.config/{NAME}rc.yml
|
||||
.config/{NAME}rc.js
|
||||
.config/{NAME}rc.ts
|
||||
.config/{NAME}rc.cjs
|
||||
{NAME}.config.js
|
||||
{NAME}.config.ts
|
||||
{NAME}.config.cjs
|
||||
```
|
||||
|
||||
The contents of these files are defined by the tool.
|
||||
For example, you can configure prettier to enforce semicolons at the end of the line
|
||||
using a file named `.config/prettierrc.yml`:
|
||||
|
||||
```yaml
|
||||
semi: true
|
||||
```
|
||||
|
||||
Additionally, you have the option to put a property named after the tool in your `package.json` file,
|
||||
with the contents of that property being the same as the file contents. To use the same example as above:
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "your-project",
|
||||
"dependencies": {},
|
||||
"prettier": {
|
||||
"semi": true
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
This has the advantage that you can put the configuration of all tools
|
||||
(at least the ones that use cosmiconfig) in one file.
|
||||
|
||||
You can also add a `cosmiconfig` key within your `package.json` file or create one of the following files
|
||||
to configure `cosmiconfig` itself:
|
||||
|
||||
```
|
||||
.config.json
|
||||
.config.yaml
|
||||
.config.yml
|
||||
.config.js
|
||||
.config.ts
|
||||
.config.cjs
|
||||
```
|
||||
|
||||
The following property is currently actively supported in these places:
|
||||
|
||||
```yaml
|
||||
cosmiconfig:
|
||||
# overrides where configuration files are being searched to enforce a custom naming convention and format
|
||||
searchPlaces:
|
||||
- .config/{name}.yml
|
||||
```
|
||||
|
||||
> **Note:** technically, you can overwrite all options described in [cosmiconfigOptions](#cosmiconfigoptions) here,
|
||||
> but everything not listed above should be used at your own risk, as it has not been tested explicitly.
|
||||
|
||||
You can also add more root properties outside the `cosmiconfig` property
|
||||
to configure your tools, entirely eliminating the need to look for additional configuration files:
|
||||
|
||||
```yaml
|
||||
cosmiconfig:
|
||||
searchPlaces: []
|
||||
|
||||
prettier:
|
||||
semi: true
|
||||
```
|
||||
|
||||
## Contributing & Development
|
||||
|
||||
Please note that this project is released with a [Contributor Code of Conduct](CODE_OF_CONDUCT.md). By participating in this project you agree to abide by its terms.
|
||||
|
||||
And please do participate!
|
||||
|
||||
[result]: #result
|
||||
|
||||
[`load()`]: #explorerload
|
||||
|
||||
[`search()`]: #explorersearch
|
||||
|
||||
[`clearloadcache()`]: #explorerclearloadcache
|
||||
|
||||
[`clearsearchcache()`]: #explorerclearsearchcache
|
||||
|
||||
[`cosmiconfig()`]: #cosmiconfig
|
||||
|
||||
[`cosmiconfigSync()`]: #cosmiconfigsync
|
||||
|
||||
[`clearcaches()`]: #explorerclearcaches
|
||||
|
||||
[`packageprop`]: #packageprop
|
||||
|
||||
[`cache`]: #cache
|
||||
|
||||
[`stopdir`]: #stopdir
|
||||
|
||||
[`searchplaces`]: #searchplaces
|
||||
|
||||
[`loaders`]: #loaders
|
||||
|
||||
[`cosmiconfigoptions`]: #cosmiconfigoptions
|
||||
|
||||
[`explorerSync.search()`]: #explorersyncsearch
|
||||
|
||||
[`explorerSync.load()`]: #explorersyncload
|
||||
|
||||
[`explorer.search()`]: #explorersearch
|
||||
|
||||
[`explorer.load()`]: #explorerload
|
||||
|
||||
["Loading JS modules"]: #loading-js-modules
|
2
my-app/node_modules/cosmiconfig/dist/Explorer.d.ts
generated
vendored
Executable file
2
my-app/node_modules/cosmiconfig/dist/Explorer.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,2 @@
|
|||
export {};
|
||||
//# sourceMappingURL=Explorer.d.ts.map
|
1
my-app/node_modules/cosmiconfig/dist/Explorer.d.ts.map
generated
vendored
Executable file
1
my-app/node_modules/cosmiconfig/dist/Explorer.d.ts.map
generated
vendored
Executable file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"Explorer.d.ts","sourceRoot":"","sources":["../src/Explorer.ts"],"names":[],"mappings":""}
|
103
my-app/node_modules/cosmiconfig/dist/Explorer.js
generated
vendored
Executable file
103
my-app/node_modules/cosmiconfig/dist/Explorer.js
generated
vendored
Executable file
|
@ -0,0 +1,103 @@
|
|||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Explorer = void 0;
|
||||
const promises_1 = __importDefault(require("fs/promises"));
|
||||
const path_1 = __importDefault(require("path"));
|
||||
const path_type_1 = require("path-type");
|
||||
const ExplorerBase_js_1 = require("./ExplorerBase.js");
|
||||
const loaders_js_1 = require("./loaders.js");
|
||||
const util_js_1 = require("./util.js");
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
class Explorer extends ExplorerBase_js_1.ExplorerBase {
|
||||
async load(filepath) {
|
||||
filepath = path_1.default.resolve(filepath);
|
||||
const load = async () => {
|
||||
return await this.config.transform(await this.#readConfiguration(filepath));
|
||||
};
|
||||
if (this.loadCache) {
|
||||
return await (0, util_js_1.emplace)(this.loadCache, filepath, load);
|
||||
}
|
||||
return await load();
|
||||
}
|
||||
async search(from = '') {
|
||||
if (this.config.metaConfigFilePath) {
|
||||
this.loadingMetaConfig = true;
|
||||
const config = await this.load(this.config.metaConfigFilePath);
|
||||
this.loadingMetaConfig = false;
|
||||
if (config && !config.isEmpty) {
|
||||
return config;
|
||||
}
|
||||
}
|
||||
const stopDir = path_1.default.resolve(this.config.stopDir);
|
||||
from = path_1.default.resolve(from);
|
||||
const search = async () => {
|
||||
/* istanbul ignore if -- @preserve */
|
||||
if (await (0, path_type_1.isDirectory)(from)) {
|
||||
for (const place of this.config.searchPlaces) {
|
||||
const filepath = path_1.default.join(from, place);
|
||||
try {
|
||||
const result = await this.#readConfiguration(filepath);
|
||||
if (result !== null &&
|
||||
!(result.isEmpty && this.config.ignoreEmptySearchPlaces)) {
|
||||
return await this.config.transform(result);
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
if (error.code === 'ENOENT' ||
|
||||
error.code === 'EISDIR' ||
|
||||
error.code === 'ENOTDIR') {
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
const dir = path_1.default.dirname(from);
|
||||
if (from !== stopDir && from !== dir) {
|
||||
from = dir;
|
||||
if (this.searchCache) {
|
||||
return await (0, util_js_1.emplace)(this.searchCache, from, search);
|
||||
}
|
||||
return await search();
|
||||
}
|
||||
return await this.config.transform(null);
|
||||
};
|
||||
if (this.searchCache) {
|
||||
return await (0, util_js_1.emplace)(this.searchCache, from, search);
|
||||
}
|
||||
return await search();
|
||||
}
|
||||
async #readConfiguration(filepath) {
|
||||
const contents = await promises_1.default.readFile(filepath, { encoding: 'utf-8' });
|
||||
return this.toCosmiconfigResult(filepath, await this.#loadConfiguration(filepath, contents));
|
||||
}
|
||||
async #loadConfiguration(filepath, contents) {
|
||||
if (contents.trim() === '') {
|
||||
return;
|
||||
}
|
||||
if (path_1.default.basename(filepath) === 'package.json') {
|
||||
return ((0, util_js_1.getPropertyByPath)((0, loaders_js_1.loadJson)(filepath, contents), this.config.packageProp) ?? null);
|
||||
}
|
||||
const extension = path_1.default.extname(filepath);
|
||||
try {
|
||||
const loader = this.config.loaders[extension || 'noExt'] ??
|
||||
this.config.loaders['default'];
|
||||
if (loader !== undefined) {
|
||||
// eslint-disable-next-line @typescript-eslint/return-await
|
||||
return await loader(filepath, contents);
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
error.filepath = filepath;
|
||||
throw error;
|
||||
}
|
||||
throw new Error(`No loader specified for ${(0, ExplorerBase_js_1.getExtensionDescription)(extension)}`);
|
||||
}
|
||||
}
|
||||
exports.Explorer = Explorer;
|
||||
//# sourceMappingURL=Explorer.js.map
|
1
my-app/node_modules/cosmiconfig/dist/Explorer.js.map
generated
vendored
Executable file
1
my-app/node_modules/cosmiconfig/dist/Explorer.js.map
generated
vendored
Executable file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"Explorer.js","sourceRoot":"","sources":["../src/Explorer.ts"],"names":[],"mappings":"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"}
|
2
my-app/node_modules/cosmiconfig/dist/ExplorerBase.d.ts
generated
vendored
Executable file
2
my-app/node_modules/cosmiconfig/dist/ExplorerBase.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,2 @@
|
|||
export {};
|
||||
//# sourceMappingURL=ExplorerBase.d.ts.map
|
1
my-app/node_modules/cosmiconfig/dist/ExplorerBase.d.ts.map
generated
vendored
Executable file
1
my-app/node_modules/cosmiconfig/dist/ExplorerBase.d.ts.map
generated
vendored
Executable file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"ExplorerBase.d.ts","sourceRoot":"","sources":["../src/ExplorerBase.ts"],"names":[],"mappings":""}
|
82
my-app/node_modules/cosmiconfig/dist/ExplorerBase.js
generated
vendored
Executable file
82
my-app/node_modules/cosmiconfig/dist/ExplorerBase.js
generated
vendored
Executable file
|
@ -0,0 +1,82 @@
|
|||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getExtensionDescription = exports.ExplorerBase = void 0;
|
||||
const path_1 = __importDefault(require("path"));
|
||||
const util_js_1 = require("./util.js");
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
class ExplorerBase {
|
||||
#loadingMetaConfig = false;
|
||||
config;
|
||||
loadCache;
|
||||
searchCache;
|
||||
constructor(options) {
|
||||
this.config = options;
|
||||
if (options.cache) {
|
||||
this.loadCache = new Map();
|
||||
this.searchCache = new Map();
|
||||
}
|
||||
this.#validateConfig();
|
||||
}
|
||||
set loadingMetaConfig(value) {
|
||||
this.#loadingMetaConfig = value;
|
||||
}
|
||||
#validateConfig() {
|
||||
const config = this.config;
|
||||
for (const place of config.searchPlaces) {
|
||||
const extension = path_1.default.extname(place);
|
||||
const loader = this.config.loaders[extension || 'noExt'] ??
|
||||
this.config.loaders['default'];
|
||||
if (loader === undefined) {
|
||||
throw new Error(`Missing loader for ${getExtensionDescription(place)}.`);
|
||||
}
|
||||
if (typeof loader !== 'function') {
|
||||
throw new Error(`Loader for ${getExtensionDescription(place)} is not a function: Received ${typeof loader}.`);
|
||||
}
|
||||
}
|
||||
}
|
||||
clearLoadCache() {
|
||||
if (this.loadCache) {
|
||||
this.loadCache.clear();
|
||||
}
|
||||
}
|
||||
clearSearchCache() {
|
||||
if (this.searchCache) {
|
||||
this.searchCache.clear();
|
||||
}
|
||||
}
|
||||
clearCaches() {
|
||||
this.clearLoadCache();
|
||||
this.clearSearchCache();
|
||||
}
|
||||
toCosmiconfigResult(filepath, config) {
|
||||
if (config === null) {
|
||||
return null;
|
||||
}
|
||||
if (config === undefined) {
|
||||
return { filepath, config: undefined, isEmpty: true };
|
||||
}
|
||||
if (this.config.applyPackagePropertyPathToConfiguration ||
|
||||
this.#loadingMetaConfig) {
|
||||
config = (0, util_js_1.getPropertyByPath)(config, this.config.packageProp);
|
||||
}
|
||||
if (config === undefined) {
|
||||
return { filepath, config: undefined, isEmpty: true };
|
||||
}
|
||||
return { config, filepath };
|
||||
}
|
||||
}
|
||||
exports.ExplorerBase = ExplorerBase;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
function getExtensionDescription(extension) {
|
||||
/* istanbul ignore next -- @preserve */
|
||||
return extension ? `extension "${extension}"` : 'files without extensions';
|
||||
}
|
||||
exports.getExtensionDescription = getExtensionDescription;
|
||||
//# sourceMappingURL=ExplorerBase.js.map
|
1
my-app/node_modules/cosmiconfig/dist/ExplorerBase.js.map
generated
vendored
Executable file
1
my-app/node_modules/cosmiconfig/dist/ExplorerBase.js.map
generated
vendored
Executable file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"ExplorerBase.js","sourceRoot":"","sources":["../src/ExplorerBase.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AASxB,uCAA8C;AAE9C;;GAEG;AACH,MAAsB,YAAY;IAGhC,kBAAkB,GAAG,KAAK,CAAC;IAER,MAAM,CAAI;IACV,SAAS,CAEb;IACI,WAAW,CAEf;IAEf,YAAmB,OAAoB;QACrC,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC;QACtB,IAAI,OAAO,CAAC,KAAK,EAAE;YACjB,IAAI,CAAC,SAAS,GAAG,IAAI,GAAG,EAAE,CAAC;YAC3B,IAAI,CAAC,WAAW,GAAG,IAAI,GAAG,EAAE,CAAC;SAC9B;QACD,IAAI,CAAC,eAAe,EAAE,CAAC;IACzB,CAAC;IAED,IAAc,iBAAiB,CAAC,KAAc;QAC5C,IAAI,CAAC,kBAAkB,GAAG,KAAK,CAAC;IAClC,CAAC;IAED,eAAe;QACb,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAE3B,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,YAAY,EAAE;YACvC,MAAM,SAAS,GAAG,cAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YACtC,MAAM,MAAM,GACV,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,IAAI,OAAO,CAAC;gBACzC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;YACjC,IAAI,MAAM,KAAK,SAAS,EAAE;gBACxB,MAAM,IAAI,KAAK,CACb,sBAAsB,uBAAuB,CAAC,KAAK,CAAC,GAAG,CACxD,CAAC;aACH;YACD,IAAI,OAAO,MAAM,KAAK,UAAU,EAAE;gBAChC,MAAM,IAAI,KAAK,CACb,cAAc,uBAAuB,CACnC,KAAK,CACN,gCAAgC,OAAO,MAAM,GAAG,CAClD,CAAC;aACH;SACF;IACH,CAAC;IAEM,cAAc;QACnB,IAAI,IAAI,CAAC,SAAS,EAAE;YAClB,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;SACxB;IACH,CAAC;IAEM,gBAAgB;QACrB,IAAI,IAAI,CAAC,WAAW,EAAE;YACpB,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC;SAC1B;IACH,CAAC;IAEM,WAAW;QAChB,IAAI,CAAC,cAAc,EAAE,CAAC;QACtB,IAAI,CAAC,gBAAgB,EAAE,CAAC;IAC1B,CAAC;IAES,mBAAmB,CAC3B,QAAgB,EAChB,MAAc;QAEd,IAAI,MAAM,KAAK,IAAI,EAAE;YACnB,OAAO,IAAI,CAAC;SACb;QACD,IAAI,MAAM,KAAK,SAAS,EAAE;YACxB,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;SACvD;QACD,IACE,IAAI,CAAC,MAAM,CAAC,uCAAuC;YACnD,IAAI,CAAC,kBAAkB,EACvB;YACA,MAAM,GAAG,IAAA,2BAAiB,EAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;SAC7D;QACD,IAAI,MAAM,KAAK,SAAS,EAAE;YACxB,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;SACvD;QACD,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;IAC9B,CAAC;CACF;AAvFD,oCAuFC;AAED;;GAEG;AACH,SAAgB,uBAAuB,CAAC,SAAkB;IACxD,uCAAuC;IACvC,OAAO,SAAS,CAAC,CAAC,CAAC,cAAc,SAAS,GAAG,CAAC,CAAC,CAAC,0BAA0B,CAAC;AAC7E,CAAC;AAHD,0DAGC"}
|
2
my-app/node_modules/cosmiconfig/dist/ExplorerSync.d.ts
generated
vendored
Executable file
2
my-app/node_modules/cosmiconfig/dist/ExplorerSync.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,2 @@
|
|||
export {};
|
||||
//# sourceMappingURL=ExplorerSync.d.ts.map
|
1
my-app/node_modules/cosmiconfig/dist/ExplorerSync.d.ts.map
generated
vendored
Executable file
1
my-app/node_modules/cosmiconfig/dist/ExplorerSync.d.ts.map
generated
vendored
Executable file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"ExplorerSync.d.ts","sourceRoot":"","sources":["../src/ExplorerSync.ts"],"names":[],"mappings":""}
|
116
my-app/node_modules/cosmiconfig/dist/ExplorerSync.js
generated
vendored
Executable file
116
my-app/node_modules/cosmiconfig/dist/ExplorerSync.js
generated
vendored
Executable file
|
@ -0,0 +1,116 @@
|
|||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ExplorerSync = void 0;
|
||||
const fs_1 = __importDefault(require("fs"));
|
||||
const path_1 = __importDefault(require("path"));
|
||||
const path_type_1 = require("path-type");
|
||||
const ExplorerBase_js_1 = require("./ExplorerBase.js");
|
||||
const loaders_js_1 = require("./loaders.js");
|
||||
const util_js_1 = require("./util.js");
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
class ExplorerSync extends ExplorerBase_js_1.ExplorerBase {
|
||||
load(filepath) {
|
||||
filepath = path_1.default.resolve(filepath);
|
||||
const load = () => {
|
||||
return this.config.transform(this.#readConfiguration(filepath));
|
||||
};
|
||||
if (this.loadCache) {
|
||||
return (0, util_js_1.emplace)(this.loadCache, filepath, load);
|
||||
}
|
||||
return load();
|
||||
}
|
||||
search(from = '') {
|
||||
if (this.config.metaConfigFilePath) {
|
||||
this.loadingMetaConfig = true;
|
||||
const config = this.load(this.config.metaConfigFilePath);
|
||||
this.loadingMetaConfig = false;
|
||||
if (config && !config.isEmpty) {
|
||||
return config;
|
||||
}
|
||||
}
|
||||
const stopDir = path_1.default.resolve(this.config.stopDir);
|
||||
from = path_1.default.resolve(from);
|
||||
const search = () => {
|
||||
/* istanbul ignore if -- @preserve */
|
||||
if ((0, path_type_1.isDirectorySync)(from)) {
|
||||
for (const place of this.config.searchPlaces) {
|
||||
const filepath = path_1.default.join(from, place);
|
||||
try {
|
||||
const result = this.#readConfiguration(filepath);
|
||||
if (result !== null &&
|
||||
!(result.isEmpty && this.config.ignoreEmptySearchPlaces)) {
|
||||
return this.config.transform(result);
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
if (error.code === 'ENOENT' ||
|
||||
error.code === 'EISDIR' ||
|
||||
error.code === 'ENOTDIR') {
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
const dir = path_1.default.dirname(from);
|
||||
if (from !== stopDir && from !== dir) {
|
||||
from = dir;
|
||||
if (this.searchCache) {
|
||||
return (0, util_js_1.emplace)(this.searchCache, from, search);
|
||||
}
|
||||
return search();
|
||||
}
|
||||
return this.config.transform(null);
|
||||
};
|
||||
if (this.searchCache) {
|
||||
return (0, util_js_1.emplace)(this.searchCache, from, search);
|
||||
}
|
||||
return search();
|
||||
}
|
||||
#readConfiguration(filepath) {
|
||||
const contents = fs_1.default.readFileSync(filepath, 'utf8');
|
||||
return this.toCosmiconfigResult(filepath, this.#loadConfiguration(filepath, contents));
|
||||
}
|
||||
#loadConfiguration(filepath, contents) {
|
||||
if (contents.trim() === '') {
|
||||
return;
|
||||
}
|
||||
if (path_1.default.basename(filepath) === 'package.json') {
|
||||
return ((0, util_js_1.getPropertyByPath)((0, loaders_js_1.loadJson)(filepath, contents), this.config.packageProp) ?? null);
|
||||
}
|
||||
const extension = path_1.default.extname(filepath);
|
||||
try {
|
||||
const loader = this.config.loaders[extension || 'noExt'] ??
|
||||
this.config.loaders['default'];
|
||||
if (loader !== undefined) {
|
||||
return loader(filepath, contents);
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
error.filepath = filepath;
|
||||
throw error;
|
||||
}
|
||||
throw new Error(`No loader specified for ${(0, ExplorerBase_js_1.getExtensionDescription)(extension)}`);
|
||||
}
|
||||
/**
|
||||
* @deprecated Use {@link ExplorerSync.prototype.load}.
|
||||
*/
|
||||
/* istanbul ignore next */
|
||||
loadSync(filepath) {
|
||||
return this.load(filepath);
|
||||
}
|
||||
/**
|
||||
* @deprecated Use {@link ExplorerSync.prototype.search}.
|
||||
*/
|
||||
/* istanbul ignore next */
|
||||
searchSync(from = '') {
|
||||
return this.search(from);
|
||||
}
|
||||
}
|
||||
exports.ExplorerSync = ExplorerSync;
|
||||
//# sourceMappingURL=ExplorerSync.js.map
|
1
my-app/node_modules/cosmiconfig/dist/ExplorerSync.js.map
generated
vendored
Executable file
1
my-app/node_modules/cosmiconfig/dist/ExplorerSync.js.map
generated
vendored
Executable file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"ExplorerSync.js","sourceRoot":"","sources":["../src/ExplorerSync.ts"],"names":[],"mappings":"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"}
|
25
my-app/node_modules/cosmiconfig/dist/index.d.ts
generated
vendored
Executable file
25
my-app/node_modules/cosmiconfig/dist/index.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,25 @@
|
|||
export * from './types.js';
|
||||
import { Options, OptionsSync, PublicExplorer, PublicExplorerSync } from './types.js';
|
||||
export declare const metaSearchPlaces: string[];
|
||||
export declare const defaultLoaders: Readonly<{
|
||||
readonly '.mjs': import("./types.js").Loader;
|
||||
readonly '.cjs': import("./types.js").Loader;
|
||||
readonly '.js': import("./types.js").Loader;
|
||||
readonly '.ts': import("./types.js").Loader;
|
||||
readonly '.json': import("./types.js").LoaderSync;
|
||||
readonly '.yaml': import("./types.js").LoaderSync;
|
||||
readonly '.yml': import("./types.js").LoaderSync;
|
||||
readonly noExt: import("./types.js").LoaderSync;
|
||||
}>;
|
||||
export declare const defaultLoadersSync: Readonly<{
|
||||
readonly '.cjs': import("./types.js").LoaderSync;
|
||||
readonly '.js': import("./types.js").LoaderSync;
|
||||
readonly '.ts': import("./types.js").LoaderSync;
|
||||
readonly '.json': import("./types.js").LoaderSync;
|
||||
readonly '.yaml': import("./types.js").LoaderSync;
|
||||
readonly '.yml': import("./types.js").LoaderSync;
|
||||
readonly noExt: import("./types.js").LoaderSync;
|
||||
}>;
|
||||
export declare function cosmiconfig(moduleName: string, options?: Readonly<Options>): PublicExplorer;
|
||||
export declare function cosmiconfigSync(moduleName: string, options?: Readonly<OptionsSync>): PublicExplorerSync;
|
||||
//# sourceMappingURL=index.d.ts.map
|
1
my-app/node_modules/cosmiconfig/dist/index.d.ts.map
generated
vendored
Executable file
1
my-app/node_modules/cosmiconfig/dist/index.d.ts.map
generated
vendored
Executable file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,YAAY,CAAC;AAa3B,OAAO,EAGL,OAAO,EACP,WAAW,EACX,cAAc,EACd,kBAAkB,EAEnB,MAAM,YAAY,CAAC;AAIpB,eAAO,MAAM,gBAAgB,UAS5B,CAAC;AAGF,eAAO,MAAM,cAAc;;;;;;;;;EAShB,CAAC;AACZ,eAAO,MAAM,kBAAkB;;;;;;;;EAQpB,CAAC;AAuIZ,wBAAgB,WAAW,CACzB,UAAU,EAAE,MAAM,EAClB,OAAO,GAAE,QAAQ,CAAC,OAAO,CAAM,GAC9B,cAAc,CAWhB;AAED,wBAAgB,eAAe,CAC7B,UAAU,EAAE,MAAM,EAClB,OAAO,GAAE,QAAQ,CAAC,WAAW,CAAM,GAClC,kBAAkB,CAWpB"}
|
195
my-app/node_modules/cosmiconfig/dist/index.js
generated
vendored
Executable file
195
my-app/node_modules/cosmiconfig/dist/index.js
generated
vendored
Executable file
|
@ -0,0 +1,195 @@
|
|||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.cosmiconfigSync = exports.cosmiconfig = exports.defaultLoadersSync = exports.defaultLoaders = exports.metaSearchPlaces = void 0;
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
__exportStar(require("./types.js"), exports);
|
||||
const os_1 = __importDefault(require("os"));
|
||||
const Explorer_js_1 = require("./Explorer.js");
|
||||
const ExplorerSync_js_1 = require("./ExplorerSync.js");
|
||||
const loaders_js_1 = require("./loaders.js");
|
||||
const util_1 = require("./util");
|
||||
// this needs to be hardcoded, as this is intended for end users, who can't supply options at this point
|
||||
exports.metaSearchPlaces = [
|
||||
'package.json',
|
||||
'.config.json',
|
||||
'.config.yaml',
|
||||
'.config.yml',
|
||||
'.config.js',
|
||||
'.config.ts',
|
||||
'.config.cjs',
|
||||
'.config.mjs',
|
||||
];
|
||||
// do not allow mutation of default loaders. Make sure it is set inside options
|
||||
exports.defaultLoaders = Object.freeze({
|
||||
'.mjs': loaders_js_1.loadJs,
|
||||
'.cjs': loaders_js_1.loadJs,
|
||||
'.js': loaders_js_1.loadJs,
|
||||
'.ts': loaders_js_1.loadTs,
|
||||
'.json': loaders_js_1.loadJson,
|
||||
'.yaml': loaders_js_1.loadYaml,
|
||||
'.yml': loaders_js_1.loadYaml,
|
||||
noExt: loaders_js_1.loadYaml,
|
||||
});
|
||||
exports.defaultLoadersSync = Object.freeze({
|
||||
'.cjs': loaders_js_1.loadJsSync,
|
||||
'.js': loaders_js_1.loadJsSync,
|
||||
'.ts': loaders_js_1.loadTsSync,
|
||||
'.json': loaders_js_1.loadJson,
|
||||
'.yaml': loaders_js_1.loadYaml,
|
||||
'.yml': loaders_js_1.loadYaml,
|
||||
noExt: loaders_js_1.loadYaml,
|
||||
});
|
||||
const identity = function identity(x) {
|
||||
return x;
|
||||
};
|
||||
function getInternalOptions(moduleName, options) {
|
||||
const metaExplorer = new ExplorerSync_js_1.ExplorerSync({
|
||||
packageProp: 'cosmiconfig',
|
||||
stopDir: process.cwd(),
|
||||
searchPlaces: exports.metaSearchPlaces,
|
||||
ignoreEmptySearchPlaces: false,
|
||||
applyPackagePropertyPathToConfiguration: true,
|
||||
loaders: exports.defaultLoaders,
|
||||
transform: identity,
|
||||
cache: true,
|
||||
metaConfigFilePath: null,
|
||||
});
|
||||
const metaConfig = metaExplorer.search();
|
||||
if (!metaConfig) {
|
||||
return options;
|
||||
}
|
||||
if (metaConfig.config?.loaders) {
|
||||
throw new Error('Can not specify loaders in meta config file');
|
||||
}
|
||||
const overrideOptions = metaConfig.config ?? {};
|
||||
if (overrideOptions.searchPlaces) {
|
||||
overrideOptions.searchPlaces = overrideOptions.searchPlaces.map((path) => path.replace('{name}', moduleName));
|
||||
}
|
||||
overrideOptions.metaConfigFilePath = metaConfig.filepath;
|
||||
return { ...options, ...(0, util_1.removeUndefinedValuesFromObject)(overrideOptions) };
|
||||
}
|
||||
function normalizeOptions(moduleName, options) {
|
||||
const defaults = {
|
||||
packageProp: moduleName,
|
||||
searchPlaces: [
|
||||
'package.json',
|
||||
`.${moduleName}rc`,
|
||||
`.${moduleName}rc.json`,
|
||||
`.${moduleName}rc.yaml`,
|
||||
`.${moduleName}rc.yml`,
|
||||
`.${moduleName}rc.js`,
|
||||
`.${moduleName}rc.ts`,
|
||||
`.${moduleName}rc.cjs`,
|
||||
`.${moduleName}rc.mjs`,
|
||||
`.config/${moduleName}rc`,
|
||||
`.config/${moduleName}rc.json`,
|
||||
`.config/${moduleName}rc.yaml`,
|
||||
`.config/${moduleName}rc.yml`,
|
||||
`.config/${moduleName}rc.js`,
|
||||
`.config/${moduleName}rc.ts`,
|
||||
`.config/${moduleName}rc.cjs`,
|
||||
`.config/${moduleName}rc.mjs`,
|
||||
`${moduleName}.config.js`,
|
||||
`${moduleName}.config.ts`,
|
||||
`${moduleName}.config.cjs`,
|
||||
`${moduleName}.config.mjs`,
|
||||
],
|
||||
ignoreEmptySearchPlaces: true,
|
||||
stopDir: os_1.default.homedir(),
|
||||
cache: true,
|
||||
transform: identity,
|
||||
loaders: exports.defaultLoaders,
|
||||
metaConfigFilePath: null,
|
||||
};
|
||||
return {
|
||||
...defaults,
|
||||
...(0, util_1.removeUndefinedValuesFromObject)(options),
|
||||
loaders: {
|
||||
...defaults.loaders,
|
||||
...options.loaders,
|
||||
},
|
||||
};
|
||||
}
|
||||
function normalizeOptionsSync(moduleName, options) {
|
||||
const defaults = {
|
||||
packageProp: moduleName,
|
||||
searchPlaces: [
|
||||
'package.json',
|
||||
`.${moduleName}rc`,
|
||||
`.${moduleName}rc.json`,
|
||||
`.${moduleName}rc.yaml`,
|
||||
`.${moduleName}rc.yml`,
|
||||
`.${moduleName}rc.js`,
|
||||
`.${moduleName}rc.ts`,
|
||||
`.${moduleName}rc.cjs`,
|
||||
`.config/${moduleName}rc`,
|
||||
`.config/${moduleName}rc.json`,
|
||||
`.config/${moduleName}rc.yaml`,
|
||||
`.config/${moduleName}rc.yml`,
|
||||
`.config/${moduleName}rc.js`,
|
||||
`.config/${moduleName}rc.ts`,
|
||||
`.config/${moduleName}rc.cjs`,
|
||||
`${moduleName}.config.js`,
|
||||
`${moduleName}.config.ts`,
|
||||
`${moduleName}.config.cjs`,
|
||||
],
|
||||
ignoreEmptySearchPlaces: true,
|
||||
stopDir: os_1.default.homedir(),
|
||||
cache: true,
|
||||
transform: identity,
|
||||
loaders: exports.defaultLoadersSync,
|
||||
metaConfigFilePath: null,
|
||||
};
|
||||
return {
|
||||
...defaults,
|
||||
...(0, util_1.removeUndefinedValuesFromObject)(options),
|
||||
loaders: {
|
||||
...defaults.loaders,
|
||||
...options.loaders,
|
||||
},
|
||||
};
|
||||
}
|
||||
function cosmiconfig(moduleName, options = {}) {
|
||||
const internalOptions = getInternalOptions(moduleName, options);
|
||||
const normalizedOptions = normalizeOptions(moduleName, internalOptions);
|
||||
const explorer = new Explorer_js_1.Explorer(normalizedOptions);
|
||||
return {
|
||||
search: explorer.search.bind(explorer),
|
||||
load: explorer.load.bind(explorer),
|
||||
clearLoadCache: explorer.clearLoadCache.bind(explorer),
|
||||
clearSearchCache: explorer.clearSearchCache.bind(explorer),
|
||||
clearCaches: explorer.clearCaches.bind(explorer),
|
||||
};
|
||||
}
|
||||
exports.cosmiconfig = cosmiconfig;
|
||||
function cosmiconfigSync(moduleName, options = {}) {
|
||||
const internalOptions = getInternalOptions(moduleName, options);
|
||||
const normalizedOptions = normalizeOptionsSync(moduleName, internalOptions);
|
||||
const explorerSync = new ExplorerSync_js_1.ExplorerSync(normalizedOptions);
|
||||
return {
|
||||
search: explorerSync.search.bind(explorerSync),
|
||||
load: explorerSync.load.bind(explorerSync),
|
||||
clearLoadCache: explorerSync.clearLoadCache.bind(explorerSync),
|
||||
clearSearchCache: explorerSync.clearSearchCache.bind(explorerSync),
|
||||
clearCaches: explorerSync.clearCaches.bind(explorerSync),
|
||||
};
|
||||
}
|
||||
exports.cosmiconfigSync = cosmiconfigSync;
|
||||
//# sourceMappingURL=index.js.map
|
1
my-app/node_modules/cosmiconfig/dist/index.js.map
generated
vendored
Executable file
1
my-app/node_modules/cosmiconfig/dist/index.js.map
generated
vendored
Executable file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"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"}
|
8
my-app/node_modules/cosmiconfig/dist/loaders.d.ts
generated
vendored
Executable file
8
my-app/node_modules/cosmiconfig/dist/loaders.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,8 @@
|
|||
import { Loader, LoaderSync } from './types.js';
|
||||
export declare const loadJsSync: LoaderSync;
|
||||
export declare const loadJs: Loader;
|
||||
export declare const loadJson: LoaderSync;
|
||||
export declare const loadYaml: LoaderSync;
|
||||
export declare const loadTsSync: LoaderSync;
|
||||
export declare const loadTs: Loader;
|
||||
//# sourceMappingURL=loaders.d.ts.map
|
1
my-app/node_modules/cosmiconfig/dist/loaders.d.ts.map
generated
vendored
Executable file
1
my-app/node_modules/cosmiconfig/dist/loaders.d.ts.map
generated
vendored
Executable file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"loaders.d.ts","sourceRoot":"","sources":["../src/loaders.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAGhD,eAAO,MAAM,UAAU,EAAE,UAMxB,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,MAOpB,CAAC;AAGF,eAAO,MAAM,QAAQ,EAAE,UAWtB,CAAC;AAGF,eAAO,MAAM,QAAQ,EAAE,UAWtB,CAAC;AAGF,eAAO,MAAM,UAAU,EAAE,UA0BxB,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,MA0BpB,CAAC"}
|
133
my-app/node_modules/cosmiconfig/dist/loaders.js
generated
vendored
Executable file
133
my-app/node_modules/cosmiconfig/dist/loaders.js
generated
vendored
Executable file
|
@ -0,0 +1,133 @@
|
|||
"use strict";
|
||||
/* eslint-disable @typescript-eslint/no-require-imports */
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.loadTs = exports.loadTsSync = exports.loadYaml = exports.loadJson = exports.loadJs = exports.loadJsSync = void 0;
|
||||
const fs_1 = require("fs");
|
||||
const promises_1 = require("fs/promises");
|
||||
const path_1 = __importDefault(require("path"));
|
||||
const url_1 = require("url");
|
||||
let importFresh;
|
||||
const loadJsSync = function loadJsSync(filepath) {
|
||||
if (importFresh === undefined) {
|
||||
importFresh = require('import-fresh');
|
||||
}
|
||||
return importFresh(filepath);
|
||||
};
|
||||
exports.loadJsSync = loadJsSync;
|
||||
const loadJs = async function loadJs(filepath) {
|
||||
try {
|
||||
const { href } = (0, url_1.pathToFileURL)(filepath);
|
||||
return (await import(href)).default;
|
||||
}
|
||||
catch (error) {
|
||||
return (0, exports.loadJsSync)(filepath, '');
|
||||
}
|
||||
};
|
||||
exports.loadJs = loadJs;
|
||||
let parseJson;
|
||||
const loadJson = function loadJson(filepath, content) {
|
||||
if (parseJson === undefined) {
|
||||
parseJson = require('parse-json');
|
||||
}
|
||||
try {
|
||||
return parseJson(content);
|
||||
}
|
||||
catch (error) {
|
||||
error.message = `JSON Error in ${filepath}:\n${error.message}`;
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
exports.loadJson = loadJson;
|
||||
let yaml;
|
||||
const loadYaml = function loadYaml(filepath, content) {
|
||||
if (yaml === undefined) {
|
||||
yaml = require('js-yaml');
|
||||
}
|
||||
try {
|
||||
return yaml.load(content);
|
||||
}
|
||||
catch (error) {
|
||||
error.message = `YAML Error in ${filepath}:\n${error.message}`;
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
exports.loadYaml = loadYaml;
|
||||
let typescript;
|
||||
const loadTsSync = function loadTsSync(filepath, content) {
|
||||
/* istanbul ignore next -- @preserve */
|
||||
if (typescript === undefined) {
|
||||
typescript = require('typescript');
|
||||
}
|
||||
const compiledFilepath = `${filepath.slice(0, -2)}cjs`;
|
||||
try {
|
||||
const config = resolveTsConfig(path_1.default.dirname(filepath)) ?? {};
|
||||
config.compilerOptions = {
|
||||
...config.compilerOptions,
|
||||
module: typescript.ModuleKind.NodeNext,
|
||||
moduleResolution: typescript.ModuleResolutionKind.NodeNext,
|
||||
target: typescript.ScriptTarget.ES2022,
|
||||
noEmit: false,
|
||||
};
|
||||
content = typescript.transpileModule(content, config).outputText;
|
||||
(0, fs_1.writeFileSync)(compiledFilepath, content);
|
||||
return (0, exports.loadJsSync)(compiledFilepath, content).default;
|
||||
}
|
||||
catch (error) {
|
||||
error.message = `TypeScript Error in ${filepath}:\n${error.message}`;
|
||||
throw error;
|
||||
}
|
||||
finally {
|
||||
if ((0, fs_1.existsSync)(compiledFilepath)) {
|
||||
(0, fs_1.rmSync)(compiledFilepath);
|
||||
}
|
||||
}
|
||||
};
|
||||
exports.loadTsSync = loadTsSync;
|
||||
const loadTs = async function loadTs(filepath, content) {
|
||||
if (typescript === undefined) {
|
||||
typescript = (await import('typescript')).default;
|
||||
}
|
||||
const compiledFilepath = `${filepath.slice(0, -2)}mjs`;
|
||||
try {
|
||||
const config = resolveTsConfig(path_1.default.dirname(filepath)) ?? {};
|
||||
config.compilerOptions = {
|
||||
...config.compilerOptions,
|
||||
module: typescript.ModuleKind.ES2022,
|
||||
moduleResolution: typescript.ModuleResolutionKind.Bundler,
|
||||
target: typescript.ScriptTarget.ES2022,
|
||||
noEmit: false,
|
||||
};
|
||||
content = typescript.transpileModule(content, config).outputText;
|
||||
await (0, promises_1.writeFile)(compiledFilepath, content);
|
||||
const { href } = (0, url_1.pathToFileURL)(compiledFilepath);
|
||||
return (await import(href)).default;
|
||||
}
|
||||
catch (error) {
|
||||
error.message = `TypeScript Error in ${filepath}:\n${error.message}`;
|
||||
throw error;
|
||||
}
|
||||
finally {
|
||||
if ((0, fs_1.existsSync)(compiledFilepath)) {
|
||||
await (0, promises_1.rm)(compiledFilepath);
|
||||
}
|
||||
}
|
||||
};
|
||||
exports.loadTs = loadTs;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
function resolveTsConfig(directory) {
|
||||
const filePath = typescript.findConfigFile(directory, (fileName) => {
|
||||
return typescript.sys.fileExists(fileName);
|
||||
});
|
||||
if (filePath !== undefined) {
|
||||
const { config, error } = typescript.readConfigFile(filePath, (path) => typescript.sys.readFile(path));
|
||||
if (error) {
|
||||
throw new Error(`Error in ${filePath}: ${error.messageText.toString()}`);
|
||||
}
|
||||
return config;
|
||||
}
|
||||
return;
|
||||
}
|
||||
//# sourceMappingURL=loaders.js.map
|
1
my-app/node_modules/cosmiconfig/dist/loaders.js.map
generated
vendored
Executable file
1
my-app/node_modules/cosmiconfig/dist/loaders.js.map
generated
vendored
Executable file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"loaders.js","sourceRoot":"","sources":["../src/loaders.ts"],"names":[],"mappings":"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"}
|
91
my-app/node_modules/cosmiconfig/dist/types.d.ts
generated
vendored
Executable file
91
my-app/node_modules/cosmiconfig/dist/types.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,91 @@
|
|||
/**
|
||||
* @public
|
||||
*/
|
||||
export type Config = any;
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export type CosmiconfigResult = {
|
||||
config: Config;
|
||||
filepath: string;
|
||||
isEmpty?: boolean;
|
||||
} | null;
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export type LoaderResult = Config | null;
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export type Loader = ((filepath: string, content: string) => Promise<LoaderResult>) | LoaderSync;
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export type LoaderSync = (filepath: string, content: string) => LoaderResult;
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export type Transform = ((CosmiconfigResult: CosmiconfigResult) => Promise<CosmiconfigResult>) | TransformSync;
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export type TransformSync = (CosmiconfigResult: CosmiconfigResult) => CosmiconfigResult;
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface CommonOptions {
|
||||
packageProp?: string | Array<string>;
|
||||
searchPlaces?: Array<string>;
|
||||
ignoreEmptySearchPlaces?: boolean;
|
||||
stopDir?: string;
|
||||
cache?: boolean;
|
||||
}
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface Options extends CommonOptions {
|
||||
loaders?: Loaders;
|
||||
transform?: Transform;
|
||||
}
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface OptionsSync extends CommonOptions {
|
||||
loaders?: LoadersSync;
|
||||
transform?: TransformSync;
|
||||
}
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface Loaders {
|
||||
[key: string]: Loader;
|
||||
}
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface LoadersSync {
|
||||
[key: string]: LoaderSync;
|
||||
}
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface PublicExplorerBase {
|
||||
clearLoadCache: () => void;
|
||||
clearSearchCache: () => void;
|
||||
clearCaches: () => void;
|
||||
}
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface PublicExplorer extends PublicExplorerBase {
|
||||
search: (searchFrom?: string) => Promise<CosmiconfigResult>;
|
||||
load: (filepath: string) => Promise<CosmiconfigResult>;
|
||||
}
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface PublicExplorerSync extends PublicExplorerBase {
|
||||
search: (searchFrom?: string) => CosmiconfigResult;
|
||||
load: (filepath: string) => CosmiconfigResult;
|
||||
}
|
||||
//# sourceMappingURL=types.d.ts.map
|
1
my-app/node_modules/cosmiconfig/dist/types.d.ts.map
generated
vendored
Executable file
1
my-app/node_modules/cosmiconfig/dist/types.d.ts.map
generated
vendored
Executable file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,MAAM,MAAM,GAAG,GAAG,CAAC;AAEzB;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,GAAG,IAAI,CAAC;AAET;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,IAAI,CAAC;AAEzC;;GAEG;AACH,MAAM,MAAM,MAAM,GACd,CAAC,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,YAAY,CAAC,CAAC,GAC9D,UAAU,CAAC;AAEf;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,YAAY,CAAC;AAE7E;;GAEG;AACH,MAAM,MAAM,SAAS,GACjB,CAAC,CAAC,iBAAiB,EAAE,iBAAiB,KAAK,OAAO,CAAC,iBAAiB,CAAC,CAAC,GACtE,aAAa,CAAC;AAElB;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,CAC1B,iBAAiB,EAAE,iBAAiB,KACjC,iBAAiB,CAAC;AAEvB;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,WAAW,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;IACrC,YAAY,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC7B,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,OAAQ,SAAQ,aAAa;IAC5C,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,WAAY,SAAQ,aAAa;IAChD,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,SAAS,CAAC,EAAE,aAAa,CAAC;CAC3B;AA4BD;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,gBAAgB,EAAE,MAAM,IAAI,CAAC;IAC7B,WAAW,EAAE,MAAM,IAAI,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,cAAe,SAAQ,kBAAkB;IACxD,MAAM,EAAE,CAAC,UAAU,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAC5D,IAAI,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,iBAAiB,CAAC,CAAC;CACxD;AAED;;GAEG;AACH,MAAM,WAAW,kBAAmB,SAAQ,kBAAkB;IAC5D,MAAM,EAAE,CAAC,UAAU,CAAC,EAAE,MAAM,KAAK,iBAAiB,CAAC;IACnD,IAAI,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,iBAAiB,CAAC;CAC/C"}
|
3
my-app/node_modules/cosmiconfig/dist/types.js
generated
vendored
Executable file
3
my-app/node_modules/cosmiconfig/dist/types.js
generated
vendored
Executable file
|
@ -0,0 +1,3 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//# sourceMappingURL=types.js.map
|
1
my-app/node_modules/cosmiconfig/dist/types.js.map
generated
vendored
Executable file
1
my-app/node_modules/cosmiconfig/dist/types.js.map
generated
vendored
Executable file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
2
my-app/node_modules/cosmiconfig/dist/util.d.ts
generated
vendored
Executable file
2
my-app/node_modules/cosmiconfig/dist/util.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,2 @@
|
|||
export {};
|
||||
//# sourceMappingURL=util.d.ts.map
|
1
my-app/node_modules/cosmiconfig/dist/util.d.ts.map
generated
vendored
Executable file
1
my-app/node_modules/cosmiconfig/dist/util.d.ts.map
generated
vendored
Executable file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":""}
|
49
my-app/node_modules/cosmiconfig/dist/util.js
generated
vendored
Executable file
49
my-app/node_modules/cosmiconfig/dist/util.js
generated
vendored
Executable file
|
@ -0,0 +1,49 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.removeUndefinedValuesFromObject = exports.getPropertyByPath = exports.emplace = void 0;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
function emplace(map, key, fn) {
|
||||
const cached = map.get(key);
|
||||
if (cached !== undefined) {
|
||||
return cached;
|
||||
}
|
||||
const result = fn();
|
||||
map.set(key, result);
|
||||
return result;
|
||||
}
|
||||
exports.emplace = emplace;
|
||||
// Resolves property names or property paths defined with period-delimited
|
||||
// strings or arrays of strings. Property names that are found on the source
|
||||
// object are used directly (even if they include a period).
|
||||
// Nested property names that include periods, within a path, are only
|
||||
// understood in array paths.
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
function getPropertyByPath(source, path) {
|
||||
if (typeof path === 'string' &&
|
||||
Object.prototype.hasOwnProperty.call(source, path)) {
|
||||
return source[path];
|
||||
}
|
||||
const parsedPath = typeof path === 'string' ? path.split('.') : path;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
return parsedPath.reduce((previous, key) => {
|
||||
if (previous === undefined) {
|
||||
return previous;
|
||||
}
|
||||
return previous[key];
|
||||
}, source);
|
||||
}
|
||||
exports.getPropertyByPath = getPropertyByPath;
|
||||
/** @internal */
|
||||
function removeUndefinedValuesFromObject(options) {
|
||||
/* istanbul ignore if -- @preserve */
|
||||
if (!options) {
|
||||
return undefined;
|
||||
}
|
||||
return Object.fromEntries(Object.entries(options).filter(([, value]) => value !== undefined));
|
||||
}
|
||||
exports.removeUndefinedValuesFromObject = removeUndefinedValuesFromObject;
|
||||
//# sourceMappingURL=util.js.map
|
1
my-app/node_modules/cosmiconfig/dist/util.js.map
generated
vendored
Executable file
1
my-app/node_modules/cosmiconfig/dist/util.js.map
generated
vendored
Executable file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"util.js","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,SAAgB,OAAO,CAAO,GAAc,EAAE,GAAM,EAAE,EAAW;IAC/D,MAAM,MAAM,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC5B,IAAI,MAAM,KAAK,SAAS,EAAE;QACxB,OAAO,MAAM,CAAC;KACf;IACD,MAAM,MAAM,GAAG,EAAE,EAAE,CAAC;IACpB,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IACrB,OAAO,MAAM,CAAC;AAChB,CAAC;AARD,0BAQC;AAED,0EAA0E;AAC1E,4EAA4E;AAC5E,4DAA4D;AAC5D,sEAAsE;AACtE,6BAA6B;AAC7B;;GAEG;AACH,SAAgB,iBAAiB,CAC/B,MAAkC,EAClC,IAA4B;IAE5B,IACE,OAAO,IAAI,KAAK,QAAQ;QACxB,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,EAClD;QACA,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC;KACrB;IAED,MAAM,UAAU,GAAG,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACrE,8DAA8D;IAC9D,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC,QAAa,EAAE,GAAG,EAAW,EAAE;QACvD,IAAI,QAAQ,KAAK,SAAS,EAAE;YAC1B,OAAO,QAAQ,CAAC;SACjB;QACD,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC;IACvB,CAAC,EAAE,MAAM,CAAC,CAAC;AACb,CAAC;AAnBD,8CAmBC;AAED,gBAAgB;AAChB,SAAgB,+BAA+B,CAC7C,OAA4C;IAE5C,qCAAqC;IACrC,IAAI,CAAC,OAAO,EAAE;QACZ,OAAO,SAAS,CAAC;KAClB;IACD,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,KAAK,SAAS,CAAC,CACnE,CAAC;AACJ,CAAC;AAVD,0EAUC"}
|
1
my-app/node_modules/cosmiconfig/node_modules/.bin/js-yaml
generated
vendored
Symbolic link
1
my-app/node_modules/cosmiconfig/node_modules/.bin/js-yaml
generated
vendored
Symbolic link
|
@ -0,0 +1 @@
|
|||
../js-yaml/bin/js-yaml.js
|
216
my-app/node_modules/cosmiconfig/node_modules/argparse/CHANGELOG.md
generated
vendored
Executable file
216
my-app/node_modules/cosmiconfig/node_modules/argparse/CHANGELOG.md
generated
vendored
Executable file
|
@ -0,0 +1,216 @@
|
|||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
|
||||
## [2.0.1] - 2020-08-29
|
||||
### Fixed
|
||||
- Fix issue with `process.argv` when used with interpreters (`coffee`, `ts-node`, etc.), #150.
|
||||
|
||||
|
||||
## [2.0.0] - 2020-08-14
|
||||
### Changed
|
||||
- Full rewrite. Now port from python 3.9.0 & more precise following.
|
||||
See [doc](./doc) for difference and migration info.
|
||||
- node.js 10+ required
|
||||
- Removed most of local docs in favour of original ones.
|
||||
|
||||
|
||||
## [1.0.10] - 2018-02-15
|
||||
### Fixed
|
||||
- Use .concat instead of + for arrays, #122.
|
||||
|
||||
|
||||
## [1.0.9] - 2016-09-29
|
||||
### Changed
|
||||
- Rerelease after 1.0.8 - deps cleanup.
|
||||
|
||||
|
||||
## [1.0.8] - 2016-09-29
|
||||
### Changed
|
||||
- Maintenance (deps bump, fix node 6.5+ tests, coverage report).
|
||||
|
||||
|
||||
## [1.0.7] - 2016-03-17
|
||||
### Changed
|
||||
- Teach `addArgument` to accept string arg names. #97, @tomxtobin.
|
||||
|
||||
|
||||
## [1.0.6] - 2016-02-06
|
||||
### Changed
|
||||
- Maintenance: moved to eslint & updated CS.
|
||||
|
||||
|
||||
## [1.0.5] - 2016-02-05
|
||||
### Changed
|
||||
- Removed lodash dependency to significantly reduce install size.
|
||||
Thanks to @mourner.
|
||||
|
||||
|
||||
## [1.0.4] - 2016-01-17
|
||||
### Changed
|
||||
- Maintenance: lodash update to 4.0.0.
|
||||
|
||||
|
||||
## [1.0.3] - 2015-10-27
|
||||
### Fixed
|
||||
- Fix parse `=` in args: `--examplepath="C:\myfolder\env=x64"`. #84, @CatWithApple.
|
||||
|
||||
|
||||
## [1.0.2] - 2015-03-22
|
||||
### Changed
|
||||
- Relaxed lodash version dependency.
|
||||
|
||||
|
||||
## [1.0.1] - 2015-02-20
|
||||
### Changed
|
||||
- Changed dependencies to be compatible with ancient nodejs.
|
||||
|
||||
|
||||
## [1.0.0] - 2015-02-19
|
||||
### Changed
|
||||
- Maintenance release.
|
||||
- Replaced `underscore` with `lodash`.
|
||||
- Bumped version to 1.0.0 to better reflect semver meaning.
|
||||
- HISTORY.md -> CHANGELOG.md
|
||||
|
||||
|
||||
## [0.1.16] - 2013-12-01
|
||||
### Changed
|
||||
- Maintenance release. Updated dependencies and docs.
|
||||
|
||||
|
||||
## [0.1.15] - 2013-05-13
|
||||
### Fixed
|
||||
- Fixed #55, @trebor89
|
||||
|
||||
|
||||
## [0.1.14] - 2013-05-12
|
||||
### Fixed
|
||||
- Fixed #62, @maxtaco
|
||||
|
||||
|
||||
## [0.1.13] - 2013-04-08
|
||||
### Changed
|
||||
- Added `.npmignore` to reduce package size
|
||||
|
||||
|
||||
## [0.1.12] - 2013-02-10
|
||||
### Fixed
|
||||
- Fixed conflictHandler (#46), @hpaulj
|
||||
|
||||
|
||||
## [0.1.11] - 2013-02-07
|
||||
### Added
|
||||
- Added 70+ tests (ported from python), @hpaulj
|
||||
- Added conflictHandler, @applepicke
|
||||
- Added fromfilePrefixChar, @hpaulj
|
||||
|
||||
### Fixed
|
||||
- Multiple bugfixes, @hpaulj
|
||||
|
||||
|
||||
## [0.1.10] - 2012-12-30
|
||||
### Added
|
||||
- Added [mutual exclusion](http://docs.python.org/dev/library/argparse.html#mutual-exclusion)
|
||||
support, thanks to @hpaulj
|
||||
|
||||
### Fixed
|
||||
- Fixed options check for `storeConst` & `appendConst` actions, thanks to @hpaulj
|
||||
|
||||
|
||||
## [0.1.9] - 2012-12-27
|
||||
### Fixed
|
||||
- Fixed option dest interferens with other options (issue #23), thanks to @hpaulj
|
||||
- Fixed default value behavior with `*` positionals, thanks to @hpaulj
|
||||
- Improve `getDefault()` behavior, thanks to @hpaulj
|
||||
- Improve negative argument parsing, thanks to @hpaulj
|
||||
|
||||
|
||||
## [0.1.8] - 2012-12-01
|
||||
### Fixed
|
||||
- Fixed parser parents (issue #19), thanks to @hpaulj
|
||||
- Fixed negative argument parse (issue #20), thanks to @hpaulj
|
||||
|
||||
|
||||
## [0.1.7] - 2012-10-14
|
||||
### Fixed
|
||||
- Fixed 'choices' argument parse (issue #16)
|
||||
- Fixed stderr output (issue #15)
|
||||
|
||||
|
||||
## [0.1.6] - 2012-09-09
|
||||
### Fixed
|
||||
- Fixed check for conflict of options (thanks to @tomxtobin)
|
||||
|
||||
|
||||
## [0.1.5] - 2012-09-03
|
||||
### Fixed
|
||||
- Fix parser #setDefaults method (thanks to @tomxtobin)
|
||||
|
||||
|
||||
## [0.1.4] - 2012-07-30
|
||||
### Fixed
|
||||
- Fixed pseudo-argument support (thanks to @CGamesPlay)
|
||||
- Fixed addHelp default (should be true), if not set (thanks to @benblank)
|
||||
|
||||
|
||||
## [0.1.3] - 2012-06-27
|
||||
### Fixed
|
||||
- Fixed formatter api name: Formatter -> HelpFormatter
|
||||
|
||||
|
||||
## [0.1.2] - 2012-05-29
|
||||
### Fixed
|
||||
- Removed excess whitespace in help
|
||||
- Fixed error reporting, when parcer with subcommands
|
||||
called with empty arguments
|
||||
|
||||
### Added
|
||||
- Added basic tests
|
||||
|
||||
|
||||
## [0.1.1] - 2012-05-23
|
||||
### Fixed
|
||||
- Fixed line wrapping in help formatter
|
||||
- Added better error reporting on invalid arguments
|
||||
|
||||
|
||||
## [0.1.0] - 2012-05-16
|
||||
### Added
|
||||
- First release.
|
||||
|
||||
|
||||
[2.0.1]: https://github.com/nodeca/argparse/compare/2.0.0...2.0.1
|
||||
[2.0.0]: https://github.com/nodeca/argparse/compare/1.0.10...2.0.0
|
||||
[1.0.10]: https://github.com/nodeca/argparse/compare/1.0.9...1.0.10
|
||||
[1.0.9]: https://github.com/nodeca/argparse/compare/1.0.8...1.0.9
|
||||
[1.0.8]: https://github.com/nodeca/argparse/compare/1.0.7...1.0.8
|
||||
[1.0.7]: https://github.com/nodeca/argparse/compare/1.0.6...1.0.7
|
||||
[1.0.6]: https://github.com/nodeca/argparse/compare/1.0.5...1.0.6
|
||||
[1.0.5]: https://github.com/nodeca/argparse/compare/1.0.4...1.0.5
|
||||
[1.0.4]: https://github.com/nodeca/argparse/compare/1.0.3...1.0.4
|
||||
[1.0.3]: https://github.com/nodeca/argparse/compare/1.0.2...1.0.3
|
||||
[1.0.2]: https://github.com/nodeca/argparse/compare/1.0.1...1.0.2
|
||||
[1.0.1]: https://github.com/nodeca/argparse/compare/1.0.0...1.0.1
|
||||
[1.0.0]: https://github.com/nodeca/argparse/compare/0.1.16...1.0.0
|
||||
[0.1.16]: https://github.com/nodeca/argparse/compare/0.1.15...0.1.16
|
||||
[0.1.15]: https://github.com/nodeca/argparse/compare/0.1.14...0.1.15
|
||||
[0.1.14]: https://github.com/nodeca/argparse/compare/0.1.13...0.1.14
|
||||
[0.1.13]: https://github.com/nodeca/argparse/compare/0.1.12...0.1.13
|
||||
[0.1.12]: https://github.com/nodeca/argparse/compare/0.1.11...0.1.12
|
||||
[0.1.11]: https://github.com/nodeca/argparse/compare/0.1.10...0.1.11
|
||||
[0.1.10]: https://github.com/nodeca/argparse/compare/0.1.9...0.1.10
|
||||
[0.1.9]: https://github.com/nodeca/argparse/compare/0.1.8...0.1.9
|
||||
[0.1.8]: https://github.com/nodeca/argparse/compare/0.1.7...0.1.8
|
||||
[0.1.7]: https://github.com/nodeca/argparse/compare/0.1.6...0.1.7
|
||||
[0.1.6]: https://github.com/nodeca/argparse/compare/0.1.5...0.1.6
|
||||
[0.1.5]: https://github.com/nodeca/argparse/compare/0.1.4...0.1.5
|
||||
[0.1.4]: https://github.com/nodeca/argparse/compare/0.1.3...0.1.4
|
||||
[0.1.3]: https://github.com/nodeca/argparse/compare/0.1.2...0.1.3
|
||||
[0.1.2]: https://github.com/nodeca/argparse/compare/0.1.1...0.1.2
|
||||
[0.1.1]: https://github.com/nodeca/argparse/compare/0.1.0...0.1.1
|
||||
[0.1.0]: https://github.com/nodeca/argparse/releases/tag/0.1.0
|
254
my-app/node_modules/cosmiconfig/node_modules/argparse/LICENSE
generated
vendored
Executable file
254
my-app/node_modules/cosmiconfig/node_modules/argparse/LICENSE
generated
vendored
Executable file
|
@ -0,0 +1,254 @@
|
|||
A. HISTORY OF THE SOFTWARE
|
||||
==========================
|
||||
|
||||
Python was created in the early 1990s by Guido van Rossum at Stichting
|
||||
Mathematisch Centrum (CWI, see http://www.cwi.nl) in the Netherlands
|
||||
as a successor of a language called ABC. Guido remains Python's
|
||||
principal author, although it includes many contributions from others.
|
||||
|
||||
In 1995, Guido continued his work on Python at the Corporation for
|
||||
National Research Initiatives (CNRI, see http://www.cnri.reston.va.us)
|
||||
in Reston, Virginia where he released several versions of the
|
||||
software.
|
||||
|
||||
In May 2000, Guido and the Python core development team moved to
|
||||
BeOpen.com to form the BeOpen PythonLabs team. In October of the same
|
||||
year, the PythonLabs team moved to Digital Creations, which became
|
||||
Zope Corporation. In 2001, the Python Software Foundation (PSF, see
|
||||
https://www.python.org/psf/) was formed, a non-profit organization
|
||||
created specifically to own Python-related Intellectual Property.
|
||||
Zope Corporation was a sponsoring member of the PSF.
|
||||
|
||||
All Python releases are Open Source (see http://www.opensource.org for
|
||||
the Open Source Definition). Historically, most, but not all, Python
|
||||
releases have also been GPL-compatible; the table below summarizes
|
||||
the various releases.
|
||||
|
||||
Release Derived Year Owner GPL-
|
||||
from compatible? (1)
|
||||
|
||||
0.9.0 thru 1.2 1991-1995 CWI yes
|
||||
1.3 thru 1.5.2 1.2 1995-1999 CNRI yes
|
||||
1.6 1.5.2 2000 CNRI no
|
||||
2.0 1.6 2000 BeOpen.com no
|
||||
1.6.1 1.6 2001 CNRI yes (2)
|
||||
2.1 2.0+1.6.1 2001 PSF no
|
||||
2.0.1 2.0+1.6.1 2001 PSF yes
|
||||
2.1.1 2.1+2.0.1 2001 PSF yes
|
||||
2.1.2 2.1.1 2002 PSF yes
|
||||
2.1.3 2.1.2 2002 PSF yes
|
||||
2.2 and above 2.1.1 2001-now PSF yes
|
||||
|
||||
Footnotes:
|
||||
|
||||
(1) GPL-compatible doesn't mean that we're distributing Python under
|
||||
the GPL. All Python licenses, unlike the GPL, let you distribute
|
||||
a modified version without making your changes open source. The
|
||||
GPL-compatible licenses make it possible to combine Python with
|
||||
other software that is released under the GPL; the others don't.
|
||||
|
||||
(2) According to Richard Stallman, 1.6.1 is not GPL-compatible,
|
||||
because its license has a choice of law clause. According to
|
||||
CNRI, however, Stallman's lawyer has told CNRI's lawyer that 1.6.1
|
||||
is "not incompatible" with the GPL.
|
||||
|
||||
Thanks to the many outside volunteers who have worked under Guido's
|
||||
direction to make these releases possible.
|
||||
|
||||
|
||||
B. TERMS AND CONDITIONS FOR ACCESSING OR OTHERWISE USING PYTHON
|
||||
===============================================================
|
||||
|
||||
PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
|
||||
--------------------------------------------
|
||||
|
||||
1. This LICENSE AGREEMENT is between the Python Software Foundation
|
||||
("PSF"), and the Individual or Organization ("Licensee") accessing and
|
||||
otherwise using this software ("Python") in source or binary form and
|
||||
its associated documentation.
|
||||
|
||||
2. Subject to the terms and conditions of this License Agreement, PSF hereby
|
||||
grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce,
|
||||
analyze, test, perform and/or display publicly, prepare derivative works,
|
||||
distribute, and otherwise use Python alone or in any derivative version,
|
||||
provided, however, that PSF's License Agreement and PSF's notice of copyright,
|
||||
i.e., "Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
|
||||
2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Python Software Foundation;
|
||||
All Rights Reserved" are retained in Python alone or in any derivative version
|
||||
prepared by Licensee.
|
||||
|
||||
3. In the event Licensee prepares a derivative work that is based on
|
||||
or incorporates Python or any part thereof, and wants to make
|
||||
the derivative work available to others as provided herein, then
|
||||
Licensee hereby agrees to include in any such work a brief summary of
|
||||
the changes made to Python.
|
||||
|
||||
4. PSF is making Python available to Licensee on an "AS IS"
|
||||
basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
|
||||
IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND
|
||||
DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
|
||||
FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON WILL NOT
|
||||
INFRINGE ANY THIRD PARTY RIGHTS.
|
||||
|
||||
5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON
|
||||
FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS
|
||||
A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON,
|
||||
OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
|
||||
|
||||
6. This License Agreement will automatically terminate upon a material
|
||||
breach of its terms and conditions.
|
||||
|
||||
7. Nothing in this License Agreement shall be deemed to create any
|
||||
relationship of agency, partnership, or joint venture between PSF and
|
||||
Licensee. This License Agreement does not grant permission to use PSF
|
||||
trademarks or trade name in a trademark sense to endorse or promote
|
||||
products or services of Licensee, or any third party.
|
||||
|
||||
8. By copying, installing or otherwise using Python, Licensee
|
||||
agrees to be bound by the terms and conditions of this License
|
||||
Agreement.
|
||||
|
||||
|
||||
BEOPEN.COM LICENSE AGREEMENT FOR PYTHON 2.0
|
||||
-------------------------------------------
|
||||
|
||||
BEOPEN PYTHON OPEN SOURCE LICENSE AGREEMENT VERSION 1
|
||||
|
||||
1. This LICENSE AGREEMENT is between BeOpen.com ("BeOpen"), having an
|
||||
office at 160 Saratoga Avenue, Santa Clara, CA 95051, and the
|
||||
Individual or Organization ("Licensee") accessing and otherwise using
|
||||
this software in source or binary form and its associated
|
||||
documentation ("the Software").
|
||||
|
||||
2. Subject to the terms and conditions of this BeOpen Python License
|
||||
Agreement, BeOpen hereby grants Licensee a non-exclusive,
|
||||
royalty-free, world-wide license to reproduce, analyze, test, perform
|
||||
and/or display publicly, prepare derivative works, distribute, and
|
||||
otherwise use the Software alone or in any derivative version,
|
||||
provided, however, that the BeOpen Python License is retained in the
|
||||
Software, alone or in any derivative version prepared by Licensee.
|
||||
|
||||
3. BeOpen is making the Software available to Licensee on an "AS IS"
|
||||
basis. BEOPEN MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
|
||||
IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, BEOPEN MAKES NO AND
|
||||
DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
|
||||
FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE WILL NOT
|
||||
INFRINGE ANY THIRD PARTY RIGHTS.
|
||||
|
||||
4. BEOPEN SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF THE
|
||||
SOFTWARE FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS
|
||||
AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THE SOFTWARE, OR ANY
|
||||
DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
|
||||
|
||||
5. This License Agreement will automatically terminate upon a material
|
||||
breach of its terms and conditions.
|
||||
|
||||
6. This License Agreement shall be governed by and interpreted in all
|
||||
respects by the law of the State of California, excluding conflict of
|
||||
law provisions. Nothing in this License Agreement shall be deemed to
|
||||
create any relationship of agency, partnership, or joint venture
|
||||
between BeOpen and Licensee. This License Agreement does not grant
|
||||
permission to use BeOpen trademarks or trade names in a trademark
|
||||
sense to endorse or promote products or services of Licensee, or any
|
||||
third party. As an exception, the "BeOpen Python" logos available at
|
||||
http://www.pythonlabs.com/logos.html may be used according to the
|
||||
permissions granted on that web page.
|
||||
|
||||
7. By copying, installing or otherwise using the software, Licensee
|
||||
agrees to be bound by the terms and conditions of this License
|
||||
Agreement.
|
||||
|
||||
|
||||
CNRI LICENSE AGREEMENT FOR PYTHON 1.6.1
|
||||
---------------------------------------
|
||||
|
||||
1. This LICENSE AGREEMENT is between the Corporation for National
|
||||
Research Initiatives, having an office at 1895 Preston White Drive,
|
||||
Reston, VA 20191 ("CNRI"), and the Individual or Organization
|
||||
("Licensee") accessing and otherwise using Python 1.6.1 software in
|
||||
source or binary form and its associated documentation.
|
||||
|
||||
2. Subject to the terms and conditions of this License Agreement, CNRI
|
||||
hereby grants Licensee a nonexclusive, royalty-free, world-wide
|
||||
license to reproduce, analyze, test, perform and/or display publicly,
|
||||
prepare derivative works, distribute, and otherwise use Python 1.6.1
|
||||
alone or in any derivative version, provided, however, that CNRI's
|
||||
License Agreement and CNRI's notice of copyright, i.e., "Copyright (c)
|
||||
1995-2001 Corporation for National Research Initiatives; All Rights
|
||||
Reserved" are retained in Python 1.6.1 alone or in any derivative
|
||||
version prepared by Licensee. Alternately, in lieu of CNRI's License
|
||||
Agreement, Licensee may substitute the following text (omitting the
|
||||
quotes): "Python 1.6.1 is made available subject to the terms and
|
||||
conditions in CNRI's License Agreement. This Agreement together with
|
||||
Python 1.6.1 may be located on the Internet using the following
|
||||
unique, persistent identifier (known as a handle): 1895.22/1013. This
|
||||
Agreement may also be obtained from a proxy server on the Internet
|
||||
using the following URL: http://hdl.handle.net/1895.22/1013".
|
||||
|
||||
3. In the event Licensee prepares a derivative work that is based on
|
||||
or incorporates Python 1.6.1 or any part thereof, and wants to make
|
||||
the derivative work available to others as provided herein, then
|
||||
Licensee hereby agrees to include in any such work a brief summary of
|
||||
the changes made to Python 1.6.1.
|
||||
|
||||
4. CNRI is making Python 1.6.1 available to Licensee on an "AS IS"
|
||||
basis. CNRI MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
|
||||
IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, CNRI MAKES NO AND
|
||||
DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
|
||||
FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON 1.6.1 WILL NOT
|
||||
INFRINGE ANY THIRD PARTY RIGHTS.
|
||||
|
||||
5. CNRI SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON
|
||||
1.6.1 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS
|
||||
A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 1.6.1,
|
||||
OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
|
||||
|
||||
6. This License Agreement will automatically terminate upon a material
|
||||
breach of its terms and conditions.
|
||||
|
||||
7. This License Agreement shall be governed by the federal
|
||||
intellectual property law of the United States, including without
|
||||
limitation the federal copyright law, and, to the extent such
|
||||
U.S. federal law does not apply, by the law of the Commonwealth of
|
||||
Virginia, excluding Virginia's conflict of law provisions.
|
||||
Notwithstanding the foregoing, with regard to derivative works based
|
||||
on Python 1.6.1 that incorporate non-separable material that was
|
||||
previously distributed under the GNU General Public License (GPL), the
|
||||
law of the Commonwealth of Virginia shall govern this License
|
||||
Agreement only as to issues arising under or with respect to
|
||||
Paragraphs 4, 5, and 7 of this License Agreement. Nothing in this
|
||||
License Agreement shall be deemed to create any relationship of
|
||||
agency, partnership, or joint venture between CNRI and Licensee. This
|
||||
License Agreement does not grant permission to use CNRI trademarks or
|
||||
trade name in a trademark sense to endorse or promote products or
|
||||
services of Licensee, or any third party.
|
||||
|
||||
8. By clicking on the "ACCEPT" button where indicated, or by copying,
|
||||
installing or otherwise using Python 1.6.1, Licensee agrees to be
|
||||
bound by the terms and conditions of this License Agreement.
|
||||
|
||||
ACCEPT
|
||||
|
||||
|
||||
CWI LICENSE AGREEMENT FOR PYTHON 0.9.0 THROUGH 1.2
|
||||
--------------------------------------------------
|
||||
|
||||
Copyright (c) 1991 - 1995, Stichting Mathematisch Centrum Amsterdam,
|
||||
The Netherlands. All rights reserved.
|
||||
|
||||
Permission to use, copy, modify, and distribute this software and its
|
||||
documentation for any purpose and without fee is hereby granted,
|
||||
provided that the above copyright notice appear in all copies and that
|
||||
both that copyright notice and this permission notice appear in
|
||||
supporting documentation, and that the name of Stichting Mathematisch
|
||||
Centrum or CWI not be used in advertising or publicity pertaining to
|
||||
distribution of the software without specific, written prior
|
||||
permission.
|
||||
|
||||
STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
|
||||
THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
|
||||
FOR ANY SPECIAL, 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.
|
84
my-app/node_modules/cosmiconfig/node_modules/argparse/README.md
generated
vendored
Executable file
84
my-app/node_modules/cosmiconfig/node_modules/argparse/README.md
generated
vendored
Executable file
|
@ -0,0 +1,84 @@
|
|||
argparse
|
||||
========
|
||||
|
||||
[](http://travis-ci.org/nodeca/argparse)
|
||||
[](https://www.npmjs.org/package/argparse)
|
||||
|
||||
CLI arguments parser for node.js, with [sub-commands](https://docs.python.org/3.9/library/argparse.html#sub-commands) support. Port of python's [argparse](http://docs.python.org/dev/library/argparse.html) (version [3.9.0](https://github.com/python/cpython/blob/v3.9.0rc1/Lib/argparse.py)).
|
||||
|
||||
**Difference with original.**
|
||||
|
||||
- JS has no keyword arguments support.
|
||||
- Pass options instead: `new ArgumentParser({ description: 'example', add_help: true })`.
|
||||
- JS has no python's types `int`, `float`, ...
|
||||
- Use string-typed names: `.add_argument('-b', { type: 'int', help: 'help' })`.
|
||||
- `%r` format specifier uses `require('util').inspect()`.
|
||||
|
||||
More details in [doc](./doc).
|
||||
|
||||
|
||||
Example
|
||||
-------
|
||||
|
||||
`test.js` file:
|
||||
|
||||
```javascript
|
||||
#!/usr/bin/env node
|
||||
'use strict';
|
||||
|
||||
const { ArgumentParser } = require('argparse');
|
||||
const { version } = require('./package.json');
|
||||
|
||||
const parser = new ArgumentParser({
|
||||
description: 'Argparse example'
|
||||
});
|
||||
|
||||
parser.add_argument('-v', '--version', { action: 'version', version });
|
||||
parser.add_argument('-f', '--foo', { help: 'foo bar' });
|
||||
parser.add_argument('-b', '--bar', { help: 'bar foo' });
|
||||
parser.add_argument('--baz', { help: 'baz bar' });
|
||||
|
||||
console.dir(parser.parse_args());
|
||||
```
|
||||
|
||||
Display help:
|
||||
|
||||
```
|
||||
$ ./test.js -h
|
||||
usage: test.js [-h] [-v] [-f FOO] [-b BAR] [--baz BAZ]
|
||||
|
||||
Argparse example
|
||||
|
||||
optional arguments:
|
||||
-h, --help show this help message and exit
|
||||
-v, --version show program's version number and exit
|
||||
-f FOO, --foo FOO foo bar
|
||||
-b BAR, --bar BAR bar foo
|
||||
--baz BAZ baz bar
|
||||
```
|
||||
|
||||
Parse arguments:
|
||||
|
||||
```
|
||||
$ ./test.js -f=3 --bar=4 --baz 5
|
||||
{ foo: '3', bar: '4', baz: '5' }
|
||||
```
|
||||
|
||||
|
||||
API docs
|
||||
--------
|
||||
|
||||
Since this is a port with minimal divergence, there's no separate documentation.
|
||||
Use original one instead, with notes about difference.
|
||||
|
||||
1. [Original doc](https://docs.python.org/3.9/library/argparse.html).
|
||||
2. [Original tutorial](https://docs.python.org/3.9/howto/argparse.html).
|
||||
3. [Difference with python](./doc).
|
||||
|
||||
|
||||
argparse for enterprise
|
||||
-----------------------
|
||||
|
||||
Available as part of the Tidelift Subscription
|
||||
|
||||
The maintainers of argparse and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-argparse?utm_source=npm-argparse&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)
|
3707
my-app/node_modules/cosmiconfig/node_modules/argparse/argparse.js
generated
vendored
Executable file
3707
my-app/node_modules/cosmiconfig/node_modules/argparse/argparse.js
generated
vendored
Executable file
File diff suppressed because it is too large
Load diff
67
my-app/node_modules/cosmiconfig/node_modules/argparse/lib/sub.js
generated
vendored
Executable file
67
my-app/node_modules/cosmiconfig/node_modules/argparse/lib/sub.js
generated
vendored
Executable file
|
@ -0,0 +1,67 @@
|
|||
// Limited implementation of python % string operator, supports only %s and %r for now
|
||||
// (other formats are not used here, but may appear in custom templates)
|
||||
|
||||
'use strict'
|
||||
|
||||
const { inspect } = require('util')
|
||||
|
||||
|
||||
module.exports = function sub(pattern, ...values) {
|
||||
let regex = /%(?:(%)|(-)?(\*)?(?:\((\w+)\))?([A-Za-z]))/g
|
||||
|
||||
let result = pattern.replace(regex, function (_, is_literal, is_left_align, is_padded, name, format) {
|
||||
if (is_literal) return '%'
|
||||
|
||||
let padded_count = 0
|
||||
if (is_padded) {
|
||||
if (values.length === 0) throw new TypeError('not enough arguments for format string')
|
||||
padded_count = values.shift()
|
||||
if (!Number.isInteger(padded_count)) throw new TypeError('* wants int')
|
||||
}
|
||||
|
||||
let str
|
||||
if (name !== undefined) {
|
||||
let dict = values[0]
|
||||
if (typeof dict !== 'object' || dict === null) throw new TypeError('format requires a mapping')
|
||||
if (!(name in dict)) throw new TypeError(`no such key: '${name}'`)
|
||||
str = dict[name]
|
||||
} else {
|
||||
if (values.length === 0) throw new TypeError('not enough arguments for format string')
|
||||
str = values.shift()
|
||||
}
|
||||
|
||||
switch (format) {
|
||||
case 's':
|
||||
str = String(str)
|
||||
break
|
||||
case 'r':
|
||||
str = inspect(str)
|
||||
break
|
||||
case 'd':
|
||||
case 'i':
|
||||
if (typeof str !== 'number') {
|
||||
throw new TypeError(`%${format} format: a number is required, not ${typeof str}`)
|
||||
}
|
||||
str = String(str.toFixed(0))
|
||||
break
|
||||
default:
|
||||
throw new TypeError(`unsupported format character '${format}'`)
|
||||
}
|
||||
|
||||
if (padded_count > 0) {
|
||||
return is_left_align ? str.padEnd(padded_count) : str.padStart(padded_count)
|
||||
} else {
|
||||
return str
|
||||
}
|
||||
})
|
||||
|
||||
if (values.length) {
|
||||
if (values.length === 1 && typeof values[0] === 'object' && values[0] !== null) {
|
||||
// mapping
|
||||
} else {
|
||||
throw new TypeError('not all arguments converted during string formatting')
|
||||
}
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
440
my-app/node_modules/cosmiconfig/node_modules/argparse/lib/textwrap.js
generated
vendored
Executable file
440
my-app/node_modules/cosmiconfig/node_modules/argparse/lib/textwrap.js
generated
vendored
Executable file
|
@ -0,0 +1,440 @@
|
|||
// Partial port of python's argparse module, version 3.9.0 (only wrap and fill functions):
|
||||
// https://github.com/python/cpython/blob/v3.9.0b4/Lib/textwrap.py
|
||||
|
||||
'use strict'
|
||||
|
||||
/*
|
||||
* Text wrapping and filling.
|
||||
*/
|
||||
|
||||
// Copyright (C) 1999-2001 Gregory P. Ward.
|
||||
// Copyright (C) 2002, 2003 Python Software Foundation.
|
||||
// Copyright (C) 2020 argparse.js authors
|
||||
// Originally written by Greg Ward <gward@python.net>
|
||||
|
||||
// Hardcode the recognized whitespace characters to the US-ASCII
|
||||
// whitespace characters. The main reason for doing this is that
|
||||
// some Unicode spaces (like \u00a0) are non-breaking whitespaces.
|
||||
//
|
||||
// This less funky little regex just split on recognized spaces. E.g.
|
||||
// "Hello there -- you goof-ball, use the -b option!"
|
||||
// splits into
|
||||
// Hello/ /there/ /--/ /you/ /goof-ball,/ /use/ /the/ /-b/ /option!/
|
||||
const wordsep_simple_re = /([\t\n\x0b\x0c\r ]+)/
|
||||
|
||||
class TextWrapper {
|
||||
/*
|
||||
* Object for wrapping/filling text. The public interface consists of
|
||||
* the wrap() and fill() methods; the other methods are just there for
|
||||
* subclasses to override in order to tweak the default behaviour.
|
||||
* If you want to completely replace the main wrapping algorithm,
|
||||
* you'll probably have to override _wrap_chunks().
|
||||
*
|
||||
* Several instance attributes control various aspects of wrapping:
|
||||
* width (default: 70)
|
||||
* the maximum width of wrapped lines (unless break_long_words
|
||||
* is false)
|
||||
* initial_indent (default: "")
|
||||
* string that will be prepended to the first line of wrapped
|
||||
* output. Counts towards the line's width.
|
||||
* subsequent_indent (default: "")
|
||||
* string that will be prepended to all lines save the first
|
||||
* of wrapped output; also counts towards each line's width.
|
||||
* expand_tabs (default: true)
|
||||
* Expand tabs in input text to spaces before further processing.
|
||||
* Each tab will become 0 .. 'tabsize' spaces, depending on its position
|
||||
* in its line. If false, each tab is treated as a single character.
|
||||
* tabsize (default: 8)
|
||||
* Expand tabs in input text to 0 .. 'tabsize' spaces, unless
|
||||
* 'expand_tabs' is false.
|
||||
* replace_whitespace (default: true)
|
||||
* Replace all whitespace characters in the input text by spaces
|
||||
* after tab expansion. Note that if expand_tabs is false and
|
||||
* replace_whitespace is true, every tab will be converted to a
|
||||
* single space!
|
||||
* fix_sentence_endings (default: false)
|
||||
* Ensure that sentence-ending punctuation is always followed
|
||||
* by two spaces. Off by default because the algorithm is
|
||||
* (unavoidably) imperfect.
|
||||
* break_long_words (default: true)
|
||||
* Break words longer than 'width'. If false, those words will not
|
||||
* be broken, and some lines might be longer than 'width'.
|
||||
* break_on_hyphens (default: true)
|
||||
* Allow breaking hyphenated words. If true, wrapping will occur
|
||||
* preferably on whitespaces and right after hyphens part of
|
||||
* compound words.
|
||||
* drop_whitespace (default: true)
|
||||
* Drop leading and trailing whitespace from lines.
|
||||
* max_lines (default: None)
|
||||
* Truncate wrapped lines.
|
||||
* placeholder (default: ' [...]')
|
||||
* Append to the last line of truncated text.
|
||||
*/
|
||||
|
||||
constructor(options = {}) {
|
||||
let {
|
||||
width = 70,
|
||||
initial_indent = '',
|
||||
subsequent_indent = '',
|
||||
expand_tabs = true,
|
||||
replace_whitespace = true,
|
||||
fix_sentence_endings = false,
|
||||
break_long_words = true,
|
||||
drop_whitespace = true,
|
||||
break_on_hyphens = true,
|
||||
tabsize = 8,
|
||||
max_lines = undefined,
|
||||
placeholder=' [...]'
|
||||
} = options
|
||||
|
||||
this.width = width
|
||||
this.initial_indent = initial_indent
|
||||
this.subsequent_indent = subsequent_indent
|
||||
this.expand_tabs = expand_tabs
|
||||
this.replace_whitespace = replace_whitespace
|
||||
this.fix_sentence_endings = fix_sentence_endings
|
||||
this.break_long_words = break_long_words
|
||||
this.drop_whitespace = drop_whitespace
|
||||
this.break_on_hyphens = break_on_hyphens
|
||||
this.tabsize = tabsize
|
||||
this.max_lines = max_lines
|
||||
this.placeholder = placeholder
|
||||
}
|
||||
|
||||
|
||||
// -- Private methods -----------------------------------------------
|
||||
// (possibly useful for subclasses to override)
|
||||
|
||||
_munge_whitespace(text) {
|
||||
/*
|
||||
* _munge_whitespace(text : string) -> string
|
||||
*
|
||||
* Munge whitespace in text: expand tabs and convert all other
|
||||
* whitespace characters to spaces. Eg. " foo\\tbar\\n\\nbaz"
|
||||
* becomes " foo bar baz".
|
||||
*/
|
||||
if (this.expand_tabs) {
|
||||
text = text.replace(/\t/g, ' '.repeat(this.tabsize)) // not strictly correct in js
|
||||
}
|
||||
if (this.replace_whitespace) {
|
||||
text = text.replace(/[\t\n\x0b\x0c\r]/g, ' ')
|
||||
}
|
||||
return text
|
||||
}
|
||||
|
||||
_split(text) {
|
||||
/*
|
||||
* _split(text : string) -> [string]
|
||||
*
|
||||
* Split the text to wrap into indivisible chunks. Chunks are
|
||||
* not quite the same as words; see _wrap_chunks() for full
|
||||
* details. As an example, the text
|
||||
* Look, goof-ball -- use the -b option!
|
||||
* breaks into the following chunks:
|
||||
* 'Look,', ' ', 'goof-', 'ball', ' ', '--', ' ',
|
||||
* 'use', ' ', 'the', ' ', '-b', ' ', 'option!'
|
||||
* if break_on_hyphens is True, or in:
|
||||
* 'Look,', ' ', 'goof-ball', ' ', '--', ' ',
|
||||
* 'use', ' ', 'the', ' ', '-b', ' ', option!'
|
||||
* otherwise.
|
||||
*/
|
||||
let chunks = text.split(wordsep_simple_re)
|
||||
chunks = chunks.filter(Boolean)
|
||||
return chunks
|
||||
}
|
||||
|
||||
_handle_long_word(reversed_chunks, cur_line, cur_len, width) {
|
||||
/*
|
||||
* _handle_long_word(chunks : [string],
|
||||
* cur_line : [string],
|
||||
* cur_len : int, width : int)
|
||||
*
|
||||
* Handle a chunk of text (most likely a word, not whitespace) that
|
||||
* is too long to fit in any line.
|
||||
*/
|
||||
// Figure out when indent is larger than the specified width, and make
|
||||
// sure at least one character is stripped off on every pass
|
||||
let space_left
|
||||
if (width < 1) {
|
||||
space_left = 1
|
||||
} else {
|
||||
space_left = width - cur_len
|
||||
}
|
||||
|
||||
// If we're allowed to break long words, then do so: put as much
|
||||
// of the next chunk onto the current line as will fit.
|
||||
if (this.break_long_words) {
|
||||
cur_line.push(reversed_chunks[reversed_chunks.length - 1].slice(0, space_left))
|
||||
reversed_chunks[reversed_chunks.length - 1] = reversed_chunks[reversed_chunks.length - 1].slice(space_left)
|
||||
|
||||
// Otherwise, we have to preserve the long word intact. Only add
|
||||
// it to the current line if there's nothing already there --
|
||||
// that minimizes how much we violate the width constraint.
|
||||
} else if (!cur_line) {
|
||||
cur_line.push(...reversed_chunks.pop())
|
||||
}
|
||||
|
||||
// If we're not allowed to break long words, and there's already
|
||||
// text on the current line, do nothing. Next time through the
|
||||
// main loop of _wrap_chunks(), we'll wind up here again, but
|
||||
// cur_len will be zero, so the next line will be entirely
|
||||
// devoted to the long word that we can't handle right now.
|
||||
}
|
||||
|
||||
_wrap_chunks(chunks) {
|
||||
/*
|
||||
* _wrap_chunks(chunks : [string]) -> [string]
|
||||
*
|
||||
* Wrap a sequence of text chunks and return a list of lines of
|
||||
* length 'self.width' or less. (If 'break_long_words' is false,
|
||||
* some lines may be longer than this.) Chunks correspond roughly
|
||||
* to words and the whitespace between them: each chunk is
|
||||
* indivisible (modulo 'break_long_words'), but a line break can
|
||||
* come between any two chunks. Chunks should not have internal
|
||||
* whitespace; ie. a chunk is either all whitespace or a "word".
|
||||
* Whitespace chunks will be removed from the beginning and end of
|
||||
* lines, but apart from that whitespace is preserved.
|
||||
*/
|
||||
let lines = []
|
||||
let indent
|
||||
if (this.width <= 0) {
|
||||
throw Error(`invalid width ${this.width} (must be > 0)`)
|
||||
}
|
||||
if (this.max_lines !== undefined) {
|
||||
if (this.max_lines > 1) {
|
||||
indent = this.subsequent_indent
|
||||
} else {
|
||||
indent = this.initial_indent
|
||||
}
|
||||
if (indent.length + this.placeholder.trimStart().length > this.width) {
|
||||
throw Error('placeholder too large for max width')
|
||||
}
|
||||
}
|
||||
|
||||
// Arrange in reverse order so items can be efficiently popped
|
||||
// from a stack of chucks.
|
||||
chunks = chunks.reverse()
|
||||
|
||||
while (chunks.length > 0) {
|
||||
|
||||
// Start the list of chunks that will make up the current line.
|
||||
// cur_len is just the length of all the chunks in cur_line.
|
||||
let cur_line = []
|
||||
let cur_len = 0
|
||||
|
||||
// Figure out which static string will prefix this line.
|
||||
let indent
|
||||
if (lines) {
|
||||
indent = this.subsequent_indent
|
||||
} else {
|
||||
indent = this.initial_indent
|
||||
}
|
||||
|
||||
// Maximum width for this line.
|
||||
let width = this.width - indent.length
|
||||
|
||||
// First chunk on line is whitespace -- drop it, unless this
|
||||
// is the very beginning of the text (ie. no lines started yet).
|
||||
if (this.drop_whitespace && chunks[chunks.length - 1].trim() === '' && lines.length > 0) {
|
||||
chunks.pop()
|
||||
}
|
||||
|
||||
while (chunks.length > 0) {
|
||||
let l = chunks[chunks.length - 1].length
|
||||
|
||||
// Can at least squeeze this chunk onto the current line.
|
||||
if (cur_len + l <= width) {
|
||||
cur_line.push(chunks.pop())
|
||||
cur_len += l
|
||||
|
||||
// Nope, this line is full.
|
||||
} else {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
// The current line is full, and the next chunk is too big to
|
||||
// fit on *any* line (not just this one).
|
||||
if (chunks.length && chunks[chunks.length - 1].length > width) {
|
||||
this._handle_long_word(chunks, cur_line, cur_len, width)
|
||||
cur_len = cur_line.map(l => l.length).reduce((a, b) => a + b, 0)
|
||||
}
|
||||
|
||||
// If the last chunk on this line is all whitespace, drop it.
|
||||
if (this.drop_whitespace && cur_line.length > 0 && cur_line[cur_line.length - 1].trim() === '') {
|
||||
cur_len -= cur_line[cur_line.length - 1].length
|
||||
cur_line.pop()
|
||||
}
|
||||
|
||||
if (cur_line) {
|
||||
if (this.max_lines === undefined ||
|
||||
lines.length + 1 < this.max_lines ||
|
||||
(chunks.length === 0 ||
|
||||
this.drop_whitespace &&
|
||||
chunks.length === 1 &&
|
||||
!chunks[0].trim()) && cur_len <= width) {
|
||||
// Convert current line back to a string and store it in
|
||||
// list of all lines (return value).
|
||||
lines.push(indent + cur_line.join(''))
|
||||
} else {
|
||||
let had_break = false
|
||||
while (cur_line) {
|
||||
if (cur_line[cur_line.length - 1].trim() &&
|
||||
cur_len + this.placeholder.length <= width) {
|
||||
cur_line.push(this.placeholder)
|
||||
lines.push(indent + cur_line.join(''))
|
||||
had_break = true
|
||||
break
|
||||
}
|
||||
cur_len -= cur_line[-1].length
|
||||
cur_line.pop()
|
||||
}
|
||||
if (!had_break) {
|
||||
if (lines) {
|
||||
let prev_line = lines[lines.length - 1].trimEnd()
|
||||
if (prev_line.length + this.placeholder.length <=
|
||||
this.width) {
|
||||
lines[lines.length - 1] = prev_line + this.placeholder
|
||||
break
|
||||
}
|
||||
}
|
||||
lines.push(indent + this.placeholder.lstrip())
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return lines
|
||||
}
|
||||
|
||||
_split_chunks(text) {
|
||||
text = this._munge_whitespace(text)
|
||||
return this._split(text)
|
||||
}
|
||||
|
||||
// -- Public interface ----------------------------------------------
|
||||
|
||||
wrap(text) {
|
||||
/*
|
||||
* wrap(text : string) -> [string]
|
||||
*
|
||||
* Reformat the single paragraph in 'text' so it fits in lines of
|
||||
* no more than 'self.width' columns, and return a list of wrapped
|
||||
* lines. Tabs in 'text' are expanded with string.expandtabs(),
|
||||
* and all other whitespace characters (including newline) are
|
||||
* converted to space.
|
||||
*/
|
||||
let chunks = this._split_chunks(text)
|
||||
// not implemented in js
|
||||
//if (this.fix_sentence_endings) {
|
||||
// this._fix_sentence_endings(chunks)
|
||||
//}
|
||||
return this._wrap_chunks(chunks)
|
||||
}
|
||||
|
||||
fill(text) {
|
||||
/*
|
||||
* fill(text : string) -> string
|
||||
*
|
||||
* Reformat the single paragraph in 'text' to fit in lines of no
|
||||
* more than 'self.width' columns, and return a new string
|
||||
* containing the entire wrapped paragraph.
|
||||
*/
|
||||
return this.wrap(text).join('\n')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// -- Convenience interface ---------------------------------------------
|
||||
|
||||
function wrap(text, options = {}) {
|
||||
/*
|
||||
* Wrap a single paragraph of text, returning a list of wrapped lines.
|
||||
*
|
||||
* Reformat the single paragraph in 'text' so it fits in lines of no
|
||||
* more than 'width' columns, and return a list of wrapped lines. By
|
||||
* default, tabs in 'text' are expanded with string.expandtabs(), and
|
||||
* all other whitespace characters (including newline) are converted to
|
||||
* space. See TextWrapper class for available keyword args to customize
|
||||
* wrapping behaviour.
|
||||
*/
|
||||
let { width = 70, ...kwargs } = options
|
||||
let w = new TextWrapper(Object.assign({ width }, kwargs))
|
||||
return w.wrap(text)
|
||||
}
|
||||
|
||||
function fill(text, options = {}) {
|
||||
/*
|
||||
* Fill a single paragraph of text, returning a new string.
|
||||
*
|
||||
* Reformat the single paragraph in 'text' to fit in lines of no more
|
||||
* than 'width' columns, and return a new string containing the entire
|
||||
* wrapped paragraph. As with wrap(), tabs are expanded and other
|
||||
* whitespace characters converted to space. See TextWrapper class for
|
||||
* available keyword args to customize wrapping behaviour.
|
||||
*/
|
||||
let { width = 70, ...kwargs } = options
|
||||
let w = new TextWrapper(Object.assign({ width }, kwargs))
|
||||
return w.fill(text)
|
||||
}
|
||||
|
||||
// -- Loosely related functionality -------------------------------------
|
||||
|
||||
let _whitespace_only_re = /^[ \t]+$/mg
|
||||
let _leading_whitespace_re = /(^[ \t]*)(?:[^ \t\n])/mg
|
||||
|
||||
function dedent(text) {
|
||||
/*
|
||||
* Remove any common leading whitespace from every line in `text`.
|
||||
*
|
||||
* This can be used to make triple-quoted strings line up with the left
|
||||
* edge of the display, while still presenting them in the source code
|
||||
* in indented form.
|
||||
*
|
||||
* Note that tabs and spaces are both treated as whitespace, but they
|
||||
* are not equal: the lines " hello" and "\\thello" are
|
||||
* considered to have no common leading whitespace.
|
||||
*
|
||||
* Entirely blank lines are normalized to a newline character.
|
||||
*/
|
||||
// Look for the longest leading string of spaces and tabs common to
|
||||
// all lines.
|
||||
let margin = undefined
|
||||
text = text.replace(_whitespace_only_re, '')
|
||||
let indents = text.match(_leading_whitespace_re) || []
|
||||
for (let indent of indents) {
|
||||
indent = indent.slice(0, -1)
|
||||
|
||||
if (margin === undefined) {
|
||||
margin = indent
|
||||
|
||||
// Current line more deeply indented than previous winner:
|
||||
// no change (previous winner is still on top).
|
||||
} else if (indent.startsWith(margin)) {
|
||||
// pass
|
||||
|
||||
// Current line consistent with and no deeper than previous winner:
|
||||
// it's the new winner.
|
||||
} else if (margin.startsWith(indent)) {
|
||||
margin = indent
|
||||
|
||||
// Find the largest common whitespace between current line and previous
|
||||
// winner.
|
||||
} else {
|
||||
for (let i = 0; i < margin.length && i < indent.length; i++) {
|
||||
if (margin[i] !== indent[i]) {
|
||||
margin = margin.slice(0, i)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (margin) {
|
||||
text = text.replace(new RegExp('^' + margin, 'mg'), '')
|
||||
}
|
||||
return text
|
||||
}
|
||||
|
||||
module.exports = { wrap, fill, dedent }
|
31
my-app/node_modules/cosmiconfig/node_modules/argparse/package.json
generated
vendored
Executable file
31
my-app/node_modules/cosmiconfig/node_modules/argparse/package.json
generated
vendored
Executable file
|
@ -0,0 +1,31 @@
|
|||
{
|
||||
"name": "argparse",
|
||||
"description": "CLI arguments parser. Native port of python's argparse.",
|
||||
"version": "2.0.1",
|
||||
"keywords": [
|
||||
"cli",
|
||||
"parser",
|
||||
"argparse",
|
||||
"option",
|
||||
"args"
|
||||
],
|
||||
"main": "argparse.js",
|
||||
"files": [
|
||||
"argparse.js",
|
||||
"lib/"
|
||||
],
|
||||
"license": "Python-2.0",
|
||||
"repository": "nodeca/argparse",
|
||||
"scripts": {
|
||||
"lint": "eslint .",
|
||||
"test": "npm run lint && nyc mocha",
|
||||
"coverage": "npm run test && nyc report --reporter html"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/eslint-parser": "^7.11.0",
|
||||
"@babel/plugin-syntax-class-properties": "^7.10.4",
|
||||
"eslint": "^7.5.0",
|
||||
"mocha": "^8.0.1",
|
||||
"nyc": "^15.1.0"
|
||||
}
|
||||
}
|
616
my-app/node_modules/cosmiconfig/node_modules/js-yaml/CHANGELOG.md
generated
vendored
Executable file
616
my-app/node_modules/cosmiconfig/node_modules/js-yaml/CHANGELOG.md
generated
vendored
Executable file
|
@ -0,0 +1,616 @@
|
|||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
|
||||
## [4.1.0] - 2021-04-15
|
||||
### Added
|
||||
- Types are now exported as `yaml.types.XXX`.
|
||||
- Every type now has `options` property with original arguments kept as they were
|
||||
(see `yaml.types.int.options` as an example).
|
||||
|
||||
### Changed
|
||||
- `Schema.extend()` now keeps old type order in case of conflicts
|
||||
(e.g. Schema.extend([ a, b, c ]).extend([ b, a, d ]) is now ordered as `abcd` instead of `cbad`).
|
||||
|
||||
|
||||
## [4.0.0] - 2021-01-03
|
||||
### Changed
|
||||
- Check [migration guide](migrate_v3_to_v4.md) to see details for all breaking changes.
|
||||
- Breaking: "unsafe" tags `!!js/function`, `!!js/regexp`, `!!js/undefined` are
|
||||
moved to [js-yaml-js-types](https://github.com/nodeca/js-yaml-js-types) package.
|
||||
- Breaking: removed `safe*` functions. Use `load`, `loadAll`, `dump`
|
||||
instead which are all now safe by default.
|
||||
- `yaml.DEFAULT_SAFE_SCHEMA` and `yaml.DEFAULT_FULL_SCHEMA` are removed, use
|
||||
`yaml.DEFAULT_SCHEMA` instead.
|
||||
- `yaml.Schema.create(schema, tags)` is removed, use `schema.extend(tags)` instead.
|
||||
- `!!binary` now always mapped to `Uint8Array` on load.
|
||||
- Reduced nesting of `/lib` folder.
|
||||
- Parse numbers according to YAML 1.2 instead of YAML 1.1 (`01234` is now decimal,
|
||||
`0o1234` is octal, `1:23` is parsed as string instead of base60).
|
||||
- `dump()` no longer quotes `:`, `[`, `]`, `(`, `)` except when necessary, #470, #557.
|
||||
- Line and column in exceptions are now formatted as `(X:Y)` instead of
|
||||
`at line X, column Y` (also present in compact format), #332.
|
||||
- Code snippet created in exceptions now contains multiple lines with line numbers.
|
||||
- `dump()` now serializes `undefined` as `null` in collections and removes keys with
|
||||
`undefined` in mappings, #571.
|
||||
- `dump()` with `skipInvalid=true` now serializes invalid items in collections as null.
|
||||
- Custom tags starting with `!` are now dumped as `!tag` instead of `!<!tag>`, #576.
|
||||
- Custom tags starting with `tag:yaml.org,2002:` are now shorthanded using `!!`, #258.
|
||||
|
||||
### Added
|
||||
- Added `.mjs` (es modules) support.
|
||||
- Added `quotingType` and `forceQuotes` options for dumper to configure
|
||||
string literal style, #290, #529.
|
||||
- Added `styles: { '!!null': 'empty' }` option for dumper
|
||||
(serializes `{ foo: null }` as "`foo: `"), #570.
|
||||
- Added `replacer` option (similar to option in JSON.stringify), #339.
|
||||
- Custom `Tag` can now handle all tags or multiple tags with the same prefix, #385.
|
||||
|
||||
### Fixed
|
||||
- Astral characters are no longer encoded by `dump()`, #587.
|
||||
- "duplicate mapping key" exception now points at the correct column, #452.
|
||||
- Extra commas in flow collections (e.g. `[foo,,bar]`) now throw an exception
|
||||
instead of producing null, #321.
|
||||
- `__proto__` key no longer overrides object prototype, #164.
|
||||
- Removed `bower.json`.
|
||||
- Tags are now url-decoded in `load()` and url-encoded in `dump()`
|
||||
(previously usage of custom non-ascii tags may have led to invalid YAML that can't be parsed).
|
||||
- Anchors now work correctly with empty nodes, #301.
|
||||
- Fix incorrect parsing of invalid block mapping syntax, #418.
|
||||
- Throw an error if block sequence/mapping indent contains a tab, #80.
|
||||
|
||||
|
||||
## [3.14.1] - 2020-12-07
|
||||
### Security
|
||||
- Fix possible code execution in (already unsafe) `.load()` (in &anchor).
|
||||
|
||||
|
||||
## [3.14.0] - 2020-05-22
|
||||
### Changed
|
||||
- Support `safe/loadAll(input, options)` variant of call.
|
||||
- CI: drop outdated nodejs versions.
|
||||
- Dev deps bump.
|
||||
|
||||
### Fixed
|
||||
- Quote `=` in plain scalars #519.
|
||||
- Check the node type for `!<?>` tag in case user manually specifies it.
|
||||
- Verify that there are no null-bytes in input.
|
||||
- Fix wrong quote position when writing condensed flow, #526.
|
||||
|
||||
|
||||
## [3.13.1] - 2019-04-05
|
||||
### Security
|
||||
- Fix possible code execution in (already unsafe) `.load()`, #480.
|
||||
|
||||
|
||||
## [3.13.0] - 2019-03-20
|
||||
### Security
|
||||
- Security fix: `safeLoad()` can hang when arrays with nested refs
|
||||
used as key. Now throws exception for nested arrays. #475.
|
||||
|
||||
|
||||
## [3.12.2] - 2019-02-26
|
||||
### Fixed
|
||||
- Fix `noArrayIndent` option for root level, #468.
|
||||
|
||||
|
||||
## [3.12.1] - 2019-01-05
|
||||
### Added
|
||||
- Added `noArrayIndent` option, #432.
|
||||
|
||||
|
||||
## [3.12.0] - 2018-06-02
|
||||
### Changed
|
||||
- Support arrow functions without a block statement, #421.
|
||||
|
||||
|
||||
## [3.11.0] - 2018-03-05
|
||||
### Added
|
||||
- Add arrow functions suport for `!!js/function`.
|
||||
|
||||
### Fixed
|
||||
- Fix dump in bin/octal/hex formats for negative integers, #399.
|
||||
|
||||
|
||||
## [3.10.0] - 2017-09-10
|
||||
### Fixed
|
||||
- Fix `condenseFlow` output (quote keys for sure, instead of spaces), #371, #370.
|
||||
- Dump astrals as codepoints instead of surrogate pair, #368.
|
||||
|
||||
|
||||
## [3.9.1] - 2017-07-08
|
||||
### Fixed
|
||||
- Ensure stack is present for custom errors in node 7.+, #351.
|
||||
|
||||
|
||||
## [3.9.0] - 2017-07-08
|
||||
### Added
|
||||
- Add `condenseFlow` option (to create pretty URL query params), #346.
|
||||
|
||||
### Fixed
|
||||
- Support array return from safeLoadAll/loadAll, #350.
|
||||
|
||||
|
||||
## [3.8.4] - 2017-05-08
|
||||
### Fixed
|
||||
- Dumper: prevent space after dash for arrays that wrap, #343.
|
||||
|
||||
|
||||
## [3.8.3] - 2017-04-05
|
||||
### Fixed
|
||||
- Should not allow numbers to begin and end with underscore, #335.
|
||||
|
||||
|
||||
## [3.8.2] - 2017-03-02
|
||||
### Fixed
|
||||
- Fix `!!float 123` (integers) parse, #333.
|
||||
- Don't allow leading zeros in floats (except 0, 0.xxx).
|
||||
- Allow positive exponent without sign in floats.
|
||||
|
||||
|
||||
## [3.8.1] - 2017-02-07
|
||||
### Changed
|
||||
- Maintenance: update browserified build.
|
||||
|
||||
|
||||
## [3.8.0] - 2017-02-07
|
||||
### Fixed
|
||||
- Fix reported position for `duplicated mapping key` errors.
|
||||
Now points to block start instead of block end.
|
||||
(#243, thanks to @shockey).
|
||||
|
||||
|
||||
## [3.7.0] - 2016-11-12
|
||||
### Added
|
||||
- Support polymorphism for tags (#300, thanks to @monken).
|
||||
|
||||
### Fixed
|
||||
- Fix parsing of quotes followed by newlines (#304, thanks to @dplepage).
|
||||
|
||||
|
||||
## [3.6.1] - 2016-05-11
|
||||
### Fixed
|
||||
- Fix output cut on a pipe, #286.
|
||||
|
||||
|
||||
## [3.6.0] - 2016-04-16
|
||||
### Fixed
|
||||
- Dumper rewrite, fix multiple bugs with trailing `\n`.
|
||||
Big thanks to @aepsilon!
|
||||
- Loader: fix leading/trailing newlines in block scalars, @aepsilon.
|
||||
|
||||
|
||||
## [3.5.5] - 2016-03-17
|
||||
### Fixed
|
||||
- Date parse fix: don't allow dates with on digit in month and day, #268.
|
||||
|
||||
|
||||
## [3.5.4] - 2016-03-09
|
||||
### Added
|
||||
- `noCompatMode` for dumper, to disable quoting YAML 1.1 values.
|
||||
|
||||
|
||||
## [3.5.3] - 2016-02-11
|
||||
### Changed
|
||||
- Maintenance release.
|
||||
|
||||
|
||||
## [3.5.2] - 2016-01-11
|
||||
### Changed
|
||||
- Maintenance: missed comma in bower config.
|
||||
|
||||
|
||||
## [3.5.1] - 2016-01-11
|
||||
### Changed
|
||||
- Removed `inherit` dependency, #239.
|
||||
- Better browserify workaround for esprima load.
|
||||
- Demo rewrite.
|
||||
|
||||
|
||||
## [3.5.0] - 2016-01-10
|
||||
### Fixed
|
||||
- Dumper. Fold strings only, #217.
|
||||
- Dumper. `norefs` option, to clone linked objects, #229.
|
||||
- Loader. Throw a warning for duplicate keys, #166.
|
||||
- Improved browserify support (mark `esprima` & `Buffer` excluded).
|
||||
|
||||
|
||||
## [3.4.6] - 2015-11-26
|
||||
### Changed
|
||||
- Use standalone `inherit` to keep browserified files clear.
|
||||
|
||||
|
||||
## [3.4.5] - 2015-11-23
|
||||
### Added
|
||||
- Added `lineWidth` option to dumper.
|
||||
|
||||
|
||||
## [3.4.4] - 2015-11-21
|
||||
### Fixed
|
||||
- Fixed floats dump (missed dot for scientific format), #220.
|
||||
- Allow non-printable characters inside quoted scalars, #192.
|
||||
|
||||
|
||||
## [3.4.3] - 2015-10-10
|
||||
### Changed
|
||||
- Maintenance release - deps bump (esprima, argparse).
|
||||
|
||||
|
||||
## [3.4.2] - 2015-09-09
|
||||
### Fixed
|
||||
- Fixed serialization of duplicated entries in sequences, #205.
|
||||
Thanks to @vogelsgesang.
|
||||
|
||||
|
||||
## [3.4.1] - 2015-09-05
|
||||
### Fixed
|
||||
- Fixed stacktrace handling in generated errors, for browsers (FF/IE).
|
||||
|
||||
|
||||
## [3.4.0] - 2015-08-23
|
||||
### Changed
|
||||
- Don't throw on warnings anymore. Use `onWarning` option to catch.
|
||||
- Throw error on unknown tags (was warning before).
|
||||
- Reworked internals of error class.
|
||||
|
||||
### Fixed
|
||||
- Fixed multiline keys dump, #197. Thanks to @tcr.
|
||||
- Fixed heading line breaks in some scalars (regression).
|
||||
|
||||
|
||||
## [3.3.1] - 2015-05-13
|
||||
### Added
|
||||
- Added `.sortKeys` dumper option, thanks to @rjmunro.
|
||||
|
||||
### Fixed
|
||||
- Fixed astral characters support, #191.
|
||||
|
||||
|
||||
## [3.3.0] - 2015-04-26
|
||||
### Changed
|
||||
- Significantly improved long strings formatting in dumper, thanks to @isaacs.
|
||||
- Strip BOM if exists.
|
||||
|
||||
|
||||
## [3.2.7] - 2015-02-19
|
||||
### Changed
|
||||
- Maintenance release.
|
||||
- Updated dependencies.
|
||||
- HISTORY.md -> CHANGELOG.md
|
||||
|
||||
|
||||
## [3.2.6] - 2015-02-07
|
||||
### Fixed
|
||||
- Fixed encoding of UTF-16 surrogate pairs. (e.g. "\U0001F431" CAT FACE).
|
||||
- Fixed demo dates dump (#113, thanks to @Hypercubed).
|
||||
|
||||
|
||||
## [3.2.5] - 2014-12-28
|
||||
### Fixed
|
||||
- Fixed resolving of all built-in types on empty nodes.
|
||||
- Fixed invalid warning on empty lines within quoted scalars and flow collections.
|
||||
- Fixed bug: Tag on an empty node didn't resolve in some cases.
|
||||
|
||||
|
||||
## [3.2.4] - 2014-12-19
|
||||
### Fixed
|
||||
- Fixed resolving of !!null tag on an empty node.
|
||||
|
||||
|
||||
## [3.2.3] - 2014-11-08
|
||||
### Fixed
|
||||
- Implemented dumping of objects with circular and cross references.
|
||||
- Partially fixed aliasing of constructed objects. (see issue #141 for details)
|
||||
|
||||
|
||||
## [3.2.2] - 2014-09-07
|
||||
### Fixed
|
||||
- Fixed infinite loop on unindented block scalars.
|
||||
- Rewritten base64 encode/decode in binary type, to keep code licence clear.
|
||||
|
||||
|
||||
## [3.2.1] - 2014-08-24
|
||||
### Fixed
|
||||
- Nothig new. Just fix npm publish error.
|
||||
|
||||
|
||||
## [3.2.0] - 2014-08-24
|
||||
### Added
|
||||
- Added input piping support to CLI.
|
||||
|
||||
### Fixed
|
||||
- Fixed typo, that could cause hand on initial indent (#139).
|
||||
|
||||
|
||||
## [3.1.0] - 2014-07-07
|
||||
### Changed
|
||||
- 1.5x-2x speed boost.
|
||||
- Removed deprecated `require('xxx.yml')` support.
|
||||
- Significant code cleanup and refactoring.
|
||||
- Internal API changed. If you used custom types - see updated examples.
|
||||
Others are not affected.
|
||||
- Even if the input string has no trailing line break character,
|
||||
it will be parsed as if it has one.
|
||||
- Added benchmark scripts.
|
||||
- Moved bower files to /dist folder
|
||||
- Bugfixes.
|
||||
|
||||
|
||||
## [3.0.2] - 2014-02-27
|
||||
### Fixed
|
||||
- Fixed bug: "constructor" string parsed as `null`.
|
||||
|
||||
|
||||
## [3.0.1] - 2013-12-22
|
||||
### Fixed
|
||||
- Fixed parsing of literal scalars. (issue #108)
|
||||
- Prevented adding unnecessary spaces in object dumps. (issue #68)
|
||||
- Fixed dumping of objects with very long (> 1024 in length) keys.
|
||||
|
||||
|
||||
## [3.0.0] - 2013-12-16
|
||||
### Changed
|
||||
- Refactored code. Changed API for custom types.
|
||||
- Removed output colors in CLI, dump json by default.
|
||||
- Removed big dependencies from browser version (esprima, buffer). Load `esprima` manually, if `!!js/function` needed. `!!bin` now returns Array in browser
|
||||
- AMD support.
|
||||
- Don't quote dumped strings because of `-` & `?` (if not first char).
|
||||
- __Deprecated__ loading yaml files via `require()`, as not recommended
|
||||
behaviour for node.
|
||||
|
||||
|
||||
## [2.1.3] - 2013-10-16
|
||||
### Fixed
|
||||
- Fix wrong loading of empty block scalars.
|
||||
|
||||
|
||||
## [2.1.2] - 2013-10-07
|
||||
### Fixed
|
||||
- Fix unwanted line breaks in folded scalars.
|
||||
|
||||
|
||||
## [2.1.1] - 2013-10-02
|
||||
### Fixed
|
||||
- Dumper now respects deprecated booleans syntax from YAML 1.0/1.1
|
||||
- Fixed reader bug in JSON-like sequences/mappings.
|
||||
|
||||
|
||||
## [2.1.0] - 2013-06-05
|
||||
### Added
|
||||
- Add standard YAML schemas: Failsafe (`FAILSAFE_SCHEMA`),
|
||||
JSON (`JSON_SCHEMA`) and Core (`CORE_SCHEMA`).
|
||||
- Add `skipInvalid` dumper option.
|
||||
|
||||
### Changed
|
||||
- Rename `DEFAULT_SCHEMA` to `DEFAULT_FULL_SCHEMA`
|
||||
and `SAFE_SCHEMA` to `DEFAULT_SAFE_SCHEMA`.
|
||||
- Use `safeLoad` for `require` extension.
|
||||
|
||||
### Fixed
|
||||
- Bug fix: export `NIL` constant from the public interface.
|
||||
|
||||
|
||||
## [2.0.5] - 2013-04-26
|
||||
### Security
|
||||
- Close security issue in !!js/function constructor.
|
||||
Big thanks to @nealpoole for security audit.
|
||||
|
||||
|
||||
## [2.0.4] - 2013-04-08
|
||||
### Changed
|
||||
- Updated .npmignore to reduce package size
|
||||
|
||||
|
||||
## [2.0.3] - 2013-02-26
|
||||
### Fixed
|
||||
- Fixed dumping of empty arrays ans objects. ([] and {} instead of null)
|
||||
|
||||
|
||||
## [2.0.2] - 2013-02-15
|
||||
### Fixed
|
||||
- Fixed input validation: tabs are printable characters.
|
||||
|
||||
|
||||
## [2.0.1] - 2013-02-09
|
||||
### Fixed
|
||||
- Fixed error, when options not passed to function cass
|
||||
|
||||
|
||||
## [2.0.0] - 2013-02-09
|
||||
### Changed
|
||||
- Full rewrite. New architecture. Fast one-stage parsing.
|
||||
- Changed custom types API.
|
||||
- Added YAML dumper.
|
||||
|
||||
|
||||
## [1.0.3] - 2012-11-05
|
||||
### Fixed
|
||||
- Fixed utf-8 files loading.
|
||||
|
||||
|
||||
## [1.0.2] - 2012-08-02
|
||||
### Fixed
|
||||
- Pull out hand-written shims. Use ES5-Shims for old browsers support. See #44.
|
||||
- Fix timstamps incorectly parsed in local time when no time part specified.
|
||||
|
||||
|
||||
## [1.0.1] - 2012-07-07
|
||||
### Fixed
|
||||
- Fixes `TypeError: 'undefined' is not an object` under Safari. Thanks Phuong.
|
||||
- Fix timestamps incorrectly parsed in local time. Thanks @caolan. Closes #46.
|
||||
|
||||
|
||||
## [1.0.0] - 2012-07-01
|
||||
### Changed
|
||||
- `y`, `yes`, `n`, `no`, `on`, `off` are not converted to Booleans anymore.
|
||||
Fixes #42.
|
||||
- `require(filename)` now returns a single document and throws an Error if
|
||||
file contains more than one document.
|
||||
- CLI was merged back from js-yaml.bin
|
||||
|
||||
|
||||
## [0.3.7] - 2012-02-28
|
||||
### Fixed
|
||||
- Fix export of `addConstructor()`. Closes #39.
|
||||
|
||||
|
||||
## [0.3.6] - 2012-02-22
|
||||
### Changed
|
||||
- Removed AMD parts - too buggy to use. Need help to rewrite from scratch
|
||||
|
||||
### Fixed
|
||||
- Removed YUI compressor warning (renamed `double` variable). Closes #40.
|
||||
|
||||
|
||||
## [0.3.5] - 2012-01-10
|
||||
### Fixed
|
||||
- Workagound for .npmignore fuckup under windows. Thanks to airportyh.
|
||||
|
||||
|
||||
## [0.3.4] - 2011-12-24
|
||||
### Fixed
|
||||
- Fixes str[] for oldIEs support.
|
||||
- Adds better has change support for browserified demo.
|
||||
- improves compact output of Error. Closes #33.
|
||||
|
||||
|
||||
## [0.3.3] - 2011-12-20
|
||||
### Added
|
||||
- adds `compact` stringification of Errors.
|
||||
|
||||
### Changed
|
||||
- jsyaml executable moved to separate module.
|
||||
|
||||
|
||||
## [0.3.2] - 2011-12-16
|
||||
### Added
|
||||
- Added jsyaml executable.
|
||||
- Added !!js/function support. Closes #12.
|
||||
|
||||
### Fixed
|
||||
- Fixes ug with block style scalars. Closes #26.
|
||||
- All sources are passing JSLint now.
|
||||
- Fixes bug in Safari. Closes #28.
|
||||
- Fixes bug in Opers. Closes #29.
|
||||
- Improves browser support. Closes #20.
|
||||
|
||||
|
||||
## [0.3.1] - 2011-11-18
|
||||
### Added
|
||||
- Added AMD support for browserified version.
|
||||
- Added permalinks for online demo YAML snippets. Now we have YPaste service, lol.
|
||||
- Added !!js/regexp and !!js/undefined types. Partially solves #12.
|
||||
|
||||
### Changed
|
||||
- Wrapped browserified js-yaml into closure.
|
||||
|
||||
### Fixed
|
||||
- Fixed the resolvement of non-specific tags. Closes #17.
|
||||
- Fixed !!set mapping.
|
||||
- Fixed month parse in dates. Closes #19.
|
||||
|
||||
|
||||
## [0.3.0] - 2011-11-09
|
||||
### Added
|
||||
- Added browserified version. Closes #13.
|
||||
- Added live demo of browserified version.
|
||||
- Ported some of the PyYAML tests. See #14.
|
||||
|
||||
### Fixed
|
||||
- Removed JS.Class dependency. Closes #3.
|
||||
- Fixed timestamp bug when fraction was given.
|
||||
|
||||
|
||||
## [0.2.2] - 2011-11-06
|
||||
### Fixed
|
||||
- Fixed crash on docs without ---. Closes #8.
|
||||
- Fixed multiline string parse
|
||||
- Fixed tests/comments for using array as key
|
||||
|
||||
|
||||
## [0.2.1] - 2011-11-02
|
||||
### Fixed
|
||||
- Fixed short file read (<4k). Closes #9.
|
||||
|
||||
|
||||
## [0.2.0] - 2011-11-02
|
||||
### Changed
|
||||
- First public release
|
||||
|
||||
|
||||
[4.1.0]: https://github.com/nodeca/js-yaml/compare/4.0.0...4.1.0
|
||||
[4.0.0]: https://github.com/nodeca/js-yaml/compare/3.14.0...4.0.0
|
||||
[3.14.0]: https://github.com/nodeca/js-yaml/compare/3.13.1...3.14.0
|
||||
[3.13.1]: https://github.com/nodeca/js-yaml/compare/3.13.0...3.13.1
|
||||
[3.13.0]: https://github.com/nodeca/js-yaml/compare/3.12.2...3.13.0
|
||||
[3.12.2]: https://github.com/nodeca/js-yaml/compare/3.12.1...3.12.2
|
||||
[3.12.1]: https://github.com/nodeca/js-yaml/compare/3.12.0...3.12.1
|
||||
[3.12.0]: https://github.com/nodeca/js-yaml/compare/3.11.0...3.12.0
|
||||
[3.11.0]: https://github.com/nodeca/js-yaml/compare/3.10.0...3.11.0
|
||||
[3.10.0]: https://github.com/nodeca/js-yaml/compare/3.9.1...3.10.0
|
||||
[3.9.1]: https://github.com/nodeca/js-yaml/compare/3.9.0...3.9.1
|
||||
[3.9.0]: https://github.com/nodeca/js-yaml/compare/3.8.4...3.9.0
|
||||
[3.8.4]: https://github.com/nodeca/js-yaml/compare/3.8.3...3.8.4
|
||||
[3.8.3]: https://github.com/nodeca/js-yaml/compare/3.8.2...3.8.3
|
||||
[3.8.2]: https://github.com/nodeca/js-yaml/compare/3.8.1...3.8.2
|
||||
[3.8.1]: https://github.com/nodeca/js-yaml/compare/3.8.0...3.8.1
|
||||
[3.8.0]: https://github.com/nodeca/js-yaml/compare/3.7.0...3.8.0
|
||||
[3.7.0]: https://github.com/nodeca/js-yaml/compare/3.6.1...3.7.0
|
||||
[3.6.1]: https://github.com/nodeca/js-yaml/compare/3.6.0...3.6.1
|
||||
[3.6.0]: https://github.com/nodeca/js-yaml/compare/3.5.5...3.6.0
|
||||
[3.5.5]: https://github.com/nodeca/js-yaml/compare/3.5.4...3.5.5
|
||||
[3.5.4]: https://github.com/nodeca/js-yaml/compare/3.5.3...3.5.4
|
||||
[3.5.3]: https://github.com/nodeca/js-yaml/compare/3.5.2...3.5.3
|
||||
[3.5.2]: https://github.com/nodeca/js-yaml/compare/3.5.1...3.5.2
|
||||
[3.5.1]: https://github.com/nodeca/js-yaml/compare/3.5.0...3.5.1
|
||||
[3.5.0]: https://github.com/nodeca/js-yaml/compare/3.4.6...3.5.0
|
||||
[3.4.6]: https://github.com/nodeca/js-yaml/compare/3.4.5...3.4.6
|
||||
[3.4.5]: https://github.com/nodeca/js-yaml/compare/3.4.4...3.4.5
|
||||
[3.4.4]: https://github.com/nodeca/js-yaml/compare/3.4.3...3.4.4
|
||||
[3.4.3]: https://github.com/nodeca/js-yaml/compare/3.4.2...3.4.3
|
||||
[3.4.2]: https://github.com/nodeca/js-yaml/compare/3.4.1...3.4.2
|
||||
[3.4.1]: https://github.com/nodeca/js-yaml/compare/3.4.0...3.4.1
|
||||
[3.4.0]: https://github.com/nodeca/js-yaml/compare/3.3.1...3.4.0
|
||||
[3.3.1]: https://github.com/nodeca/js-yaml/compare/3.3.0...3.3.1
|
||||
[3.3.0]: https://github.com/nodeca/js-yaml/compare/3.2.7...3.3.0
|
||||
[3.2.7]: https://github.com/nodeca/js-yaml/compare/3.2.6...3.2.7
|
||||
[3.2.6]: https://github.com/nodeca/js-yaml/compare/3.2.5...3.2.6
|
||||
[3.2.5]: https://github.com/nodeca/js-yaml/compare/3.2.4...3.2.5
|
||||
[3.2.4]: https://github.com/nodeca/js-yaml/compare/3.2.3...3.2.4
|
||||
[3.2.3]: https://github.com/nodeca/js-yaml/compare/3.2.2...3.2.3
|
||||
[3.2.2]: https://github.com/nodeca/js-yaml/compare/3.2.1...3.2.2
|
||||
[3.2.1]: https://github.com/nodeca/js-yaml/compare/3.2.0...3.2.1
|
||||
[3.2.0]: https://github.com/nodeca/js-yaml/compare/3.1.0...3.2.0
|
||||
[3.1.0]: https://github.com/nodeca/js-yaml/compare/3.0.2...3.1.0
|
||||
[3.0.2]: https://github.com/nodeca/js-yaml/compare/3.0.1...3.0.2
|
||||
[3.0.1]: https://github.com/nodeca/js-yaml/compare/3.0.0...3.0.1
|
||||
[3.0.0]: https://github.com/nodeca/js-yaml/compare/2.1.3...3.0.0
|
||||
[2.1.3]: https://github.com/nodeca/js-yaml/compare/2.1.2...2.1.3
|
||||
[2.1.2]: https://github.com/nodeca/js-yaml/compare/2.1.1...2.1.2
|
||||
[2.1.1]: https://github.com/nodeca/js-yaml/compare/2.1.0...2.1.1
|
||||
[2.1.0]: https://github.com/nodeca/js-yaml/compare/2.0.5...2.1.0
|
||||
[2.0.5]: https://github.com/nodeca/js-yaml/compare/2.0.4...2.0.5
|
||||
[2.0.4]: https://github.com/nodeca/js-yaml/compare/2.0.3...2.0.4
|
||||
[2.0.3]: https://github.com/nodeca/js-yaml/compare/2.0.2...2.0.3
|
||||
[2.0.2]: https://github.com/nodeca/js-yaml/compare/2.0.1...2.0.2
|
||||
[2.0.1]: https://github.com/nodeca/js-yaml/compare/2.0.0...2.0.1
|
||||
[2.0.0]: https://github.com/nodeca/js-yaml/compare/1.0.3...2.0.0
|
||||
[1.0.3]: https://github.com/nodeca/js-yaml/compare/1.0.2...1.0.3
|
||||
[1.0.2]: https://github.com/nodeca/js-yaml/compare/1.0.1...1.0.2
|
||||
[1.0.1]: https://github.com/nodeca/js-yaml/compare/1.0.0...1.0.1
|
||||
[1.0.0]: https://github.com/nodeca/js-yaml/compare/0.3.7...1.0.0
|
||||
[0.3.7]: https://github.com/nodeca/js-yaml/compare/0.3.6...0.3.7
|
||||
[0.3.6]: https://github.com/nodeca/js-yaml/compare/0.3.5...0.3.6
|
||||
[0.3.5]: https://github.com/nodeca/js-yaml/compare/0.3.4...0.3.5
|
||||
[0.3.4]: https://github.com/nodeca/js-yaml/compare/0.3.3...0.3.4
|
||||
[0.3.3]: https://github.com/nodeca/js-yaml/compare/0.3.2...0.3.3
|
||||
[0.3.2]: https://github.com/nodeca/js-yaml/compare/0.3.1...0.3.2
|
||||
[0.3.1]: https://github.com/nodeca/js-yaml/compare/0.3.0...0.3.1
|
||||
[0.3.0]: https://github.com/nodeca/js-yaml/compare/0.2.2...0.3.0
|
||||
[0.2.2]: https://github.com/nodeca/js-yaml/compare/0.2.1...0.2.2
|
||||
[0.2.1]: https://github.com/nodeca/js-yaml/compare/0.2.0...0.2.1
|
||||
[0.2.0]: https://github.com/nodeca/js-yaml/releases/tag/0.2.0
|
21
my-app/node_modules/cosmiconfig/node_modules/js-yaml/LICENSE
generated
vendored
Executable file
21
my-app/node_modules/cosmiconfig/node_modules/js-yaml/LICENSE
generated
vendored
Executable file
|
@ -0,0 +1,21 @@
|
|||
(The MIT License)
|
||||
|
||||
Copyright (C) 2011-2015 by Vitaly Puzrin
|
||||
|
||||
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.
|
246
my-app/node_modules/cosmiconfig/node_modules/js-yaml/README.md
generated
vendored
Executable file
246
my-app/node_modules/cosmiconfig/node_modules/js-yaml/README.md
generated
vendored
Executable file
|
@ -0,0 +1,246 @@
|
|||
JS-YAML - YAML 1.2 parser / writer for JavaScript
|
||||
=================================================
|
||||
|
||||
[](https://github.com/nodeca/js-yaml/actions)
|
||||
[](https://www.npmjs.org/package/js-yaml)
|
||||
|
||||
__[Online Demo](http://nodeca.github.com/js-yaml/)__
|
||||
|
||||
|
||||
This is an implementation of [YAML](http://yaml.org/), a human-friendly data
|
||||
serialization language. Started as [PyYAML](http://pyyaml.org/) port, it was
|
||||
completely rewritten from scratch. Now it's very fast, and supports 1.2 spec.
|
||||
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
### YAML module for node.js
|
||||
|
||||
```
|
||||
npm install js-yaml
|
||||
```
|
||||
|
||||
|
||||
### CLI executable
|
||||
|
||||
If you want to inspect your YAML files from CLI, install js-yaml globally:
|
||||
|
||||
```
|
||||
npm install -g js-yaml
|
||||
```
|
||||
|
||||
#### Usage
|
||||
|
||||
```
|
||||
usage: js-yaml [-h] [-v] [-c] [-t] file
|
||||
|
||||
Positional arguments:
|
||||
file File with YAML document(s)
|
||||
|
||||
Optional arguments:
|
||||
-h, --help Show this help message and exit.
|
||||
-v, --version Show program's version number and exit.
|
||||
-c, --compact Display errors in compact mode
|
||||
-t, --trace Show stack trace on error
|
||||
```
|
||||
|
||||
|
||||
API
|
||||
---
|
||||
|
||||
Here we cover the most 'useful' methods. If you need advanced details (creating
|
||||
your own tags), see [examples](https://github.com/nodeca/js-yaml/tree/master/examples)
|
||||
for more info.
|
||||
|
||||
``` javascript
|
||||
const yaml = require('js-yaml');
|
||||
const fs = require('fs');
|
||||
|
||||
// Get document, or throw exception on error
|
||||
try {
|
||||
const doc = yaml.load(fs.readFileSync('/home/ixti/example.yml', 'utf8'));
|
||||
console.log(doc);
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
### load (string [ , options ])
|
||||
|
||||
Parses `string` as single YAML document. Returns either a
|
||||
plain object, a string, a number, `null` or `undefined`, or throws `YAMLException` on error. By default, does
|
||||
not support regexps, functions and undefined.
|
||||
|
||||
options:
|
||||
|
||||
- `filename` _(default: null)_ - string to be used as a file path in
|
||||
error/warning messages.
|
||||
- `onWarning` _(default: null)_ - function to call on warning messages.
|
||||
Loader will call this function with an instance of `YAMLException` for each warning.
|
||||
- `schema` _(default: `DEFAULT_SCHEMA`)_ - specifies a schema to use.
|
||||
- `FAILSAFE_SCHEMA` - only strings, arrays and plain objects:
|
||||
http://www.yaml.org/spec/1.2/spec.html#id2802346
|
||||
- `JSON_SCHEMA` - all JSON-supported types:
|
||||
http://www.yaml.org/spec/1.2/spec.html#id2803231
|
||||
- `CORE_SCHEMA` - same as `JSON_SCHEMA`:
|
||||
http://www.yaml.org/spec/1.2/spec.html#id2804923
|
||||
- `DEFAULT_SCHEMA` - all supported YAML types.
|
||||
- `json` _(default: false)_ - compatibility with JSON.parse behaviour. If true, then duplicate keys in a mapping will override values rather than throwing an error.
|
||||
|
||||
NOTE: This function **does not** understand multi-document sources, it throws
|
||||
exception on those.
|
||||
|
||||
NOTE: JS-YAML **does not** support schema-specific tag resolution restrictions.
|
||||
So, the JSON schema is not as strictly defined in the YAML specification.
|
||||
It allows numbers in any notation, use `Null` and `NULL` as `null`, etc.
|
||||
The core schema also has no such restrictions. It allows binary notation for integers.
|
||||
|
||||
|
||||
### loadAll (string [, iterator] [, options ])
|
||||
|
||||
Same as `load()`, but understands multi-document sources. Applies
|
||||
`iterator` to each document if specified, or returns array of documents.
|
||||
|
||||
``` javascript
|
||||
const yaml = require('js-yaml');
|
||||
|
||||
yaml.loadAll(data, function (doc) {
|
||||
console.log(doc);
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
### dump (object [ , options ])
|
||||
|
||||
Serializes `object` as a YAML document. Uses `DEFAULT_SCHEMA`, so it will
|
||||
throw an exception if you try to dump regexps or functions. However, you can
|
||||
disable exceptions by setting the `skipInvalid` option to `true`.
|
||||
|
||||
options:
|
||||
|
||||
- `indent` _(default: 2)_ - indentation width to use (in spaces).
|
||||
- `noArrayIndent` _(default: false)_ - when true, will not add an indentation level to array elements
|
||||
- `skipInvalid` _(default: false)_ - do not throw on invalid types (like function
|
||||
in the safe schema) and skip pairs and single values with such types.
|
||||
- `flowLevel` _(default: -1)_ - specifies level of nesting, when to switch from
|
||||
block to flow style for collections. -1 means block style everwhere
|
||||
- `styles` - "tag" => "style" map. Each tag may have own set of styles.
|
||||
- `schema` _(default: `DEFAULT_SCHEMA`)_ specifies a schema to use.
|
||||
- `sortKeys` _(default: `false`)_ - if `true`, sort keys when dumping YAML. If a
|
||||
function, use the function to sort the keys.
|
||||
- `lineWidth` _(default: `80`)_ - set max line width. Set `-1` for unlimited width.
|
||||
- `noRefs` _(default: `false`)_ - if `true`, don't convert duplicate objects into references
|
||||
- `noCompatMode` _(default: `false`)_ - if `true` don't try to be compatible with older
|
||||
yaml versions. Currently: don't quote "yes", "no" and so on, as required for YAML 1.1
|
||||
- `condenseFlow` _(default: `false`)_ - if `true` flow sequences will be condensed, omitting the space between `a, b`. Eg. `'[a,b]'`, and omitting the space between `key: value` and quoting the key. Eg. `'{"a":b}'` Can be useful when using yaml for pretty URL query params as spaces are %-encoded.
|
||||
- `quotingType` _(`'` or `"`, default: `'`)_ - strings will be quoted using this quoting style. If you specify single quotes, double quotes will still be used for non-printable characters.
|
||||
- `forceQuotes` _(default: `false`)_ - if `true`, all non-key strings will be quoted even if they normally don't need to.
|
||||
- `replacer` - callback `function (key, value)` called recursively on each key/value in source object (see `replacer` docs for `JSON.stringify`).
|
||||
|
||||
The following table show availlable styles (e.g. "canonical",
|
||||
"binary"...) available for each tag (.e.g. !!null, !!int ...). Yaml
|
||||
output is shown on the right side after `=>` (default setting) or `->`:
|
||||
|
||||
``` none
|
||||
!!null
|
||||
"canonical" -> "~"
|
||||
"lowercase" => "null"
|
||||
"uppercase" -> "NULL"
|
||||
"camelcase" -> "Null"
|
||||
|
||||
!!int
|
||||
"binary" -> "0b1", "0b101010", "0b1110001111010"
|
||||
"octal" -> "0o1", "0o52", "0o16172"
|
||||
"decimal" => "1", "42", "7290"
|
||||
"hexadecimal" -> "0x1", "0x2A", "0x1C7A"
|
||||
|
||||
!!bool
|
||||
"lowercase" => "true", "false"
|
||||
"uppercase" -> "TRUE", "FALSE"
|
||||
"camelcase" -> "True", "False"
|
||||
|
||||
!!float
|
||||
"lowercase" => ".nan", '.inf'
|
||||
"uppercase" -> ".NAN", '.INF'
|
||||
"camelcase" -> ".NaN", '.Inf'
|
||||
```
|
||||
|
||||
Example:
|
||||
|
||||
``` javascript
|
||||
dump(object, {
|
||||
'styles': {
|
||||
'!!null': 'canonical' // dump null as ~
|
||||
},
|
||||
'sortKeys': true // sort object keys
|
||||
});
|
||||
```
|
||||
|
||||
Supported YAML types
|
||||
--------------------
|
||||
|
||||
The list of standard YAML tags and corresponding JavaScript types. See also
|
||||
[YAML tag discussion](http://pyyaml.org/wiki/YAMLTagDiscussion) and
|
||||
[YAML types repository](http://yaml.org/type/).
|
||||
|
||||
```
|
||||
!!null '' # null
|
||||
!!bool 'yes' # bool
|
||||
!!int '3...' # number
|
||||
!!float '3.14...' # number
|
||||
!!binary '...base64...' # buffer
|
||||
!!timestamp 'YYYY-...' # date
|
||||
!!omap [ ... ] # array of key-value pairs
|
||||
!!pairs [ ... ] # array or array pairs
|
||||
!!set { ... } # array of objects with given keys and null values
|
||||
!!str '...' # string
|
||||
!!seq [ ... ] # array
|
||||
!!map { ... } # object
|
||||
```
|
||||
|
||||
**JavaScript-specific tags**
|
||||
|
||||
See [js-yaml-js-types](https://github.com/nodeca/js-yaml-js-types) for
|
||||
extra types.
|
||||
|
||||
|
||||
Caveats
|
||||
-------
|
||||
|
||||
Note, that you use arrays or objects as key in JS-YAML. JS does not allow objects
|
||||
or arrays as keys, and stringifies (by calling `toString()` method) them at the
|
||||
moment of adding them.
|
||||
|
||||
``` yaml
|
||||
---
|
||||
? [ foo, bar ]
|
||||
: - baz
|
||||
? { foo: bar }
|
||||
: - baz
|
||||
- baz
|
||||
```
|
||||
|
||||
``` javascript
|
||||
{ "foo,bar": ["baz"], "[object Object]": ["baz", "baz"] }
|
||||
```
|
||||
|
||||
Also, reading of properties on implicit block mapping keys is not supported yet.
|
||||
So, the following YAML document cannot be loaded.
|
||||
|
||||
``` yaml
|
||||
&anchor foo:
|
||||
foo: bar
|
||||
*anchor: duplicate key
|
||||
baz: bat
|
||||
*anchor: duplicate key
|
||||
```
|
||||
|
||||
|
||||
js-yaml for enterprise
|
||||
----------------------
|
||||
|
||||
Available as part of the Tidelift Subscription
|
||||
|
||||
The maintainers of js-yaml and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-js-yaml?utm_source=npm-js-yaml&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)
|
126
my-app/node_modules/cosmiconfig/node_modules/js-yaml/bin/js-yaml.js
generated
vendored
Executable file
126
my-app/node_modules/cosmiconfig/node_modules/js-yaml/bin/js-yaml.js
generated
vendored
Executable file
|
@ -0,0 +1,126 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
|
||||
'use strict';
|
||||
|
||||
/*eslint-disable no-console*/
|
||||
|
||||
|
||||
var fs = require('fs');
|
||||
var argparse = require('argparse');
|
||||
var yaml = require('..');
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
var cli = new argparse.ArgumentParser({
|
||||
prog: 'js-yaml',
|
||||
add_help: true
|
||||
});
|
||||
|
||||
cli.add_argument('-v', '--version', {
|
||||
action: 'version',
|
||||
version: require('../package.json').version
|
||||
});
|
||||
|
||||
cli.add_argument('-c', '--compact', {
|
||||
help: 'Display errors in compact mode',
|
||||
action: 'store_true'
|
||||
});
|
||||
|
||||
// deprecated (not needed after we removed output colors)
|
||||
// option suppressed, but not completely removed for compatibility
|
||||
cli.add_argument('-j', '--to-json', {
|
||||
help: argparse.SUPPRESS,
|
||||
dest: 'json',
|
||||
action: 'store_true'
|
||||
});
|
||||
|
||||
cli.add_argument('-t', '--trace', {
|
||||
help: 'Show stack trace on error',
|
||||
action: 'store_true'
|
||||
});
|
||||
|
||||
cli.add_argument('file', {
|
||||
help: 'File to read, utf-8 encoded without BOM',
|
||||
nargs: '?',
|
||||
default: '-'
|
||||
});
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
var options = cli.parse_args();
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function readFile(filename, encoding, callback) {
|
||||
if (options.file === '-') {
|
||||
// read from stdin
|
||||
|
||||
var chunks = [];
|
||||
|
||||
process.stdin.on('data', function (chunk) {
|
||||
chunks.push(chunk);
|
||||
});
|
||||
|
||||
process.stdin.on('end', function () {
|
||||
return callback(null, Buffer.concat(chunks).toString(encoding));
|
||||
});
|
||||
} else {
|
||||
fs.readFile(filename, encoding, callback);
|
||||
}
|
||||
}
|
||||
|
||||
readFile(options.file, 'utf8', function (error, input) {
|
||||
var output, isYaml;
|
||||
|
||||
if (error) {
|
||||
if (error.code === 'ENOENT') {
|
||||
console.error('File not found: ' + options.file);
|
||||
process.exit(2);
|
||||
}
|
||||
|
||||
console.error(
|
||||
options.trace && error.stack ||
|
||||
error.message ||
|
||||
String(error));
|
||||
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
try {
|
||||
output = JSON.parse(input);
|
||||
isYaml = false;
|
||||
} catch (err) {
|
||||
if (err instanceof SyntaxError) {
|
||||
try {
|
||||
output = [];
|
||||
yaml.loadAll(input, function (doc) { output.push(doc); }, {});
|
||||
isYaml = true;
|
||||
|
||||
if (output.length === 0) output = null;
|
||||
else if (output.length === 1) output = output[0];
|
||||
|
||||
} catch (e) {
|
||||
if (options.trace && err.stack) console.error(e.stack);
|
||||
else console.error(e.toString(options.compact));
|
||||
|
||||
process.exit(1);
|
||||
}
|
||||
} else {
|
||||
console.error(
|
||||
options.trace && err.stack ||
|
||||
err.message ||
|
||||
String(err));
|
||||
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
if (isYaml) console.log(JSON.stringify(output, null, ' '));
|
||||
else console.log(yaml.dump(output));
|
||||
});
|
3874
my-app/node_modules/cosmiconfig/node_modules/js-yaml/dist/js-yaml.js
generated
vendored
Executable file
3874
my-app/node_modules/cosmiconfig/node_modules/js-yaml/dist/js-yaml.js
generated
vendored
Executable file
File diff suppressed because it is too large
Load diff
2
my-app/node_modules/cosmiconfig/node_modules/js-yaml/dist/js-yaml.min.js
generated
vendored
Executable file
2
my-app/node_modules/cosmiconfig/node_modules/js-yaml/dist/js-yaml.min.js
generated
vendored
Executable file
File diff suppressed because one or more lines are too long
3851
my-app/node_modules/cosmiconfig/node_modules/js-yaml/dist/js-yaml.mjs
generated
vendored
Executable file
3851
my-app/node_modules/cosmiconfig/node_modules/js-yaml/dist/js-yaml.mjs
generated
vendored
Executable file
File diff suppressed because it is too large
Load diff
47
my-app/node_modules/cosmiconfig/node_modules/js-yaml/index.js
generated
vendored
Executable file
47
my-app/node_modules/cosmiconfig/node_modules/js-yaml/index.js
generated
vendored
Executable file
|
@ -0,0 +1,47 @@
|
|||
'use strict';
|
||||
|
||||
|
||||
var loader = require('./lib/loader');
|
||||
var dumper = require('./lib/dumper');
|
||||
|
||||
|
||||
function renamed(from, to) {
|
||||
return function () {
|
||||
throw new Error('Function yaml.' + from + ' is removed in js-yaml 4. ' +
|
||||
'Use yaml.' + to + ' instead, which is now safe by default.');
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
module.exports.Type = require('./lib/type');
|
||||
module.exports.Schema = require('./lib/schema');
|
||||
module.exports.FAILSAFE_SCHEMA = require('./lib/schema/failsafe');
|
||||
module.exports.JSON_SCHEMA = require('./lib/schema/json');
|
||||
module.exports.CORE_SCHEMA = require('./lib/schema/core');
|
||||
module.exports.DEFAULT_SCHEMA = require('./lib/schema/default');
|
||||
module.exports.load = loader.load;
|
||||
module.exports.loadAll = loader.loadAll;
|
||||
module.exports.dump = dumper.dump;
|
||||
module.exports.YAMLException = require('./lib/exception');
|
||||
|
||||
// Re-export all types in case user wants to create custom schema
|
||||
module.exports.types = {
|
||||
binary: require('./lib/type/binary'),
|
||||
float: require('./lib/type/float'),
|
||||
map: require('./lib/type/map'),
|
||||
null: require('./lib/type/null'),
|
||||
pairs: require('./lib/type/pairs'),
|
||||
set: require('./lib/type/set'),
|
||||
timestamp: require('./lib/type/timestamp'),
|
||||
bool: require('./lib/type/bool'),
|
||||
int: require('./lib/type/int'),
|
||||
merge: require('./lib/type/merge'),
|
||||
omap: require('./lib/type/omap'),
|
||||
seq: require('./lib/type/seq'),
|
||||
str: require('./lib/type/str')
|
||||
};
|
||||
|
||||
// Removed functions from JS-YAML 3.0.x
|
||||
module.exports.safeLoad = renamed('safeLoad', 'load');
|
||||
module.exports.safeLoadAll = renamed('safeLoadAll', 'loadAll');
|
||||
module.exports.safeDump = renamed('safeDump', 'dump');
|
59
my-app/node_modules/cosmiconfig/node_modules/js-yaml/lib/common.js
generated
vendored
Executable file
59
my-app/node_modules/cosmiconfig/node_modules/js-yaml/lib/common.js
generated
vendored
Executable file
|
@ -0,0 +1,59 @@
|
|||
'use strict';
|
||||
|
||||
|
||||
function isNothing(subject) {
|
||||
return (typeof subject === 'undefined') || (subject === null);
|
||||
}
|
||||
|
||||
|
||||
function isObject(subject) {
|
||||
return (typeof subject === 'object') && (subject !== null);
|
||||
}
|
||||
|
||||
|
||||
function toArray(sequence) {
|
||||
if (Array.isArray(sequence)) return sequence;
|
||||
else if (isNothing(sequence)) return [];
|
||||
|
||||
return [ sequence ];
|
||||
}
|
||||
|
||||
|
||||
function extend(target, source) {
|
||||
var index, length, key, sourceKeys;
|
||||
|
||||
if (source) {
|
||||
sourceKeys = Object.keys(source);
|
||||
|
||||
for (index = 0, length = sourceKeys.length; index < length; index += 1) {
|
||||
key = sourceKeys[index];
|
||||
target[key] = source[key];
|
||||
}
|
||||
}
|
||||
|
||||
return target;
|
||||
}
|
||||
|
||||
|
||||
function repeat(string, count) {
|
||||
var result = '', cycle;
|
||||
|
||||
for (cycle = 0; cycle < count; cycle += 1) {
|
||||
result += string;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
function isNegativeZero(number) {
|
||||
return (number === 0) && (Number.NEGATIVE_INFINITY === 1 / number);
|
||||
}
|
||||
|
||||
|
||||
module.exports.isNothing = isNothing;
|
||||
module.exports.isObject = isObject;
|
||||
module.exports.toArray = toArray;
|
||||
module.exports.repeat = repeat;
|
||||
module.exports.isNegativeZero = isNegativeZero;
|
||||
module.exports.extend = extend;
|
965
my-app/node_modules/cosmiconfig/node_modules/js-yaml/lib/dumper.js
generated
vendored
Executable file
965
my-app/node_modules/cosmiconfig/node_modules/js-yaml/lib/dumper.js
generated
vendored
Executable file
|
@ -0,0 +1,965 @@
|
|||
'use strict';
|
||||
|
||||
/*eslint-disable no-use-before-define*/
|
||||
|
||||
var common = require('./common');
|
||||
var YAMLException = require('./exception');
|
||||
var DEFAULT_SCHEMA = require('./schema/default');
|
||||
|
||||
var _toString = Object.prototype.toString;
|
||||
var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
|
||||
var CHAR_BOM = 0xFEFF;
|
||||
var CHAR_TAB = 0x09; /* Tab */
|
||||
var CHAR_LINE_FEED = 0x0A; /* LF */
|
||||
var CHAR_CARRIAGE_RETURN = 0x0D; /* CR */
|
||||
var CHAR_SPACE = 0x20; /* Space */
|
||||
var CHAR_EXCLAMATION = 0x21; /* ! */
|
||||
var CHAR_DOUBLE_QUOTE = 0x22; /* " */
|
||||
var CHAR_SHARP = 0x23; /* # */
|
||||
var CHAR_PERCENT = 0x25; /* % */
|
||||
var CHAR_AMPERSAND = 0x26; /* & */
|
||||
var CHAR_SINGLE_QUOTE = 0x27; /* ' */
|
||||
var CHAR_ASTERISK = 0x2A; /* * */
|
||||
var CHAR_COMMA = 0x2C; /* , */
|
||||
var CHAR_MINUS = 0x2D; /* - */
|
||||
var CHAR_COLON = 0x3A; /* : */
|
||||
var CHAR_EQUALS = 0x3D; /* = */
|
||||
var CHAR_GREATER_THAN = 0x3E; /* > */
|
||||
var CHAR_QUESTION = 0x3F; /* ? */
|
||||
var CHAR_COMMERCIAL_AT = 0x40; /* @ */
|
||||
var CHAR_LEFT_SQUARE_BRACKET = 0x5B; /* [ */
|
||||
var CHAR_RIGHT_SQUARE_BRACKET = 0x5D; /* ] */
|
||||
var CHAR_GRAVE_ACCENT = 0x60; /* ` */
|
||||
var CHAR_LEFT_CURLY_BRACKET = 0x7B; /* { */
|
||||
var CHAR_VERTICAL_LINE = 0x7C; /* | */
|
||||
var CHAR_RIGHT_CURLY_BRACKET = 0x7D; /* } */
|
||||
|
||||
var ESCAPE_SEQUENCES = {};
|
||||
|
||||
ESCAPE_SEQUENCES[0x00] = '\\0';
|
||||
ESCAPE_SEQUENCES[0x07] = '\\a';
|
||||
ESCAPE_SEQUENCES[0x08] = '\\b';
|
||||
ESCAPE_SEQUENCES[0x09] = '\\t';
|
||||
ESCAPE_SEQUENCES[0x0A] = '\\n';
|
||||
ESCAPE_SEQUENCES[0x0B] = '\\v';
|
||||
ESCAPE_SEQUENCES[0x0C] = '\\f';
|
||||
ESCAPE_SEQUENCES[0x0D] = '\\r';
|
||||
ESCAPE_SEQUENCES[0x1B] = '\\e';
|
||||
ESCAPE_SEQUENCES[0x22] = '\\"';
|
||||
ESCAPE_SEQUENCES[0x5C] = '\\\\';
|
||||
ESCAPE_SEQUENCES[0x85] = '\\N';
|
||||
ESCAPE_SEQUENCES[0xA0] = '\\_';
|
||||
ESCAPE_SEQUENCES[0x2028] = '\\L';
|
||||
ESCAPE_SEQUENCES[0x2029] = '\\P';
|
||||
|
||||
var DEPRECATED_BOOLEANS_SYNTAX = [
|
||||
'y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON',
|
||||
'n', 'N', 'no', 'No', 'NO', 'off', 'Off', 'OFF'
|
||||
];
|
||||
|
||||
var DEPRECATED_BASE60_SYNTAX = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;
|
||||
|
||||
function compileStyleMap(schema, map) {
|
||||
var result, keys, index, length, tag, style, type;
|
||||
|
||||
if (map === null) return {};
|
||||
|
||||
result = {};
|
||||
keys = Object.keys(map);
|
||||
|
||||
for (index = 0, length = keys.length; index < length; index += 1) {
|
||||
tag = keys[index];
|
||||
style = String(map[tag]);
|
||||
|
||||
if (tag.slice(0, 2) === '!!') {
|
||||
tag = 'tag:yaml.org,2002:' + tag.slice(2);
|
||||
}
|
||||
type = schema.compiledTypeMap['fallback'][tag];
|
||||
|
||||
if (type && _hasOwnProperty.call(type.styleAliases, style)) {
|
||||
style = type.styleAliases[style];
|
||||
}
|
||||
|
||||
result[tag] = style;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function encodeHex(character) {
|
||||
var string, handle, length;
|
||||
|
||||
string = character.toString(16).toUpperCase();
|
||||
|
||||
if (character <= 0xFF) {
|
||||
handle = 'x';
|
||||
length = 2;
|
||||
} else if (character <= 0xFFFF) {
|
||||
handle = 'u';
|
||||
length = 4;
|
||||
} else if (character <= 0xFFFFFFFF) {
|
||||
handle = 'U';
|
||||
length = 8;
|
||||
} else {
|
||||
throw new YAMLException('code point within a string may not be greater than 0xFFFFFFFF');
|
||||
}
|
||||
|
||||
return '\\' + handle + common.repeat('0', length - string.length) + string;
|
||||
}
|
||||
|
||||
|
||||
var QUOTING_TYPE_SINGLE = 1,
|
||||
QUOTING_TYPE_DOUBLE = 2;
|
||||
|
||||
function State(options) {
|
||||
this.schema = options['schema'] || DEFAULT_SCHEMA;
|
||||
this.indent = Math.max(1, (options['indent'] || 2));
|
||||
this.noArrayIndent = options['noArrayIndent'] || false;
|
||||
this.skipInvalid = options['skipInvalid'] || false;
|
||||
this.flowLevel = (common.isNothing(options['flowLevel']) ? -1 : options['flowLevel']);
|
||||
this.styleMap = compileStyleMap(this.schema, options['styles'] || null);
|
||||
this.sortKeys = options['sortKeys'] || false;
|
||||
this.lineWidth = options['lineWidth'] || 80;
|
||||
this.noRefs = options['noRefs'] || false;
|
||||
this.noCompatMode = options['noCompatMode'] || false;
|
||||
this.condenseFlow = options['condenseFlow'] || false;
|
||||
this.quotingType = options['quotingType'] === '"' ? QUOTING_TYPE_DOUBLE : QUOTING_TYPE_SINGLE;
|
||||
this.forceQuotes = options['forceQuotes'] || false;
|
||||
this.replacer = typeof options['replacer'] === 'function' ? options['replacer'] : null;
|
||||
|
||||
this.implicitTypes = this.schema.compiledImplicit;
|
||||
this.explicitTypes = this.schema.compiledExplicit;
|
||||
|
||||
this.tag = null;
|
||||
this.result = '';
|
||||
|
||||
this.duplicates = [];
|
||||
this.usedDuplicates = null;
|
||||
}
|
||||
|
||||
// Indents every line in a string. Empty lines (\n only) are not indented.
|
||||
function indentString(string, spaces) {
|
||||
var ind = common.repeat(' ', spaces),
|
||||
position = 0,
|
||||
next = -1,
|
||||
result = '',
|
||||
line,
|
||||
length = string.length;
|
||||
|
||||
while (position < length) {
|
||||
next = string.indexOf('\n', position);
|
||||
if (next === -1) {
|
||||
line = string.slice(position);
|
||||
position = length;
|
||||
} else {
|
||||
line = string.slice(position, next + 1);
|
||||
position = next + 1;
|
||||
}
|
||||
|
||||
if (line.length && line !== '\n') result += ind;
|
||||
|
||||
result += line;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function generateNextLine(state, level) {
|
||||
return '\n' + common.repeat(' ', state.indent * level);
|
||||
}
|
||||
|
||||
function testImplicitResolving(state, str) {
|
||||
var index, length, type;
|
||||
|
||||
for (index = 0, length = state.implicitTypes.length; index < length; index += 1) {
|
||||
type = state.implicitTypes[index];
|
||||
|
||||
if (type.resolve(str)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// [33] s-white ::= s-space | s-tab
|
||||
function isWhitespace(c) {
|
||||
return c === CHAR_SPACE || c === CHAR_TAB;
|
||||
}
|
||||
|
||||
// Returns true if the character can be printed without escaping.
|
||||
// From YAML 1.2: "any allowed characters known to be non-printable
|
||||
// should also be escaped. [However,] This isn’t mandatory"
|
||||
// Derived from nb-char - \t - #x85 - #xA0 - #x2028 - #x2029.
|
||||
function isPrintable(c) {
|
||||
return (0x00020 <= c && c <= 0x00007E)
|
||||
|| ((0x000A1 <= c && c <= 0x00D7FF) && c !== 0x2028 && c !== 0x2029)
|
||||
|| ((0x0E000 <= c && c <= 0x00FFFD) && c !== CHAR_BOM)
|
||||
|| (0x10000 <= c && c <= 0x10FFFF);
|
||||
}
|
||||
|
||||
// [34] ns-char ::= nb-char - s-white
|
||||
// [27] nb-char ::= c-printable - b-char - c-byte-order-mark
|
||||
// [26] b-char ::= b-line-feed | b-carriage-return
|
||||
// Including s-white (for some reason, examples doesn't match specs in this aspect)
|
||||
// ns-char ::= c-printable - b-line-feed - b-carriage-return - c-byte-order-mark
|
||||
function isNsCharOrWhitespace(c) {
|
||||
return isPrintable(c)
|
||||
&& c !== CHAR_BOM
|
||||
// - b-char
|
||||
&& c !== CHAR_CARRIAGE_RETURN
|
||||
&& c !== CHAR_LINE_FEED;
|
||||
}
|
||||
|
||||
// [127] ns-plain-safe(c) ::= c = flow-out ⇒ ns-plain-safe-out
|
||||
// c = flow-in ⇒ ns-plain-safe-in
|
||||
// c = block-key ⇒ ns-plain-safe-out
|
||||
// c = flow-key ⇒ ns-plain-safe-in
|
||||
// [128] ns-plain-safe-out ::= ns-char
|
||||
// [129] ns-plain-safe-in ::= ns-char - c-flow-indicator
|
||||
// [130] ns-plain-char(c) ::= ( ns-plain-safe(c) - “:” - “#” )
|
||||
// | ( /* An ns-char preceding */ “#” )
|
||||
// | ( “:” /* Followed by an ns-plain-safe(c) */ )
|
||||
function isPlainSafe(c, prev, inblock) {
|
||||
var cIsNsCharOrWhitespace = isNsCharOrWhitespace(c);
|
||||
var cIsNsChar = cIsNsCharOrWhitespace && !isWhitespace(c);
|
||||
return (
|
||||
// ns-plain-safe
|
||||
inblock ? // c = flow-in
|
||||
cIsNsCharOrWhitespace
|
||||
: cIsNsCharOrWhitespace
|
||||
// - c-flow-indicator
|
||||
&& c !== CHAR_COMMA
|
||||
&& c !== CHAR_LEFT_SQUARE_BRACKET
|
||||
&& c !== CHAR_RIGHT_SQUARE_BRACKET
|
||||
&& c !== CHAR_LEFT_CURLY_BRACKET
|
||||
&& c !== CHAR_RIGHT_CURLY_BRACKET
|
||||
)
|
||||
// ns-plain-char
|
||||
&& c !== CHAR_SHARP // false on '#'
|
||||
&& !(prev === CHAR_COLON && !cIsNsChar) // false on ': '
|
||||
|| (isNsCharOrWhitespace(prev) && !isWhitespace(prev) && c === CHAR_SHARP) // change to true on '[^ ]#'
|
||||
|| (prev === CHAR_COLON && cIsNsChar); // change to true on ':[^ ]'
|
||||
}
|
||||
|
||||
// Simplified test for values allowed as the first character in plain style.
|
||||
function isPlainSafeFirst(c) {
|
||||
// Uses a subset of ns-char - c-indicator
|
||||
// where ns-char = nb-char - s-white.
|
||||
// No support of ( ( “?” | “:” | “-” ) /* Followed by an ns-plain-safe(c)) */ ) part
|
||||
return isPrintable(c) && c !== CHAR_BOM
|
||||
&& !isWhitespace(c) // - s-white
|
||||
// - (c-indicator ::=
|
||||
// “-” | “?” | “:” | “,” | “[” | “]” | “{” | “}”
|
||||
&& c !== CHAR_MINUS
|
||||
&& c !== CHAR_QUESTION
|
||||
&& c !== CHAR_COLON
|
||||
&& c !== CHAR_COMMA
|
||||
&& c !== CHAR_LEFT_SQUARE_BRACKET
|
||||
&& c !== CHAR_RIGHT_SQUARE_BRACKET
|
||||
&& c !== CHAR_LEFT_CURLY_BRACKET
|
||||
&& c !== CHAR_RIGHT_CURLY_BRACKET
|
||||
// | “#” | “&” | “*” | “!” | “|” | “=” | “>” | “'” | “"”
|
||||
&& c !== CHAR_SHARP
|
||||
&& c !== CHAR_AMPERSAND
|
||||
&& c !== CHAR_ASTERISK
|
||||
&& c !== CHAR_EXCLAMATION
|
||||
&& c !== CHAR_VERTICAL_LINE
|
||||
&& c !== CHAR_EQUALS
|
||||
&& c !== CHAR_GREATER_THAN
|
||||
&& c !== CHAR_SINGLE_QUOTE
|
||||
&& c !== CHAR_DOUBLE_QUOTE
|
||||
// | “%” | “@” | “`”)
|
||||
&& c !== CHAR_PERCENT
|
||||
&& c !== CHAR_COMMERCIAL_AT
|
||||
&& c !== CHAR_GRAVE_ACCENT;
|
||||
}
|
||||
|
||||
// Simplified test for values allowed as the last character in plain style.
|
||||
function isPlainSafeLast(c) {
|
||||
// just not whitespace or colon, it will be checked to be plain character later
|
||||
return !isWhitespace(c) && c !== CHAR_COLON;
|
||||
}
|
||||
|
||||
// Same as 'string'.codePointAt(pos), but works in older browsers.
|
||||
function codePointAt(string, pos) {
|
||||
var first = string.charCodeAt(pos), second;
|
||||
if (first >= 0xD800 && first <= 0xDBFF && pos + 1 < string.length) {
|
||||
second = string.charCodeAt(pos + 1);
|
||||
if (second >= 0xDC00 && second <= 0xDFFF) {
|
||||
// https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
|
||||
return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;
|
||||
}
|
||||
}
|
||||
return first;
|
||||
}
|
||||
|
||||
// Determines whether block indentation indicator is required.
|
||||
function needIndentIndicator(string) {
|
||||
var leadingSpaceRe = /^\n* /;
|
||||
return leadingSpaceRe.test(string);
|
||||
}
|
||||
|
||||
var STYLE_PLAIN = 1,
|
||||
STYLE_SINGLE = 2,
|
||||
STYLE_LITERAL = 3,
|
||||
STYLE_FOLDED = 4,
|
||||
STYLE_DOUBLE = 5;
|
||||
|
||||
// Determines which scalar styles are possible and returns the preferred style.
|
||||
// lineWidth = -1 => no limit.
|
||||
// Pre-conditions: str.length > 0.
|
||||
// Post-conditions:
|
||||
// STYLE_PLAIN or STYLE_SINGLE => no \n are in the string.
|
||||
// STYLE_LITERAL => no lines are suitable for folding (or lineWidth is -1).
|
||||
// STYLE_FOLDED => a line > lineWidth and can be folded (and lineWidth != -1).
|
||||
function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth,
|
||||
testAmbiguousType, quotingType, forceQuotes, inblock) {
|
||||
|
||||
var i;
|
||||
var char = 0;
|
||||
var prevChar = null;
|
||||
var hasLineBreak = false;
|
||||
var hasFoldableLine = false; // only checked if shouldTrackWidth
|
||||
var shouldTrackWidth = lineWidth !== -1;
|
||||
var previousLineBreak = -1; // count the first line correctly
|
||||
var plain = isPlainSafeFirst(codePointAt(string, 0))
|
||||
&& isPlainSafeLast(codePointAt(string, string.length - 1));
|
||||
|
||||
if (singleLineOnly || forceQuotes) {
|
||||
// Case: no block styles.
|
||||
// Check for disallowed characters to rule out plain and single.
|
||||
for (i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) {
|
||||
char = codePointAt(string, i);
|
||||
if (!isPrintable(char)) {
|
||||
return STYLE_DOUBLE;
|
||||
}
|
||||
plain = plain && isPlainSafe(char, prevChar, inblock);
|
||||
prevChar = char;
|
||||
}
|
||||
} else {
|
||||
// Case: block styles permitted.
|
||||
for (i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) {
|
||||
char = codePointAt(string, i);
|
||||
if (char === CHAR_LINE_FEED) {
|
||||
hasLineBreak = true;
|
||||
// Check if any line can be folded.
|
||||
if (shouldTrackWidth) {
|
||||
hasFoldableLine = hasFoldableLine ||
|
||||
// Foldable line = too long, and not more-indented.
|
||||
(i - previousLineBreak - 1 > lineWidth &&
|
||||
string[previousLineBreak + 1] !== ' ');
|
||||
previousLineBreak = i;
|
||||
}
|
||||
} else if (!isPrintable(char)) {
|
||||
return STYLE_DOUBLE;
|
||||
}
|
||||
plain = plain && isPlainSafe(char, prevChar, inblock);
|
||||
prevChar = char;
|
||||
}
|
||||
// in case the end is missing a \n
|
||||
hasFoldableLine = hasFoldableLine || (shouldTrackWidth &&
|
||||
(i - previousLineBreak - 1 > lineWidth &&
|
||||
string[previousLineBreak + 1] !== ' '));
|
||||
}
|
||||
// Although every style can represent \n without escaping, prefer block styles
|
||||
// for multiline, since they're more readable and they don't add empty lines.
|
||||
// Also prefer folding a super-long line.
|
||||
if (!hasLineBreak && !hasFoldableLine) {
|
||||
// Strings interpretable as another type have to be quoted;
|
||||
// e.g. the string 'true' vs. the boolean true.
|
||||
if (plain && !forceQuotes && !testAmbiguousType(string)) {
|
||||
return STYLE_PLAIN;
|
||||
}
|
||||
return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;
|
||||
}
|
||||
// Edge case: block indentation indicator can only have one digit.
|
||||
if (indentPerLevel > 9 && needIndentIndicator(string)) {
|
||||
return STYLE_DOUBLE;
|
||||
}
|
||||
// At this point we know block styles are valid.
|
||||
// Prefer literal style unless we want to fold.
|
||||
if (!forceQuotes) {
|
||||
return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL;
|
||||
}
|
||||
return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;
|
||||
}
|
||||
|
||||
// Note: line breaking/folding is implemented for only the folded style.
|
||||
// NB. We drop the last trailing newline (if any) of a returned block scalar
|
||||
// since the dumper adds its own newline. This always works:
|
||||
// • No ending newline => unaffected; already using strip "-" chomping.
|
||||
// • Ending newline => removed then restored.
|
||||
// Importantly, this keeps the "+" chomp indicator from gaining an extra line.
|
||||
function writeScalar(state, string, level, iskey, inblock) {
|
||||
state.dump = (function () {
|
||||
if (string.length === 0) {
|
||||
return state.quotingType === QUOTING_TYPE_DOUBLE ? '""' : "''";
|
||||
}
|
||||
if (!state.noCompatMode) {
|
||||
if (DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1 || DEPRECATED_BASE60_SYNTAX.test(string)) {
|
||||
return state.quotingType === QUOTING_TYPE_DOUBLE ? ('"' + string + '"') : ("'" + string + "'");
|
||||
}
|
||||
}
|
||||
|
||||
var indent = state.indent * Math.max(1, level); // no 0-indent scalars
|
||||
// As indentation gets deeper, let the width decrease monotonically
|
||||
// to the lower bound min(state.lineWidth, 40).
|
||||
// Note that this implies
|
||||
// state.lineWidth ≤ 40 + state.indent: width is fixed at the lower bound.
|
||||
// state.lineWidth > 40 + state.indent: width decreases until the lower bound.
|
||||
// This behaves better than a constant minimum width which disallows narrower options,
|
||||
// or an indent threshold which causes the width to suddenly increase.
|
||||
var lineWidth = state.lineWidth === -1
|
||||
? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent);
|
||||
|
||||
// Without knowing if keys are implicit/explicit, assume implicit for safety.
|
||||
var singleLineOnly = iskey
|
||||
// No block styles in flow mode.
|
||||
|| (state.flowLevel > -1 && level >= state.flowLevel);
|
||||
function testAmbiguity(string) {
|
||||
return testImplicitResolving(state, string);
|
||||
}
|
||||
|
||||
switch (chooseScalarStyle(string, singleLineOnly, state.indent, lineWidth,
|
||||
testAmbiguity, state.quotingType, state.forceQuotes && !iskey, inblock)) {
|
||||
|
||||
case STYLE_PLAIN:
|
||||
return string;
|
||||
case STYLE_SINGLE:
|
||||
return "'" + string.replace(/'/g, "''") + "'";
|
||||
case STYLE_LITERAL:
|
||||
return '|' + blockHeader(string, state.indent)
|
||||
+ dropEndingNewline(indentString(string, indent));
|
||||
case STYLE_FOLDED:
|
||||
return '>' + blockHeader(string, state.indent)
|
||||
+ dropEndingNewline(indentString(foldString(string, lineWidth), indent));
|
||||
case STYLE_DOUBLE:
|
||||
return '"' + escapeString(string, lineWidth) + '"';
|
||||
default:
|
||||
throw new YAMLException('impossible error: invalid scalar style');
|
||||
}
|
||||
}());
|
||||
}
|
||||
|
||||
// Pre-conditions: string is valid for a block scalar, 1 <= indentPerLevel <= 9.
|
||||
function blockHeader(string, indentPerLevel) {
|
||||
var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : '';
|
||||
|
||||
// note the special case: the string '\n' counts as a "trailing" empty line.
|
||||
var clip = string[string.length - 1] === '\n';
|
||||
var keep = clip && (string[string.length - 2] === '\n' || string === '\n');
|
||||
var chomp = keep ? '+' : (clip ? '' : '-');
|
||||
|
||||
return indentIndicator + chomp + '\n';
|
||||
}
|
||||
|
||||
// (See the note for writeScalar.)
|
||||
function dropEndingNewline(string) {
|
||||
return string[string.length - 1] === '\n' ? string.slice(0, -1) : string;
|
||||
}
|
||||
|
||||
// Note: a long line without a suitable break point will exceed the width limit.
|
||||
// Pre-conditions: every char in str isPrintable, str.length > 0, width > 0.
|
||||
function foldString(string, width) {
|
||||
// In folded style, $k$ consecutive newlines output as $k+1$ newlines—
|
||||
// unless they're before or after a more-indented line, or at the very
|
||||
// beginning or end, in which case $k$ maps to $k$.
|
||||
// Therefore, parse each chunk as newline(s) followed by a content line.
|
||||
var lineRe = /(\n+)([^\n]*)/g;
|
||||
|
||||
// first line (possibly an empty line)
|
||||
var result = (function () {
|
||||
var nextLF = string.indexOf('\n');
|
||||
nextLF = nextLF !== -1 ? nextLF : string.length;
|
||||
lineRe.lastIndex = nextLF;
|
||||
return foldLine(string.slice(0, nextLF), width);
|
||||
}());
|
||||
// If we haven't reached the first content line yet, don't add an extra \n.
|
||||
var prevMoreIndented = string[0] === '\n' || string[0] === ' ';
|
||||
var moreIndented;
|
||||
|
||||
// rest of the lines
|
||||
var match;
|
||||
while ((match = lineRe.exec(string))) {
|
||||
var prefix = match[1], line = match[2];
|
||||
moreIndented = (line[0] === ' ');
|
||||
result += prefix
|
||||
+ (!prevMoreIndented && !moreIndented && line !== ''
|
||||
? '\n' : '')
|
||||
+ foldLine(line, width);
|
||||
prevMoreIndented = moreIndented;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// Greedy line breaking.
|
||||
// Picks the longest line under the limit each time,
|
||||
// otherwise settles for the shortest line over the limit.
|
||||
// NB. More-indented lines *cannot* be folded, as that would add an extra \n.
|
||||
function foldLine(line, width) {
|
||||
if (line === '' || line[0] === ' ') return line;
|
||||
|
||||
// Since a more-indented line adds a \n, breaks can't be followed by a space.
|
||||
var breakRe = / [^ ]/g; // note: the match index will always be <= length-2.
|
||||
var match;
|
||||
// start is an inclusive index. end, curr, and next are exclusive.
|
||||
var start = 0, end, curr = 0, next = 0;
|
||||
var result = '';
|
||||
|
||||
// Invariants: 0 <= start <= length-1.
|
||||
// 0 <= curr <= next <= max(0, length-2). curr - start <= width.
|
||||
// Inside the loop:
|
||||
// A match implies length >= 2, so curr and next are <= length-2.
|
||||
while ((match = breakRe.exec(line))) {
|
||||
next = match.index;
|
||||
// maintain invariant: curr - start <= width
|
||||
if (next - start > width) {
|
||||
end = (curr > start) ? curr : next; // derive end <= length-2
|
||||
result += '\n' + line.slice(start, end);
|
||||
// skip the space that was output as \n
|
||||
start = end + 1; // derive start <= length-1
|
||||
}
|
||||
curr = next;
|
||||
}
|
||||
|
||||
// By the invariants, start <= length-1, so there is something left over.
|
||||
// It is either the whole string or a part starting from non-whitespace.
|
||||
result += '\n';
|
||||
// Insert a break if the remainder is too long and there is a break available.
|
||||
if (line.length - start > width && curr > start) {
|
||||
result += line.slice(start, curr) + '\n' + line.slice(curr + 1);
|
||||
} else {
|
||||
result += line.slice(start);
|
||||
}
|
||||
|
||||
return result.slice(1); // drop extra \n joiner
|
||||
}
|
||||
|
||||
// Escapes a double-quoted string.
|
||||
function escapeString(string) {
|
||||
var result = '';
|
||||
var char = 0;
|
||||
var escapeSeq;
|
||||
|
||||
for (var i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) {
|
||||
char = codePointAt(string, i);
|
||||
escapeSeq = ESCAPE_SEQUENCES[char];
|
||||
|
||||
if (!escapeSeq && isPrintable(char)) {
|
||||
result += string[i];
|
||||
if (char >= 0x10000) result += string[i + 1];
|
||||
} else {
|
||||
result += escapeSeq || encodeHex(char);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function writeFlowSequence(state, level, object) {
|
||||
var _result = '',
|
||||
_tag = state.tag,
|
||||
index,
|
||||
length,
|
||||
value;
|
||||
|
||||
for (index = 0, length = object.length; index < length; index += 1) {
|
||||
value = object[index];
|
||||
|
||||
if (state.replacer) {
|
||||
value = state.replacer.call(object, String(index), value);
|
||||
}
|
||||
|
||||
// Write only valid elements, put null instead of invalid elements.
|
||||
if (writeNode(state, level, value, false, false) ||
|
||||
(typeof value === 'undefined' &&
|
||||
writeNode(state, level, null, false, false))) {
|
||||
|
||||
if (_result !== '') _result += ',' + (!state.condenseFlow ? ' ' : '');
|
||||
_result += state.dump;
|
||||
}
|
||||
}
|
||||
|
||||
state.tag = _tag;
|
||||
state.dump = '[' + _result + ']';
|
||||
}
|
||||
|
||||
function writeBlockSequence(state, level, object, compact) {
|
||||
var _result = '',
|
||||
_tag = state.tag,
|
||||
index,
|
||||
length,
|
||||
value;
|
||||
|
||||
for (index = 0, length = object.length; index < length; index += 1) {
|
||||
value = object[index];
|
||||
|
||||
if (state.replacer) {
|
||||
value = state.replacer.call(object, String(index), value);
|
||||
}
|
||||
|
||||
// Write only valid elements, put null instead of invalid elements.
|
||||
if (writeNode(state, level + 1, value, true, true, false, true) ||
|
||||
(typeof value === 'undefined' &&
|
||||
writeNode(state, level + 1, null, true, true, false, true))) {
|
||||
|
||||
if (!compact || _result !== '') {
|
||||
_result += generateNextLine(state, level);
|
||||
}
|
||||
|
||||
if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
|
||||
_result += '-';
|
||||
} else {
|
||||
_result += '- ';
|
||||
}
|
||||
|
||||
_result += state.dump;
|
||||
}
|
||||
}
|
||||
|
||||
state.tag = _tag;
|
||||
state.dump = _result || '[]'; // Empty sequence if no valid values.
|
||||
}
|
||||
|
||||
function writeFlowMapping(state, level, object) {
|
||||
var _result = '',
|
||||
_tag = state.tag,
|
||||
objectKeyList = Object.keys(object),
|
||||
index,
|
||||
length,
|
||||
objectKey,
|
||||
objectValue,
|
||||
pairBuffer;
|
||||
|
||||
for (index = 0, length = objectKeyList.length; index < length; index += 1) {
|
||||
|
||||
pairBuffer = '';
|
||||
if (_result !== '') pairBuffer += ', ';
|
||||
|
||||
if (state.condenseFlow) pairBuffer += '"';
|
||||
|
||||
objectKey = objectKeyList[index];
|
||||
objectValue = object[objectKey];
|
||||
|
||||
if (state.replacer) {
|
||||
objectValue = state.replacer.call(object, objectKey, objectValue);
|
||||
}
|
||||
|
||||
if (!writeNode(state, level, objectKey, false, false)) {
|
||||
continue; // Skip this pair because of invalid key;
|
||||
}
|
||||
|
||||
if (state.dump.length > 1024) pairBuffer += '? ';
|
||||
|
||||
pairBuffer += state.dump + (state.condenseFlow ? '"' : '') + ':' + (state.condenseFlow ? '' : ' ');
|
||||
|
||||
if (!writeNode(state, level, objectValue, false, false)) {
|
||||
continue; // Skip this pair because of invalid value.
|
||||
}
|
||||
|
||||
pairBuffer += state.dump;
|
||||
|
||||
// Both key and value are valid.
|
||||
_result += pairBuffer;
|
||||
}
|
||||
|
||||
state.tag = _tag;
|
||||
state.dump = '{' + _result + '}';
|
||||
}
|
||||
|
||||
function writeBlockMapping(state, level, object, compact) {
|
||||
var _result = '',
|
||||
_tag = state.tag,
|
||||
objectKeyList = Object.keys(object),
|
||||
index,
|
||||
length,
|
||||
objectKey,
|
||||
objectValue,
|
||||
explicitPair,
|
||||
pairBuffer;
|
||||
|
||||
// Allow sorting keys so that the output file is deterministic
|
||||
if (state.sortKeys === true) {
|
||||
// Default sorting
|
||||
objectKeyList.sort();
|
||||
} else if (typeof state.sortKeys === 'function') {
|
||||
// Custom sort function
|
||||
objectKeyList.sort(state.sortKeys);
|
||||
} else if (state.sortKeys) {
|
||||
// Something is wrong
|
||||
throw new YAMLException('sortKeys must be a boolean or a function');
|
||||
}
|
||||
|
||||
for (index = 0, length = objectKeyList.length; index < length; index += 1) {
|
||||
pairBuffer = '';
|
||||
|
||||
if (!compact || _result !== '') {
|
||||
pairBuffer += generateNextLine(state, level);
|
||||
}
|
||||
|
||||
objectKey = objectKeyList[index];
|
||||
objectValue = object[objectKey];
|
||||
|
||||
if (state.replacer) {
|
||||
objectValue = state.replacer.call(object, objectKey, objectValue);
|
||||
}
|
||||
|
||||
if (!writeNode(state, level + 1, objectKey, true, true, true)) {
|
||||
continue; // Skip this pair because of invalid key.
|
||||
}
|
||||
|
||||
explicitPair = (state.tag !== null && state.tag !== '?') ||
|
||||
(state.dump && state.dump.length > 1024);
|
||||
|
||||
if (explicitPair) {
|
||||
if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
|
||||
pairBuffer += '?';
|
||||
} else {
|
||||
pairBuffer += '? ';
|
||||
}
|
||||
}
|
||||
|
||||
pairBuffer += state.dump;
|
||||
|
||||
if (explicitPair) {
|
||||
pairBuffer += generateNextLine(state, level);
|
||||
}
|
||||
|
||||
if (!writeNode(state, level + 1, objectValue, true, explicitPair)) {
|
||||
continue; // Skip this pair because of invalid value.
|
||||
}
|
||||
|
||||
if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
|
||||
pairBuffer += ':';
|
||||
} else {
|
||||
pairBuffer += ': ';
|
||||
}
|
||||
|
||||
pairBuffer += state.dump;
|
||||
|
||||
// Both key and value are valid.
|
||||
_result += pairBuffer;
|
||||
}
|
||||
|
||||
state.tag = _tag;
|
||||
state.dump = _result || '{}'; // Empty mapping if no valid pairs.
|
||||
}
|
||||
|
||||
function detectType(state, object, explicit) {
|
||||
var _result, typeList, index, length, type, style;
|
||||
|
||||
typeList = explicit ? state.explicitTypes : state.implicitTypes;
|
||||
|
||||
for (index = 0, length = typeList.length; index < length; index += 1) {
|
||||
type = typeList[index];
|
||||
|
||||
if ((type.instanceOf || type.predicate) &&
|
||||
(!type.instanceOf || ((typeof object === 'object') && (object instanceof type.instanceOf))) &&
|
||||
(!type.predicate || type.predicate(object))) {
|
||||
|
||||
if (explicit) {
|
||||
if (type.multi && type.representName) {
|
||||
state.tag = type.representName(object);
|
||||
} else {
|
||||
state.tag = type.tag;
|
||||
}
|
||||
} else {
|
||||
state.tag = '?';
|
||||
}
|
||||
|
||||
if (type.represent) {
|
||||
style = state.styleMap[type.tag] || type.defaultStyle;
|
||||
|
||||
if (_toString.call(type.represent) === '[object Function]') {
|
||||
_result = type.represent(object, style);
|
||||
} else if (_hasOwnProperty.call(type.represent, style)) {
|
||||
_result = type.represent[style](object, style);
|
||||
} else {
|
||||
throw new YAMLException('!<' + type.tag + '> tag resolver accepts not "' + style + '" style');
|
||||
}
|
||||
|
||||
state.dump = _result;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Serializes `object` and writes it to global `result`.
|
||||
// Returns true on success, or false on invalid object.
|
||||
//
|
||||
function writeNode(state, level, object, block, compact, iskey, isblockseq) {
|
||||
state.tag = null;
|
||||
state.dump = object;
|
||||
|
||||
if (!detectType(state, object, false)) {
|
||||
detectType(state, object, true);
|
||||
}
|
||||
|
||||
var type = _toString.call(state.dump);
|
||||
var inblock = block;
|
||||
var tagStr;
|
||||
|
||||
if (block) {
|
||||
block = (state.flowLevel < 0 || state.flowLevel > level);
|
||||
}
|
||||
|
||||
var objectOrArray = type === '[object Object]' || type === '[object Array]',
|
||||
duplicateIndex,
|
||||
duplicate;
|
||||
|
||||
if (objectOrArray) {
|
||||
duplicateIndex = state.duplicates.indexOf(object);
|
||||
duplicate = duplicateIndex !== -1;
|
||||
}
|
||||
|
||||
if ((state.tag !== null && state.tag !== '?') || duplicate || (state.indent !== 2 && level > 0)) {
|
||||
compact = false;
|
||||
}
|
||||
|
||||
if (duplicate && state.usedDuplicates[duplicateIndex]) {
|
||||
state.dump = '*ref_' + duplicateIndex;
|
||||
} else {
|
||||
if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) {
|
||||
state.usedDuplicates[duplicateIndex] = true;
|
||||
}
|
||||
if (type === '[object Object]') {
|
||||
if (block && (Object.keys(state.dump).length !== 0)) {
|
||||
writeBlockMapping(state, level, state.dump, compact);
|
||||
if (duplicate) {
|
||||
state.dump = '&ref_' + duplicateIndex + state.dump;
|
||||
}
|
||||
} else {
|
||||
writeFlowMapping(state, level, state.dump);
|
||||
if (duplicate) {
|
||||
state.dump = '&ref_' + duplicateIndex + ' ' + state.dump;
|
||||
}
|
||||
}
|
||||
} else if (type === '[object Array]') {
|
||||
if (block && (state.dump.length !== 0)) {
|
||||
if (state.noArrayIndent && !isblockseq && level > 0) {
|
||||
writeBlockSequence(state, level - 1, state.dump, compact);
|
||||
} else {
|
||||
writeBlockSequence(state, level, state.dump, compact);
|
||||
}
|
||||
if (duplicate) {
|
||||
state.dump = '&ref_' + duplicateIndex + state.dump;
|
||||
}
|
||||
} else {
|
||||
writeFlowSequence(state, level, state.dump);
|
||||
if (duplicate) {
|
||||
state.dump = '&ref_' + duplicateIndex + ' ' + state.dump;
|
||||
}
|
||||
}
|
||||
} else if (type === '[object String]') {
|
||||
if (state.tag !== '?') {
|
||||
writeScalar(state, state.dump, level, iskey, inblock);
|
||||
}
|
||||
} else if (type === '[object Undefined]') {
|
||||
return false;
|
||||
} else {
|
||||
if (state.skipInvalid) return false;
|
||||
throw new YAMLException('unacceptable kind of an object to dump ' + type);
|
||||
}
|
||||
|
||||
if (state.tag !== null && state.tag !== '?') {
|
||||
// Need to encode all characters except those allowed by the spec:
|
||||
//
|
||||
// [35] ns-dec-digit ::= [#x30-#x39] /* 0-9 */
|
||||
// [36] ns-hex-digit ::= ns-dec-digit
|
||||
// | [#x41-#x46] /* A-F */ | [#x61-#x66] /* a-f */
|
||||
// [37] ns-ascii-letter ::= [#x41-#x5A] /* A-Z */ | [#x61-#x7A] /* a-z */
|
||||
// [38] ns-word-char ::= ns-dec-digit | ns-ascii-letter | “-”
|
||||
// [39] ns-uri-char ::= “%” ns-hex-digit ns-hex-digit | ns-word-char | “#”
|
||||
// | “;” | “/” | “?” | “:” | “@” | “&” | “=” | “+” | “$” | “,”
|
||||
// | “_” | “.” | “!” | “~” | “*” | “'” | “(” | “)” | “[” | “]”
|
||||
//
|
||||
// Also need to encode '!' because it has special meaning (end of tag prefix).
|
||||
//
|
||||
tagStr = encodeURI(
|
||||
state.tag[0] === '!' ? state.tag.slice(1) : state.tag
|
||||
).replace(/!/g, '%21');
|
||||
|
||||
if (state.tag[0] === '!') {
|
||||
tagStr = '!' + tagStr;
|
||||
} else if (tagStr.slice(0, 18) === 'tag:yaml.org,2002:') {
|
||||
tagStr = '!!' + tagStr.slice(18);
|
||||
} else {
|
||||
tagStr = '!<' + tagStr + '>';
|
||||
}
|
||||
|
||||
state.dump = tagStr + ' ' + state.dump;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function getDuplicateReferences(object, state) {
|
||||
var objects = [],
|
||||
duplicatesIndexes = [],
|
||||
index,
|
||||
length;
|
||||
|
||||
inspectNode(object, objects, duplicatesIndexes);
|
||||
|
||||
for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) {
|
||||
state.duplicates.push(objects[duplicatesIndexes[index]]);
|
||||
}
|
||||
state.usedDuplicates = new Array(length);
|
||||
}
|
||||
|
||||
function inspectNode(object, objects, duplicatesIndexes) {
|
||||
var objectKeyList,
|
||||
index,
|
||||
length;
|
||||
|
||||
if (object !== null && typeof object === 'object') {
|
||||
index = objects.indexOf(object);
|
||||
if (index !== -1) {
|
||||
if (duplicatesIndexes.indexOf(index) === -1) {
|
||||
duplicatesIndexes.push(index);
|
||||
}
|
||||
} else {
|
||||
objects.push(object);
|
||||
|
||||
if (Array.isArray(object)) {
|
||||
for (index = 0, length = object.length; index < length; index += 1) {
|
||||
inspectNode(object[index], objects, duplicatesIndexes);
|
||||
}
|
||||
} else {
|
||||
objectKeyList = Object.keys(object);
|
||||
|
||||
for (index = 0, length = objectKeyList.length; index < length; index += 1) {
|
||||
inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function dump(input, options) {
|
||||
options = options || {};
|
||||
|
||||
var state = new State(options);
|
||||
|
||||
if (!state.noRefs) getDuplicateReferences(input, state);
|
||||
|
||||
var value = input;
|
||||
|
||||
if (state.replacer) {
|
||||
value = state.replacer.call({ '': value }, '', value);
|
||||
}
|
||||
|
||||
if (writeNode(state, 0, value, true, true)) return state.dump + '\n';
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
module.exports.dump = dump;
|
55
my-app/node_modules/cosmiconfig/node_modules/js-yaml/lib/exception.js
generated
vendored
Executable file
55
my-app/node_modules/cosmiconfig/node_modules/js-yaml/lib/exception.js
generated
vendored
Executable file
|
@ -0,0 +1,55 @@
|
|||
// YAML error class. http://stackoverflow.com/questions/8458984
|
||||
//
|
||||
'use strict';
|
||||
|
||||
|
||||
function formatError(exception, compact) {
|
||||
var where = '', message = exception.reason || '(unknown reason)';
|
||||
|
||||
if (!exception.mark) return message;
|
||||
|
||||
if (exception.mark.name) {
|
||||
where += 'in "' + exception.mark.name + '" ';
|
||||
}
|
||||
|
||||
where += '(' + (exception.mark.line + 1) + ':' + (exception.mark.column + 1) + ')';
|
||||
|
||||
if (!compact && exception.mark.snippet) {
|
||||
where += '\n\n' + exception.mark.snippet;
|
||||
}
|
||||
|
||||
return message + ' ' + where;
|
||||
}
|
||||
|
||||
|
||||
function YAMLException(reason, mark) {
|
||||
// Super constructor
|
||||
Error.call(this);
|
||||
|
||||
this.name = 'YAMLException';
|
||||
this.reason = reason;
|
||||
this.mark = mark;
|
||||
this.message = formatError(this, false);
|
||||
|
||||
// Include stack trace in error object
|
||||
if (Error.captureStackTrace) {
|
||||
// Chrome and NodeJS
|
||||
Error.captureStackTrace(this, this.constructor);
|
||||
} else {
|
||||
// FF, IE 10+ and Safari 6+. Fallback for others
|
||||
this.stack = (new Error()).stack || '';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Inherit from Error
|
||||
YAMLException.prototype = Object.create(Error.prototype);
|
||||
YAMLException.prototype.constructor = YAMLException;
|
||||
|
||||
|
||||
YAMLException.prototype.toString = function toString(compact) {
|
||||
return this.name + ': ' + formatError(this, compact);
|
||||
};
|
||||
|
||||
|
||||
module.exports = YAMLException;
|
1727
my-app/node_modules/cosmiconfig/node_modules/js-yaml/lib/loader.js
generated
vendored
Executable file
1727
my-app/node_modules/cosmiconfig/node_modules/js-yaml/lib/loader.js
generated
vendored
Executable file
File diff suppressed because it is too large
Load diff
121
my-app/node_modules/cosmiconfig/node_modules/js-yaml/lib/schema.js
generated
vendored
Executable file
121
my-app/node_modules/cosmiconfig/node_modules/js-yaml/lib/schema.js
generated
vendored
Executable file
|
@ -0,0 +1,121 @@
|
|||
'use strict';
|
||||
|
||||
/*eslint-disable max-len*/
|
||||
|
||||
var YAMLException = require('./exception');
|
||||
var Type = require('./type');
|
||||
|
||||
|
||||
function compileList(schema, name) {
|
||||
var result = [];
|
||||
|
||||
schema[name].forEach(function (currentType) {
|
||||
var newIndex = result.length;
|
||||
|
||||
result.forEach(function (previousType, previousIndex) {
|
||||
if (previousType.tag === currentType.tag &&
|
||||
previousType.kind === currentType.kind &&
|
||||
previousType.multi === currentType.multi) {
|
||||
|
||||
newIndex = previousIndex;
|
||||
}
|
||||
});
|
||||
|
||||
result[newIndex] = currentType;
|
||||
});
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
function compileMap(/* lists... */) {
|
||||
var result = {
|
||||
scalar: {},
|
||||
sequence: {},
|
||||
mapping: {},
|
||||
fallback: {},
|
||||
multi: {
|
||||
scalar: [],
|
||||
sequence: [],
|
||||
mapping: [],
|
||||
fallback: []
|
||||
}
|
||||
}, index, length;
|
||||
|
||||
function collectType(type) {
|
||||
if (type.multi) {
|
||||
result.multi[type.kind].push(type);
|
||||
result.multi['fallback'].push(type);
|
||||
} else {
|
||||
result[type.kind][type.tag] = result['fallback'][type.tag] = type;
|
||||
}
|
||||
}
|
||||
|
||||
for (index = 0, length = arguments.length; index < length; index += 1) {
|
||||
arguments[index].forEach(collectType);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
function Schema(definition) {
|
||||
return this.extend(definition);
|
||||
}
|
||||
|
||||
|
||||
Schema.prototype.extend = function extend(definition) {
|
||||
var implicit = [];
|
||||
var explicit = [];
|
||||
|
||||
if (definition instanceof Type) {
|
||||
// Schema.extend(type)
|
||||
explicit.push(definition);
|
||||
|
||||
} else if (Array.isArray(definition)) {
|
||||
// Schema.extend([ type1, type2, ... ])
|
||||
explicit = explicit.concat(definition);
|
||||
|
||||
} else if (definition && (Array.isArray(definition.implicit) || Array.isArray(definition.explicit))) {
|
||||
// Schema.extend({ explicit: [ type1, type2, ... ], implicit: [ type1, type2, ... ] })
|
||||
if (definition.implicit) implicit = implicit.concat(definition.implicit);
|
||||
if (definition.explicit) explicit = explicit.concat(definition.explicit);
|
||||
|
||||
} else {
|
||||
throw new YAMLException('Schema.extend argument should be a Type, [ Type ], ' +
|
||||
'or a schema definition ({ implicit: [...], explicit: [...] })');
|
||||
}
|
||||
|
||||
implicit.forEach(function (type) {
|
||||
if (!(type instanceof Type)) {
|
||||
throw new YAMLException('Specified list of YAML types (or a single Type object) contains a non-Type object.');
|
||||
}
|
||||
|
||||
if (type.loadKind && type.loadKind !== 'scalar') {
|
||||
throw new YAMLException('There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.');
|
||||
}
|
||||
|
||||
if (type.multi) {
|
||||
throw new YAMLException('There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.');
|
||||
}
|
||||
});
|
||||
|
||||
explicit.forEach(function (type) {
|
||||
if (!(type instanceof Type)) {
|
||||
throw new YAMLException('Specified list of YAML types (or a single Type object) contains a non-Type object.');
|
||||
}
|
||||
});
|
||||
|
||||
var result = Object.create(Schema.prototype);
|
||||
|
||||
result.implicit = (this.implicit || []).concat(implicit);
|
||||
result.explicit = (this.explicit || []).concat(explicit);
|
||||
|
||||
result.compiledImplicit = compileList(result, 'implicit');
|
||||
result.compiledExplicit = compileList(result, 'explicit');
|
||||
result.compiledTypeMap = compileMap(result.compiledImplicit, result.compiledExplicit);
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
|
||||
module.exports = Schema;
|
11
my-app/node_modules/cosmiconfig/node_modules/js-yaml/lib/schema/core.js
generated
vendored
Executable file
11
my-app/node_modules/cosmiconfig/node_modules/js-yaml/lib/schema/core.js
generated
vendored
Executable file
|
@ -0,0 +1,11 @@
|
|||
// Standard YAML's Core schema.
|
||||
// http://www.yaml.org/spec/1.2/spec.html#id2804923
|
||||
//
|
||||
// NOTE: JS-YAML does not support schema-specific tag resolution restrictions.
|
||||
// So, Core schema has no distinctions from JSON schema is JS-YAML.
|
||||
|
||||
|
||||
'use strict';
|
||||
|
||||
|
||||
module.exports = require('./json');
|
22
my-app/node_modules/cosmiconfig/node_modules/js-yaml/lib/schema/default.js
generated
vendored
Executable file
22
my-app/node_modules/cosmiconfig/node_modules/js-yaml/lib/schema/default.js
generated
vendored
Executable file
|
@ -0,0 +1,22 @@
|
|||
// JS-YAML's default schema for `safeLoad` function.
|
||||
// It is not described in the YAML specification.
|
||||
//
|
||||
// This schema is based on standard YAML's Core schema and includes most of
|
||||
// extra types described at YAML tag repository. (http://yaml.org/type/)
|
||||
|
||||
|
||||
'use strict';
|
||||
|
||||
|
||||
module.exports = require('./core').extend({
|
||||
implicit: [
|
||||
require('../type/timestamp'),
|
||||
require('../type/merge')
|
||||
],
|
||||
explicit: [
|
||||
require('../type/binary'),
|
||||
require('../type/omap'),
|
||||
require('../type/pairs'),
|
||||
require('../type/set')
|
||||
]
|
||||
});
|
17
my-app/node_modules/cosmiconfig/node_modules/js-yaml/lib/schema/failsafe.js
generated
vendored
Executable file
17
my-app/node_modules/cosmiconfig/node_modules/js-yaml/lib/schema/failsafe.js
generated
vendored
Executable file
|
@ -0,0 +1,17 @@
|
|||
// Standard YAML's Failsafe schema.
|
||||
// http://www.yaml.org/spec/1.2/spec.html#id2802346
|
||||
|
||||
|
||||
'use strict';
|
||||
|
||||
|
||||
var Schema = require('../schema');
|
||||
|
||||
|
||||
module.exports = new Schema({
|
||||
explicit: [
|
||||
require('../type/str'),
|
||||
require('../type/seq'),
|
||||
require('../type/map')
|
||||
]
|
||||
});
|
19
my-app/node_modules/cosmiconfig/node_modules/js-yaml/lib/schema/json.js
generated
vendored
Executable file
19
my-app/node_modules/cosmiconfig/node_modules/js-yaml/lib/schema/json.js
generated
vendored
Executable file
|
@ -0,0 +1,19 @@
|
|||
// Standard YAML's JSON schema.
|
||||
// http://www.yaml.org/spec/1.2/spec.html#id2803231
|
||||
//
|
||||
// NOTE: JS-YAML does not support schema-specific tag resolution restrictions.
|
||||
// So, this schema is not such strict as defined in the YAML specification.
|
||||
// It allows numbers in binary notaion, use `Null` and `NULL` as `null`, etc.
|
||||
|
||||
|
||||
'use strict';
|
||||
|
||||
|
||||
module.exports = require('./failsafe').extend({
|
||||
implicit: [
|
||||
require('../type/null'),
|
||||
require('../type/bool'),
|
||||
require('../type/int'),
|
||||
require('../type/float')
|
||||
]
|
||||
});
|
101
my-app/node_modules/cosmiconfig/node_modules/js-yaml/lib/snippet.js
generated
vendored
Executable file
101
my-app/node_modules/cosmiconfig/node_modules/js-yaml/lib/snippet.js
generated
vendored
Executable file
|
@ -0,0 +1,101 @@
|
|||
'use strict';
|
||||
|
||||
|
||||
var common = require('./common');
|
||||
|
||||
|
||||
// get snippet for a single line, respecting maxLength
|
||||
function getLine(buffer, lineStart, lineEnd, position, maxLineLength) {
|
||||
var head = '';
|
||||
var tail = '';
|
||||
var maxHalfLength = Math.floor(maxLineLength / 2) - 1;
|
||||
|
||||
if (position - lineStart > maxHalfLength) {
|
||||
head = ' ... ';
|
||||
lineStart = position - maxHalfLength + head.length;
|
||||
}
|
||||
|
||||
if (lineEnd - position > maxHalfLength) {
|
||||
tail = ' ...';
|
||||
lineEnd = position + maxHalfLength - tail.length;
|
||||
}
|
||||
|
||||
return {
|
||||
str: head + buffer.slice(lineStart, lineEnd).replace(/\t/g, '→') + tail,
|
||||
pos: position - lineStart + head.length // relative position
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
function padStart(string, max) {
|
||||
return common.repeat(' ', max - string.length) + string;
|
||||
}
|
||||
|
||||
|
||||
function makeSnippet(mark, options) {
|
||||
options = Object.create(options || null);
|
||||
|
||||
if (!mark.buffer) return null;
|
||||
|
||||
if (!options.maxLength) options.maxLength = 79;
|
||||
if (typeof options.indent !== 'number') options.indent = 1;
|
||||
if (typeof options.linesBefore !== 'number') options.linesBefore = 3;
|
||||
if (typeof options.linesAfter !== 'number') options.linesAfter = 2;
|
||||
|
||||
var re = /\r?\n|\r|\0/g;
|
||||
var lineStarts = [ 0 ];
|
||||
var lineEnds = [];
|
||||
var match;
|
||||
var foundLineNo = -1;
|
||||
|
||||
while ((match = re.exec(mark.buffer))) {
|
||||
lineEnds.push(match.index);
|
||||
lineStarts.push(match.index + match[0].length);
|
||||
|
||||
if (mark.position <= match.index && foundLineNo < 0) {
|
||||
foundLineNo = lineStarts.length - 2;
|
||||
}
|
||||
}
|
||||
|
||||
if (foundLineNo < 0) foundLineNo = lineStarts.length - 1;
|
||||
|
||||
var result = '', i, line;
|
||||
var lineNoLength = Math.min(mark.line + options.linesAfter, lineEnds.length).toString().length;
|
||||
var maxLineLength = options.maxLength - (options.indent + lineNoLength + 3);
|
||||
|
||||
for (i = 1; i <= options.linesBefore; i++) {
|
||||
if (foundLineNo - i < 0) break;
|
||||
line = getLine(
|
||||
mark.buffer,
|
||||
lineStarts[foundLineNo - i],
|
||||
lineEnds[foundLineNo - i],
|
||||
mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo - i]),
|
||||
maxLineLength
|
||||
);
|
||||
result = common.repeat(' ', options.indent) + padStart((mark.line - i + 1).toString(), lineNoLength) +
|
||||
' | ' + line.str + '\n' + result;
|
||||
}
|
||||
|
||||
line = getLine(mark.buffer, lineStarts[foundLineNo], lineEnds[foundLineNo], mark.position, maxLineLength);
|
||||
result += common.repeat(' ', options.indent) + padStart((mark.line + 1).toString(), lineNoLength) +
|
||||
' | ' + line.str + '\n';
|
||||
result += common.repeat('-', options.indent + lineNoLength + 3 + line.pos) + '^' + '\n';
|
||||
|
||||
for (i = 1; i <= options.linesAfter; i++) {
|
||||
if (foundLineNo + i >= lineEnds.length) break;
|
||||
line = getLine(
|
||||
mark.buffer,
|
||||
lineStarts[foundLineNo + i],
|
||||
lineEnds[foundLineNo + i],
|
||||
mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo + i]),
|
||||
maxLineLength
|
||||
);
|
||||
result += common.repeat(' ', options.indent) + padStart((mark.line + i + 1).toString(), lineNoLength) +
|
||||
' | ' + line.str + '\n';
|
||||
}
|
||||
|
||||
return result.replace(/\n$/, '');
|
||||
}
|
||||
|
||||
|
||||
module.exports = makeSnippet;
|
66
my-app/node_modules/cosmiconfig/node_modules/js-yaml/lib/type.js
generated
vendored
Executable file
66
my-app/node_modules/cosmiconfig/node_modules/js-yaml/lib/type.js
generated
vendored
Executable file
|
@ -0,0 +1,66 @@
|
|||
'use strict';
|
||||
|
||||
var YAMLException = require('./exception');
|
||||
|
||||
var TYPE_CONSTRUCTOR_OPTIONS = [
|
||||
'kind',
|
||||
'multi',
|
||||
'resolve',
|
||||
'construct',
|
||||
'instanceOf',
|
||||
'predicate',
|
||||
'represent',
|
||||
'representName',
|
||||
'defaultStyle',
|
||||
'styleAliases'
|
||||
];
|
||||
|
||||
var YAML_NODE_KINDS = [
|
||||
'scalar',
|
||||
'sequence',
|
||||
'mapping'
|
||||
];
|
||||
|
||||
function compileStyleAliases(map) {
|
||||
var result = {};
|
||||
|
||||
if (map !== null) {
|
||||
Object.keys(map).forEach(function (style) {
|
||||
map[style].forEach(function (alias) {
|
||||
result[String(alias)] = style;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function Type(tag, options) {
|
||||
options = options || {};
|
||||
|
||||
Object.keys(options).forEach(function (name) {
|
||||
if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) {
|
||||
throw new YAMLException('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.');
|
||||
}
|
||||
});
|
||||
|
||||
// TODO: Add tag format check.
|
||||
this.options = options; // keep original options in case user wants to extend this type later
|
||||
this.tag = tag;
|
||||
this.kind = options['kind'] || null;
|
||||
this.resolve = options['resolve'] || function () { return true; };
|
||||
this.construct = options['construct'] || function (data) { return data; };
|
||||
this.instanceOf = options['instanceOf'] || null;
|
||||
this.predicate = options['predicate'] || null;
|
||||
this.represent = options['represent'] || null;
|
||||
this.representName = options['representName'] || null;
|
||||
this.defaultStyle = options['defaultStyle'] || null;
|
||||
this.multi = options['multi'] || false;
|
||||
this.styleAliases = compileStyleAliases(options['styleAliases'] || null);
|
||||
|
||||
if (YAML_NODE_KINDS.indexOf(this.kind) === -1) {
|
||||
throw new YAMLException('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.');
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Type;
|
125
my-app/node_modules/cosmiconfig/node_modules/js-yaml/lib/type/binary.js
generated
vendored
Executable file
125
my-app/node_modules/cosmiconfig/node_modules/js-yaml/lib/type/binary.js
generated
vendored
Executable file
|
@ -0,0 +1,125 @@
|
|||
'use strict';
|
||||
|
||||
/*eslint-disable no-bitwise*/
|
||||
|
||||
|
||||
var Type = require('../type');
|
||||
|
||||
|
||||
// [ 64, 65, 66 ] -> [ padding, CR, LF ]
|
||||
var BASE64_MAP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r';
|
||||
|
||||
|
||||
function resolveYamlBinary(data) {
|
||||
if (data === null) return false;
|
||||
|
||||
var code, idx, bitlen = 0, max = data.length, map = BASE64_MAP;
|
||||
|
||||
// Convert one by one.
|
||||
for (idx = 0; idx < max; idx++) {
|
||||
code = map.indexOf(data.charAt(idx));
|
||||
|
||||
// Skip CR/LF
|
||||
if (code > 64) continue;
|
||||
|
||||
// Fail on illegal characters
|
||||
if (code < 0) return false;
|
||||
|
||||
bitlen += 6;
|
||||
}
|
||||
|
||||
// If there are any bits left, source was corrupted
|
||||
return (bitlen % 8) === 0;
|
||||
}
|
||||
|
||||
function constructYamlBinary(data) {
|
||||
var idx, tailbits,
|
||||
input = data.replace(/[\r\n=]/g, ''), // remove CR/LF & padding to simplify scan
|
||||
max = input.length,
|
||||
map = BASE64_MAP,
|
||||
bits = 0,
|
||||
result = [];
|
||||
|
||||
// Collect by 6*4 bits (3 bytes)
|
||||
|
||||
for (idx = 0; idx < max; idx++) {
|
||||
if ((idx % 4 === 0) && idx) {
|
||||
result.push((bits >> 16) & 0xFF);
|
||||
result.push((bits >> 8) & 0xFF);
|
||||
result.push(bits & 0xFF);
|
||||
}
|
||||
|
||||
bits = (bits << 6) | map.indexOf(input.charAt(idx));
|
||||
}
|
||||
|
||||
// Dump tail
|
||||
|
||||
tailbits = (max % 4) * 6;
|
||||
|
||||
if (tailbits === 0) {
|
||||
result.push((bits >> 16) & 0xFF);
|
||||
result.push((bits >> 8) & 0xFF);
|
||||
result.push(bits & 0xFF);
|
||||
} else if (tailbits === 18) {
|
||||
result.push((bits >> 10) & 0xFF);
|
||||
result.push((bits >> 2) & 0xFF);
|
||||
} else if (tailbits === 12) {
|
||||
result.push((bits >> 4) & 0xFF);
|
||||
}
|
||||
|
||||
return new Uint8Array(result);
|
||||
}
|
||||
|
||||
function representYamlBinary(object /*, style*/) {
|
||||
var result = '', bits = 0, idx, tail,
|
||||
max = object.length,
|
||||
map = BASE64_MAP;
|
||||
|
||||
// Convert every three bytes to 4 ASCII characters.
|
||||
|
||||
for (idx = 0; idx < max; idx++) {
|
||||
if ((idx % 3 === 0) && idx) {
|
||||
result += map[(bits >> 18) & 0x3F];
|
||||
result += map[(bits >> 12) & 0x3F];
|
||||
result += map[(bits >> 6) & 0x3F];
|
||||
result += map[bits & 0x3F];
|
||||
}
|
||||
|
||||
bits = (bits << 8) + object[idx];
|
||||
}
|
||||
|
||||
// Dump tail
|
||||
|
||||
tail = max % 3;
|
||||
|
||||
if (tail === 0) {
|
||||
result += map[(bits >> 18) & 0x3F];
|
||||
result += map[(bits >> 12) & 0x3F];
|
||||
result += map[(bits >> 6) & 0x3F];
|
||||
result += map[bits & 0x3F];
|
||||
} else if (tail === 2) {
|
||||
result += map[(bits >> 10) & 0x3F];
|
||||
result += map[(bits >> 4) & 0x3F];
|
||||
result += map[(bits << 2) & 0x3F];
|
||||
result += map[64];
|
||||
} else if (tail === 1) {
|
||||
result += map[(bits >> 2) & 0x3F];
|
||||
result += map[(bits << 4) & 0x3F];
|
||||
result += map[64];
|
||||
result += map[64];
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function isBinary(obj) {
|
||||
return Object.prototype.toString.call(obj) === '[object Uint8Array]';
|
||||
}
|
||||
|
||||
module.exports = new Type('tag:yaml.org,2002:binary', {
|
||||
kind: 'scalar',
|
||||
resolve: resolveYamlBinary,
|
||||
construct: constructYamlBinary,
|
||||
predicate: isBinary,
|
||||
represent: representYamlBinary
|
||||
});
|
35
my-app/node_modules/cosmiconfig/node_modules/js-yaml/lib/type/bool.js
generated
vendored
Executable file
35
my-app/node_modules/cosmiconfig/node_modules/js-yaml/lib/type/bool.js
generated
vendored
Executable file
|
@ -0,0 +1,35 @@
|
|||
'use strict';
|
||||
|
||||
var Type = require('../type');
|
||||
|
||||
function resolveYamlBoolean(data) {
|
||||
if (data === null) return false;
|
||||
|
||||
var max = data.length;
|
||||
|
||||
return (max === 4 && (data === 'true' || data === 'True' || data === 'TRUE')) ||
|
||||
(max === 5 && (data === 'false' || data === 'False' || data === 'FALSE'));
|
||||
}
|
||||
|
||||
function constructYamlBoolean(data) {
|
||||
return data === 'true' ||
|
||||
data === 'True' ||
|
||||
data === 'TRUE';
|
||||
}
|
||||
|
||||
function isBoolean(object) {
|
||||
return Object.prototype.toString.call(object) === '[object Boolean]';
|
||||
}
|
||||
|
||||
module.exports = new Type('tag:yaml.org,2002:bool', {
|
||||
kind: 'scalar',
|
||||
resolve: resolveYamlBoolean,
|
||||
construct: constructYamlBoolean,
|
||||
predicate: isBoolean,
|
||||
represent: {
|
||||
lowercase: function (object) { return object ? 'true' : 'false'; },
|
||||
uppercase: function (object) { return object ? 'TRUE' : 'FALSE'; },
|
||||
camelcase: function (object) { return object ? 'True' : 'False'; }
|
||||
},
|
||||
defaultStyle: 'lowercase'
|
||||
});
|
97
my-app/node_modules/cosmiconfig/node_modules/js-yaml/lib/type/float.js
generated
vendored
Executable file
97
my-app/node_modules/cosmiconfig/node_modules/js-yaml/lib/type/float.js
generated
vendored
Executable file
|
@ -0,0 +1,97 @@
|
|||
'use strict';
|
||||
|
||||
var common = require('../common');
|
||||
var Type = require('../type');
|
||||
|
||||
var YAML_FLOAT_PATTERN = new RegExp(
|
||||
// 2.5e4, 2.5 and integers
|
||||
'^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?' +
|
||||
// .2e4, .2
|
||||
// special case, seems not from spec
|
||||
'|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?' +
|
||||
// .inf
|
||||
'|[-+]?\\.(?:inf|Inf|INF)' +
|
||||
// .nan
|
||||
'|\\.(?:nan|NaN|NAN))$');
|
||||
|
||||
function resolveYamlFloat(data) {
|
||||
if (data === null) return false;
|
||||
|
||||
if (!YAML_FLOAT_PATTERN.test(data) ||
|
||||
// Quick hack to not allow integers end with `_`
|
||||
// Probably should update regexp & check speed
|
||||
data[data.length - 1] === '_') {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function constructYamlFloat(data) {
|
||||
var value, sign;
|
||||
|
||||
value = data.replace(/_/g, '').toLowerCase();
|
||||
sign = value[0] === '-' ? -1 : 1;
|
||||
|
||||
if ('+-'.indexOf(value[0]) >= 0) {
|
||||
value = value.slice(1);
|
||||
}
|
||||
|
||||
if (value === '.inf') {
|
||||
return (sign === 1) ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
|
||||
|
||||
} else if (value === '.nan') {
|
||||
return NaN;
|
||||
}
|
||||
return sign * parseFloat(value, 10);
|
||||
}
|
||||
|
||||
|
||||
var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/;
|
||||
|
||||
function representYamlFloat(object, style) {
|
||||
var res;
|
||||
|
||||
if (isNaN(object)) {
|
||||
switch (style) {
|
||||
case 'lowercase': return '.nan';
|
||||
case 'uppercase': return '.NAN';
|
||||
case 'camelcase': return '.NaN';
|
||||
}
|
||||
} else if (Number.POSITIVE_INFINITY === object) {
|
||||
switch (style) {
|
||||
case 'lowercase': return '.inf';
|
||||
case 'uppercase': return '.INF';
|
||||
case 'camelcase': return '.Inf';
|
||||
}
|
||||
} else if (Number.NEGATIVE_INFINITY === object) {
|
||||
switch (style) {
|
||||
case 'lowercase': return '-.inf';
|
||||
case 'uppercase': return '-.INF';
|
||||
case 'camelcase': return '-.Inf';
|
||||
}
|
||||
} else if (common.isNegativeZero(object)) {
|
||||
return '-0.0';
|
||||
}
|
||||
|
||||
res = object.toString(10);
|
||||
|
||||
// JS stringifier can build scientific format without dots: 5e-100,
|
||||
// while YAML requres dot: 5.e-100. Fix it with simple hack
|
||||
|
||||
return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace('e', '.e') : res;
|
||||
}
|
||||
|
||||
function isFloat(object) {
|
||||
return (Object.prototype.toString.call(object) === '[object Number]') &&
|
||||
(object % 1 !== 0 || common.isNegativeZero(object));
|
||||
}
|
||||
|
||||
module.exports = new Type('tag:yaml.org,2002:float', {
|
||||
kind: 'scalar',
|
||||
resolve: resolveYamlFloat,
|
||||
construct: constructYamlFloat,
|
||||
predicate: isFloat,
|
||||
represent: representYamlFloat,
|
||||
defaultStyle: 'lowercase'
|
||||
});
|
156
my-app/node_modules/cosmiconfig/node_modules/js-yaml/lib/type/int.js
generated
vendored
Executable file
156
my-app/node_modules/cosmiconfig/node_modules/js-yaml/lib/type/int.js
generated
vendored
Executable file
|
@ -0,0 +1,156 @@
|
|||
'use strict';
|
||||
|
||||
var common = require('../common');
|
||||
var Type = require('../type');
|
||||
|
||||
function isHexCode(c) {
|
||||
return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) ||
|
||||
((0x41/* A */ <= c) && (c <= 0x46/* F */)) ||
|
||||
((0x61/* a */ <= c) && (c <= 0x66/* f */));
|
||||
}
|
||||
|
||||
function isOctCode(c) {
|
||||
return ((0x30/* 0 */ <= c) && (c <= 0x37/* 7 */));
|
||||
}
|
||||
|
||||
function isDecCode(c) {
|
||||
return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */));
|
||||
}
|
||||
|
||||
function resolveYamlInteger(data) {
|
||||
if (data === null) return false;
|
||||
|
||||
var max = data.length,
|
||||
index = 0,
|
||||
hasDigits = false,
|
||||
ch;
|
||||
|
||||
if (!max) return false;
|
||||
|
||||
ch = data[index];
|
||||
|
||||
// sign
|
||||
if (ch === '-' || ch === '+') {
|
||||
ch = data[++index];
|
||||
}
|
||||
|
||||
if (ch === '0') {
|
||||
// 0
|
||||
if (index + 1 === max) return true;
|
||||
ch = data[++index];
|
||||
|
||||
// base 2, base 8, base 16
|
||||
|
||||
if (ch === 'b') {
|
||||
// base 2
|
||||
index++;
|
||||
|
||||
for (; index < max; index++) {
|
||||
ch = data[index];
|
||||
if (ch === '_') continue;
|
||||
if (ch !== '0' && ch !== '1') return false;
|
||||
hasDigits = true;
|
||||
}
|
||||
return hasDigits && ch !== '_';
|
||||
}
|
||||
|
||||
|
||||
if (ch === 'x') {
|
||||
// base 16
|
||||
index++;
|
||||
|
||||
for (; index < max; index++) {
|
||||
ch = data[index];
|
||||
if (ch === '_') continue;
|
||||
if (!isHexCode(data.charCodeAt(index))) return false;
|
||||
hasDigits = true;
|
||||
}
|
||||
return hasDigits && ch !== '_';
|
||||
}
|
||||
|
||||
|
||||
if (ch === 'o') {
|
||||
// base 8
|
||||
index++;
|
||||
|
||||
for (; index < max; index++) {
|
||||
ch = data[index];
|
||||
if (ch === '_') continue;
|
||||
if (!isOctCode(data.charCodeAt(index))) return false;
|
||||
hasDigits = true;
|
||||
}
|
||||
return hasDigits && ch !== '_';
|
||||
}
|
||||
}
|
||||
|
||||
// base 10 (except 0)
|
||||
|
||||
// value should not start with `_`;
|
||||
if (ch === '_') return false;
|
||||
|
||||
for (; index < max; index++) {
|
||||
ch = data[index];
|
||||
if (ch === '_') continue;
|
||||
if (!isDecCode(data.charCodeAt(index))) {
|
||||
return false;
|
||||
}
|
||||
hasDigits = true;
|
||||
}
|
||||
|
||||
// Should have digits and should not end with `_`
|
||||
if (!hasDigits || ch === '_') return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function constructYamlInteger(data) {
|
||||
var value = data, sign = 1, ch;
|
||||
|
||||
if (value.indexOf('_') !== -1) {
|
||||
value = value.replace(/_/g, '');
|
||||
}
|
||||
|
||||
ch = value[0];
|
||||
|
||||
if (ch === '-' || ch === '+') {
|
||||
if (ch === '-') sign = -1;
|
||||
value = value.slice(1);
|
||||
ch = value[0];
|
||||
}
|
||||
|
||||
if (value === '0') return 0;
|
||||
|
||||
if (ch === '0') {
|
||||
if (value[1] === 'b') return sign * parseInt(value.slice(2), 2);
|
||||
if (value[1] === 'x') return sign * parseInt(value.slice(2), 16);
|
||||
if (value[1] === 'o') return sign * parseInt(value.slice(2), 8);
|
||||
}
|
||||
|
||||
return sign * parseInt(value, 10);
|
||||
}
|
||||
|
||||
function isInteger(object) {
|
||||
return (Object.prototype.toString.call(object)) === '[object Number]' &&
|
||||
(object % 1 === 0 && !common.isNegativeZero(object));
|
||||
}
|
||||
|
||||
module.exports = new Type('tag:yaml.org,2002:int', {
|
||||
kind: 'scalar',
|
||||
resolve: resolveYamlInteger,
|
||||
construct: constructYamlInteger,
|
||||
predicate: isInteger,
|
||||
represent: {
|
||||
binary: function (obj) { return obj >= 0 ? '0b' + obj.toString(2) : '-0b' + obj.toString(2).slice(1); },
|
||||
octal: function (obj) { return obj >= 0 ? '0o' + obj.toString(8) : '-0o' + obj.toString(8).slice(1); },
|
||||
decimal: function (obj) { return obj.toString(10); },
|
||||
/* eslint-disable max-len */
|
||||
hexadecimal: function (obj) { return obj >= 0 ? '0x' + obj.toString(16).toUpperCase() : '-0x' + obj.toString(16).toUpperCase().slice(1); }
|
||||
},
|
||||
defaultStyle: 'decimal',
|
||||
styleAliases: {
|
||||
binary: [ 2, 'bin' ],
|
||||
octal: [ 8, 'oct' ],
|
||||
decimal: [ 10, 'dec' ],
|
||||
hexadecimal: [ 16, 'hex' ]
|
||||
}
|
||||
});
|
8
my-app/node_modules/cosmiconfig/node_modules/js-yaml/lib/type/map.js
generated
vendored
Executable file
8
my-app/node_modules/cosmiconfig/node_modules/js-yaml/lib/type/map.js
generated
vendored
Executable file
|
@ -0,0 +1,8 @@
|
|||
'use strict';
|
||||
|
||||
var Type = require('../type');
|
||||
|
||||
module.exports = new Type('tag:yaml.org,2002:map', {
|
||||
kind: 'mapping',
|
||||
construct: function (data) { return data !== null ? data : {}; }
|
||||
});
|
12
my-app/node_modules/cosmiconfig/node_modules/js-yaml/lib/type/merge.js
generated
vendored
Executable file
12
my-app/node_modules/cosmiconfig/node_modules/js-yaml/lib/type/merge.js
generated
vendored
Executable file
|
@ -0,0 +1,12 @@
|
|||
'use strict';
|
||||
|
||||
var Type = require('../type');
|
||||
|
||||
function resolveYamlMerge(data) {
|
||||
return data === '<<' || data === null;
|
||||
}
|
||||
|
||||
module.exports = new Type('tag:yaml.org,2002:merge', {
|
||||
kind: 'scalar',
|
||||
resolve: resolveYamlMerge
|
||||
});
|
35
my-app/node_modules/cosmiconfig/node_modules/js-yaml/lib/type/null.js
generated
vendored
Executable file
35
my-app/node_modules/cosmiconfig/node_modules/js-yaml/lib/type/null.js
generated
vendored
Executable file
|
@ -0,0 +1,35 @@
|
|||
'use strict';
|
||||
|
||||
var Type = require('../type');
|
||||
|
||||
function resolveYamlNull(data) {
|
||||
if (data === null) return true;
|
||||
|
||||
var max = data.length;
|
||||
|
||||
return (max === 1 && data === '~') ||
|
||||
(max === 4 && (data === 'null' || data === 'Null' || data === 'NULL'));
|
||||
}
|
||||
|
||||
function constructYamlNull() {
|
||||
return null;
|
||||
}
|
||||
|
||||
function isNull(object) {
|
||||
return object === null;
|
||||
}
|
||||
|
||||
module.exports = new Type('tag:yaml.org,2002:null', {
|
||||
kind: 'scalar',
|
||||
resolve: resolveYamlNull,
|
||||
construct: constructYamlNull,
|
||||
predicate: isNull,
|
||||
represent: {
|
||||
canonical: function () { return '~'; },
|
||||
lowercase: function () { return 'null'; },
|
||||
uppercase: function () { return 'NULL'; },
|
||||
camelcase: function () { return 'Null'; },
|
||||
empty: function () { return ''; }
|
||||
},
|
||||
defaultStyle: 'lowercase'
|
||||
});
|
44
my-app/node_modules/cosmiconfig/node_modules/js-yaml/lib/type/omap.js
generated
vendored
Executable file
44
my-app/node_modules/cosmiconfig/node_modules/js-yaml/lib/type/omap.js
generated
vendored
Executable file
|
@ -0,0 +1,44 @@
|
|||
'use strict';
|
||||
|
||||
var Type = require('../type');
|
||||
|
||||
var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
var _toString = Object.prototype.toString;
|
||||
|
||||
function resolveYamlOmap(data) {
|
||||
if (data === null) return true;
|
||||
|
||||
var objectKeys = [], index, length, pair, pairKey, pairHasKey,
|
||||
object = data;
|
||||
|
||||
for (index = 0, length = object.length; index < length; index += 1) {
|
||||
pair = object[index];
|
||||
pairHasKey = false;
|
||||
|
||||
if (_toString.call(pair) !== '[object Object]') return false;
|
||||
|
||||
for (pairKey in pair) {
|
||||
if (_hasOwnProperty.call(pair, pairKey)) {
|
||||
if (!pairHasKey) pairHasKey = true;
|
||||
else return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!pairHasKey) return false;
|
||||
|
||||
if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey);
|
||||
else return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function constructYamlOmap(data) {
|
||||
return data !== null ? data : [];
|
||||
}
|
||||
|
||||
module.exports = new Type('tag:yaml.org,2002:omap', {
|
||||
kind: 'sequence',
|
||||
resolve: resolveYamlOmap,
|
||||
construct: constructYamlOmap
|
||||
});
|
53
my-app/node_modules/cosmiconfig/node_modules/js-yaml/lib/type/pairs.js
generated
vendored
Executable file
53
my-app/node_modules/cosmiconfig/node_modules/js-yaml/lib/type/pairs.js
generated
vendored
Executable file
|
@ -0,0 +1,53 @@
|
|||
'use strict';
|
||||
|
||||
var Type = require('../type');
|
||||
|
||||
var _toString = Object.prototype.toString;
|
||||
|
||||
function resolveYamlPairs(data) {
|
||||
if (data === null) return true;
|
||||
|
||||
var index, length, pair, keys, result,
|
||||
object = data;
|
||||
|
||||
result = new Array(object.length);
|
||||
|
||||
for (index = 0, length = object.length; index < length; index += 1) {
|
||||
pair = object[index];
|
||||
|
||||
if (_toString.call(pair) !== '[object Object]') return false;
|
||||
|
||||
keys = Object.keys(pair);
|
||||
|
||||
if (keys.length !== 1) return false;
|
||||
|
||||
result[index] = [ keys[0], pair[keys[0]] ];
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function constructYamlPairs(data) {
|
||||
if (data === null) return [];
|
||||
|
||||
var index, length, pair, keys, result,
|
||||
object = data;
|
||||
|
||||
result = new Array(object.length);
|
||||
|
||||
for (index = 0, length = object.length; index < length; index += 1) {
|
||||
pair = object[index];
|
||||
|
||||
keys = Object.keys(pair);
|
||||
|
||||
result[index] = [ keys[0], pair[keys[0]] ];
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
module.exports = new Type('tag:yaml.org,2002:pairs', {
|
||||
kind: 'sequence',
|
||||
resolve: resolveYamlPairs,
|
||||
construct: constructYamlPairs
|
||||
});
|
8
my-app/node_modules/cosmiconfig/node_modules/js-yaml/lib/type/seq.js
generated
vendored
Executable file
8
my-app/node_modules/cosmiconfig/node_modules/js-yaml/lib/type/seq.js
generated
vendored
Executable file
|
@ -0,0 +1,8 @@
|
|||
'use strict';
|
||||
|
||||
var Type = require('../type');
|
||||
|
||||
module.exports = new Type('tag:yaml.org,2002:seq', {
|
||||
kind: 'sequence',
|
||||
construct: function (data) { return data !== null ? data : []; }
|
||||
});
|
29
my-app/node_modules/cosmiconfig/node_modules/js-yaml/lib/type/set.js
generated
vendored
Executable file
29
my-app/node_modules/cosmiconfig/node_modules/js-yaml/lib/type/set.js
generated
vendored
Executable file
|
@ -0,0 +1,29 @@
|
|||
'use strict';
|
||||
|
||||
var Type = require('../type');
|
||||
|
||||
var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
|
||||
function resolveYamlSet(data) {
|
||||
if (data === null) return true;
|
||||
|
||||
var key, object = data;
|
||||
|
||||
for (key in object) {
|
||||
if (_hasOwnProperty.call(object, key)) {
|
||||
if (object[key] !== null) return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function constructYamlSet(data) {
|
||||
return data !== null ? data : {};
|
||||
}
|
||||
|
||||
module.exports = new Type('tag:yaml.org,2002:set', {
|
||||
kind: 'mapping',
|
||||
resolve: resolveYamlSet,
|
||||
construct: constructYamlSet
|
||||
});
|
8
my-app/node_modules/cosmiconfig/node_modules/js-yaml/lib/type/str.js
generated
vendored
Executable file
8
my-app/node_modules/cosmiconfig/node_modules/js-yaml/lib/type/str.js
generated
vendored
Executable file
|
@ -0,0 +1,8 @@
|
|||
'use strict';
|
||||
|
||||
var Type = require('../type');
|
||||
|
||||
module.exports = new Type('tag:yaml.org,2002:str', {
|
||||
kind: 'scalar',
|
||||
construct: function (data) { return data !== null ? data : ''; }
|
||||
});
|
88
my-app/node_modules/cosmiconfig/node_modules/js-yaml/lib/type/timestamp.js
generated
vendored
Executable file
88
my-app/node_modules/cosmiconfig/node_modules/js-yaml/lib/type/timestamp.js
generated
vendored
Executable file
|
@ -0,0 +1,88 @@
|
|||
'use strict';
|
||||
|
||||
var Type = require('../type');
|
||||
|
||||
var YAML_DATE_REGEXP = new RegExp(
|
||||
'^([0-9][0-9][0-9][0-9])' + // [1] year
|
||||
'-([0-9][0-9])' + // [2] month
|
||||
'-([0-9][0-9])$'); // [3] day
|
||||
|
||||
var YAML_TIMESTAMP_REGEXP = new RegExp(
|
||||
'^([0-9][0-9][0-9][0-9])' + // [1] year
|
||||
'-([0-9][0-9]?)' + // [2] month
|
||||
'-([0-9][0-9]?)' + // [3] day
|
||||
'(?:[Tt]|[ \\t]+)' + // ...
|
||||
'([0-9][0-9]?)' + // [4] hour
|
||||
':([0-9][0-9])' + // [5] minute
|
||||
':([0-9][0-9])' + // [6] second
|
||||
'(?:\\.([0-9]*))?' + // [7] fraction
|
||||
'(?:[ \\t]*(Z|([-+])([0-9][0-9]?)' + // [8] tz [9] tz_sign [10] tz_hour
|
||||
'(?::([0-9][0-9]))?))?$'); // [11] tz_minute
|
||||
|
||||
function resolveYamlTimestamp(data) {
|
||||
if (data === null) return false;
|
||||
if (YAML_DATE_REGEXP.exec(data) !== null) return true;
|
||||
if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
function constructYamlTimestamp(data) {
|
||||
var match, year, month, day, hour, minute, second, fraction = 0,
|
||||
delta = null, tz_hour, tz_minute, date;
|
||||
|
||||
match = YAML_DATE_REGEXP.exec(data);
|
||||
if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data);
|
||||
|
||||
if (match === null) throw new Error('Date resolve error');
|
||||
|
||||
// match: [1] year [2] month [3] day
|
||||
|
||||
year = +(match[1]);
|
||||
month = +(match[2]) - 1; // JS month starts with 0
|
||||
day = +(match[3]);
|
||||
|
||||
if (!match[4]) { // no hour
|
||||
return new Date(Date.UTC(year, month, day));
|
||||
}
|
||||
|
||||
// match: [4] hour [5] minute [6] second [7] fraction
|
||||
|
||||
hour = +(match[4]);
|
||||
minute = +(match[5]);
|
||||
second = +(match[6]);
|
||||
|
||||
if (match[7]) {
|
||||
fraction = match[7].slice(0, 3);
|
||||
while (fraction.length < 3) { // milli-seconds
|
||||
fraction += '0';
|
||||
}
|
||||
fraction = +fraction;
|
||||
}
|
||||
|
||||
// match: [8] tz [9] tz_sign [10] tz_hour [11] tz_minute
|
||||
|
||||
if (match[9]) {
|
||||
tz_hour = +(match[10]);
|
||||
tz_minute = +(match[11] || 0);
|
||||
delta = (tz_hour * 60 + tz_minute) * 60000; // delta in mili-seconds
|
||||
if (match[9] === '-') delta = -delta;
|
||||
}
|
||||
|
||||
date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));
|
||||
|
||||
if (delta) date.setTime(date.getTime() - delta);
|
||||
|
||||
return date;
|
||||
}
|
||||
|
||||
function representYamlTimestamp(object /*, style*/) {
|
||||
return object.toISOString();
|
||||
}
|
||||
|
||||
module.exports = new Type('tag:yaml.org,2002:timestamp', {
|
||||
kind: 'scalar',
|
||||
resolve: resolveYamlTimestamp,
|
||||
construct: constructYamlTimestamp,
|
||||
instanceOf: Date,
|
||||
represent: representYamlTimestamp
|
||||
});
|
66
my-app/node_modules/cosmiconfig/node_modules/js-yaml/package.json
generated
vendored
Executable file
66
my-app/node_modules/cosmiconfig/node_modules/js-yaml/package.json
generated
vendored
Executable file
|
@ -0,0 +1,66 @@
|
|||
{
|
||||
"name": "js-yaml",
|
||||
"version": "4.1.0",
|
||||
"description": "YAML 1.2 parser and serializer",
|
||||
"keywords": [
|
||||
"yaml",
|
||||
"parser",
|
||||
"serializer",
|
||||
"pyyaml"
|
||||
],
|
||||
"author": "Vladimir Zapparov <dervus.grim@gmail.com>",
|
||||
"contributors": [
|
||||
"Aleksey V Zapparov <ixti@member.fsf.org> (http://www.ixti.net/)",
|
||||
"Vitaly Puzrin <vitaly@rcdesign.ru> (https://github.com/puzrin)",
|
||||
"Martin Grenfell <martin.grenfell@gmail.com> (http://got-ravings.blogspot.com)"
|
||||
],
|
||||
"license": "MIT",
|
||||
"repository": "nodeca/js-yaml",
|
||||
"files": [
|
||||
"index.js",
|
||||
"lib/",
|
||||
"bin/",
|
||||
"dist/"
|
||||
],
|
||||
"bin": {
|
||||
"js-yaml": "bin/js-yaml.js"
|
||||
},
|
||||
"module": "./dist/js-yaml.mjs",
|
||||
"exports": {
|
||||
".": {
|
||||
"import": "./dist/js-yaml.mjs",
|
||||
"require": "./index.js"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint .",
|
||||
"test": "npm run lint && mocha",
|
||||
"coverage": "npm run lint && nyc mocha && nyc report --reporter html",
|
||||
"demo": "npm run lint && node support/build_demo.js",
|
||||
"gh-demo": "npm run demo && gh-pages -d demo -f",
|
||||
"browserify": "rollup -c support/rollup.config.js",
|
||||
"prepublishOnly": "npm run gh-demo"
|
||||
},
|
||||
"unpkg": "dist/js-yaml.min.js",
|
||||
"jsdelivr": "dist/js-yaml.min.js",
|
||||
"dependencies": {
|
||||
"argparse": "^2.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@rollup/plugin-commonjs": "^17.0.0",
|
||||
"@rollup/plugin-node-resolve": "^11.0.0",
|
||||
"ansi": "^0.3.1",
|
||||
"benchmark": "^2.1.4",
|
||||
"codemirror": "^5.13.4",
|
||||
"eslint": "^7.0.0",
|
||||
"fast-check": "^2.8.0",
|
||||
"gh-pages": "^3.1.0",
|
||||
"mocha": "^8.2.1",
|
||||
"nyc": "^15.1.0",
|
||||
"rollup": "^2.34.1",
|
||||
"rollup-plugin-node-polyfills": "^0.2.1",
|
||||
"rollup-plugin-terser": "^7.0.2",
|
||||
"shelljs": "^0.8.4"
|
||||
}
|
||||
}
|
105
my-app/node_modules/cosmiconfig/package.json
generated
vendored
Executable file
105
my-app/node_modules/cosmiconfig/package.json
generated
vendored
Executable file
|
@ -0,0 +1,105 @@
|
|||
{
|
||||
"name": "cosmiconfig",
|
||||
"version": "8.3.6",
|
||||
"description": "Find and load configuration from a package.json property, rc file, TypeScript module, and more!",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"scripts": {
|
||||
"clean": "git clean -Xdf -e '!node_modules' .",
|
||||
"build": "npm run build:tsc",
|
||||
"build:tsc": "cross-env NODE_ENV=production tsc -b",
|
||||
"dev": "npm run build:tsc -- --watch",
|
||||
"lint": "eslint --ext .js,.ts .",
|
||||
"lint:fix": "eslint --ext .js,.ts . --fix",
|
||||
"lint:md": "remark-preset-davidtheclark",
|
||||
"format": "prettier \"**/*.{js,ts,json,yml,yaml}\" --write",
|
||||
"format:md": "remark-preset-davidtheclark --format",
|
||||
"format:check": "prettier \"**/*.{js,ts,json,yml,yaml}\" --check",
|
||||
"test": "vitest run --coverage",
|
||||
"test:watch": "vitest",
|
||||
"check:all": "npm run test && npm run lint && npm run format:check",
|
||||
"prepublishOnly": "npm run check:all && npm run build",
|
||||
"prepare": "husky install"
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.{js,ts}": [
|
||||
"eslint --fix",
|
||||
"prettier --write"
|
||||
],
|
||||
"*.{json,yml,yaml}": [
|
||||
"prettier --write"
|
||||
],
|
||||
"*.md": [
|
||||
"remark-preset-davidtheclark",
|
||||
"remark-preset-davidtheclark --format"
|
||||
]
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/cosmiconfig/cosmiconfig.git"
|
||||
},
|
||||
"keywords": [
|
||||
"load",
|
||||
"configuration",
|
||||
"config"
|
||||
],
|
||||
"author": "Daniel Fischer <daniel@d-fischer.dev>",
|
||||
"contributors": [
|
||||
"Randolf J <jrandolf@google.com>",
|
||||
"David Clark <david.dave.clark@gmail.com>",
|
||||
"Bogdan Chadkin <trysound@yandex.ru>",
|
||||
"Suhas Karanth <sudo.suhas@gmail.com>"
|
||||
],
|
||||
"funding": "https://github.com/sponsors/d-fischer",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/cosmiconfig/cosmiconfig/issues"
|
||||
},
|
||||
"homepage": "https://github.com/cosmiconfig/cosmiconfig#readme",
|
||||
"peerDependencies": {
|
||||
"typescript": ">=4.9.5"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"typescript": {
|
||||
"optional": true
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"import-fresh": "^3.3.0",
|
||||
"js-yaml": "^4.1.0",
|
||||
"parse-json": "^5.2.0",
|
||||
"path-type": "^4.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/js-yaml": "^4.0.5",
|
||||
"@types/node": "^14",
|
||||
"@types/parse-json": "^4.0.0",
|
||||
"@typescript-eslint/eslint-plugin": "^6.5.0",
|
||||
"@typescript-eslint/parser": "^6.5.0",
|
||||
"@vitest/coverage-istanbul": "^0.34.3",
|
||||
"cross-env": "^7.0.3",
|
||||
"del": "^7.1.0",
|
||||
"del-cli": "^5.1.0",
|
||||
"eslint": "^8.48.0",
|
||||
"eslint-config-davidtheclark-node": "^0.2.2",
|
||||
"eslint-config-prettier": "^9.0.0",
|
||||
"eslint-import-resolver-typescript": "^3.6.0",
|
||||
"eslint-plugin-import": "^2.28.1",
|
||||
"eslint-plugin-node": "^11.1.0",
|
||||
"eslint-plugin-vitest": "^0.2.8",
|
||||
"husky": "^8.0.3",
|
||||
"lint-staged": "^14.0.1",
|
||||
"make-dir": "^4.0.0",
|
||||
"parent-module": "^3.0.0",
|
||||
"prettier": "^3.0.3",
|
||||
"remark-preset-davidtheclark": "^0.12.0",
|
||||
"typescript": "^5.2.2",
|
||||
"vitest": "^0.34.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14"
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue