vite-plugin-rpx 0.11.30 → 0.11.31

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.
Files changed (2) hide show
  1. package/dist/index.js +22 -1
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -21775,7 +21775,8 @@ __export(exports_utils, {
21775
21775
  getPrimaryDomain: () => getPrimaryDomain,
21776
21776
  extractHostname: () => extractHostname,
21777
21777
  execSudoSync: () => execSudoSync,
21778
- debugLog: () => debugLog
21778
+ debugLog: () => debugLog,
21779
+ authorizeSystemAccess: () => authorizeSystemAccess
21779
21780
  });
21780
21781
  import { execSync } from "node:child_process";
21781
21782
  import * as fs from "node:fs/promises";
@@ -21791,6 +21792,26 @@ function isProcessElevated() {
21791
21792
  return false;
21792
21793
  }
21793
21794
  }
21795
+ function authorizeSystemAccess(options = {}) {
21796
+ if (process.platform === "win32")
21797
+ return true;
21798
+ if (isProcessElevated() || !!getSudoPassword())
21799
+ return true;
21800
+ const run = options.exec ?? execSync;
21801
+ try {
21802
+ run("sudo -n true", { stdio: "ignore" });
21803
+ return true;
21804
+ } catch {
21805
+ if (!options.interactive)
21806
+ return false;
21807
+ }
21808
+ try {
21809
+ run("sudo -v", { stdio: "inherit" });
21810
+ return true;
21811
+ } catch {
21812
+ return false;
21813
+ }
21814
+ }
21794
21815
  function execSudoSync(command) {
21795
21816
  if (isProcessElevated()) {
21796
21817
  return execSync(command, { encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vite-plugin-rpx",
3
3
  "type": "module",
4
- "version": "0.11.30",
4
+ "version": "0.11.31",
5
5
  "description": "A modern and smart reverse proxy. Vite plugin.",
6
6
  "author": "Chris Breuer <chris@stacksjs.org>",
7
7
  "license": "MIT",
@@ -47,7 +47,7 @@
47
47
  "typecheck": "bunx tsc --noEmit"
48
48
  },
49
49
  "dependencies": {
50
- "@stacksjs/rpx": "0.11.30",
50
+ "@stacksjs/rpx": "0.11.31",
51
51
  "@stacksjs/tlsx": "^0.13.13"
52
52
  },
53
53
  "simple-git-hooks": {