unplugin-https-reverse-proxy 4.1.0-beta.2 → 4.1.0-beta.3

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/index.cjs CHANGED
@@ -13678,16 +13678,28 @@ var import_node_process2 = __toESM(require("process"), 1);
13678
13678
  function resolveHelperEntry(options) {
13679
13679
  const { moduleDir, nodeBin = import_node_process2.default.execPath, exists: exists2 = import_node_fs2.existsSync } = options;
13680
13680
  for (const name of ["privileged-helper.js", "privileged-helper.cjs", "privileged-helper.mjs"]) {
13681
- const candidate = (0, import_node_path2.join)(moduleDir, name);
13682
- if (exists2(candidate))
13681
+ const candidate = findUp(moduleDir, name, exists2);
13682
+ if (candidate)
13683
13683
  return { entry: nodeBin, args: [candidate] };
13684
13684
  }
13685
- const source = (0, import_node_path2.join)(moduleDir, "privileged-helper.ts");
13686
- const tsxCli = (0, import_node_path2.join)(moduleDir, "../node_modules/tsx/dist/cli.mjs");
13687
- if (exists2(source) && exists2(tsxCli))
13685
+ const source = findUp(moduleDir, "privileged-helper.ts", exists2);
13686
+ const tsxCli = findUp(moduleDir, "node_modules/tsx/dist/cli.mjs", exists2);
13687
+ if (source && tsxCli)
13688
13688
  return { entry: nodeBin, args: [tsxCli, source] };
13689
13689
  throw new Error(`privileged helper entry not found in ${moduleDir}. Build the package first.`);
13690
13690
  }
13691
+ function findUp(from, relative, exists2) {
13692
+ let current = from;
13693
+ while (true) {
13694
+ const candidate = (0, import_node_path2.join)(current, relative);
13695
+ if (exists2(candidate))
13696
+ return candidate;
13697
+ const parent = (0, import_node_path2.dirname)(current);
13698
+ if (parent === current)
13699
+ return void 0;
13700
+ current = parent;
13701
+ }
13702
+ }
13691
13703
 
13692
13704
  // src/privileged/session.ts
13693
13705
  var import_node_buffer = require("buffer");
@@ -13986,18 +13998,42 @@ function spawnElevatedOnWindows(options) {
13986
13998
  function createHelperToken() {
13987
13999
  return (0, import_node_crypto.randomBytes)(24).toString("hex");
13988
14000
  }
13989
- function authenticateSudo(sudoCommand = "sudo") {
14001
+ function describePasswordReason(target, https) {
14002
+ const port = https ? "443" : "80";
14003
+ return [
14004
+ `reverse proxy needs administrator permission for ${target}`,
14005
+ ` \xB7 bind port ${port}${https ? ` for https://${target}` : ""}`,
14006
+ ` \xB7 add ${target} to the hosts file`,
14007
+ "",
14008
+ "This is the only prompt; the rest of the dev server keeps running as you.",
14009
+ "Press Ctrl+C at the prompt to skip the proxy and keep the dev server."
14010
+ ];
14011
+ }
14012
+ function authenticateSudo(sudoCommand = "sudo", options = {}) {
13990
14013
  if ((0, import_node_os3.platform)() === "win32")
13991
14014
  return { ok: true };
13992
14015
  if ((0, import_node_child_process2.spawnSync)(sudoCommand, ["-n", "true"], { stdio: "ignore" }).status === 0)
13993
14016
  return { ok: true };
14017
+ if (options.target) {
14018
+ for (const line of describePasswordReason(options.target, options.https ?? false))
14019
+ import_node_process5.default.stderr.write(`${line}
14020
+ `);
14021
+ import_node_process5.default.stderr.write("\n");
14022
+ }
13994
14023
  if ((0, import_node_child_process2.spawnSync)(sudoCommand, ["-v"], { stdio: "inherit" }).status === 0)
13995
14024
  return { ok: true };
13996
14025
  return {
13997
14026
  ok: false,
14027
+ denied: true,
13998
14028
  message: "administrator permission is required to edit the hosts file and bind ports 80/443"
13999
14029
  };
14000
14030
  }
14031
+ var PrivilegeDeniedError = class extends Error {
14032
+ constructor(message) {
14033
+ super(message);
14034
+ this.name = "PrivilegeDeniedError";
14035
+ }
14036
+ };
14001
14037
  async function startPrivilegedHelper(options) {
14002
14038
  var _a4, _b3;
14003
14039
  const {
@@ -14013,9 +14049,11 @@ async function startPrivilegedHelper(options) {
14013
14049
  connectTimeoutMs = 12e4
14014
14050
  } = options;
14015
14051
  if (!skipAuth && !direct) {
14016
- const auth = authenticateSudo(sudoCommand);
14017
- if (!auth.ok)
14018
- throw new Error(auth.message);
14052
+ const auth = authenticateSudo(sudoCommand, options.reason);
14053
+ if (!auth.ok) {
14054
+ const message = auth.message ?? "administrator permission is required";
14055
+ throw auth.denied ? new PrivilegeDeniedError(message) : new Error(message);
14056
+ }
14019
14057
  }
14020
14058
  const forwarded = collectForwardedEnv(env2);
14021
14059
  const forwardedArgs = Object.entries(forwarded).map(([key, value2]) => `${key}=${value2}`);
@@ -14120,6 +14158,7 @@ async function openHelperSession(scope2) {
14120
14158
  caddyStoragePath: scope2.caddyStoragePath,
14121
14159
  caddyBin: scope2.caddyBin,
14122
14160
  caddyConfigPath: scope2.caddyConfigPath,
14161
+ reason: scope2.reason,
14123
14162
  log: scope2.log
14124
14163
  });
14125
14164
  await writeToken(scope2.runtimeDir, token);
@@ -14206,6 +14245,7 @@ function openPrivilegedSession(runtimeDir, options) {
14206
14245
  // execute a path supplied over the socket.
14207
14246
  caddyBin: options.caddyBin,
14208
14247
  caddyConfigPath: options.caddyConfigPath,
14248
+ reason: options.reason,
14209
14249
  log: options.log
14210
14250
  });
14211
14251
  }
@@ -14406,12 +14446,13 @@ function splitHostPort(addr) {
14406
14446
  return { host: addr.slice(0, lastColon), port: addr.slice(lastColon + 1) };
14407
14447
  }
14408
14448
  var defaultDependencies = {
14409
- openSession: (runtimeDir) => openPrivilegedSession(runtimeDir, {
14449
+ openSession: (runtimeDir, reason) => openPrivilegedSession(runtimeDir, {
14410
14450
  log: (message) => consola.debug(message),
14411
14451
  // Both paths are fixed here, before any socket traffic: the privileged
14412
14452
  // helper must never execute something named in a request.
14413
14453
  caddyBin: caddyPath,
14414
- caddyConfigPath: caddyFilePath
14454
+ caddyConfigPath: caddyFilePath,
14455
+ reason
14415
14456
  })
14416
14457
  };
14417
14458
  var CaddyInstant = class {
@@ -14438,11 +14479,11 @@ var CaddyInstant = class {
14438
14479
  * reused across instances so a second dev server does not ask for a
14439
14480
  * password again.
14440
14481
  */
14441
- async session() {
14482
+ async session(reason) {
14442
14483
  if (this._session && !this._session.client.connected)
14443
14484
  this._session = void 0;
14444
14485
  if (!this._session)
14445
- this._session = await this.deps.openSession(TEMP_DIR);
14486
+ this._session = await this.deps.openSession(TEMP_DIR, reason);
14446
14487
  return this._session;
14447
14488
  }
14448
14489
  async getCaddyfile() {
@@ -14547,9 +14588,9 @@ Run \`${caddyPath} trust\` manually if the browser warns about the certificate.`
14547
14588
  this._target = target;
14548
14589
  if (!this.inited)
14549
14590
  await this.init();
14550
- const session = await this.session();
14551
14591
  const sourceHost = splitHostPort(source).host;
14552
14592
  const targetHost = splitHostPort(target).host;
14593
+ const session = await this.session({ target: targetHost, https });
14553
14594
  await session.client.call("hosts.add", { ip: sourceHost, host: targetHost });
14554
14595
  consola.success("update host success\n");
14555
14596
  const normalizeBase = (b) => {
@@ -14981,6 +15022,15 @@ var hmrSseBridgeClientScript = `
14981
15022
  })();
14982
15023
  `;
14983
15024
 
15025
+ // src/privilege-state.ts
15026
+ var denied = false;
15027
+ function markPrivilegeDenied() {
15028
+ denied = true;
15029
+ }
15030
+ function isPrivilegeDenied() {
15031
+ return denied;
15032
+ }
15033
+
14984
15034
  // src/index.ts
14985
15035
  var config;
14986
15036
  var caddy;
@@ -15020,16 +15070,27 @@ async function printForwardProxy() {
15020
15070
  }
15021
15071
  var vitePrintUrls = once((options, source, target, base = "/", _printUrls) => {
15022
15072
  _printUrls == null ? void 0 : _printUrls();
15073
+ if (isPrivilegeDenied())
15074
+ return;
15023
15075
  if (caddy)
15024
15076
  return;
15025
- caddy = new CaddyInstant();
15026
- caddy.run(source, target, {
15077
+ const instance = new CaddyInstant();
15078
+ caddy = instance;
15079
+ instance.run(source, target, {
15027
15080
  base,
15028
15081
  ...options
15029
15082
  }).then(async () => {
15030
15083
  await printForwardProxy();
15031
15084
  consola.success(` ${import_picocolors2.default.green("\u279C")} ${import_picocolors2.default.bold("run caddy reverse proxy success")}: ${colorUrl(`${options.https ? "https" : "http"}://${target}${base}`)}`);
15032
15085
  }).catch((e) => {
15086
+ if (caddy === instance)
15087
+ caddy = void 0;
15088
+ if (e instanceof PrivilegeDeniedError) {
15089
+ markPrivilegeDenied();
15090
+ consola.warn("reverse proxy skipped: administrator permission was not granted.");
15091
+ consola.info("Restart the dev server to enable it again.");
15092
+ return;
15093
+ }
15033
15094
  throw e;
15034
15095
  });
15035
15096
  });
@@ -15109,6 +15170,8 @@ var unpluginFactory = (options) => ({
15109
15170
  ...(_a4 = import_node_process8.default.VUE_CLI_SERVICE) == null ? void 0 : _a4.projectOptions.devServer
15110
15171
  };
15111
15172
  const source = `${devServer.host}:${devServer.port}`;
15173
+ if (isPrivilegeDenied())
15174
+ return;
15112
15175
  if (caddy)
15113
15176
  return;
15114
15177
  let base = "/";
@@ -15130,8 +15193,9 @@ var unpluginFactory = (options) => ({
15130
15193
  } else {
15131
15194
  options.https = false;
15132
15195
  }
15133
- caddy = new CaddyInstant();
15134
- caddy.run(source, target, {
15196
+ const instance = new CaddyInstant();
15197
+ caddy = instance;
15198
+ instance.run(source, target, {
15135
15199
  base,
15136
15200
  ...options
15137
15201
  }).then(() => {
@@ -15140,6 +15204,14 @@ var unpluginFactory = (options) => ({
15140
15204
  consola.success(` ${import_picocolors2.default.green("\u279C")} ${import_picocolors2.default.bold("run caddy reverse proxy success")}: ${colorUrl(`${options.https ? "https" : "http"}://${target}${base}`)}`);
15141
15205
  });
15142
15206
  }).catch((e) => {
15207
+ if (caddy === instance)
15208
+ caddy = void 0;
15209
+ if (e instanceof PrivilegeDeniedError) {
15210
+ markPrivilegeDenied();
15211
+ consola.warn("reverse proxy skipped: administrator permission was not granted.");
15212
+ consola.info("Restart the dev server to enable it again.");
15213
+ return;
15214
+ }
15143
15215
  throw e;
15144
15216
  });
15145
15217
  },
@@ -15170,9 +15242,10 @@ var unpluginFactory = (options) => ({
15170
15242
  }))) == null ? void 0 : _b3.content) == null ? void 0 : _c2.server
15171
15243
  };
15172
15244
  const source = `${devServer.host}:${devServer.port}`;
15245
+ if (isPrivilegeDenied())
15246
+ return;
15173
15247
  if (caddy)
15174
15248
  return;
15175
- caddy = new CaddyInstant();
15176
15249
  let base = "/";
15177
15250
  const publicPath = (_d2 = compiler.options.output) == null ? void 0 : _d2.publicPath;
15178
15251
  if (typeof publicPath === "string" && publicPath) {
@@ -15182,13 +15255,23 @@ var unpluginFactory = (options) => ({
15182
15255
  base = `/${base}`;
15183
15256
  if (base !== "/" && !base.endsWith("/"))
15184
15257
  base = `${base}/`;
15185
- caddy.run(source, target, {
15258
+ const instance = new CaddyInstant();
15259
+ caddy = instance;
15260
+ instance.run(source, target, {
15186
15261
  base,
15187
15262
  ...options
15188
15263
  }).then(async () => {
15189
15264
  await printForwardProxy();
15190
15265
  consola.success(` ${import_picocolors2.default.green("\u279C")} ${import_picocolors2.default.bold("run caddy reverse proxy success")}: ${colorUrl(`${options.https ? "https" : "http"}://${target}${base}`)}`);
15191
15266
  }).catch((e) => {
15267
+ if (caddy === instance)
15268
+ caddy = void 0;
15269
+ if (e instanceof PrivilegeDeniedError) {
15270
+ markPrivilegeDenied();
15271
+ consola.warn("reverse proxy skipped: administrator permission was not granted.");
15272
+ consola.info("Restart the dev server to enable it again.");
15273
+ return;
15274
+ }
15192
15275
  throw e;
15193
15276
  });
15194
15277
  }
package/dist/index.js CHANGED
@@ -3,9 +3,10 @@ import {
3
3
  unplugin,
4
4
  unpluginFactory,
5
5
  vitePrintUrls
6
- } from "./chunk-7CA3EIIX.js";
6
+ } from "./chunk-HBXMM25C.js";
7
7
  import "./chunk-EY3HXBJ4.js";
8
8
  import "./chunk-C5A7XLKL.js";
9
+ import "./chunk-WOMR3ZLM.js";
9
10
  import "./chunk-RKHJN6KY.js";
10
11
  export {
11
12
  src_default as default,
package/dist/nuxt.cjs CHANGED
@@ -13679,16 +13679,28 @@ var import_node_process2 = __toESM(require("process"), 1);
13679
13679
  function resolveHelperEntry(options) {
13680
13680
  const { moduleDir, nodeBin = import_node_process2.default.execPath, exists: exists2 = import_node_fs2.existsSync } = options;
13681
13681
  for (const name of ["privileged-helper.js", "privileged-helper.cjs", "privileged-helper.mjs"]) {
13682
- const candidate = (0, import_node_path2.join)(moduleDir, name);
13683
- if (exists2(candidate))
13682
+ const candidate = findUp(moduleDir, name, exists2);
13683
+ if (candidate)
13684
13684
  return { entry: nodeBin, args: [candidate] };
13685
13685
  }
13686
- const source = (0, import_node_path2.join)(moduleDir, "privileged-helper.ts");
13687
- const tsxCli = (0, import_node_path2.join)(moduleDir, "../node_modules/tsx/dist/cli.mjs");
13688
- if (exists2(source) && exists2(tsxCli))
13686
+ const source = findUp(moduleDir, "privileged-helper.ts", exists2);
13687
+ const tsxCli = findUp(moduleDir, "node_modules/tsx/dist/cli.mjs", exists2);
13688
+ if (source && tsxCli)
13689
13689
  return { entry: nodeBin, args: [tsxCli, source] };
13690
13690
  throw new Error(`privileged helper entry not found in ${moduleDir}. Build the package first.`);
13691
13691
  }
13692
+ function findUp(from, relative, exists2) {
13693
+ let current = from;
13694
+ while (true) {
13695
+ const candidate = (0, import_node_path2.join)(current, relative);
13696
+ if (exists2(candidate))
13697
+ return candidate;
13698
+ const parent = (0, import_node_path2.dirname)(current);
13699
+ if (parent === current)
13700
+ return void 0;
13701
+ current = parent;
13702
+ }
13703
+ }
13692
13704
 
13693
13705
  // src/privileged/session.ts
13694
13706
  var import_node_buffer = require("buffer");
@@ -13987,18 +13999,42 @@ function spawnElevatedOnWindows(options) {
13987
13999
  function createHelperToken() {
13988
14000
  return (0, import_node_crypto.randomBytes)(24).toString("hex");
13989
14001
  }
13990
- function authenticateSudo(sudoCommand = "sudo") {
14002
+ function describePasswordReason(target, https) {
14003
+ const port = https ? "443" : "80";
14004
+ return [
14005
+ `reverse proxy needs administrator permission for ${target}`,
14006
+ ` \xB7 bind port ${port}${https ? ` for https://${target}` : ""}`,
14007
+ ` \xB7 add ${target} to the hosts file`,
14008
+ "",
14009
+ "This is the only prompt; the rest of the dev server keeps running as you.",
14010
+ "Press Ctrl+C at the prompt to skip the proxy and keep the dev server."
14011
+ ];
14012
+ }
14013
+ function authenticateSudo(sudoCommand = "sudo", options = {}) {
13991
14014
  if ((0, import_node_os3.platform)() === "win32")
13992
14015
  return { ok: true };
13993
14016
  if ((0, import_node_child_process2.spawnSync)(sudoCommand, ["-n", "true"], { stdio: "ignore" }).status === 0)
13994
14017
  return { ok: true };
14018
+ if (options.target) {
14019
+ for (const line of describePasswordReason(options.target, options.https ?? false))
14020
+ import_node_process5.default.stderr.write(`${line}
14021
+ `);
14022
+ import_node_process5.default.stderr.write("\n");
14023
+ }
13995
14024
  if ((0, import_node_child_process2.spawnSync)(sudoCommand, ["-v"], { stdio: "inherit" }).status === 0)
13996
14025
  return { ok: true };
13997
14026
  return {
13998
14027
  ok: false,
14028
+ denied: true,
13999
14029
  message: "administrator permission is required to edit the hosts file and bind ports 80/443"
14000
14030
  };
14001
14031
  }
14032
+ var PrivilegeDeniedError = class extends Error {
14033
+ constructor(message) {
14034
+ super(message);
14035
+ this.name = "PrivilegeDeniedError";
14036
+ }
14037
+ };
14002
14038
  async function startPrivilegedHelper(options) {
14003
14039
  var _a4, _b3;
14004
14040
  const {
@@ -14014,9 +14050,11 @@ async function startPrivilegedHelper(options) {
14014
14050
  connectTimeoutMs = 12e4
14015
14051
  } = options;
14016
14052
  if (!skipAuth && !direct) {
14017
- const auth = authenticateSudo(sudoCommand);
14018
- if (!auth.ok)
14019
- throw new Error(auth.message);
14053
+ const auth = authenticateSudo(sudoCommand, options.reason);
14054
+ if (!auth.ok) {
14055
+ const message = auth.message ?? "administrator permission is required";
14056
+ throw auth.denied ? new PrivilegeDeniedError(message) : new Error(message);
14057
+ }
14020
14058
  }
14021
14059
  const forwarded = collectForwardedEnv(env2);
14022
14060
  const forwardedArgs = Object.entries(forwarded).map(([key, value2]) => `${key}=${value2}`);
@@ -14121,6 +14159,7 @@ async function openHelperSession(scope2) {
14121
14159
  caddyStoragePath: scope2.caddyStoragePath,
14122
14160
  caddyBin: scope2.caddyBin,
14123
14161
  caddyConfigPath: scope2.caddyConfigPath,
14162
+ reason: scope2.reason,
14124
14163
  log: scope2.log
14125
14164
  });
14126
14165
  await writeToken(scope2.runtimeDir, token);
@@ -14207,6 +14246,7 @@ function openPrivilegedSession(runtimeDir, options) {
14207
14246
  // execute a path supplied over the socket.
14208
14247
  caddyBin: options.caddyBin,
14209
14248
  caddyConfigPath: options.caddyConfigPath,
14249
+ reason: options.reason,
14210
14250
  log: options.log
14211
14251
  });
14212
14252
  }
@@ -14407,12 +14447,13 @@ function splitHostPort(addr) {
14407
14447
  return { host: addr.slice(0, lastColon), port: addr.slice(lastColon + 1) };
14408
14448
  }
14409
14449
  var defaultDependencies = {
14410
- openSession: (runtimeDir) => openPrivilegedSession(runtimeDir, {
14450
+ openSession: (runtimeDir, reason) => openPrivilegedSession(runtimeDir, {
14411
14451
  log: (message) => consola.debug(message),
14412
14452
  // Both paths are fixed here, before any socket traffic: the privileged
14413
14453
  // helper must never execute something named in a request.
14414
14454
  caddyBin: caddyPath,
14415
- caddyConfigPath: caddyFilePath
14455
+ caddyConfigPath: caddyFilePath,
14456
+ reason
14416
14457
  })
14417
14458
  };
14418
14459
  var CaddyInstant = class {
@@ -14439,11 +14480,11 @@ var CaddyInstant = class {
14439
14480
  * reused across instances so a second dev server does not ask for a
14440
14481
  * password again.
14441
14482
  */
14442
- async session() {
14483
+ async session(reason) {
14443
14484
  if (this._session && !this._session.client.connected)
14444
14485
  this._session = void 0;
14445
14486
  if (!this._session)
14446
- this._session = await this.deps.openSession(TEMP_DIR);
14487
+ this._session = await this.deps.openSession(TEMP_DIR, reason);
14447
14488
  return this._session;
14448
14489
  }
14449
14490
  async getCaddyfile() {
@@ -14548,9 +14589,9 @@ Run \`${caddyPath} trust\` manually if the browser warns about the certificate.`
14548
14589
  this._target = target;
14549
14590
  if (!this.inited)
14550
14591
  await this.init();
14551
- const session = await this.session();
14552
14592
  const sourceHost = splitHostPort(source).host;
14553
14593
  const targetHost = splitHostPort(target).host;
14594
+ const session = await this.session({ target: targetHost, https });
14554
14595
  await session.client.call("hosts.add", { ip: sourceHost, host: targetHost });
14555
14596
  consola.success("update host success\n");
14556
14597
  const normalizeBase = (b) => {
@@ -14885,6 +14926,15 @@ var hmrSseBridgeClientScript = `
14885
14926
  })();
14886
14927
  `;
14887
14928
 
14929
+ // src/privilege-state.ts
14930
+ var denied = false;
14931
+ function markPrivilegeDenied() {
14932
+ denied = true;
14933
+ }
14934
+ function isPrivilegeDenied() {
14935
+ return denied;
14936
+ }
14937
+
14888
14938
  // src/index.ts
14889
14939
  var caddy;
14890
14940
  var cwd = import_node_process8.default.cwd();
@@ -14922,16 +14972,27 @@ async function printForwardProxy() {
14922
14972
  }
14923
14973
  var vitePrintUrls = once((options, source, target, base = "/", _printUrls) => {
14924
14974
  _printUrls == null ? void 0 : _printUrls();
14975
+ if (isPrivilegeDenied())
14976
+ return;
14925
14977
  if (caddy)
14926
14978
  return;
14927
- caddy = new CaddyInstant();
14928
- caddy.run(source, target, {
14979
+ const instance = new CaddyInstant();
14980
+ caddy = instance;
14981
+ instance.run(source, target, {
14929
14982
  base,
14930
14983
  ...options
14931
14984
  }).then(async () => {
14932
14985
  await printForwardProxy();
14933
14986
  consola.success(` ${import_picocolors2.default.green("\u279C")} ${import_picocolors2.default.bold("run caddy reverse proxy success")}: ${colorUrl(`${options.https ? "https" : "http"}://${target}${base}`)}`);
14934
14987
  }).catch((e) => {
14988
+ if (caddy === instance)
14989
+ caddy = void 0;
14990
+ if (e instanceof PrivilegeDeniedError) {
14991
+ markPrivilegeDenied();
14992
+ consola.warn("reverse proxy skipped: administrator permission was not granted.");
14993
+ consola.info("Restart the dev server to enable it again.");
14994
+ return;
14995
+ }
14935
14996
  throw e;
14936
14997
  });
14937
14998
  });
package/dist/nuxt.js CHANGED
@@ -1,10 +1,11 @@
1
1
  import {
2
2
  vitePrintUrls
3
- } from "./chunk-7CA3EIIX.js";
3
+ } from "./chunk-HBXMM25C.js";
4
4
  import {
5
5
  consola
6
6
  } from "./chunk-EY3HXBJ4.js";
7
7
  import "./chunk-C5A7XLKL.js";
8
+ import "./chunk-WOMR3ZLM.js";
8
9
  import "./chunk-RKHJN6KY.js";
9
10
 
10
11
  // src/nuxt.ts
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/privilege-state.ts
21
+ var privilege_state_exports = {};
22
+ __export(privilege_state_exports, {
23
+ isPrivilegeDenied: () => isPrivilegeDenied,
24
+ markPrivilegeDenied: () => markPrivilegeDenied,
25
+ resetPrivilegeDenied: () => resetPrivilegeDenied
26
+ });
27
+ module.exports = __toCommonJS(privilege_state_exports);
28
+ var denied = false;
29
+ function markPrivilegeDenied() {
30
+ denied = true;
31
+ }
32
+ function isPrivilegeDenied() {
33
+ return denied;
34
+ }
35
+ function resetPrivilegeDenied() {
36
+ denied = false;
37
+ }
38
+ // Annotate the CommonJS export names for ESM import in node:
39
+ 0 && (module.exports = {
40
+ isPrivilegeDenied,
41
+ markPrivilegeDenied,
42
+ resetPrivilegeDenied
43
+ });
44
+ exports.default = module.exports;
@@ -0,0 +1,7 @@
1
+ /** Records that the user declined; every entry point checks this first. */
2
+ declare function markPrivilegeDenied(): void;
3
+ declare function isPrivilegeDenied(): boolean;
4
+ /** Test hook: restores the initial state between cases. */
5
+ declare function resetPrivilegeDenied(): void;
6
+
7
+ export { isPrivilegeDenied, markPrivilegeDenied, resetPrivilegeDenied };
@@ -0,0 +1,7 @@
1
+ /** Records that the user declined; every entry point checks this first. */
2
+ declare function markPrivilegeDenied(): void;
3
+ declare function isPrivilegeDenied(): boolean;
4
+ /** Test hook: restores the initial state between cases. */
5
+ declare function resetPrivilegeDenied(): void;
6
+
7
+ export { isPrivilegeDenied, markPrivilegeDenied, resetPrivilegeDenied };
@@ -0,0 +1,10 @@
1
+ import {
2
+ isPrivilegeDenied,
3
+ markPrivilegeDenied,
4
+ resetPrivilegeDenied
5
+ } from "./chunk-WOMR3ZLM.js";
6
+ export {
7
+ isPrivilegeDenied,
8
+ markPrivilegeDenied,
9
+ resetPrivilegeDenied
10
+ };