added unit testing, and started implementing unit tests...phew

This commit is contained in:
Josh Burman
2019-03-12 22:28:02 -04:00
parent 74aad4a957
commit e8c2539f1b
3489 changed files with 464813 additions and 88 deletions

59
node_modules/node-environment-flags/README.md generated vendored Normal file
View File

@ -0,0 +1,59 @@
# node-environment-flags
> Polyfill/shim for `process.allowedNodeEnvironmentFlags`
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
**node-environment-flags** is a *rough* polyfill and shim for [process.allowedNodeEnvironmentFlags](https://nodejs.org/api/process.html#process_process_allowednodeenvironmentflags), which was introduced in Node.js v10.10.0.
## Table of Contents
- [Install](#install)
- [Usage](#usage)
- [Maintainers](#maintainers)
- [Contribute](#contribute)
- [License](#license)
## Install
*Requires Node.js v6.0.0 or newer.*
```shell
$ npm i node-environment-flags
```
## Usage
If the current Node.js version is v10.10.0 or newer, the native implementation will be provided instead.
### As Polyfill (Recommended)
```js
const nodeEnvironmentFlags = require('node-environment-flags');
nodeEnvironmentFlags.has('--require'); // true
```
### As Shim
```js
require('node-environment-flags/shim')();
process.allowedNodeEnvironmentFlags.has('--require'); // true
```
## Notes
- This module approximates what `process.allowedNodeEnvironmentFlags` provides in versions of Node.js prior to v10.10.0. Since `process.allowedNodeEnvironmentFlags` is based on [`NODE_OPTIONS`](https://nodejs.org/api/cli.html#cli_node_options_options) (introduced in v8.0.0), the set of supported flags for versions older than v8.0.0 is *highly theoretical*.
- Version ranges are matched using [semver](https://npm.im/semver).
- This module is granular to the *minor* Node.js version number; *patch* version numbers are not considered.
- Results for unmaintained (odd) versions of Node.js are based on data for the most recent LTS version; e.g., running this module against Node.js v7.10.0 will yield the same results as would v6.14.0.
- Prior art: @ljharb's [util.promisify](https://npm.im/util.promisify)
## Maintainers
[@boneskull](https://github.com/boneskull)
## License
Copyright © 2018 Christopher Hiller. Licensed Apache-2.0.

439
node_modules/node-environment-flags/flags.json generated vendored Normal file
View File

@ -0,0 +1,439 @@
{
">=6.0.0 <6.3.0": [
"--debug",
"--debug-brk",
"--icu-data-dir",
"--no-deprecation",
"--no-warnings",
"--port",
"--prof-process",
"--require",
"--throw-deprecation",
"--tls-cipher-list",
"--trace-deprecation",
"--trace-sync-io",
"--trace-warnings",
"--track-heap-objects",
"--v8-pool-size",
"--zero-fill-buffers",
"-r"
],
">=6.3.0 <6.9.0": [
"--debug",
"--debug-brk",
"--icu-data-dir",
"--inspect",
"--no-deprecation",
"--no-warnings",
"--port",
"--prof-process",
"--require",
"--throw-deprecation",
"--tls-cipher-list",
"--trace-deprecation",
"--trace-sync-io",
"--trace-warnings",
"--track-heap-objects",
"--v8-pool-size",
"--zero-fill-buffers",
"-r"
],
">=6.9.0 <6.11.0": [
"--debug",
"--debug-brk",
"--icu-data-dir",
"--inspect",
"--no-deprecation",
"--no-warnings",
"--openssl-config",
"--port",
"--prof-process",
"--require",
"--throw-deprecation",
"--tls-cipher-list",
"--trace-deprecation",
"--trace-sync-io",
"--trace-warnings",
"--track-heap-objects",
"--v8-pool-size",
"--zero-fill-buffers",
"-r"
],
"~6.11.0": [
"--debug",
"--debug-brk",
"--icu-data-dir",
"--inspect",
"--no-deprecation",
"--no-warnings",
"--openssl-config",
"--port",
"--prof-process",
"--require",
"--throw-deprecation",
"--tls-cipher-list",
"--trace-deprecation",
"--trace-sync-io",
"--trace-warnings",
"--track-heap-objects",
"--use-bundled-ca",
"--use-openssl-ca",
"--v8-pool-size",
"--zero-fill-buffers",
"-r"
],
">=6.12.0 <8.0.0": [
"--debug",
"--debug-brk",
"--icu-data-dir",
"--inspect",
"--inspect-brk",
"--inspect-port",
"--no-deprecation",
"--no-warnings",
"--openssl-config",
"--port",
"--prof-process",
"--redirect-warnings",
"--require",
"--throw-deprecation",
"--tls-cipher-list",
"--trace-deprecation",
"--trace-sync-io",
"--trace-warnings",
"--track-heap-objects",
"--use-bundled-ca",
"--use-openssl-ca",
"--v8-pool-size",
"--zero-fill-buffers",
"-r"
],
">=8.0.0 <8.2.0": [
"--icu-data-dir",
"--inspect-brk",
"--inspect-port",
"--inspect",
"--loader",
"--max-old-space-size",
"--napi-modules",
"--no-deprecation",
"--no-warnings",
"--openssl-config",
"--pending-deprecation",
"--redirect-warnings",
"--require",
"--throw-deprecation",
"--tls-cipher-list",
"--trace-deprecation",
"--trace-event-categories",
"--trace-events-enabled",
"--trace-sync-io",
"--trace-warnings",
"--track-heap-objects",
"--use-bundled-ca",
"--use-openssl-ca",
"--v8-pool-size",
"--zero-fill-buffers",
"-r"
],
">=8.2.0 <8.4.0": [
"--abort-on-uncaught-exception",
"--icu-data-dir",
"--inspect-brk",
"--inspect-port",
"--inspect",
"--loader",
"--max-old-space-size",
"--napi-modules",
"--no-deprecation",
"--no-warnings",
"--openssl-config",
"--pending-deprecation",
"--redirect-warnings",
"--require",
"--throw-deprecation",
"--tls-cipher-list",
"--trace-deprecation",
"--trace-event-categories",
"--trace-events-enabled",
"--trace-sync-io",
"--trace-warnings",
"--track-heap-objects",
"--use-bundled-ca",
"--use-openssl-ca",
"--v8-pool-size",
"--zero-fill-buffers",
"-r"
],
"~8.4.0": [
"--abort-on-uncaught-exception",
"--expose-http2",
"--icu-data-dir",
"--inspect-brk",
"--inspect-port",
"--inspect",
"--loader",
"--max-old-space-size",
"--napi-modules",
"--no-deprecation",
"--no-warnings",
"--openssl-config",
"--pending-deprecation",
"--redirect-warnings",
"--require",
"--throw-deprecation",
"--tls-cipher-list",
"--trace-deprecation",
"--trace-event-categories",
"--trace-events-enabled",
"--trace-sync-io",
"--trace-warnings",
"--track-heap-objects",
"--use-bundled-ca",
"--use-openssl-ca",
"--v8-pool-size",
"--zero-fill-buffers",
"-r"
],
">=8.5.0 <8.8.0": [
"--abort-on-uncaught-exception",
"--experimental-modules",
"--expose-http2",
"--icu-data-dir",
"--inspect-brk",
"--inspect-port",
"--inspect",
"--loader",
"--max-old-space-size",
"--napi-modules",
"--no-deprecation",
"--no-warnings",
"--openssl-config",
"--pending-deprecation",
"--redirect-warnings",
"--require",
"--throw-deprecation",
"--tls-cipher-list",
"--trace-deprecation",
"--trace-event-categories",
"--trace-events-enabled",
"--trace-sync-io",
"--trace-warnings",
"--track-heap-objects",
"--use-bundled-ca",
"--use-openssl-ca",
"--v8-pool-size",
"--zero-fill-buffers",
"-r"
],
">=8.8.0 <8.12.0": [
"--abort-on-uncaught-exception",
"--experimental-modules",
"--expose-http2",
"--force-async-hooks-checks",
"--icu-data-dir",
"--inspect-brk",
"--inspect-port",
"--inspect",
"--loader",
"--max-old-space-size",
"--napi-modules",
"--no-deprecation",
"--no-warnings",
"--openssl-config",
"--pending-deprecation",
"--redirect-warnings",
"--require",
"--throw-deprecation",
"--tls-cipher-list",
"--trace-deprecation",
"--trace-event-categories",
"--trace-events-enabled",
"--trace-sync-io",
"--trace-warnings",
"--track-heap-objects",
"--use-bundled-ca",
"--use-openssl-ca",
"--v8-pool-size",
"--zero-fill-buffers",
"-r"
],
">=8.12.0 <10.0.0": [
"--abort-on-uncaught-exception",
"--experimental-modules",
"--expose-http2",
"--force-async-hooks-checks",
"--icu-data-dir",
"--inspect-brk",
"--inspect-port",
"--inspect",
"--loader",
"--max-old-space-size",
"--napi-modules",
"--no-deprecation",
"--no-warnings",
"--openssl-config",
"--pending-deprecation",
"--redirect-warnings",
"--require",
"--throw-deprecation",
"--tls-cipher-list",
"--trace-deprecation",
"--trace-event-categories",
"--trace-event-file-pattern",
"--trace-events-enabled",
"--trace-sync-io",
"--trace-warnings",
"--track-heap-objects",
"--use-bundled-ca",
"--use-openssl-ca",
"--v8-pool-size",
"--zero-fill-buffers",
"-r"
],
">=10.0.0 <10.3.0": [
"--enable-fips",
"--experimental-modules",
"--experimental-repl-await",
"--experimental-vm-modules",
"--force-fips",
"--icu-data-dir",
"--inspect-brk",
"--inspect-port",
"--inspect",
"--loader",
"--napi-modules",
"--no-deprecation",
"--no-force-async-hooks-checks",
"--no-warnings",
"--openssl-config",
"--pending-deprecation",
"--redirect-warnings",
"--require",
"--throw-deprecation",
"--tls-cipher-list",
"--trace-deprecation",
"--trace-event-categories",
"--trace-event-file-pattern",
"--trace-events-enabled",
"--trace-sync-io",
"--trace-warnings",
"--track-heap-objects",
"--use-bundled-ca",
"--use-openssl-ca",
"--v8-pool-size",
"--zero-fill-buffers",
"-r"
],
">=10.3.0 <10.5.0": [
"--enable-fips",
"--experimental-modules",
"--experimental-repl-await",
"--experimental-vm-modules",
"--force-fips",
"--icu-data-dir",
"--inspect-brk",
"--inspect-port",
"--inspect",
"--loader",
"--napi-modules",
"--no-deprecation",
"--no-force-async-hooks-checks",
"--no-warnings",
"--openssl-config",
"--pending-deprecation",
"--prof",
"--prof-process",
"--redirect-warnings",
"--require",
"--throw-deprecation",
"--tls-cipher-list",
"--trace-deprecation",
"--trace-event-categories",
"--trace-event-file-pattern",
"--trace-events-enabled",
"--trace-sync-io",
"--trace-warnings",
"--track-heap-objects",
"--use-bundled-ca",
"--use-openssl-ca",
"--v8-pool-size",
"--zero-fill-buffers",
"-r"
],
">=10.5.0 <10.7.0": [
"--enable-fips",
"--experimental-modules",
"--experimental-repl-await",
"--experimental-vm-modules",
"--experimental-worker",
"--force-fips",
"--icu-data-dir",
"--inspect-brk",
"--inspect-port",
"--inspect",
"--loader",
"--napi-modules",
"--no-deprecation",
"--no-force-async-hooks-checks",
"--no-warnings",
"--openssl-config",
"--pending-deprecation",
"--prof",
"--prof-process",
"--redirect-warnings",
"--require",
"--throw-deprecation",
"--tls-cipher-list",
"--trace-deprecation",
"--trace-event-categories",
"--trace-event-file-pattern",
"--trace-events-enabled",
"--trace-sync-io",
"--trace-warnings",
"--track-heap-objects",
"--use-bundled-ca",
"--use-openssl-ca",
"--v8-pool-size",
"--zero-fill-buffers",
"-r"
],
">=10.7.0 <10.10.0": [
"--enable-fips",
"--experimental-modules",
"--experimental-repl-await",
"--experimental-vm-modules",
"--experimental-worker",
"--force-fips",
"--icu-data-dir",
"--inspect-brk",
"--inspect-port",
"--inspect",
"--loader",
"--napi-modules",
"--no-deprecation",
"--no-force-async-hooks-checks",
"--no-warnings",
"--openssl-config",
"--pending-deprecation",
"--prof",
"--prof-process",
"--redirect-warnings",
"--require",
"--throw-deprecation",
"--title",
"--tls-cipher-list",
"--trace-deprecation",
"--trace-event-categories",
"--trace-event-file-pattern",
"--trace-events-enabled",
"--trace-sync-io",
"--trace-warnings",
"--track-heap-objects",
"--use-bundled-ca",
"--use-openssl-ca",
"--v8-pool-size",
"--zero-fill-buffers",
"-r"
]
}

62
node_modules/node-environment-flags/implementation.js generated vendored Normal file
View File

@ -0,0 +1,62 @@
'use strict';
const semver = require('semver');
const flags = require('./flags.json');
const getDescriptors = require('object.getownpropertydescriptors');
const replaceUnderscoresRegex = /_/g;
const leadingDashesRegex = /^--?/;
const trailingValuesRegex = /=.*$/;
const replace = Function.call.bind(String.prototype.replace);
const has = Function.call.bind(Set.prototype.has);
const test = Function.call.bind(RegExp.prototype.test);
const [allowedNodeEnvironmentFlags, detectedSemverRange] = Object.keys(
flags
).reduce(
(acc, range) =>
acc ||
(semver.satisfies(process.version, range) ? [flags[range], range] : acc),
null
);
const trimLeadingDashes = flag => replace(flag, leadingDashesRegex, '');
class NodeEnvironmentFlagsSet extends Set {
constructor(...args) {
super(...args);
this.add = () => this;
}
delete() {
return false;
}
clear() {}
has(key) {
if (typeof key === 'string') {
key = replace(key, replaceUnderscoresRegex, '-');
if (test(leadingDashesRegex, key)) {
key = replace(key, trailingValuesRegex, '');
return has(this, key);
}
return has(nodeFlags, key);
}
return false;
}
}
const nodeFlags = Object.defineProperties(
new Set(allowedNodeEnvironmentFlags.map(trimLeadingDashes)),
getDescriptors(Set.prototype)
);
Object.freeze(NodeEnvironmentFlagsSet.prototype.constructor);
Object.freeze(NodeEnvironmentFlagsSet.prototype);
exports.allowedNodeEnvironmentFlags = Object.freeze(
new NodeEnvironmentFlagsSet(allowedNodeEnvironmentFlags)
);
exports.detectedSemverRange = detectedSemverRange;

3
node_modules/node-environment-flags/index.js generated vendored Normal file
View File

@ -0,0 +1,3 @@
'use strict';
module.exports = require('./polyfill')();

96
node_modules/node-environment-flags/package.json generated vendored Normal file
View File

@ -0,0 +1,96 @@
{
"_from": "node-environment-flags@1.0.4",
"_id": "node-environment-flags@1.0.4",
"_inBundle": false,
"_integrity": "sha512-M9rwCnWVLW7PX+NUWe3ejEdiLYinRpsEre9hMkU/6NS4h+EEulYaDH1gCEZ2gyXsmw+RXYDaV2JkkTNcsPDJ0Q==",
"_location": "/node-environment-flags",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "node-environment-flags@1.0.4",
"name": "node-environment-flags",
"escapedName": "node-environment-flags",
"rawSpec": "1.0.4",
"saveSpec": null,
"fetchSpec": "1.0.4"
},
"_requiredBy": [
"/mocha"
],
"_resolved": "https://registry.npmjs.org/node-environment-flags/-/node-environment-flags-1.0.4.tgz",
"_shasum": "0b784a6551426bfc16d3b2208424dcbc2b2ff038",
"_spec": "node-environment-flags@1.0.4",
"_where": "/Users/josh.burman/Projects/braid/node_modules/mocha",
"author": {
"name": "Christopher Hiller",
"email": "boneskull@boneskull.com",
"url": "https://boneskull.com/"
},
"bugs": {
"url": "https://github.com/boneskull/node-environment-flags/issues"
},
"bundleDependencies": false,
"dependencies": {
"object.getownpropertydescriptors": "^2.0.3"
},
"deprecated": false,
"description": "> Polyfill/shim for `process.allowedNodeEnvironmentFlags`",
"devDependencies": {
"eslint": "^5.9.0",
"eslint-config-prettier": "^3.3.0",
"eslint-config-semistandard": "^13.0.0",
"eslint-config-standard": "^12.0.0",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-node": "^8.0.0",
"eslint-plugin-prettier": "^3.0.0",
"eslint-plugin-promise": "^4.0.1",
"eslint-plugin-standard": "^4.0.0",
"husky": "^1.1.3",
"lint-staged": "^8.0.4",
"mocha": "^5.2.0",
"nyc": "^13.1.0",
"prettier-eslint-cli": "^4.7.1",
"semantic-release": "^15.11.0",
"travis-deploy-once": "^5.0.9",
"unexpected": "^10.39.1"
},
"files": [
"implementation.js",
"flags.json",
"index.js",
"polyfill.js",
"shim.js"
],
"homepage": "https://github.com/boneskull/node-environment-flags#readme",
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"keywords": [],
"license": "Apache-2.0",
"lint-staged": {
"*.{js,json}": [
"prettier-eslint --write",
"git add"
]
},
"main": "index.js",
"name": "node-environment-flags",
"prettier": {
"singleQuote": true,
"bracketSpacing": false
},
"repository": {
"type": "git",
"url": "git+https://github.com/boneskull/node-environment-flags.git"
},
"scripts": {
"format": "prettier-eslint --write \"*.js\" \"*.json\" \"test/**/*.js\"",
"semantic-release": "semantic-release",
"test": "mocha",
"travis-deploy-once": "travis-deploy-once"
},
"version": "1.0.4"
}

8
node_modules/node-environment-flags/polyfill.js generated vendored Normal file
View File

@ -0,0 +1,8 @@
'use strict';
module.exports = () => {
if (typeof process.allowedNodeEnvironmentFlags === 'object') {
return process.allowedNodeEnvironmentFlags;
}
return require('./implementation').allowedNodeEnvironmentFlags;
};

16
node_modules/node-environment-flags/shim.js generated vendored Normal file
View File

@ -0,0 +1,16 @@
'use strict';
const getPolyfill = require('./polyfill');
module.exports = () => {
const polyfill = getPolyfill();
if (polyfill !== process.allowedNodeEnvironmentFlags) {
Object.defineProperty(process, 'allowedNodeEnvironmentFlags', {
writable: true,
enumerable: true,
configurable: true,
value: polyfill
});
}
return polyfill;
};