@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.
- package/README.md +84 -133
- package/README.zh-CN.md +47 -96
- package/lib/client.js +243 -88
- package/lib/index.js +312 -159
- package/lib/typert.host.js +171 -1
- package/lib/typert.remote-client.js +143 -1
- package/lib/types/client/format-remote-error.d.ts +10 -0
- package/lib/types/client/locales.d.ts +66 -8
- package/lib/types/env-file.d.ts +59 -11
- package/lib/types/index.d.ts +33 -4
- package/lib/types/os-user-env/index.d.ts +15 -4
- package/lib/types/os-user-env/macos.d.ts +15 -1
- package/lib/types/os-user-env/windows.d.ts +16 -1
- package/lib/types/types.d.ts +5 -0
- package/locale/en.json +1 -1
- package/locale/zh.json +1 -1
- package/package.json +2 -2
|
@@ -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
|
|
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.
|
package/lib/types/types.d.ts
CHANGED
|
@@ -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
package/locale/zh.json
CHANGED
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
|
|
4
|
-
"version": "0.1.
|
|
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",
|