yavascript 0.0.3 → 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/bin/darwin/yavascript +0 -0
- package/bin/darwin-arm/yavascript +0 -0
- package/bin/linux/yavascript +0 -0
- package/bin/windows/yavascript.exe +0 -0
- package/package.json +1 -1
- package/yavascript.d.ts +409 -70
package/bin/darwin/yavascript
CHANGED
|
Binary file
|
|
Binary file
|
package/bin/linux/yavascript
CHANGED
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
package/yavascript.d.ts
CHANGED
|
@@ -3,11 +3,9 @@
|
|
|
3
3
|
// YavaScript APIs
|
|
4
4
|
// ---------------
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
/** The name of the directory the current file is inside of. */
|
|
10
|
-
declare const __dirname: string;
|
|
6
|
+
// -----------
|
|
7
|
+
// --- env ---
|
|
8
|
+
// -----------
|
|
11
9
|
|
|
12
10
|
/**
|
|
13
11
|
* An object representing the process's environment variables. You can read
|
|
@@ -17,6 +15,10 @@ declare const __dirname: string;
|
|
|
17
15
|
*/
|
|
18
16
|
declare const env: { [key: string]: string | undefined };
|
|
19
17
|
|
|
18
|
+
// ------------
|
|
19
|
+
// --- exec ---
|
|
20
|
+
// ------------
|
|
21
|
+
|
|
20
22
|
type BaseExecOptions = {
|
|
21
23
|
/** Sets the current working directory for the child process. */
|
|
22
24
|
cwd?: string;
|
|
@@ -26,12 +28,12 @@ type BaseExecOptions = {
|
|
|
26
28
|
};
|
|
27
29
|
|
|
28
30
|
interface Exec {
|
|
29
|
-
(args: Array<string>): void;
|
|
31
|
+
(args: Array<string> | string): void;
|
|
30
32
|
|
|
31
|
-
(args: Array<string
|
|
33
|
+
(args: Array<string> | string, options: Record<string, never>): void;
|
|
32
34
|
|
|
33
35
|
(
|
|
34
|
-
args: Array<string
|
|
36
|
+
args: Array<string> | string,
|
|
35
37
|
options: BaseExecOptions & {
|
|
36
38
|
/**
|
|
37
39
|
* Whether an Error should be thrown when the process exits with a nonzero
|
|
@@ -51,7 +53,7 @@ interface Exec {
|
|
|
51
53
|
): void;
|
|
52
54
|
|
|
53
55
|
(
|
|
54
|
-
args: Array<string
|
|
56
|
+
args: Array<string> | string,
|
|
55
57
|
options: BaseExecOptions & {
|
|
56
58
|
/**
|
|
57
59
|
* Whether an Error should be thrown when the process exits with a nonzero
|
|
@@ -71,7 +73,7 @@ interface Exec {
|
|
|
71
73
|
): { status: number };
|
|
72
74
|
|
|
73
75
|
(
|
|
74
|
-
args: Array<string
|
|
76
|
+
args: Array<string> | string,
|
|
75
77
|
options: BaseExecOptions & {
|
|
76
78
|
/**
|
|
77
79
|
* Whether an Error should be thrown when the process exits with a nonzero
|
|
@@ -84,7 +86,7 @@ interface Exec {
|
|
|
84
86
|
): { status: number };
|
|
85
87
|
|
|
86
88
|
(
|
|
87
|
-
args: Array<string
|
|
89
|
+
args: Array<string> | string,
|
|
88
90
|
options: BaseExecOptions & {
|
|
89
91
|
/**
|
|
90
92
|
* Whether an Error should be thrown when the process exits with a nonzero
|
|
@@ -104,7 +106,7 @@ interface Exec {
|
|
|
104
106
|
): { stdout: string; stderr: string };
|
|
105
107
|
|
|
106
108
|
(
|
|
107
|
-
args: Array<string
|
|
109
|
+
args: Array<string> | string,
|
|
108
110
|
options: BaseExecOptions & {
|
|
109
111
|
/**
|
|
110
112
|
* If true, stdout and stderr will be collected into strings and returned
|
|
@@ -117,7 +119,7 @@ interface Exec {
|
|
|
117
119
|
): { stdout: string; stderr: string };
|
|
118
120
|
|
|
119
121
|
(
|
|
120
|
-
args: Array<string
|
|
122
|
+
args: Array<string> | string,
|
|
121
123
|
options: BaseExecOptions & {
|
|
122
124
|
/**
|
|
123
125
|
* Whether an Error should be thrown when the process exits with a nonzero
|
|
@@ -129,82 +131,162 @@ interface Exec {
|
|
|
129
131
|
captureOutput: true;
|
|
130
132
|
}
|
|
131
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;
|
|
132
137
|
}
|
|
133
138
|
|
|
134
139
|
/** Run a child process using the provided arguments. The first value in the arguments array is the program to run. */
|
|
135
140
|
declare const exec: Exec;
|
|
136
141
|
|
|
137
142
|
/** Alias for `exec(args, { captureOutput: true })` */
|
|
138
|
-
declare function $(args: Array<string>): {
|
|
143
|
+
declare function $(args: Array<string> | string): {
|
|
139
144
|
stdout: string;
|
|
140
145
|
stderr: string;
|
|
141
146
|
};
|
|
142
147
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
/** Write the contents of a string or ArrayBuffer to a file. */
|
|
147
|
-
declare function writeFile(path: string, data: string | ArrayBuffer): void;
|
|
148
|
-
|
|
149
|
-
/** Returns true if the path points to a directory, or if the path points to a symlink which points to a directory. */
|
|
150
|
-
declare function isDir(path: string): boolean;
|
|
151
|
-
|
|
152
|
-
/** Delete the file or directory at the specified path. If the directory isn't empty, its contents will be deleted, too. */
|
|
153
|
-
declare function remove(path: string): void;
|
|
154
|
-
|
|
155
|
-
/** Returns true if a file or directory exists at the specified path. */
|
|
156
|
-
declare function exists(path: string): boolean;
|
|
148
|
+
// -------------
|
|
149
|
+
// --- paths ---
|
|
150
|
+
// -------------
|
|
157
151
|
|
|
158
|
-
/**
|
|
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
|
+
*/
|
|
159
157
|
declare function cd(path: string): void;
|
|
160
158
|
|
|
161
|
-
/**
|
|
159
|
+
/**
|
|
160
|
+
* Return the process's current working directory.
|
|
161
|
+
*
|
|
162
|
+
* Provides the same functionality as the shell builtin of the same name.
|
|
163
|
+
*/
|
|
162
164
|
declare function pwd(): string;
|
|
163
165
|
|
|
164
|
-
/**
|
|
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
|
+
*/
|
|
165
180
|
declare function dirname(path: string): string;
|
|
166
181
|
|
|
167
182
|
/**
|
|
168
|
-
*
|
|
169
|
-
*
|
|
170
|
-
*
|
|
183
|
+
* Return the last component of a path string.
|
|
184
|
+
*
|
|
185
|
+
* Provides the same functionality as the unix binary of the same name.
|
|
171
186
|
*/
|
|
172
|
-
declare
|
|
187
|
+
declare function basename(path: string): string;
|
|
173
188
|
|
|
174
189
|
/**
|
|
175
|
-
*
|
|
176
|
-
*
|
|
177
|
-
*
|
|
178
|
-
* or backslashes that do not match the requested path separator character
|
|
179
|
-
* (which defaults to {@link OS_PATH_SEPARATOR}) will be converted to the
|
|
180
|
-
* requested path separator. If multiple strings are passed, they will be
|
|
181
|
-
* joined together using the requested path separator.
|
|
182
|
-
*
|
|
183
|
-
* This function does not resolve `..` or `.`. Use {@link realpath} for that.
|
|
184
|
-
*
|
|
185
|
-
* To request a path separator other than {@link OS_PATH_SEPARATOR}, pass an
|
|
186
|
-
* object like `{ separator: "/" }` as the final argument to `makePath`.
|
|
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.
|
|
187
193
|
*
|
|
188
|
-
*
|
|
189
|
-
* the returned path string.
|
|
194
|
+
* Pass `{ full: true }` to get compound extensions, eg `.d.ts` or `.test.js` instead of just `.ts`/`.js`.
|
|
190
195
|
*/
|
|
191
|
-
declare function
|
|
192
|
-
|
|
196
|
+
declare function extname(
|
|
197
|
+
pathOrFilename: string,
|
|
198
|
+
options?: { full?: boolean }
|
|
193
199
|
): string;
|
|
194
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
|
+
|
|
195
272
|
/**
|
|
196
273
|
* Returns the absolute path to the root folder of the git/hg repo.
|
|
197
|
-
*
|
|
274
|
+
*
|
|
198
275
|
* This is done by running `git rev-parse --show-toplevel` and `hg root`.
|
|
199
|
-
*
|
|
200
|
-
* If `relativeTo` is provided, the git and hg commands will be executed in
|
|
276
|
+
*
|
|
277
|
+
* If `relativeTo` is provided, the git and hg commands will be executed in
|
|
278
|
+
* that folder instead of in `pwd()`.
|
|
201
279
|
*/
|
|
202
280
|
declare function repoRoot(relativeTo?: string): string;
|
|
203
281
|
|
|
204
282
|
/**
|
|
205
283
|
* Returns whether the provided path is ignored by git.
|
|
206
284
|
*/
|
|
207
|
-
declare function isGitignored(path: string): boolean
|
|
285
|
+
declare function isGitignored(path: string): boolean;
|
|
286
|
+
|
|
287
|
+
// ------------------
|
|
288
|
+
// --- filesystem ---
|
|
289
|
+
// ------------------
|
|
208
290
|
|
|
209
291
|
/**
|
|
210
292
|
* Return the contents of a directory, as absolute paths. `.` and `..` are
|
|
@@ -218,33 +300,176 @@ declare function ls(
|
|
|
218
300
|
options?: { relativePaths?: boolean }
|
|
219
301
|
): Array<string>;
|
|
220
302
|
|
|
221
|
-
/**
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
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
|
+
*/
|
|
225
310
|
declare function readlink(path: string): string;
|
|
226
311
|
|
|
227
312
|
/**
|
|
228
|
-
*
|
|
313
|
+
* Read the contents of a file from disk, as a UTF-8 string.
|
|
314
|
+
*/
|
|
315
|
+
declare function readFile(path: string): string;
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* Write the contents of a string or ArrayBuffer to a file.
|
|
319
|
+
*
|
|
320
|
+
* Strings are written using the UTF-8 encoding.
|
|
321
|
+
*/
|
|
322
|
+
declare function writeFile(path: string, data: string | ArrayBuffer): void;
|
|
323
|
+
|
|
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;
|
|
335
|
+
|
|
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
|
+
*/
|
|
361
|
+
declare function remove(path: string): void;
|
|
362
|
+
|
|
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
|
+
*/
|
|
368
|
+
declare function exists(path: string): boolean;
|
|
369
|
+
|
|
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;
|
|
377
|
+
|
|
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
|
+
};
|
|
402
|
+
|
|
403
|
+
/**
|
|
404
|
+
* Copy a file or folder from one location to another.
|
|
405
|
+
* Folders are copied recursively.
|
|
406
|
+
*
|
|
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.
|
|
229
442
|
*
|
|
230
|
-
*
|
|
443
|
+
* Uses [minimatch](https://www.npmjs.com/package/minimatch) with its default
|
|
444
|
+
* options.
|
|
231
445
|
*/
|
|
232
446
|
declare function glob(
|
|
233
447
|
dir: string,
|
|
234
448
|
patterns: Array<string>,
|
|
235
|
-
options?:
|
|
449
|
+
options?: GlobOptions
|
|
236
450
|
): Array<string>;
|
|
237
451
|
|
|
238
|
-
|
|
452
|
+
// ---------------
|
|
453
|
+
// --- console ---
|
|
454
|
+
// ---------------
|
|
455
|
+
|
|
456
|
+
/**
|
|
457
|
+
* Print one or more values to stdout.
|
|
458
|
+
*/
|
|
239
459
|
declare const echo: typeof console.log;
|
|
240
460
|
|
|
241
|
-
|
|
242
|
-
|
|
461
|
+
// ---------------
|
|
462
|
+
// --- strings ---
|
|
463
|
+
// ---------------
|
|
243
464
|
|
|
244
|
-
/**
|
|
465
|
+
/**
|
|
466
|
+
* Remove ANSI control characters from a string.
|
|
467
|
+
*/
|
|
245
468
|
declare function stripAnsi(input: string): string;
|
|
246
469
|
|
|
247
|
-
/**
|
|
470
|
+
/**
|
|
471
|
+
* Wrap a string in double quotes, and escape any double-quotes inside using `\"`.
|
|
472
|
+
*/
|
|
248
473
|
declare function quote(input: string): string;
|
|
249
474
|
|
|
250
475
|
// Colors
|
|
@@ -333,6 +558,15 @@ declare var print: (...args: Array<any>) => void;
|
|
|
333
558
|
declare var console: {
|
|
334
559
|
/** Same as {@link print}(). */
|
|
335
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;
|
|
336
570
|
};
|
|
337
571
|
|
|
338
572
|
declare module "std" {
|
|
@@ -385,9 +619,9 @@ declare module "std" {
|
|
|
385
619
|
|
|
386
620
|
/**
|
|
387
621
|
* Read the script of module filename from an active stack frame, then return it as a string.
|
|
388
|
-
*
|
|
622
|
+
*
|
|
389
623
|
* If there isn't a valid filename for the specified stack frame, an error will be thrown.
|
|
390
|
-
*
|
|
624
|
+
*
|
|
391
625
|
* @param stackLevels - How many levels up the stack to search for a filename. Defaults to 0, which uses the current stack frame.
|
|
392
626
|
*/
|
|
393
627
|
export function getFileNameFromStack(stackLevels: number): string;
|
|
@@ -638,7 +872,7 @@ declare module "std" {
|
|
|
638
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. */
|
|
639
873
|
read(buffer: ArrayBuffer, position: number, length: number): number;
|
|
640
874
|
|
|
641
|
-
/** Write `length` bytes from the
|
|
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. */
|
|
642
876
|
write(buffer: ArrayBuffer, position: number, length: number): number;
|
|
643
877
|
|
|
644
878
|
/** Return the next line from the file, assuming UTF-8 encoding, excluding the trailing line feed. */
|
|
@@ -1029,3 +1263,108 @@ declare module "os" {
|
|
|
1029
1263
|
export function access(path: string, accessMode: number): void;
|
|
1030
1264
|
}
|
|
1031
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
|
+
|