Skip to content

Commit be154d1

Browse files
committed
docs: [api] functions (not resolver methods)
Signed-off-by: Lexus Drumgold <unicornware@flexdevelopment.llc>
1 parent 8d40c07 commit be154d1

14 files changed

+374
-56
lines changed

README.md

Lines changed: 331 additions & 21 deletions
Large diffs are not rendered by default.

src/lib/can-parse-url.mts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import type { ModuleId } from '@flex-development/mlly'
88
/**
99
* Check if `input` can be parsed to a {@linkcode URL}.
1010
*
11-
* > 👉 **Note**: If `input` is relative, `base` is required. If `input` is
12-
* > absolute, `base` is ignored.
11+
* > 👉 **Note**: If `input` is relative, `base` is required.
12+
* > If `input` is absolute, `base` is ignored.
1313
*
1414
* @see {@linkcode ModuleId}
1515
*
@@ -20,7 +20,7 @@ import type { ModuleId } from '@flex-development/mlly'
2020
* @param {unknown} [base]
2121
* The base URL to resolve against if `input` is not absolute
2222
* @return {boolean}
23-
* `true` if `input` can be parsed to a `URL`
23+
* `true` if `input` can be parsed to a `URL`, `false` otherwise
2424
*/
2525
function canParseUrl(this: void, input: unknown, base?: unknown): boolean {
2626
try {

src/lib/is-absolute-specifier.mts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ import pathe from '@flex-development/pathe'
1111
* Check if `value` is an *absolute specifier*.
1212
*
1313
* ::: warning
14-
* Only checks specifier syntax. Does **not** guarantee the specifier references
15-
* a file that exists.
14+
* Only checks specifier syntax.
15+
* Does **not** guarantee the specifier references an existing module.
1616
* :::
1717
*
1818
* @see https://nodejs.org/api/esm.html#terminology

src/lib/is-bare-specifier.mts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ import { isBuiltin } from '@flex-development/is-builtin'
1111
* Check if `value` is a *bare specifier*.
1212
*
1313
* ::: warning
14-
* Only checks specifier syntax. Does **not** guarantee the specifier references
15-
* a file that exists.
14+
* Only checks specifier syntax.
15+
* Does **not** guarantee the specifier references an existing module.
1616
* :::
1717
*
1818
* @see https://nodejs.org/api/esm.html#terminology

src/lib/is-imports-subpath.mts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,16 @@ import chars from '#internal/chars'
77
import type { ImportsSubpath } from '@flex-development/pkg-types'
88

99
/**
10-
* Check if `value` is an `imports` subpath.
10+
* Check if `value` is an [`imports`][subpath-imports] subpath.
11+
*
12+
* ::: warning
13+
* Only checks specifier syntax.
14+
* Does **not** guarantee the specifier references an existing module.
15+
* :::
16+
*
17+
* [subpath-imports]: https://nodejs.org/api/packages.html#subpath-imports
1118
*
1219
* @see {@linkcode ImportsSubpath}
13-
* @see https://nodejs.org/api/packages.html#subpath-imports
1420
*
1521
* @this {void}
1622
*

src/lib/is-module-id.mts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import type { ModuleId } from '@flex-development/mlly'
77

88
/**
9-
* Check if `value` looks like a module id.
9+
* Check if `value` is a module id.
1010
*
1111
* ::: warning
1212
* Does **not** guarantee `value` references an existing file or directory.
@@ -19,7 +19,7 @@ import type { ModuleId } from '@flex-development/mlly'
1919
* @param {unknown} value
2020
* The value to check
2121
* @return {value is ModuleId}
22-
* `true` if `value` looks like a module id, `false` otherwise
22+
* `true` if `value` is module id, `false` otherwise
2323
*/
2424
function isModuleId(this: void, value: unknown): value is ModuleId {
2525
return typeof value === 'string' || value instanceof URL

src/lib/is-relative-specifier.mts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import pathe from '@flex-development/pathe'
99
* Check if `value` is a *relative specifier*.
1010
*
1111
* ::: warning
12-
* Only checks specifier syntax. Does **not** guarantee the specifier references
13-
* a file that exists.
12+
* Only checks specifier syntax.
13+
* Does **not** guarantee the specifier references an existing module.
1414
* :::
1515
*
1616
* @see https://nodejs.org/api/esm.html#terminology

src/lib/lookup-package-scope.mts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,18 @@ export default lookupPackageScope
2828
*
2929
* @param {EmptyString | null | undefined} url
3030
* The URL of the module to scope
31+
* @param {ModuleId | null | undefined} [end]
32+
* The URL of the directory to end search at, defaults to {@linkcode root}
33+
* @param {FileSystem | null | undefined} [fs]
34+
* The file system API
3135
* @return {null}
3236
* The URL of nearest directory containing a `package.json` file
3337
*/
3438
function lookupPackageScope(
3539
this: void,
36-
url: EmptyString | null | undefined
40+
url: EmptyString | null | undefined,
41+
end?: ModuleId | null | undefined,
42+
fs?: FileSystem | null | undefined
3743
): null
3844

3945
/**
@@ -49,7 +55,7 @@ function lookupPackageScope(
4955
* @see https://github.com/nodejs/node/blob/v22.9.0/doc/api/esm.md#resolution-algorithm-specification
5056
*
5157
* @template {Awaitable<URL | null>} T
52-
* The resolved URL
58+
* The resolved package scope URL
5359
*
5460
* @this {void}
5561
*

src/lib/pattern-key-compare.mts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,7 @@ import type { PatternKeyComparison } from '@flex-development/mlly'
88
import { ok } from 'devlop'
99

1010
/**
11-
* Compare two pattern keys and return a value indicating their order:
12-
*
13-
* - `-1`: `a` should come before `b`
14-
* - `0`: `a` and `b` are equal
15-
* - `1`: `a` should come after `b`
11+
* Compare two pattern keys and return a value indicating their order.
1612
*
1713
* Implements the `PATTERN_KEY_COMPARE` algorithm.
1814
*
@@ -24,9 +20,9 @@ import { ok } from 'devlop'
2420
* @param {string} a
2521
* The first key
2622
* @param {string} b
27-
* The key to compare to `a`
23+
* The key to compare against `a`
2824
* @return {PatternKeyComparison}
29-
* Pattern key comparsion result
25+
* The pattern key comparsion result
3026
*/
3127
function patternKeyCompare(
3228
this: void,

src/lib/pattern-match.mts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { ok } from 'devlop'
1616
* @this {void}
1717
*
1818
* @param {string} matchKey
19-
* The string to expand
19+
* The key to expand
2020
* @param {unknown} matchObject
2121
* The match keys object
2222
* @return {PatternMatch | null}

0 commit comments

Comments
 (0)