unplugin-https-reverse-proxy 1.0.0-beta.9 → 2.0.0

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.
package/dist/rspack.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  src_default
3
- } from "./chunk-ZSHTX2B6.js";
4
- import "./chunk-RUJE3YFB.js";
3
+ } from "./chunk-SO2FMQ2Q.js";
4
+ import "./chunk-2P7SUCQ3.js";
5
5
 
6
6
  // src/rspack.ts
7
7
  var rspack_default = src_default.rspack;
package/dist/types.cjs CHANGED
@@ -16,4 +16,4 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
16
16
  // src/types.ts
17
17
  var types_exports = {};
18
18
  module.exports = __toCommonJS(types_exports);
19
- exports.default = module.exports;
19
+ module.exports = module.exports;exports.default = module.exports;
package/dist/utils.cjs CHANGED
@@ -32,15 +32,20 @@ var utils_exports = {};
32
32
  __export(utils_exports, {
33
33
  chmodRecursive: () => chmodRecursive,
34
34
  consola: () => consola,
35
+ generateQrcode: () => generateQrcode,
36
+ getIpv4List: () => getIpv4List,
35
37
  isAdmin: () => isAdmin,
36
38
  once: () => once
37
39
  });
38
40
  module.exports = __toCommonJS(utils_exports);
39
- var import_node_process = __toESM(require("process"), 1);
40
- var import_node_path = __toESM(require("path"), 1);
41
- var import_promises = require("fs/promises");
42
41
  var import_node_child_process = require("child_process");
42
+ var import_promises = require("fs/promises");
43
+ var import_node_os = require("os");
44
+ var import_node_path = __toESM(require("path"), 1);
45
+ var import_node_process = __toESM(require("process"), 1);
43
46
  var import_consola = require("consola");
47
+ var import_picocolors = __toESM(require("picocolors"), 1);
48
+ var import_qrcode_terminal = __toESM(require("qrcode-terminal"), 1);
44
49
  var consola = (0, import_consola.createConsola)({
45
50
  level: 3
46
51
  }).withTag("reverse-proxy");
@@ -66,18 +71,33 @@ function isAdmin() {
66
71
  try {
67
72
  (0, import_node_child_process.execSync)("net session", { stdio: "ignore" });
68
73
  return true;
69
- } catch (e) {
74
+ } catch {
70
75
  return false;
71
76
  }
72
77
  } else {
73
- return import_node_process.default.getuid && import_node_process.default.getuid() === 0;
78
+ return !!(import_node_process.default.getuid && import_node_process.default.getuid() === 0);
74
79
  }
75
80
  }
81
+ function getIpv4List() {
82
+ const interfaces = (0, import_node_os.networkInterfaces)();
83
+ return Object.values(interfaces).flatMap((nInterface) => nInterface ?? []).filter(
84
+ (detail) => detail.address && (detail.family === "IPv4" || detail.family === 4)
85
+ ).filter((detail) => detail.family === "IPv4" && !detail.internal).map((detail) => detail.address);
86
+ }
87
+ async function generateQrcode(input) {
88
+ return new Promise((resolve) => {
89
+ import_qrcode_terminal.default.generate(input, { small: true }, (code) => {
90
+ resolve(code.split("\n").map((line) => import_picocolors.default.bgBlack(import_picocolors.default.white(line))).join("\n"));
91
+ });
92
+ });
93
+ }
76
94
  // Annotate the CommonJS export names for ESM import in node:
77
95
  0 && (module.exports = {
78
96
  chmodRecursive,
79
97
  consola,
98
+ generateQrcode,
99
+ getIpv4List,
80
100
  isAdmin,
81
101
  once
82
102
  });
83
- exports.default = module.exports;
103
+ module.exports = module.exports;exports.default = module.exports;
package/dist/utils.d.cts CHANGED
@@ -1,8 +1,10 @@
1
- import * as consola_dist_core from 'consola/dist/core';
1
+ import * as _consola from 'consola';
2
2
 
3
- declare const consola: consola_dist_core.ConsolaInstance;
3
+ declare const consola: _consola.ConsolaInstance;
4
4
  declare function chmodRecursive(_path: string, mode: number): Promise<void>;
5
5
  declare function once<T extends (...args: any[]) => any>(fn: T): (...args: Parameters<T>) => ReturnType<T>;
6
- declare function isAdmin(): boolean | undefined;
6
+ declare function isAdmin(): boolean;
7
+ declare function getIpv4List(): string[];
8
+ declare function generateQrcode(input: string): Promise<string>;
7
9
 
8
- export { chmodRecursive, consola, isAdmin, once };
10
+ export { chmodRecursive, consola, generateQrcode, getIpv4List, isAdmin, once };
package/dist/utils.d.ts CHANGED
@@ -1,8 +1,10 @@
1
- import * as consola_dist_core from 'consola/dist/core';
1
+ import * as _consola from 'consola';
2
2
 
3
- declare const consola: consola_dist_core.ConsolaInstance;
3
+ declare const consola: _consola.ConsolaInstance;
4
4
  declare function chmodRecursive(_path: string, mode: number): Promise<void>;
5
5
  declare function once<T extends (...args: any[]) => any>(fn: T): (...args: Parameters<T>) => ReturnType<T>;
6
- declare function isAdmin(): boolean | undefined;
6
+ declare function isAdmin(): boolean;
7
+ declare function getIpv4List(): string[];
8
+ declare function generateQrcode(input: string): Promise<string>;
7
9
 
8
- export { chmodRecursive, consola, isAdmin, once };
10
+ export { chmodRecursive, consola, generateQrcode, getIpv4List, isAdmin, once };
package/dist/utils.js CHANGED
@@ -1,12 +1,16 @@
1
1
  import {
2
2
  chmodRecursive,
3
3
  consola,
4
+ generateQrcode,
5
+ getIpv4List,
4
6
  isAdmin,
5
7
  once
6
- } from "./chunk-RUJE3YFB.js";
8
+ } from "./chunk-2P7SUCQ3.js";
7
9
  export {
8
10
  chmodRecursive,
9
11
  consola,
12
+ generateQrcode,
13
+ getIpv4List,
10
14
  isAdmin,
11
15
  once
12
16
  };