diff --git a/node_modules/.bin/opener b/node_modules/.bin/opener index 120b591ba993f..891b847f9117f 120000 --- a/node_modules/.bin/opener +++ b/node_modules/.bin/opener @@ -1 +1 @@ -../opener/opener.js \ No newline at end of file +../opener/bin/opener-bin.js \ No newline at end of file diff --git a/node_modules/opener/LICENSE.txt b/node_modules/opener/LICENSE.txt index 0253e52cfea9e..251b540e2e63a 100644 --- a/node_modules/opener/LICENSE.txt +++ b/node_modules/opener/LICENSE.txt @@ -2,7 +2,7 @@ Dual licensed under WTFPL and MIT: --- -Copyright © 2012–2016 Domenic Denicola +Copyright © 2012–2018 Domenic Denicola This work is free. You can redistribute it and/or modify it under the terms of the Do What The Fuck You Want To Public License, Version 2, @@ -26,7 +26,7 @@ as published by Sam Hocevar. See below for more details. The MIT License (MIT) -Copyright © 2012–2016 Domenic Denicola +Copyright © 2012–2018 Domenic Denicola Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/node_modules/opener/README.md b/node_modules/opener/README.md index 8a803f3384e67..1d81513b160d0 100644 --- a/node_modules/opener/README.md +++ b/node_modules/opener/README.md @@ -52,6 +52,4 @@ Like opening the user's browser with a test harness in your package's test scrip ## Why -Because Windows has `start`, Macs have `open`, and *nix has `xdg-open`. At least -[according to some guy on StackOverflow](http://stackoverflow.com/q/1480971/3191). And I like things that work on all -three. Like Node.js. And Opener. +Because Windows has `start`, Macs have `open`, and *nix has `xdg-open`. At least [according to some guy on StackOverflow](http://stackoverflow.com/q/1480971/3191). And I like things that work on all three. Like Node.js. And Opener. diff --git a/node_modules/opener/bin/opener-bin.js b/node_modules/opener/bin/opener-bin.js new file mode 100755 index 0000000000000..a051ea8f03f19 --- /dev/null +++ b/node_modules/opener/bin/opener-bin.js @@ -0,0 +1,10 @@ +#!/usr/bin/env node +"use strict"; + +var opener = require(".."); + +opener(process.argv.slice(2), function (error) { + if (error) { + throw error; + } +}); diff --git a/node_modules/opener/opener.js b/node_modules/opener/lib/opener.js old mode 100755 new mode 100644 similarity index 54% rename from node_modules/opener/opener.js rename to node_modules/opener/lib/opener.js index 8951fa2def5c7..2e299677d0d6e --- a/node_modules/opener/opener.js +++ b/node_modules/opener/lib/opener.js @@ -1,14 +1,33 @@ -#!/usr/bin/env node - "use strict"; - var childProcess = require("child_process"); +var os = require("os"); + +module.exports = function opener(args, options, callback) { + var platform = process.platform; + + // Attempt to detect Windows Subystem for Linux (WSL). WSL itself as Linux (which works in most cases), but in + // this specific case we need to treat it as actually being Windows. The "Windows-way" of opening things through + // cmd.exe works just fine here, whereas using xdg-open does not, since there is no X Windows in WSL. + if (platform === "linux" && os.release().indexOf("Microsoft") !== -1) { + platform = "win32"; + } -function opener(args, options, callback) { // http://stackoverflow.com/q/1480971/3191, but see below for Windows. - var command = process.platform === "win32" ? "cmd" : - process.platform === "darwin" ? "open" : - "xdg-open"; + var command; + switch (platform) { + case "win32": { + command = "cmd"; + break; + } + case "darwin": { + command = "open"; + break; + } + default: { + command = "xdg-open"; + break; + } + } if (typeof args === "string") { args = [args]; @@ -20,7 +39,7 @@ function opener(args, options, callback) { } if (options && typeof options === "object" && options.command) { - if (process.platform === "win32") { + if (platform === "win32") { // *always* use cmd on windows args = [options.command].concat(args); } else { @@ -28,7 +47,7 @@ function opener(args, options, callback) { } } - if (process.platform === "win32") { + if (platform === "win32") { // On Windows, we really want to use the "start" command. But, the rules regarding arguments with spaces, and // escaping them with quotes, can get really arcane. So the easiest way to deal with this is to pass off the // responsibility to "cmd /c", which has that logic built in. @@ -37,24 +56,11 @@ function opener(args, options, callback) { // so we need to add a dummy empty-string window title: http://stackoverflow.com/a/154090/3191 // // Additionally, on Windows ampersand needs to be escaped when passed to "start" - args = args.map(function(value) { - return value.replace(/&/g, '^&'); + args = args.map(function (value) { + return value.replace(/&/g, "^&"); }); - args = ["/c", "start", '""'].concat(args); + args = ["/c", "start", "\"\""].concat(args); } return childProcess.execFile(command, args, options, callback); -} - -// Export `opener` for programmatic access. -// You might use this to e.g. open a website: `opener("http://google.com")` -module.exports = opener; - -// If we're being called from the command line, just execute, using the command-line arguments. -if (require.main && require.main.id === module.id) { - opener(process.argv.slice(2), function (error) { - if (error) { - throw error; - } - }); -} +}; diff --git a/node_modules/opener/package.json b/node_modules/opener/package.json index 1842d51486b6d..bfd7aa7dabf36 100644 --- a/node_modules/opener/package.json +++ b/node_modules/opener/package.json @@ -1,61 +1,60 @@ { - "_args": [ - [ - "opener@1.4.3", - "/Users/rebecca/code/npm" - ] - ], - "_from": "opener@1.4.3", - "_id": "opener@1.4.3", + "_from": "opener@1.5.0", + "_id": "opener@1.5.0", "_inBundle": false, - "_integrity": "sha1-XG2ixdflgx6P+jlklQ+NZnSskLg=", + "_integrity": "sha512-MD4s/o61y2slS27zm2s4229V2gAUHX0/e3/XOmY/jsXwhysjjCIHN8lx7gqZCrZk19ym+HjCUWHeMKD7YJtKCQ==", "_location": "/opener", "_phantomChildren": {}, "_requested": { "type": "version", "registry": true, - "raw": "opener@1.4.3", + "raw": "opener@1.5.0", "name": "opener", "escapedName": "opener", - "rawSpec": "1.4.3", + "rawSpec": "1.5.0", "saveSpec": null, - "fetchSpec": "1.4.3" + "fetchSpec": "1.5.0" }, "_requiredBy": [ + "#USER", "/", "/tap" ], - "_resolved": "https://registry.npmjs.org/opener/-/opener-1.4.3.tgz", - "_spec": "1.4.3", - "_where": "/Users/rebecca/code/npm", + "_resolved": "https://registry.npmjs.org/opener/-/opener-1.5.0.tgz", + "_shasum": "24222fb4ad423ba21f5bf38855cebe44220f6531", + "_spec": "opener@1.5.0", + "_where": "/Users/zkat/Documents/code/work/npm", "author": { "name": "Domenic Denicola", "email": "d@domenic.me", "url": "https://domenic.me/" }, "bin": { - "opener": "opener.js" + "opener": "bin/opener-bin.js" }, "bugs": { "url": "https://github.com/domenic/opener/issues" }, + "bundleDependencies": false, + "deprecated": false, "description": "Opens stuff, like webpages and files and executables, cross-platform", "devDependencies": { - "jshint": "^2.6.3" + "eslint": "^5.3.0" }, "files": [ - "opener.js" + "lib/", + "bin/" ], "homepage": "https://github.com/domenic/opener#readme", "license": "(WTFPL OR MIT)", - "main": "opener.js", + "main": "lib/opener.js", "name": "opener", "repository": { "type": "git", "url": "git+https://github.com/domenic/opener.git" }, "scripts": { - "lint": "jshint opener.js" + "lint": "eslint ." }, - "version": "1.4.3" + "version": "1.5.0" } diff --git a/package-lock.json b/package-lock.json index dce6a032f34c7..2137ec287cb03 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6011,9 +6011,9 @@ } }, "opener": { - "version": "1.4.3", - "resolved": "https://registry.npmjs.org/opener/-/opener-1.4.3.tgz", - "integrity": "sha1-XG2ixdflgx6P+jlklQ+NZnSskLg=" + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/opener/-/opener-1.5.0.tgz", + "integrity": "sha512-MD4s/o61y2slS27zm2s4229V2gAUHX0/e3/XOmY/jsXwhysjjCIHN8lx7gqZCrZk19ym+HjCUWHeMKD7YJtKCQ==" }, "optimist": { "version": "0.3.7", diff --git a/package.json b/package.json index ff49f6dd4e4f3..3c10c4e686997 100644 --- a/package.json +++ b/package.json @@ -102,7 +102,7 @@ "npm-user-validate": "~1.0.0", "npmlog": "~4.1.2", "once": "~1.4.0", - "opener": "~1.4.3", + "opener": "^1.5.0", "osenv": "^0.1.5", "pacote": "^8.1.6", "path-is-inside": "~1.0.2",