From 190fdcdabb9f587de2c4bd657b70515220285014 Mon Sep 17 00:00:00 2001 From: ficristo Date: Tue, 2 Aug 2016 19:46:12 +0200 Subject: [PATCH] Use opn instead of open. Installed with node@3 and npm install --production --- .../launchers/node/LauncherDomain.js | 2 +- .../node/node_modules/object-assign/index.js | 83 +++++ .../node/node_modules/object-assign/license | 21 ++ .../node_modules/object-assign/package.json | 106 +++++++ .../node/node_modules/object-assign/readme.md | 56 ++++ .../node/node_modules/open/.jshintignore | 2 - .../node/node_modules/open/.jshintrc | 27 -- .../node/node_modules/open/.npmignore | 1 - .../launchers/node/node_modules/open/LICENSE | 22 -- .../node/node_modules/open/README.md | 33 -- .../node/node_modules/open/lib/open.js | 60 ---- .../node/node_modules/open/package.json | 48 --- .../launchers/node/node_modules/opn/index.js | 95 ++++++ .../launchers/node/node_modules/opn/license | 21 ++ .../node/node_modules/opn/package.json | 116 +++++++ .../launchers/node/node_modules/opn/readme.md | 89 ++++++ .../{open/vendor => opn}/xdg-open | 180 ++++++++--- .../node/node_modules/pinkie-promise/index.js | 3 + .../node/node_modules/pinkie-promise/license | 21 ++ .../node_modules/pinkie-promise/package.json | 94 ++++++ .../node_modules/pinkie-promise/readme.md | 28 ++ .../node/node_modules/pinkie/index.js | 292 ++++++++++++++++++ .../node/node_modules/pinkie/license | 21 ++ .../node/node_modules/pinkie/package.json | 92 ++++++ .../node/node_modules/pinkie/readme.md | 83 +++++ .../launchers/node/package.json | 2 +- 26 files changed, 1360 insertions(+), 238 deletions(-) create mode 100644 src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/object-assign/index.js create mode 100644 src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/object-assign/license create mode 100644 src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/object-assign/package.json create mode 100644 src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/object-assign/readme.md delete mode 100644 src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/open/.jshintignore delete mode 100644 src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/open/.jshintrc delete mode 100644 src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/open/.npmignore delete mode 100644 src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/open/LICENSE delete mode 100644 src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/open/README.md delete mode 100644 src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/open/lib/open.js delete mode 100644 src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/open/package.json create mode 100644 src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/opn/index.js create mode 100644 src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/opn/license create mode 100644 src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/opn/package.json create mode 100644 src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/opn/readme.md rename src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/{open/vendor => opn}/xdg-open (81%) create mode 100644 src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/pinkie-promise/index.js create mode 100644 src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/pinkie-promise/license create mode 100644 src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/pinkie-promise/package.json create mode 100644 src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/pinkie-promise/readme.md create mode 100644 src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/pinkie/index.js create mode 100644 src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/pinkie/license create mode 100644 src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/pinkie/package.json create mode 100644 src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/pinkie/readme.md diff --git a/src/LiveDevelopment/MultiBrowserImpl/launchers/node/LauncherDomain.js b/src/LiveDevelopment/MultiBrowserImpl/launchers/node/LauncherDomain.js index 566d59072f3..7b9272f5d6f 100644 --- a/src/LiveDevelopment/MultiBrowserImpl/launchers/node/LauncherDomain.js +++ b/src/LiveDevelopment/MultiBrowserImpl/launchers/node/LauncherDomain.js @@ -26,7 +26,7 @@ (function () { "use strict"; - var open = require("open"); + var open = require("opn"); /** * @private diff --git a/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/object-assign/index.js b/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/object-assign/index.js new file mode 100644 index 00000000000..508504840dc --- /dev/null +++ b/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/object-assign/index.js @@ -0,0 +1,83 @@ +'use strict'; +/* eslint-disable no-unused-vars */ +var hasOwnProperty = Object.prototype.hasOwnProperty; +var propIsEnumerable = Object.prototype.propertyIsEnumerable; + +function toObject(val) { + if (val === null || val === undefined) { + throw new TypeError('Object.assign cannot be called with null or undefined'); + } + + return Object(val); +} + +function shouldUseNative() { + try { + if (!Object.assign) { + return false; + } + + // Detect buggy property enumeration order in older V8 versions. + + // https://bugs.chromium.org/p/v8/issues/detail?id=4118 + var test1 = new String('abc'); // eslint-disable-line + test1[5] = 'de'; + if (Object.getOwnPropertyNames(test1)[0] === '5') { + return false; + } + + // https://bugs.chromium.org/p/v8/issues/detail?id=3056 + var test2 = {}; + for (var i = 0; i < 10; i++) { + test2['_' + String.fromCharCode(i)] = i; + } + var order2 = Object.getOwnPropertyNames(test2).map(function (n) { + return test2[n]; + }); + if (order2.join('') !== '0123456789') { + return false; + } + + // https://bugs.chromium.org/p/v8/issues/detail?id=3056 + var test3 = {}; + 'abcdefghijklmnopqrst'.split('').forEach(function (letter) { + test3[letter] = letter; + }); + if (Object.keys(Object.assign({}, test3)).join('') !== + 'abcdefghijklmnopqrst') { + return false; + } + + return true; + } catch (e) { + // We don't expect any of the above to throw, but better to be safe. + return false; + } +} + +module.exports = shouldUseNative() ? Object.assign : function (target, source) { + var from; + var to = toObject(target); + var symbols; + + for (var s = 1; s < arguments.length; s++) { + from = Object(arguments[s]); + + for (var key in from) { + if (hasOwnProperty.call(from, key)) { + to[key] = from[key]; + } + } + + if (Object.getOwnPropertySymbols) { + symbols = Object.getOwnPropertySymbols(from); + for (var i = 0; i < symbols.length; i++) { + if (propIsEnumerable.call(from, symbols[i])) { + to[symbols[i]] = from[symbols[i]]; + } + } + } + } + + return to; +}; diff --git a/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/object-assign/license b/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/object-assign/license new file mode 100644 index 00000000000..654d0bfe943 --- /dev/null +++ b/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/object-assign/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +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/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/object-assign/package.json b/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/object-assign/package.json new file mode 100644 index 00000000000..068b9088c79 --- /dev/null +++ b/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/object-assign/package.json @@ -0,0 +1,106 @@ +{ + "_args": [ + [ + "object-assign@^4.0.1", + "/Users/Filippo/Documents/git/brackets/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/opn" + ] + ], + "_from": "object-assign@>=4.0.1 <5.0.0", + "_id": "object-assign@4.1.0", + "_inCache": true, + "_installable": true, + "_location": "/object-assign", + "_nodeVersion": "4.1.0", + "_npmOperationalInternal": { + "host": "packages-16-east.internal.npmjs.com", + "tmp": "tmp/object-assign-4.1.0.tgz_1462212593641_0.3332549517508596" + }, + "_npmUser": { + "email": "ben@benalpert.com", + "name": "spicyj" + }, + "_npmVersion": "2.14.19", + "_phantomChildren": {}, + "_requested": { + "name": "object-assign", + "raw": "object-assign@^4.0.1", + "rawSpec": "^4.0.1", + "scope": null, + "spec": ">=4.0.1 <5.0.0", + "type": "range" + }, + "_requiredBy": [ + "/opn" + ], + "_resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.0.tgz", + "_shasum": "7a3b3d0e98063d43f4c03f2e8ae6cd51a86883a0", + "_shrinkwrap": null, + "_spec": "object-assign@^4.0.1", + "_where": "/Users/Filippo/Documents/git/brackets/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/opn", + "author": { + "email": "sindresorhus@gmail.com", + "name": "Sindre Sorhus", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/object-assign/issues" + }, + "dependencies": {}, + "description": "ES2015 Object.assign() ponyfill", + "devDependencies": { + "lodash": "^4.8.2", + "matcha": "^0.7.0", + "mocha": "*", + "xo": "*" + }, + "directories": {}, + "dist": { + "shasum": "7a3b3d0e98063d43f4c03f2e8ae6cd51a86883a0", + "tarball": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.0.tgz" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "gitHead": "72fe21c86911758f3342fdf41c2a57860d5829bc", + "homepage": "https://github.com/sindresorhus/object-assign#readme", + "keywords": [ + "object", + "assign", + "extend", + "properties", + "es2015", + "ecmascript", + "harmony", + "ponyfill", + "prollyfill", + "polyfill", + "shim", + "browser" + ], + "license": "MIT", + "maintainers": [ + { + "email": "sindresorhus@gmail.com", + "name": "sindresorhus" + }, + { + "email": "ben@benalpert.com", + "name": "spicyj" + } + ], + "name": "object-assign", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/object-assign.git" + }, + "scripts": { + "bench": "matcha bench.js", + "test": "xo && mocha" + }, + "version": "4.1.0" +} diff --git a/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/object-assign/readme.md b/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/object-assign/readme.md new file mode 100644 index 00000000000..13c097734cf --- /dev/null +++ b/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/object-assign/readme.md @@ -0,0 +1,56 @@ +# object-assign [![Build Status](https://travis-ci.org/sindresorhus/object-assign.svg?branch=master)](https://travis-ci.org/sindresorhus/object-assign) + +> ES2015 [`Object.assign()`](http://www.2ality.com/2014/01/object-assign.html) ponyfill + +> Ponyfill: A polyfill that doesn't overwrite the native method + + +## Install + +``` +$ npm install --save object-assign +``` + + +## Usage + +```js +const objectAssign = require('object-assign'); + +objectAssign({foo: 0}, {bar: 1}); +//=> {foo: 0, bar: 1} + +// multiple sources +objectAssign({foo: 0}, {bar: 1}, {baz: 2}); +//=> {foo: 0, bar: 1, baz: 2} + +// overwrites equal keys +objectAssign({foo: 0}, {foo: 1}, {foo: 2}); +//=> {foo: 2} + +// ignores null and undefined sources +objectAssign({foo: 0}, null, {bar: 1}, undefined); +//=> {foo: 0, bar: 1} +``` + + +## API + +### objectAssign(target, source, [source, ...]) + +Assigns enumerable own properties of `source` objects to the `target` object and returns the `target` object. Additional `source` objects will overwrite previous ones. + + +## Resources + +- [ES2015 spec - Object.assign](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign) + + +## Related + +- [deep-assign](https://github.com/sindresorhus/deep-assign) - Recursive `Object.assign()` + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/open/.jshintignore b/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/open/.jshintignore deleted file mode 100644 index 651665bbd97..00000000000 --- a/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/open/.jshintignore +++ /dev/null @@ -1,2 +0,0 @@ -node_modules -.git diff --git a/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/open/.jshintrc b/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/open/.jshintrc deleted file mode 100644 index 765fb34a1ec..00000000000 --- a/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/open/.jshintrc +++ /dev/null @@ -1,27 +0,0 @@ -{ - "bitwise": true, - "curly": true, - "eqeqeq": true, - "forin": true, - "immed": true, - "latedef": false, - "newcap": true, - "noarg": true, - "noempty": false, - "nonew": true, - "plusplus": false, - "regexp": false, - "undef": true, - "strict": false, - "trailing": true, - - "eqnull": true, - "laxcomma": true, - - "node": true, - - "onevar": true, - "white": true, - - "indent": 2 -} diff --git a/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/open/.npmignore b/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/open/.npmignore deleted file mode 100644 index 9daeafb9864..00000000000 --- a/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/open/.npmignore +++ /dev/null @@ -1 +0,0 @@ -test diff --git a/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/open/LICENSE b/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/open/LICENSE deleted file mode 100644 index 58b5cd2414f..00000000000 --- a/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/open/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -Copyright (c) 2012 Jay Jordan - -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/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/open/README.md b/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/open/README.md deleted file mode 100644 index 4fc0d54ecea..00000000000 --- a/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/open/README.md +++ /dev/null @@ -1,33 +0,0 @@ -# open - -Open a file or url in the user's preferred application. - -# Usage - -```javascript -var open = require("open"); -open("http://www.google.com"); -``` - -`open` taks an optional argument specifying the program to be used to open the -file or URL. - -```javascript -open("http://www.google.com", "firefox"); -``` - -# Installation - - npm install open - -# How it works - -- on `win32` uses `start` -- on `darwin` uses `open` -- otherwise uses the `xdg-open` script from [freedesktop.org](http://portland.freedesktop.org/xdg-utils-1.0/xdg-open.html) - -# Warning - -The same care should be taken when calling open as if you were calling -[child_process.exec](http://nodejs.org/api/child_process.html#child_process_child_process_exec_command_options_callback) -directly. If it is an executable it will run in a new shell. diff --git a/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/open/lib/open.js b/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/open/lib/open.js deleted file mode 100644 index 3b77c3f3bb9..00000000000 --- a/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/open/lib/open.js +++ /dev/null @@ -1,60 +0,0 @@ -var exec = require('child_process').exec - , path = require('path') - ; - - -/** - * open a file or uri using the default application for the file type. - * - * @return {ChildProcess} - the child process object. - * @param {string} target - the file/uri to open. - * @param {string} appName - (optional) the application to be used to open the - * file (for example, "chrome", "firefox") - * @param {function(Error)} callback - called with null on success, or - * an error object that contains a property 'code' with the exit - * code of the process. - */ - -module.exports = open; - -function open(target, appName, callback) { - var opener; - - if (typeof(appName) === 'function') { - callback = appName; - appName = null; - } - - switch (process.platform) { - case 'darwin': - if (appName) { - opener = 'open -a "' + escape(appName) + '"'; - } else { - opener = 'open'; - } - break; - case 'win32': - // if the first parameter to start is quoted, it uses that as the title - // so we pass a blank title so we can quote the file we are opening - if (appName) { - opener = 'start "" "' + escape(appName) + '"'; - } else { - opener = 'start ""'; - } - break; - default: - if (appName) { - opener = escape(appName); - } else { - // use Portlands xdg-open everywhere else - opener = path.join(__dirname, '../vendor/xdg-open'); - } - break; - } - - return exec(opener + ' "' + escape(target) + '"', callback); -} - -function escape(s) { - return s.replace(/"/g, '\\\"'); -} diff --git a/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/open/package.json b/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/open/package.json deleted file mode 100644 index 0999270937b..00000000000 --- a/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/open/package.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "name": "open", - "version": "0.0.4", - "description": "open a file or url in the user's preferred application", - "keywords": [ - "start", - "open", - "browser", - "editor", - "default" - ], - "homepage": "https://github.com/jjrdn/node-open", - "author": { - "name": "J Jordan", - "email": "jjrdn@styosis.com" - }, - "license": "MIT", - "contributors": [ - { - "name": "Victor Costan", - "email": "victor@costan.us", - "url": "http://www.costan.us" - } - ], - "repository": { - "type": "git", - "url": "https://github.com/pwnall/node-open.git" - }, - "bugs": { - "url": "https://github.com/pwnall/node-open/issues" - }, - "engines": { - "node": ">= 0.6.0" - }, - "dependencies": {}, - "devDependencies": { - "mocha": "*" - }, - "optionalDependencies": {}, - "main": "lib/open.js", - "scripts": { - "test": "node_modules/mocha/bin/mocha" - }, - "readme": "# open\n\nOpen a file or url in the user's preferred application.\n\n# Usage\n\n```javascript\nvar open = require(\"open\");\nopen(\"http://www.google.com\");\n```\n\n`open` taks an optional argument specifying the program to be used to open the\nfile or URL.\n\n```javascript\nopen(\"http://www.google.com\", \"firefox\");\n```\n\n# Installation\n\n npm install open\n\n# How it works\n\n- on `win32` uses `start`\n- on `darwin` uses `open`\n- otherwise uses the `xdg-open` script from [freedesktop.org](http://portland.freedesktop.org/xdg-utils-1.0/xdg-open.html)\n\n# Warning\n\nThe same care should be taken when calling open as if you were calling\n[child_process.exec](http://nodejs.org/api/child_process.html#child_process_child_process_exec_command_options_callback)\ndirectly. If it is an executable it will run in a new shell.\n", - "readmeFilename": "README.md", - "_id": "open@0.0.4", - "_from": "open@0.0.4" -} diff --git a/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/opn/index.js b/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/opn/index.js new file mode 100644 index 00000000000..13dcb66fb12 --- /dev/null +++ b/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/opn/index.js @@ -0,0 +1,95 @@ +'use strict'; +var path = require('path'); +var childProcess = require('child_process'); +var objectAssign = require('object-assign'); +var Promise = require('pinkie-promise'); + +module.exports = function (target, opts) { + if (typeof target !== 'string') { + return Promise.reject(new Error('Expected a `target`')); + } + + opts = objectAssign({wait: true}, opts); + + var cmd; + var appArgs = []; + var args = []; + var cpOpts = {}; + + if (Array.isArray(opts.app)) { + appArgs = opts.app.slice(1); + opts.app = opts.app[0]; + } + + if (process.platform === 'darwin') { + cmd = 'open'; + + if (opts.wait) { + args.push('-W'); + } + + if (opts.app) { + args.push('-a', opts.app); + } + } else if (process.platform === 'win32') { + cmd = 'cmd'; + args.push('/c', 'start', '""'); + target = target.replace(/&/g, '^&'); + + if (opts.wait) { + args.push('/wait'); + } + + if (opts.app) { + args.push(opts.app); + } + + if (appArgs.length > 0) { + args = args.concat(appArgs); + } + } else { + if (opts.app) { + cmd = opts.app; + } else { + cmd = path.join(__dirname, 'xdg-open'); + } + + if (appArgs.length > 0) { + args = args.concat(appArgs); + } + + if (!opts.wait) { + // xdg-open will block the process unless + // stdio is ignored even if it's unref'd + cpOpts.stdio = 'ignore'; + } + } + + args.push(target); + + if (process.platform === 'darwin' && appArgs.length > 0) { + args.push('--args'); + args = args.concat(appArgs); + } + + var cp = childProcess.spawn(cmd, args, cpOpts); + + if (opts.wait) { + return new Promise(function (resolve, reject) { + cp.once('error', reject); + + cp.once('close', function (code) { + if (code > 0) { + reject(new Error('Exited with code ' + code)); + return; + } + + resolve(cp); + }); + }); + } + + cp.unref(); + + return Promise.resolve(cp); +}; diff --git a/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/opn/license b/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/opn/license new file mode 100644 index 00000000000..ced6f6b30dd --- /dev/null +++ b/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/opn/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus + +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/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/opn/package.json b/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/opn/package.json new file mode 100644 index 00000000000..1f9d62546b4 --- /dev/null +++ b/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/opn/package.json @@ -0,0 +1,116 @@ +{ + "_args": [ + [ + "opn@4.0.2", + "/Users/Filippo/Documents/git/brackets/src/LiveDevelopment/MultiBrowserImpl/launchers/node" + ] + ], + "_from": "opn@4.0.2", + "_id": "opn@4.0.2", + "_inCache": true, + "_installable": true, + "_location": "/opn", + "_nodeVersion": "4.4.2", + "_npmOperationalInternal": { + "host": "packages-12-west.internal.npmjs.com", + "tmp": "tmp/opn-4.0.2.tgz_1463477356148_0.1645404922310263" + }, + "_npmUser": { + "email": "sindresorhus@gmail.com", + "name": "sindresorhus" + }, + "_npmVersion": "3.9.0", + "_phantomChildren": {}, + "_requested": { + "name": "opn", + "raw": "opn@4.0.2", + "rawSpec": "4.0.2", + "scope": null, + "spec": "4.0.2", + "type": "version" + }, + "_requiredBy": [ + "/" + ], + "_resolved": "https://registry.npmjs.org/opn/-/opn-4.0.2.tgz", + "_shasum": "7abc22e644dff63b0a96d5ab7f2790c0f01abc95", + "_shrinkwrap": null, + "_spec": "opn@4.0.2", + "_where": "/Users/Filippo/Documents/git/brackets/src/LiveDevelopment/MultiBrowserImpl/launchers/node", + "author": { + "email": "sindresorhus@gmail.com", + "name": "Sindre Sorhus", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/opn/issues" + }, + "dependencies": { + "object-assign": "^4.0.1", + "pinkie-promise": "^2.0.0" + }, + "description": "A better node-open. Opens stuff like websites, files, executables. Cross-platform.", + "devDependencies": { + "ava": "*", + "xo": "*" + }, + "directories": {}, + "dist": { + "shasum": "7abc22e644dff63b0a96d5ab7f2790c0f01abc95", + "tarball": "https://registry.npmjs.org/opn/-/opn-4.0.2.tgz" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js", + "xdg-open" + ], + "gitHead": "b56b0e981ee377d3b04c57a4e6748ad2793ada17", + "homepage": "https://github.com/sindresorhus/opn#readme", + "keywords": [ + "app", + "open", + "opn", + "opener", + "opens", + "launch", + "start", + "xdg-open", + "xdg", + "default", + "cmd", + "browser", + "editor", + "executable", + "exe", + "url", + "urls", + "arguments", + "args", + "spawn", + "exec", + "child", + "process", + "website", + "file" + ], + "license": "MIT", + "maintainers": [ + { + "email": "sindresorhus@gmail.com", + "name": "sindresorhus" + } + ], + "name": "opn", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/opn.git" + }, + "scripts": { + "test": "xo && ava" + }, + "version": "4.0.2" +} diff --git a/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/opn/readme.md b/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/opn/readme.md new file mode 100644 index 00000000000..76d543933cd --- /dev/null +++ b/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/opn/readme.md @@ -0,0 +1,89 @@ +# opn + +> A better [node-open](https://github.com/pwnall/node-open). Opens stuff like websites, files, executables. Cross-platform. + + +#### Why? + +- Actively maintained +- Supports app arguments +- Safer as it uses `spawn` instead of `exec` +- Fixes most of the open `node-open` issues +- Includes the latest [`xdg-open` script](http://cgit.freedesktop.org/xdg/xdg-utils/commit/?id=c55122295c2a480fa721a9614f0e2d42b2949c18) for Linux + + +## Install + +``` +$ npm install --save opn +``` + + +## Usage + +```js +const opn = require('opn'); + +// opens the image in the default image viewer +opn('unicorn.png').then(() => { + // image viewer closed +}); + +// opens the url in the default browser +opn('http://sindresorhus.com'); + +// specify the app to open in +opn('http://sindresorhus.com', {app: 'firefox'}); + +// specify app arguments +opn('http://sindresorhus.com', {app: ['google chrome', '--incognito']}); +``` + + +## API + +Uses the command `open` on OS X, `start` on Windows and `xdg-open` on other platforms. + +### opn(target, [options]) + +Returns a promise for the [spawned child process](https://nodejs.org/api/child_process.html#child_process_class_childprocess). You'd normally not need to use this for anything, but it can be useful if you'd like to attach custom event listeners or perform other operations directly on the spawned process. + +#### target + +*Required* +Type: `string` + +The thing you want to open. Can be a URL, file, or executable. + +Opens in the default app for the file type. Eg. URLs opens in your default browser. + +#### options + +Type: `object` + +##### wait + +Type: `boolean` +Default: `true` + +Wait for the opened app to exit before calling the `callback`. If `false` it's called immediately when opening the app. + +On Windows you have to explicitly specify an app for it to be able to wait. + +##### app + +Type: `string`, `array` + +Specify the app to open the `target` with, or an array with the app and app arguments. + +The app name is platform dependent. Don't hard code it in reusable modules. Eg. Chrome is `google chrome` on OS X, `google-chrome` on Linux and `chrome` on Windows. + + +## Related + +- [opn-cli](https://github.com/sindresorhus/opn-cli) - CLI for this module + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/open/vendor/xdg-open b/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/opn/xdg-open similarity index 81% rename from src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/open/vendor/xdg-open rename to src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/opn/xdg-open index 13caac1a43f..9be7f32f63e 100755 --- a/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/open/vendor/xdg-open +++ b/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/opn/xdg-open @@ -38,7 +38,7 @@ manualpage() cat << _MANUALPAGE Name - xdg-open -- opens a file or URL in the user's preferred + xdg-open - opens a file or URL in the user's preferred application Synopsis @@ -104,7 +104,7 @@ _MANUALPAGE usage() { cat << _USAGE - xdg-open -- opens a file or URL in the user's preferred + xdg-open - opens a file or URL in the user's preferred application Synopsis @@ -296,7 +296,7 @@ check_vendor_prefix() [ -n "$file_label" ] || file_label="filename" file=`basename "$1"` case "$file" in - [a-zA-Z]*-*) + [[:alpha:]]*-*) return ;; esac @@ -346,7 +346,7 @@ check_common_commands() ;; --version) - echo "xdg-open 1.1.0 rc1" + echo "xdg-open 1.1.0 rc3" exit_success ;; esac @@ -375,6 +375,9 @@ detectDE() if [ -n "${XDG_CURRENT_DESKTOP}" ]; then case "${XDG_CURRENT_DESKTOP}" in + ENLIGHTENMENT) + DE=enlightenment; + ;; GNOME) DE=gnome; ;; @@ -384,19 +387,24 @@ detectDE() LXDE) DE=lxde; ;; + MATE) + DE=mate; + ;; XFCE) DE=xfce + ;; esac fi if [ x"$DE" = x"" ]; then # classic fallbacks - if [ x"$KDE_FULL_SESSION" = x"true" ]; then DE=kde; + if [ x"$KDE_FULL_SESSION" != x"" ]; then DE=kde; elif [ x"$GNOME_DESKTOP_SESSION_ID" != x"" ]; then DE=gnome; elif [ x"$MATE_DESKTOP_SESSION_ID" != x"" ]; then DE=mate; elif `dbus-send --print-reply --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.GetNameOwner string:org.gnome.SessionManager > /dev/null 2>&1` ; then DE=gnome; elif xprop -root _DT_SAVE_MODE 2> /dev/null | grep ' = \"xfce4\"$' >/dev/null 2>&1; then DE=xfce; elif xprop -root 2> /dev/null | grep -i '^xfce_desktop_window' >/dev/null 2>&1; then DE=xfce + elif echo $DESKTOP | grep -q '^Enlightenment'; then DE=enlightenment; fi fi @@ -409,6 +417,9 @@ detectDE() LXDE|Lubuntu) DE=lxde; ;; + MATE) + DE=mate; + ;; xfce|xfce4|'Xfce Session') DE=xfce; ;; @@ -449,16 +460,42 @@ kfmclient_fix_exit_code() } # This handles backslashes but not quote marks. -first_word() +last_word() { read first rest - echo "$first" + echo "$rest" } -last_word() +# Get the value of a key in a desktop file's Desktop Entry group. +# Example: Use get_key foo.desktop Exec +# to get the values of the Exec= key for the Desktop Entry group. +get_key() { - read first rest - echo "$rest" + local file="${1}" + local key="${2}" + local desktop_entry="" + + IFS_="${IFS}" + IFS="" + while read line + do + case "$line" in + "[Desktop Entry]") + desktop_entry="y" + ;; + # Reset match flag for other groups + "["*) + desktop_entry="" + ;; + "${key}="*) + # Only match Desktop Entry group + if [ -n "${desktop_entry}" ] + then + echo "${line}" | cut -d= -f 2- + fi + esac + done < "${file}" + IFS="${IFS_}" } open_darwin() @@ -474,15 +511,18 @@ open_darwin() open_kde() { - if kde-open -v 2>/dev/null 1>&2; then - kde-open "$1" + if [ -n "${KDE_SESSION_VERSION}" ]; then + case "${KDE_SESSION_VERSION}" in + 4) + kde-open "$1" + ;; + 5) + kde-open${KDE_SESSION_VERSION} "$1" + ;; + esac else - if [ x"$KDE_SESSION_VERSION" = x"4" ]; then - kfmclient openURL "$1" - else - kfmclient exec "$1" - kfmclient_fix_exit_code $? - fi + kfmclient exec "$1" + kfmclient_fix_exit_code $? fi if [ $? -eq 0 ]; then @@ -533,6 +573,17 @@ open_xfce() fi } +open_enlightenment() +{ + enlightenment_open "$1" + + if [ $? -eq 0 ]; then + exit_success + else + exit_failure_operation_failed + fi +} + #----------------------------------------- # Recursively search .desktop file @@ -540,7 +591,7 @@ search_desktop_file() { local default="$1" local dir="$2" - local arg="$3" + local target="$3" local file="" # look for both vendor-app.desktop, vendor/app.desktop @@ -551,29 +602,56 @@ search_desktop_file() fi if [ -r "$file" ] ; then - command="`grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -d= -f 2- | first_word`" + command="$(get_key "${file}" "Exec" | first_word)" command_exec=`which $command 2>/dev/null` - arguments="`grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -d= -f 2- | last_word`" - arg_one="`echo $arg | sed 's/&/\\\\&/g'`" - arguments_exec="`echo $arguments | sed -e 's*%[fFuU]*"'"$arg_one"'"*g'`" - - if [ -x "$command_exec" ] ; then - if echo $arguments | grep -iq '%[fFuU]' ; then - echo START $command_exec $arguments_exec - eval $command_exec $arguments_exec - else - echo START $command_exec $arguments_exec "$arg" - eval $command_exec $arguments_exec "$arg" - fi + icon="$(get_key "${file}" "Icon")" + # FIXME: Actually LC_MESSAGES should be used as described in + # http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s04.html + localised_name="$(get_key "${file}" "Name")" + set -- $(get_key "${file}" "Exec" | last_word) + # We need to replace any occurrence of "%f", "%F" and + # the like by the target file. We examine each + # argument and append the modified argument to the + # end then shift. + local args=$# + local replaced=0 + while [ $args -gt 0 ]; do + case $1 in + %[c]) + replaced=1 + arg="${localised_name}" + shift + set -- "$@" "$arg" + ;; + %[fFuU]) + replaced=1 + arg="$target" + shift + set -- "$@" "$arg" + ;; + %[i]) + replaced=1 + shift + set -- "$@" "--icon" "$icon" + ;; + *) + arg="$1" + shift + set -- "$@" "$arg" + ;; + esac + args=$(( $args - 1 )) + done + [ $replaced -eq 1 ] || set -- "$@" "$target" + "$command_exec" "$@" - if [ $? -eq 0 ]; then - exit_success - fi + if [ $? -eq 0 ]; then + exit_success fi fi for d in $dir/*/; do - [ -d "$d" ] && search_desktop_file "$default" "$d" "$arg" + [ -d "$d" ] && search_desktop_file "$default" "$d" "$target" done } @@ -624,12 +702,14 @@ open_generic() file=${file#file://} file="$(printf "$(echo "$file" | sed -e 's@%\([a-f0-9A-F]\{2\}\)@\\x\1@g')")" fi - check_input_file "$file" + file_check=${file%%#*} + file_check=${file_check%%\?*} + check_input_file "$file_check" - open_generic_xdg_file_mime "$file" + filetype=`xdg-mime query filetype "$file_check" | sed "s/;.*//"` + open_generic_xdg_mime "$file" "$filetype" - if [ -f /etc/debian_version ] && - which run-mailcap 2>/dev/null 1>&2; then + if which run-mailcap 2>/dev/null 1>&2; then run-mailcap --action=view "$file" if [ $? -eq 0 ]; then exit_success @@ -656,7 +736,7 @@ open_generic() fi if [ x"$browser_with_arg" = x"$browser" ]; then - eval '$browser $1'$xdg_redirect_output; + eval '$browser "$1"'$xdg_redirect_output; else eval '$browser_with_arg'$xdg_redirect_output; fi @@ -675,10 +755,10 @@ open_lxde() if (echo "$1" | grep -q '^file://' || ! echo "$1" | egrep -q '^[[:alpha:]+\.\-]+:') then - local file="$(echo "$1" | sed 's%^file://%%')" + local file="$1" # handle relative paths - if ! echo "$file" | grep -q '^/'; then + if ! echo "$file" | egrep -q '^(file://)?/'; then file="$(pwd)/$file" fi @@ -728,6 +808,16 @@ fi DEBUG 2 "Selected DE $DE" +# sanitize BROWSER (avoid caling ourselves in particular) +case "${BROWSER}" in + *:"xdg-open"|"xdg-open":*) + BROWSER=$(echo $BROWSER | sed -e 's|:xdg-open||g' -e 's|xdg-open:||g') + ;; + "xdg-open") + BROWSER= + ;; +esac + # if BROWSER variable is not set, check some well known browsers instead if [ x"$BROWSER" = x"" ]; then BROWSER=links2:elinks:links:lynx:w3m @@ -757,6 +847,10 @@ case "$DE" in open_lxde "$url" ;; + enlightenment) + open_enlightenment "$url" + ;; + generic) open_generic "$url" ;; diff --git a/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/pinkie-promise/index.js b/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/pinkie-promise/index.js new file mode 100644 index 00000000000..777377a1f77 --- /dev/null +++ b/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/pinkie-promise/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = typeof Promise === 'function' ? Promise : require('pinkie'); diff --git a/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/pinkie-promise/license b/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/pinkie-promise/license new file mode 100644 index 00000000000..1aeb74fd25e --- /dev/null +++ b/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/pinkie-promise/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Vsevolod Strukchinsky (github.com/floatdrop) + +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/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/pinkie-promise/package.json b/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/pinkie-promise/package.json new file mode 100644 index 00000000000..a02e8f465e0 --- /dev/null +++ b/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/pinkie-promise/package.json @@ -0,0 +1,94 @@ +{ + "_args": [ + [ + "pinkie-promise@^2.0.0", + "/Users/Filippo/Documents/git/brackets/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/opn" + ] + ], + "_from": "pinkie-promise@>=2.0.0 <3.0.0", + "_id": "pinkie-promise@2.0.1", + "_inCache": true, + "_installable": true, + "_location": "/pinkie-promise", + "_nodeVersion": "4.4.1", + "_npmOperationalInternal": { + "host": "packages-16-east.internal.npmjs.com", + "tmp": "tmp/pinkie-promise-2.0.1.tgz_1460309839126_0.3422858319245279" + }, + "_npmUser": { + "email": "floatdrop@gmail.com", + "name": "floatdrop" + }, + "_npmVersion": "2.14.20", + "_phantomChildren": {}, + "_requested": { + "name": "pinkie-promise", + "raw": "pinkie-promise@^2.0.0", + "rawSpec": "^2.0.0", + "scope": null, + "spec": ">=2.0.0 <3.0.0", + "type": "range" + }, + "_requiredBy": [ + "/opn" + ], + "_resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", + "_shasum": "2135d6dfa7a358c069ac9b178776288228450ffa", + "_shrinkwrap": null, + "_spec": "pinkie-promise@^2.0.0", + "_where": "/Users/Filippo/Documents/git/brackets/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/opn", + "author": { + "email": "floatdrop@gmail.com", + "name": "Vsevolod Strukchinsky", + "url": "github.com/floatdrop" + }, + "bugs": { + "url": "https://github.com/floatdrop/pinkie-promise/issues" + }, + "dependencies": { + "pinkie": "^2.0.0" + }, + "description": "ES2015 Promise ponyfill", + "devDependencies": { + "mocha": "*" + }, + "directories": {}, + "dist": { + "shasum": "2135d6dfa7a358c069ac9b178776288228450ffa", + "tarball": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "gitHead": "4a936c09c34ad591a25db93f1216d242de0d6184", + "homepage": "https://github.com/floatdrop/pinkie-promise", + "keywords": [ + "promise", + "promises", + "es2015", + "es6", + "polyfill", + "ponyfill" + ], + "license": "MIT", + "maintainers": [ + { + "email": "floatdrop@gmail.com", + "name": "floatdrop" + } + ], + "name": "pinkie-promise", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git+https://github.com/floatdrop/pinkie-promise.git" + }, + "scripts": { + "test": "mocha" + }, + "version": "2.0.1" +} diff --git a/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/pinkie-promise/readme.md b/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/pinkie-promise/readme.md new file mode 100644 index 00000000000..78477f4297d --- /dev/null +++ b/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/pinkie-promise/readme.md @@ -0,0 +1,28 @@ +# pinkie-promise [![Build Status](https://travis-ci.org/floatdrop/pinkie-promise.svg?branch=master)](https://travis-ci.org/floatdrop/pinkie-promise) + +> [ES2015 Promise](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promise-objects) ponyfill + +Module exports global Promise object (if available) or [`pinkie`](http://github.com/floatdrop/pinkie) Promise polyfill. + +## Install + +``` +$ npm install --save pinkie-promise +``` + +## Usage + +```js +var Promise = require('pinkie-promise'); + +new Promise(function (resolve) { resolve('unicorns'); }); +//=> Promise { 'unicorns' } +``` + +## Related + +- [pify](https://github.com/sindresorhus/pify) - Promisify a callback-style function + +## License + +MIT © [Vsevolod Strukchinsky](http://github.com/floatdrop) diff --git a/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/pinkie/index.js b/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/pinkie/index.js new file mode 100644 index 00000000000..14ce1bfe3d4 --- /dev/null +++ b/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/pinkie/index.js @@ -0,0 +1,292 @@ +'use strict'; + +var PENDING = 'pending'; +var SETTLED = 'settled'; +var FULFILLED = 'fulfilled'; +var REJECTED = 'rejected'; +var NOOP = function () {}; +var isNode = typeof global !== 'undefined' && typeof global.process !== 'undefined' && typeof global.process.emit === 'function'; + +var asyncSetTimer = typeof setImmediate === 'undefined' ? setTimeout : setImmediate; +var asyncQueue = []; +var asyncTimer; + +function asyncFlush() { + // run promise callbacks + for (var i = 0; i < asyncQueue.length; i++) { + asyncQueue[i][0](asyncQueue[i][1]); + } + + // reset async asyncQueue + asyncQueue = []; + asyncTimer = false; +} + +function asyncCall(callback, arg) { + asyncQueue.push([callback, arg]); + + if (!asyncTimer) { + asyncTimer = true; + asyncSetTimer(asyncFlush, 0); + } +} + +function invokeResolver(resolver, promise) { + function resolvePromise(value) { + resolve(promise, value); + } + + function rejectPromise(reason) { + reject(promise, reason); + } + + try { + resolver(resolvePromise, rejectPromise); + } catch (e) { + rejectPromise(e); + } +} + +function invokeCallback(subscriber) { + var owner = subscriber.owner; + var settled = owner._state; + var value = owner._data; + var callback = subscriber[settled]; + var promise = subscriber.then; + + if (typeof callback === 'function') { + settled = FULFILLED; + try { + value = callback(value); + } catch (e) { + reject(promise, e); + } + } + + if (!handleThenable(promise, value)) { + if (settled === FULFILLED) { + resolve(promise, value); + } + + if (settled === REJECTED) { + reject(promise, value); + } + } +} + +function handleThenable(promise, value) { + var resolved; + + try { + if (promise === value) { + throw new TypeError('A promises callback cannot return that same promise.'); + } + + if (value && (typeof value === 'function' || typeof value === 'object')) { + // then should be retrieved only once + var then = value.then; + + if (typeof then === 'function') { + then.call(value, function (val) { + if (!resolved) { + resolved = true; + + if (value === val) { + fulfill(promise, val); + } else { + resolve(promise, val); + } + } + }, function (reason) { + if (!resolved) { + resolved = true; + + reject(promise, reason); + } + }); + + return true; + } + } + } catch (e) { + if (!resolved) { + reject(promise, e); + } + + return true; + } + + return false; +} + +function resolve(promise, value) { + if (promise === value || !handleThenable(promise, value)) { + fulfill(promise, value); + } +} + +function fulfill(promise, value) { + if (promise._state === PENDING) { + promise._state = SETTLED; + promise._data = value; + + asyncCall(publishFulfillment, promise); + } +} + +function reject(promise, reason) { + if (promise._state === PENDING) { + promise._state = SETTLED; + promise._data = reason; + + asyncCall(publishRejection, promise); + } +} + +function publish(promise) { + promise._then = promise._then.forEach(invokeCallback); +} + +function publishFulfillment(promise) { + promise._state = FULFILLED; + publish(promise); +} + +function publishRejection(promise) { + promise._state = REJECTED; + publish(promise); + if (!promise._handled && isNode) { + global.process.emit('unhandledRejection', promise._data, promise); + } +} + +function notifyRejectionHandled(promise) { + global.process.emit('rejectionHandled', promise); +} + +/** + * @class + */ +function Promise(resolver) { + if (typeof resolver !== 'function') { + throw new TypeError('Promise resolver ' + resolver + ' is not a function'); + } + + if (this instanceof Promise === false) { + throw new TypeError('Failed to construct \'Promise\': Please use the \'new\' operator, this object constructor cannot be called as a function.'); + } + + this._then = []; + + invokeResolver(resolver, this); +} + +Promise.prototype = { + constructor: Promise, + + _state: PENDING, + _then: null, + _data: undefined, + _handled: false, + + then: function (onFulfillment, onRejection) { + var subscriber = { + owner: this, + then: new this.constructor(NOOP), + fulfilled: onFulfillment, + rejected: onRejection + }; + + if ((onRejection || onFulfillment) && !this._handled) { + this._handled = true; + if (this._state === REJECTED && isNode) { + asyncCall(notifyRejectionHandled, this); + } + } + + if (this._state === FULFILLED || this._state === REJECTED) { + // already resolved, call callback async + asyncCall(invokeCallback, subscriber); + } else { + // subscribe + this._then.push(subscriber); + } + + return subscriber.then; + }, + + catch: function (onRejection) { + return this.then(null, onRejection); + } +}; + +Promise.all = function (promises) { + if (!Array.isArray(promises)) { + throw new TypeError('You must pass an array to Promise.all().'); + } + + return new Promise(function (resolve, reject) { + var results = []; + var remaining = 0; + + function resolver(index) { + remaining++; + return function (value) { + results[index] = value; + if (!--remaining) { + resolve(results); + } + }; + } + + for (var i = 0, promise; i < promises.length; i++) { + promise = promises[i]; + + if (promise && typeof promise.then === 'function') { + promise.then(resolver(i), reject); + } else { + results[i] = promise; + } + } + + if (!remaining) { + resolve(results); + } + }); +}; + +Promise.race = function (promises) { + if (!Array.isArray(promises)) { + throw new TypeError('You must pass an array to Promise.race().'); + } + + return new Promise(function (resolve, reject) { + for (var i = 0, promise; i < promises.length; i++) { + promise = promises[i]; + + if (promise && typeof promise.then === 'function') { + promise.then(resolve, reject); + } else { + resolve(promise); + } + } + }); +}; + +Promise.resolve = function (value) { + if (value && typeof value === 'object' && value.constructor === Promise) { + return value; + } + + return new Promise(function (resolve) { + resolve(value); + }); +}; + +Promise.reject = function (reason) { + return new Promise(function (resolve, reject) { + reject(reason); + }); +}; + +module.exports = Promise; diff --git a/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/pinkie/license b/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/pinkie/license new file mode 100644 index 00000000000..1aeb74fd25e --- /dev/null +++ b/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/pinkie/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Vsevolod Strukchinsky (github.com/floatdrop) + +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/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/pinkie/package.json b/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/pinkie/package.json new file mode 100644 index 00000000000..096b2057a3a --- /dev/null +++ b/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/pinkie/package.json @@ -0,0 +1,92 @@ +{ + "_args": [ + [ + "pinkie@^2.0.0", + "/Users/Filippo/Documents/git/brackets/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/pinkie-promise" + ] + ], + "_from": "pinkie@>=2.0.0 <3.0.0", + "_id": "pinkie@2.0.4", + "_inCache": true, + "_installable": true, + "_location": "/pinkie", + "_nodeVersion": "4.2.4", + "_npmUser": { + "email": "floatdrop@gmail.com", + "name": "floatdrop" + }, + "_npmVersion": "2.14.12", + "_phantomChildren": {}, + "_requested": { + "name": "pinkie", + "raw": "pinkie@^2.0.0", + "rawSpec": "^2.0.0", + "scope": null, + "spec": ">=2.0.0 <3.0.0", + "type": "range" + }, + "_requiredBy": [ + "/pinkie-promise" + ], + "_resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", + "_shasum": "72556b80cfa0d48a974e80e77248e80ed4f7f870", + "_shrinkwrap": null, + "_spec": "pinkie@^2.0.0", + "_where": "/Users/Filippo/Documents/git/brackets/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/pinkie-promise", + "author": { + "email": "floatdrop@gmail.com", + "name": "Vsevolod Strukchinsky", + "url": "github.com/floatdrop" + }, + "bugs": { + "url": "https://github.com/floatdrop/pinkie/issues" + }, + "dependencies": {}, + "description": "Itty bitty little widdle twinkie pinkie ES2015 Promise implementation", + "devDependencies": { + "core-assert": "^0.1.1", + "coveralls": "^2.11.4", + "mocha": "*", + "nyc": "^3.2.2", + "promises-aplus-tests": "*", + "xo": "^0.10.1" + }, + "directories": {}, + "dist": { + "shasum": "72556b80cfa0d48a974e80e77248e80ed4f7f870", + "tarball": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "gitHead": "8d4a92447a5c62bff9f89756caeb4c9c8770579b", + "homepage": "https://github.com/floatdrop/pinkie", + "keywords": [ + "promise", + "promises", + "es2015", + "es6" + ], + "license": "MIT", + "maintainers": [ + { + "email": "floatdrop@gmail.com", + "name": "floatdrop" + } + ], + "name": "pinkie", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git+https://github.com/floatdrop/pinkie.git" + }, + "scripts": { + "coverage": "nyc report --reporter=text-lcov | coveralls", + "test": "xo && nyc mocha" + }, + "version": "2.0.4" +} diff --git a/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/pinkie/readme.md b/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/pinkie/readme.md new file mode 100644 index 00000000000..1565f958896 --- /dev/null +++ b/src/LiveDevelopment/MultiBrowserImpl/launchers/node/node_modules/pinkie/readme.md @@ -0,0 +1,83 @@ +

+
+ pinkie +
+
+

+ +> Itty bitty little widdle twinkie pinkie [ES2015 Promise](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promise-objects) implementation + +[![Build Status](https://travis-ci.org/floatdrop/pinkie.svg?branch=master)](https://travis-ci.org/floatdrop/pinkie) [![Coverage Status](https://coveralls.io/repos/floatdrop/pinkie/badge.svg?branch=master&service=github)](https://coveralls.io/github/floatdrop/pinkie?branch=master) + +There are [tons of Promise implementations](https://github.com/promises-aplus/promises-spec/blob/master/implementations.md#standalone) out there, but all of them focus on browser compatibility and are often bloated with functionality. + +This module is an exact Promise specification polyfill (like [native-promise-only](https://github.com/getify/native-promise-only)), but in Node.js land (it should be browserify-able though). + + +## Install + +``` +$ npm install --save pinkie +``` + + +## Usage + +```js +var fs = require('fs'); +var Promise = require('pinkie'); + +new Promise(function (resolve, reject) { + fs.readFile('foo.json', 'utf8', function (err, data) { + if (err) { + reject(err); + return; + } + + resolve(data); + }); +}); +//=> Promise +``` + + +### API + +`pinkie` exports bare [ES2015 Promise](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promise-objects) implementation and polyfills [Node.js rejection events](https://nodejs.org/api/process.html#process_event_unhandledrejection). In case you forgot: + +#### new Promise(executor) + +Returns new instance of `Promise`. + +##### executor + +*Required* +Type: `function` + +Function with two arguments `resolve` and `reject`. The first argument fulfills the promise, the second argument rejects it. + +#### pinkie.all(promises) + +Returns a promise that resolves when all of the promises in the `promises` Array argument have resolved. + +#### pinkie.race(promises) + +Returns a promise that resolves or rejects as soon as one of the promises in the `promises` Array resolves or rejects, with the value or reason from that promise. + +#### pinkie.reject(reason) + +Returns a Promise object that is rejected with the given `reason`. + +#### pinkie.resolve(value) + +Returns a Promise object that is resolved with the given `value`. If the `value` is a thenable (i.e. has a then method), the returned promise will "follow" that thenable, adopting its eventual state; otherwise the returned promise will be fulfilled with the `value`. + + +## Related + +- [pinkie-promise](https://github.com/floatdrop/pinkie-promise) - Returns the native Promise or this module + + +## License + +MIT © [Vsevolod Strukchinsky](http://github.com/floatdrop) diff --git a/src/LiveDevelopment/MultiBrowserImpl/launchers/node/package.json b/src/LiveDevelopment/MultiBrowserImpl/launchers/node/package.json index 83cdf737498..994a54144c5 100644 --- a/src/LiveDevelopment/MultiBrowserImpl/launchers/node/package.json +++ b/src/LiveDevelopment/MultiBrowserImpl/launchers/node/package.json @@ -1,6 +1,6 @@ { "name": "livedev-multibrowser-launchers", "dependencies": { - "open": "0.0.4" + "opn": "4.0.2" } }