yavascript 0.0.1 → 0.0.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 ADDED
@@ -0,0 +1,43 @@
1
+ # yavascript
2
+
3
+ <!-- NOTE: this file is also used as help text by the CLI. Don't use markdown syntax below this line unless said syntax would also be clearly readable as plain text. -->
4
+
5
+ YavaScript is a bash-like script runner which is distributed as a single
6
+ statically-linked binary. Scripts are written in JavaScript. There are global
7
+ APIs available for all the things you'd normally want to do in a bash script,
8
+ such as:
9
+
10
+ - Running programs
11
+ - Accessing environment variables
12
+ - Reading and writing file contents
13
+ - Checking if files/folders exist
14
+ - Removing files/folders
15
+ - Reading and changing the current working directory
16
+ - Using globs to get large lists of files
17
+ - Printing stylized text to the terminal
18
+
19
+ Additionally, since it's JavaScript, you get some other features that are
20
+ either not present in bash or are cumbersome to use in bash, namely:
21
+
22
+ - Arrays (lists) and Objects (key/value dictionaries)
23
+ - Working with path strings
24
+ - Working with JSON
25
+ - Cross-file import/export using ECMAScript Modules
26
+ - Splitting strings on delimeters
27
+ - Pretty-printing of objects
28
+ - Getting the path to the currently-running script (via import.meta.url or `__filename`)
29
+ - Getting the absolute path to the root folder of the current git/mercurial repo (repoRoot function)
30
+
31
+ To view the APIs, consult the file yavascript.d.ts which was distributed with
32
+ this program, or online at https://github.com/suchipi/yavascript/blob/main/yavascript.d.ts.
33
+ This file contains TypeScript type definitions which can be given to your IDE
34
+ to assist you when writing scripts.
35
+
36
+ YavaScript is powered by a fork of the QuickJS JavaScript Engine, originally
37
+ written by Fabrice Bellard. QuickJS is a small, fast JavaScript engine
38
+ supporting the ES2020 specification.
39
+
40
+ - Original QuickJS engine: https://bellard.org/quickjs/
41
+ - The fork we use: https://github.com/suchipi/quickjs/
42
+
43
+ YavaScript is written with <3 by Lily Scott.
Binary file
Binary file
Binary file
@@ -2,9 +2,25 @@ var path = require("path");
2
2
 
3
3
  var binaryPath;
4
4
  if (process.platform === "win32") {
5
- binaryPath = path.resolve(__dirname, "..", "bin", "win32", "yavascript.exe");
5
+ binaryPath = path.resolve(
6
+ __dirname,
7
+ "..",
8
+ "bin",
9
+ "windows",
10
+ "yavascript.exe"
11
+ );
6
12
  } else if (process.platform === "darwin") {
7
- binaryPath = path.resolve(__dirname, "..", "bin", "darwin", "yavascript");
13
+ if (process.arch.startsWith("arm")) {
14
+ binaryPath = path.resolve(
15
+ __dirname,
16
+ "..",
17
+ "bin",
18
+ "darwin-arm",
19
+ "yavascript"
20
+ );
21
+ } else {
22
+ binaryPath = path.resolve(__dirname, "..", "bin", "darwin", "yavascript");
23
+ }
8
24
  } else if (process.platform === "linux") {
9
25
  binaryPath = path.resolve(__dirname, "..", "bin", "linux", "yavascript");
10
26
  } else {
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "yavascript",
3
- "version": "0.0.1",
3
+ "version": "0.0.4",
4
4
  "main": "lib/index.js",
5
5
  "bin": "lib/cli.js",
6
6
  "types": "yavascript.d.ts",
7
7
  "author": "Lily Scott <me@suchipi.com>",
8
- "license": "MIT"
8
+ "license": "MIT",
9
+ "repository": "suchipi/yavascript"
9
10
  }
package/yavascript.d.ts CHANGED
@@ -3,16 +3,38 @@
3
3
  // YavaScript APIs
4
4
  // ---------------
5
5
 
6
+ // -----------
7
+ // --- env ---
8
+ // -----------
9
+
10
+ /**
11
+ * An object representing the process's environment variables. You can read
12
+ * from it to read environment variables, write into it to set environment
13
+ * variables, and/or delete properties from it to unset environment variables.
14
+ * Any value you write will be coerced into a string.
15
+ */
6
16
  declare const env: { [key: string]: string | undefined };
7
17
 
18
+ // ------------
19
+ // --- exec ---
20
+ // ------------
21
+
22
+ type BaseExecOptions = {
23
+ /** Sets the current working directory for the child process. */
24
+ cwd?: string;
25
+
26
+ /** Sets environment variables within the process. */
27
+ env?: { [key: string | number]: string | number | boolean };
28
+ };
29
+
8
30
  interface Exec {
9
- (args: Array<string>): void;
31
+ (args: Array<string> | string): void;
10
32
 
11
- (args: Array<string>, options: Record<string, never>): void;
33
+ (args: Array<string> | string, options: Record<string, never>): void;
12
34
 
13
35
  (
14
- args: Array<string>,
15
- options: {
36
+ args: Array<string> | string,
37
+ options: BaseExecOptions & {
16
38
  /**
17
39
  * Whether an Error should be thrown when the process exits with a nonzero
18
40
  * status code.
@@ -31,8 +53,8 @@ interface Exec {
31
53
  ): void;
32
54
 
33
55
  (
34
- args: Array<string>,
35
- options: {
56
+ args: Array<string> | string,
57
+ options: BaseExecOptions & {
36
58
  /**
37
59
  * Whether an Error should be thrown when the process exits with a nonzero
38
60
  * status code.
@@ -51,8 +73,8 @@ interface Exec {
51
73
  ): { status: number };
52
74
 
53
75
  (
54
- args: Array<string>,
55
- options: {
76
+ args: Array<string> | string,
77
+ options: BaseExecOptions & {
56
78
  /**
57
79
  * Whether an Error should be thrown when the process exits with a nonzero
58
80
  * status code.
@@ -64,8 +86,8 @@ interface Exec {
64
86
  ): { status: number };
65
87
 
66
88
  (
67
- args: Array<string>,
68
- options: {
89
+ args: Array<string> | string,
90
+ options: BaseExecOptions & {
69
91
  /**
70
92
  * Whether an Error should be thrown when the process exits with a nonzero
71
93
  * status code.
@@ -84,8 +106,8 @@ interface Exec {
84
106
  ): { stdout: string; stderr: string };
85
107
 
86
108
  (
87
- args: Array<string>,
88
- options: {
109
+ args: Array<string> | string,
110
+ options: BaseExecOptions & {
89
111
  /**
90
112
  * If true, stdout and stderr will be collected into strings and returned
91
113
  * instead of being printed to the screen.
@@ -97,8 +119,8 @@ interface Exec {
97
119
  ): { stdout: string; stderr: string };
98
120
 
99
121
  (
100
- args: Array<string>,
101
- options: {
122
+ args: Array<string> | string,
123
+ options: BaseExecOptions & {
102
124
  /**
103
125
  * Whether an Error should be thrown when the process exits with a nonzero
104
126
  * status code.
@@ -109,60 +131,345 @@ interface Exec {
109
131
  captureOutput: true;
110
132
  }
111
133
  ): { stdout: string; stderr: string; status: number };
134
+
135
+ /** Log all executed commands to stderr. `isOn` is optional and defaults to `true`. Pass `false` to disable logging. */
136
+ enableLogging(isOn?: boolean): void;
112
137
  }
113
138
 
114
139
  /** Run a child process using the provided arguments. The first value in the arguments array is the program to run. */
115
140
  declare const exec: Exec;
116
141
 
117
- /** Alias for `exec(args, { captureOutput: true, failOnNonZeroStatus: false })` */
118
- declare function $(args: Array<string>): {
142
+ /** Alias for `exec(args, { captureOutput: true })` */
143
+ declare function $(args: Array<string> | string): {
119
144
  stdout: string;
120
145
  stderr: string;
121
- status: number;
122
146
  };
123
147
 
124
- /** Read the contents of a file from disk, as a string. */
148
+ // -------------
149
+ // --- paths ---
150
+ // -------------
151
+
152
+ /**
153
+ * Change the process's current working directory to the specified path.
154
+ *
155
+ * Provides the same functionality as the shell builtin of the same name.
156
+ */
157
+ declare function cd(path: string): void;
158
+
159
+ /**
160
+ * Return the process's current working directory.
161
+ *
162
+ * Provides the same functionality as the shell builtin of the same name.
163
+ */
164
+ declare function pwd(): string;
165
+
166
+ /**
167
+ * Get the absolute path given a relative path. Symlinks are also resolved.
168
+ *
169
+ * The path's target file/directory must exist.
170
+ *
171
+ * Provides the same functionality as the unix binary of the same name.
172
+ */
173
+ declare function realpath(path: string): string;
174
+
175
+ /**
176
+ * Removes the final component from a path string.
177
+ *
178
+ * Provides the same functionality as the unix binary of the same name.
179
+ */
180
+ declare function dirname(path: string): string;
181
+
182
+ /**
183
+ * Return the last component of a path string.
184
+ *
185
+ * Provides the same functionality as the unix binary of the same name.
186
+ */
187
+ declare function basename(path: string): string;
188
+
189
+ /**
190
+ * Returns the file extension of the file at a given path.
191
+ *
192
+ * If the file has no extension (eg `Makefile`, etc), then `''` will be returned.
193
+ *
194
+ * Pass `{ full: true }` to get compound extensions, eg `.d.ts` or `.test.js` instead of just `.ts`/`.js`.
195
+ */
196
+ declare function extname(
197
+ pathOrFilename: string,
198
+ options?: { full?: boolean }
199
+ ): string;
200
+
201
+ /**
202
+ * A namespace object providing several path-string-related APIs.
203
+ */
204
+ declare const paths: {
205
+ /**
206
+ * The separator character the host operating system uses between path
207
+ * components, ie. the slashes in a filepath. On windows, it's a backslash, and
208
+ * on all other OSes, it's a forward slash.
209
+ */
210
+ OS_PATH_SEPARATOR: "/" | "\\";
211
+
212
+ /**
213
+ * Split a path string (or array of path strings) on / or \\, returning an
214
+ * Array of strings.
215
+ *
216
+ * Trailing slashes and duplicate path separators will be removed.
217
+ *
218
+ * If the path starts with `/`, the first string in the Array will be empty.
219
+ */
220
+ split(path: string | Array<string>): Array<string>;
221
+
222
+ /**
223
+ * Detect which path separator is present in the given path or array of
224
+ * paths: `\` or `/`.
225
+ *
226
+ * If neither is present, `/` will be returned.
227
+ */
228
+ detectSeparator(input: string | Array<string>): string;
229
+
230
+ /**
231
+ * Create a path string from one or more path or path component strings.
232
+ * {@link paths.OS_PATH_SEPARATOR} will be used to combine parts.
233
+ *
234
+ * This function does not resolve `..` or `.`. Use {@link paths.resolve} for that.
235
+ */
236
+ join(...parts: Array<string>): string;
237
+
238
+ /**
239
+ * Resolves all `..` and `.` components in a path, returning an absolute
240
+ * path.
241
+ *
242
+ * Use `from` to specify where leading `.` or `..` characters should be
243
+ * resolved relative to. If unspecified, it defaults to `pwd()`.
244
+ */
245
+ resolve(path: string, from?: string): string;
246
+
247
+ /**
248
+ * Returns whether the path starts with either a leading slash or a windows
249
+ * drive letter.
250
+ */
251
+ isAbsolute(path: string): boolean;
252
+ };
253
+
254
+ /**
255
+ * The absolute path to the current file (whether script or module).
256
+ *
257
+ * Behaves the same as in Node.js, except that it's present within ES modules.
258
+ */
259
+ declare const __filename: string;
260
+
261
+ /**
262
+ * The absolute path to the directory the current file is inside of.
263
+ *
264
+ * Behaves the same as in Node.js, except that it's present within ES modules.
265
+ */
266
+ declare const __dirname: string;
267
+
268
+ // ------------
269
+ // --- repo ---
270
+ // ------------
271
+
272
+ /**
273
+ * Returns the absolute path to the root folder of the git/hg repo.
274
+ *
275
+ * This is done by running `git rev-parse --show-toplevel` and `hg root`.
276
+ *
277
+ * If `relativeTo` is provided, the git and hg commands will be executed in
278
+ * that folder instead of in `pwd()`.
279
+ */
280
+ declare function repoRoot(relativeTo?: string): string;
281
+
282
+ /**
283
+ * Returns whether the provided path is ignored by git.
284
+ */
285
+ declare function isGitignored(path: string): boolean;
286
+
287
+ // ------------------
288
+ // --- filesystem ---
289
+ // ------------------
290
+
291
+ /**
292
+ * Return the contents of a directory, as absolute paths. `.` and `..` are
293
+ * omitted.
294
+ *
295
+ * Use the `relativePaths` option to get relative paths instead (relative to
296
+ * the parent directory).
297
+ */
298
+ declare function ls(
299
+ dir?: string,
300
+ options?: { relativePaths?: boolean }
301
+ ): Array<string>;
302
+
303
+ /**
304
+ * Read a symlink.
305
+ *
306
+ * Returns the target of the symlink, which may be absolute or relative.
307
+ *
308
+ * Provides the same functionality as the unix binary of the same name.
309
+ */
310
+ declare function readlink(path: string): string;
311
+
312
+ /**
313
+ * Read the contents of a file from disk, as a UTF-8 string.
314
+ */
125
315
  declare function readFile(path: string): string;
126
316
 
127
- /** Write the contents of a string or ArrayBuffer to a file. */
317
+ /**
318
+ * Write the contents of a string or ArrayBuffer to a file.
319
+ *
320
+ * Strings are written using the UTF-8 encoding.
321
+ */
128
322
  declare function writeFile(path: string, data: string | ArrayBuffer): void;
129
323
 
130
- /** Returns true if the path points to a directory, or if the path points to a symlink which points to a directory. */
131
- declare function isDir(path: string): boolean;
324
+ /**
325
+ * Function which returns true if the path points to a directory, or if the
326
+ * path points to a symlink which points to a directory. Otherwise, it returns
327
+ * false.
328
+ */
329
+ interface IsDir {
330
+ /**
331
+ * Returns true if the path points to a directory, or if the path points to
332
+ * a symlink which points to a directory. Otherwise, returns false.
333
+ */
334
+ (path: string): boolean;
132
335
 
133
- /** Delete the file or directory at the specified path. If the directory isn't empty, its contents will be deleted, too. */
336
+ /**
337
+ * Maximum number of symlinks to follow before erroring. Defaults to 100.
338
+ */
339
+ symlinkLimit: number;
340
+ }
341
+
342
+ /**
343
+ * Function which returns true if the path points to a directory, or if the
344
+ * path points to a symlink which points to a directory. Otherwise, it returns
345
+ * false.
346
+ */
347
+ declare const isDir: IsDir;
348
+
349
+ /**
350
+ * Returns true if the path points to a symlink.
351
+ */
352
+ declare function isLink(path: string): boolean;
353
+
354
+ /**
355
+ * Delete the file or directory at the specified path.
356
+ *
357
+ * If the directory isn't empty, its contents will be deleted, too.
358
+ *
359
+ * Provides the same functionality as the command `rm -rf`.
360
+ */
134
361
  declare function remove(path: string): void;
135
362
 
136
- /** Returns true if a file or directory exists at the specified path. */
363
+ /**
364
+ * Returns true if a file or directory exists at the specified path.
365
+ *
366
+ * Provides the same functionality as the command `test -e`.
367
+ */
137
368
  declare function exists(path: string): boolean;
138
369
 
139
- /** Change the process's current working directory to the specified path. */
140
- declare function cd(path: string): void;
370
+ /**
371
+ * Create directories for each of the provided path components,
372
+ * if they don't already exist.
373
+ *
374
+ * Provides the same functionality as the command `mkdir -p`.
375
+ */
376
+ declare function ensureDir(path: string): string;
141
377
 
142
- /** Return the process's current working directory. */
143
- declare function pwd(): string;
378
+ /**
379
+ * Options for {@link copy}.
380
+ */
381
+ export type CopyOptions = {
382
+ /**
383
+ * What to do when attempting to copy something into a location where
384
+ * something else already exists.
385
+ *
386
+ * Defaults to "error".
387
+ */
388
+ whenTargetExists?: "overwrite" | "skip" | "error";
389
+
390
+ /**
391
+ * If provided, this function will be called multiple times as `copy`
392
+ * traverses the filesystem, to help you understand what's going on and/or
393
+ * troubleshoot things. In most cases, it makes sense to use a logging
394
+ * function here, like so:
395
+ *
396
+ * ```js
397
+ * copy("./source", "./destination", { trace: console.log });
398
+ * ```
399
+ */
400
+ trace?: (...args: Array<any>) => void;
401
+ };
144
402
 
145
403
  /**
146
- * Search the filesystem for files matching the specified glob patterns. Uses [minimatch](https://www.npmjs.com/package/minimatch) with its default options.
404
+ * Copy a file or folder from one location to another.
405
+ * Folders are copied recursively.
147
406
  *
148
- * `followSymlinks` defaults to false.
407
+ * Provides the same functionality as the command `cp -R`.
408
+ */
409
+ export function copy(from: string, to: string, options?: CopyOptions): void;
410
+
411
+ // ------------
412
+ // --- glob ---
413
+ // ------------
414
+
415
+ /**
416
+ * Options for {@link glob}.
417
+ */
418
+ export type GlobOptions = {
419
+ /**
420
+ * Whether to treat symlinks to directories as if they themselves were
421
+ * directories, traversing into them.
422
+ *
423
+ * Defaults to false.
424
+ */
425
+ followSymlinks?: boolean;
426
+
427
+ /**
428
+ * If provided, this function will be called multiple times as `glob`
429
+ * traverses the filesystem, to help you understand what's going on and/or
430
+ * troubleshoot things. In most cases, it makes sense to use a logging
431
+ * function here, like so:
432
+ *
433
+ * ```js
434
+ * glob(pwd(), ["./*.js"], { trace: console.log });
435
+ * ```
436
+ */
437
+ trace?: (...args: Array<any>) => void;
438
+ };
439
+
440
+ /**
441
+ * Search the filesystem for files matching the specified glob patterns.
442
+ *
443
+ * Uses [minimatch](https://www.npmjs.com/package/minimatch) with its default
444
+ * options.
149
445
  */
150
446
  declare function glob(
151
447
  dir: string,
152
448
  patterns: Array<string>,
153
- options?: { followSymlinks?: boolean }
449
+ options?: GlobOptions
154
450
  ): Array<string>;
155
451
 
156
- /** Print a value or values to stdout. */
452
+ // ---------------
453
+ // --- console ---
454
+ // ---------------
455
+
456
+ /**
457
+ * Print one or more values to stdout.
458
+ */
157
459
  declare const echo: typeof console.log;
158
460
 
159
- /** Convert a value to a string, using the same logic as `echo` and `console.log`. */
160
- declare function inspect(value: any): string;
461
+ // ---------------
462
+ // --- strings ---
463
+ // ---------------
161
464
 
162
- /** Remove ANSI control characters from a string. */
465
+ /**
466
+ * Remove ANSI control characters from a string.
467
+ */
163
468
  declare function stripAnsi(input: string): string;
164
469
 
165
- /** Wrap a string in double quotes, and escape any double-quotes inside with `\"`. */
470
+ /**
471
+ * Wrap a string in double quotes, and escape any double-quotes inside using `\"`.
472
+ */
166
473
  declare function quote(input: string): string;
167
474
 
168
475
  // Colors
@@ -251,6 +558,15 @@ declare var print: (...args: Array<any>) => void;
251
558
  declare var console: {
252
559
  /** Same as {@link print}(). */
253
560
  log: typeof print;
561
+
562
+ /** Same as {@link print}(). */
563
+ warn: typeof print;
564
+
565
+ /** Same as {@link print}(). */
566
+ error: typeof print;
567
+
568
+ /** Same as {@link print}(). */
569
+ info: typeof print;
254
570
  };
255
571
 
256
572
  declare module "std" {
@@ -301,6 +617,15 @@ declare module "std" {
301
617
  */
302
618
  export function loadFile(filename: string): string;
303
619
 
620
+ /**
621
+ * Read the script of module filename from an active stack frame, then return it as a string.
622
+ *
623
+ * If there isn't a valid filename for the specified stack frame, an error will be thrown.
624
+ *
625
+ * @param stackLevels - How many levels up the stack to search for a filename. Defaults to 0, which uses the current stack frame.
626
+ */
627
+ export function getFileNameFromStack(stackLevels: number): string;
628
+
304
629
  /**
305
630
  * Open a file (wrapper to the libc `fopen()`).
306
631
  * Return the FILE object.
@@ -547,7 +872,7 @@ declare module "std" {
547
872
  /** Read `length` bytes from the file to the ArrayBuffer `buffer` at byte position `position` (wrapper to the libc `fread`). Returns the number of bytes read, or `0` if the end of the file has been reached. */
548
873
  read(buffer: ArrayBuffer, position: number, length: number): number;
549
874
 
550
- /** Write `length` bytes from the file to the ArrayBuffer `buffer` at byte position `position` (wrapper to the libc `fwrite`). Returns the number of bytes written. */
875
+ /** Write `length` bytes from the ArrayBuffer `buffer` at byte position `position` into the file (wrapper to the libc `fwrite`). Returns the number of bytes written. */
551
876
  write(buffer: ArrayBuffer, position: number, length: number): number;
552
877
 
553
878
  /** Return the next line from the file, assuming UTF-8 encoding, excluding the trailing line feed. */
@@ -938,3 +1263,108 @@ declare module "os" {
938
1263
  export function access(path: string, accessMode: number): void;
939
1264
  }
940
1265
 
1266
+ /**
1267
+ * Options for {@link inspect}.
1268
+ */
1269
+ declare interface InspectOptions {
1270
+ /** Whether to display non-enumerable properties. Defaults to false. */
1271
+ all?: boolean;
1272
+
1273
+ /** Whether to invoke getter functions. Defaults to false. */
1274
+ followGetters?: boolean;
1275
+
1276
+ /** Whether to display the indexes of iterable entries. Defaults to false. */
1277
+ indexes?: boolean;
1278
+
1279
+ /** Hide object details after 𝑁 recursions. Defaults to Infinity. */
1280
+ maxDepth?: number;
1281
+
1282
+ /** If true, don't identify well-known symbols as `@@…`. Defaults to false. */
1283
+ noAmp?: boolean;
1284
+
1285
+ /** If true, don't format byte-arrays as hexadecimal. Defaults to false. */
1286
+ noHex?: boolean;
1287
+
1288
+ /** If true, don't display function source code. Defaults to false. */
1289
+ noSource?: boolean;
1290
+
1291
+ /** Whether to show `__proto__` properties if possible. Defaults to false. */
1292
+ proto?: boolean;
1293
+
1294
+ /** Whether to sort properties alphabetically. When false, properties are sorted by creation order. Defaults to false. */
1295
+ sort?: boolean;
1296
+
1297
+ /** Options that control whether and how ANSI terminal escape sequences for colours should be added to the output. Defaults to false, meaning no colours. */
1298
+ colours?: boolean | 256 | 8 | InspectColours;
1299
+
1300
+ /** Prefix string to use for indentation. Defaults to '\t'. */
1301
+ indent?: string;
1302
+ }
1303
+
1304
+ declare interface InspectColours {
1305
+ off?: string | number;
1306
+ red?: string | number;
1307
+ grey?: string | number;
1308
+ green?: string | number;
1309
+ darkGreen?: string | number;
1310
+ punct?: string | number;
1311
+ keys?: string | number;
1312
+ keyEscape?: string | number;
1313
+ typeColour?: string | number;
1314
+ primitive?: string | number;
1315
+ escape?: string | number;
1316
+ date?: string | number;
1317
+ hexBorder?: string | number;
1318
+ hexValue?: string | number;
1319
+ hexOffset?: string | number;
1320
+ reference?: string | number;
1321
+ srcBorder?: string | number;
1322
+ srcRowNum?: string | number;
1323
+ srcRowText?: string | number;
1324
+ nul?: string | number;
1325
+ nulProt?: string | number;
1326
+ undef?: string | number;
1327
+ noExts?: string | number;
1328
+ frozen?: string | number;
1329
+ sealed?: string | number;
1330
+ regex?: string | number;
1331
+ string?: string | number;
1332
+ symbol?: string | number;
1333
+ symbolFade?: string | number;
1334
+ braces?: string | number;
1335
+ quotes?: string | number;
1336
+ empty?: string | number;
1337
+ dot?: string | number;
1338
+ }
1339
+
1340
+ declare interface InspectFunction {
1341
+ /**
1342
+ * Generate a human-readable representation of a value.
1343
+ *
1344
+ * @param value - Value to inspect
1345
+ * @param options - Additional settings for refining output
1346
+ * @returns A string representation of `value`.
1347
+ */
1348
+ (value: any, options?: InspectOptions): string;
1349
+
1350
+ /**
1351
+ * Generate a human-readable representation of a value.
1352
+ *
1353
+ * @param value - Value to inspect
1354
+ * @param key - The value's corresponding member name
1355
+ * @param options - Additional settings for refining output
1356
+ * @returns A string representation of `value`.
1357
+ */
1358
+ (value: any, key?: string | symbol, options?: InspectOptions): string;
1359
+ }
1360
+
1361
+ /**
1362
+ * Generate a human-readable representation of a value.
1363
+ *
1364
+ * @param value - Value to inspect
1365
+ * @param key - The value's corresponding member name
1366
+ * @param options - Additional settings for refining output
1367
+ * @returns A string representation of `value`.
1368
+ */
1369
+ declare var inspect: InspectFunction;
1370
+