first commit

This commit is contained in:
s2
2024-12-13 08:53:01 +01:00
commit 2746dc9c4e
5477 changed files with 682458 additions and 0 deletions

12
node_modules/editions/.dependabot/config.yml generated vendored Normal file
View File

@@ -0,0 +1,12 @@
version: 1
update_configs:
- package_manager: javascript
directory: /
update_schedule: weekly
allowed_updates:
- match:
update_type: security
automerged_updates:
- match:
dependency_type: all
update_type: all

147
node_modules/editions/HISTORY.md generated vendored Normal file
View File

@@ -0,0 +1,147 @@
# History
## v2.3.1 2020 May 21
- Cherry-pick the types compilation from v3 to hopefully fix the consumption error:
```
node_modules/editions/source/index.ts:6:20 - error TS7016: Could not find a declaration file for module 'semver'. '/Users/balupton/Projects/active/envfile/node_modules/semver/semver.js' implicitly has an 'any' type.
Try `npm install @types/semver` if it exists or add a new declaration (.d.ts) file containing `declare module 'semver';`
6 import semver from 'semver'
```
## v2.3.0 2019 December 11
- Rewrote in TypeScript
- Updated dependencies, [base files](https://github.com/bevry/base), and [editions](https://editions.bevry.me) using [boundation](https://github.com/bevry/boundation)
## v2.2.0 2019 September 11
- Removed the `browser` edition introduced in v2.0.1 as the Editions Autloader has no use in the web browser
- Updated dependencies
## v2.1.3 2018 December 29
- Updated `errlop` dependency, should function to fix [issue #2](https://github.com/bevry/errlop/issues/2)
## v2.1.2 2018 December 29
Iternal change of not assuming the error `code` property exists, as on certain node versions its existance is denied. This should fix the following error:
```
./node_modules/editions/edition-node-0.8/index.js:310
if (editionError.code.indexOf('unsupported-edition-engines-node-version') === 0) {
^
TypeError: Cannot read property 'indexOf' of undefined
```
## v2.1.1 2018 December 29
Internal change of requiring a specific [Errlop](https://github.com/bevry/errlop) edition, which should function as a workaround for [errlop#2](https://github.com/bevry/errlop/issues/2) to fix the following error:
```
./node_modules/errlop/index.js:4
module.exports = require('editions').requirePackage(\_\_dirname, require)
^
TypeError: require(...).requirePackage is not a function
```
## v2.1.0 2018 November 15
- If none of the editions for a package match the current node version, editions will try to find a compatible package by converting strict version ranges likes `4 || 6 || 8 || 10` to looser ones like `>=4`, and if that fails, then it will attempt to load the last edition for the environment.
- This brings editions handling of engines closer in line with how node handles it, which is as a warning/recomendation, rather than a requirement/enforcement.
- This has the benefit that edition authors can specify ranges as the specific versions that they have tested the edition against that pass, rather than having to omit that information for runtime compatibility.
- As such editions will now automatically select the edition with guaranteed support for the environment, and if there are none with guaranteed support, then editions will select the one is most likely supported, and if there are none that are likely supported, then it will try the last edition, which should be the most compatible edition.
- This is timely, as node v11 is now the version most developers use, yet if edition authors specified only LTS releases, then the editions autoloader would reject loading on v11, despite compatibility being likely with the most upper edition.
- This behaviour is dictated by the new `strict` option, which omission of a value enables the above behaviour.
- Change `syntaxes` to `tags`, with backwards compatibility. This applies to edition specifications, as well as for the blacklist environment variable which is now named `EDITIONS_TAG_BLACKLIST`.
- Added codes to the different types of errors we may produce.
- Upgraded babel from v6 to v7
- Documentation has swapped from Documentation.js to JSDoc with the Minami theme.
## v2.0.2 2018 September 3
- Fixed `Error: Cannot find module 'editions'` on Windows (caused by edition directories containing `:` which is unsupported on Windows)
- Regression in v2.0.0
- Closes
- [ungit issue #1130](https://github.com/FredrikNoren/ungit/issues/1130)
- [getmac issue #39](https://github.com/bevry/getmac/issues/39)
- [docpad issue #1088](https://github.com/docpad/docpad/issues/1088)
- [bevry thread #240](https://discuss.bevry.me/t/error-cannot-find-module-editions/240)
## v2.0.1 2018 August 24
- Fixed potential `Error: Cannot find module 'editions'` (causes by `main` pointing to a legacy location
- Regression in v2.0.0
- Added an edition for browsers
## v2.0.0 2018 July 27
- Edition entries must now make use of the fields: `description`, `directory`, `entry`, and the new `engines` field (which follows the [`package.json:engines` spec](https://docs.npmjs.com/files/package.json#engines)).
- In version 1, if an edition failed to load, its syntax combination would be blacklisted. This functionality has been removed. The `engines` field is a better replacement. The `syntaxes` field remains optional, as it is still useful for user configured blacklisting and ecosystem tooling.
- Errors reported by the autoloader have improved readability thanks to [Errlop](https://github.com/bevry/errlop)
- Updated base files
## v1.3.4 2018 January 31
- Updated base files
## v1.3.3 2016 November 4
- Properly add node 0.8 support
## v1.3.2 2016 November 4
- Added node 0.8 support
## v1.3.1 2016 October 11
- Fixed failure to load editions that had the edition directory within the edition entry
- Thanks to [Jordan Harband](https://github.com/ljharb) for [issue #20](https://github.com/bevry/editions/issues/20)
## v1.3.0 2016 October 11
- Added support for `EDITIONS_SYNTAX_BLACKLIST` environment variable
- Thanks to [Damon Maria](https://github.com/damonmaria) for [issue #10](https://github.com/bevry/editions/issues/10)
- Dropped need for `DEBUG_BEVRY_EDITIONS` as failures will not output all the necessary debugging information
## v1.2.1 2016 October 10
- Change `esnext` skip from v8 engines < 4 to node engines < 0.12
## v1.2.0 2016 October 10
- Skip syntaxes that require preprocessors
- Skip `import` syntax, as the `module` field inside `package.json` skips the autoloader if supported
- Skip `esnext` syntax on v8 engines < 4
## v1.1.2 2016 June 16
- Parent errors are now displayed in a more sensible way
## v1.1.1 2016 March 20
- Errors and debug messages are now more useful
- Closes https://github.com/bevry/editions/issues/5
## v1.1.0 2016 March 20
- Added support for custom entry point overrides
- Debugging goes to `console.error` (stderr) rather than `console.log` (stdout)
- Closes https://github.com/bevry/editions/issues/2
- Added tests
- Closes https://github.com/bevry/editions/issues/4
## v1.0.1 2016 March 9
- Initial release
```
```

23
node_modules/editions/LICENSE.md generated vendored Normal file
View File

@@ -0,0 +1,23 @@
<!-- LICENSEFILE/ -->
<h1>License</h1>
Unless stated otherwise all works are:
<ul><li>Copyright &copy; 2016+ <a href="http://bevry.me">Bevry Pty Ltd</a></li></ul>
and licensed under:
<ul><li><a href="http://spdx.org/licenses/MIT.html">MIT License</a></li></ul>
<h2>MIT License</h2>
<pre>
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 (including the next paragraph) 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.
</pre>
<!-- /LICENSEFILE -->

111
node_modules/editions/README.md generated vendored Normal file
View File

@@ -0,0 +1,111 @@
<!-- TITLE/ -->
<h1>editions</h1>
<!-- /TITLE -->
<!-- BADGES/ -->
<span class="badge-travisci"><a href="http://travis-ci.com/bevry/editions" title="Check this project's build status on TravisCI"><img src="https://img.shields.io/travis/com/bevry/editions/master.svg" alt="Travis CI Build Status" /></a></span>
<span class="badge-npmversion"><a href="https://npmjs.org/package/editions" title="View this project on NPM"><img src="https://img.shields.io/npm/v/editions.svg" alt="NPM version" /></a></span>
<span class="badge-npmdownloads"><a href="https://npmjs.org/package/editions" title="View this project on NPM"><img src="https://img.shields.io/npm/dm/editions.svg" alt="NPM downloads" /></a></span>
<span class="badge-daviddm"><a href="https://david-dm.org/bevry/editions" title="View the status of this project's dependencies on DavidDM"><img src="https://img.shields.io/david/bevry/editions.svg" alt="Dependency Status" /></a></span>
<span class="badge-daviddmdev"><a href="https://david-dm.org/bevry/editions#info=devDependencies" title="View the status of this project's development dependencies on DavidDM"><img src="https://img.shields.io/david/dev/bevry/editions.svg" alt="Dev Dependency Status" /></a></span>
<br class="badge-separator" />
<span class="badge-githubsponsors"><a href="https://github.com/sponsors/balupton" title="Donate to this project using GitHub Sponsors"><img src="https://img.shields.io/badge/github-donate-yellow.svg" alt="GitHub Sponsors donate button" /></a></span>
<span class="badge-patreon"><a href="https://patreon.com/bevry" title="Donate to this project using Patreon"><img src="https://img.shields.io/badge/patreon-donate-yellow.svg" alt="Patreon donate button" /></a></span>
<span class="badge-flattr"><a href="https://flattr.com/profile/balupton" title="Donate to this project using Flattr"><img src="https://img.shields.io/badge/flattr-donate-yellow.svg" alt="Flattr donate button" /></a></span>
<span class="badge-liberapay"><a href="https://liberapay.com/bevry" title="Donate to this project using Liberapay"><img src="https://img.shields.io/badge/liberapay-donate-yellow.svg" alt="Liberapay donate button" /></a></span>
<span class="badge-buymeacoffee"><a href="https://buymeacoffee.com/balupton" title="Donate to this project using Buy Me A Coffee"><img src="https://img.shields.io/badge/buy%20me%20a%20coffee-donate-yellow.svg" alt="Buy Me A Coffee donate button" /></a></span>
<span class="badge-opencollective"><a href="https://opencollective.com/bevry" title="Donate to this project using Open Collective"><img src="https://img.shields.io/badge/open%20collective-donate-yellow.svg" alt="Open Collective donate button" /></a></span>
<span class="badge-crypto"><a href="https://bevry.me/crypto" title="Donate to this project using Cryptocurrency"><img src="https://img.shields.io/badge/crypto-donate-yellow.svg" alt="crypto donate button" /></a></span>
<span class="badge-paypal"><a href="https://bevry.me/paypal" title="Donate to this project using Paypal"><img src="https://img.shields.io/badge/paypal-donate-yellow.svg" alt="PayPal donate button" /></a></span>
<span class="badge-wishlist"><a href="https://bevry.me/wishlist" title="Buy an item on our wishlist for us"><img src="https://img.shields.io/badge/wishlist-donate-yellow.svg" alt="Wishlist browse button" /></a></span>
<!-- /BADGES -->
<!-- DESCRIPTION/ -->
Publish multiple editions for your JavaScript packages consistently and easily (e.g. source edition, esnext edition, es2015 edition)
<!-- /DESCRIPTION -->
## Discover
[Watch the talk.](https://youtu.be/IAB8_UlcNWI)
[Read the Documentation.](https://editions.bevry.me)
[View the Editions Autoloader API documentation.](http://master.editions.bevry.surge.sh/docs/)
<!-- HISTORY/ -->
<h2>History</h2>
<a href="https://github.com/bevry/editions/blob/master/HISTORY.md#files">Discover the release history by heading on over to the <code>HISTORY.md</code> file.</a>
<!-- /HISTORY -->
<!-- CONTRIBUTE/ -->
<h2>Contribute</h2>
<a href="https://github.com/bevry/editions/blob/master/CONTRIBUTING.md#files">Discover how you can contribute by heading on over to the <code>CONTRIBUTING.md</code> file.</a>
<!-- /CONTRIBUTE -->
<!-- BACKERS/ -->
<h2>Backers</h2>
<h3>Maintainers</h3>
These amazing people are maintaining this project:
<ul><li><a href="http://balupton.com">Benjamin Lupton</a><a href="https://github.com/bevry/editions/commits?author=balupton" title="View the GitHub contributions of Benjamin Lupton on repository bevry/editions">view contributions</a></li></ul>
<h3>Sponsors</h3>
No sponsors yet! Will you be the first?
<span class="badge-githubsponsors"><a href="https://github.com/sponsors/balupton" title="Donate to this project using GitHub Sponsors"><img src="https://img.shields.io/badge/github-donate-yellow.svg" alt="GitHub Sponsors donate button" /></a></span>
<span class="badge-patreon"><a href="https://patreon.com/bevry" title="Donate to this project using Patreon"><img src="https://img.shields.io/badge/patreon-donate-yellow.svg" alt="Patreon donate button" /></a></span>
<span class="badge-flattr"><a href="https://flattr.com/profile/balupton" title="Donate to this project using Flattr"><img src="https://img.shields.io/badge/flattr-donate-yellow.svg" alt="Flattr donate button" /></a></span>
<span class="badge-liberapay"><a href="https://liberapay.com/bevry" title="Donate to this project using Liberapay"><img src="https://img.shields.io/badge/liberapay-donate-yellow.svg" alt="Liberapay donate button" /></a></span>
<span class="badge-buymeacoffee"><a href="https://buymeacoffee.com/balupton" title="Donate to this project using Buy Me A Coffee"><img src="https://img.shields.io/badge/buy%20me%20a%20coffee-donate-yellow.svg" alt="Buy Me A Coffee donate button" /></a></span>
<span class="badge-opencollective"><a href="https://opencollective.com/bevry" title="Donate to this project using Open Collective"><img src="https://img.shields.io/badge/open%20collective-donate-yellow.svg" alt="Open Collective donate button" /></a></span>
<span class="badge-crypto"><a href="https://bevry.me/crypto" title="Donate to this project using Cryptocurrency"><img src="https://img.shields.io/badge/crypto-donate-yellow.svg" alt="crypto donate button" /></a></span>
<span class="badge-paypal"><a href="https://bevry.me/paypal" title="Donate to this project using Paypal"><img src="https://img.shields.io/badge/paypal-donate-yellow.svg" alt="PayPal donate button" /></a></span>
<span class="badge-wishlist"><a href="https://bevry.me/wishlist" title="Buy an item on our wishlist for us"><img src="https://img.shields.io/badge/wishlist-donate-yellow.svg" alt="Wishlist browse button" /></a></span>
<h3>Contributors</h3>
These amazing people have contributed code to this project:
<ul><li><a href="http://balupton.com">Benjamin Lupton</a><a href="https://github.com/bevry/editions/commits?author=balupton" title="View the GitHub contributions of Benjamin Lupton on repository bevry/editions">view contributions</a></li>
<li><a href="http://zdroid.github.io">Zlatan Vasović</a><a href="https://github.com/bevry/editions/commits?author=zdroid" title="View the GitHub contributions of Zlatan Vasović on repository bevry/editions">view contributions</a></li>
<li><a href="http://github.com/apps/dependabot">dependabot[bot]</a><a href="https://github.com/bevry/editions/commits?author=dependabot[bot]" title="View the GitHub contributions of dependabot[bot] on repository bevry/editions">view contributions</a></li></ul>
<a href="https://github.com/bevry/editions/blob/master/CONTRIBUTING.md#files">Discover how you can contribute by heading on over to the <code>CONTRIBUTING.md</code> file.</a>
<!-- /BACKERS -->
<!-- LICENSE/ -->
<h2>License</h2>
Unless stated otherwise all works are:
<ul><li>Copyright &copy; 2016+ <a href="http://bevry.me">Bevry Pty Ltd</a></li></ul>
and licensed under:
<ul><li><a href="http://spdx.org/licenses/MIT.html">MIT License</a></li></ul>
<!-- /LICENSE -->

95
node_modules/editions/compiled-types/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,95 @@
/// <reference types="node" />
/** Edition entries must conform to the following specification. */
export interface Edition {
/**
* Use this property to decribe the edition in human readable terms. Such as what it does and who it is for. It is used to reference the edition in user facing reporting, such as error messages.
* @example "esnext source code with require for modules"
*/
description: String;
/**
* The location to where this directory is located. It should be a relative path from the `package.json` file.
* @example "source"
*/
directory: string;
/**
* The default entry location for this edition, relative to the edition's directory.
* @example "index.js"
*/
entry?: string;
/**
* Any keywords you wish to associate to the edition. Useful for various ecosystem tooling, such as automatic ESNext lint configuration if the `esnext` tag is present in the source edition tags. Consumers also make use of this via {@link EDITIONS_TAG_BLACKLIST} for preventing loading editions that contain a blacklisted tag. Previously this field was named `syntaxes`.
* @example ["javascript", "esnext", "require"]
*/
tags?: string[];
/** @alias tags */
syntaxes?: Edition['tags'];
/**
* This field is used to specific which Node.js and Browser environments this edition supports. If `false` this edition does not support either. If `node` is a string, it should be a semver range of node.js versions that the edition targets. If `browsers` is a string, it should be a [browserlist](https://github.com/browserslist/browserslist) value of the specific browser values the edition targets. If `node` or `browsers` is true, it indicates that this edition is compatible with those environments.
* @example
* {
* "description": "esnext source code with require for modules",
* "directory": "source",
* "entry": "index.js",
* "tags": [
* "javascript",
* "esnext",
* "require"
* ],
* "engines": {
* "node": ">=6",
* "browsers": "defaults"
* }
* }
*/
engines?: false | {
[engine: string]: string | boolean;
};
}
/** These are the various options that you can use to customise the behaviour of certain methods. */
export interface EditionOptions {
/** The require method of the calling module, used to ensure require paths remain correct. */
require: Function;
/** If provided, this is used for debugging. */
packagePath?: string;
/** If provided, any error loading an edition will be logged. By default, errors are only logged if all editions failed. If not provided, process.env.EDITIONS_VERBOSE is used. */
verbose?: boolean;
/** If `true`, then only exact version matches will be loaded. If `false`, then likely matches using {@link simplifyRange} will be evaluated, with a fallback to the last. If missing, then `true` is attempted first and if no result, then `false` is attempted. */
strict?: boolean;
/** If provided, this will be the cwd for entries. */
cwd?: string;
/** If provided, should be a relative path to the entry point of the edition. */
entry?: string;
/** If provided, should be the name of the package that we are loading the editions for. */
package?: string;
/** If not provided, will use process.stderr instead. It is the stream that verbose errors are logged to. */
stderr?: NodeJS.WritableStream;
}
/**
* Attempt to load a specific {@link Edition}.
* @returns The result of the loaded edition.
* @throws An error if the edition failed to load.
*/
export declare function loadEdition(edition: Edition, opts: EditionOptions): any;
/**
* Attempt to require an {@link Edition}, based on its compatibility with the current environment, such as {@link NODE_VERSION} and {@link EDITIONS_TAG_BLACKLIST} compatibility.
* If compatibility is established with the environment, it will load the edition using {@link loadEdition}.
* @returns The result of the loaded edition
* @throws An error if the edition failed to load
*/
export declare function requireEdition(edition: Edition, opts: EditionOptions): any;
/**
* Cycles through a list of editions, returning the require result of the first suitable {@link Edition} that it was able to load.
* Editions should be ordered from most preferable first, to least desirable last.
* Providing the editions configuration is valid, individual edition handling is forwarded to {@link requireEdition}.
* @returns The result of the loaded edition.
* @throws An error if a suitable edition was unable to be resolved.
*/
export declare function requireEditions(editions: Edition[], opts: EditionOptions): any;
/**
* Cycle through the editions for a package and require the correct one.
* Providing the package configuration is valid, editions handling is forwarded to {@link requireEditions}.
* @returns The result of the loaded edition.
* @throws An error if a suitable edition was unable to be resolved.
*/
export declare function requirePackage(cwd: EditionOptions['cwd'], require: EditionOptions['require'], entry: EditionOptions['entry']): any;
//# sourceMappingURL=index.d.ts.map

1
node_modules/editions/compiled-types/index.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../source/index.ts"],"names":[],"mappings":";AAkEA,mEAAmE;AACnE,MAAM,WAAW,OAAO;IACvB;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAA;IACnB;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAA;IACjB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;IACf,kBAAkB;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAA;IAC1B;;;;;;;;;;;;;;;;;OAiBG;IACH,OAAO,CAAC,EAAE,KAAK,GAAG;QAAE,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAA;KAAE,CAAA;CACxD;AAED,oGAAoG;AACpG,MAAM,WAAW,cAAc;IAC9B,6FAA6F;IAC7F,OAAO,EAAE,QAAQ,CAAA;IACjB,+CAA+C;IAC/C,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,kLAAkL;IAClL,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,qQAAqQ;IACrQ,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,qDAAqD;IACrD,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,gFAAgF;IAChF,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,2FAA2F;IAC3F,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,4GAA4G;IAC5G,MAAM,CAAC,EAAE,MAAM,CAAC,cAAc,CAAA;CAC9B;AAoBD;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,cAAc,GAAG,GAAG,CAwBvE;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,cAAc,GAAG,GAAG,CA0F1E;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC9B,QAAQ,EAAE,OAAO,EAAE,EACnB,IAAI,EAAE,cAAc,GAClB,GAAG,CAsGL;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAC7B,GAAG,EAAE,cAAc,CAAC,KAAK,CAAC,EAC1B,OAAO,EAAE,cAAc,CAAC,SAAS,CAAC,EAClC,KAAK,EAAE,cAAc,CAAC,OAAO,CAAC,GAC5B,GAAG,CAML"}

19
node_modules/editions/compiled-types/util.d.ts generated vendored Normal file
View File

@@ -0,0 +1,19 @@
import Errlop from 'errlop';
interface ErrtionOptions {
message: string;
code: string | number;
level?: string | number;
}
interface Errtion extends Errlop, ErrtionOptions {
}
/**
* Allow code and level inputs on Errlop.
* We do this instead of a class extension, as class extensions do not interop well on node 0.8, which is our target.
*/
export declare function errtion(this: void, opts: ErrtionOptions, parent?: Errlop | Error): Errtion;
/** Converts anything to a string, by returning strings and serialising objects. */
export declare function stringify(value: any): string;
/** Converts a version range like `4 || 6` to `>=4` */
export declare function simplifyRange(range: string): string;
export {};
//# sourceMappingURL=util.d.ts.map

1
node_modules/editions/compiled-types/util.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../source/util.ts"],"names":[],"mappings":"AAKA,OAAO,MAAM,MAAM,QAAQ,CAAA;AAE3B,UAAU,cAAc;IACvB,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,GAAG,MAAM,CAAA;IACrB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CACvB;AAED,UAAU,OAAQ,SAAQ,MAAM,EAAE,cAAc;CAAG;AAEnD;;;GAGG;AACH,wBAAgB,OAAO,CACtB,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,cAAc,EACpB,MAAM,CAAC,EAAE,MAAM,GAAG,KAAK,GACrB,OAAO,CAMT;AAED,mFAAmF;AACnF,wBAAgB,SAAS,CAAC,KAAK,EAAE,GAAG,GAAG,MAAM,CAE5C;AAED,sDAAsD;AACtD,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEnD"}

286
node_modules/editions/edition-es5/index.js generated vendored Normal file
View File

@@ -0,0 +1,286 @@
/* eslint no-console:0 */
'use strict';
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
var _a, _b;
Object.defineProperty(exports, "__esModule", { value: true });
// Imports
var path_1 = __importDefault(require("path"));
var semver_1 = __importDefault(require("semver"));
var util_js_1 = require("./util.js");
// As Errlop uses Editions, we should use a specific Errlop edition
// As otherwise, the circular reference may fail on some machines
// https://github.com/bevry/errlop/issues/2
var errlop_1 = __importDefault(require("errlop"));
/**
* The current node version that we are operating within.
* It is compared in {@link requireEdition} against {@link Edition.engines}.
*/
var NODE_VERSION = process.versions.node;
/**
* Whether or not {@link EDITIONS_VERBOSE} is enabled.
* @type {bollean}
* @private
*/
var VERBOSE = process.env.EDITIONS_VERBOSE === true ||
process.env.EDITIONS_VERBOSE === 'yes' ||
process.env.EDITIONS_VERBOSE === 'true' ||
false;
/**
* A list of the blacklisted tags.
* Data imported from {@link EDITIONS_TAG_BLACKLIST}.
*/
var BLACKLIST = ((_a = process.env.EDITIONS_TAG_BLACKLIST) === null || _a === void 0 ? void 0 : _a.split(/[, ]+/g)) || ((_b = process.env.EDITIONS_SYNTAX_BLACKLIST) === null || _b === void 0 ? void 0 : _b.split(/[, ]+/g));
/**
* A mapping of blacklisted tags to their reasons.
* Keys are the tags.
* Values are the error instances that contain the reasoning for why/how that tag is/became blacklisted.
* Data imported from {@link EDITIONS_TAG_BLACKLIST}.
*/
var blacklist = {};
// Create the mapping of blacklisted tags and their reasonings
if (BLACKLIST) {
for (var i = 0; i < BLACKLIST.length; ++i) {
var tag = BLACKLIST[i].trim().toLowerCase();
blacklist[tag] = util_js_1.errtion({
message: "The EDITIONS_TAG_BLACKLIST (aka EDITIONS_SYNTAX_BLACKLIST) environment variable blacklisted the tag [" + tag + "]",
code: 'blacklisted-tag'
});
}
}
// Blacklist the tag 'esnext' if our node version is below 0.12
if (semver_1.default.satisfies(NODE_VERSION, '<0.12')) {
blacklist.esnext = new Error('The esnext tag is skipped on early node versions as attempting to use esnext features will output debugging information on these node versions');
}
/**
* Attempt to load a specific {@link Edition}.
* @returns The result of the loaded edition.
* @throws An error if the edition failed to load.
*/
function loadEdition(edition, opts) {
var entry = path_1.default.resolve(opts.cwd || '', edition.directory, opts.entry || edition.entry || '');
if (opts.require == null) {
throw util_js_1.errtion({
message: "Skipped edition [" + edition.description + "] as opts.require was not provided, this is probably due to a testing misconfiguration.",
code: 'unsupported-edition-require'
});
}
try {
return opts.require(entry);
}
catch (loadError) {
// Note the error with more details
throw util_js_1.errtion({
message: "Skipped edition [" + edition.description + "] at entry [" + entry + "] because it failed to load",
code: 'unsupported-edition-tried'
}, loadError);
}
}
exports.loadEdition = loadEdition;
/**
* Attempt to require an {@link Edition}, based on its compatibility with the current environment, such as {@link NODE_VERSION} and {@link EDITIONS_TAG_BLACKLIST} compatibility.
* If compatibility is established with the environment, it will load the edition using {@link loadEdition}.
* @returns The result of the loaded edition
* @throws An error if the edition failed to load
*/
function requireEdition(edition, opts) {
// Verify the edition is valid
if (!edition.description ||
!edition.directory ||
!edition.entry ||
edition.engines == null) {
throw util_js_1.errtion({
message: "Each edition must have its [description, directory, entry, engines] fields defined, yet all it had was [" + Object.keys(edition).join(', ') + "]",
code: 'unsupported-edition-malformed',
level: 'fatal'
});
}
// Handle strict omission
if (opts.strict == null) {
try {
return requireEdition(edition, __assign(__assign({}, opts), { strict: true }));
}
catch (err) {
return requireEdition(edition, __assign(__assign({}, opts), { strict: false }));
}
}
// Verify tag support
// Convert tags into a sorted lowercase string
var tags = (edition.tags || edition.syntaxes || [])
.map(function (i) { return i.toLowerCase(); })
.sort();
for (var index = 0; index < tags.length; index++) {
var tag = tags[index];
var blacklisted = blacklist[tag];
if (blacklisted) {
throw util_js_1.errtion({
message: "Skipping edition [" + edition.description + "] because it contained a blacklisted tag [" + tag + "]",
code: 'unsupported-edition-backlisted-tag'
}, blacklisted);
}
}
// Verify engine support
if (edition.engines === false) {
throw util_js_1.errtion({
message: "Skipping edition [" + edition.description + "] because its engines field was false",
code: 'unsupported-edition-engine'
});
}
if (!edition.engines.node) {
throw util_js_1.errtion({
message: "Skipping edition [" + edition.description + "] because its .engines.node field was falsey",
code: 'unsupported-edition-engines-node'
});
}
if (opts.strict) {
if (edition.engines.node === true) {
throw util_js_1.errtion({
message: "Skipping edition [" + edition.description + "] because its .engines.node field was true yet we are in strict mode",
code: 'unsupported-edition-engines-node-version-true'
});
}
else if (semver_1.default.satisfies(NODE_VERSION, edition.engines.node) === false) {
throw util_js_1.errtion({
message: "Skipping edition [" + edition.description + "] because our current node version [" + NODE_VERSION + "] is not supported by its specific range [" + util_js_1.stringify(edition.engines.node) + "]",
code: 'unsupported-edition-engines-node-version-specific'
});
}
}
else if (edition.engines.node !== true) {
var simplifiedRange = util_js_1.simplifyRange(edition.engines.node);
if (semver_1.default.satisfies(NODE_VERSION, simplifiedRange) === false) {
throw util_js_1.errtion({
message: "Skipping edition [" + edition.description + "] because our current node version [" + NODE_VERSION + "] is not supported by its simplified range [" + util_js_1.stringify(simplifiedRange) + "]",
code: 'unsupported-edition-engines-node-version-simplified'
});
}
}
// Load the edition
return loadEdition(edition, opts);
}
exports.requireEdition = requireEdition;
/**
* Cycles through a list of editions, returning the require result of the first suitable {@link Edition} that it was able to load.
* Editions should be ordered from most preferable first, to least desirable last.
* Providing the editions configuration is valid, individual edition handling is forwarded to {@link requireEdition}.
* @returns The result of the loaded edition.
* @throws An error if a suitable edition was unable to be resolved.
*/
function requireEditions(editions, opts) {
// Check
if (!editions || editions.length === 0) {
if (opts.packagePath) {
throw util_js_1.errtion({
message: "There were no editions specified for package [" + opts.packagePath + "]",
code: 'unsupported-editions-missing'
});
}
else {
throw util_js_1.errtion({
message: 'There were no editions specified',
code: 'unsupported-editions-missing'
});
}
}
// Handle strict omission
if (opts.strict == null) {
try {
return requireEditions(editions, __assign(__assign({}, opts), { strict: true }));
}
catch (err) {
return requireEditions(editions, __assign(__assign({}, opts), { strict: false }));
}
}
// Whether or not we should be verbose
var verbose = opts.verbose == null ? VERBOSE : opts.verbose;
// Capture the load result, the last error, and the fallback option
var result, loaded = false, editionsError = null, fallbackEdition = null;
// Cycle through the editions determing the above
for (var i = 0; i < editions.length; ++i) {
var edition = editions[i];
try {
result = requireEdition(edition, opts);
loaded = true;
break;
}
catch (editionError) {
if (editionError.level === 'fatal') {
editionsError = editionError;
break;
}
else if (editionsError) {
editionsError = util_js_1.errtion(editionsError, editionError);
}
else {
editionsError = editionError;
}
// make the fallback edition one that we don't bother loading due to its engines
// also: don't assume that .code is accessible, as it may not be, even if it should be, due to the way different environments behave
if (String(editionError.code || '').indexOf('unsupported-edition-engines-node-version') === 0) {
fallbackEdition = edition;
}
}
}
// if no edition was suitable for our environment, then try the fallback if it exists
// that is to say, ignore its engines.node
if (opts.strict === false && loaded === false && fallbackEdition) {
try {
result = loadEdition(fallbackEdition, opts);
loaded = true;
}
catch (editionError) {
editionsError = new errlop_1.default(editionError, editionsError);
}
}
// if we were able to load something, then provide it
if (loaded) {
// make note of any errors if desired
if (editionsError && verbose) {
var stderr = opts.stderr || process.stderr;
stderr.write(editionsError.stack + '\n');
}
return result;
}
// otherwise, provide the error
else if (editionsError) {
if (opts.packagePath) {
throw util_js_1.errtion({
message: "There were no suitable editions for package [" + opts.packagePath + "]",
code: 'unsupported-editions-tried'
}, editionsError);
}
else {
throw util_js_1.errtion({
message: 'There were no suitable editions',
code: 'unsupported-editions-tried'
}, editionsError);
}
}
}
exports.requireEditions = requireEditions;
/**
* Cycle through the editions for a package and require the correct one.
* Providing the package configuration is valid, editions handling is forwarded to {@link requireEditions}.
* @returns The result of the loaded edition.
* @throws An error if a suitable edition was unable to be resolved.
*/
function requirePackage(cwd, require, entry) {
// Load the package.json file to fetch `name` for debugging and `editions` for loading
var packagePath = path_1.default.resolve(cwd || '', 'package.json');
var editions = require(packagePath).editions;
var opts = { packagePath: packagePath, cwd: cwd, require: require, entry: entry };
return requireEditions(editions, opts);
}
exports.requirePackage = requirePackage;

33
node_modules/editions/edition-es5/util.js generated vendored Normal file
View File

@@ -0,0 +1,33 @@
'use strict';
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
// As Errlop uses Editions, we should use a specific Errlop edition
// As otherwise, the circular reference may fail on some machines
// https://github.com/bevry/errlop/issues/2
var errlop_1 = __importDefault(require("errlop"));
/**
* Allow code and level inputs on Errlop.
* We do this instead of a class extension, as class extensions do not interop well on node 0.8, which is our target.
*/
function errtion(opts, parent) {
var message = opts.message, code = opts.code, level = opts.level;
var error = new errlop_1.default(message, parent);
if (code)
error.code = code;
if (level)
error.level = level;
return error;
}
exports.errtion = errtion;
/** Converts anything to a string, by returning strings and serialising objects. */
function stringify(value) {
return typeof value === 'string' ? value : JSON.stringify(value);
}
exports.stringify = stringify;
/** Converts a version range like `4 || 6` to `>=4` */
function simplifyRange(range) {
return range.replace(/^([.\-\w]+)(\s.+)?$/, '>=$1');
}
exports.simplifyRange = simplifyRange;

209
node_modules/editions/package.json generated vendored Normal file
View File

@@ -0,0 +1,209 @@
{
"_args": [
[
"editions@2.3.1",
"D:\\Projects\\siag\\vanillajs-seed"
]
],
"_development": true,
"_from": "editions@2.3.1",
"_id": "editions@2.3.1",
"_inBundle": false,
"_integrity": "sha512-ptGvkwTvGdGfC0hfhKg0MT+TRLRKGtUiWGBInxOm5pz7ssADezahjCUaYuZ8Dr+C05FW0AECIIPt4WBxVINEhA==",
"_location": "/editions",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "editions@2.3.1",
"name": "editions",
"escapedName": "editions",
"rawSpec": "2.3.1",
"saveSpec": null,
"fetchSpec": "2.3.1"
},
"_requiredBy": [
"/sortobject"
],
"_resolved": "https://registry.npmjs.org/editions/-/editions-2.3.1.tgz",
"_spec": "2.3.1",
"_where": "D:\\Projects\\siag\\vanillajs-seed",
"author": {
"name": "2016+ Bevry Pty Ltd",
"email": "us@bevry.me",
"url": "http://bevry.me"
},
"badges": {
"list": [
"travisci",
"npmversion",
"npmdownloads",
"daviddm",
"daviddmdev",
"---",
"githubsponsors",
"patreon",
"flattr",
"liberapay",
"buymeacoffee",
"opencollective",
"crypto",
"paypal",
"wishlist"
],
"config": {
"githubSponsorsUsername": "balupton",
"buymeacoffeeUsername": "balupton",
"cryptoURL": "https://bevry.me/crypto",
"flattrUsername": "balupton",
"liberapayUsername": "bevry",
"opencollectiveUsername": "bevry",
"patreonUsername": "bevry",
"paypalURL": "https://bevry.me/paypal",
"wishlistURL": "https://bevry.me/wishlist",
"travisTLD": "com"
}
},
"boundation": {
"minimumSupportNodeVersion": "0.8",
"minimumTestNodeVersion": "0.8",
"browser": false,
"compiler": "typescript",
"targets": [
"ES5"
]
},
"bugs": {
"url": "https://github.com/bevry/editions/issues"
},
"contributors": [
{
"name": "Benjamin Lupton",
"email": "b@lupton.cc",
"url": "http://balupton.com"
},
{
"name": "Zlatan Vasović",
"email": "zlatanvasovic@gmail.com",
"url": "http://zdroid.github.io"
},
{
"name": "dependabot[bot]",
"url": "http://github.com/apps/dependabot"
}
],
"dependencies": {
"errlop": "^2.0.0",
"semver": "^6.3.0"
},
"description": "Publish multiple editions for your JavaScript packages consistently and easily (e.g. source edition, esnext edition, es2015 edition)",
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^2.11.0",
"@typescript-eslint/parser": "^2.11.0",
"assert-helpers": "4.10.0",
"eslint": "^6.7.2",
"eslint-config-bevry": "^2.3.0",
"eslint-config-prettier": "^6.7.0",
"eslint-plugin-prettier": "^3.1.1",
"kava": "3.2.0",
"prettier": "^1.19.1",
"projectz": "^1.16.0",
"surge": "^0.21.3",
"typedoc": "^0.15.4",
"typescript": "^3.7.3",
"valid-directory": "^1.6.0"
},
"editions": [
{
"description": "typescript source code with import for modules",
"directory": "source",
"entry": "index.ts",
"tags": [
"typescript",
"import"
],
"engines": false
},
{
"description": "typescript compiled against ES5 for Node.js with require for modules",
"directory": "edition-es5",
"entry": "index.js",
"tags": [
"javascript",
"es5",
"require"
],
"engines": {
"node": "0.8 || 0.10 || 0.12 || 4 || 6 || 8 || 10 || 12 || 13 || 14"
}
}
],
"engines": {
"node": ">=0.8"
},
"eslintConfig": {
"extends": [
"bevry"
]
},
"funding": "https://bevry.me/fund",
"homepage": "https://github.com/bevry/editions",
"keywords": [
"editions",
"edition",
"versions",
"syntaxes",
"esnext",
"jsnext",
"es2015",
"es6",
"es6+"
],
"license": "MIT",
"main": "edition-es5/index.js",
"maintainers": [
{
"name": "Benjamin Lupton",
"email": "b@lupton.cc",
"url": "http://balupton.com"
}
],
"name": "editions",
"prettier": {
"semi": false,
"singleQuote": true
},
"repository": {
"type": "git",
"url": "git+https://github.com/bevry/editions.git"
},
"scripts": {
"our:clean": "rm -Rf ./docs ./edition* ./es2015 ./es5 ./out ./.next",
"our:compile": "npm run our:compile:edition-es5 && npm run our:compile:types",
"our:compile:edition-es5": "tsc --module commonjs --target ES5 --outDir ./edition-es5 --project tsconfig.json && test -d edition-es5/source && ( mv edition-es5/source edition-temp && rm -Rf edition-es5 && mv edition-temp edition-es5 ) || true",
"our:compile:types": "tsc --project tsconfig.json --emitDeclarationOnly --declaration --declarationDir ./compiled-types/ --declarationMap",
"our:deploy": "echo no need for this project",
"our:meta": "npm run our:meta:docs && npm run our:meta:projectz",
"our:meta:docs": "npm run our:meta:docs:typedoc",
"our:meta:docs:typedoc": "rm -Rf ./docs && typedoc --mode file --exclude '**/+(*test*|node_modules)' --excludeExternals --name \"$npm_package_name\" --readme ./README.md --out ./docs ./source",
"our:meta:projectz": "projectz compile",
"our:release": "npm run our:release:prepare && npm run our:release:check-changelog && npm run our:release:check-dirty && npm run our:release:tag && npm run our:release:push",
"our:release:check-changelog": "cat ./HISTORY.md | grep v$npm_package_version || (echo add a changelog entry for v$npm_package_version && exit -1)",
"our:release:check-dirty": "git diff --exit-code",
"our:release:prepare": "npm run our:clean && npm run our:compile && npm run our:test && npm run our:meta",
"our:release:push": "git push origin master && git push origin --tags",
"our:release:tag": "export MESSAGE=$(cat ./HISTORY.md | sed -n \"/## v$npm_package_version/,/##/p\" | sed 's/## //' | awk 'NR>1{print buf}{buf = $0}') && test \"$MESSAGE\" || (echo 'proper changelog entry not found' && exit -1) && git tag v$npm_package_version -am \"$MESSAGE\"",
"our:setup": "npm run our:setup:install",
"our:setup:install": "npm install",
"our:test": "npm run our:verify && npm test",
"our:verify": "npm run our:verify:directory && npm run our:verify:eslint && npm run our:verify:prettier && npm run our:verify:typescript",
"our:verify:directory": "npx valid-directory",
"our:verify:eslint": "eslint --fix --ignore-pattern '**/*.d.ts' --ignore-pattern '**/vendor/' --ignore-pattern '**/node_modules/' --ext .mjs,.js,.jsx,.ts,.tsx ./source",
"our:verify:prettier": "prettier --write ./source/**",
"our:verify:typescript": "tsc --noEmit --project tsconfig.json",
"test": "node ./edition-es5/test.js"
},
"type": "commonjs",
"types": "./compiled-types/",
"version": "2.3.1"
}

409
node_modules/editions/source/index.ts generated vendored Normal file
View File

@@ -0,0 +1,409 @@
/* eslint no-console:0 */
'use strict'
// Imports
import pathUtil from 'path'
import semver from 'semver'
import { errtion, stringify, simplifyRange } from './util.js'
// As Errlop uses Editions, we should use a specific Errlop edition
// As otherwise, the circular reference may fail on some machines
// https://github.com/bevry/errlop/issues/2
import Errlop from 'errlop'
/**
* The current node version that we are operating within.
* It is compared in {@link requireEdition} against {@link Edition.engines}.
*/
const NODE_VERSION: string = process.versions.node
/**
* Set the environment variable `EDITIONS_VERBOSE` to output debugging information to stderr on how editions selected the edition it did.
* Values of `yes` and `true` are supported.
* @example env EDITIONS_VERBOSE=true node mypackage/index.js
*/
type EDITIONS_VERBOSE = string | boolean | undefined
/**
* Whether or not {@link EDITIONS_VERBOSE} is enabled.
* @type {bollean}
* @private
*/
const VERBOSE: boolean =
(process.env.EDITIONS_VERBOSE as EDITIONS_VERBOSE) === true ||
(process.env.EDITIONS_VERBOSE as EDITIONS_VERBOSE) === 'yes' ||
(process.env.EDITIONS_VERBOSE as EDITIONS_VERBOSE) === 'true' ||
false
/**
* Set the environment variable `EDITIONS_TAG_BLACKLIST` to the tags you wish to blacklist, and editions will skip editions that contain them.
* For backwards compatibility `EDITIONS_SYNTAX_BLACKLIST` is also supported.
* It is compared in {@link requireEdition} against {@link Edition.tags}.
* The value of this is stored locally in the {@link BLACKLIST} cache.
* @example env EDITIONS_TAG_BLACKLIST=esnext,typescript,coffeescript node mypackage/index.js
*/
type EDITIONS_TAG_BLACKLIST = string
/**
* A list of the blacklisted tags.
* Data imported from {@link EDITIONS_TAG_BLACKLIST}.
*/
const BLACKLIST: string[] =
(process.env.EDITIONS_TAG_BLACKLIST as EDITIONS_TAG_BLACKLIST)?.split(
/[, ]+/g
) ||
(process.env.EDITIONS_SYNTAX_BLACKLIST as EDITIONS_TAG_BLACKLIST)?.split(
/[, ]+/g
)
/**
* A mapping of blacklisted tags to their reasons.
* Keys are the tags.
* Values are the error instances that contain the reasoning for why/how that tag is/became blacklisted.
* Data imported from {@link EDITIONS_TAG_BLACKLIST}.
*/
const blacklist: { [tag: string]: Error } = {}
/** Edition entries must conform to the following specification. */
export interface Edition {
/**
* Use this property to decribe the edition in human readable terms. Such as what it does and who it is for. It is used to reference the edition in user facing reporting, such as error messages.
* @example "esnext source code with require for modules"
*/
description: String
/**
* The location to where this directory is located. It should be a relative path from the `package.json` file.
* @example "source"
*/
directory: string
/**
* The default entry location for this edition, relative to the edition's directory.
* @example "index.js"
*/
entry?: string
/**
* Any keywords you wish to associate to the edition. Useful for various ecosystem tooling, such as automatic ESNext lint configuration if the `esnext` tag is present in the source edition tags. Consumers also make use of this via {@link EDITIONS_TAG_BLACKLIST} for preventing loading editions that contain a blacklisted tag. Previously this field was named `syntaxes`.
* @example ["javascript", "esnext", "require"]
*/
tags?: string[]
/** @alias tags */
syntaxes?: Edition['tags']
/**
* This field is used to specific which Node.js and Browser environments this edition supports. If `false` this edition does not support either. If `node` is a string, it should be a semver range of node.js versions that the edition targets. If `browsers` is a string, it should be a [browserlist](https://github.com/browserslist/browserslist) value of the specific browser values the edition targets. If `node` or `browsers` is true, it indicates that this edition is compatible with those environments.
* @example
* {
* "description": "esnext source code with require for modules",
* "directory": "source",
* "entry": "index.js",
* "tags": [
* "javascript",
* "esnext",
* "require"
* ],
* "engines": {
* "node": ">=6",
* "browsers": "defaults"
* }
* }
*/
engines?: false | { [engine: string]: string | boolean }
}
/** These are the various options that you can use to customise the behaviour of certain methods. */
export interface EditionOptions {
/** The require method of the calling module, used to ensure require paths remain correct. */
require: Function
/** If provided, this is used for debugging. */
packagePath?: string
/** If provided, any error loading an edition will be logged. By default, errors are only logged if all editions failed. If not provided, process.env.EDITIONS_VERBOSE is used. */
verbose?: boolean
/** If `true`, then only exact version matches will be loaded. If `false`, then likely matches using {@link simplifyRange} will be evaluated, with a fallback to the last. If missing, then `true` is attempted first and if no result, then `false` is attempted. */
strict?: boolean
/** If provided, this will be the cwd for entries. */
cwd?: string
/** If provided, should be a relative path to the entry point of the edition. */
entry?: string
/** If provided, should be the name of the package that we are loading the editions for. */
package?: string
/** If not provided, will use process.stderr instead. It is the stream that verbose errors are logged to. */
stderr?: NodeJS.WritableStream
}
// Create the mapping of blacklisted tags and their reasonings
if (BLACKLIST) {
for (let i = 0; i < BLACKLIST.length; ++i) {
const tag = BLACKLIST[i].trim().toLowerCase()
blacklist[tag] = errtion({
message: `The EDITIONS_TAG_BLACKLIST (aka EDITIONS_SYNTAX_BLACKLIST) environment variable blacklisted the tag [${tag}]`,
code: 'blacklisted-tag'
})
}
}
// Blacklist the tag 'esnext' if our node version is below 0.12
if (semver.satisfies(NODE_VERSION, '<0.12')) {
blacklist.esnext = new Error(
'The esnext tag is skipped on early node versions as attempting to use esnext features will output debugging information on these node versions'
)
}
/**
* Attempt to load a specific {@link Edition}.
* @returns The result of the loaded edition.
* @throws An error if the edition failed to load.
*/
export function loadEdition(edition: Edition, opts: EditionOptions): any {
const entry = pathUtil.resolve(
opts.cwd || '',
edition.directory,
opts.entry || edition.entry || ''
)
if (opts.require == null) {
throw errtion({
message: `Skipped edition [${edition.description}] as opts.require was not provided, this is probably due to a testing misconfiguration.`,
code: 'unsupported-edition-require'
})
}
try {
return opts.require(entry)
} catch (loadError) {
// Note the error with more details
throw errtion(
{
message: `Skipped edition [${edition.description}] at entry [${entry}] because it failed to load`,
code: 'unsupported-edition-tried'
},
loadError
)
}
}
/**
* Attempt to require an {@link Edition}, based on its compatibility with the current environment, such as {@link NODE_VERSION} and {@link EDITIONS_TAG_BLACKLIST} compatibility.
* If compatibility is established with the environment, it will load the edition using {@link loadEdition}.
* @returns The result of the loaded edition
* @throws An error if the edition failed to load
*/
export function requireEdition(edition: Edition, opts: EditionOptions): any {
// Verify the edition is valid
if (
!edition.description ||
!edition.directory ||
!edition.entry ||
edition.engines == null
) {
throw errtion({
message: `Each edition must have its [description, directory, entry, engines] fields defined, yet all it had was [${Object.keys(
edition
).join(', ')}]`,
code: 'unsupported-edition-malformed',
level: 'fatal'
})
}
// Handle strict omission
if (opts.strict == null) {
try {
return requireEdition(edition, { ...opts, strict: true })
} catch (err) {
return requireEdition(edition, { ...opts, strict: false })
}
}
// Verify tag support
// Convert tags into a sorted lowercase string
const tags = (edition.tags || edition.syntaxes || [])
.map(i => i.toLowerCase())
.sort()
for (let index = 0; index < tags.length; index++) {
const tag = tags[index]
const blacklisted = blacklist[tag]
if (blacklisted) {
throw errtion(
{
message: `Skipping edition [${edition.description}] because it contained a blacklisted tag [${tag}]`,
code: 'unsupported-edition-backlisted-tag'
},
blacklisted
)
}
}
// Verify engine support
if (edition.engines === false) {
throw errtion({
message: `Skipping edition [${edition.description}] because its engines field was false`,
code: 'unsupported-edition-engine'
})
}
if (!edition.engines.node) {
throw errtion({
message: `Skipping edition [${edition.description}] because its .engines.node field was falsey`,
code: 'unsupported-edition-engines-node'
})
}
if (opts.strict) {
if (edition.engines.node === true) {
throw errtion({
message: `Skipping edition [${edition.description}] because its .engines.node field was true yet we are in strict mode`,
code: 'unsupported-edition-engines-node-version-true'
})
} else if (semver.satisfies(NODE_VERSION, edition.engines.node) === false) {
throw errtion({
message: `Skipping edition [${
edition.description
}] because our current node version [${NODE_VERSION}] is not supported by its specific range [${stringify(
edition.engines.node
)}]`,
code: 'unsupported-edition-engines-node-version-specific'
})
}
} else if (edition.engines.node !== true) {
const simplifiedRange = simplifyRange(edition.engines.node)
if (semver.satisfies(NODE_VERSION, simplifiedRange) === false) {
throw errtion({
message: `Skipping edition [${
edition.description
}] because our current node version [${NODE_VERSION}] is not supported by its simplified range [${stringify(
simplifiedRange
)}]`,
code: 'unsupported-edition-engines-node-version-simplified'
})
}
}
// Load the edition
return loadEdition(edition, opts)
}
/**
* Cycles through a list of editions, returning the require result of the first suitable {@link Edition} that it was able to load.
* Editions should be ordered from most preferable first, to least desirable last.
* Providing the editions configuration is valid, individual edition handling is forwarded to {@link requireEdition}.
* @returns The result of the loaded edition.
* @throws An error if a suitable edition was unable to be resolved.
*/
export function requireEditions(
editions: Edition[],
opts: EditionOptions
): any {
// Check
if (!editions || editions.length === 0) {
if (opts.packagePath) {
throw errtion({
message: `There were no editions specified for package [${opts.packagePath}]`,
code: 'unsupported-editions-missing'
})
} else {
throw errtion({
message: 'There were no editions specified',
code: 'unsupported-editions-missing'
})
}
}
// Handle strict omission
if (opts.strict == null) {
try {
return requireEditions(editions, { ...opts, strict: true })
} catch (err) {
return requireEditions(editions, { ...opts, strict: false })
}
}
// Whether or not we should be verbose
const verbose = opts.verbose == null ? VERBOSE : opts.verbose
// Capture the load result, the last error, and the fallback option
let result,
loaded = false,
editionsError = null,
fallbackEdition = null
// Cycle through the editions determing the above
for (let i = 0; i < editions.length; ++i) {
const edition = editions[i]
try {
result = requireEdition(edition, opts)
loaded = true
break
} catch (editionError) {
if (editionError.level === 'fatal') {
editionsError = editionError
break
} else if (editionsError) {
editionsError = errtion(editionsError, editionError)
} else {
editionsError = editionError
}
// make the fallback edition one that we don't bother loading due to its engines
// also: don't assume that .code is accessible, as it may not be, even if it should be, due to the way different environments behave
if (
String(editionError.code || '').indexOf(
'unsupported-edition-engines-node-version'
) === 0
) {
fallbackEdition = edition
}
}
}
// if no edition was suitable for our environment, then try the fallback if it exists
// that is to say, ignore its engines.node
if (opts.strict === false && loaded === false && fallbackEdition) {
try {
result = loadEdition(fallbackEdition, opts)
loaded = true
} catch (editionError) {
editionsError = new Errlop(editionError, editionsError)
}
}
// if we were able to load something, then provide it
if (loaded) {
// make note of any errors if desired
if (editionsError && verbose) {
const stderr = opts.stderr || process.stderr
stderr.write(editionsError.stack + '\n')
}
return result
}
// otherwise, provide the error
else if (editionsError) {
if (opts.packagePath) {
throw errtion(
{
message: `There were no suitable editions for package [${opts.packagePath}]`,
code: 'unsupported-editions-tried'
},
editionsError
)
} else {
throw errtion(
{
message: 'There were no suitable editions',
code: 'unsupported-editions-tried'
},
editionsError
)
}
}
}
/**
* Cycle through the editions for a package and require the correct one.
* Providing the package configuration is valid, editions handling is forwarded to {@link requireEditions}.
* @returns The result of the loaded edition.
* @throws An error if a suitable edition was unable to be resolved.
*/
export function requirePackage(
cwd: EditionOptions['cwd'],
require: EditionOptions['require'],
entry: EditionOptions['entry']
): any {
// Load the package.json file to fetch `name` for debugging and `editions` for loading
const packagePath = pathUtil.resolve(cwd || '', 'package.json')
const { editions } = require(packagePath)
const opts = { packagePath, cwd, require, entry }
return requireEditions(editions, opts)
}

40
node_modules/editions/source/util.ts generated vendored Normal file
View File

@@ -0,0 +1,40 @@
'use strict'
// As Errlop uses Editions, we should use a specific Errlop edition
// As otherwise, the circular reference may fail on some machines
// https://github.com/bevry/errlop/issues/2
import Errlop from 'errlop'
interface ErrtionOptions {
message: string
code: string | number
level?: string | number
}
interface Errtion extends Errlop, ErrtionOptions {}
/**
* Allow code and level inputs on Errlop.
* We do this instead of a class extension, as class extensions do not interop well on node 0.8, which is our target.
*/
export function errtion(
this: void,
opts: ErrtionOptions,
parent?: Errlop | Error
): Errtion {
const { message, code, level } = opts
const error = new Errlop(message, parent) as Errtion
if (code) error.code = code
if (level) error.level = level
return error
}
/** Converts anything to a string, by returning strings and serialising objects. */
export function stringify(value: any): string {
return typeof value === 'string' ? value : JSON.stringify(value)
}
/** Converts a version range like `4 || 6` to `>=4` */
export function simplifyRange(range: string): string {
return range.replace(/^([.\-\w]+)(\s.+)?$/, '>=$1')
}

14
node_modules/editions/tsconfig.json generated vendored Normal file
View File

@@ -0,0 +1,14 @@
{
"compilerOptions": {
"allowJs": true,
"esModuleInterop": true,
"isolatedModules": true,
"maxNodeModuleJsDepth": 5,
"moduleResolution": "node",
"strict": true,
"target": "esnext"
},
"include": [
"source"
]
}