initial commit

This commit is contained in:
air66
2019-07-24 18:16:32 +01:00
commit 5efebf4ded
8591 changed files with 899103 additions and 0 deletions

16
node_modules/editions/.flowconfig generated vendored Normal file
View File

@@ -0,0 +1,16 @@
# 2018 January 24
# https://github.com/bevry/base
[ignore]
.*/docs/.*
.*/es2015/.*
.*/test/.*
.*/node_modules/documentation/.*
.*/node_modules/projectz/.*
[options]
module.ignore_non_literal_requires=true
esproposal.class_static_fields=enable
esproposal.class_instance_fields=enable
[version]
>=0.23 <1

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

@@ -0,0 +1,44 @@
# History
## 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 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 -->

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

@@ -0,0 +1,109 @@
<!-- TITLE/ -->
<h1>editions</h1>
<!-- /TITLE -->
<!-- BADGES/ -->
<span class="badge-travisci"><a href="http://travis-ci.org/bevry/editions" title="Check this project's build status on TravisCI"><img src="https://img.shields.io/travis/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-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-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-gratipay"><a href="https://www.gratipay.com/bevry" title="Donate weekly to this project using Gratipay"><img src="https://img.shields.io/badge/gratipay-donate-yellow.svg" alt="Gratipay 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-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-bitcoin"><a href="https://bevry.me/bitcoin" title="Donate once-off to this project using Bitcoin"><img src="https://img.shields.io/badge/bitcoin-donate-yellow.svg" alt="Bitcoin 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>
<br class="badge-separator" />
<span class="badge-slackin"><a href="https://slack.bevry.me" title="Join this project's slack community"><img src="https://slack.bevry.me/badge.svg" alt="Slack community badge" /></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)
[Get started with the guides and explanations.](https://github.com/bevry/editions/wiki)
[View the 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-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-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-gratipay"><a href="https://www.gratipay.com/bevry" title="Donate weekly to this project using Gratipay"><img src="https://img.shields.io/badge/gratipay-donate-yellow.svg" alt="Gratipay 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-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-bitcoin"><a href="https://bevry.me/bitcoin" title="Donate once-off to this project using Bitcoin"><img src="https://img.shields.io/badge/bitcoin-donate-yellow.svg" alt="Bitcoin 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></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 -->

211
node_modules/editions/es2015/index.js generated vendored Normal file
View File

@@ -0,0 +1,211 @@
/* @flow */
/* eslint no-console:0 */
'use strict';
// Imports
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var pathUtil = require('path');
// Helper class to display nested error in a sensible way
var DetailedError = function (_Error) {
_inherits(DetailedError, _Error);
function DetailedError(message /* :string */, details /* :Object */) {
_classCallCheck(this, DetailedError);
Object.keys(details).forEach(function (key) {
var data = details[key];
var value = require('util').inspect(data.stack || data.message || data);
message += '\n' + key + ': ' + value;
});
return _possibleConstructorReturn(this, (DetailedError.__proto__ || Object.getPrototypeOf(DetailedError)).call(this, message));
}
return DetailedError;
}(Error);
// Environment fetching
var blacklist = process && process.env && process.env.EDITIONS_SYNTAX_BLACKLIST && process.env.EDITIONS_SYNTAX_BLACKLIST.split(',');
// Cache of which syntax combinations are supported or unsupported, hash of booleans
var syntaxFailedCombitions = {}; // sorted lowercase syntax combination => Error instance of failure
var syntaxBlacklist = {};
syntaxBlacklist.import = new Error('The import syntax is skipped as the module package.json field eliminates the need for autoloader support');
syntaxBlacklist.coffeescript = new Error('The coffeescript syntax is skipped as we want to use a precompiled edition rather than compiling at runtime');
syntaxBlacklist.typescript = new Error('The typescript syntax is skipped as we want to use a precompiled edition rather than compiling at runtime');
// Blacklist non-esnext node versions from esnext
if (process && process.versions && process.versions.node) {
var EARLIEST_ESNEXT_NODE_VERSION = [0, 12];
var NODE_VERSION = process.versions.node.split('.').map(function (n) {
return parseInt(n, 10);
});
var ESNEXT_UNSUPPORTED = NODE_VERSION[0] < EARLIEST_ESNEXT_NODE_VERSION[0] || NODE_VERSION[0] === EARLIEST_ESNEXT_NODE_VERSION[0] && NODE_VERSION[1] < EARLIEST_ESNEXT_NODE_VERSION[1];
if (ESNEXT_UNSUPPORTED) syntaxBlacklist.esnext = new Error('The esnext syntax is skipped on early node versions as attempting to use esnext features will output debugging information on these node versions');
}
// Check the environment configuration for a syntax blacklist
if (blacklist) {
for (var i = 0; i < blacklist.length; ++i) {
var syntax = blacklist[i].trim().toLowerCase();
syntaxBlacklist[syntax] = new DetailedError('The EDITIONS_SYNTAX_BLACKLIST environment variable has blacklisted an edition syntax:', { syntax: syntax, blacklist: blacklist });
}
}
/* ::
type edition = {
name:number,
description?:string,
directory?:string,
entry?:string,
syntaxes?:Array<string>
};
type options = {
cwd?:string,
package?:string,
entry?:string,
require:function
};
*/
/**
* Cycle through the editions and require the correct one
* @protected internal function that is untested for public consumption
* @param {edition} edition - the edition entry
* @param {Object} opts - the following options
* @param {string} opts.require - the require method of the calling module, used to ensure require paths remain correct
* @param {string} [opts.cwd] - if provided, this will be the cwd for entries
* @param {string} [opts.entry] - if provided, should be a relative or absolute path to the entry point of the edition
* @param {string} [opts.package] - if provided, should be the name of the package that we are loading the editions for
* @returns {*}
*/
function requireEdition(edition /* :edition */, opts /* :options */) /* :any */{
// Prevent require from being included in debug logs
Object.defineProperty(opts, 'require', { value: opts.require, enumerable: false });
// Get the correct entry path
// As older versions o
var cwd = opts.cwd || '';
var dir = edition.directory || '';
var entry = opts.entry || edition.entry || '';
if (dir && entry && entry.indexOf(dir + '/') === 0) entry = entry.substring(dir.length + 1);
// ^ this should not be needed, but as previous versions of editions included the directory inside the entry
// it unfortunately is, as such this is a stepping stone for the new format, the new format being
// if entry is specified by itself, it is cwd => entry
// if entry is specified with a directory, it is cwd => dir => entry
// if entry is not specified but dir is, it is cwd => dir
// if neither entry nor dir are specified, we have a problem
if (!dir && !entry) {
var editionFailure = new DetailedError('Skipped edition due to no entry or directory being specified:', { edition: edition, cwd: cwd, dir: dir, entry: entry });
throw editionFailure;
}
var entryPath = pathUtil.resolve(cwd, dir, entry);
// Check syntax support
// Convert syntaxes into a sorted lowercase string
var syntaxes = edition.syntaxes && edition.syntaxes.map(function (i) {
return i.toLowerCase();
}).sort();
var syntaxCombination = syntaxes && syntaxes.join(', ');
if (syntaxes && syntaxCombination) {
// Check if any of the syntaxes are unsupported
var unsupportedSyntaxes = syntaxes.filter(function (i) {
return syntaxBlacklist[i.toLowerCase()];
});
if (unsupportedSyntaxes.length) {
var _editionFailure = new DetailedError('Skipped edition due to it containing an unsupported syntax:', { edition: edition, unsupportedSyntaxes: unsupportedSyntaxes });
throw _editionFailure;
}
// Is this syntax combination unsupported? If so skip it with a soft failure to try the next edition
else if (syntaxFailedCombitions[syntaxCombination]) {
var previousCombinationFailure = syntaxFailedCombitions[syntaxCombination];
var _editionFailure2 = new DetailedError('Skipped edition due to its syntax combinatiom failing previously:', { edition: edition, previousCombinationFailure: previousCombinationFailure });
throw _editionFailure2;
}
}
// Try and load this syntax combination
try {
return opts.require(entryPath);
} catch (error) {
// Note the error with more details
var _editionFailure3 = new DetailedError('Failed to load the edition due to a load error:', { edition: edition, error: error.stack });
// Blacklist the combination, even if it may have worked before
// Perhaps in the future note if that if it did work previously, then we should instruct module owners to be more specific with their syntaxes
if (syntaxCombination) syntaxFailedCombitions[syntaxCombination] = _editionFailure3;
// Continue to the next edition
throw _editionFailure3;
}
}
/**
* Cycle through the editions and require the correct one
* @protected internal function that is untested for public consumption
* @param {Array<edition>} editions - an array of edition entries
* @param {Object} opts - the following options
* @param {string} opts.require - the require method of the calling module, used to ensure require paths remain correct
* @param {string} [opts.cwd] - if provided, this will be the cwd for entries
* @param {string} [opts.entry] - if provided, should be a relative path to the entry point of the edition
* @param {string} [opts.package] - if provided, should be the name of the package that we are loading the editions for
* @returns {*}
*/
function requireEditions(editions /* :Array<edition> */, opts /* :options */) /* :any */{
// Extract
if (opts.package == null) opts.package = 'custom runtime package';
// Check
if (!editions || editions.length === 0) {
throw new DetailedError('No editions were specified:', { opts: opts });
}
// Note the last error message
var editionFailures = [];
// Cycle through the editions
for (var _i = 0; _i < editions.length; ++_i) {
var edition = editions[_i];
try {
return requireEdition(edition, opts);
} catch (err) {
editionFailures.push(err);
}
}
// Through the error as no edition loaded
throw new DetailedError('There are no suitable editions for this environment:', { opts: opts, editions: editions, failures: editionFailures });
}
/**
* Cycle through the editions for a package and require the correct one
* @param {string} cwd - the path of the package, used to load package.json:editions and handle relative edition entry points
* @param {function} require - the require method of the calling module, used to ensure require paths remain correct
* @param {string} [entry] - an optional override for the entry of an edition, requires the edition to specify a `directory` property
* @returns {*}
*/
function requirePackage(cwd /* :string */, require /* :function */, entry /* :: ?:string */) /* :any */{
// Load the package.json file to fetch `name` for debugging and `editions` for loading
var packagePath = pathUtil.resolve(cwd, 'package.json');
var _require = require(packagePath),
name = _require.name,
editions = _require.editions;
var opts /* :options */ = { cwd: cwd, require: require };
if (name) opts.package = name;
if (entry) opts.entry = entry;
return requireEditions(editions, opts);
}
// Exports
module.exports = { requireEdition: requireEdition, requireEditions: requireEditions, requirePackage: requirePackage };

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

@@ -0,0 +1,169 @@
{
"_from": "editions@^1.3.3",
"_id": "editions@1.3.4",
"_inBundle": false,
"_integrity": "sha512-gzao+mxnYDzIysXKMQi/+M1mjy/rjestjg6OPoYTtI+3Izp23oiGZitsl9lPDPiTGXbcSIk1iJWhliSaglxnUg==",
"_location": "/editions",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "editions@^1.3.3",
"name": "editions",
"escapedName": "editions",
"rawSpec": "^1.3.3",
"saveSpec": null,
"fetchSpec": "^1.3.3"
},
"_requiredBy": [
"/istextorbinary"
],
"_resolved": "https://registry.npmjs.org/editions/-/editions-1.3.4.tgz",
"_shasum": "3662cb592347c3168eb8e498a0ff73271d67f50b",
"_spec": "editions@^1.3.3",
"_where": "D:\\Air66 Files\\dev_sites\\www.airurl.dev.cc\\user\\plugins\\air66Theme\\node_modules\\istextorbinary",
"author": {
"name": "2016+ Bevry Pty Ltd",
"email": "us@bevry.me",
"url": "http://bevry.me"
},
"badges": {
"list": [
"travisci",
"npmversion",
"npmdownloads",
"daviddm",
"daviddmdev",
"---",
"patreon",
"opencollective",
"gratipay",
"flattr",
"paypal",
"bitcoin",
"wishlist",
"---",
"slackin"
],
"config": {
"patreonUsername": "bevry",
"opencollectiveUsername": "bevry",
"gratipayUsername": "bevry",
"flattrUsername": "balupton",
"paypalURL": "https://bevry.me/paypal",
"bitcoinURL": "https://bevry.me/bitcoin",
"wishlistURL": "https://bevry.me/wishlist",
"slackinURL": "https://slack.bevry.me"
}
},
"bugs": {
"url": "https://github.com/bevry/editions/issues"
},
"bundleDependencies": false,
"contributors": [
{
"name": "Benjamin Lupton",
"email": "b@lupton.cc",
"url": "http://balupton.com"
},
{
"name": "Zlatan Vasović",
"email": "zlatanvasovic@gmail.com",
"url": "http://zdroid.github.io"
}
],
"dependencies": {},
"deprecated": false,
"description": "Publish multiple editions for your JavaScript packages consistently and easily (e.g. source edition, esnext edition, es2015 edition)",
"devDependencies": {
"assert-helpers": "^4.5.1",
"babel-cli": "^6.26.0",
"babel-preset-es2015": "^6.24.1",
"documentation": "^5.3.5",
"eslint": "^4.16.0",
"flow-bin": "^0.64.0",
"joe": "^2.0.2",
"joe-reporter-console": "^2.0.1",
"projectz": "^1.4.0",
"surge": "^0.19.0"
},
"editions": [
{
"description": "Source + ESNext + Require + Flow Type Comments",
"directory": "source",
"entry": "index.js",
"syntaxes": [
"javascript",
"esnext",
"require",
"arrows",
"destructuring",
"const",
"let",
"flow type comments"
]
},
{
"description": "Babel Compiled + ES2015 + Require",
"directory": "es2015",
"entry": "index.js",
"syntaxes": [
"javascript",
"es2015",
"require"
]
}
],
"engines": {
"node": ">=0.8"
},
"homepage": "https://github.com/bevry/editions",
"keywords": [
"editions",
"edition",
"versions",
"syntaxes",
"esnext",
"jsnext",
"es2015",
"es6",
"es6+"
],
"license": "MIT",
"main": "es2015/index.js",
"maintainers": [
{
"name": "Benjamin Lupton",
"email": "b@lupton.cc",
"url": "http://balupton.com"
}
],
"name": "editions",
"repository": {
"type": "git",
"url": "git+https://github.com/bevry/editions.git"
},
"scripts": {
"our:clean": "rm -Rf ./docs ./es2015 ./es5 ./out",
"our:compile": "npm run our:compile:es2015",
"our:compile:es2015": "babel ./source --out-dir ./es2015 --presets es2015",
"our:meta": "npm run our:meta:docs && npm run our:meta:projectz",
"our:meta:docs": "documentation build -f html -o ./docs -g --shallow ./source/**.js",
"our:meta:projectz": "projectz compile",
"our:release": "npm run our:release:prepare && npm run our:release:check && npm run our:release:tag && npm run our:release:push",
"our:release:check": "npm run our:release:check:changelog && npm run our:release:check:dirty",
"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:npm",
"our:setup:npm": "npm install",
"our:test": "npm run our:verify && npm test",
"our:verify": "npm run our:verify:eslint && npm run our:verify:flow",
"our:verify:eslint": "eslint --fix ./source",
"our:verify:flow": "flow check",
"test": "node --harmony ./es2015/test.js --joe-reporter=console"
},
"version": "1.3.4"
}

190
node_modules/editions/source/index.js generated vendored Normal file
View File

@@ -0,0 +1,190 @@
/* @flow */
/* eslint no-console:0 */
'use strict'
// Imports
const pathUtil = require('path')
// Helper class to display nested error in a sensible way
class DetailedError extends Error {
constructor (message /* :string */, details /* :Object */) {
Object.keys(details).forEach(function (key) {
const data = details[key]
const value = require('util').inspect(data.stack || data.message || data)
message += `\n${key}: ${value}`
})
super(message)
}
}
// Environment fetching
const blacklist = process && process.env && process.env.EDITIONS_SYNTAX_BLACKLIST && process.env.EDITIONS_SYNTAX_BLACKLIST.split(',')
// Cache of which syntax combinations are supported or unsupported, hash of booleans
const syntaxFailedCombitions = {} // sorted lowercase syntax combination => Error instance of failure
const syntaxBlacklist = {}
syntaxBlacklist.import = new Error('The import syntax is skipped as the module package.json field eliminates the need for autoloader support')
syntaxBlacklist.coffeescript = new Error('The coffeescript syntax is skipped as we want to use a precompiled edition rather than compiling at runtime')
syntaxBlacklist.typescript = new Error('The typescript syntax is skipped as we want to use a precompiled edition rather than compiling at runtime')
// Blacklist non-esnext node versions from esnext
if ( process && process.versions && process.versions.node ) {
const EARLIEST_ESNEXT_NODE_VERSION = [0, 12]
const NODE_VERSION = process.versions.node.split('.').map((n) => parseInt(n, 10))
const ESNEXT_UNSUPPORTED = NODE_VERSION[0] < EARLIEST_ESNEXT_NODE_VERSION[0] || (
NODE_VERSION[0] === EARLIEST_ESNEXT_NODE_VERSION[0] &&
NODE_VERSION[1] < EARLIEST_ESNEXT_NODE_VERSION[1]
)
if ( ESNEXT_UNSUPPORTED ) syntaxBlacklist.esnext = new Error('The esnext syntax is skipped on early node versions as attempting to use esnext features will output debugging information on these node versions')
}
// Check the environment configuration for a syntax blacklist
if ( blacklist ) {
for ( let i = 0; i < blacklist.length; ++i ) {
const syntax = blacklist[i].trim().toLowerCase()
syntaxBlacklist[syntax] = new DetailedError('The EDITIONS_SYNTAX_BLACKLIST environment variable has blacklisted an edition syntax:', {syntax, blacklist})
}
}
/* ::
type edition = {
name:number,
description?:string,
directory?:string,
entry?:string,
syntaxes?:Array<string>
};
type options = {
cwd?:string,
package?:string,
entry?:string,
require:function
};
*/
/**
* Cycle through the editions and require the correct one
* @protected internal function that is untested for public consumption
* @param {edition} edition - the edition entry
* @param {Object} opts - the following options
* @param {string} opts.require - the require method of the calling module, used to ensure require paths remain correct
* @param {string} [opts.cwd] - if provided, this will be the cwd for entries
* @param {string} [opts.entry] - if provided, should be a relative or absolute path to the entry point of the edition
* @param {string} [opts.package] - if provided, should be the name of the package that we are loading the editions for
* @returns {*}
*/
function requireEdition ( edition /* :edition */, opts /* :options */ ) /* :any */ {
// Prevent require from being included in debug logs
Object.defineProperty(opts, 'require', {value: opts.require, enumerable: false})
// Get the correct entry path
// As older versions o
const cwd = opts.cwd || ''
const dir = edition.directory || ''
let entry = opts.entry || edition.entry || ''
if ( dir && entry && entry.indexOf(dir + '/') === 0 ) entry = entry.substring(dir.length + 1)
// ^ this should not be needed, but as previous versions of editions included the directory inside the entry
// it unfortunately is, as such this is a stepping stone for the new format, the new format being
// if entry is specified by itself, it is cwd => entry
// if entry is specified with a directory, it is cwd => dir => entry
// if entry is not specified but dir is, it is cwd => dir
// if neither entry nor dir are specified, we have a problem
if ( !dir && !entry ) {
const editionFailure = new DetailedError('Skipped edition due to no entry or directory being specified:', {edition, cwd, dir, entry})
throw editionFailure
}
const entryPath = pathUtil.resolve(cwd, dir, entry)
// Check syntax support
// Convert syntaxes into a sorted lowercase string
const syntaxes = edition.syntaxes && edition.syntaxes.map((i) => i.toLowerCase()).sort()
const syntaxCombination = syntaxes && syntaxes.join(', ')
if ( syntaxes && syntaxCombination ) {
// Check if any of the syntaxes are unsupported
const unsupportedSyntaxes = syntaxes.filter((i) => syntaxBlacklist[i.toLowerCase()])
if ( unsupportedSyntaxes.length ) {
const editionFailure = new DetailedError('Skipped edition due to it containing an unsupported syntax:', {edition, unsupportedSyntaxes})
throw editionFailure
}
// Is this syntax combination unsupported? If so skip it with a soft failure to try the next edition
else if ( syntaxFailedCombitions[syntaxCombination] ) {
const previousCombinationFailure = syntaxFailedCombitions[syntaxCombination]
const editionFailure = new DetailedError('Skipped edition due to its syntax combinatiom failing previously:', {edition, previousCombinationFailure})
throw editionFailure
}
}
// Try and load this syntax combination
try {
return opts.require(entryPath)
}
catch ( error ) {
// Note the error with more details
const editionFailure = new DetailedError('Failed to load the edition due to a load error:', {edition, error: error.stack})
// Blacklist the combination, even if it may have worked before
// Perhaps in the future note if that if it did work previously, then we should instruct module owners to be more specific with their syntaxes
if ( syntaxCombination ) syntaxFailedCombitions[syntaxCombination] = editionFailure
// Continue to the next edition
throw editionFailure
}
}
/**
* Cycle through the editions and require the correct one
* @protected internal function that is untested for public consumption
* @param {Array<edition>} editions - an array of edition entries
* @param {Object} opts - the following options
* @param {string} opts.require - the require method of the calling module, used to ensure require paths remain correct
* @param {string} [opts.cwd] - if provided, this will be the cwd for entries
* @param {string} [opts.entry] - if provided, should be a relative path to the entry point of the edition
* @param {string} [opts.package] - if provided, should be the name of the package that we are loading the editions for
* @returns {*}
*/
function requireEditions ( editions /* :Array<edition> */, opts /* :options */ ) /* :any */ {
// Extract
if ( opts.package == null ) opts.package = 'custom runtime package'
// Check
if ( !editions || editions.length === 0 ) {
throw new DetailedError('No editions were specified:', {opts})
}
// Note the last error message
const editionFailures = []
// Cycle through the editions
for ( let i = 0; i < editions.length; ++i ) {
const edition = editions[i]
try {
return requireEdition(edition, opts)
}
catch ( err ) {
editionFailures.push(err)
}
}
// Through the error as no edition loaded
throw new DetailedError('There are no suitable editions for this environment:', {opts, editions, failures: editionFailures})
}
/**
* Cycle through the editions for a package and require the correct one
* @param {string} cwd - the path of the package, used to load package.json:editions and handle relative edition entry points
* @param {function} require - the require method of the calling module, used to ensure require paths remain correct
* @param {string} [entry] - an optional override for the entry of an edition, requires the edition to specify a `directory` property
* @returns {*}
*/
function requirePackage (cwd /* :string */, require /* :function */, entry /* :: ?:string */ ) /* :any */ {
// Load the package.json file to fetch `name` for debugging and `editions` for loading
const packagePath = pathUtil.resolve(cwd, 'package.json')
const {name, editions} = require(packagePath)
const opts /* :options */ = {cwd, require}
if ( name ) opts.package = name
if ( entry ) opts.entry = entry
return requireEditions(editions, opts)
}
// Exports
module.exports = {requireEdition, requireEditions, requirePackage}