Skip to content

Commit 91ba229

Browse files
committed
doc: add types for ArchString OsString LibcString and TargetTriplet
1 parent 1a61d16 commit 91ba229

File tree

3 files changed

+41
-0
lines changed

3 files changed

+41
-0
lines changed

host-targets.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
'use strict';
22

3+
/** @typedef {import('./types.js').OsString} OsString */
4+
/** @typedef {import('./types.js').LibcString} LibcString */
5+
/** @typedef {import('./types.js').ArchString} ArchString */
6+
/** @typedef {import('./types.js').TargetTriplet} TargetTriplet */
7+
38
var HostTargets = module.exports;
49

510
let reVersionOnly = /^[\d\.]+(-RELEASE)?$/;
@@ -112,6 +117,9 @@ HostTargets._MATCHERS = {
112117
mingw: /^MINGW(64_NT)?/,
113118
};
114119

120+
/**
121+
* @param {Object.<"os"|"arch"|"libc", String>} target
122+
*/
115123
HostTargets.termsToTarget = function (target, terms) {
116124
let bogoTerms = [];
117125

triplet.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
* @prop {Array<String>} TERMS_EXTS_SOURCE
1010
*/
1111

12+
/** @typedef {import('./types.js').OsString} OsString */
13+
/** @typedef {import('./types.js').LibcString} LibcString */
14+
/** @typedef {import('./types.js').ArchString} ArchString */
15+
/** @typedef {import('./types.js').TargetTriplet} TargetTriplet */
16+
1217
/** @type {Triplet} */
1318
//@ts-ignore
1419
var Triplet = ('object' === typeof module && exports) || {};

types.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
'use strict';
2+
3+
module.exports._types = true;
4+
5+
/**
6+
* @typedef {""|"ANYOS"|"posix_2017"|"aix"|"android"|"darwin"|"dragonfly"|"freebsd"|"illumos"|"linux"|"netbsd"|"openbsd"|"plan9"|"solaris"|"sunos"|"wasi"|"windows"} OsString
7+
*/
8+
9+
/**
10+
* @typedef {""|"ANYLIBC"|"none"|"bionic"|"gnu"|"libc"|"msvc"|"musl"} LibcString
11+
*/
12+
13+
/**
14+
* @typedef {""|"ANYARCH"|"POSIX"|"aarch64"|"armel"|"armhf"|"armv6"|"armv7"|"armv7a"|"loong64"|"mips"|"mips64"|"mips64el"|"mips64r6"|"mips64r6el"|"mipsel"|"mipsr6"|"mipsr6el"|"ppc"|"ppc64"|"ppc64le"|"riscv64"|"s390x"|"wasm32"|"x86"|"x86_64"|"x86_64_v2"|"x86_64_v3"} ArchString
15+
*/
16+
17+
/**
18+
* @typedef {""|"ANYVENDOR"|"apple"|"pc"|"unknown"} VendorString
19+
*/
20+
21+
/**
22+
* @typedef TargetTriplet
23+
* @prop {OsString} os
24+
* @prop {ArchString} arch
25+
* @prop {LibcString} libc
26+
* @prop {VendorString} [vendor]
27+
* @prop {Boolean} [android] - for intermediary representation
28+
*/

0 commit comments

Comments
 (0)