Skip to content

Commit 1a4c264

Browse files
committed
update generated docs and yavascript.d.ts
1 parent 35dd2ba commit 1a4c264

22 files changed

Lines changed: 706 additions & 148 deletions

meta/generated-docs/ChildProcess.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,16 @@
2525

2626
# ChildProcess (interface)
2727

28-
A class which represents a child process. The process may or may not be running.
28+
A class which represents a child process. The process may or may not be
29+
running.
30+
31+
This class is the API used internally by the [exec](/meta/generated-docs/exec.md#exec-interface) function to spawn child
32+
processes.
33+
34+
Generally, you should not need to use the `ChildProcess` class directly, and
35+
should use [exec](/meta/generated-docs/exec.md#exec-interface) or [$](/meta/generated-docs/exec.md#-function) instead. However, you may need to use it in some
36+
special cases, like when specifying custom stdio for a process, or spawning a
37+
non-blocking long-running process.
2938

3039
```ts
3140
declare interface ChildProcess {

meta/generated-docs/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,3 +281,10 @@ For convenience, two builtin modules from QuickJS are also available as globals.
281281
[`Number.MAX_VALUE`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_VALUE
282282
[`Number.EPSILON`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/EPSILON
283283
[`BigFloatEnv.RNDNA`]: /meta/generated-docs/quickjs-extensions.md#bigfloatenvconstructorrndna-bigfloatroundingmode-property
284+
[`console.log`]: /meta/generated-docs/console.md#consolelog-method
285+
[`console.clear`]: /meta/generated-docs/console.md#consoleclear-method
286+
[`console.info`]: /meta/generated-docs/console.md#consoleinfo-method
287+
[`console.error`]: /meta/generated-docs/console.md#consoleerror-method
288+
[`console.warn`]: /meta/generated-docs/console.md#consolewarn-method
289+
[`BaseExecOptions`]: /meta/generated-docs/exec.md#baseexecoptions-type
290+
[`Path.normalize`]: /meta/generated-docs/path.md#pathnormalize-static-method

meta/generated-docs/assert.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,11 @@ Throws an error if `value` is not truthy.
3333
3434
## assert.type (function property)
3535
36-
Throws an error if `value` is not of the type `type`.
36+
Throws an error if its argument isn't the correct type.
3737
38-
`type` should be either a [TypeValidator](/meta/generated-docs/types.md#typevalidator-type), or a value which can be coerced into one via [types.coerce](/meta/generated-docs/types.md#typescoerce-function-property).
38+
- `@param` _value_ — The value to test the type of
39+
- `@param` _type_ — The type that `value` should be, as either a `TypeValidator` (from the `types.*` namespace) or a value which can be coerced into a `TypeValidator` via the `types.coerce` function, like `String`, `Boolean`, etc.
40+
- `@param` _message_ — An optional error message to use. If unspecified, a generic-but-descriptive message will be used.
3941
4042
```ts
4143
type: <T extends TypeValidator<any> | CoerceableToTypeValidator>(value: any, type: T, optionalMessage?: string) => asserts value is UnwrapTypeFromCoerceableOrValidator<T>;

meta/generated-docs/basename.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ Return the last component of a path string.
66

77
Provides the same functionality as the unix binary of the same name.
88

9+
> Example: `basename("/home/suchipi/something")` returns `"something"`, the last part.
10+
911
```ts
1012
declare function basename(path: string | Path): string;
1113
```

meta/generated-docs/cat.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@
99
Reads the contents of one or more files from disk as either one UTF-8 string
1010
or one ArrayBuffer.
1111

12+
Provides the same functionality as the unix binary of the same name.
13+
14+
> Example: If you have a file called `hi.txt` in the current working
15+
> directory, and it contains the text "hello", running `cat("hi.txt")`
16+
> returns `"hello"`.
17+
1218
```ts
1319
const cat: {
1420
(paths: string | Path | Array<string | Path>): string;

meta/generated-docs/cd.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# cd (function)
44

5-
Change the process's current working directory to the specified path. If no
5+
Changes the process's current working directory to the specified path. If no
66
path is specified, moves to the user's home directory.
77

88
Provides the same functionality as the shell builtin of the same name.

meta/generated-docs/chmod.md

Lines changed: 70 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,75 @@
1+
- [chmod (function)](#chmod-function)
12
- [ChmodPermissionsWho (type)](#chmodpermissionswho-type)
23
- [ChmodPermissionsWhat (type)](#chmodpermissionswhat-type)
3-
- [chmod (function)](#chmod-function)
4+
5+
# chmod (function)
6+
7+
Set the permission bits for the specified file.
8+
9+
- `@param` _permissions_ — The permission bits to set. This can be a number, a string
10+
containing an octal number, or an object.
11+
- `@param` _path_ — The path to the file.
12+
13+
Provides the same functionality as the unix binary of the same name.
14+
15+
The `permissions` argument can be either:
16+
17+
- a number (best expressed using octal, eg `0o655`)
18+
- a string (which will be interpreted as an octal number, eg `'777'`)
19+
- or an object (see below).
20+
21+
> NOTE: At this time there are no "add"/"remove" semantics; the existing
22+
> permissions will be completely overwritten with your specified permissions.
23+
> This will be changed later as this is not intuitive.
24+
25+
When permissions is an object, each of the object's own properties' keys must
26+
be one of these strings:
27+
28+
- `"user"`
29+
- `"group"`
30+
- `"others"`
31+
- `"all"` (meaning "user", "group", and "others")
32+
- `"u"` (alias for "user")
33+
- `"g"` (alias for "group")
34+
- `"o"` (alias for "others")
35+
- `"a"` (alias for "all")
36+
- `"ug"` ("user" plus "group")
37+
- `"go"` ("group" plus "others")
38+
- `"uo"` ("user" plus "others")
39+
40+
and their values must be one of these strings:
41+
42+
- `"read"` (permission to read the contents of the file)
43+
- `"write"` (permission to write to the file's contents)
44+
- `"execute"` (permission to run the file as an executable)
45+
- `"readwrite"` (both "read" and "write")
46+
- `"none"` (no permissions)
47+
- `"full"` ("read", "write", and "execute")
48+
- `"r"` (alias for "read")
49+
- `"w"` (alias for "write")
50+
- `"x"` (alias for "execute")
51+
- `"rw"` (alias for "readwrite")
52+
- `"rx"` ("read" and "execute")
53+
- `"wx"` ("write" and "execute")
54+
- `"rwx"` (alias for "full")
55+
56+
Some example objects:
57+
58+
```ts
59+
chmod({ user: "readwrite", group: "read", others: "none" });
60+
chmod({ ug: "rw", o: "w" });
61+
chmod({ all: "full" });
62+
```
63+
64+
```ts
65+
declare function chmod(
66+
permissions:
67+
| number
68+
| string
69+
| Record<ChmodPermissionsWho, ChmodPermissionsWhat>,
70+
path: string | Path
71+
): void;
72+
```
473

574
# ChmodPermissionsWho (type)
675

@@ -41,20 +110,3 @@ declare type ChmodPermissionsWhat =
41110
| "wx"
42111
| "rwx";
43112
```
44-
45-
# chmod (function)
46-
47-
Set the permission bits for the specified file.
48-
49-
- `@param` _permissions_ — The permission bits to set. This can be a number, a string containing an octal number, or an object.
50-
- `@param` _path_ — The path to the file.
51-
52-
```ts
53-
declare function chmod(
54-
permissions:
55-
| number
56-
| string
57-
| Record<ChmodPermissionsWho, ChmodPermissionsWhat>,
58-
path: string | Path
59-
): void;
60-
```

meta/generated-docs/console.md

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@
99

1010
# clear (function)
1111

12-
Clear the contents and scrollback buffer of the tty by printing special characters into stdout.
12+
Prints special ANSI escape characters to stdout which instruct your terminal
13+
emulator to clear the screen and clear your terminal scrollback.
14+
15+
Identical to [console.clear](/meta/generated-docs/console.md#consoleclear-method).
1316

1417
```ts
1518
declare function clear(): void;
@@ -29,39 +32,68 @@ interface Console {
2932

3033
## Console.log (method)
3134

32-
Writes to stdout, with newline appended.
35+
Logs its arguments to stdout, with a newline appended.
36+
37+
Any value can be logged, not just strings. Non-string values will be
38+
formatted using [inspect](/meta/generated-docs/inspect.md#inspect-inspectfunction).
39+
40+
Functionally identical to [console.info](/meta/generated-docs/console.md#consoleinfo-method), [echo](/meta/generated-docs/echo.md#echo-value), and
41+
[print](/meta/generated-docs/print.md#print-function). Contrast with [console.error](/meta/generated-docs/console.md#consoleerror-method), which prints to stderr
42+
instead of stdout.
3343

3444
```ts
3545
log(message?: any, ...optionalParams: any[]): void;
3646
```
3747

3848
## Console.info (method)
3949

40-
Writes to stdout, with newline appended.
50+
Logs its arguments to stdout, with a newline appended.
51+
52+
Any value can be logged, not just strings. Non-string values will be
53+
formatted using [inspect](/meta/generated-docs/inspect.md#inspect-inspectfunction).
54+
55+
Functionally identical to [console.log](/meta/generated-docs/console.md#consolelog-method), [echo](/meta/generated-docs/echo.md#echo-value), and
56+
[print](/meta/generated-docs/print.md#print-function). Contrast with [console.error](/meta/generated-docs/console.md#consoleerror-method), which prints to stderr
57+
instead of stdout.
4158

4259
```ts
4360
info(message?: any, ...optionalParams: any[]): void;
4461
```
4562

4663
## Console.warn (method)
4764

48-
Writes to stderr, with newline appended.
65+
Logs its arguments to stderr, with a newline appended.
66+
67+
Any value can be logged, not just strings. Non-string values will be
68+
formatted using [inspect](/meta/generated-docs/inspect.md#inspect-inspectfunction).
69+
70+
Functionally identical to [console.error](/meta/generated-docs/console.md#consoleerror-method). Contrast with
71+
[console.log](/meta/generated-docs/console.md#consolelog-method), which prints to stdout instead of stderr.
4972

5073
```ts
5174
warn(message?: any, ...optionalParams: any[]): void;
5275
```
5376

5477
## Console.error (method)
5578

56-
Writes to stderr, with newline appended.
79+
Logs its arguments to stderr, with a newline appended.
80+
81+
Any value can be logged, not just strings. Non-string values will be
82+
formatted using [inspect](/meta/generated-docs/inspect.md#inspect-inspectfunction).
83+
84+
Functionally identical to [console.warn](/meta/generated-docs/console.md#consolewarn-method). Contrast with
85+
[console.log](/meta/generated-docs/console.md#consolelog-method), which prints to stdout instead of stderr.
5786

5887
```ts
5988
error(message?: any, ...optionalParams: any[]): void;
6089
```
6190

6291
## Console.clear (method)
6392

64-
Same as [clear](/meta/generated-docs/console.md#clear-function)().
93+
Prints special ANSI escape characters to stdout which instruct your terminal
94+
emulator to clear the screen and clear your terminal scrollback.
95+
96+
Identical to [clear](/meta/generated-docs/console.md#clear-function).
6597

6698
```ts
6799
clear(): void;

meta/generated-docs/csv.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@
44

55
# CSV (object)
66

7+
Serializes or deserializes CSV data.
8+
9+
The `CSV` object contains a `parse` function and a `stringify` function which
10+
can be used to parse strings of CSV (comma-separated values) data into
11+
arrays-of-arrays-of-strings and serialize arrays-of-arrays-of-strings into
12+
strings of CSV data.
13+
14+
Its interface is similar to `JSON.parse` and `JSON.stringify`, but CSV does
15+
not support the spacing/replacer/reviver options that `JSON.parse` and
16+
`JSON.stringify` have.
17+
718
```ts
819
const CSV: {
920
parse(input: string): Array<Array<string>>;

meta/generated-docs/dirname.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ Removes the final component from a path string.
66

77
Provides the same functionality as the unix binary of the same name.
88

9+
> Example: `dirname("/home/suchipi/something")` returns
10+
> `"/home/suchipi"`, everything except the last part.
11+
912
```ts
1013
declare function dirname(path: string | Path): Path;
1114
```

0 commit comments

Comments
 (0)