diff options
| author | ruki <waruqi@gmail.com> | 2018-11-08 00:38:48 +0800 |
|---|---|---|
| committer | ruki <waruqi@gmail.com> | 2018-11-07 21:53:09 +0800 |
| commit | 26105034da4fcce7ac883c899d781f016559310d (patch) | |
| tree | c459a5dc4e3aa0972d9919033ece511ce76dd129 /node_modules/util.promisify | |
| parent | 2c77f00f1a7ecb6c8192f9c16d3b2001b254a107 (diff) | |
| download | xmake-docs-26105034da4fcce7ac883c899d781f016559310d.tar.gz xmake-docs-26105034da4fcce7ac883c899d781f016559310d.zip | |
switch to vuepress
Diffstat (limited to 'node_modules/util.promisify')
| -rw-r--r-- | node_modules/util.promisify/.eslintrc | 16 | ||||
| -rw-r--r-- | node_modules/util.promisify/.npmignore | 61 | ||||
| -rw-r--r-- | node_modules/util.promisify/.travis.yml | 182 | ||||
| -rw-r--r-- | node_modules/util.promisify/CHANGELOG.md | 3 | ||||
| -rw-r--r-- | node_modules/util.promisify/LICENSE | 21 | ||||
| -rw-r--r-- | node_modules/util.promisify/README.md | 8 | ||||
| -rw-r--r-- | node_modules/util.promisify/implementation.js | 86 | ||||
| -rw-r--r-- | node_modules/util.promisify/index.js | 24 | ||||
| -rw-r--r-- | node_modules/util.promisify/package.json | 41 | ||||
| -rw-r--r-- | node_modules/util.promisify/polyfill.js | 11 | ||||
| -rw-r--r-- | node_modules/util.promisify/shim.js | 13 |
11 files changed, 466 insertions, 0 deletions
diff --git a/node_modules/util.promisify/.eslintrc b/node_modules/util.promisify/.eslintrc new file mode 100644 index 00000000..f2aa7953 --- /dev/null +++ b/node_modules/util.promisify/.eslintrc @@ -0,0 +1,16 @@ +{ + "root": true, + + "extends": "@ljharb", + + "env": { + "es6": true + }, + + "rules": { + "id-length": [2, { "max": 30 }], + "max-statements": [2, 16], + "no-magic-numbers": 0, + "operator-linebreak": [2, "before"] + } +} diff --git a/node_modules/util.promisify/.npmignore b/node_modules/util.promisify/.npmignore new file mode 100644 index 00000000..cf763ce3 --- /dev/null +++ b/node_modules/util.promisify/.npmignore @@ -0,0 +1,61 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (http://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# Typescript v1 declaration files +typings/ + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env + +# Only apps should have lockfiles +package-lock.json diff --git a/node_modules/util.promisify/.travis.yml b/node_modules/util.promisify/.travis.yml new file mode 100644 index 00000000..748ac89e --- /dev/null +++ b/node_modules/util.promisify/.travis.yml @@ -0,0 +1,182 @@ +language: node_js +os: + - linux +node_js: + - "8.0" + - "7.10" + - "6.10" + - "5.12" + - "4.8" + - "iojs-v3.3" + - "iojs-v2.5" + - "iojs-v1.8" + - "0.12" + - "0.10" + - "0.8" +before_install: + - 'if [ "${TRAVIS_NODE_VERSION}" = "0.6" ]; then npm install -g npm@1.3 ; elif [ "${TRAVIS_NODE_VERSION}" != "0.9" ]; then case "$(npm --version)" in 1.*) npm install -g npm@1.4.28 ;; 2.*) npm install -g npm@2 ;; esac ; fi' + - 'if [ "${TRAVIS_NODE_VERSION%${TRAVIS_NODE_VERSION#[0-9]}}" = "0" ]; then npm install -g npm@4.5 ; elif [ "${TRAVIS_NODE_VERSION}" != "0.6" ] && [ "${TRAVIS_NODE_VERSION}" != "0.9" ]; then npm install -g npm; fi' +install: + - 'if [ "${TRAVIS_NODE_VERSION}" = "0.6" ]; then nvm install 0.8 && npm install -g npm@1.3 && npm install -g npm@1.4.28 && npm install -g npm@2 && npm install && nvm use "${TRAVIS_NODE_VERSION}"; else npm install; fi;' +script: + - 'if [ -n "${PRETEST-}" ]; then npm run pretest ; fi' + - 'if [ -n "${POSTTEST-}" ]; then npm run posttest ; fi' + - 'if [ -n "${COVERAGE-}" ]; then npm run coverage ; fi' + - 'if [ -n "${TEST-}" ]; then npm run tests-only ; fi' +sudo: false +env: + - TEST=true +matrix: + fast_finish: true + include: + - node_js: "node" + env: PRETEST=true + - node_js: "7.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.11" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.10" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v3.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v3.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v3.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "0.11" + env: TEST=true ALLOW_FAILURE=true + - node_js: "0.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "0.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "0.4" + env: TEST=true ALLOW_FAILURE=true + ##- node_js: "7" + #env: TEST=true + #os: osx + #- node_js: "6" + #env: TEST=true + #os: osx + #- node_js: "5" + #env: TEST=true + #os: osx + #- node_js: "4" + #env: TEST=true + #os: osx + #- node_js: "iojs" + #env: TEST=true + #os: osx + #- node_js: "0.12" + #env: TEST=true + #os: osx + #- node_js: "0.10" + #env: TEST=true + #os: osx + #- node_js: "0.8" + #env: TEST=true + #os: osx + allow_failures: + - os: osx + - env: TEST=true ALLOW_FAILURE=true + - node_js: "0.10" + - node_js: "0.8" diff --git a/node_modules/util.promisify/CHANGELOG.md b/node_modules/util.promisify/CHANGELOG.md new file mode 100644 index 00000000..e41f7cbc --- /dev/null +++ b/node_modules/util.promisify/CHANGELOG.md @@ -0,0 +1,3 @@ +1.0.0 / 2017-05-30 +================= + * Initial release. diff --git a/node_modules/util.promisify/LICENSE b/node_modules/util.promisify/LICENSE new file mode 100644 index 00000000..0a9f7a94 --- /dev/null +++ b/node_modules/util.promisify/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017 Jordan Harband + +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. diff --git a/node_modules/util.promisify/README.md b/node_modules/util.promisify/README.md new file mode 100644 index 00000000..f5098cea --- /dev/null +++ b/node_modules/util.promisify/README.md @@ -0,0 +1,8 @@ +# util.promisify +Polyfill for util.promisify in node versions < v8 + +node v8.0.0 added support for a built-in `util.promisify`: https://github.com/nodejs/node/pull/12442/ + +This package provides the built-in `util.promisify` in node v8.0.0 and later, and a replacement in other environments. + +Note: this package requires a native ES5 environment, and for `Promise` to be globally available. It will throw upon requiring it if these are not present. diff --git a/node_modules/util.promisify/implementation.js b/node_modules/util.promisify/implementation.js new file mode 100644 index 00000000..3b532484 --- /dev/null +++ b/node_modules/util.promisify/implementation.js @@ -0,0 +1,86 @@ +'use strict'; + +var isES5 = typeof Object.defineProperty === 'function' + && typeof Object.defineProperties === 'function' + && typeof Object.getPrototypeOf === 'function' + && typeof Object.setPrototypeOf === 'function'; + +if (!isES5) { + throw new TypeError('util.promisify requires a true ES5 environment'); +} + +var getOwnPropertyDescriptors = require('object.getownpropertydescriptors'); + +if (typeof Promise !== 'function') { + throw new TypeError('`Promise` must be globally available for util.promisify to work.'); +} + +var slice = Function.call.bind(Array.prototype.slice); +var concat = Function.call.bind(Array.prototype.concat); +var forEach = Function.call.bind(Array.prototype.forEach); + +var hasSymbols = typeof Symbol === 'function' && typeof Symbol('') === 'symbol'; + +var kCustomPromisifiedSymbol = hasSymbols ? Symbol('util.promisify.custom') : null; +var kCustomPromisifyArgsSymbol = hasSymbols ? Symbol('customPromisifyArgs') : null; + +module.exports = function promisify(orig) { + if (typeof orig !== 'function') { + var error = new TypeError('The "original" argument must be of type function'); + error.name = 'TypeError [ERR_INVALID_ARG_TYPE]'; + error.code = 'ERR_INVALID_ARG_TYPE'; + throw error; + } + + if (hasSymbols && orig[kCustomPromisifiedSymbol]) { + var customFunction = orig[kCustomPromisifiedSymbol]; + if (typeof customFunction !== 'function') { + throw new TypeError('The [util.promisify.custom] property must be a function'); + } + Object.defineProperty(customFunction, kCustomPromisifiedSymbol, { + configurable: true, + enumerable: false, + value: customFunction, + writable: false + }); + return customFunction; + } + + // Names to create an object from in case the callback receives multiple + // arguments, e.g. ['stdout', 'stderr'] for child_process.exec. + var argumentNames = orig[kCustomPromisifyArgsSymbol]; + + var promisified = function fn() { + var args = slice(arguments); + var self = this; // eslint-disable-line no-invalid-this + return new Promise(function (resolve, reject) { + orig.apply(self, concat(args, function (err) { + var values = arguments.length > 1 ? slice(arguments, 1) : []; + if (err) { + reject(err); + } else if (typeof argumentNames !== 'undefined' && values.length > 1) { + var obj = {}; + forEach(argumentNames, function (name, index) { + obj[name] = values[index]; + }); + resolve(obj); + } else { + resolve(values[0]); + } + })); + }); + }; + + Object.setPrototypeOf(promisified, Object.getPrototypeOf(orig)); + + Object.defineProperty(promisified, kCustomPromisifiedSymbol, { + configurable: true, + enumerable: false, + value: promisified, + writable: false + }); + return Object.defineProperties(promisified, getOwnPropertyDescriptors(orig)); +}; + +module.exports.custom = kCustomPromisifiedSymbol; +module.exports.customPromisifyArgs = kCustomPromisifyArgsSymbol; diff --git a/node_modules/util.promisify/index.js b/node_modules/util.promisify/index.js new file mode 100644 index 00000000..55843cf3 --- /dev/null +++ b/node_modules/util.promisify/index.js @@ -0,0 +1,24 @@ +'use strict'; + +var define = require('define-properties'); +var util = require('util'); + +var implementation = require('./implementation'); +var getPolyfill = require('./polyfill'); +var polyfill = getPolyfill(); +var shim = require('./shim'); + +/* eslint-disable no-unused-vars */ +var boundPromisify = function promisify(orig) { +/* eslint-enable no-unused-vars */ + return polyfill.apply(util, arguments); +}; +define(boundPromisify, { + custom: polyfill.custom, + customPromisifyArgs: polyfill.customPromisifyArgs, + getPolyfill: getPolyfill, + implementation: implementation, + shim: shim +}); + +module.exports = boundPromisify; diff --git a/node_modules/util.promisify/package.json b/node_modules/util.promisify/package.json new file mode 100644 index 00000000..b1d792c1 --- /dev/null +++ b/node_modules/util.promisify/package.json @@ -0,0 +1,41 @@ +{ + "name": "util.promisify", + "version": "1.0.0", + "description": "Polyfill/shim for util.promisify in node versions < v8", + "main": "index.js", + "dependencies": { + "define-properties": "^1.1.2", + "object.getownpropertydescriptors": "^2.0.3" + }, + "devDependencies": { + "@es-shims/api": "^1.2.0", + "@ljharb/eslint-config": "^11.0.0", + "eslint": "^3.19.0", + "safe-publish-latest": "^1.1.1" + }, + "scripts": { + "prepublish": "safe-publish-latest", + "lint": "eslint .", + "pretest": "npm run lint", + "tests-only": "es-shim-api --bound", + "test": "npm run tests-only" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/ljharb/util.promisify.git" + }, + "keywords": [ + "promisify", + "promise", + "util", + "polyfill", + "shim", + "util.promisify" + ], + "author": "Jordan Harband <ljharb@gmail.com>", + "license": "MIT", + "bugs": { + "url": "https://github.com/ljharb/util.promisify/issues" + }, + "homepage": "https://github.com/ljharb/util.promisify#readme" +} diff --git a/node_modules/util.promisify/polyfill.js b/node_modules/util.promisify/polyfill.js new file mode 100644 index 00000000..e8484b88 --- /dev/null +++ b/node_modules/util.promisify/polyfill.js @@ -0,0 +1,11 @@ +'use strict'; + +var util = require('util'); +var implementation = require('./implementation'); + +module.exports = function getPolyfill() { + if (typeof util.promisify === 'function') { + return util.promisify; + } + return implementation; +}; diff --git a/node_modules/util.promisify/shim.js b/node_modules/util.promisify/shim.js new file mode 100644 index 00000000..b6d2e193 --- /dev/null +++ b/node_modules/util.promisify/shim.js @@ -0,0 +1,13 @@ +'use strict'; + +var util = require('util'); +var getPolyfill = require('./polyfill'); + +module.exports = function shimUtilPromisify() { + var polyfill = getPolyfill(); + if (polyfill !== util.promisify) { + util.promisify = polyfill; + Object.defineProperty(util, 'promisify', { value: polyfill }); + } + return polyfill; +}; |
