first
This commit is contained in:
47
node_modules/opener/LICENSE.txt
generated
vendored
Normal file
47
node_modules/opener/LICENSE.txt
generated
vendored
Normal file
@ -0,0 +1,47 @@
|
||||
Dual licensed under WTFPL and MIT:
|
||||
|
||||
---
|
||||
|
||||
Copyright © 2012–2020 Domenic Denicola <d@domenic.me>
|
||||
|
||||
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,
|
||||
as published by Sam Hocevar. See below for more details.
|
||||
|
||||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
Version 2, December 2004
|
||||
|
||||
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim or modified
|
||||
copies of this license document, and changing it is allowed as long
|
||||
as the name is changed.
|
||||
|
||||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. You just DO WHAT THE FUCK YOU WANT TO.
|
||||
|
||||
---
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright © 2012–2020 Domenic Denicola <d@domenic.me>
|
||||
|
||||
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.
|
54
node_modules/opener/README.md
generated
vendored
Normal file
54
node_modules/opener/README.md
generated
vendored
Normal file
@ -0,0 +1,54 @@
|
||||
# It Opens Stuff
|
||||
|
||||
That is, in your desktop environment. This will make *actual windows pop up*, with stuff in them:
|
||||
|
||||
```bash
|
||||
npm install opener -g
|
||||
|
||||
opener http://google.com
|
||||
opener ./my-file.txt
|
||||
opener firefox
|
||||
opener npm run lint
|
||||
```
|
||||
|
||||
Also if you want to use it programmatically you can do that too:
|
||||
|
||||
```js
|
||||
var opener = require("opener");
|
||||
|
||||
opener("http://google.com");
|
||||
opener("./my-file.txt");
|
||||
opener("firefox");
|
||||
opener("npm run lint");
|
||||
```
|
||||
|
||||
Plus, it returns the child process created, so you can do things like let your script exit while the window stays open:
|
||||
|
||||
```js
|
||||
var editor = opener("documentation.odt");
|
||||
editor.unref();
|
||||
// These other unrefs may be necessary if your OS's opener process
|
||||
// exits before the process it started is complete.
|
||||
editor.stdin.unref();
|
||||
editor.stdout.unref();
|
||||
editor.stderr.unref();
|
||||
```
|
||||
|
||||
## Use It for Good
|
||||
|
||||
Like opening the user's browser with a test harness in your package's test script:
|
||||
|
||||
```json
|
||||
{
|
||||
"scripts": {
|
||||
"test": "opener ./test/runner.html"
|
||||
},
|
||||
"devDependencies": {
|
||||
"opener": "*"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Why
|
||||
|
||||
Because Windows has `start`, Macs have `open`, and *nix has `xdg-open`. At least [according to some person on StackOverflow](http://stackoverflow.com/q/1480971/3191). And I like things that work on all three. Like Node.js. And Opener.
|
10
node_modules/opener/bin/opener-bin.js
generated
vendored
Normal file
10
node_modules/opener/bin/opener-bin.js
generated
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env node
|
||||
"use strict";
|
||||
|
||||
var opener = require("..");
|
||||
|
||||
opener(process.argv.slice(2), function (error) {
|
||||
if (error) {
|
||||
throw error;
|
||||
}
|
||||
});
|
66
node_modules/opener/lib/opener.js
generated
vendored
Normal file
66
node_modules/opener/lib/opener.js
generated
vendored
Normal file
@ -0,0 +1,66 @@
|
||||
"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";
|
||||
}
|
||||
|
||||
// http://stackoverflow.com/q/1480971/3191, but see below for Windows.
|
||||
var command;
|
||||
switch (platform) {
|
||||
case "win32": {
|
||||
command = "cmd.exe";
|
||||
break;
|
||||
}
|
||||
case "darwin": {
|
||||
command = "open";
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
command = "xdg-open";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof args === "string") {
|
||||
args = [args];
|
||||
}
|
||||
|
||||
if (typeof options === "function") {
|
||||
callback = options;
|
||||
options = {};
|
||||
}
|
||||
|
||||
if (options && typeof options === "object" && options.command) {
|
||||
if (platform === "win32") {
|
||||
// *always* use cmd on windows
|
||||
args = [options.command].concat(args);
|
||||
} else {
|
||||
command = options.command;
|
||||
}
|
||||
}
|
||||
|
||||
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.
|
||||
//
|
||||
// Furthermore, if "cmd /c" double-quoted the first parameter, then "start" will interpret it as a window title,
|
||||
// so we need to add a dummy empty-string window title: http://stackoverflow.com/a/154090/3191
|
||||
//
|
||||
// Additionally, on Windows ampersand and caret need to be escaped when passed to "start"
|
||||
args = args.map(function (value) {
|
||||
return value.replace(/[&^]/g, "^$&");
|
||||
});
|
||||
args = ["/c", "start", "\"\""].concat(args);
|
||||
}
|
||||
|
||||
return childProcess.execFile(command, args, options, callback);
|
||||
};
|
58
node_modules/opener/package.json
generated
vendored
Normal file
58
node_modules/opener/package.json
generated
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
{
|
||||
"_from": "opener@^1.5.2",
|
||||
"_id": "opener@1.5.2",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-ur5UIdyw5Y7yEj9wLzhqXiy6GZ3Mwx0yGI+5sMn2r0N0v3cKJvUmFH5yPP+WXh9e0xfyzyJX95D8l088DNFj7A==",
|
||||
"_location": "/opener",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "opener@^1.5.2",
|
||||
"name": "opener",
|
||||
"escapedName": "opener",
|
||||
"rawSpec": "^1.5.2",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.5.2"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/webpack-bundle-analyzer"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/opener/-/opener-1.5.2.tgz",
|
||||
"_shasum": "5d37e1f35077b9dcac4301372271afdeb2a13598",
|
||||
"_spec": "opener@^1.5.2",
|
||||
"_where": "C:\\Users\\zhouxueli\\Desktop\\scheduling-app\\node_modules\\webpack-bundle-analyzer",
|
||||
"author": {
|
||||
"name": "Domenic Denicola",
|
||||
"email": "d@domenic.me",
|
||||
"url": "https://domenic.me/"
|
||||
},
|
||||
"bin": {
|
||||
"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": {
|
||||
"eslint": "^7.7.0"
|
||||
},
|
||||
"files": [
|
||||
"lib/",
|
||||
"bin/"
|
||||
],
|
||||
"homepage": "https://github.com/domenic/opener#readme",
|
||||
"license": "(WTFPL OR MIT)",
|
||||
"main": "lib/opener.js",
|
||||
"name": "opener",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/domenic/opener.git"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint ."
|
||||
},
|
||||
"version": "1.5.2"
|
||||
}
|
Reference in New Issue
Block a user