@woosau/dsh-custom-env 0.1.0 → 0.1.4

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.
@@ -5,6 +5,7 @@
5
5
  /** Win32 registry and broadcast calls used to publish user environment values. */
6
6
  export interface WindowsUserEnvBindings {
7
7
  readonly openKey: (hKey: number, subKey: string, options: number, samDesired: number, result: [unknown]) => number;
8
+ readonly queryValue: (hKey: unknown, valueName: string, reserved: unknown, type: [number] | null, data: Buffer | null, cbData: [number]) => number;
8
9
  readonly setValue: (hKey: unknown, valueName: string, reserved: number, type: number, data: Buffer, cbData: number) => number;
9
10
  readonly deleteValue: (hKey: unknown, valueName: string) => number;
10
11
  readonly closeKey: (hKey: unknown) => number;
@@ -21,13 +22,27 @@ export declare function setWindowsUserEnvBindingsForTests(next: WindowsUserEnvBi
21
22
  * @returns Buffer accepted by RegSetValueExW.
22
23
  */
23
24
  export declare function encodeRegSz(value: string): Buffer;
25
+ /**
26
+ * Whether `name` exists under HKCU\\Environment (value may be empty).
27
+ * @param name - Variable name.
28
+ * @param platform - Override for tests; defaults to `process.platform`.
29
+ * @returns true when the value name is present.
30
+ */
31
+ export declare function hasWindowsUserEnv(name: string, platform?: NodeJS.Platform): boolean;
24
32
  /**
25
33
  * Write entries into HKCU\\Environment and broadcast WM_SETTINGCHANGE.
26
34
  * No-op on non-Windows hosts or when `entries` is empty.
27
35
  * @param entries - Variable map to persist.
28
36
  * @param platform - Override for tests; defaults to `process.platform`.
29
37
  */
30
- export declare function persistWindowsUserEnv(entries: Readonly<Record<string, string>>, platform?: NodeJS.Platform): void;
38
+ export declare function writeWindowsUserEnv(entries: Readonly<Record<string, string>>, platform?: NodeJS.Platform): void;
39
+ /**
40
+ * Delete many user environment values from HKCU\\Environment in one open/broadcast.
41
+ * Missing values are ignored.
42
+ * @param names - Variable names to remove.
43
+ * @param platform - Override for tests; defaults to `process.platform`.
44
+ */
45
+ export declare function removeWindowsUserEnvs(names: readonly string[], platform?: NodeJS.Platform): void;
31
46
  /**
32
47
  * Delete one user environment value from HKCU\\Environment.
33
48
  * Missing values are ignored.
@@ -21,6 +21,11 @@ export interface EnvSnapshot {
21
21
  readonly exists: boolean;
22
22
  readonly entries: readonly EnvEntry[];
23
23
  }
24
+ /** One name/value pair for plugin-facing `setVar` / `setVars`. */
25
+ export interface EnvVarWrite {
26
+ readonly name: string;
27
+ readonly value: string;
28
+ }
24
29
  /** Snapshot returned by `customEnv/cliStatus` and `cliInstall`. */
25
30
  export interface CliStatus {
26
31
  readonly platform: string;
package/locale/en.json CHANGED
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "meta.title": "Environment variables",
3
- "meta.description": "Edit $DSH_HOME/.env, sync Host/OS user environment, and install the dsh CLI for this Host on Windows/macOS."
3
+ "meta.description": "Edit $DSH_HOME/.env and sync the Host / OS user environment."
4
4
  }
package/locale/zh.json CHANGED
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "meta.title": "环境变量",
3
- "meta.description": "编辑 $DSH_HOME/.env,同步 Host/操作系统用户环境,并在 Windows/macOS 为本 Host 安装 dsh CLI。"
3
+ "meta.description": "编辑 $DSH_HOME/.env,并同步 Host / 操作系统用户环境。"
4
4
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@woosau/dsh-custom-env",
3
- "description": "DSH plugin: manage $DSH_HOME/.env from Settings, sync Host process.env and Windows/macOS user environment",
4
- "version": "0.1.0",
3
+ "description": "DSH plugin: manage $DSH_HOME/.env from Settings",
4
+ "version": "0.1.4",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
7
7
  "types": "lib/types/index.d.ts",