yavascript 0.0.6 → 0.0.7

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 CHANGED
@@ -1,35 +1,79 @@
1
1
  # yavascript
2
2
 
3
- YavaScript is a bash-like script runner which is distributed as a single
4
- statically-linked binary. Scripts are written in JavaScript or CoffeeScript.
5
- There are global APIs available for all the things you'd normally want to do in
3
+ YavaScript is a cross-platform bash-like script runner and repl which is distributed as a single
4
+ statically-linked binary. Scripts can be written in JavaScript, TypeScript, JSX/TSX, or CoffeeScript.
5
+
6
+ There are APIs available for all the things you'd normally want to do in
6
7
  a bash script, such as:
7
8
 
8
- - Running programs
9
- - Accessing environment variables
10
- - Reading and writing file contents
9
+ - Running programs and getting their stdout/stderr/status
10
+ - Reading/writing environment variables
11
11
  - Checking if files/folders exist
12
- - Removing files/folders
12
+ - Removing/creating/copying files/folders
13
13
  - Reading and changing the current working directory
14
+ - Reading and resolving symbolic links
14
15
  - Using globs to get large lists of files
15
- - Printing stylized text to the terminal
16
+ - Printing stylized text
17
+ - Clearing the terminal
18
+ - Fetching files from the internet
16
19
 
17
- Additionally, since it's JavaScript, you get some other features that are
18
- either not present in bash or are cumbersome to use in bash, namely:
20
+ Additionally, you can do other things that are either not present in bash or are cumbersome to use in bash, namely:
19
21
 
20
- - Arrays (lists) and Objects (key/value dictionaries)
21
- - Working with path strings
22
- - Working with JSON
22
+ - Serialize and deserialize JSON, CSV, and YAML
23
+ - Removing ANSI control characters from a string
24
+ - Split path strings into a list of segments and rejoin them into a string
25
+ - Check if a path is absolute and resolve relative paths
26
+ - Parse command-line flags
27
+ - Work with Arrays (lists)
28
+ - Work with Objects (key/value dictionaries)
29
+ - Work with Typed Arrays (byte buffers)
30
+ - Reliably get the path to the currently-running file
31
+ - Strongly-typed interfaces and functions (via TypeScript)
23
32
  - Cross-file import/export using ECMAScript Modules
24
- - Splitting strings on delimeters
25
- - Pretty-printing of objects
26
- - Getting the path to the currently-running script (via import.meta.url or `__filename`)
27
- - Getting the absolute path to the root folder of the current git/mercurial repo (repoRoot function)
33
+ - Split strings on delimeters
34
+ - Pretty-print complex structures
35
+ - Call low-level POSIX C APIs like fputs, sprintf, isatty
36
+ - Perform work in threads
37
+
38
+ You'll also find analogues to familiar CLI tools, like:
39
+
40
+ - dirname
41
+ - basename
42
+ - cat
43
+ - ls
44
+ - realpath
45
+ - readlink
46
+
47
+ ...and more.
28
48
 
29
49
  To view the APIs, consult the file yavascript.d.ts which was distributed with
30
50
  this program, or online at https://github.com/suchipi/yavascript/blob/main/yavascript.d.ts.
31
51
  This file contains TypeScript type definitions which can be given to your IDE
32
- to assist you when writing scripts.
52
+ to assist you when writing scripts, even if you aren't writing your scripts in TypeScript.
53
+
54
+ Here's an example of a script using YavaScript:
55
+
56
+ ```js
57
+ #!/usr/bin/env yavascript
58
+
59
+ // This comment is optional; it tells VS Code to load the specified TypeScript definitions.
60
+ /// <reference path="./yavascript.d.ts" />
61
+
62
+ let isWorkingTreeDirty;
63
+ try {
64
+ exec(`git diff --quiet`);
65
+ isWorkingTreeDirty = false;
66
+ } catch (error) {
67
+ isWorkingTreeDirty = true;
68
+ }
69
+
70
+ const branchName = $(`git rev-parse --abbrev-ref HEAD`).stdout.trim();
71
+
72
+ const gitInfo = { branchName, isWorkingTreeDirty };
73
+ echo(gitInfo);
74
+
75
+ writeFile("git-info.yml", YAML.stringify(gitInfo));
76
+ ```
33
77
 
34
78
  YavaScript is powered by a fork of the QuickJS JavaScript Engine, originally
35
79
  written by Fabrice Bellard. QuickJS is a small, fast JavaScript engine
@@ -42,7 +86,11 @@ supporting the ES2020 specification.
42
86
 
43
87
  ### Binaries (all platforms)
44
88
 
45
- You will need docker installed, then run `./scripts/build.sh`.
89
+ You will need docker installed, then run `meta/docker/build-all.sh`.
90
+
91
+ ### Binaries (just for your machine)
92
+
93
+ You will need node.js and ninja installed, then run `meta/build.sh`.
46
94
 
47
95
  ### Docker image
48
96
 
Binary file
Binary file
Binary file
Binary file
@@ -1,30 +1,33 @@
1
1
  var path = require("path");
2
2
 
3
- var binaryPath;
4
- if (process.platform === "win32") {
5
- binaryPath = path.resolve(
6
- __dirname,
7
- "..",
8
- "bin",
9
- "windows",
10
- "yavascript.exe"
11
- );
12
- } else if (process.platform === "darwin") {
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");
3
+ var binDir = path.resolve(__dirname, "..", "bin");
4
+
5
+ function getBinaryPath(platformAndArch) {
6
+ switch (platformAndArch) {
7
+ case "darwin-arm64": {
8
+ return path.join(binDir, "darwin-arm64", "yavascript");
9
+ }
10
+ case "darwin-x64": {
11
+ return path.join(binDir, "darwin-x86_64", "yavascript");
12
+ }
13
+ case "linux-arm64": {
14
+ return path.join(binDir, "linux-aarch64", "yavascript");
15
+ }
16
+ case "linux-x64": {
17
+ return path.join(binDir, "linux-amd64", "yavascript");
18
+ }
19
+ case "win32-x64": {
20
+ return path.join(binDir, "windows-x86_64", "yavascript.exe");
21
+ }
22
+ default: {
23
+ throw new Error("Unsupported platform: " + platformAndArch);
24
+ }
23
25
  }
24
- } else if (process.platform === "linux") {
25
- binaryPath = path.resolve(__dirname, "..", "bin", "linux", "yavascript");
26
- } else {
27
- throw new Error("Unsupported platform: " + process.platform);
28
26
  }
29
27
 
30
- module.exports = binaryPath;
28
+ var binaryPath = getBinaryPath(process.platform + "-" + process.arch);
29
+
30
+ module.exports = {
31
+ getBinaryPath: getBinaryPath,
32
+ binaryPath: binaryPath,
33
+ };
package/lib/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  var child_process = require("child_process");
3
- var binaryPath = require("./binary-path");
3
+ var binaryPath = require("./binary-path").binaryPath;
4
4
 
5
5
  try {
6
6
  child_process.execFileSync(binaryPath, process.argv.slice(2), {
package/lib/index.js CHANGED
@@ -1,7 +1,9 @@
1
- const binaryPath = require("./binary-path");
2
- const version = require("./package.json").version;
1
+ var getBinaryPath = require("./binary-path").getBinaryPath;
2
+ var binaryPath = require("./binary-path").binaryPath;
3
+ var version = require("../package.json").version;
3
4
 
4
5
  module.exports = {
6
+ getBinaryPath,
5
7
  binaryPath,
6
8
  version,
7
9
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yavascript",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "main": "lib/index.js",
5
5
  "bin": "lib/cli.js",
6
6
  "types": "yavascript.d.ts",
package/yavascript.d.ts CHANGED
@@ -12,25 +12,86 @@
12
12
  declare const env: { [key: string]: string | undefined };
13
13
 
14
14
  /**
15
- * Return the contents of a directory, as absolute paths. `.` and `..` are
16
- * omitted.
15
+ * Parse command line --flags into an object of flags and an array of
16
+ * positional arguments. This function is opinionated; if it doesn't meet your
17
+ * needs, you can parse the `scriptArgs` global manually.
17
18
  *
18
- * Use the `relativePaths` option to get relative paths instead (relative to
19
- * the parent directory).
20
- */
21
- declare function ls(
22
- dir?: string,
23
- options?: { relativePaths?: boolean }
24
- ): Array<string>;
25
-
26
- /**
27
- * Read a symlink.
19
+ * Flags `--like-this`, `--like_this`, or `--LIKE_THIS` get converted into
20
+ * property names `likeThis` on the returned flags object.
28
21
  *
29
- * Returns the target of the symlink, which may be absolute or relative.
22
+ * Flags like this: `-v` get converted into into property names like this: `v`
23
+ * on the returned flags object.
30
24
  *
31
- * Provides the same functionality as the unix binary of the same name.
25
+ * Anything that appears after `--` is considered a positional argument instead
26
+ * of a flag. `--` is not present in the returned positional arguments Array.
27
+ *
28
+ * Single-character flags must have a single leading dash, and multi-character
29
+ * flags must have two leading dashes.
30
+ *
31
+ * Flags with equals signs in them (eg. `--something=42`) are not supported.
32
+ * Write `--something 42` instead.
33
+ *
34
+ * Flags where you specify them multiple times, like `-vvv`, are not supported.
35
+ * Write something like `-v 3` instead.
36
+ *
37
+ * @param hints - An object whose keys are flag names (in camelCase) and whose values indicate what type to treat that flag as. Valid property values are `String`, `Boolean`, `Number`, and `parseScriptArgs.Path`. `parseScriptArgs.Path` will resolve relative paths into absolute paths for you. If no hints object is specified, `parseScriptArgs` will do its best to guess, based on the command-line args.
38
+ * @param argv - An array containing the command line flags you want to parse. If unspecified, `scriptArgs.slice(2)` will be used (we slice 2 in order to skip the yavascript binary and script name). If you pass in an array here, it should only contain command-line flags, not the binary being called.
39
+ *
40
+ * @returns An object with two properties: `flags` and `args`. `flags` is an object whose keys are camelCase flag names and whose values are strings, booleans, or numbers corresponding to the input command-line args. `args` is an Array of positional arguments, as found on the command-line.
32
41
  */
33
- declare function readlink(path: string): string;
42
+ declare const parseScriptArgs: {
43
+ /**
44
+ * Parse command line --flags into an object of flags and an array of
45
+ * positional arguments. This function is opinionated; if it doesn't meet your
46
+ * needs, you can parse the `scriptArgs` global manually.
47
+ *
48
+ * Flags `--like-this`, `--like_this`, or `--LIKE_THIS` get converted into
49
+ * property names `likeThis` on the returned flags object.
50
+ *
51
+ * Flags like this: `-v` get converted into into property names like this: `v`
52
+ * on the returned flags object.
53
+ *
54
+ * Anything that appears after `--` is considered a positional argument instead
55
+ * of a flag. `--` is not present in the returned positional arguments Array.
56
+ *
57
+ * Single-character flags must have a single leading dash, and multi-character
58
+ * flags must have two leading dashes.
59
+ *
60
+ * Flags with equals signs in them (eg. `--something=42`) are not supported.
61
+ * Write `--something 42` instead.
62
+ *
63
+ * Flags where you specify them multiple times, like `-vvv`, are not supported.
64
+ * Write something like `-v 3` instead.
65
+ *
66
+ * @param hints - An object whose keys are flag names (in camelCase) and whose values indicate what type to treat that flag as. Valid property values are `String`, `Boolean`, `Number`, and `parseScriptArgs.Path`. `parseScriptArgs.Path` will resolve relative paths into absolute paths for you. If no hints object is specified, `parseScriptArgs` will do its best to guess, based on the command-line args.
67
+ * @param args - An array containing the command line flags you want to parse. If unspecified, `scriptArgs.slice(2)` will be used (we slice 2 in order to skip the yavascript binary and script name). If you pass in an array here, it should only contain command-line flags, not the binary being called.
68
+ *
69
+ * @returns An object with two properties: `flags` and `args`. `flags` is an object whose keys are camelCase flag names and whose values are strings, booleans, or numbers corresponding to the input command-line args. `args` is an Array of positional arguments, as found on the command-line.
70
+ */
71
+ (
72
+ hints?: {
73
+ [key: string]:
74
+ | typeof String
75
+ | typeof Boolean
76
+ | typeof Number
77
+ | typeof parseScriptArgs["Path"];
78
+ },
79
+ args?: Array<string>
80
+ ): {
81
+ flags: { [key: string]: any };
82
+ args: Array<string>;
83
+ };
84
+
85
+ /**
86
+ * A hint value for {@link parseScriptArgs}. Behaves similar to the hint value
87
+ * `String`, except that it also resolves relative paths into absolute paths,
88
+ * using the following rules:
89
+ *
90
+ * - paths `./like/this` or `../like/this` get resolved relative to `pwd()`.
91
+ * - paths `like/this` or `this` get resolved relative to `pwd()` as if they had a leading `./`.
92
+ */
93
+ readonly Path: unique symbol;
94
+ };
34
95
 
35
96
  /**
36
97
  * Read the contents of a file from disk, as a UTF-8 string.
@@ -131,28 +192,191 @@ declare type CopyOptions = {
131
192
  */
132
193
  declare function copy(from: string, to: string, options?: CopyOptions): void;
133
194
 
195
+ /** An object that represents a filesystem path. */
196
+ declare class Path {
197
+ /** The character used to separate path segments on this OS. */
198
+ static readonly OS_SEGMENT_SEPARATOR: "/" | "\\";
199
+
200
+ /**
201
+ * The character used to separate entries within the PATH environment
202
+ * variable on this OS.
203
+ */
204
+ static readonly OS_ENV_VAR_SEPARATOR: ":" | ";";
205
+
206
+ /** Split one or more path strings into an array of path segments. */
207
+ static splitToSegments(inputParts: Array<string> | string): Array<string>;
208
+
209
+ /**
210
+ * Search the provided path string or strings for a path separator character,
211
+ * and return it. If none is found, return `fallback`, which defaults to the
212
+ * OS's path segment separator.
213
+ */
214
+ static detectSeparator<Fallback extends string | null = string>(
215
+ input: Array<string> | string,
216
+ // @ts-ignore might be instantiated with a different subtype
217
+ fallback: Fallback = Path.OS_SEGMENT_SEPARATOR
218
+ ): string | Fallback;
219
+
220
+ /** Join together one or more paths. */
221
+ static join(...inputs: Array<string | Path | Array<string | Path>>): string;
222
+
223
+ /**
224
+ * Turns the input path(s) into an absolute path by resolving all `.` and `..`
225
+ * segments, using `pwd()` as a base dir to use when resolving leading `.` or
226
+ * `..` segments.
227
+ */
228
+ static resolve(
229
+ ...inputs: Array<string | Path | Array<string | Path>>
230
+ ): string;
231
+
232
+ /**
233
+ * Concatenates the input path(s) and then resolves all non-leading `.` and
234
+ * `..` segments.
235
+ */
236
+ static normalize(
237
+ ...inputs: Array<string | Path | Array<string | Path>>
238
+ ): string;
239
+
240
+ /**
241
+ * Return whether the provided path string is absolute; that is, whether it
242
+ * starts with either `/` or a drive letter (ie `C:`).
243
+ */
244
+ static isAbsolute(path: string): boolean;
245
+
246
+ /**
247
+ * An array of the path segments that make up this path.
248
+ *
249
+ * For `/tmp/foo.txt`, it'd be `["", "tmp", "foo.txt"]`.
250
+ *
251
+ * For `C:\something\somewhere.txt`, it'd be `["C:", "something", "somewhere.txt"]`.
252
+ */
253
+ segments: Array<string>;
254
+
255
+ /**
256
+ * The path separator that should be used to turn this path into a string.
257
+ *
258
+ * Will be either `/` or `\`.
259
+ */
260
+ separator: string;
261
+
262
+ /** Create a new Path object using the provided input(s). */
263
+ constructor(...inputs: Array<string | Path | Array<string | Path>>);
264
+
265
+ /** Create a new Path object using the provided segments and separator. */
266
+ static from(segments: Array<string>, separator: string): Path;
267
+
268
+ /**
269
+ * Turn this path into an absolute path by resolving all `.` and `..`
270
+ * segments, using `from` as a base dir to use when resolving leading `.` or
271
+ * `..` segments.
272
+ *
273
+ * If `from` is unspecified, it defaults to `pwd()`.
274
+ */
275
+ resolve(from?: string | Path): Path;
276
+
277
+ /**
278
+ * Resolve all non-leading `.` and `..` segments in this path.
279
+ */
280
+ normalize(): Path;
281
+
282
+ /**
283
+ * Create a new path by appending another path's segments after this path's
284
+ * segments.
285
+ *
286
+ * The returned path will use this path's separator.
287
+ */
288
+ concat(other: string | Path | Array<string | Path>): Path;
289
+
290
+ /**
291
+ * Return whether this path is absolute; that is, whether it starts with
292
+ * either `/` or a drive letter (ie `C:`).
293
+ */
294
+ isAbsolute(): boolean;
295
+
296
+ /**
297
+ * Turn this path into a string by joining its segments using its separator.
298
+ */
299
+ toString(): string;
300
+ }
301
+
134
302
  /**
135
- * Change the process's current working directory to the specified path.
303
+ * The absolute path to the current file (whether script or module).
136
304
  *
137
- * Provides the same functionality as the shell builtin of the same name.
305
+ * Behaves the same as in Node.js, except that it's present within ES modules.
138
306
  */
139
- declare function cd(path: string): void;
307
+ declare const __filename: string;
140
308
 
141
309
  /**
142
- * Return the process's current working directory.
310
+ * The absolute path to the directory the current file is inside of.
143
311
  *
144
- * Provides the same functionality as the shell builtin of the same name.
312
+ * Behaves the same as in Node.js, except that it's present within ES modules.
145
313
  */
146
- declare function pwd(): string;
314
+ declare const __dirname: string;
147
315
 
148
316
  /**
149
- * Get the absolute path given a relative path. Symlinks are also resolved.
150
- *
151
- * The path's target file/directory must exist.
317
+ * Return the last component of a path string.
152
318
  *
153
319
  * Provides the same functionality as the unix binary of the same name.
154
320
  */
155
- declare function realpath(path: string): string;
321
+ declare function basename(path: string): string;
322
+
323
+ /**
324
+ * Read the contents of one of more files from disk as one UTF-8 string,
325
+ * print that string to stdout, then return it.
326
+ */
327
+ declare function cat(...paths: Array<string>): string;
328
+
329
+ /**
330
+ * Change the process's current working directory to the specified path. If no
331
+ * path is specified, moves to the user's home directory.
332
+ *
333
+ * Provides the same functionality as the shell builtin of the same name.
334
+ */
335
+ declare function cd(path?: string): void;
336
+
337
+ /** A string representing who a permission applies to. */
338
+ declare type ChmodPermissionsWho =
339
+ | "user"
340
+ | "group"
341
+ | "others"
342
+ | "all"
343
+ | "u"
344
+ | "g"
345
+ | "o"
346
+ | "a"
347
+ | "ug"
348
+ | "go"
349
+ | "uo";
350
+
351
+ /** A string representing the access level for the given permission. */
352
+ declare type ChmodPermissionsWhat =
353
+ | "read"
354
+ | "write"
355
+ | "execute"
356
+ | "readwrite"
357
+ | "none"
358
+ | "full"
359
+ | "r"
360
+ | "w"
361
+ | "x"
362
+ | "rw"
363
+ | "rx"
364
+ | "wx"
365
+ | "rwx";
366
+
367
+ /**
368
+ * Set the permission bits for the specified file.
369
+ *
370
+ * @param permissions The permission bits to set. This can be a number, a string containing an octal number, or an object.
371
+ * @param path The path to the file.
372
+ */
373
+ declare function chmod(
374
+ permissions:
375
+ | number
376
+ | string
377
+ | Record<ChmodPermissionsWho, ChmodPermissionsWhat>,
378
+ path: string
379
+ ): void;
156
380
 
157
381
  /**
158
382
  * Removes the final component from a path string.
@@ -162,11 +386,9 @@ declare function realpath(path: string): string;
162
386
  declare function dirname(path: string): string;
163
387
 
164
388
  /**
165
- * Return the last component of a path string.
166
- *
167
- * Provides the same functionality as the unix binary of the same name.
389
+ * Print one or more values to stdout.
168
390
  */
169
- declare function basename(path: string): string;
391
+ declare const echo: typeof console.log;
170
392
 
171
393
  /**
172
394
  * Returns the file extension of the file at a given path.
@@ -181,71 +403,55 @@ declare function extname(
181
403
  ): string;
182
404
 
183
405
  /**
184
- * A namespace object providing several path-string-related APIs.
406
+ * Return the contents of a directory, as absolute paths. `.` and `..` are
407
+ * omitted.
408
+ *
409
+ * Use the `relativePaths` option to get relative paths instead (relative to
410
+ * the parent directory).
185
411
  */
186
- declare const paths: {
187
- /**
188
- * The separator character the host operating system uses between path
189
- * components, ie. the slashes in a filepath. On windows, it's a backslash, and
190
- * on all other OSes, it's a forward slash.
191
- */
192
- OS_PATH_SEPARATOR: "/" | "\\";
193
-
194
- /**
195
- * Split a path string (or array of path strings) on / or \\, returning an
196
- * Array of strings.
197
- *
198
- * Trailing slashes and duplicate path separators will be removed.
199
- *
200
- * If the path starts with `/`, the first string in the Array will be empty.
201
- */
202
- split(path: string | Array<string>): Array<string>;
203
-
204
- /**
205
- * Detect which path separator is present in the given path or array of
206
- * paths: `\` or `/`.
207
- *
208
- * If neither is present, `/` will be returned.
209
- */
210
- detectSeparator(input: string | Array<string>): string;
412
+ declare function ls(
413
+ dir?: string,
414
+ options?: { relativePaths?: boolean }
415
+ ): Array<string>;
211
416
 
212
- /**
213
- * Create a path string from one or more path or path component strings.
214
- * {@link paths.OS_PATH_SEPARATOR} will be used to combine parts.
215
- *
216
- * This function does not resolve `..` or `.`. Use {@link paths.resolve} for that.
217
- */
218
- join(...parts: Array<string>): string;
417
+ /**
418
+ * Print data to stdout using C-style format specifiers.
419
+ */
420
+ declare function printf(format: string, ...args: Array<any>): void;
219
421
 
220
- /**
221
- * Resolves all `..` and `.` components in a path, returning an absolute
222
- * path.
223
- *
224
- * Use `from` to specify where leading `.` or `..` characters should be
225
- * resolved relative to. If unspecified, it defaults to `pwd()`.
226
- */
227
- resolve(path: string, from?: string): string;
422
+ /**
423
+ * Return the process's current working directory.
424
+ *
425
+ * Provides the same functionality as the shell builtin of the same name.
426
+ */
427
+ declare function pwd(): string;
228
428
 
229
- /**
230
- * Returns whether the path starts with either a leading slash or a windows
231
- * drive letter.
232
- */
233
- isAbsolute(path: string): boolean;
234
- };
429
+ /**
430
+ * Read a symlink.
431
+ *
432
+ * Returns the target of the symlink, which may be absolute or relative.
433
+ *
434
+ * Provides the same functionality as the unix binary of the same name.
435
+ */
436
+ declare function readlink(path: string): string;
235
437
 
236
438
  /**
237
- * The absolute path to the current file (whether script or module).
439
+ * Get the absolute path given a relative path. Symlinks are also resolved.
238
440
  *
239
- * Behaves the same as in Node.js, except that it's present within ES modules.
441
+ * The path's target file/directory must exist.
442
+ *
443
+ * Provides the same functionality as the unix binary of the same name.
240
444
  */
241
- declare const __filename: string;
445
+ declare function realpath(path: string): string;
242
446
 
243
447
  /**
244
- * The absolute path to the directory the current file is inside of.
448
+ * If the file at `path` exists, update its creation/modification timestamps.
245
449
  *
246
- * Behaves the same as in Node.js, except that it's present within ES modules.
450
+ * Otherwise, create an empty file at that path.
451
+ *
452
+ * @param path The target path for the file.
247
453
  */
248
- declare const __dirname: string;
454
+ declare function touch(path: string): void;
249
455
 
250
456
  declare type BaseExecOptions = {
251
457
  /** Sets the current working directory for the child process. */
@@ -428,11 +634,6 @@ declare function glob(
428
634
  options?: GlobOptions
429
635
  ): Array<string>;
430
636
 
431
- /**
432
- * Print one or more values to stdout.
433
- */
434
- declare const echo: typeof console.log;
435
-
436
637
  /**
437
638
  * Remove ANSI control characters from a string.
438
639
  */
@@ -509,6 +710,178 @@ declare function hidden(input: string | number): string;
509
710
  /** Wrap a string with the ANSI control characters that will make it print with a horizontal line through its center. */
510
711
  declare function strikethrough(input: string | number): string;
511
712
 
713
+ /** Split `str` on newline and then return lines matching `pattern`. */
714
+ declare const grepString: {
715
+ /** Split `str` on newline and then return lines matching `pattern`. */
716
+ (str: string, pattern: string | RegExp): Array<string>;
717
+
718
+ /** Split `str` on newline and then return lines matching `pattern`. */
719
+ (
720
+ str: string,
721
+ pattern: string | RegExp,
722
+ options: { inverse: false }
723
+ ): Array<string>;
724
+
725
+ /** Split `str` on newline and then return lines NOT matching `pattern`. */
726
+ (
727
+ str: string,
728
+ pattern: string | RegExp,
729
+ options: { inverse: true }
730
+ ): Array<string>;
731
+
732
+ /** Split `str` on newline and then return lines matching `pattern`. */
733
+ (
734
+ str: string,
735
+ pattern: string | RegExp,
736
+ options: { details: false }
737
+ ): Array<string>;
738
+
739
+ /** Split `str` on newline and then return lines matching `pattern`. */
740
+ (
741
+ str: string,
742
+ pattern: string | RegExp,
743
+ options: { inverse: false; details: false }
744
+ ): Array<string>;
745
+
746
+ /** Split `str` on newline and then return lines NOT matching `pattern`. */
747
+ (
748
+ str: string,
749
+ pattern: string | RegExp,
750
+ options: { inverse: true; details: false }
751
+ ): Array<string>;
752
+
753
+ /** Split `str` on newline and then return info about lines matching `pattern`. */
754
+ (str: string, pattern: string | RegExp, options: { details: true }): Array<{
755
+ lineNumber: number;
756
+ lineContent: string;
757
+ matches: RegExpMatchArray;
758
+ }>;
759
+
760
+ /** Split `str` on newline and then return info about lines matching `pattern`. */
761
+ (
762
+ str: string,
763
+ pattern: string | RegExp,
764
+ options: { inverse: false; details: true }
765
+ ): Array<string>;
766
+
767
+ /** Split `str` on newline and then return info about lines NOT matching `pattern`. */
768
+ (
769
+ str: string,
770
+ pattern: string | RegExp,
771
+ options: { inverse: true; details: true }
772
+ ): Array<string>;
773
+ };
774
+
775
+ /** Read the content at `path`, split it on newline, and then return lines matching `pattern`. */
776
+ declare const grepFile: {
777
+ /** Read the content at `path`, split it on newline, and then return lines matching `pattern`. */
778
+ (path: string, pattern: string | RegExp): Array<string>;
779
+
780
+ /** Read the content at `path`, split it on newline, and then return lines matching `pattern`. */
781
+ (
782
+ path: string,
783
+ pattern: string | RegExp,
784
+ options: { inverse: false }
785
+ ): Array<string>;
786
+
787
+ /** Read the content at `path`, split it on newline, and then return lines NOT matching `pattern`. */
788
+ (
789
+ path: string,
790
+ pattern: string | RegExp,
791
+ options: { inverse: true }
792
+ ): Array<string>;
793
+
794
+ /** Read the content at `path`, split it on newline, and then return lines matching `pattern`. */
795
+ (
796
+ path: string,
797
+ pattern: string | RegExp,
798
+ options: { details: false }
799
+ ): Array<string>;
800
+
801
+ /** Read the content at `path`, split it on newline, and then return lines matching `pattern`. */
802
+ (
803
+ path: string,
804
+ pattern: string | RegExp,
805
+ options: { inverse: false; details: false }
806
+ ): Array<string>;
807
+
808
+ /** Read the content at `path`, split it on newline, and then return lines NOT matching `pattern`. */
809
+ (
810
+ path: string,
811
+ pattern: string | RegExp,
812
+ options: { inverse: true; details: false }
813
+ ): Array<string>;
814
+
815
+ /** Read the content at `path`, split it on newline, and then return info about lines matching `pattern`. */
816
+ (path: string, pattern: string | RegExp, options: { details: true }): Array<{
817
+ lineNumber: number;
818
+ lineContent: string;
819
+ matches: RegExpMatchArray;
820
+ }>;
821
+
822
+ /** Read the content at `path`, split it on newline, and then return info about lines matching `pattern`. */
823
+ (
824
+ path: string,
825
+ pattern: string | RegExp,
826
+ options: { inverse: false; details: true }
827
+ ): Array<string>;
828
+
829
+ /** Read the content at `path`, split it on newline, and then return info about lines NOT matching `pattern`. */
830
+ (
831
+ path: string,
832
+ pattern: string | RegExp,
833
+ options: { inverse: true; details: true }
834
+ ): Array<string>;
835
+ };
836
+
837
+ interface String {
838
+ // Same as grepString but without the first argument.
839
+ grep: {
840
+ /** Split the string on newline and then return lines matching `pattern`. */
841
+ (pattern: string | RegExp): Array<string>;
842
+
843
+ /** Split the string on newline and then return lines matching `pattern`. */
844
+ (pattern: string | RegExp, options: { inverse: false }): Array<string>;
845
+
846
+ /** Split the string on newline and then return lines NOT matching `pattern`. */
847
+ (pattern: string | RegExp, options: { inverse: true }): Array<string>;
848
+
849
+ /** Split the string on newline and then return lines matching `pattern`. */
850
+ (pattern: string | RegExp, options: { details: false }): Array<string>;
851
+
852
+ /** Split the string on newline and then return lines matching `pattern`. */
853
+ (
854
+ pattern: string | RegExp,
855
+ options: { inverse: false; details: false }
856
+ ): Array<string>;
857
+
858
+ /** Split the string on newline and then return lines NOT matching `pattern`. */
859
+ (
860
+ pattern: string | RegExp,
861
+ options: { inverse: true; details: false }
862
+ ): Array<string>;
863
+
864
+ /** Split the string on newline and then return info about lines matching `pattern`. */
865
+ (pattern: string | RegExp, options: { details: true }): Array<{
866
+ lineNumber: number;
867
+ lineContent: string;
868
+ matches: RegExpMatchArray;
869
+ }>;
870
+
871
+ /** Split the string on newline and then return info about lines matching `pattern`. */
872
+ (
873
+ pattern: string | RegExp,
874
+ options: { inverse: false; details: true }
875
+ ): Array<string>;
876
+
877
+ /** Split the string on newline and then return info about lines NOT matching `pattern`. */
878
+ (
879
+ pattern: string | RegExp,
880
+ options: { inverse: true; details: true }
881
+ ): Array<string>;
882
+ };
883
+ }
884
+
512
885
  declare type TypedArray =
513
886
  | Int8Array
514
887
  | Uint8Array
@@ -538,7 +911,7 @@ declare const is: {
538
911
  boolean(value: any): value is boolean;
539
912
  Boolean(value: any): value is boolean;
540
913
  bigint(value: any): value is bigint;
541
- BigInt(value: any): value is BigInt;
914
+ BigInt(value: any): value is bigint;
542
915
  symbol(value: any): value is symbol;
543
916
  Symbol(value: any): value is symbol;
544
917
  null(value: any): value is null;
@@ -611,6 +984,132 @@ declare const is: {
611
984
  };
612
985
  };
613
986
 
987
+ declare const assert: {
988
+ /**
989
+ * Throws an error if `value` is not truthy.
990
+ *
991
+ * @param value - The value to test for truthiness
992
+ * @param message - An optional error message to use. If unspecified, "Assertion failed" will be used.
993
+ */
994
+ <ValueType>(
995
+ value: ValueType,
996
+ message?: string
997
+ ): asserts value is ValueType extends null | undefined | false | 0 | ""
998
+ ? never
999
+ : ValueType;
1000
+
1001
+ string(value: any, message?: string): asserts value is string;
1002
+ String(value: any, message?: string): asserts value is string;
1003
+ number(value: any, message?: string): asserts value is number;
1004
+ Number(value: any, message?: string): asserts value is number;
1005
+ boolean(value: any, message?: string): asserts value is boolean;
1006
+ Boolean(value: any, message?: string): asserts value is boolean;
1007
+ bigint(value: any, message?: string): asserts value is bigint;
1008
+ BigInt(value: any, message?: string): asserts value is bigint;
1009
+ symbol(value: any, message?: string): asserts value is symbol;
1010
+ Symbol(value: any, message?: string): asserts value is symbol;
1011
+ null(value: any, message?: string): asserts value is null;
1012
+ undefined(value: any, message?: string): asserts value is undefined;
1013
+ void(value: any, message?: string): asserts value is null | undefined;
1014
+ object(
1015
+ value: any,
1016
+ message?: string
1017
+ ): asserts value is {
1018
+ [key: string]: unknown;
1019
+ [key: number]: unknown;
1020
+ [key: symbol]: unknown;
1021
+ };
1022
+ Object(
1023
+ value: any,
1024
+ message?: string
1025
+ ): asserts value is {
1026
+ [key: string]: unknown;
1027
+ [key: number]: unknown;
1028
+ [key: symbol]: unknown;
1029
+ };
1030
+ Array(value: any, message?: string): asserts value is unknown[];
1031
+ function(
1032
+ value: any,
1033
+ message?: string
1034
+ ): asserts value is Function & {
1035
+ [key: string]: unknown;
1036
+ [key: number]: unknown;
1037
+ [key: symbol]: unknown;
1038
+ };
1039
+ Function(
1040
+ value: any,
1041
+ message?: string
1042
+ ): asserts value is Function & {
1043
+ [key: string]: unknown;
1044
+ [key: number]: unknown;
1045
+ [key: symbol]: unknown;
1046
+ };
1047
+ tagged(value: any, tag: string, message?: string): void;
1048
+ instanceOf<T>(value: any, klass: new (...args: any) => T): asserts value is T;
1049
+ Error(value: any, message?: string): asserts value is Error;
1050
+ Infinity(value: any, message?: string): asserts value is number;
1051
+ NegativeInfinity(value: any, message?: string): asserts value is number;
1052
+ NaN(value: any, message?: string): asserts value is number;
1053
+ Date(value: any, message?: string): asserts value is Date;
1054
+ RegExp(value: any, message?: string): asserts value is RegExp;
1055
+ Map(value: any, message?: string): asserts value is Map<unknown, unknown>;
1056
+ Set(value: any, message?: string): asserts value is Set<unknown>;
1057
+ WeakMap(value: any, message?: string): asserts value is Map<unknown, unknown>;
1058
+ WeakSet(value: any, message?: string): asserts value is Set<unknown>;
1059
+ ArrayBuffer(value: any, message?: string): asserts value is ArrayBuffer;
1060
+ SharedArrayBuffer(
1061
+ value: any,
1062
+ message?: string
1063
+ ): asserts value is SharedArrayBuffer;
1064
+ DataView(value: any, message?: string): asserts value is DataView;
1065
+ TypedArray(value: any, message?: string): asserts value is TypedArray;
1066
+ Int8Array(value: any, message?: string): asserts value is Int8Array;
1067
+ Uint8Array(value: any, message?: string): asserts value is Uint8Array;
1068
+ Uint8ClampedArray(
1069
+ value: any,
1070
+ message?: string
1071
+ ): asserts value is Uint8ClampedArray;
1072
+ Int16Array(value: any, message?: string): asserts value is Int16Array;
1073
+ Uint16Array(value: any, message?: string): asserts value is Uint16Array;
1074
+ Int32Array(value: any, message?: string): asserts value is Int32Array;
1075
+ Uint32Array(value: any, message?: string): asserts value is Uint32Array;
1076
+ Float32Array(value: any, message?: string): asserts value is Float32Array;
1077
+ Float64Array(value: any, message?: string): asserts value is Float64Array;
1078
+ Promise(value: any, message?: string): asserts value is Promise<unknown>;
1079
+ Generator(
1080
+ value: any,
1081
+ message?: string
1082
+ ): asserts value is Generator<unknown, any, unknown>;
1083
+ GeneratorFunction(
1084
+ value: any,
1085
+ message?: string
1086
+ ): asserts value is GeneratorFunction;
1087
+ AsyncFunction(
1088
+ value: any,
1089
+ message?: string
1090
+ ): asserts value is ((...args: any) => Promise<unknown>) & {
1091
+ [key: string]: unknown;
1092
+ [key: number]: unknown;
1093
+ [key: symbol]: unknown;
1094
+ };
1095
+ AsyncGenerator(
1096
+ value: any
1097
+ ): asserts value is AsyncGenerator<unknown, any, unknown>;
1098
+ AsyncGeneratorFunction(
1099
+ value: any,
1100
+ message?: string
1101
+ ): asserts value is AsyncGeneratorFunction;
1102
+
1103
+ FILE(value: any, message?: string): asserts value is FILE;
1104
+
1105
+ JSX: {
1106
+ /** Returns whether `value` is a JSX Element object as created via JSX syntax. */
1107
+ Element(value: any, message?: string): asserts value is JSX.Element;
1108
+ /** Returns whether `value` is a JSX fragment element as created via JSX syntax. */
1109
+ Fragment(value: any, message?: string): asserts value is JSX.Fragment;
1110
+ };
1111
+ };
1112
+
614
1113
  /**
615
1114
  * The data source of a pipe operation; either an in-memory object, or a
616
1115
  * file stream.
@@ -647,7 +1146,7 @@ declare type PipeSource =
647
1146
  * - Use `intoNew` to put data into a new object.
648
1147
  * - Use `path` or `fd` to create a new file handle and put data into it.
649
1148
  */
650
- export type PipeDestination =
1149
+ declare type PipeDestination =
651
1150
  | ArrayBuffer
652
1151
  | SharedArrayBuffer
653
1152
  | DataView
@@ -690,6 +1189,25 @@ declare function pipe<Dest extends PipeDestination>(
690
1189
  : never;
691
1190
  };
692
1191
 
1192
+ /**
1193
+ * Launch the Yavascript REPL (read-eval-print-loop).
1194
+ *
1195
+ * @param context Variables to make available as globals within the repl.
1196
+ * @param lang The langauge to use in the repl. Defaults to "javascript".
1197
+ */
1198
+ declare function startRepl(
1199
+ context?: { [key: string]: any },
1200
+ lang?:
1201
+ | "js"
1202
+ | "javascript"
1203
+ | "ts"
1204
+ | "typescript"
1205
+ | "jsx"
1206
+ | "tsx"
1207
+ | "coffee"
1208
+ | "coffeescript"
1209
+ ): void;
1210
+
693
1211
  /**
694
1212
  * Returns the absolute path to the root folder of the git/hg repo.
695
1213
  *
@@ -825,6 +1343,51 @@ declare namespace JSX {
825
1343
  };
826
1344
  }
827
1345
 
1346
+ declare const YAML: {
1347
+ /**
1348
+ * Parse a YAML document (`input`) into a JSON-compatible value.
1349
+ */
1350
+ parse(
1351
+ input: string,
1352
+ reviver?: (this: any, key: string, value: any) => any
1353
+ ): any;
1354
+
1355
+ /**
1356
+ * Convert a JSON-compatible value into a YAML document.
1357
+ */
1358
+ stringify(
1359
+ input: any,
1360
+ replacer?:
1361
+ | ((this: any, key: string, value: any) => any)
1362
+ | (number | string)[]
1363
+ | null,
1364
+ indent?: number
1365
+ ): string;
1366
+ };
1367
+
1368
+ declare const CSV: {
1369
+ /**
1370
+ * Parse a CSV string into an Array of Arrays of strings.
1371
+ *
1372
+ * The outer array holds the rows, and the inner arrays hold the items in
1373
+ * each row.
1374
+ */
1375
+ parse(input: string): Array<Array<string>>;
1376
+
1377
+ /**
1378
+ * Convert an Array of Arrays of strings into a CSV string.
1379
+ *
1380
+ * The outer array holds the rows, and the inner arrays hold the items in
1381
+ * each row.
1382
+ */
1383
+ stringify(input: Array<Array<string>>): string;
1384
+ };
1385
+
1386
+ interface RegExpConstructor {
1387
+ /** See https://github.com/tc39/proposal-regex-escaping */
1388
+ escape(str: any): string;
1389
+ }
1390
+
828
1391
  // prettier-ignore
829
1392
  /** Any integer in the range [0, 255]. */
830
1393
  declare type byte =
@@ -915,7 +1478,7 @@ declare interface FILE {
915
1478
  close(): void;
916
1479
 
917
1480
  /** Outputs the string with the UTF-8 encoding. */
918
- puts(str: string): void;
1481
+ puts(...strings: Array<string>): void;
919
1482
 
920
1483
  /**
921
1484
  * Formatted printf.
@@ -1015,6 +1578,15 @@ declare module "std" {
1015
1578
  basename?: string
1016
1579
  ): { [key: string]: any };
1017
1580
 
1581
+ /**
1582
+ * Return the resolved path to a module.
1583
+ *
1584
+ * @param filename - The relative or absolute path to the file to import. Relative paths are resolved relative to the file calling `importModule`, or `basename` if present.
1585
+ * @param basename - If present and `filename` is a relative path, `filename` will be resolved relative to this basename.
1586
+ * @returns The resolved module path.
1587
+ */
1588
+ export function resolveModule(filename: string, basename?: string): string;
1589
+
1018
1590
  /**
1019
1591
  * Load the file `filename` and return it as a string assuming UTF-8 encoding.
1020
1592
  *
@@ -1029,7 +1601,7 @@ declare module "std" {
1029
1601
  *
1030
1602
  * @param stackLevels - How many levels up the stack to search for a filename. Defaults to 0, which uses the current stack frame.
1031
1603
  */
1032
- export function getFileNameFromStack(stackLevels: number): string;
1604
+ export function getFileNameFromStack(stackLevels?: number): string;
1033
1605
 
1034
1606
  /**
1035
1607
  * Return a boolean indicating whether the provided value is a FILE object.
@@ -1078,7 +1650,7 @@ declare module "std" {
1078
1650
  export function tmpfile(): FILE;
1079
1651
 
1080
1652
  /** Equivalent to `std.out.puts(str)`. */
1081
- export function puts(str: string): void;
1653
+ export function puts(...strings: Array<string>): void;
1082
1654
 
1083
1655
  /** Equivalent to `std.out.printf(fmt, ...args)` */
1084
1656
  export function printf(fmt: string, ...args: Array<any>): void;
@@ -1533,16 +2105,19 @@ declare module "os" {
1533
2105
  /** Sleep for `delay_ms` milliseconds. */
1534
2106
  export function sleep(delay_ms: number): void;
1535
2107
 
1536
- export type Timer = number & { __is: "Timer" };
2108
+ export type OSTimer = { [Symbol.toStringTag]: "OSTimer" };
1537
2109
 
1538
2110
  /** Call the function func after delay ms. Return a handle to the timer. */
1539
- export function setTimeout(func: () => void, delay: number): Timer;
2111
+ export function setTimeout(
2112
+ func: (...args: any) => any,
2113
+ delay: number
2114
+ ): OSTimer;
1540
2115
 
1541
2116
  /** Cancel a timer. */
1542
- export function clearTimeout(handle: Timer): void;
2117
+ export function clearTimeout(handle: OSTimer): void;
1543
2118
 
1544
- /** Return a string representing the platform: "linux", "darwin", "win32" or "js". */
1545
- export var platform: "linux" | "darwin" | "win32" | "js";
2119
+ /** Return a string representing the platform: "linux", "darwin", "win32", "freebsd", or "js" (emscripten). */
2120
+ export var platform: "linux" | "darwin" | "win32" | "freebsd" | "js";
1546
2121
 
1547
2122
  /**
1548
2123
  * Things that can be put into Worker.postMessage.
@@ -1630,6 +2205,12 @@ declare module "os" {
1630
2205
 
1631
2206
  /** `access` Unix system call; checks if a file is readable, writable, executable, and/or exists (use {@link R_OK}, {@link W_OK}, {@link X_OK}, and/or {@link F_OK} for `accessMode`). Throws a descriptive error (with errno property) if the requested access is not available; otherwise, returns undefined. */
1632
2207
  export function access(path: string, accessMode: number): void;
2208
+
2209
+ /** gets the path to the executable which is executing this JS code. might be a relative path or symlink. */
2210
+ export function execPath(): string;
2211
+
2212
+ /** changes the access permission bits of the file at `path` using the octal number `mode`. */
2213
+ export function chmod(path: string, mode: number): void;
1633
2214
  }
1634
2215
 
1635
2216
  /**
@@ -1783,10 +2364,13 @@ declare class Module {
1783
2364
  *
1784
2365
  * The key for each property in this object should be a file extension
1785
2366
  * string with a leading dot, eg `".jsx"`. The value for each property should
1786
- * be a function which receives the filepath to a module, and should
1787
- * synchronously load that file, then return a string containing JavaScript
1788
- * code that corresponds to that module. In many cases, these functions will
1789
- * compile the contents of the file from one format into JavaScript.
2367
+ * be a function which receives (1) the filepath to a module, and (2) that
2368
+ * file's content as a UTF-8 string, and the function should return a string
2369
+ * containing JavaScript code that corresponds to that module. In most cases,
2370
+ * these functions will compile the contents of the file from one format into JavaScript.
2371
+ *
2372
+ * The function does not have to use the second 'content' argument it
2373
+ * receives (ie. when loading binary files).
1790
2374
  *
1791
2375
  * By adding to this object, you can make it possible to import non-js
1792
2376
  * filetypes; compile-to-JS languages like JSX, TypeScript, and CoffeeScript
@@ -1797,8 +2381,7 @@ declare class Module {
1797
2381
  * ```js
1798
2382
  * import * as std from "std";
1799
2383
  *
1800
- * Module.compilers[".txt"] = (filename) => {
1801
- * const content = std.loadFile(filename);
2384
+ * Module.compilers[".txt"] = (filename, content) => {
1802
2385
  * return `export default ${JSON.stringify(content)}`;
1803
2386
  * }
1804
2387
  * ```
@@ -1815,8 +2398,14 @@ declare class Module {
1815
2398
  * {@link Module.searchExtensions}.
1816
2399
  */
1817
2400
  static compilers: {
1818
- [extensionWithDot: string]: (filename: string) => string;
2401
+ [extensionWithDot: string]: (filename: string, content: string) => string;
1819
2402
  };
2403
+
2404
+ /**
2405
+ * Create a virtual built-in module whose exports consist of the own
2406
+ * enumerable properties of `obj`.
2407
+ */
2408
+ static define(name: string, obj: { [key: string]: any }): void;
1820
2409
  }
1821
2410
 
1822
2411
  /**
@@ -1851,4 +2440,71 @@ declare class Module {
1851
2440
  * will use those, too. It will search in the same order as the strings appear
1852
2441
  * in the `Module.searchExtensions` array.
1853
2442
  */
1854
- declare var require: (source: string) => Module;
2443
+ declare var require: ((source: string) => { [key: string]: any }) & {
2444
+ /**
2445
+ * Resolves the normalized path to a modules, relative to the calling file.
2446
+ */
2447
+ resolve: (source: string) => string;
2448
+ };
2449
+
2450
+ declare var setTimeout: typeof import("os").setTimeout;
2451
+ declare var clearTimeout: typeof import("os").clearTimeout;
2452
+
2453
+ declare type Interval = { [Symbol.toStringTag]: "Interval" };
2454
+
2455
+ declare function setInterval(func: (...args: any) => any, ms: number): Interval;
2456
+ declare function clearInterval(interval: Interval): void;
2457
+
2458
+ interface StringConstructor {
2459
+ /**
2460
+ * A no-op template literal tag.
2461
+ *
2462
+ * https://github.com/tc39/proposal-string-cooked
2463
+ */
2464
+ cooked(
2465
+ strings: readonly string[] | ArrayLike<string>,
2466
+ ...substitutions: any[]
2467
+ ): string;
2468
+
2469
+ /**
2470
+ * Remove leading minimum indentation from the string.
2471
+ * The first line of the string must be empty.
2472
+ *
2473
+ * https://github.com/tc39/proposal-string-dedent
2474
+ */
2475
+ dedent: {
2476
+ /**
2477
+ * Remove leading minimum indentation from the string.
2478
+ * The first line of the string must be empty.
2479
+ *
2480
+ * https://github.com/tc39/proposal-string-dedent
2481
+ */
2482
+ (input: string): string;
2483
+
2484
+ /**
2485
+ * Remove leading minimum indentation from the template literal.
2486
+ * The first line of the string must be empty.
2487
+ *
2488
+ * https://github.com/tc39/proposal-string-dedent
2489
+ */
2490
+ (
2491
+ strings: readonly string[] | ArrayLike<string>,
2492
+ ...substitutions: any[]
2493
+ ): string;
2494
+
2495
+ /**
2496
+ * Wrap another template tag function such that tagged literals
2497
+ * become dedented before being passed to the wrapped function.
2498
+ *
2499
+ * https://www.npmjs.com/package/string-dedent#usage
2500
+ */
2501
+ <
2502
+ Func extends (
2503
+ strings: readonly string[] | ArrayLike<string>,
2504
+ ...substitutions: any[]
2505
+ ) => string
2506
+ >(
2507
+ input: Func
2508
+ ): Func;
2509
+ };
2510
+ }
Binary file
Binary file
Binary file