zarro 1.141.5 → 1.141.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ (function () {
3
+ // originally, I wanted to use the opn package, now renamed to
4
+ // open, but the author has kindly made it impossible to require
5
+ // from within zarro (I get an error about it being an ESM module);
6
+ // since my requirements are simple, I'll just roll my own.
7
+ const os = require("os"), { ZarroError } = requireModule("zarro-error"), spawn = requireModule("spawn");
8
+ async function open(url) {
9
+ const opener = findOpenerForPlatform();
10
+ await spawn(opener, [url]);
11
+ }
12
+ function findOpenerForPlatform() {
13
+ switch (os.platform()) {
14
+ case "darwin":
15
+ return "open";
16
+ case "netbsd":
17
+ case "freebsd":
18
+ case "linux":
19
+ case "openbsd":
20
+ return "xdg-open";
21
+ case "win32":
22
+ return "start";
23
+ case "cygwin":
24
+ // if we believe: https://stackoverflow.com/a/577698/1697008
25
+ return "cygstart";
26
+ case "aix":
27
+ case "android":
28
+ case "sunos":
29
+ default:
30
+ throw platformNotSupported();
31
+ }
32
+ }
33
+ function platformNotSupported() {
34
+ return new ZarroError(`Platform not supported for opening urls. Please open an issue at https://github.com/fluffynuts/zarro.`);
35
+ }
36
+ module.exports = {
37
+ open
38
+ };
39
+ })();
@@ -46,10 +46,10 @@
46
46
  if (!env.resolveFlag(env.DEV_SMTP_OPEN_INTERFACE)) {
47
47
  return;
48
48
  }
49
- const url = generateInterfaceUrlFor(ip, port), open = require("open");
49
+ const url = generateInterfaceUrlFor(ip, port), { open } = requireModule("open");
50
50
  logInfo(`
51
51
  Opening the dev smtp interface in your browser (${url})
52
- To disable this behavor, set env variable ${env.DEV_SMTP_OPEN_INTERFACE}=0
52
+ To disable this behavior, set env variable ${env.DEV_SMTP_OPEN_INTERFACE}=0
53
53
  `.trim());
54
54
  await open(url);
55
55
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zarro",
3
- "version": "1.141.5",
3
+ "version": "1.141.7",
4
4
  "description": "Some glue to make gulp easier, perhaps even zero- or close-to-zero-conf",
5
5
  "bin": {
6
6
  "zarro": "./index.js"
@@ -54,7 +54,6 @@
54
54
  "gulp-msbuild": "^0.10.0",
55
55
  "mkdirp": "^1.0.4",
56
56
  "npm-run-all": "^4.1.5",
57
- "open": "^9.1.0",
58
57
  "plugin-error": "^1.0.1",
59
58
  "readline": "^1.3.0",
60
59
  "request": "^2.88.2",
package/types.d.ts CHANGED
@@ -217,6 +217,9 @@ declare global {
217
217
  }
218
218
 
219
219
  type GetToolsFolder = (overrideEnv?: Env) => string;
220
+ interface Open {
221
+ open(url: string): Promise<void>;
222
+ }
220
223
 
221
224
  interface Env {
222
225
  resolve(...names: (StringEnvVar | VersionIncrementStrategy)[]): string;