55
66import type extname from '#lib/extname'
77import type {
8- ErrInvalidArgType ,
98 ErrInvalidArgValue ,
109 ErrInvalidFileUrlHost ,
1110 ErrInvalidFileUrlPath ,
@@ -36,8 +35,10 @@ interface Pathe extends PosixPlatformPath {
3635 * Does nothing if a file extension is not provided, or the
3736 * {@linkcode extname} of `path` is already `ext`.
3837 *
38+ * @this {void}
39+ *
3940 * @param {string } path
40- * Path to handle
41+ * The path to handle
4142 * @param {string | null | undefined } ext
4243 * File extension to add
4344 * @return {string }
@@ -52,8 +53,10 @@ interface Pathe extends PosixPlatformPath {
5253 * If the file extension is an empty string, however, `path`'s file extension
5354 * will be removed.
5455 *
56+ * @this {void}
57+ *
5558 * @param {string } path
56- * Path to handle
59+ * The path to handle
5760 * @param {string | null | undefined } [ext]
5861 * File extension to add
5962 * @return {string } `path` unmodified or with changed file extension
@@ -64,6 +67,8 @@ interface Pathe extends PosixPlatformPath {
6467 /**
6568 * Get the path to the current working directory.
6669 *
70+ * @this {void}
71+ *
6772 * @return {string }
6873 * Absolute path to current working directory
6974 */
@@ -84,34 +89,37 @@ interface Pathe extends PosixPlatformPath {
8489 * @see {@linkcode Ext }
8590 * @see {@linkcode extname }
8691 *
92+ * @this {void}
93+ *
8794 * @param {string } path
88- * Path to handle
95+ * The path to handle
8996 * @return {Ext[] }
9097 * List of extensions
9198 */
92- extnames ( path : string ) : Ext [ ]
99+ extnames ( this : void , path : string ) : Ext [ ]
93100
94101 /**
95102 * Convert a `file:` URL to a path.
96103 *
97- * @see {@linkcode ErrInvalidArgType }
98104 * @see {@linkcode ErrInvalidFileUrlHost }
99105 * @see {@linkcode ErrInvalidFileUrlPath }
100106 * @see {@linkcode ErrInvalidUrlScheme }
101107 * @see {@linkcode PlatformOptions }
102108 *
109+ * @this {void}
110+ *
103111 * @param {URL | string } url
104112 * The file URL string or URL object to convert to a path
105113 * @param {PlatformOptions | null | undefined } [options]
106114 * Platform options
107115 * @return {string }
108116 * `url` as path
109- * @throws {ErrInvalidArgType }
110117 * @throws {ErrInvalidFileUrlHost }
111118 * @throws {ErrInvalidFileUrlPath }
112119 * @throws {ErrInvalidUrlScheme }
113120 */
114121 fileURLToPath (
122+ this : void ,
115123 url : URL | string ,
116124 options ?: PlatformOptions | null | undefined
117125 ) : string
@@ -122,6 +130,8 @@ interface Pathe extends PosixPlatformPath {
122130 * @see {@linkcode EmptyString }
123131 * @see {@linkcode Ext }
124132 *
133+ * @this {void}
134+ *
125135 * @param {string | null | undefined } ext
126136 * File extension to format
127137 * @return {EmptyString | Ext }
@@ -134,6 +144,8 @@ interface Pathe extends PosixPlatformPath {
134144 *
135145 * @see {@linkcode DeviceRoot }
136146 *
147+ * @this {void}
148+ *
137149 * @param {unknown } [value]
138150 * Value to check
139151 * @return {value is DeviceRoot }
@@ -146,6 +158,8 @@ interface Pathe extends PosixPlatformPath {
146158 *
147159 * @see {@linkcode Sep }
148160 *
161+ * @this {void}
162+ *
149163 * @param {unknown } [value]
150164 * Value to check
151165 * @return {value is Sep }
@@ -169,15 +183,18 @@ interface Pathe extends PosixPlatformPath {
169183 * @see {@linkcode ErrInvalidArgValue }
170184 * @see {@linkcode PlatformOptions }
171185 *
186+ * @this {void}
187+ *
172188 * @param {URL | string } path
173- * Path to handle
189+ * The path to handle
174190 * @param {PlatformOptions | null | undefined } [options]
175191 * Platform options
176192 * @return {URL }
177193 * `path` as `file:` URL
178194 * @throws {ErrInvalidArgValue }
179195 */
180196 pathToFileURL (
197+ this : void ,
181198 path : string ,
182199 options ?: PlatformOptions | null | undefined
183200 ) : URL
@@ -188,8 +205,10 @@ interface Pathe extends PosixPlatformPath {
188205 * Does nothing if `path` does not end with the provided file extension, or if
189206 * a file extension is not provided.
190207 *
208+ * @this {void}
209+ *
191210 * @param {string } path
192- * Path to handle
211+ * The path to handle
193212 * @param {string | null | undefined } ext
194213 * File extension to remove
195214 * @return {string }
@@ -220,6 +239,8 @@ interface Pathe extends PosixPlatformPath {
220239 *
221240 * @see {@linkcode Cwd }
222241 *
242+ * @this {void}
243+ *
223244 * @param {ReadonlyArray<string> | string } paths
224245 * Sequence of paths or path segments
225246 * @param {Cwd | null | undefined } [cwd]
@@ -239,31 +260,38 @@ interface Pathe extends PosixPlatformPath {
239260 /**
240261 * Get the root of `path`.
241262 *
263+ * @this {void}
264+ *
242265 * @param {string } path
243- * Path to handle
266+ * The path to handle
244267 * @return {string }
245268 * Root of `path`
246269 */
247270 root ( this : void , path : string ) : string
248271
249272 /**
250- * Make `path` POSIX-compliant.
273+ * Make separators in `path` POSIX-compliant.
251274 *
252- * This includes:
253- *
254- * - Converting Windows-style path delimiters (`;`) to POSIX (`:`)
255- * - Converting Windows-style path segment separators (`\`) to POSIX (`/`)
256- *
257- * @see https://nodejs.org/api/path.html#windows-vs-posix
258- * @see https://nodejs.org/api/path.html#pathdelimiter
259- * @see https://nodejs.org/api/path.html#pathsep
275+ * @this {void}
260276 *
261277 * @param {string } path
262- * Path to handle
278+ * The path to handle
263279 * @return {string }
264- * POSIX-compliant `path`
280+ * `path` with POSIX-compliant separators
265281 */
266282 toPosix ( this : void , path : string ) : string
283+
284+ /**
285+ * Make separators in `url` POSIX-compliant.
286+ *
287+ * @this {void}
288+ *
289+ * @param {string } url
290+ * The {@linkcode URL} to handle
291+ * @return {URL }
292+ * `url` with POSIX-compliant separators
293+ */
294+ toPosix ( this : void , url : URL ) : URL
267295}
268296
269297export type { Pathe as default }
0 commit comments