@jeffreycao/copilot-api 1.9.0-beta.0 → 1.9.1

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 (49) hide show
  1. package/README.md +10 -0
  2. package/README.zh-CN.md +10 -0
  3. package/dist/{auth-DCB53u05.js → auth-C3UbfaIB.js} +6 -6
  4. package/dist/{auth-DCB53u05.js.map → auth-C3UbfaIB.js.map} +1 -1
  5. package/dist/{check-usage-iKUAIfc_.js → check-usage-CELArOu5.js} +6 -6
  6. package/dist/{check-usage-iKUAIfc_.js.map → check-usage-CELArOu5.js.map} +1 -1
  7. package/dist/{config-D3dkAXQE.js → config-BQvWqYh_.js} +3 -3
  8. package/dist/{config-D3dkAXQE.js.map → config-BQvWqYh_.js.map} +1 -1
  9. package/dist/{debug-CUx-7_jF.js → debug-DcC7ZPH0.js} +4 -4
  10. package/dist/{debug-CUx-7_jF.js.map → debug-DcC7ZPH0.js.map} +1 -1
  11. package/dist/main.js +6 -6
  12. package/dist/{paths-DvrimVju.js → paths-Cla6y5eD.js} +2 -2
  13. package/dist/{paths-DvrimVju.js.map → paths-Cla6y5eD.js.map} +1 -1
  14. package/dist/{server-BGqhE4N_.js → server-CA39Gy7x.js} +45 -1647
  15. package/dist/server-CA39Gy7x.js.map +1 -0
  16. package/dist/start-DKwPr9vl.js +268 -0
  17. package/dist/start-DKwPr9vl.js.map +1 -0
  18. package/dist/{token-BCdEIfN_.js → token-CIwAFD_6.js} +9 -5
  19. package/dist/token-CIwAFD_6.js.map +1 -0
  20. package/dist/{utils-DXuuBUT_.js → utils-DG6CB51Z.js} +4 -5
  21. package/dist/{utils-DXuuBUT_.js.map → utils-DG6CB51Z.js.map} +1 -1
  22. package/package.json +2 -1
  23. package/dist/GptEncoding-TiCgsNrQ.js +0 -887
  24. package/dist/GptEncoding-TiCgsNrQ.js.map +0 -1
  25. package/dist/chunk-BZ41Y9eH.js +0 -39
  26. package/dist/cl100k_base-kiDWemr-.js +0 -101375
  27. package/dist/cl100k_base-kiDWemr-.js.map +0 -1
  28. package/dist/dist-B3jIqeb6.js +0 -961
  29. package/dist/dist-B3jIqeb6.js.map +0 -1
  30. package/dist/dist-CSEoNgAt.js +0 -334
  31. package/dist/dist-CSEoNgAt.js.map +0 -1
  32. package/dist/o200k_base-BlrOP1Jc.js +0 -204726
  33. package/dist/o200k_base-BlrOP1Jc.js.map +0 -1
  34. package/dist/p50k_base-DA6KYT1Z.js +0 -11
  35. package/dist/p50k_base-DA6KYT1Z.js.map +0 -1
  36. package/dist/p50k_base-tS38LhIO.js +0 -50483
  37. package/dist/p50k_base-tS38LhIO.js.map +0 -1
  38. package/dist/p50k_edit-BlA1HcF4.js +0 -11
  39. package/dist/p50k_edit-BlA1HcF4.js.map +0 -1
  40. package/dist/prompt-CyV2d7YW.js +0 -850
  41. package/dist/prompt-CyV2d7YW.js.map +0 -1
  42. package/dist/r50k_base-CaCWe6-8.js +0 -50466
  43. package/dist/r50k_base-CaCWe6-8.js.map +0 -1
  44. package/dist/registry-B_2v83L7.js +0 -797
  45. package/dist/registry-B_2v83L7.js.map +0 -1
  46. package/dist/server-BGqhE4N_.js.map +0 -1
  47. package/dist/start-Cxl5pgll.js +0 -27379
  48. package/dist/start-Cxl5pgll.js.map +0 -1
  49. package/dist/token-BCdEIfN_.js.map +0 -1
@@ -1,797 +0,0 @@
1
- import { __commonJS, __require } from "./chunk-BZ41Y9eH.js";
2
-
3
- //#region node_modules/winreg/lib/registry.js
4
- var require_registry = /* @__PURE__ */ __commonJS({ "node_modules/winreg/lib/registry.js": ((exports, module) => {
5
- /************************************************************************************************************
6
- * registry.js - contains a wrapper for the REG command under Windows, which provides access to the registry
7
- *
8
- * @author Paul Bottin a/k/a FrEsC
9
- *
10
- */
11
- var util = __require("util"), path = __require("path"), spawn = __require("child_process").spawn, log = function() {}, HKLM = "HKLM", HKCU = "HKCU", HKCR = "HKCR", HKU = "HKU", HKCC = "HKCC", HIVES = [
12
- HKLM,
13
- HKCU,
14
- HKCR,
15
- HKU,
16
- HKCC
17
- ], REG_SZ = "REG_SZ", REG_MULTI_SZ = "REG_MULTI_SZ", REG_EXPAND_SZ = "REG_EXPAND_SZ", REG_DWORD = "REG_DWORD", REG_QWORD = "REG_QWORD", REG_BINARY = "REG_BINARY", REG_NONE = "REG_NONE", REG_TYPES = [
18
- REG_SZ,
19
- REG_MULTI_SZ,
20
- REG_EXPAND_SZ,
21
- REG_DWORD,
22
- REG_QWORD,
23
- REG_BINARY,
24
- REG_NONE
25
- ], DEFAULT_VALUE = "", KEY_PATTERN = /(\\[a-zA-Z0-9_\s]+)*/, PATH_PATTERN = /^(HKEY_LOCAL_MACHINE|HKEY_CURRENT_USER|HKEY_CLASSES_ROOT|HKEY_USERS|HKEY_CURRENT_CONFIG)(.*)$/, ITEM_PATTERN = /^(.*)\s(REG_SZ|REG_MULTI_SZ|REG_EXPAND_SZ|REG_DWORD|REG_QWORD|REG_BINARY|REG_NONE)\s+([^\s].*)$/;
26
- /**
27
- * Creates an Error object that contains the exit code of the REG.EXE process.
28
- * This contructor is private. Objects of this type are created internally and returned in the <code>err</code> parameters in case the REG.EXE process doesn't exit cleanly.
29
- *
30
- * @private
31
- * @class
32
- *
33
- * @param {string} message - the error message
34
- * @param {number} code - the process exit code
35
- *
36
- */
37
- function ProcessUncleanExitError(message, code) {
38
- if (!(this instanceof ProcessUncleanExitError)) return new ProcessUncleanExitError(message, code);
39
- Error.captureStackTrace(this, ProcessUncleanExitError);
40
- /**
41
- * The error name.
42
- * @readonly
43
- * @member {string} ProcessUncleanExitError#name
44
- */
45
- this.__defineGetter__("name", function() {
46
- return ProcessUncleanExitError.name;
47
- });
48
- /**
49
- * The error message.
50
- * @readonly
51
- * @member {string} ProcessUncleanExitError#message
52
- */
53
- this.__defineGetter__("message", function() {
54
- return message;
55
- });
56
- /**
57
- * The process exit code.
58
- * @readonly
59
- * @member {number} ProcessUncleanExitError#code
60
- */
61
- this.__defineGetter__("code", function() {
62
- return code;
63
- });
64
- }
65
- util.inherits(ProcessUncleanExitError, Error);
66
- function captureOutput(child) {
67
- var output = {
68
- "stdout": "",
69
- "stderr": ""
70
- };
71
- child.stdout.on("data", function(data) {
72
- output["stdout"] += data.toString();
73
- });
74
- child.stderr.on("data", function(data) {
75
- output["stderr"] += data.toString();
76
- });
77
- return output;
78
- }
79
- function mkErrorMsg(registryCommand, code, output) {
80
- var stdout = output["stdout"].trim();
81
- var stderr = output["stderr"].trim();
82
- var msg = util.format("%s command exited with code %d:\n%s\n%s", registryCommand, code, stdout, stderr);
83
- return new ProcessUncleanExitError(msg, code);
84
- }
85
- function convertArchString(archString) {
86
- if (archString == "x64") return "64";
87
- else if (archString == "x86") return "32";
88
- else throw new Error("illegal architecture: " + archString + " (use x86 or x64)");
89
- }
90
- function pushArch(args, arch) {
91
- if (arch) args.push("/reg:" + convertArchString(arch));
92
- }
93
- function getRegExePath() {
94
- if (process.platform === "win32") return path.join(process.env.windir, "system32", "reg.exe");
95
- else return "REG";
96
- }
97
- /**
98
- * Creates a single registry value record.
99
- * This contructor is private. Objects of this type are created internally and returned by methods of {@link Registry} objects.
100
- *
101
- * @private
102
- * @class
103
- *
104
- * @param {string} host - the hostname
105
- * @param {string} hive - the hive id
106
- * @param {string} key - the registry key
107
- * @param {string} name - the value name
108
- * @param {string} type - the value type
109
- * @param {string} value - the value
110
- * @param {string} arch - the hive architecture ('x86' or 'x64')
111
- *
112
- */
113
- function RegistryItem(host, hive, key, name, type, value, arch) {
114
- if (!(this instanceof RegistryItem)) return new RegistryItem(host, hive, key, name, type, value, arch);
115
- var _host = host, _hive = hive, _key = key, _name = name, _type = type, _value = value, _arch = arch;
116
- /**
117
- * The hostname.
118
- * @readonly
119
- * @member {string} RegistryItem#host
120
- */
121
- this.__defineGetter__("host", function() {
122
- return _host;
123
- });
124
- /**
125
- * The hive id.
126
- * @readonly
127
- * @member {string} RegistryItem#hive
128
- */
129
- this.__defineGetter__("hive", function() {
130
- return _hive;
131
- });
132
- /**
133
- * The registry key.
134
- * @readonly
135
- * @member {string} RegistryItem#key
136
- */
137
- this.__defineGetter__("key", function() {
138
- return _key;
139
- });
140
- /**
141
- * The value name.
142
- * @readonly
143
- * @member {string} RegistryItem#name
144
- */
145
- this.__defineGetter__("name", function() {
146
- return _name;
147
- });
148
- /**
149
- * The value type.
150
- * @readonly
151
- * @member {string} RegistryItem#type
152
- */
153
- this.__defineGetter__("type", function() {
154
- return _type;
155
- });
156
- /**
157
- * The value.
158
- * @readonly
159
- * @member {string} RegistryItem#value
160
- */
161
- this.__defineGetter__("value", function() {
162
- return _value;
163
- });
164
- /**
165
- * The hive architecture.
166
- * @readonly
167
- * @member {string} RegistryItem#arch
168
- */
169
- this.__defineGetter__("arch", function() {
170
- return _arch;
171
- });
172
- }
173
- util.inherits(RegistryItem, Object);
174
- /**
175
- * Creates a registry object, which provides access to a single registry key.
176
- * Note: This class is returned by a call to ```require('winreg')```.
177
- *
178
- * @public
179
- * @class
180
- *
181
- * @param {object} options - the options
182
- * @param {string=} options.host - the hostname
183
- * @param {string=} options.hive - the hive id
184
- * @param {string=} options.key - the registry key
185
- * @param {string=} options.arch - the optional registry hive architecture ('x86' or 'x64'; only valid on Windows 64 Bit Operating Systems)
186
- *
187
- * @example
188
- * var Registry = require('winreg')
189
- * , autoStartCurrentUser = new Registry({
190
- * hive: Registry.HKCU,
191
- * key: '\\Software\\Microsoft\\Windows\\CurrentVersion\\Run'
192
- * });
193
- *
194
- */
195
- function Registry(options) {
196
- if (!(this instanceof Registry)) return new Registry(options);
197
- var _options = options || {}, _host = "" + (_options.host || ""), _hive = "" + (_options.hive || HKLM), _key = "" + (_options.key || ""), _arch = _options.arch || null;
198
- /**
199
- * The hostname.
200
- * @readonly
201
- * @member {string} Registry#host
202
- */
203
- this.__defineGetter__("host", function() {
204
- return _host;
205
- });
206
- /**
207
- * The hive id.
208
- * @readonly
209
- * @member {string} Registry#hive
210
- */
211
- this.__defineGetter__("hive", function() {
212
- return _hive;
213
- });
214
- /**
215
- * The registry key name.
216
- * @readonly
217
- * @member {string} Registry#key
218
- */
219
- this.__defineGetter__("key", function() {
220
- return _key;
221
- });
222
- /**
223
- * The full path to the registry key.
224
- * @readonly
225
- * @member {string} Registry#path
226
- */
227
- this.__defineGetter__("path", function() {
228
- return "\"" + (_host.length == 0 ? "" : "\\\\" + _host + "\\") + _hive + _key + "\"";
229
- });
230
- /**
231
- * The registry hive architecture ('x86' or 'x64').
232
- * @readonly
233
- * @member {string} Registry#arch
234
- */
235
- this.__defineGetter__("arch", function() {
236
- return _arch;
237
- });
238
- /**
239
- * Creates a new {@link Registry} instance that points to the parent registry key.
240
- * @readonly
241
- * @member {Registry} Registry#parent
242
- */
243
- this.__defineGetter__("parent", function() {
244
- var i = _key.lastIndexOf("\\");
245
- return new Registry({
246
- host: this.host,
247
- hive: this.hive,
248
- key: i == -1 ? "" : _key.substring(0, i),
249
- arch: this.arch
250
- });
251
- });
252
- if (HIVES.indexOf(_hive) == -1) throw new Error("illegal hive specified.");
253
- if (!KEY_PATTERN.test(_key)) throw new Error("illegal key specified.");
254
- if (_arch && _arch != "x64" && _arch != "x86") throw new Error("illegal architecture specified (use x86 or x64)");
255
- }
256
- /**
257
- * Registry hive key HKEY_LOCAL_MACHINE.
258
- * Note: For writing to this hive your program has to run with admin privileges.
259
- * @type {string}
260
- */
261
- Registry.HKLM = HKLM;
262
- /**
263
- * Registry hive key HKEY_CURRENT_USER.
264
- * @type {string}
265
- */
266
- Registry.HKCU = HKCU;
267
- /**
268
- * Registry hive key HKEY_CLASSES_ROOT.
269
- * Note: For writing to this hive your program has to run with admin privileges.
270
- * @type {string}
271
- */
272
- Registry.HKCR = HKCR;
273
- /**
274
- * Registry hive key HKEY_USERS.
275
- * Note: For writing to this hive your program has to run with admin privileges.
276
- * @type {string}
277
- */
278
- Registry.HKU = HKU;
279
- /**
280
- * Registry hive key HKEY_CURRENT_CONFIG.
281
- * Note: For writing to this hive your program has to run with admin privileges.
282
- * @type {string}
283
- */
284
- Registry.HKCC = HKCC;
285
- /**
286
- * Collection of available registry hive keys.
287
- * @type {array}
288
- */
289
- Registry.HIVES = HIVES;
290
- /**
291
- * Registry value type STRING.
292
- * @type {string}
293
- */
294
- Registry.REG_SZ = REG_SZ;
295
- /**
296
- * Registry value type MULTILINE_STRING.
297
- * @type {string}
298
- */
299
- Registry.REG_MULTI_SZ = REG_MULTI_SZ;
300
- /**
301
- * Registry value type EXPANDABLE_STRING.
302
- * @type {string}
303
- */
304
- Registry.REG_EXPAND_SZ = REG_EXPAND_SZ;
305
- /**
306
- * Registry value type DOUBLE_WORD.
307
- * @type {string}
308
- */
309
- Registry.REG_DWORD = REG_DWORD;
310
- /**
311
- * Registry value type QUAD_WORD.
312
- * @type {string}
313
- */
314
- Registry.REG_QWORD = REG_QWORD;
315
- /**
316
- * Registry value type BINARY.
317
- * @type {string}
318
- */
319
- Registry.REG_BINARY = REG_BINARY;
320
- /**
321
- * Registry value type UNKNOWN.
322
- * @type {string}
323
- */
324
- Registry.REG_NONE = REG_NONE;
325
- /**
326
- * Collection of available registry value types.
327
- * @type {array}
328
- */
329
- Registry.REG_TYPES = REG_TYPES;
330
- /**
331
- * The name of the default value. May be used instead of the empty string literal for better readability.
332
- * @type {string}
333
- */
334
- Registry.DEFAULT_VALUE = DEFAULT_VALUE;
335
- /**
336
- * Retrieve all values from this registry key.
337
- * @param {valuesCallback} cb - callback function
338
- * @param {ProcessUncleanExitError=} cb.err - error object or null if successful
339
- * @param {array=} cb.items - an array of {@link RegistryItem} objects
340
- * @returns {Registry} this registry key object
341
- */
342
- Registry.prototype.values = function values(cb) {
343
- if (typeof cb !== "function") throw new TypeError("must specify a callback");
344
- var args = ["QUERY", this.path];
345
- pushArch(args, this.arch);
346
- var proc = spawn(getRegExePath(), args, {
347
- cwd: void 0,
348
- env: process.env,
349
- shell: true,
350
- windowsHide: true,
351
- stdio: [
352
- "ignore",
353
- "pipe",
354
- "pipe"
355
- ]
356
- }), buffer = "", self = this, error = null;
357
- var output = captureOutput(proc);
358
- proc.on("close", function(code) {
359
- if (error) return;
360
- else if (code !== 0) {
361
- log("process exited with code " + code);
362
- cb(mkErrorMsg("QUERY", code, output), null);
363
- } else {
364
- var items = [], result = [], lines = buffer.split("\n"), lineNumber = 0;
365
- for (var i = 0, l = lines.length; i < l; i++) {
366
- var line = lines[i].trim();
367
- if (line.length > 0) {
368
- log(line);
369
- if (lineNumber != 0) items.push(line);
370
- ++lineNumber;
371
- }
372
- }
373
- for (var i = 0, l = items.length; i < l; i++) {
374
- var match = ITEM_PATTERN.exec(items[i]), name, type, value;
375
- if (match) {
376
- name = match[1].trim();
377
- type = match[2].trim();
378
- value = match[3];
379
- result.push(new RegistryItem(self.host, self.hive, self.key, name, type, value, self.arch));
380
- }
381
- }
382
- cb(null, result);
383
- }
384
- });
385
- proc.stdout.on("data", function(data) {
386
- buffer += data.toString();
387
- });
388
- proc.on("error", function(err) {
389
- error = err;
390
- cb(err);
391
- });
392
- return this;
393
- };
394
- /**
395
- * Retrieve all subkeys from this registry key.
396
- * @param {function (err, items)} cb - callback function
397
- * @param {ProcessUncleanExitError=} cb.err - error object or null if successful
398
- * @param {array=} cb.items - an array of {@link Registry} objects
399
- * @returns {Registry} this registry key object
400
- */
401
- Registry.prototype.keys = function keys(cb) {
402
- if (typeof cb !== "function") throw new TypeError("must specify a callback");
403
- var args = ["QUERY", this.path];
404
- pushArch(args, this.arch);
405
- var proc = spawn(getRegExePath(), args, {
406
- cwd: void 0,
407
- env: process.env,
408
- shell: true,
409
- windowsHide: true,
410
- stdio: [
411
- "ignore",
412
- "pipe",
413
- "pipe"
414
- ]
415
- }), buffer = "", self = this, error = null;
416
- var output = captureOutput(proc);
417
- proc.on("close", function(code) {
418
- if (error) return;
419
- else if (code !== 0) {
420
- log("process exited with code " + code);
421
- cb(mkErrorMsg("QUERY", code, output), null);
422
- }
423
- });
424
- proc.stdout.on("data", function(data) {
425
- buffer += data.toString();
426
- });
427
- proc.stdout.on("end", function() {
428
- var items = [], result = [], lines = buffer.split("\n");
429
- for (var i = 0, l = lines.length; i < l; i++) {
430
- var line = lines[i].trim();
431
- if (line.length > 0) {
432
- log(line);
433
- items.push(line);
434
- }
435
- }
436
- for (var i = 0, l = items.length; i < l; i++) {
437
- var match = PATH_PATTERN.exec(items[i]), key;
438
- if (match) {
439
- match[1];
440
- key = match[2];
441
- if (key && key !== self.key) result.push(new Registry({
442
- host: self.host,
443
- hive: self.hive,
444
- key,
445
- arch: self.arch
446
- }));
447
- }
448
- }
449
- cb(null, result);
450
- });
451
- proc.on("error", function(err) {
452
- error = err;
453
- cb(err);
454
- });
455
- return this;
456
- };
457
- /**
458
- * Gets a named value from this registry key.
459
- * @param {string} name - the value name, use {@link Registry.DEFAULT_VALUE} or an empty string for the default value
460
- * @param {function (err, item)} cb - callback function
461
- * @param {ProcessUncleanExitError=} cb.err - error object or null if successful
462
- * @param {RegistryItem=} cb.item - the retrieved registry item
463
- * @returns {Registry} this registry key object
464
- */
465
- Registry.prototype.get = function get(name, cb) {
466
- if (typeof cb !== "function") throw new TypeError("must specify a callback");
467
- var args = ["QUERY", this.path];
468
- if (name == "") args.push("/ve");
469
- else args = args.concat(["/v", name]);
470
- pushArch(args, this.arch);
471
- var proc = spawn(getRegExePath(), args, {
472
- cwd: void 0,
473
- env: process.env,
474
- shell: true,
475
- windowsHide: true,
476
- stdio: [
477
- "ignore",
478
- "pipe",
479
- "pipe"
480
- ]
481
- }), buffer = "", self = this, error = null;
482
- var output = captureOutput(proc);
483
- proc.on("close", function(code) {
484
- if (error) return;
485
- else if (code !== 0) {
486
- log("process exited with code " + code);
487
- cb(mkErrorMsg("QUERY", code, output), null);
488
- } else {
489
- var items = [], result = null, lines = buffer.split("\n"), lineNumber = 0;
490
- for (var i = 0, l = lines.length; i < l; i++) {
491
- var line = lines[i].trim();
492
- if (line.length > 0) {
493
- log(line);
494
- if (lineNumber != 0) items.push(line);
495
- ++lineNumber;
496
- }
497
- }
498
- var item = items[items.length - 1] || "", match = ITEM_PATTERN.exec(item), name$1, type, value;
499
- if (match) {
500
- name$1 = match[1].trim();
501
- type = match[2].trim();
502
- value = match[3];
503
- result = new RegistryItem(self.host, self.hive, self.key, name$1, type, value, self.arch);
504
- }
505
- cb(null, result);
506
- }
507
- });
508
- proc.stdout.on("data", function(data) {
509
- buffer += data.toString();
510
- });
511
- proc.on("error", function(err) {
512
- error = err;
513
- cb(err);
514
- });
515
- return this;
516
- };
517
- /**
518
- * Sets a named value in this registry key, overwriting an already existing value.
519
- * @param {string} name - the value name, use {@link Registry.DEFAULT_VALUE} or an empty string for the default value
520
- * @param {string} type - the value type
521
- * @param {string} value - the value
522
- * @param {function (err)} cb - callback function
523
- * @param {ProcessUncleanExitError=} cb.err - error object or null if successful
524
- * @returns {Registry} this registry key object
525
- */
526
- Registry.prototype.set = function set(name, type, value, cb) {
527
- if (typeof cb !== "function") throw new TypeError("must specify a callback");
528
- if (REG_TYPES.indexOf(type) == -1) throw Error("illegal type specified.");
529
- var args = ["ADD", this.path];
530
- if (name == "") args.push("/ve");
531
- else args = args.concat(["/v", name]);
532
- args = args.concat([
533
- "/t",
534
- type,
535
- "/d",
536
- value,
537
- "/f"
538
- ]);
539
- pushArch(args, this.arch);
540
- var proc = spawn(getRegExePath(), args, {
541
- cwd: void 0,
542
- env: process.env,
543
- shell: true,
544
- windowsHide: true,
545
- stdio: [
546
- "ignore",
547
- "pipe",
548
- "pipe"
549
- ]
550
- }), error = null;
551
- var output = captureOutput(proc);
552
- proc.on("close", function(code) {
553
- if (error) return;
554
- else if (code !== 0) {
555
- log("process exited with code " + code);
556
- cb(mkErrorMsg("ADD", code, output, null));
557
- } else cb(null);
558
- });
559
- proc.stdout.on("data", function(data) {
560
- log("" + data);
561
- });
562
- proc.on("error", function(err) {
563
- error = err;
564
- cb(err);
565
- });
566
- return this;
567
- };
568
- /**
569
- * Remove a named value from this registry key. If name is empty, sets the default value of this key.
570
- * Note: This key must be already existing.
571
- * @param {string} name - the value name, use {@link Registry.DEFAULT_VALUE} or an empty string for the default value
572
- * @param {function (err)} cb - callback function
573
- * @param {ProcessUncleanExitError=} cb.err - error object or null if successful
574
- * @returns {Registry} this registry key object
575
- */
576
- Registry.prototype.remove = function remove(name, cb) {
577
- if (typeof cb !== "function") throw new TypeError("must specify a callback");
578
- var args = name ? [
579
- "DELETE",
580
- this.path,
581
- "/f",
582
- "/v",
583
- name
584
- ] : [
585
- "DELETE",
586
- this.path,
587
- "/f",
588
- "/ve"
589
- ];
590
- pushArch(args, this.arch);
591
- var proc = spawn(getRegExePath(), args, {
592
- cwd: void 0,
593
- env: process.env,
594
- shell: true,
595
- windowsHide: true,
596
- stdio: [
597
- "ignore",
598
- "pipe",
599
- "pipe"
600
- ]
601
- }), error = null;
602
- var output = captureOutput(proc);
603
- proc.on("close", function(code) {
604
- if (error) return;
605
- else if (code !== 0) {
606
- log("process exited with code " + code);
607
- cb(mkErrorMsg("DELETE", code, output), null);
608
- } else cb(null);
609
- });
610
- proc.stdout.on("data", function(data) {
611
- log("" + data);
612
- });
613
- proc.on("error", function(err) {
614
- error = err;
615
- cb(err);
616
- });
617
- return this;
618
- };
619
- /**
620
- * Remove all subkeys and values (including the default value) from this registry key.
621
- * @param {function (err)} cb - callback function
622
- * @param {ProcessUncleanExitError=} cb.err - error object or null if successful
623
- * @returns {Registry} this registry key object
624
- */
625
- Registry.prototype.clear = function clear(cb) {
626
- if (typeof cb !== "function") throw new TypeError("must specify a callback");
627
- var args = [
628
- "DELETE",
629
- this.path,
630
- "/f",
631
- "/va"
632
- ];
633
- pushArch(args, this.arch);
634
- var proc = spawn(getRegExePath(), args, {
635
- cwd: void 0,
636
- env: process.env,
637
- shell: true,
638
- windowsHide: true,
639
- stdio: [
640
- "ignore",
641
- "pipe",
642
- "pipe"
643
- ]
644
- }), error = null;
645
- var output = captureOutput(proc);
646
- proc.on("close", function(code) {
647
- if (error) return;
648
- else if (code !== 0) {
649
- log("process exited with code " + code);
650
- cb(mkErrorMsg("DELETE", code, output), null);
651
- } else cb(null);
652
- });
653
- proc.stdout.on("data", function(data) {
654
- log("" + data);
655
- });
656
- proc.on("error", function(err) {
657
- error = err;
658
- cb(err);
659
- });
660
- return this;
661
- };
662
- /**
663
- * Alias for the clear method to keep it backward compatible.
664
- * @method
665
- * @deprecated Use {@link Registry#clear} or {@link Registry#destroy} in favour of this method.
666
- * @param {function (err)} cb - callback function
667
- * @param {ProcessUncleanExitError=} cb.err - error object or null if successful
668
- * @returns {Registry} this registry key object
669
- */
670
- Registry.prototype.erase = Registry.prototype.clear;
671
- /**
672
- * Delete this key and all subkeys from the registry.
673
- * @param {function (err)} cb - callback function
674
- * @param {ProcessUncleanExitError=} cb.err - error object or null if successful
675
- * @returns {Registry} this registry key object
676
- */
677
- Registry.prototype.destroy = function destroy(cb) {
678
- if (typeof cb !== "function") throw new TypeError("must specify a callback");
679
- var args = [
680
- "DELETE",
681
- this.path,
682
- "/f"
683
- ];
684
- pushArch(args, this.arch);
685
- var proc = spawn(getRegExePath(), args, {
686
- cwd: void 0,
687
- env: process.env,
688
- shell: true,
689
- windowsHide: true,
690
- stdio: [
691
- "ignore",
692
- "pipe",
693
- "pipe"
694
- ]
695
- }), error = null;
696
- var output = captureOutput(proc);
697
- proc.on("close", function(code) {
698
- if (error) return;
699
- else if (code !== 0) {
700
- log("process exited with code " + code);
701
- cb(mkErrorMsg("DELETE", code, output), null);
702
- } else cb(null);
703
- });
704
- proc.stdout.on("data", function(data) {
705
- log("" + data);
706
- });
707
- proc.on("error", function(err) {
708
- error = err;
709
- cb(err);
710
- });
711
- return this;
712
- };
713
- /**
714
- * Create this registry key. Note that this is a no-op if the key already exists.
715
- * @param {function (err)} cb - callback function
716
- * @param {ProcessUncleanExitError=} cb.err - error object or null if successful
717
- * @returns {Registry} this registry key object
718
- */
719
- Registry.prototype.create = function create(cb) {
720
- if (typeof cb !== "function") throw new TypeError("must specify a callback");
721
- var args = [
722
- "ADD",
723
- this.path,
724
- "/f"
725
- ];
726
- pushArch(args, this.arch);
727
- var proc = spawn(getRegExePath(), args, {
728
- cwd: void 0,
729
- env: process.env,
730
- shell: true,
731
- windowsHide: true,
732
- stdio: [
733
- "ignore",
734
- "pipe",
735
- "pipe"
736
- ]
737
- }), error = null;
738
- var output = captureOutput(proc);
739
- proc.on("close", function(code) {
740
- if (error) return;
741
- else if (code !== 0) {
742
- log("process exited with code " + code);
743
- cb(mkErrorMsg("ADD", code, output), null);
744
- } else cb(null);
745
- });
746
- proc.stdout.on("data", function(data) {
747
- log("" + data);
748
- });
749
- proc.on("error", function(err) {
750
- error = err;
751
- cb(err);
752
- });
753
- return this;
754
- };
755
- /**
756
- * Checks if this key already exists.
757
- * @param {function (err, exists)} cb - callback function
758
- * @param {ProcessUncleanExitError=} cb.err - error object or null if successful
759
- * @param {boolean=} cb.exists - true if a registry key with this name already exists
760
- * @returns {Registry} this registry key object
761
- */
762
- Registry.prototype.keyExists = function keyExists(cb) {
763
- this.values(function(err, items) {
764
- if (err) {
765
- if (err.code == 1) return cb(null, false);
766
- return cb(err);
767
- }
768
- cb(null, true);
769
- });
770
- return this;
771
- };
772
- /**
773
- * Checks if a value with the given name already exists within this key.
774
- * @param {string} name - the value name, use {@link Registry.DEFAULT_VALUE} or an empty string for the default value
775
- * @param {function (err, exists)} cb - callback function
776
- * @param {ProcessUncleanExitError=} cb.err - error object or null if successful
777
- * @param {boolean=} cb.exists - true if a value with the given name was found in this key
778
- * @returns {Registry} this registry key object
779
- */
780
- Registry.prototype.valueExists = function valueExists(name, cb) {
781
- this.get(name, function(err, item) {
782
- if (err) {
783
- if (err.code == 1) return cb(null, false);
784
- return cb(err);
785
- }
786
- cb(null, true);
787
- });
788
- return this;
789
- };
790
- module.exports = Registry;
791
- }) });
792
-
793
- //#endregion
794
- export default require_registry();
795
-
796
- export { };
797
- //# sourceMappingURL=registry-B_2v83L7.js.map